summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-21 14:49:59 +0200
committerobo <obo@openoffice.org>2010-06-21 14:49:59 +0200
commitca1e640c70f7953d31aa2676e1fadbe8f4e25cc4 (patch)
tree103d1b61c7da4afa0a66b68b26865c4addc13581 /svtools
parent7909970540ae7c31fe8b93705b50dd93e9208f85 (diff)
parent03a87109c292e5a2090ab49beb362a87f6020ae8 (diff)
CWS-TOOLING: integrate CWS gridcontrol04
Diffstat (limited to 'svtools')
-rwxr-xr-xsvtools/inc/svtools/accessibletable.hxx2
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx1
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx4
-rw-r--r--svtools/inc/svtools/table/tabledatawindow.hxx5
-rw-r--r--svtools/source/contnr/fileview.cxx231
-rw-r--r--svtools/source/table/gridtablerenderer.cxx145
-rw-r--r--svtools/source/table/tablecontrol.cxx13
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx39
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx1
-rw-r--r--svtools/source/table/tabledatawindow.cxx31
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.cxx52
11 files changed, 355 insertions, 169 deletions
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index 198a24b8eb62..8ff17a2b71c7 100755
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -124,7 +124,7 @@ public:
virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
virtual std::vector<sal_Int32>& GetSelectedRows() = 0;
virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0;
- virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0;
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
};
// ----------------------------------------------------------------------------
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
index 2b3951f6aaf3..9206f20ecbcb 100644
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx
@@ -116,6 +116,7 @@ namespace svt { namespace table
/** returns selection engine*/
virtual SelectionEngine* getSelEngine() = 0;
virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
+ virtual bool isTooltipActive() = 0;
virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0;
virtual RowPos getCurrentRow(const Point& rPoint ) = 0;
virtual void resizeColumn(const Point& rPoint ) = 0;
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index 6eb7f063f9fa..f3b7ed88b565 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -79,6 +79,7 @@ namespace svt { namespace table
::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText;
Link m_aSelectHdl;
bool m_bSelectionChanged;
+ bool m_bTooltip;
public:
::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable;
@@ -217,12 +218,13 @@ namespace svt { namespace table
virtual sal_Bool isAccessibleAlive( ) const;
virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
virtual void RemoveSelectedRow(RowPos _nRowPos);
- virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos);
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip();
::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip();
void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
void clearSelection();
void selectionChanged(bool _bChanged);
+ bool isTooltip();
protected:
/// retrieves the XAccessible implementation associated with the GridControl instance
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx
index c9f96483d943..9a6ece489119 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/inc/svtools/table/tabledatawindow.hxx
@@ -74,6 +74,11 @@ namespace svt { namespace table
virtual void CaptureMouse();
virtual void ReleaseMouse();
virtual long Notify(NotifyEvent& rNEvt);
+ virtual void SetControlBackground(const Color& rColor);
+ virtual void SetControlBackground();
+
+ void SetBackground(const Wallpaper& rColor);
+ void SetBackground();
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 843de83f7710..af19379d8b8f 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -54,6 +54,9 @@
#include <vcl/waitobj.hxx>
#include <com/sun/star/io/XPersist.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <algorithm>
#include <memory>
@@ -100,7 +103,7 @@ using ::rtl::OUString;
DECLARE_LIST( StringList_Impl, OUString* )
-#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap
+#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap
#define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reseted
namespace
@@ -210,6 +213,7 @@ private:
sal_Bool mbResizeDisabled : 1;
sal_Bool mbAutoResize : 1;
sal_Bool mbEnableDelete : 1;
+ sal_Bool mbEnableRename : 1;
void DeleteEntries();
void DoQuickSearch( const xub_Unicode& rChar );
@@ -232,6 +236,7 @@ public:
void EnableAutoResize() { mbAutoResize = sal_True; }
void EnableDelete( sal_Bool bEnable ) { mbEnableDelete = bEnable; }
+ void EnableRename( sal_Bool bEnable ) { mbEnableRename = bEnable; }
sal_Bool IsDeleteOrContextMenuEnabled() { return mbEnableDelete || IsContextMenuHandlingEnabled(); }
Reference< XCommandEnvironment > GetCommandEnvironment() const { return mxCmdEnv; }
@@ -299,11 +304,11 @@ inline const OUString& HashedEntry::GetName() const
class HashedEntryList : protected List
{// provides a list of _unique_ Entries
protected:
- inline HashedEntry* First();
- inline HashedEntry* Next();
- inline void Append( HashedEntry* pNewEntry );
+ inline HashedEntry* First();
+ inline HashedEntry* Next();
+ inline void Append( HashedEntry* pNewEntry );
public:
- virtual ~HashedEntryList();
+ virtual ~HashedEntryList();
const HashedEntry* Find( const OUString& rNameToSearchFor );
const HashedEntry* Find( const HashedEntry& rToSearchFor );
@@ -338,7 +343,7 @@ HashedEntryList::~HashedEntryList()
const HashedEntry* HashedEntryList::Find( const OUString& rRefName )
{ // simple linear search, which should be fast enough for this purpose
- HashedEntry aRef( rRefName );
+ HashedEntry aRef( rRefName );
HashedEntry* pIter = First();
while( pIter && *pIter != aRef )
pIter = Next();
@@ -419,12 +424,12 @@ class NameTranslationList : protected HashedEntryList
{ // contains a list of substitutes of strings for a given folder (as URL)
// explanation of the circumstances see in remarks for Init();
protected:
- INetURLObject maTransFile; // URL of file with translation entries
- HashedEntry maHashedURL; // for future purposes when dealing with a set of cached
- // NameTranslationLists
+ INetURLObject maTransFile; // URL of file with translation entries
+ HashedEntry maHashedURL; // for future purposes when dealing with a set of cached
+ // NameTranslationLists
private:
const String maTransFileName;
- void Init(); // reads the translation file and fills the (internal) list
+ void Init(); // reads the translation file and fills the (internal) list
public:
NameTranslationList( const INetURLObject& rBaseURL );
@@ -436,12 +441,12 @@ public:
using List::operator!=;
inline sal_Bool operator !=( const HashedEntry& rRef ) const;
- const OUString* Translate( const OUString& rName ) const;
+ const OUString* Translate( const OUString& rName ) const;
// returns NULL, if rName can't be found
- inline void Update(); // clears list and init
+ inline void Update(); // clears list and init
- inline const String& GetTransTableFileName() const;
+ inline const String& GetTransTableFileName() const;
// returns the name for the file, which contains the translation strings
};
@@ -463,7 +468,7 @@ void NameTranslationList::Init()
if( aTestContent.isDocument() )
{// ... also tests the existence of maTransFile by throwing an Exception
- const sal_Char* pSection = "TRANSLATIONNAMES";
+ const sal_Char* pSection = "TRANSLATIONNAMES";
String aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) );
Config aConfig( aFsysName );
@@ -475,7 +480,7 @@ void NameTranslationList::Init()
Insert( new NameTranslationEntry( aConfig.GetKeyName( nCnt ), aConfig.ReadKey( nCnt ) ) );
}
}
- catch( Exception& ) {}
+ catch( Exception const & ) {}
}
NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ):
@@ -527,7 +532,7 @@ public:
// IContentTitleTranslation
virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const;
- void UpdateTranslationTable(); // reads the translation file again
+ void UpdateTranslationTable(); // reads the translation file again
void SetActualFolder( const INetURLObject& rActualFolder );
const String* GetTransTableFileName() const;
@@ -600,7 +605,7 @@ public:
void OpenFolder_Impl();
// #83004# -------
- void ReplaceTabWithString( OUString& aValue );
+ void ReplaceTabWithString( OUString& aValue );
void CreateDisplayText_Impl();
void CreateVector_Impl( const Sequence < OUString > &rList );
void SortFolderContent_Impl();
@@ -661,11 +666,13 @@ inline void SvtFileView_Impl::EnableDelete( sal_Bool bEnable )
inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable )
{
+ mpView->EnableRename( bEnable );
+
sal_Bool bRet;
if( mpView->IsDeleteOrContextMenuEnabled() )
{
DBG_ASSERT( !mbReplaceNames, "SvtFileView_Impl::EnableNameReplacing(): state should be not possible!" );
- bRet = !bEnable; // only for enabling this is an unsuccessful result
+ bRet = !bEnable; // only for enabling this is an unsuccessful result
}
else
{
@@ -744,7 +751,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
mnSearchIndex ( 0 ),
mbResizeDisabled ( sal_False ),
mbAutoResize ( sal_False ),
- mbEnableDelete ( sal_True )
+ mbEnableDelete ( sal_True ),
+ mbEnableRename ( sal_True )
{
Size aBoxSize = pParentWin->GetSizePixel();
@@ -824,7 +832,7 @@ void ViewTabListBox_Impl::Resize()
mbResizeDisabled = sal_True;
Point aPos = GetPosPixel();
SetPosSizePixel( Point( 0, aBarSize.Height() ),
- Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
+ Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
mbResizeDisabled = sal_False;
}
}
@@ -870,20 +878,90 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void )
{
- PopupMenu* pRet;
- sal_Int32 nSelectedEntries = GetSelectionCount();
+ bool bEnableDelete = mbEnableDelete;
+ bool bEnableRename = mbEnableRename;
+
+ if ( bEnableDelete || bEnableRename )
+ {
+ sal_Int32 nSelectedEntries = GetSelectionCount();
+ bEnableDelete &= nSelectedEntries > 0;
+ bEnableRename &= nSelectedEntries == 1;
+ }
+
+ if ( bEnableDelete || bEnableRename )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ while ( pEntry )
+ {
+ ::ucbhelper::Content aCnt;
+ try
+ {
+ OUString aURL( static_cast< SvtContentEntry * >(
+ pEntry->GetUserData() )->maURL );
+ aCnt = ::ucbhelper::Content( aURL, mxCmdEnv );
+ }
+ catch( Exception const & )
+ {
+ bEnableDelete = bEnableRename = false;
+ }
+
+ if ( bEnableDelete )
+ {
+ try
+ {
+ Reference< XCommandInfo > aCommands = aCnt.getCommands();
+ if ( aCommands.is() )
+ bEnableDelete
+ = aCommands->hasCommandByName(
+ OUString::createFromAscii( "delete" ) );
+ else
+ bEnableDelete = false;
+ }
+ catch( Exception const & )
+ {
+ bEnableDelete = false;
+ }
+ }
+
+ if ( bEnableRename )
+ {
+ try
+ {
+ Reference< XPropertySetInfo > aProps = aCnt.getProperties();
+ if ( aProps.is() )
+ {
+ Property aProp
+ = aProps->getPropertyByName(
+ OUString::createFromAscii( "Title" ) );
+ bEnableRename
+ = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ else
+ bEnableRename = false;
+ }
+ catch( Exception const & )
+ {
+ bEnableRename = false;
+ }
+ }
+
+ pEntry = ( bEnableDelete || bEnableRename )
+ ? NextSelected( pEntry )
+ : 0;
+ }
+ }
- if ( nSelectedEntries )
+ if ( bEnableDelete || bEnableRename )
{
- pRet = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
- pRet->EnableItem( MID_FILEVIEW_DELETE, 0 < nSelectedEntries );
- pRet->EnableItem( MID_FILEVIEW_RENAME, 1 == nSelectedEntries );
+ PopupMenu * pRet
+ = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
+ pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete );
+ pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename );
pRet->RemoveDisabledEntries( sal_True, sal_True );
+ return pRet;
}
- else
- pRet = NULL;
- return pRet;
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -928,12 +1006,31 @@ void ViewTabListBox_Impl::DeleteEntries()
aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL;
if ( !aURL.Len() )
- return;
+ continue;
+
+ bool canDelete = true;
+ try
+ {
+ ::ucbhelper::Content aCnt( aURL, mxCmdEnv );
+ Reference< XCommandInfo > aCommands = aCnt.getCommands();
+ if ( aCommands.is() )
+ canDelete
+ = aCommands->hasCommandByName(
+ OUString::createFromAscii( "delete" ) );
+ else
+ canDelete = false;
+ }
+ catch( Exception const & )
+ {
+ canDelete = false;
+ }
- INetURLObject aObj( aURL );
+ if (!canDelete)
+ continue; // process next entry
if ( eResult != svtools::QUERYDELETE_ALL )
{
+ INetURLObject aObj( aURL );
svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
if ( sDialogPosition.Len() )
aDlg.SetWindowState( sDialogPosition );
@@ -979,22 +1076,44 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry,
try
{
+ OUString aPropName = OUString::createFromAscii( "Title" );
+ bool canRename = true;
::ucbhelper::Content aContent( aURL, mxCmdEnv );
- OUString aPropName = OUString::createFromAscii( "Title" );
- Any aValue;
- aValue <<= OUString( rNewText );
- aContent.setPropertyValue( aPropName, aValue );
- mpParent->EntryRenamed( aURL, rNewText );
+ try
+ {
+ Reference< XPropertySetInfo > aProps = aContent.getProperties();
+ if ( aProps.is() )
+ {
+ Property aProp = aProps->getPropertyByName( aPropName );
+ canRename = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ else
+ {
+ canRename = false;
+ }
+ }
+ catch ( Exception const & )
+ {
+ canRename = false;
+ }
+
+ if ( canRename )
+ {
+ Any aValue;
+ aValue <<= OUString( rNewText );
+ aContent.setPropertyValue( aPropName, aValue );
+ mpParent->EntryRenamed( aURL, rNewText );
- pData->maURL = aURL;
- pEntry->SetUserData( pData );
+ pData->maURL = aURL;
+ pEntry->SetUserData( pData );
- bRet = TRUE;
+ bRet = TRUE;
+ }
+ }
+ catch( Exception const & )
+ {
}
- catch( ::com::sun::star::ucb::ContentCreationException ) {}
- catch( ::com::sun::star::ucb::CommandAbortedException ) {}
- catch( ::com::sun::star::uno::Exception ) {}
return bRet;
}
@@ -1095,12 +1214,12 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent )
::ucbhelper::Content aCnt( rContent, mxCmdEnv );
aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) );
}
- catch( ::com::sun::star::ucb::CommandAbortedException& )
+ catch( ::com::sun::star::ucb::CommandAbortedException const & )
{
DBG_WARNING( "CommandAbortedException" );
bRet = sal_False;
}
- catch( ::com::sun::star::uno::Exception& )
+ catch( Exception const & )
{
DBG_WARNING( "Any other exception" );
bRet = sal_False;
@@ -1314,7 +1433,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const
}
}
}
- catch( ::com::sun::star::uno::Exception )
+ catch( Exception const & )
{
// perhaps an unkown url protocol (e.g. "private:newdoc")
}
@@ -1366,7 +1485,7 @@ sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com:
mpImp->FilterFolderContent_Impl( rFilter );
- mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!!
+ mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!!
mpImp->CreateDisplayText_Impl();
mpImp->OpenFolder_Impl();
@@ -1999,7 +2118,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
{
// normalize the content title (we always match case-insensitive)
// 91872 - 11.09.2001 - frank.schoenheit@sun.com
- sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title!
+ sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title!
sal_Bool bDelete;
if( bHideTransFile && sCompareString == sHideEntry )
@@ -2643,12 +2762,12 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ),
- _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ),
- _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ),
- _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ),
- _aYesButton ( this, SvtResId( BTN_YES ) ),
- _aAllButton ( this, SvtResId( BTN_ALL ) ),
- _aNoButton ( this, SvtResId( BTN_NO ) ),
+ _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ),
+ _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ),
+ _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ),
+ _aYesButton ( this, SvtResId( BTN_YES ) ),
+ _aAllButton ( this, SvtResId( BTN_ALL ) ),
+ _aNoButton ( this, SvtResId( BTN_NO ) ),
_aCancelButton( this, SvtResId( BTN_CANCEL ) )
{
@@ -2671,12 +2790,6 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
// -----------------------------------------------------------------------
IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn )
-
-/* [Beschreibung]
-
- Die Methode wertet das Resultat der Abfrage aus.
-*/
-
{
if ( pBtn == &pThis->_aYesButton )
pThis->_eResult = QUERYDELETE_YES;
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index a3f954e0bef5..8e5bd181a583 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -109,7 +109,10 @@ namespace svt { namespace table
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ if(m_pImpl->rModel.getTextColor() != 0x000000)
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
ULONG nHorFlag = TEXT_DRAW_LEFT;
ULONG nVerFlag = TEXT_DRAW_TOP;
if(m_pImpl->rModel.getVerticalAlign() == 1)
@@ -146,6 +149,11 @@ namespace svt { namespace table
Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
Color line = m_pImpl->rModel.getLineColor();
Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color fieldColor = _rStyle.GetFieldColor();
+ if(aRowBackground == 0xFFFFFF)
+ aRowBackground = fieldColor;
+ if(aRowBackground2 == 0xFFFFFF)
+ aRowBackground2 = fieldColor;
//if row is selected background color becomes blue, and lines should be also blue
//if they aren't user defined
if(_bSelected)
@@ -161,7 +169,7 @@ namespace svt { namespace table
//and set line color to be the same
else
{
- if(aRowBackground2 != 0xFFFFFF && _nRow%2)
+ if(aRowBackground2 != fieldColor && _nRow%2)
{
aRowBackground = aRowBackground2;
if(line == 0xFFFFFF)
@@ -170,7 +178,7 @@ namespace svt { namespace table
_rDevice.SetLineColor(line);
}
//fill the rows with alternating background colors if second background color is specified
- else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF)
+ else if(aRowBackground != fieldColor && line == 0xFFFFFF)
_rDevice.SetLineColor(aRowBackground);
else
{
@@ -195,7 +203,10 @@ namespace svt { namespace table
_rDevice.Push( PUSH_LINECOLOR);
_rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ if(m_pImpl->rModel.getTextColor() != 0x000000)
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
ULONG nHorFlag = TEXT_DRAW_LEFT;
ULONG nVerFlag = TEXT_DRAW_TOP;
if(m_pImpl->rModel.getVerticalAlign() == 1)
@@ -221,44 +232,42 @@ namespace svt { namespace table
void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData )
{
- _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION);
- _rDevice.IntersectClipRegion( _rArea );
- Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
- Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- //if row is selected and line color isn't user specified, set it blue
- if(_bSelected)
- {
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(_rStyle.GetHighlightColor());
- else
- _rDevice.SetLineColor(line);
- }
- //else set line color to the color of row background
- else
- {
- if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR);
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
{
if(line == 0xFFFFFF)
- _rDevice.SetLineColor(background2);
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
else
_rDevice.SetLineColor(line);
}
- else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
- _rDevice.SetLineColor(background1);
+ //else set line color to the color of row background
else
{
- //if line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor(line);
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
+ {
+ //if line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
}
- }
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- {
- // TODO: remove those temporary place holders
- Rectangle aRect( _rArea );
- ++aRect.Left(); --aRect.Right();
- aRect.Top(); aRect.Bottom();
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+
+ Rectangle aRect( _rArea );
+ ++aRect.Left(); --aRect.Right();
+ aRect.Top(); aRect.Bottom();
Point imagePos(Point(aRect.Left(), aRect.Top()));
Size imageSize = _pCellData->GetSizePixel();
if(aRect.GetWidth() > imageSize.Width())
@@ -281,8 +290,7 @@ namespace svt { namespace table
imageSize.Height() = aRect.GetHeight()-1;
Image& image (*_pCellData);
_rDevice.DrawImage(imagePos, imageSize, image, 0);
- }
- _rDevice.Pop();
+ _rDevice.Pop();
(void)_bActive;
// no special painting for the active cell at the moment
@@ -293,48 +301,47 @@ namespace svt { namespace table
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
{
_rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
- Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- //if row is selected and line color isn't user specified, set it blue
- if(_bSelected)
- {
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(_rStyle.GetHighlightColor());
- else
- _rDevice.SetLineColor(line);
- }
- //else set line color to the color of row background
- else
- {
- if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
{
if(line == 0xFFFFFF)
- _rDevice.SetLineColor(background2);
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
else
_rDevice.SetLineColor(line);
}
- else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
- _rDevice.SetLineColor(background1);
+ //else set line color to the color of row background
else
{
- //if Line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor(line);
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
+ {
+ //if Line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
}
- }
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- {
- // TODO: remove those temporary place holders
- Rectangle aRect( _rArea );
- ++aRect.Left(); --aRect.Right();
- aRect.Top(); aRect.Bottom();
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+
+ Rectangle aRect( _rArea );
+ ++aRect.Left(); --aRect.Right();
+ aRect.Top(); aRect.Bottom();
if(_bSelected)
- {
_rDevice.SetTextColor(_rStyle.GetHighlightTextColor());
- }
- else
+ else if(m_pImpl->rModel.getTextColor() != 0x000000)
_rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ else
+ _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
ULONG nHorFlag = TEXT_DRAW_LEFT;
ULONG nVerFlag = TEXT_DRAW_TOP;
if(m_pImpl->rModel.getVerticalAlign() == 1)
@@ -348,8 +355,8 @@ namespace svt { namespace table
Rectangle textRect(_rArea);
textRect.Left()+=4; textRect.Right()-=4;
textRect.Bottom()-=2;
- _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
- }
+ _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+
_rDevice.Pop();
(void)_bActive;
// no special painting for the active cell at the moment
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 1770bfd7dd02..33c80e642118 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -70,6 +70,7 @@ namespace svt { namespace table
:Control( _pParent, _nStyle )
,m_pImpl( new TableControl_Impl( *this ) )
,m_bSelectionChanged(false)
+ ,m_bTooltip(false)
{
TableDataWindow* aTableData = m_pImpl->getDataWindow();
aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
@@ -306,7 +307,7 @@ namespace svt { namespace table
aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
break;
case TCTYPE_TABLECELL:
- aRetText = GetRowName(_nRow);
+ aRetText = GetAccessibleCellText(_nRow, _nCol);
break;
case TCTYPE_ROWHEADERCELL:
aRetText = GetRowName(_nRow);
@@ -389,9 +390,9 @@ namespace svt { namespace table
}
// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos)
+::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
{
- ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos);
+ const ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos);
return m_pImpl->convertToString(cellContent);
}
// -----------------------------------------------------------------------------
@@ -589,6 +590,7 @@ void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUSt
{
m_aText = aText;
m_nCols = nCols;
+ m_bTooltip = true;
}
// -----------------------------------------------------------------------
void TableControl::selectionChanged(bool _bChanged)
@@ -596,6 +598,11 @@ void TableControl::selectionChanged(bool _bChanged)
m_bSelectionChanged = _bChanged;
}
// -----------------------------------------------------------------------
+bool TableControl::isTooltip()
+{
+ return m_bTooltip;
+}
+// -----------------------------------------------------------------------
IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
{
Select();
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 3288ab6a4284..90bc4899209b 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -609,10 +609,10 @@ namespace svt { namespace table
if(pColumn->getMinWidth() == 0 && bResizable)
{
pColumn->setMinWidth(1);
- minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width();
+ minColWithoutFixedSum+=m_rAntiImpl.PixelToLogic( Size( 1, 0 ), MAP_APPFONT ).Width();
}
if(pColumn->getMaxWidth() == 0 && bResizable)
- pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
+ pColumn->setMaxWidth(m_rAntiImpl.PixelToLogic( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
if( colPrefWidth != 0)
{
if(m_bResizingGrid)
@@ -884,6 +884,16 @@ namespace svt { namespace table
// position it
if ( m_pHScroll )
{
+ TableSize nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false );
+ int nRange = m_nColumnCount;
+ if( m_nLeftColumn + nVisibleUnits == nRange-1)
+ {
+ if(m_aAccColumnWidthsPixel[nRange-2] - m_aAccColumnWidthsPixel[m_nLeftColumn] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth())
+ {
+ m_pHScroll->SetVisibleSize( nVisibleUnits -1 );
+ m_pHScroll->SetPageSize(nVisibleUnits -1);
+ }
+ }
Rectangle aScrollbarArea(
Point( 0, aDataCellPlayground.Bottom() + 1 ),
Size( aDataCellPlayground.Right() + 1, nScrollbarMetrics )
@@ -1000,7 +1010,6 @@ namespace svt { namespace table
*m_pDataWindow, aCell.getRect(), rStyle );
}
}
-
// the area occupied by the row header, if any
Rectangle aRowHeaderArea;
if ( m_pModel->hasRowHeaders() )
@@ -1014,12 +1023,13 @@ namespace svt { namespace table
//to avoid double lines when scrolling vertically
if(m_nTopRow != 0)
--aRowHeaderArea.Top();
+ --aRowHeaderArea.Right();
pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
// Note that strictly, aRowHeaderArea also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
// so this hopefully doesn't hurt if we already paint it here.
- if ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
@@ -1030,6 +1040,7 @@ namespace svt { namespace table
--aInters.Top();
--aInters.Bottom();
}
+ --aInters.Right();
pRenderer->PaintHeaderArea(
*m_pDataWindow, aInters, true, true, rStyle
);
@@ -1068,6 +1079,11 @@ namespace svt { namespace table
--aRect.Top();
if(m_nLeftColumn != 0)
--aRect.Left();
+ else
+ {
+ if(m_pModel->hasRowHeaders())
+ --aRect.Left();
+ }
// give the redenderer a chance to prepare the row
pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
*m_pDataWindow, aRect, rStyle );
@@ -1908,6 +1924,11 @@ namespace svt { namespace table
return -1;
}
//-------------------------------------------------------------------------------
+ bool TableControl_Impl::isTooltipActive()
+ {
+ return m_rAntiImpl.isTooltip();
+ }
+ //-------------------------------------------------------------------------------
::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint )
{
::rtl::OUString aTooltipText;
@@ -2033,8 +2054,8 @@ namespace svt { namespace table
{
m_pDataWindow->HideTracking();
PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
- int maxWidth = pColumn->getMaxWidth();
- int minWidth = pColumn->getMinWidth();
+ int maxWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMaxWidth(), 0 ), MAP_APPFONT ).Width();
+ int minWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMinWidth(), 0 ), MAP_APPFONT ).Width();
int resizeCol = m_nResizingColumn-m_nLeftColumn;
//new position of mouse
int actX = rPoint.X();
@@ -2044,7 +2065,7 @@ namespace svt { namespace table
int leftX = 0;
if(m_nResizingColumn > m_nLeftColumn)
leftX = m_aVisibleColumnWidthsPixel[resizeCol-1];
- else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders())
+ else if(m_nResizingColumn == m_nLeftColumn && m_pModel->hasRowHeaders())
leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
int actWidth = actX - leftX;
int newActWidth = 0;
@@ -2057,7 +2078,7 @@ namespace svt { namespace table
pColumn->setPreferredWidth(newActWidth);
}
else
- pColumn->setPreferredWidth(minWidth);
+ pColumn->setPreferredWidth(pColumn->getMinWidth());
if(m_nLeftColumn != 0)
impl_updateLeftColumn();
}
@@ -2069,7 +2090,7 @@ namespace svt { namespace table
pColumn->setPreferredWidth(newActWidth);
}
else
- pColumn->setPreferredWidth(maxWidth);
+ pColumn->setPreferredWidth(pColumn->getMaxWidth());
}
m_nCurColumn = m_nResizingColumn;
impl_ni_updateColumnWidths();
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 12b518aa3578..053766d92841 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -210,6 +210,7 @@ namespace svt { namespace table
virtual void showCursor();
virtual bool dispatchAction( TableControlAction _eAction );
virtual SelectionEngine* getSelEngine();
+ virtual bool isTooltipActive();
virtual rtl::OUString& setTooltip(const Point& rPoint );
virtual void resizeColumn(const Point& rPoint);
virtual bool startResizeColumn(const Point& rPoint);
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 3245b7e84aac..e2e1ce5353fe 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -58,14 +58,33 @@ namespace svt { namespace table
{
m_rTableControl.doPaintContent( rUpdateRect );
}
-
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetBackground( const Wallpaper& rColor )
+ {
+ Window::SetBackground( rColor );
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetControlBackground( const Color& rColor )
+ {
+ Window::SetControlBackground( rColor );
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetBackground()
+ {
+ Window::SetBackground();
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetControlBackground()
+ {
+ Window::SetControlBackground();
+ }
//--------------------------------------------------------------------
void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
{
Point aPoint = rMEvt.GetPosPixel();
if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
{
- if(m_rTableControl.getCurrentRow(aPoint)>=0 )
+ if(m_rTableControl.getCurrentRow(aPoint)>=0 && m_rTableControl.isTooltipActive() )
{
SetPointer(POINTER_ARROW);
rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint);
@@ -102,12 +121,9 @@ namespace svt { namespace table
m_nRowAlreadySelected = nCurRow;
m_aSelectHdl.Call( NULL );
}
- else
- m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
}
- else
- m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
}
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().LoseFocus();
}
//--------------------------------------------------------------------
@@ -115,8 +131,7 @@ namespace svt { namespace table
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
Window::MouseButtonUp( rMEvt );
- else
- m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
+ m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GetFocus();
}
//--------------------------------------------------------------------
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 99b36c390f23..480987d50fac 100755
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -191,7 +191,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_HEADER_BACKGROUND:
{
- sal_Int32 colorHeader = 0x000000;
+ sal_Int32 colorHeader = 0xFFFFFF;
if( aValue >>= colorHeader )
{
m_pTableModel->setHeaderBackgroundColor(colorHeader);
@@ -200,7 +200,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_LINE_COLOR:
{
- sal_Int32 colorLine = 0x000000;
+ sal_Int32 colorLine = 0xFFFFFF;
if( aValue >>= colorLine )
{
m_pTableModel->setLineColor(colorLine);
@@ -209,7 +209,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
{
- sal_Int32 colorEvenRow = 0x000000;
+ sal_Int32 colorEvenRow = 0xFFFFFF;
if( aValue >>= colorEvenRow )
{
m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
@@ -218,7 +218,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_ROW_BACKGROUND:
{
- sal_Int32 colorBackground = 0x000000;
+ sal_Int32 colorBackground = 0xFFFFFF;
if( aValue >>= colorBackground )
{
m_pTableModel->setOddRowBackgroundColor(colorBackground);
@@ -227,13 +227,25 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_TEXTCOLOR:
{
- sal_Int32 colorText = 0xFFFFFF;
+ sal_Int32 colorText = 0x000000;
if( aValue >>= colorText )
{
m_pTableModel->setTextColor(colorText);
}
break;
}
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ {
+ sal_Int32 color = 0xFFFFFF;
+ Color color1 = pTable->GetSettings().GetStyleSettings().GetFieldColor();
+ if( aValue >>= color )
+ {
+ color1 = color;
+ pTable->getDataWindow()->SetBackground( color1 );
+ pTable->getDataWindow()->SetControlBackground( color1 );
+ }
+ break;
+ }
case BASEPROPERTY_VERTICALALIGN:
{
com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0));
@@ -673,10 +685,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence<
if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
{
std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- if(!selectedRows.empty())
- selectedRows.clear();
if(eSelMode == SINGLE_SELECTION)
{
+ if(!selectedRows.empty())
+ selectedRows.clear();
if(rangeOfRows.getLength() == 1)
selectedRows.push_back(start);
else
@@ -685,7 +697,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence<
else
{
for(int i=0;i<seqSize;i++)
- selectedRows.push_back(rangeOfRows[i]);
+ {
+ if(!isSelectedIndex(rangeOfRows[i]))
+ selectedRows.push_back(rangeOfRows[i]);
+ }
}
pTable->selectionChanged(true);
pTable->InvalidateDataWindow(start, end, false);
@@ -713,24 +728,23 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run
SetSynthesizingVCLEvent( sal_False );
}
}
+
void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
std::vector<RowPos>::iterator itStart = selectedRows.begin();
std::vector<RowPos>::iterator itEnd = selectedRows.end();
- sal_Int32 start = rangeOfRows[0];
- sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1];
- if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
+ for(int i = 0; i < rangeOfRows.getLength(); i++ )
{
- std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, start);
- selectedRows.erase(iter, iter+(end-start)+1);
- pTable->selectionChanged(true);
- pTable->InvalidateDataWindow(start, end, false);
- SetSynthesizingVCLEvent( sal_True );
- pTable->Select();
- SetSynthesizingVCLEvent( sal_False );
+ std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, rangeOfRows[i]);
+ selectedRows.erase(iter);
}
+ pTable->selectionChanged(true);
+ pTable->Invalidate();
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
}
void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
@@ -869,7 +883,7 @@ void SVTXGridControl::ImplCallItemListeners()
aEvent.Range = diff;
}
//selected row changed
- else if(diff == 0)
+ else if(diff == 0 && actSelRowCount != 0)
{
aEvent.Row = selRows[actSelRowCount-1];
aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);