2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 06:25:29 +00:00
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
#include "TableWindow.hxx"
|
|
|
|
#include "TableWindowListBox.hxx"
|
|
|
|
#include "QueryTableView.hxx"
|
|
|
|
#include "QueryDesignView.hxx"
|
|
|
|
#include "TableWindowData.hxx"
|
2006-12-13 15:54:27 +00:00
|
|
|
#include "imageprovider.hxx"
|
2006-07-10 14:44:38 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2011-02-03 00:33:36 +01:00
|
|
|
#include <osl/diagnose.h>
|
2001-02-05 08:26:47 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/wall.hxx>
|
2007-11-01 14:33:32 +00:00
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2003-04-24 16:22:49 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
2001-02-05 08:26:47 +00:00
|
|
|
#include "querycontroller.hxx"
|
2002-08-19 07:01:32 +00:00
|
|
|
#include "dbu_qry.hrc"
|
2001-02-05 08:26:47 +00:00
|
|
|
#include "dbustrings.hrc"
|
|
|
|
#include "Query.hrc"
|
2001-03-15 07:29:16 +00:00
|
|
|
#include <comphelper/extract.hxx>
|
2001-02-23 14:04:37 +00:00
|
|
|
#include "UITools.hxx"
|
2002-02-06 07:15:30 +00:00
|
|
|
#include "TableWindowAccess.hxx"
|
|
|
|
#include "browserids.hxx"
|
2010-02-08 14:07:46 +01:00
|
|
|
#include <connectivity/dbtools.hxx>
|
2008-10-01 12:28:29 +00:00
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
using namespace dbaui;
|
2001-06-28 13:22:47 +00:00
|
|
|
using namespace ::utl;
|
2008-10-01 12:28:29 +00:00
|
|
|
using namespace ::com::sun::star;
|
2006-07-10 14:44:38 +00:00
|
|
|
using namespace ::com::sun::star::sdb;
|
2001-02-05 08:26:47 +00:00
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::container;
|
2001-06-28 13:22:47 +00:00
|
|
|
using namespace ::com::sun::star::lang;
|
2003-04-24 16:22:49 +00:00
|
|
|
using namespace ::com::sun::star::accessibility;
|
2001-02-05 08:26:47 +00:00
|
|
|
|
2002-02-08 08:10:00 +00:00
|
|
|
#define TABWIN_SIZING_AREA 4
|
|
|
|
#define LISTBOX_SCROLLING_AREA 6
|
|
|
|
#define SCROLLING_TIMESPAN 500
|
|
|
|
|
|
|
|
#define TABWIN_WIDTH_MIN 90
|
|
|
|
#define TABWIN_HEIGHT_MIN 80
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// class OTableWindow
|
|
|
|
//========================================================================
|
2007-11-05 08:06:13 +00:00
|
|
|
DBG_NAME(OTableWindow)
|
2001-02-05 08:26:47 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2007-11-01 14:33:32 +00:00
|
|
|
OTableWindow::OTableWindow( Window* pParent, const TTableWindowData::value_type& pTabWinData )
|
2008-10-01 12:28:29 +00:00
|
|
|
: ::comphelper::OContainerListener(m_aMutex)
|
|
|
|
,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
|
2006-12-13 15:54:27 +00:00
|
|
|
,m_aTypeImage( this )
|
2001-02-05 08:26:47 +00:00
|
|
|
,m_aTitle( this )
|
|
|
|
,m_pListBox(NULL)
|
2006-06-20 02:28:47 +00:00
|
|
|
,m_pAccessible(NULL)
|
|
|
|
,m_pData( pTabWinData )
|
2002-02-06 07:15:30 +00:00
|
|
|
,m_nMoveCount(0)
|
|
|
|
,m_nMoveIncrement(1)
|
2006-06-20 02:28:47 +00:00
|
|
|
,m_nSizingFlags( SIZING_NONE )
|
2011-01-14 15:00:11 +01:00
|
|
|
,m_bActive( sal_False )
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
|
|
|
DBG_CTOR(OTableWindow,NULL);
|
|
|
|
|
|
|
|
// Position und Groesse bestimmen
|
|
|
|
if( GetData()->HasPosition() )
|
|
|
|
SetPosPixel( GetData()->GetPosition() );
|
|
|
|
|
|
|
|
if( GetData()->HasSize() )
|
|
|
|
SetSizePixel( GetData()->GetSize() );
|
|
|
|
|
|
|
|
// Hintergrund setzen
|
2002-02-06 07:15:30 +00:00
|
|
|
const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
|
|
|
|
SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
|
2001-02-05 08:26:47 +00:00
|
|
|
// und Textfarbe (obwohl ich eigentlich keinen Text habe, aber wer weiss, was
|
|
|
|
// abgeleitete Klassen machen)
|
|
|
|
SetTextColor(aSystemStyle.GetButtonTextColor());
|
|
|
|
|
|
|
|
EnableClipSiblings();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
OTableWindow::~OTableWindow()
|
|
|
|
{
|
2004-08-02 15:14:58 +00:00
|
|
|
DBG_DTOR(OTableWindow,NULL);
|
2006-07-10 14:44:38 +00:00
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
if (m_pListBox)
|
|
|
|
{
|
2002-06-27 07:23:50 +00:00
|
|
|
OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
|
2002-05-10 07:23:32 +00:00
|
|
|
::std::auto_ptr<Window> aTemp(m_pListBox);
|
|
|
|
m_pListBox = NULL;
|
2010-11-25 01:16:20 +00:00
|
|
|
}
|
2008-10-01 12:28:29 +00:00
|
|
|
if ( m_pContainerListener.is() )
|
|
|
|
m_pContainerListener->dispose();
|
|
|
|
|
2002-02-08 08:10:00 +00:00
|
|
|
m_pAccessible = NULL;
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-02-28 09:18:26 +00:00
|
|
|
const OJoinTableView* OTableWindow::getTableView() const
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2001-02-28 09:18:26 +00:00
|
|
|
OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!");
|
|
|
|
return static_cast<OJoinTableView*>(GetParent());
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-02-28 09:18:26 +00:00
|
|
|
OJoinTableView* OTableWindow::getTableView()
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2001-02-28 09:18:26 +00:00
|
|
|
OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!");
|
|
|
|
return static_cast<OJoinTableView*>(GetParent());
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-02-28 09:18:26 +00:00
|
|
|
OJoinDesignView* OTableWindow::getDesignView()
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2001-02-28 09:18:26 +00:00
|
|
|
OSL_ENSURE(static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()),"No OJoinDesignView!");
|
|
|
|
return static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent());
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::SetPosPixel( const Point& rNewPos )
|
|
|
|
{
|
|
|
|
Point aNewPosData = rNewPos + getTableView()->GetScrollOffset();
|
|
|
|
GetData()->SetPosition( aNewPosData );
|
|
|
|
Window::SetPosPixel( rNewPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::SetSizePixel( const Size& rNewSize )
|
|
|
|
{
|
|
|
|
Size aOutSize(rNewSize);
|
|
|
|
if( aOutSize.Width() < TABWIN_WIDTH_MIN )
|
|
|
|
aOutSize.Width() = TABWIN_WIDTH_MIN;
|
|
|
|
if( aOutSize.Height() < TABWIN_HEIGHT_MIN )
|
|
|
|
aOutSize.Height() = TABWIN_HEIGHT_MIN;
|
|
|
|
|
|
|
|
GetData()->SetSize( aOutSize );
|
|
|
|
Window::SetSizePixel( aOutSize );
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
|
|
|
|
{
|
|
|
|
SetPosPixel( rNewPos );
|
|
|
|
SetSizePixel( rNewSize );
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
OTableWindowListBox* OTableWindow::CreateListBox()
|
|
|
|
{
|
2006-06-20 02:28:47 +00:00
|
|
|
return new OTableWindowListBox(this);
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool OTableWindow::FillListBox()
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pListBox->Clear();
|
|
|
|
if ( !m_pContainerListener.is() )
|
|
|
|
{
|
|
|
|
Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
|
|
|
|
if ( xContainer.is() )
|
|
|
|
m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
// mark all primary keys with special image
|
2010-11-16 20:42:52 +00:00
|
|
|
ModuleRes TmpRes(IMG_JOINS);
|
2002-05-08 08:09:31 +00:00
|
|
|
ImageList aImageList(TmpRes);
|
2001-02-05 08:26:47 +00:00
|
|
|
Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY);
|
|
|
|
|
|
|
|
if (GetData()->IsShowAll())
|
2002-06-27 07:23:50 +00:00
|
|
|
{
|
2010-11-13 21:19:14 +00:00
|
|
|
SvLBoxEntry* pEntry = m_pListBox->InsertEntry( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")) );
|
2002-06-27 07:23:50 +00:00
|
|
|
pEntry->SetUserData( createUserData(NULL,false) );
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
Reference<XNameAccess> xPKeyColumns;
|
2003-07-21 11:28:12 +00:00
|
|
|
try
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2010-02-08 14:07:46 +01:00
|
|
|
xPKeyColumns = dbtools::getPrimaryKeyColumns_throw(m_pData->getTable());
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2003-07-21 11:28:12 +00:00
|
|
|
catch(Exception&)
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Exception occurred!");
|
2003-07-21 11:28:12 +00:00
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
2007-11-01 14:33:32 +00:00
|
|
|
Reference< XNameAccess > xColumns = m_pData->getColumns();
|
|
|
|
if( xColumns.is() )
|
2001-06-28 13:22:47 +00:00
|
|
|
{
|
2007-11-01 14:33:32 +00:00
|
|
|
Sequence< ::rtl::OUString> aColumns = xColumns->getElementNames();
|
|
|
|
const ::rtl::OUString* pIter = aColumns.getConstArray();
|
|
|
|
const ::rtl::OUString* pEnd = pIter + aColumns.getLength();
|
2002-06-27 07:23:50 +00:00
|
|
|
|
2003-07-21 11:28:12 +00:00
|
|
|
SvLBoxEntry* pEntry = NULL;
|
2007-11-01 14:33:32 +00:00
|
|
|
for (; pIter != pEnd; ++pIter)
|
2003-07-21 11:28:12 +00:00
|
|
|
{
|
2007-11-01 14:33:32 +00:00
|
|
|
bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter );
|
2003-07-21 11:28:12 +00:00
|
|
|
// is this column in the primary key
|
2006-07-10 14:44:38 +00:00
|
|
|
if ( bPrimaryKeyColumn )
|
2007-11-01 14:33:32 +00:00
|
|
|
pEntry = m_pListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
|
2003-07-21 11:28:12 +00:00
|
|
|
else
|
2007-11-01 14:33:32 +00:00
|
|
|
pEntry = m_pListBox->InsertEntry(*pIter);
|
2003-07-21 11:28:12 +00:00
|
|
|
|
2007-11-01 14:33:32 +00:00
|
|
|
Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
|
2003-07-21 11:28:12 +00:00
|
|
|
if ( xColumn.is() )
|
|
|
|
pEntry->SetUserData( createUserData(xColumn,bPrimaryKeyColumn) );
|
|
|
|
}
|
2001-06-28 13:22:47 +00:00
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2003-07-21 11:28:12 +00:00
|
|
|
catch(Exception&)
|
|
|
|
{
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Exception occurred!");
|
2003-07-21 11:28:12 +00:00
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
return sal_True;
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2002-06-27 07:23:50 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2006-06-20 02:28:47 +00:00
|
|
|
void* OTableWindow::createUserData(const Reference< XPropertySet>& /*_xColumn*/,bool /*_bPrimaryKey*/)
|
2002-06-27 07:23:50 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::deleteUserData(void*& _pUserData)
|
|
|
|
{
|
|
|
|
OSL_ENSURE(!_pUserData,"INVALID call. Need to delete the userclass!");
|
|
|
|
_pUserData = NULL;
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2002-06-27 07:23:50 +00:00
|
|
|
void OTableWindow::clearListBox()
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2002-02-06 07:15:30 +00:00
|
|
|
if ( m_pListBox )
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2002-02-06 07:15:30 +00:00
|
|
|
SvLBoxEntry* pEntry = m_pListBox->First();
|
|
|
|
|
|
|
|
while(pEntry)
|
|
|
|
{
|
2002-06-27 07:23:50 +00:00
|
|
|
void* pUserData = pEntry->GetUserData();
|
|
|
|
deleteUserData(pUserData);
|
2002-02-06 07:15:30 +00:00
|
|
|
SvLBoxEntry* pNextEntry = m_pListBox->Next(pEntry);
|
|
|
|
m_pListBox->GetModel()->Remove(pEntry);
|
|
|
|
pEntry = pNextEntry;
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-13 15:54:27 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::impl_updateImage()
|
|
|
|
{
|
2008-06-25 11:54:20 +00:00
|
|
|
ImageProvider aImageProvider( getDesignView()->getController().getConnection() );
|
2006-12-13 15:54:27 +00:00
|
|
|
|
2010-11-16 20:42:52 +00:00
|
|
|
Image aImage;
|
|
|
|
aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage );
|
2006-12-13 15:54:27 +00:00
|
|
|
|
2010-11-16 20:42:52 +00:00
|
|
|
if ( !aImage )
|
2006-12-13 15:54:27 +00:00
|
|
|
{
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OTableWindow::impl_updateImage: no images!" );
|
2006-12-13 15:54:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-13 00:29:58 -08:00
|
|
|
m_aTypeImage.SetModeImage( aImage );
|
2006-12-13 15:54:27 +00:00
|
|
|
m_aTypeImage.Show();
|
|
|
|
}
|
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool OTableWindow::Init()
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2007-11-01 14:33:32 +00:00
|
|
|
// create list box if necessary
|
|
|
|
if ( !m_pListBox )
|
2006-07-10 14:44:38 +00:00
|
|
|
{
|
2007-11-01 14:33:32 +00:00
|
|
|
m_pListBox = CreateListBox();
|
2011-02-03 00:33:36 +01:00
|
|
|
OSL_ENSURE( m_pListBox != NULL, "OTableWindow::Init() : CreateListBox hat NULL geliefert !" );
|
2007-11-01 14:33:32 +00:00
|
|
|
m_pListBox->SetSelectionMode( MULTIPLE_SELECTION );
|
2006-07-10 14:44:38 +00:00
|
|
|
}
|
|
|
|
|
2007-11-01 14:33:32 +00:00
|
|
|
// Titel setzen
|
|
|
|
m_aTitle.SetText( m_pData->GetWinName() );
|
|
|
|
m_aTitle.Show();
|
2006-07-10 14:44:38 +00:00
|
|
|
|
2007-11-01 14:33:32 +00:00
|
|
|
m_pListBox->Show();
|
2006-07-10 14:44:38 +00:00
|
|
|
|
2007-11-01 14:33:32 +00:00
|
|
|
// die Felder in die ListBox eintragen
|
|
|
|
clearListBox();
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool bSuccess = FillListBox();
|
2007-11-01 14:33:32 +00:00
|
|
|
if ( bSuccess )
|
2011-01-14 15:00:11 +01:00
|
|
|
m_pListBox->SelectAll( sal_False );
|
2001-02-05 08:26:47 +00:00
|
|
|
|
2006-12-13 15:54:27 +00:00
|
|
|
impl_updateImage();
|
|
|
|
|
2006-07-10 14:44:38 +00:00
|
|
|
return bSuccess;
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt)
|
|
|
|
{
|
|
|
|
if (rDCEvt.GetType() == DATACHANGED_SETTINGS)
|
|
|
|
{
|
|
|
|
// nehmen wir den worst-case an : die Farben haben sich geaendert, also
|
|
|
|
// mich anpassen
|
2002-02-06 07:15:30 +00:00
|
|
|
const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
|
2001-02-05 08:26:47 +00:00
|
|
|
SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor())));
|
|
|
|
SetTextColor(aSystemStyle.GetButtonTextColor());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::Paint( const Rectangle& rRect )
|
|
|
|
{
|
|
|
|
Rectangle aRect( Point(0,0), GetOutputSizePixel() );
|
|
|
|
Window::Paint( rRect );
|
|
|
|
Draw3DBorder( aRect );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::Draw3DBorder(const Rectangle& rRect)
|
|
|
|
{
|
|
|
|
// die Style-Settings des Systems fuer meine Farben
|
2002-02-06 07:15:30 +00:00
|
|
|
const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
// Schwarze Linie unten und rechts
|
|
|
|
SetLineColor(aSystemStyle.GetDarkShadowColor());
|
|
|
|
DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
|
|
|
|
DrawLine( rRect.BottomRight(), rRect.TopRight() );
|
|
|
|
|
|
|
|
// Dunkelgraue Linie ueber der schwarzen
|
|
|
|
SetLineColor(aSystemStyle.GetShadowColor());
|
2002-02-06 07:15:30 +00:00
|
|
|
Point aEHvector(1,1);
|
|
|
|
DrawLine( rRect.BottomLeft()+Point(1,-1), rRect.BottomRight() - aEHvector );
|
|
|
|
DrawLine( rRect.BottomRight() - aEHvector, rRect.TopRight()+Point(-1,1) );
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
// Hellgraue Linie links und oben
|
|
|
|
SetLineColor(aSystemStyle.GetLightColor());
|
2002-02-06 07:15:30 +00:00
|
|
|
DrawLine( rRect.BottomLeft()+Point(1,-2), rRect.TopLeft() + aEHvector );
|
|
|
|
DrawLine( rRect.TopLeft() + aEHvector, rRect.TopRight()+Point(-2,1) );
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2002-06-24 06:49:59 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& _rOutputSize) const
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2002-06-24 06:49:59 +00:00
|
|
|
Rectangle aSizingRect = Rectangle( GetPosPixel(), GetSizePixel() );
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nSizingFlags = GetSizingFlags();
|
2001-02-05 08:26:47 +00:00
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( nSizingFlags & SIZING_TOP )
|
|
|
|
{
|
|
|
|
if( _rPos.Y() < 0 )
|
|
|
|
aSizingRect.Top() = 0;
|
|
|
|
else
|
|
|
|
aSizingRect.Top() = _rPos.Y();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nSizingFlags & SIZING_BOTTOM )
|
|
|
|
{
|
|
|
|
if( _rPos.Y() > _rOutputSize.Height() )
|
|
|
|
aSizingRect.Bottom() = _rOutputSize.Height();
|
|
|
|
else
|
|
|
|
aSizingRect.Bottom() = _rPos.Y();
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( nSizingFlags & SIZING_RIGHT )
|
|
|
|
{
|
|
|
|
if( _rPos.X() > _rOutputSize.Width() )
|
|
|
|
aSizingRect.Right() = _rOutputSize.Width();
|
|
|
|
else
|
|
|
|
aSizingRect.Right() = _rPos.X();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nSizingFlags & SIZING_LEFT )
|
|
|
|
{
|
|
|
|
if( _rPos.X() < 0 )
|
|
|
|
aSizingRect.Left() = 0;
|
|
|
|
else
|
|
|
|
aSizingRect.Left() = _rPos.X();
|
|
|
|
}
|
|
|
|
return aSizingRect;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::setSizingFlag(const Point& _rPos)
|
|
|
|
{
|
|
|
|
Size aOutSize = GetOutputSizePixel();
|
2001-02-05 08:26:47 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Flags anpassen, wenn Mauszeiger in sizingArea
|
|
|
|
m_nSizingFlags = SIZING_NONE;
|
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( _rPos.X() < TABWIN_SIZING_AREA )
|
2001-02-05 08:26:47 +00:00
|
|
|
m_nSizingFlags |= SIZING_LEFT;
|
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( _rPos.Y() < TABWIN_SIZING_AREA )
|
2001-02-05 08:26:47 +00:00
|
|
|
m_nSizingFlags |= SIZING_TOP;
|
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( _rPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA )
|
2001-02-05 08:26:47 +00:00
|
|
|
m_nSizingFlags |= SIZING_RIGHT;
|
|
|
|
|
2002-06-24 06:49:59 +00:00
|
|
|
if( _rPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA )
|
2001-02-05 08:26:47 +00:00
|
|
|
m_nSizingFlags |= SIZING_BOTTOM;
|
2002-06-24 06:49:59 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::MouseMove( const MouseEvent& rEvt )
|
|
|
|
{
|
|
|
|
Window::MouseMove(rEvt);
|
|
|
|
|
|
|
|
OJoinTableView* pCont = getTableView();
|
2008-06-25 11:54:20 +00:00
|
|
|
if (pCont->getDesignView()->getController().isReadOnly())
|
2002-06-24 06:49:59 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Point aPos = rEvt.GetPosPixel();
|
|
|
|
setSizingFlag(aPos);
|
|
|
|
Pointer aPointer;
|
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Mauszeiger anpassen, wenn Mauszeiger in sizingArea
|
|
|
|
switch( m_nSizingFlags )
|
|
|
|
{
|
|
|
|
case SIZING_TOP:
|
|
|
|
case SIZING_BOTTOM:
|
|
|
|
aPointer = Pointer( POINTER_SSIZE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIZING_LEFT:
|
|
|
|
case SIZING_RIGHT:
|
|
|
|
aPointer = Pointer( POINTER_ESIZE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIZING_LEFT+SIZING_TOP:
|
|
|
|
case SIZING_RIGHT+SIZING_BOTTOM:
|
|
|
|
aPointer = Pointer( POINTER_SESIZE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIZING_RIGHT+SIZING_TOP:
|
|
|
|
case SIZING_LEFT+SIZING_BOTTOM:
|
|
|
|
aPointer = Pointer( POINTER_NESIZE );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetPointer( aPointer );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::MouseButtonDown( const MouseEvent& rEvt )
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Wenn sizing, dann bekommt Parent die Nachricht,
|
|
|
|
// dass jetzt die Fenstergroesse seines Childs veraendert wird
|
|
|
|
if( m_nSizingFlags )
|
|
|
|
getTableView()->BeginChildSizing( this, GetPointer() );
|
|
|
|
|
|
|
|
Window::MouseButtonDown( rEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::Resize()
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Das Fenster darf nicht verschwinden, deshalb min. Groesse setzen
|
|
|
|
Size aOutSize = GetOutputSizePixel();
|
|
|
|
aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height()));
|
2006-12-13 15:54:27 +00:00
|
|
|
|
|
|
|
long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 );
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Titel und ListBox anpassen
|
|
|
|
long n5Pos = CalcZoom(5);
|
2006-12-13 15:54:27 +00:00
|
|
|
long nPositionX = n5Pos;
|
|
|
|
long nPositionY = n5Pos;
|
|
|
|
|
|
|
|
// position the image which indicates the type
|
|
|
|
m_aTypeImage.SetPosPixel( Point( nPositionX, nPositionY ) );
|
|
|
|
Size aImageSize( m_aTypeImage.GetImage().GetSizePixel() );
|
|
|
|
m_aTypeImage.SetSizePixel( aImageSize );
|
|
|
|
|
|
|
|
if ( nTitleHeight < aImageSize.Height() )
|
|
|
|
nTitleHeight = aImageSize.Height();
|
|
|
|
|
|
|
|
nPositionX += aImageSize.Width() + CalcZoom( 2 );
|
|
|
|
m_aTitle.SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
|
|
|
|
|
|
|
|
long nTitleToList = CalcZoom( 3 );
|
|
|
|
|
|
|
|
m_pListBox->SetPosSizePixel(
|
|
|
|
Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ),
|
|
|
|
Size( aOutSize.Width() - 2 * n5Pos, aOutSize.Height() - ( nPositionY + nTitleHeight + nTitleToList ) - n5Pos )
|
|
|
|
);
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
Window::Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2011-01-14 15:00:11 +01:00
|
|
|
void OTableWindow::SetBoldTitle( sal_Bool bBold )
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
|
|
|
Font aFont = m_aTitle.GetFont();
|
|
|
|
aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL );
|
|
|
|
m_aTitle.SetFont( aFont );
|
|
|
|
m_aTitle.Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::GetFocus()
|
|
|
|
{
|
2001-10-26 06:49:36 +00:00
|
|
|
Window::GetFocus();
|
2001-11-09 11:20:17 +00:00
|
|
|
// we have to forward the focus to our listbox to enable keystokes
|
|
|
|
if(m_pListBox)
|
|
|
|
m_pListBox->GrabFocus();
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2001-11-09 11:20:17 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::setActive(sal_Bool _bActive)
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2001-11-09 11:20:17 +00:00
|
|
|
SetBoldTitle( _bActive );
|
|
|
|
m_bActive = _bActive;
|
|
|
|
if (!_bActive && m_pListBox && m_pListBox->GetSelectionCount() != 0)
|
2011-01-14 15:00:11 +01:00
|
|
|
m_pListBox->SelectAll(sal_False);
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::Remove()
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Fenster loeschen
|
2001-02-28 09:18:26 +00:00
|
|
|
OJoinTableView* pTabWinCont = getTableView();
|
2001-02-05 08:26:47 +00:00
|
|
|
pTabWinCont->RemoveTabWin( this );
|
|
|
|
pTabWinCont->Invalidate();
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool OTableWindow::HandleKeyInput( const KeyEvent& rEvt )
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2002-02-06 07:15:30 +00:00
|
|
|
const KeyCode& rCode = rEvt.GetKeyCode();
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nCode = rCode.GetCode();
|
|
|
|
sal_Bool bShift = rCode.IsShift();
|
|
|
|
sal_Bool bCtrl = rCode.IsMod1();
|
2001-02-05 08:26:47 +00:00
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool bHandle = sal_False;
|
2002-05-22 09:38:07 +00:00
|
|
|
|
2001-02-05 08:26:47 +00:00
|
|
|
if( !bCtrl && !bShift && (nCode==KEY_DELETE) )
|
|
|
|
{
|
|
|
|
Remove();
|
2011-01-14 15:00:11 +01:00
|
|
|
bHandle = sal_True;
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
2002-05-22 09:38:07 +00:00
|
|
|
return bHandle;
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool OTableWindow::ExistsAConn() const
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
|
|
|
return getTableView()->ExistsAConn(this);
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OTableWindow::EnumValidFields(::std::vector< ::rtl::OUString>& arrstrFields)
|
|
|
|
{
|
|
|
|
arrstrFields.clear();
|
|
|
|
// diese Default-Implementierung zaehlt einfach alles auf, was es in der ListBox gibt ... fuer anderes Verhalten ueberschreiben
|
2002-02-06 07:15:30 +00:00
|
|
|
if ( m_pListBox )
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
2002-02-06 07:15:30 +00:00
|
|
|
arrstrFields.reserve(m_pListBox->GetEntryCount());
|
|
|
|
SvLBoxEntry* pEntryLoop = m_pListBox->First();
|
|
|
|
while (pEntryLoop)
|
|
|
|
{
|
|
|
|
arrstrFields.push_back(m_pListBox->GetEntryText(pEntryLoop));
|
|
|
|
pEntryLoop = m_pListBox->Next(pEntryLoop);
|
|
|
|
}
|
2001-02-05 08:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::StateChanged( StateChangedType nType )
|
|
|
|
{
|
|
|
|
Window::StateChanged( nType );
|
|
|
|
|
|
|
|
if ( nType == STATE_CHANGE_ZOOM )
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
Font aFont = rStyleSettings.GetGroupFont();
|
|
|
|
if ( IsControlFont() )
|
|
|
|
aFont.Merge( GetControlFont() );
|
|
|
|
SetZoomedPointFont( aFont );
|
|
|
|
|
|
|
|
m_aTitle.SetZoom(GetZoom());
|
|
|
|
m_pListBox->SetZoom(GetZoom());
|
|
|
|
Resize();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2002-02-06 07:15:30 +00:00
|
|
|
Reference< XAccessible > OTableWindow::CreateAccessible()
|
|
|
|
{
|
2003-06-25 10:04:59 +00:00
|
|
|
OTableWindowAccess* pAccessible = new OTableWindowAccess(this);
|
2002-02-08 08:10:00 +00:00
|
|
|
m_pAccessible = pAccessible;
|
|
|
|
return pAccessible;
|
2002-02-06 07:15:30 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::Command(const CommandEvent& rEvt)
|
|
|
|
{
|
|
|
|
switch (rEvt.GetCommand())
|
|
|
|
{
|
|
|
|
case COMMAND_CONTEXTMENU:
|
|
|
|
{
|
2008-06-25 11:54:20 +00:00
|
|
|
OJoinController& rController = getDesignView()->getController();
|
|
|
|
if(!rController.isReadOnly() && rController.isConnected())
|
2002-02-06 07:15:30 +00:00
|
|
|
{
|
|
|
|
Point ptWhere;
|
|
|
|
if ( rEvt.IsMouseEvent() )
|
|
|
|
ptWhere = rEvt.GetMousePosPixel();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvLBoxEntry* pCurrent = m_pListBox->GetCurEntry();
|
|
|
|
if ( pCurrent )
|
2006-06-20 02:28:47 +00:00
|
|
|
ptWhere = m_pListBox->GetEntryPosition(pCurrent);
|
2002-02-06 07:15:30 +00:00
|
|
|
else
|
|
|
|
ptWhere = m_aTitle.GetPosPixel();
|
|
|
|
}
|
2001-06-28 13:22:47 +00:00
|
|
|
|
2002-05-24 12:00:41 +00:00
|
|
|
PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
|
2002-02-06 07:15:30 +00:00
|
|
|
switch (aContextMenu.Execute(this, ptWhere))
|
|
|
|
{
|
|
|
|
case SID_DELETE:
|
|
|
|
Remove();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
Window::Command(rEvt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
long OTableWindow::PreNotify(NotifyEvent& rNEvt)
|
|
|
|
{
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool bHandled = sal_False;
|
2002-02-06 07:15:30 +00:00
|
|
|
switch (rNEvt.GetType())
|
|
|
|
{
|
|
|
|
case EVENT_KEYINPUT:
|
|
|
|
{
|
2008-06-25 11:54:20 +00:00
|
|
|
if ( getDesignView()->getController().isReadOnly() )
|
2002-06-24 06:49:59 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-06 07:15:30 +00:00
|
|
|
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
|
|
|
|
const KeyCode& rCode = pKeyEvent->GetKeyCode();
|
2002-06-11 06:33:43 +00:00
|
|
|
if ( rCode.IsMod1() )
|
2002-02-06 07:15:30 +00:00
|
|
|
{
|
|
|
|
Point aStartPoint = GetPosPixel();
|
2002-06-21 06:09:34 +00:00
|
|
|
if ( rCode.IsShift() )
|
|
|
|
{
|
|
|
|
aStartPoint.X() = GetSizePixel().Width();
|
|
|
|
aStartPoint.Y() = GetSizePixel().Height();
|
|
|
|
}
|
|
|
|
|
2002-02-06 07:15:30 +00:00
|
|
|
switch( rCode.GetCode() )
|
|
|
|
{
|
|
|
|
case KEY_DOWN:
|
2011-01-14 15:00:11 +01:00
|
|
|
bHandled = sal_True;
|
2002-02-06 07:15:30 +00:00
|
|
|
aStartPoint.Y() += m_nMoveIncrement;
|
|
|
|
break;
|
|
|
|
case KEY_UP:
|
2011-01-14 15:00:11 +01:00
|
|
|
bHandled = sal_True;
|
2002-02-06 07:15:30 +00:00
|
|
|
aStartPoint.Y() += -m_nMoveIncrement;
|
|
|
|
break;
|
|
|
|
case KEY_LEFT:
|
2011-01-14 15:00:11 +01:00
|
|
|
bHandled = sal_True;
|
2002-02-06 07:15:30 +00:00
|
|
|
aStartPoint.X() += -m_nMoveIncrement;
|
|
|
|
break;
|
|
|
|
case KEY_RIGHT:
|
2011-01-14 15:00:11 +01:00
|
|
|
bHandled = sal_True;
|
2002-02-06 07:15:30 +00:00
|
|
|
aStartPoint.X() += m_nMoveIncrement;
|
|
|
|
break;
|
|
|
|
}
|
2002-06-21 06:09:34 +00:00
|
|
|
if ( bHandled )
|
2002-02-06 07:15:30 +00:00
|
|
|
{
|
2002-06-21 06:09:34 +00:00
|
|
|
if ( rCode.IsShift() )
|
|
|
|
{
|
2002-06-24 06:49:59 +00:00
|
|
|
OJoinTableView* pView = getTableView();
|
|
|
|
Point ptOld = GetPosPixel();
|
|
|
|
Size aSize = pView->getRealOutputSize();
|
|
|
|
Size aNewSize(aStartPoint.X(),aStartPoint.Y());
|
|
|
|
if ( ((ptOld.X() + aNewSize.Width()) <= aSize.Width())
|
|
|
|
&& ((ptOld.Y() + aNewSize.Height()) <= aSize.Height()) )
|
|
|
|
{
|
|
|
|
if ( aNewSize.Width() < TABWIN_WIDTH_MIN )
|
|
|
|
aNewSize.Width() = TABWIN_WIDTH_MIN;
|
|
|
|
if ( aNewSize.Height() < TABWIN_HEIGHT_MIN )
|
|
|
|
aNewSize.Height() = TABWIN_HEIGHT_MIN;
|
|
|
|
|
|
|
|
Size szOld = GetSizePixel();
|
|
|
|
|
|
|
|
aNewSize = Size(pView->CalcZoom(aNewSize.Width()),pView->CalcZoom(aNewSize.Height()));
|
|
|
|
SetPosSizePixel( ptOld, aNewSize );
|
|
|
|
pView->TabWinSized(this, ptOld, szOld);
|
|
|
|
Invalidate( INVALIDATE_NOCHILDREN );
|
|
|
|
}
|
2002-06-21 06:09:34 +00:00
|
|
|
}
|
|
|
|
else
|
2002-05-22 09:38:07 +00:00
|
|
|
{
|
2002-06-21 06:09:34 +00:00
|
|
|
// remember how often the user moved our window
|
|
|
|
++m_nMoveCount;
|
|
|
|
if( m_nMoveCount == 5 )
|
|
|
|
m_nMoveIncrement = 10;
|
|
|
|
else if( m_nMoveCount > 15 )
|
|
|
|
m_nMoveCount = m_nMoveIncrement = 20;
|
|
|
|
|
|
|
|
Point aOldDataPoint = GetData()->GetPosition();
|
|
|
|
Point aNewDataPoint = aStartPoint + getTableView()->GetScrollOffset();
|
|
|
|
if ( aNewDataPoint.X() > -1 && aNewDataPoint.Y() > -1 )
|
2002-05-22 09:38:07 +00:00
|
|
|
{
|
2002-06-21 06:09:34 +00:00
|
|
|
OJoinTableView* pView = getTableView();
|
|
|
|
if ( pView->isMovementAllowed(aNewDataPoint, GetData()->GetSize()) )
|
|
|
|
{
|
|
|
|
SetPosPixel(aStartPoint);
|
|
|
|
|
|
|
|
// aNewDataPoint can not be used here because SetPosPixel reset it
|
|
|
|
pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize());
|
|
|
|
pView->TabWinMoved(this,aOldDataPoint);
|
|
|
|
Invalidate(INVALIDATE_NOCHILDREN);
|
2008-06-25 11:54:20 +00:00
|
|
|
getDesignView()->getController().setModified( sal_True );
|
2002-06-21 06:09:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_nMoveCount = 0; // reset our movement count
|
|
|
|
m_nMoveIncrement = 1;
|
|
|
|
}
|
2002-05-22 09:38:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_nMoveCount = 0; // reset our movement count
|
|
|
|
m_nMoveIncrement = 1;
|
|
|
|
}
|
|
|
|
}
|
2002-06-24 06:49:59 +00:00
|
|
|
resetSizingFlag();
|
2002-02-06 07:15:30 +00:00
|
|
|
}
|
2002-05-22 09:38:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_nMoveCount = 0; // reset our movement count
|
|
|
|
m_nMoveIncrement = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_nMoveCount = 0; // reset our movement count
|
|
|
|
m_nMoveIncrement = 1;
|
2002-02-06 07:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-22 09:38:07 +00:00
|
|
|
break;
|
|
|
|
case EVENT_KEYUP:
|
|
|
|
{
|
|
|
|
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
|
|
|
|
const KeyCode& rCode = pKeyEvent->GetKeyCode();
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nKeyCode = rCode.GetCode();
|
2002-05-22 09:38:07 +00:00
|
|
|
if ( rCode.IsMod2() && nKeyCode != KEY_UP && nKeyCode != KEY_DOWN && nKeyCode != KEY_LEFT && nKeyCode != KEY_RIGHT )
|
|
|
|
{
|
|
|
|
m_nMoveCount = 0; // reset our movement count
|
|
|
|
m_nMoveIncrement = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-02-06 07:15:30 +00:00
|
|
|
}
|
|
|
|
if (!bHandled)
|
|
|
|
return Window::PreNotify(rNEvt);
|
|
|
|
return 1L;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2002-02-08 08:10:00 +00:00
|
|
|
String OTableWindow::getTitle() const
|
|
|
|
{
|
|
|
|
return m_aTitle.GetText();
|
|
|
|
}
|
2002-05-08 08:09:31 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2008-10-01 12:28:29 +00:00
|
|
|
void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
FillListBox();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::_elementRemoved( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
FillListBox();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTableWindow::_elementReplaced( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
FillListBox();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|