196de5490SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 396de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 496de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file 596de5490SAndrew Rist * distributed with this work for additional information 696de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file 796de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the 896de5490SAndrew Rist * "License"); you may not use this file except in compliance 996de5490SAndrew Rist * with the License. You may obtain a copy of the License at 1096de5490SAndrew Rist * 1196de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1296de5490SAndrew Rist * 1396de5490SAndrew Rist * Unless required by applicable law or agreed to in writing, 1496de5490SAndrew Rist * software distributed under the License is distributed on an 1596de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1696de5490SAndrew Rist * KIND, either express or implied. See the License for the 1796de5490SAndrew Rist * specific language governing permissions and limitations 1896de5490SAndrew Rist * under the License. 1996de5490SAndrew Rist * 2096de5490SAndrew Rist *************************************************************/ 2196de5490SAndrew Rist 2296de5490SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 26cdf0e10cSrcweir #ifndef DBAUI_TABLEWINDOW_HXX 27cdf0e10cSrcweir #include "TableWindow.hxx" 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef DBAUI_TABLEWINDOWLISTBOX_HXX 30cdf0e10cSrcweir #include "TableWindowListBox.hxx" 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef DBAUI_QUERYTABLEVIEW_HXX 33cdf0e10cSrcweir #include "QueryTableView.hxx" 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef DBAUI_QUERYDESIGNVIEW_HXX 36cdf0e10cSrcweir #include "QueryDesignView.hxx" 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef DBAUI_TABLEWINDOWDATA_HXX 39cdf0e10cSrcweir #include "TableWindowData.hxx" 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #ifndef DBACCESS_IMAGEPROVIDER_HXX 42cdf0e10cSrcweir #include "imageprovider.hxx" 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 45cdf0e10cSrcweir #include <tools/debug.hxx> 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H 48cdf0e10cSrcweir #include <tools/diagnose_ex.h> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX 51cdf0e10cSrcweir #include <vcl/svapp.hxx> 52cdf0e10cSrcweir #endif 53cdf0e10cSrcweir #ifndef _SV_WALL_HXX 54cdf0e10cSrcweir #include <vcl/wall.hxx> 55cdf0e10cSrcweir #endif 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> 58cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 59cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 60cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 61cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 62cdf0e10cSrcweir #include "querycontroller.hxx" 63cdf0e10cSrcweir #include "dbu_qry.hrc" 64cdf0e10cSrcweir #include "dbustrings.hrc" 65cdf0e10cSrcweir #include "Query.hrc" 66cdf0e10cSrcweir #include <comphelper/extract.hxx> 67cdf0e10cSrcweir #include "UITools.hxx" 68cdf0e10cSrcweir #include "TableWindowAccess.hxx" 69cdf0e10cSrcweir #include "browserids.hxx" 70cdf0e10cSrcweir #include <connectivity/dbtools.hxx> 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir using namespace dbaui; 74cdf0e10cSrcweir using namespace ::utl; 75cdf0e10cSrcweir using namespace ::com::sun::star; 76cdf0e10cSrcweir using namespace ::com::sun::star::sdb; 77cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 78cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx; 79cdf0e10cSrcweir using namespace ::com::sun::star::uno; 80cdf0e10cSrcweir using namespace ::com::sun::star::beans; 81cdf0e10cSrcweir using namespace ::com::sun::star::container; 82cdf0e10cSrcweir using namespace ::com::sun::star::lang; 83cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 84cdf0e10cSrcweir 85cdf0e10cSrcweir #define TABWIN_SIZING_AREA 4 86cdf0e10cSrcweir #define LISTBOX_SCROLLING_AREA 6 87cdf0e10cSrcweir #define SCROLLING_TIMESPAN 500 88cdf0e10cSrcweir 89cdf0e10cSrcweir #define TABWIN_WIDTH_MIN 90 90cdf0e10cSrcweir #define TABWIN_HEIGHT_MIN 80 91cdf0e10cSrcweir 92cdf0e10cSrcweir //======================================================================== 93cdf0e10cSrcweir // class OTableWindow 94cdf0e10cSrcweir //======================================================================== 95cdf0e10cSrcweir DBG_NAME(OTableWindow) 96cdf0e10cSrcweir //------------------------------------------------------------------------------ 97cdf0e10cSrcweir OTableWindow::OTableWindow( Window* pParent, const TTableWindowData::value_type& pTabWinData ) 98cdf0e10cSrcweir : ::comphelper::OContainerListener(m_aMutex) 99cdf0e10cSrcweir ,Window( pParent, WB_3DLOOK|WB_MOVEABLE ) 100cdf0e10cSrcweir ,m_aTypeImage( this ) 101cdf0e10cSrcweir ,m_aTitle( this ) 102cdf0e10cSrcweir ,m_pListBox(NULL) 103cdf0e10cSrcweir ,m_pAccessible(NULL) 104cdf0e10cSrcweir ,m_pData( pTabWinData ) 105cdf0e10cSrcweir ,m_nMoveCount(0) 106cdf0e10cSrcweir ,m_nMoveIncrement(1) 107cdf0e10cSrcweir ,m_nSizingFlags( SIZING_NONE ) 108cdf0e10cSrcweir ,m_bActive( sal_False ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir DBG_CTOR(OTableWindow,NULL); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // Position und Groesse bestimmen 113cdf0e10cSrcweir if( GetData()->HasPosition() ) 114cdf0e10cSrcweir SetPosPixel( GetData()->GetPosition() ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir if( GetData()->HasSize() ) 117cdf0e10cSrcweir SetSizePixel( GetData()->GetSize() ); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // Hintergrund setzen 120cdf0e10cSrcweir const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings(); 121cdf0e10cSrcweir SetBackground(Wallpaper(aSystemStyle.GetFaceColor())); 122cdf0e10cSrcweir // und Textfarbe (obwohl ich eigentlich keinen Text habe, aber wer weiss, was 123cdf0e10cSrcweir // abgeleitete Klassen machen) 124cdf0e10cSrcweir SetTextColor(aSystemStyle.GetButtonTextColor()); 125cdf0e10cSrcweir 126cdf0e10cSrcweir EnableClipSiblings(); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir //------------------------------------------------------------------------------ 130cdf0e10cSrcweir OTableWindow::~OTableWindow() 131cdf0e10cSrcweir { 132cdf0e10cSrcweir DBG_DTOR(OTableWindow,NULL); 133cdf0e10cSrcweir 134cdf0e10cSrcweir if (m_pListBox) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!"); 137cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp(m_pListBox); 138cdf0e10cSrcweir m_pListBox = NULL; 139cdf0e10cSrcweir } // if (m_pListBox) 140cdf0e10cSrcweir if ( m_pContainerListener.is() ) 141cdf0e10cSrcweir m_pContainerListener->dispose(); 142cdf0e10cSrcweir 143cdf0e10cSrcweir m_pAccessible = NULL; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir // ----------------------------------------------------------------------------- 146cdf0e10cSrcweir const OJoinTableView* OTableWindow::getTableView() const 147cdf0e10cSrcweir { 148cdf0e10cSrcweir OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!"); 149cdf0e10cSrcweir return static_cast<OJoinTableView*>(GetParent()); 150cdf0e10cSrcweir } 151cdf0e10cSrcweir // ----------------------------------------------------------------------------- 152cdf0e10cSrcweir OJoinTableView* OTableWindow::getTableView() 153cdf0e10cSrcweir { 154cdf0e10cSrcweir OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!"); 155cdf0e10cSrcweir return static_cast<OJoinTableView*>(GetParent()); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir // ----------------------------------------------------------------------------- 158cdf0e10cSrcweir OJoinDesignView* OTableWindow::getDesignView() 159cdf0e10cSrcweir { 160cdf0e10cSrcweir OSL_ENSURE(static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()),"No OJoinDesignView!"); 161cdf0e10cSrcweir return static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()); 162cdf0e10cSrcweir } 163cdf0e10cSrcweir //------------------------------------------------------------------------------ 164cdf0e10cSrcweir void OTableWindow::SetPosPixel( const Point& rNewPos ) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir Point aNewPosData = rNewPos + getTableView()->GetScrollOffset(); 167cdf0e10cSrcweir GetData()->SetPosition( aNewPosData ); 168cdf0e10cSrcweir Window::SetPosPixel( rNewPos ); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir //------------------------------------------------------------------------------ 172cdf0e10cSrcweir void OTableWindow::SetSizePixel( const Size& rNewSize ) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir Size aOutSize(rNewSize); 175cdf0e10cSrcweir if( aOutSize.Width() < TABWIN_WIDTH_MIN ) 176cdf0e10cSrcweir aOutSize.Width() = TABWIN_WIDTH_MIN; 177cdf0e10cSrcweir if( aOutSize.Height() < TABWIN_HEIGHT_MIN ) 178cdf0e10cSrcweir aOutSize.Height() = TABWIN_HEIGHT_MIN; 179cdf0e10cSrcweir 180cdf0e10cSrcweir GetData()->SetSize( aOutSize ); 181cdf0e10cSrcweir Window::SetSizePixel( aOutSize ); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir //------------------------------------------------------------------------------ 184cdf0e10cSrcweir void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir SetPosPixel( rNewPos ); 187cdf0e10cSrcweir SetSizePixel( rNewSize ); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir //------------------------------------------------------------------------------ 190cdf0e10cSrcweir OTableWindowListBox* OTableWindow::CreateListBox() 191cdf0e10cSrcweir { 192cdf0e10cSrcweir return new OTableWindowListBox(this); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir //------------------------------------------------------------------------------ 196cdf0e10cSrcweir sal_Bool OTableWindow::FillListBox() 197cdf0e10cSrcweir { 198cdf0e10cSrcweir m_pListBox->Clear(); 199cdf0e10cSrcweir if ( !m_pContainerListener.is() ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY); 202cdf0e10cSrcweir if ( xContainer.is() ) 203cdf0e10cSrcweir m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir // mark all primary keys with special image 206cdf0e10cSrcweir ModuleRes TmpRes(isHiContrast(m_pListBox) ? IMG_JOINS_H : IMG_JOINS); 207cdf0e10cSrcweir ImageList aImageList(TmpRes); 208cdf0e10cSrcweir Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY); 209cdf0e10cSrcweir 210cdf0e10cSrcweir if (GetData()->IsShowAll()) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir SvLBoxEntry* pEntry = m_pListBox->InsertEntry( ::rtl::OUString::createFromAscii("*") ); 213cdf0e10cSrcweir pEntry->SetUserData( createUserData(NULL,false) ); 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir Reference<XNameAccess> xPKeyColumns; 217cdf0e10cSrcweir try 218cdf0e10cSrcweir { 219cdf0e10cSrcweir xPKeyColumns = dbtools::getPrimaryKeyColumns_throw(m_pData->getTable()); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir catch(Exception&) 222cdf0e10cSrcweir { 223*07a3d7f1SPedro Giffuni OSL_ENSURE(0,"Exception occurred!"); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir try 226cdf0e10cSrcweir { 227cdf0e10cSrcweir Reference< XNameAccess > xColumns = m_pData->getColumns(); 228cdf0e10cSrcweir if( xColumns.is() ) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir Sequence< ::rtl::OUString> aColumns = xColumns->getElementNames(); 231cdf0e10cSrcweir const ::rtl::OUString* pIter = aColumns.getConstArray(); 232cdf0e10cSrcweir const ::rtl::OUString* pEnd = pIter + aColumns.getLength(); 233cdf0e10cSrcweir 234cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL; 235cdf0e10cSrcweir for (; pIter != pEnd; ++pIter) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter ); 238cdf0e10cSrcweir // is this column in the primary key 239cdf0e10cSrcweir if ( bPrimaryKeyColumn ) 240cdf0e10cSrcweir pEntry = m_pListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage); 241cdf0e10cSrcweir else 242cdf0e10cSrcweir pEntry = m_pListBox->InsertEntry(*pIter); 243cdf0e10cSrcweir 244cdf0e10cSrcweir Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY); 245cdf0e10cSrcweir if ( xColumn.is() ) 246cdf0e10cSrcweir pEntry->SetUserData( createUserData(xColumn,bPrimaryKeyColumn) ); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir } 249cdf0e10cSrcweir } 250cdf0e10cSrcweir catch(Exception&) 251cdf0e10cSrcweir { 252*07a3d7f1SPedro Giffuni OSL_ENSURE(0,"Exception occurred!"); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir 255cdf0e10cSrcweir return sal_True; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir // ----------------------------------------------------------------------------- 258cdf0e10cSrcweir void* OTableWindow::createUserData(const Reference< XPropertySet>& /*_xColumn*/,bool /*_bPrimaryKey*/) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir return NULL; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir // ----------------------------------------------------------------------------- 263cdf0e10cSrcweir void OTableWindow::deleteUserData(void*& _pUserData) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir OSL_ENSURE(!_pUserData,"INVALID call. Need to delete the userclass!"); 266cdf0e10cSrcweir _pUserData = NULL; 267cdf0e10cSrcweir } 268cdf0e10cSrcweir //------------------------------------------------------------------------------ 269cdf0e10cSrcweir void OTableWindow::clearListBox() 270cdf0e10cSrcweir { 271cdf0e10cSrcweir if ( m_pListBox ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir SvLBoxEntry* pEntry = m_pListBox->First(); 274cdf0e10cSrcweir 275cdf0e10cSrcweir while(pEntry) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir void* pUserData = pEntry->GetUserData(); 278cdf0e10cSrcweir deleteUserData(pUserData); 279cdf0e10cSrcweir SvLBoxEntry* pNextEntry = m_pListBox->Next(pEntry); 280cdf0e10cSrcweir m_pListBox->GetModel()->Remove(pEntry); 281cdf0e10cSrcweir pEntry = pNextEntry; 282cdf0e10cSrcweir } 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir //------------------------------------------------------------------------------ 287cdf0e10cSrcweir void OTableWindow::impl_updateImage() 288cdf0e10cSrcweir { 289cdf0e10cSrcweir ImageProvider aImageProvider( getDesignView()->getController().getConnection() ); 290cdf0e10cSrcweir 291cdf0e10cSrcweir Image aImage, aImageHC; 292cdf0e10cSrcweir aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage, aImageHC ); 293cdf0e10cSrcweir 294cdf0e10cSrcweir if ( !aImage || !aImageHC ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir OSL_ENSURE( false, "OTableWindow::impl_updateImage: no images!" ); 297cdf0e10cSrcweir return; 298cdf0e10cSrcweir } 299cdf0e10cSrcweir 300cdf0e10cSrcweir m_aTypeImage.SetModeImage( aImage, BMP_COLOR_NORMAL ); 301cdf0e10cSrcweir m_aTypeImage.SetModeImage( aImageHC, BMP_COLOR_HIGHCONTRAST ); 302cdf0e10cSrcweir m_aTypeImage.Show(); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir 305cdf0e10cSrcweir //------------------------------------------------------------------------------ 306cdf0e10cSrcweir sal_Bool OTableWindow::Init() 307cdf0e10cSrcweir { 308cdf0e10cSrcweir // create list box if necessary 309cdf0e10cSrcweir if ( !m_pListBox ) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir m_pListBox = CreateListBox(); 312cdf0e10cSrcweir DBG_ASSERT( m_pListBox != NULL, "OTableWindow::Init() : CreateListBox hat NULL geliefert !" ); 313cdf0e10cSrcweir m_pListBox->SetSelectionMode( MULTIPLE_SELECTION ); 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir // Titel setzen 317cdf0e10cSrcweir m_aTitle.SetText( m_pData->GetWinName() ); 318cdf0e10cSrcweir m_aTitle.Show(); 319cdf0e10cSrcweir 320cdf0e10cSrcweir m_pListBox->Show(); 321cdf0e10cSrcweir 322cdf0e10cSrcweir // die Felder in die ListBox eintragen 323cdf0e10cSrcweir clearListBox(); 324cdf0e10cSrcweir sal_Bool bSuccess = FillListBox(); 325cdf0e10cSrcweir if ( bSuccess ) 326cdf0e10cSrcweir m_pListBox->SelectAll( sal_False ); 327cdf0e10cSrcweir 328cdf0e10cSrcweir impl_updateImage(); 329cdf0e10cSrcweir 330cdf0e10cSrcweir return bSuccess; 331cdf0e10cSrcweir } 332cdf0e10cSrcweir //------------------------------------------------------------------------------ 333cdf0e10cSrcweir void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir if (rDCEvt.GetType() == DATACHANGED_SETTINGS) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir // nehmen wir den worst-case an : die Farben haben sich geaendert, also 338cdf0e10cSrcweir // mich anpassen 339cdf0e10cSrcweir const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings(); 340cdf0e10cSrcweir SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor()))); 341cdf0e10cSrcweir SetTextColor(aSystemStyle.GetButtonTextColor()); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir } 344cdf0e10cSrcweir //------------------------------------------------------------------------------ 345cdf0e10cSrcweir void OTableWindow::Paint( const Rectangle& rRect ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir Rectangle aRect( Point(0,0), GetOutputSizePixel() ); 348cdf0e10cSrcweir Window::Paint( rRect ); 349cdf0e10cSrcweir Draw3DBorder( aRect ); 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir //------------------------------------------------------------------------------ 353cdf0e10cSrcweir void OTableWindow::Draw3DBorder(const Rectangle& rRect) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir // die Style-Settings des Systems fuer meine Farben 356cdf0e10cSrcweir const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings(); 357cdf0e10cSrcweir 358cdf0e10cSrcweir // Schwarze Linie unten und rechts 359cdf0e10cSrcweir SetLineColor(aSystemStyle.GetDarkShadowColor()); 360cdf0e10cSrcweir DrawLine( rRect.BottomLeft(), rRect.BottomRight() ); 361cdf0e10cSrcweir DrawLine( rRect.BottomRight(), rRect.TopRight() ); 362cdf0e10cSrcweir 363cdf0e10cSrcweir // Dunkelgraue Linie ueber der schwarzen 364cdf0e10cSrcweir SetLineColor(aSystemStyle.GetShadowColor()); 365cdf0e10cSrcweir Point aEHvector(1,1); 366cdf0e10cSrcweir DrawLine( rRect.BottomLeft()+Point(1,-1), rRect.BottomRight() - aEHvector ); 367cdf0e10cSrcweir DrawLine( rRect.BottomRight() - aEHvector, rRect.TopRight()+Point(-1,1) ); 368cdf0e10cSrcweir 369cdf0e10cSrcweir // Hellgraue Linie links und oben 370cdf0e10cSrcweir SetLineColor(aSystemStyle.GetLightColor()); 371cdf0e10cSrcweir DrawLine( rRect.BottomLeft()+Point(1,-2), rRect.TopLeft() + aEHvector ); 372cdf0e10cSrcweir DrawLine( rRect.TopLeft() + aEHvector, rRect.TopRight()+Point(-2,1) ); 373cdf0e10cSrcweir } 374cdf0e10cSrcweir // ----------------------------------------------------------------------------- 375cdf0e10cSrcweir Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& _rOutputSize) const 376cdf0e10cSrcweir { 377cdf0e10cSrcweir Rectangle aSizingRect = Rectangle( GetPosPixel(), GetSizePixel() ); 378cdf0e10cSrcweir sal_uInt16 nSizingFlags = GetSizingFlags(); 379cdf0e10cSrcweir 380cdf0e10cSrcweir if( nSizingFlags & SIZING_TOP ) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir if( _rPos.Y() < 0 ) 383cdf0e10cSrcweir aSizingRect.Top() = 0; 384cdf0e10cSrcweir else 385cdf0e10cSrcweir aSizingRect.Top() = _rPos.Y(); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir if( nSizingFlags & SIZING_BOTTOM ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir if( _rPos.Y() > _rOutputSize.Height() ) 391cdf0e10cSrcweir aSizingRect.Bottom() = _rOutputSize.Height(); 392cdf0e10cSrcweir else 393cdf0e10cSrcweir aSizingRect.Bottom() = _rPos.Y(); 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir 397cdf0e10cSrcweir if( nSizingFlags & SIZING_RIGHT ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir if( _rPos.X() > _rOutputSize.Width() ) 400cdf0e10cSrcweir aSizingRect.Right() = _rOutputSize.Width(); 401cdf0e10cSrcweir else 402cdf0e10cSrcweir aSizingRect.Right() = _rPos.X(); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir 405cdf0e10cSrcweir if( nSizingFlags & SIZING_LEFT ) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir if( _rPos.X() < 0 ) 408cdf0e10cSrcweir aSizingRect.Left() = 0; 409cdf0e10cSrcweir else 410cdf0e10cSrcweir aSizingRect.Left() = _rPos.X(); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir return aSizingRect; 413cdf0e10cSrcweir } 414cdf0e10cSrcweir // ----------------------------------------------------------------------------- 415cdf0e10cSrcweir void OTableWindow::setSizingFlag(const Point& _rPos) 416cdf0e10cSrcweir { 417cdf0e10cSrcweir Size aOutSize = GetOutputSizePixel(); 418cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 419cdf0e10cSrcweir // Flags anpassen, wenn Mauszeiger in sizingArea 420cdf0e10cSrcweir m_nSizingFlags = SIZING_NONE; 421cdf0e10cSrcweir 422cdf0e10cSrcweir if( _rPos.X() < TABWIN_SIZING_AREA ) 423cdf0e10cSrcweir m_nSizingFlags |= SIZING_LEFT; 424cdf0e10cSrcweir 425cdf0e10cSrcweir if( _rPos.Y() < TABWIN_SIZING_AREA ) 426cdf0e10cSrcweir m_nSizingFlags |= SIZING_TOP; 427cdf0e10cSrcweir 428cdf0e10cSrcweir if( _rPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA ) 429cdf0e10cSrcweir m_nSizingFlags |= SIZING_RIGHT; 430cdf0e10cSrcweir 431cdf0e10cSrcweir if( _rPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA ) 432cdf0e10cSrcweir m_nSizingFlags |= SIZING_BOTTOM; 433cdf0e10cSrcweir } 434cdf0e10cSrcweir //------------------------------------------------------------------------------ 435cdf0e10cSrcweir void OTableWindow::MouseMove( const MouseEvent& rEvt ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir Window::MouseMove(rEvt); 438cdf0e10cSrcweir 439cdf0e10cSrcweir OJoinTableView* pCont = getTableView(); 440cdf0e10cSrcweir if (pCont->getDesignView()->getController().isReadOnly()) 441cdf0e10cSrcweir return; 442cdf0e10cSrcweir 443cdf0e10cSrcweir Point aPos = rEvt.GetPosPixel(); 444cdf0e10cSrcweir setSizingFlag(aPos); 445cdf0e10cSrcweir Pointer aPointer; 446cdf0e10cSrcweir 447cdf0e10cSrcweir 448cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 449cdf0e10cSrcweir // Mauszeiger anpassen, wenn Mauszeiger in sizingArea 450cdf0e10cSrcweir switch( m_nSizingFlags ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir case SIZING_TOP: 453cdf0e10cSrcweir case SIZING_BOTTOM: 454cdf0e10cSrcweir aPointer = Pointer( POINTER_SSIZE ); 455cdf0e10cSrcweir break; 456cdf0e10cSrcweir 457cdf0e10cSrcweir case SIZING_LEFT: 458cdf0e10cSrcweir case SIZING_RIGHT: 459cdf0e10cSrcweir aPointer = Pointer( POINTER_ESIZE ); 460cdf0e10cSrcweir break; 461cdf0e10cSrcweir 462cdf0e10cSrcweir case SIZING_LEFT+SIZING_TOP: 463cdf0e10cSrcweir case SIZING_RIGHT+SIZING_BOTTOM: 464cdf0e10cSrcweir aPointer = Pointer( POINTER_SESIZE ); 465cdf0e10cSrcweir break; 466cdf0e10cSrcweir 467cdf0e10cSrcweir case SIZING_RIGHT+SIZING_TOP: 468cdf0e10cSrcweir case SIZING_LEFT+SIZING_BOTTOM: 469cdf0e10cSrcweir aPointer = Pointer( POINTER_NESIZE ); 470cdf0e10cSrcweir break; 471cdf0e10cSrcweir } 472cdf0e10cSrcweir 473cdf0e10cSrcweir SetPointer( aPointer ); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir //------------------------------------------------------------------------------ 477cdf0e10cSrcweir void OTableWindow::MouseButtonDown( const MouseEvent& rEvt ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 480cdf0e10cSrcweir // Wenn sizing, dann bekommt Parent die Nachricht, 481cdf0e10cSrcweir // dass jetzt die Fenstergroesse seines Childs veraendert wird 482cdf0e10cSrcweir if( m_nSizingFlags ) 483cdf0e10cSrcweir getTableView()->BeginChildSizing( this, GetPointer() ); 484cdf0e10cSrcweir 485cdf0e10cSrcweir Window::MouseButtonDown( rEvt ); 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir 489cdf0e10cSrcweir 490cdf0e10cSrcweir //------------------------------------------------------------------------------ 491cdf0e10cSrcweir void OTableWindow::Resize() 492cdf0e10cSrcweir { 493cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 494cdf0e10cSrcweir // Das Fenster darf nicht verschwinden, deshalb min. Groesse setzen 495cdf0e10cSrcweir Size aOutSize = GetOutputSizePixel(); 496cdf0e10cSrcweir aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height())); 497cdf0e10cSrcweir 498cdf0e10cSrcweir long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 ); 499cdf0e10cSrcweir 500cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 501cdf0e10cSrcweir // Titel und ListBox anpassen 502cdf0e10cSrcweir long n5Pos = CalcZoom(5); 503cdf0e10cSrcweir long nPositionX = n5Pos; 504cdf0e10cSrcweir long nPositionY = n5Pos; 505cdf0e10cSrcweir 506cdf0e10cSrcweir // position the image which indicates the type 507cdf0e10cSrcweir m_aTypeImage.SetPosPixel( Point( nPositionX, nPositionY ) ); 508cdf0e10cSrcweir Size aImageSize( m_aTypeImage.GetImage().GetSizePixel() ); 509cdf0e10cSrcweir m_aTypeImage.SetSizePixel( aImageSize ); 510cdf0e10cSrcweir 511cdf0e10cSrcweir if ( nTitleHeight < aImageSize.Height() ) 512cdf0e10cSrcweir nTitleHeight = aImageSize.Height(); 513cdf0e10cSrcweir 514cdf0e10cSrcweir nPositionX += aImageSize.Width() + CalcZoom( 2 ); 515cdf0e10cSrcweir m_aTitle.SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) ); 516cdf0e10cSrcweir 517cdf0e10cSrcweir long nTitleToList = CalcZoom( 3 ); 518cdf0e10cSrcweir 519cdf0e10cSrcweir m_pListBox->SetPosSizePixel( 520cdf0e10cSrcweir Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ), 521cdf0e10cSrcweir Size( aOutSize.Width() - 2 * n5Pos, aOutSize.Height() - ( nPositionY + nTitleHeight + nTitleToList ) - n5Pos ) 522cdf0e10cSrcweir ); 523cdf0e10cSrcweir 524cdf0e10cSrcweir Window::Invalidate(); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir 527cdf0e10cSrcweir //------------------------------------------------------------------------------ 528cdf0e10cSrcweir void OTableWindow::SetBoldTitle( sal_Bool bBold ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir Font aFont = m_aTitle.GetFont(); 531cdf0e10cSrcweir aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL ); 532cdf0e10cSrcweir m_aTitle.SetFont( aFont ); 533cdf0e10cSrcweir m_aTitle.Invalidate(); 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir //------------------------------------------------------------------------------ 537cdf0e10cSrcweir void OTableWindow::GetFocus() 538cdf0e10cSrcweir { 539cdf0e10cSrcweir Window::GetFocus(); 540cdf0e10cSrcweir // we have to forward the focus to our listbox to enable keystokes 541cdf0e10cSrcweir if(m_pListBox) 542cdf0e10cSrcweir m_pListBox->GrabFocus(); 543cdf0e10cSrcweir } 544cdf0e10cSrcweir // ----------------------------------------------------------------------------- 545cdf0e10cSrcweir void OTableWindow::setActive(sal_Bool _bActive) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir SetBoldTitle( _bActive ); 548cdf0e10cSrcweir m_bActive = _bActive; 549cdf0e10cSrcweir if (!_bActive && m_pListBox && m_pListBox->GetSelectionCount() != 0) 550cdf0e10cSrcweir m_pListBox->SelectAll(sal_False); 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir //------------------------------------------------------------------------------ 554cdf0e10cSrcweir void OTableWindow::Remove() 555cdf0e10cSrcweir { 556cdf0e10cSrcweir ////////////////////////////////////////////////////////////////// 557cdf0e10cSrcweir // Fenster loeschen 558cdf0e10cSrcweir OJoinTableView* pTabWinCont = getTableView(); 559cdf0e10cSrcweir pTabWinCont->RemoveTabWin( this ); 560cdf0e10cSrcweir pTabWinCont->Invalidate(); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir //------------------------------------------------------------------------------ 563cdf0e10cSrcweir sal_Bool OTableWindow::HandleKeyInput( const KeyEvent& rEvt ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir const KeyCode& rCode = rEvt.GetKeyCode(); 566cdf0e10cSrcweir sal_uInt16 nCode = rCode.GetCode(); 567cdf0e10cSrcweir sal_Bool bShift = rCode.IsShift(); 568cdf0e10cSrcweir sal_Bool bCtrl = rCode.IsMod1(); 569cdf0e10cSrcweir 570cdf0e10cSrcweir sal_Bool bHandle = sal_False; 571cdf0e10cSrcweir 572cdf0e10cSrcweir if( !bCtrl && !bShift && (nCode==KEY_DELETE) ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir Remove(); 575cdf0e10cSrcweir bHandle = sal_True; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir return bHandle; 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir //------------------------------------------------------------------------------ 581cdf0e10cSrcweir sal_Bool OTableWindow::ExistsAConn() const 582cdf0e10cSrcweir { 583cdf0e10cSrcweir return getTableView()->ExistsAConn(this); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir //------------------------------------------------------------------------------ 586cdf0e10cSrcweir void OTableWindow::EnumValidFields(::std::vector< ::rtl::OUString>& arrstrFields) 587cdf0e10cSrcweir { 588cdf0e10cSrcweir arrstrFields.clear(); 589cdf0e10cSrcweir // diese Default-Implementierung zaehlt einfach alles auf, was es in der ListBox gibt ... fuer anderes Verhalten ueberschreiben 590cdf0e10cSrcweir if ( m_pListBox ) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir arrstrFields.reserve(m_pListBox->GetEntryCount()); 593cdf0e10cSrcweir SvLBoxEntry* pEntryLoop = m_pListBox->First(); 594cdf0e10cSrcweir while (pEntryLoop) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir arrstrFields.push_back(m_pListBox->GetEntryText(pEntryLoop)); 597cdf0e10cSrcweir pEntryLoop = m_pListBox->Next(pEntryLoop); 598cdf0e10cSrcweir } 599cdf0e10cSrcweir } 600cdf0e10cSrcweir } 601cdf0e10cSrcweir // ----------------------------------------------------------------------------- 602cdf0e10cSrcweir void OTableWindow::StateChanged( StateChangedType nType ) 603cdf0e10cSrcweir { 604cdf0e10cSrcweir Window::StateChanged( nType ); 605cdf0e10cSrcweir 606cdf0e10cSrcweir if ( nType == STATE_CHANGE_ZOOM ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 609cdf0e10cSrcweir 610cdf0e10cSrcweir Font aFont = rStyleSettings.GetGroupFont(); 611cdf0e10cSrcweir if ( IsControlFont() ) 612cdf0e10cSrcweir aFont.Merge( GetControlFont() ); 613cdf0e10cSrcweir SetZoomedPointFont( aFont ); 614cdf0e10cSrcweir 615cdf0e10cSrcweir m_aTitle.SetZoom(GetZoom()); 616cdf0e10cSrcweir m_pListBox->SetZoom(GetZoom()); 617cdf0e10cSrcweir Resize(); 618cdf0e10cSrcweir Invalidate(); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir } 621cdf0e10cSrcweir // ----------------------------------------------------------------------------- 622cdf0e10cSrcweir Reference< XAccessible > OTableWindow::CreateAccessible() 623cdf0e10cSrcweir { 624cdf0e10cSrcweir OTableWindowAccess* pAccessible = new OTableWindowAccess(this); 625cdf0e10cSrcweir m_pAccessible = pAccessible; 626cdf0e10cSrcweir return pAccessible; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir // ----------------------------------------------------------------------------- 629cdf0e10cSrcweir void OTableWindow::Command(const CommandEvent& rEvt) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir switch (rEvt.GetCommand()) 632cdf0e10cSrcweir { 633cdf0e10cSrcweir case COMMAND_CONTEXTMENU: 634cdf0e10cSrcweir { 635cdf0e10cSrcweir OJoinController& rController = getDesignView()->getController(); 636cdf0e10cSrcweir if(!rController.isReadOnly() && rController.isConnected()) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir Point ptWhere; 639cdf0e10cSrcweir if ( rEvt.IsMouseEvent() ) 640cdf0e10cSrcweir ptWhere = rEvt.GetMousePosPixel(); 641cdf0e10cSrcweir else 642cdf0e10cSrcweir { 643cdf0e10cSrcweir SvLBoxEntry* pCurrent = m_pListBox->GetCurEntry(); 644cdf0e10cSrcweir if ( pCurrent ) 645cdf0e10cSrcweir ptWhere = m_pListBox->GetEntryPosition(pCurrent); 646cdf0e10cSrcweir else 647cdf0e10cSrcweir ptWhere = m_aTitle.GetPosPixel(); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir 650cdf0e10cSrcweir PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE)); 651cdf0e10cSrcweir switch (aContextMenu.Execute(this, ptWhere)) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir case SID_DELETE: 654cdf0e10cSrcweir Remove(); 655cdf0e10cSrcweir break; 656cdf0e10cSrcweir } 657cdf0e10cSrcweir } 658cdf0e10cSrcweir break; 659cdf0e10cSrcweir } 660cdf0e10cSrcweir default: 661cdf0e10cSrcweir Window::Command(rEvt); 662cdf0e10cSrcweir } 663cdf0e10cSrcweir } 664cdf0e10cSrcweir // ----------------------------------------------------------------------------- 665cdf0e10cSrcweir long OTableWindow::PreNotify(NotifyEvent& rNEvt) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir sal_Bool bHandled = sal_False; 668cdf0e10cSrcweir switch (rNEvt.GetType()) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir case EVENT_KEYINPUT: 671cdf0e10cSrcweir { 672cdf0e10cSrcweir if ( getDesignView()->getController().isReadOnly() ) 673cdf0e10cSrcweir break; 674cdf0e10cSrcweir 675cdf0e10cSrcweir const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); 676cdf0e10cSrcweir const KeyCode& rCode = pKeyEvent->GetKeyCode(); 677cdf0e10cSrcweir if ( rCode.IsMod1() ) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir Point aStartPoint = GetPosPixel(); 680cdf0e10cSrcweir if ( rCode.IsShift() ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir aStartPoint.X() = GetSizePixel().Width(); 683cdf0e10cSrcweir aStartPoint.Y() = GetSizePixel().Height(); 684cdf0e10cSrcweir } 685cdf0e10cSrcweir 686cdf0e10cSrcweir switch( rCode.GetCode() ) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir case KEY_DOWN: 689cdf0e10cSrcweir bHandled = sal_True; 690cdf0e10cSrcweir aStartPoint.Y() += m_nMoveIncrement; 691cdf0e10cSrcweir break; 692cdf0e10cSrcweir case KEY_UP: 693cdf0e10cSrcweir bHandled = sal_True; 694cdf0e10cSrcweir aStartPoint.Y() += -m_nMoveIncrement; 695cdf0e10cSrcweir break; 696cdf0e10cSrcweir case KEY_LEFT: 697cdf0e10cSrcweir bHandled = sal_True; 698cdf0e10cSrcweir aStartPoint.X() += -m_nMoveIncrement; 699cdf0e10cSrcweir break; 700cdf0e10cSrcweir case KEY_RIGHT: 701cdf0e10cSrcweir bHandled = sal_True; 702cdf0e10cSrcweir aStartPoint.X() += m_nMoveIncrement; 703cdf0e10cSrcweir break; 704cdf0e10cSrcweir } 705cdf0e10cSrcweir if ( bHandled ) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir if ( rCode.IsShift() ) 708cdf0e10cSrcweir { 709cdf0e10cSrcweir OJoinTableView* pView = getTableView(); 710cdf0e10cSrcweir Point ptOld = GetPosPixel(); 711cdf0e10cSrcweir Size aSize = pView->getRealOutputSize(); 712cdf0e10cSrcweir Size aNewSize(aStartPoint.X(),aStartPoint.Y()); 713cdf0e10cSrcweir if ( ((ptOld.X() + aNewSize.Width()) <= aSize.Width()) 714cdf0e10cSrcweir && ((ptOld.Y() + aNewSize.Height()) <= aSize.Height()) ) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir if ( aNewSize.Width() < TABWIN_WIDTH_MIN ) 717cdf0e10cSrcweir aNewSize.Width() = TABWIN_WIDTH_MIN; 718cdf0e10cSrcweir if ( aNewSize.Height() < TABWIN_HEIGHT_MIN ) 719cdf0e10cSrcweir aNewSize.Height() = TABWIN_HEIGHT_MIN; 720cdf0e10cSrcweir 721cdf0e10cSrcweir Size szOld = GetSizePixel(); 722cdf0e10cSrcweir 723cdf0e10cSrcweir aNewSize = Size(pView->CalcZoom(aNewSize.Width()),pView->CalcZoom(aNewSize.Height())); 724cdf0e10cSrcweir SetPosSizePixel( ptOld, aNewSize ); 725cdf0e10cSrcweir pView->TabWinSized(this, ptOld, szOld); 726cdf0e10cSrcweir Invalidate( INVALIDATE_NOCHILDREN ); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir } 729cdf0e10cSrcweir else 730cdf0e10cSrcweir { 731cdf0e10cSrcweir // remember how often the user moved our window 732cdf0e10cSrcweir ++m_nMoveCount; 733cdf0e10cSrcweir if( m_nMoveCount == 5 ) 734cdf0e10cSrcweir m_nMoveIncrement = 10; 735cdf0e10cSrcweir else if( m_nMoveCount > 15 ) 736cdf0e10cSrcweir m_nMoveCount = m_nMoveIncrement = 20; 737cdf0e10cSrcweir 738cdf0e10cSrcweir Point aOldDataPoint = GetData()->GetPosition(); 739cdf0e10cSrcweir Point aNewDataPoint = aStartPoint + getTableView()->GetScrollOffset(); 740cdf0e10cSrcweir if ( aNewDataPoint.X() > -1 && aNewDataPoint.Y() > -1 ) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir OJoinTableView* pView = getTableView(); 743cdf0e10cSrcweir if ( pView->isMovementAllowed(aNewDataPoint, GetData()->GetSize()) ) 744cdf0e10cSrcweir { 745cdf0e10cSrcweir SetPosPixel(aStartPoint); 746cdf0e10cSrcweir 747cdf0e10cSrcweir // aNewDataPoint can not be used here because SetPosPixel reset it 748cdf0e10cSrcweir pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize()); 749cdf0e10cSrcweir pView->TabWinMoved(this,aOldDataPoint); 750cdf0e10cSrcweir Invalidate(INVALIDATE_NOCHILDREN); 751cdf0e10cSrcweir getDesignView()->getController().setModified( sal_True ); 752cdf0e10cSrcweir } 753cdf0e10cSrcweir else 754cdf0e10cSrcweir { 755cdf0e10cSrcweir m_nMoveCount = 0; // reset our movement count 756cdf0e10cSrcweir m_nMoveIncrement = 1; 757cdf0e10cSrcweir } 758cdf0e10cSrcweir } 759cdf0e10cSrcweir else 760cdf0e10cSrcweir { 761cdf0e10cSrcweir m_nMoveCount = 0; // reset our movement count 762cdf0e10cSrcweir m_nMoveIncrement = 1; 763cdf0e10cSrcweir } 764cdf0e10cSrcweir } 765cdf0e10cSrcweir resetSizingFlag(); 766cdf0e10cSrcweir } 767cdf0e10cSrcweir else 768cdf0e10cSrcweir { 769cdf0e10cSrcweir m_nMoveCount = 0; // reset our movement count 770cdf0e10cSrcweir m_nMoveIncrement = 1; 771cdf0e10cSrcweir } 772cdf0e10cSrcweir } 773cdf0e10cSrcweir else 774cdf0e10cSrcweir { 775cdf0e10cSrcweir m_nMoveCount = 0; // reset our movement count 776cdf0e10cSrcweir m_nMoveIncrement = 1; 777cdf0e10cSrcweir } 778cdf0e10cSrcweir } 779cdf0e10cSrcweir break; 780cdf0e10cSrcweir case EVENT_KEYUP: 781cdf0e10cSrcweir { 782cdf0e10cSrcweir const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); 783cdf0e10cSrcweir const KeyCode& rCode = pKeyEvent->GetKeyCode(); 784cdf0e10cSrcweir sal_uInt16 nKeyCode = rCode.GetCode(); 785cdf0e10cSrcweir if ( rCode.IsMod2() && nKeyCode != KEY_UP && nKeyCode != KEY_DOWN && nKeyCode != KEY_LEFT && nKeyCode != KEY_RIGHT ) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir m_nMoveCount = 0; // reset our movement count 788cdf0e10cSrcweir m_nMoveIncrement = 1; 789cdf0e10cSrcweir } 790cdf0e10cSrcweir } 791cdf0e10cSrcweir break; 792cdf0e10cSrcweir } 793cdf0e10cSrcweir if (!bHandled) 794cdf0e10cSrcweir return Window::PreNotify(rNEvt); 795cdf0e10cSrcweir return 1L; 796cdf0e10cSrcweir } 797cdf0e10cSrcweir // ----------------------------------------------------------------------------- 798cdf0e10cSrcweir String OTableWindow::getTitle() const 799cdf0e10cSrcweir { 800cdf0e10cSrcweir return m_aTitle.GetText(); 801cdf0e10cSrcweir } 802cdf0e10cSrcweir // ----------------------------------------------------------------------------- 803cdf0e10cSrcweir void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir FillListBox(); 806cdf0e10cSrcweir } 807cdf0e10cSrcweir // ----------------------------------------------------------------------------- 808cdf0e10cSrcweir void OTableWindow::_elementRemoved( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException) 809cdf0e10cSrcweir { 810cdf0e10cSrcweir FillListBox(); 811cdf0e10cSrcweir } 812cdf0e10cSrcweir // ----------------------------------------------------------------------------- 813cdf0e10cSrcweir void OTableWindow::_elementReplaced( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir FillListBox(); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir // ----------------------------------------------------------------------------- 818cdf0e10cSrcweir 819