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:24:03 +00:00
2001-02-05 08:26:47 +00:00
# include "SelectionBrowseBox.hxx"
# include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
# include <com/sun/star/sdbc/DataType.hpp>
2017-10-23 22:42:52 +02:00
# include <QueryDesignView.hxx>
# include <querycontroller.hxx>
# include <sqlbison.hxx>
# include <QueryTableView.hxx>
# include <browserids.hxx>
2012-01-02 10:55:27 +00:00
# include <comphelper/stl_types.hxx>
# include <comphelper/string.hxx>
2001-02-05 08:26:47 +00:00
# include "TableFieldInfo.hxx"
2018-03-18 16:03:47 +01:00
# include <core_resource.hxx>
2017-10-23 22:42:52 +02:00
# include <strings.hrc>
# include <strings.hxx>
# include <helpids.h>
2001-02-05 08:26:47 +00:00
# include <com/sun/star/container/XNameAccess.hpp>
2017-10-23 22:42:52 +02:00
# include <stringconstants.hxx>
2001-02-05 08:26:47 +00:00
# include "QTableWindow.hxx"
2018-02-21 21:20:15 +00:00
# include <vcl/weld.hxx>
2014-01-02 23:52:37 +01:00
# include <vcl/settings.hxx>
2001-02-05 08:26:47 +00:00
# include "QueryDesignFieldUndoAct.hxx"
2017-10-23 22:42:52 +02:00
# include <sqlmessage.hxx>
# include <UITools.hxx>
2011-02-03 00:33:36 +01:00
# include <osl/diagnose.h>
2019-05-18 16:01:16 +02:00
# include <i18nlangtag/languagetag.hxx>
2018-10-08 09:02:25 +01:00
# include <vcl/treelistentry.hxx>
2018-11-15 22:04:54 +01:00
# include <vcl/commandevent.hxx>
2019-01-30 00:10:38 +01:00
# include <vcl/svapp.hxx>
2001-02-14 13:54:12 +00:00
2001-06-29 07:45:10 +00:00
using namespace : : svt ;
2001-02-05 08:26:47 +00:00
using namespace : : dbaui ;
using namespace : : connectivity ;
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : sdbc ;
using namespace : : com : : sun : : star : : beans ;
using namespace : : com : : sun : : star : : container ;
using namespace : : com : : sun : : star : : util ;
2003-05-19 11:56:04 +00:00
using namespace : : com : : sun : : star : : accessibility ;
2001-02-05 08:26:47 +00:00
# define DEFAULT_QUERY_COLS 20
2014-12-18 13:22:10 +01:00
# define DEFAULT_SIZE GetTextWidth("0") * 30
2002-08-19 07:01:32 +00:00
# define HANDLE_ID 0
2018-07-21 11:04:19 +02:00
# define HANDLE_COLUMN_WIDTH 70
2012-03-20 11:01:12 +01:00
# define SORT_COLUMN_NONE 0xFFFFFFFF
2001-02-05 08:26:47 +00:00
2002-08-30 10:14:45 +00:00
namespace
{
2014-04-17 11:16:55 +02:00
bool isFieldNameAsterisk ( const OUString & _sFieldName )
2002-08-30 10:14:45 +00:00
{
2019-02-15 12:56:52 +02:00
bool bAsterisk = _sFieldName . isEmpty ( ) | | _sFieldName . toChar ( ) = = ' * ' ;
2013-12-20 11:25:37 +01:00
if ( ! bAsterisk )
2002-08-30 10:14:45 +00:00
{
2016-04-12 16:39:03 +02:00
sal_Int32 nTokenCount = comphelper : : string : : getTokenCount ( _sFieldName , ' . ' ) ;
if ( ( nTokenCount = = 2 & & _sFieldName . getToken ( 1 , ' . ' ) [ 0 ] = = ' * ' )
| | ( nTokenCount = = 3 & & _sFieldName . getToken ( 2 , ' . ' ) [ 0 ] = = ' * ' ) )
2002-08-30 10:14:45 +00:00
{
2014-04-17 11:16:55 +02:00
bAsterisk = true ;
2002-08-30 10:14:45 +00:00
}
}
2013-12-20 11:25:37 +01:00
return bAsterisk ;
2002-08-30 10:14:45 +00:00
}
2014-04-17 11:16:55 +02:00
bool lcl_SupportsCoreSQLGrammar ( const Reference < XConnection > & _xConnection )
2003-12-01 09:38:48 +00:00
{
2014-04-17 11:16:55 +02:00
bool bSupportsCoreGrammar = false ;
2003-12-01 09:38:48 +00:00
if ( _xConnection . is ( ) )
{
try
{
Reference < XDatabaseMetaData > xMetaData = _xConnection - > getMetaData ( ) ;
bSupportsCoreGrammar = xMetaData . is ( ) & & xMetaData - > supportsCoreSQLGrammar ( ) ;
}
catch ( Exception & )
{
}
}
return bSupportsCoreGrammar ;
}
2002-08-30 10:14:45 +00:00
}
2014-09-23 11:20:40 +02:00
OSelectionBrowseBox : : OSelectionBrowseBox ( vcl : : Window * pParent )
2015-04-17 11:11:23 +02:00
: EditBrowseBox ( pParent , EditBrowseBoxFlags : : NO_HANDLE_COLUMN_CONTENT , WB_3DLOOK , BrowserMode : : COLUMNSELECTION | BrowserMode : : KEEPHIGHLIGHT | BrowserMode : : HIDESELECT |
2015-04-16 15:41:10 +02:00
BrowserMode : : HIDECURSOR | BrowserMode : : HLINES | BrowserMode : : VLINES )
2014-02-21 11:15:15 +00:00
, m_nSeekRow ( 0 )
, m_nMaxColumns ( 0 )
2017-06-11 20:56:30 +01:00
, m_aFunctionStrings ( DBA_RES ( STR_QUERY_FUNCTIONS ) )
2006-06-20 02:27:27 +00:00
, m_nVisibleCount ( 0 )
2012-03-20 11:01:12 +01:00
, m_nLastSortColumn ( SORT_COLUMN_NONE )
2014-04-17 11:16:55 +02:00
, m_bOrderByUnRelated ( true )
, m_bGroupByUnRelated ( true )
, m_bStopTimer ( false )
, m_bWasEditing ( false )
, m_bDisableErrorBox ( false )
, m_bInUndoMode ( false )
2001-02-05 08:26:47 +00:00
{
2010-07-10 18:21:24 +02:00
SetHelpId ( HID_CTL_QRYDGNCRIT ) ;
2001-02-05 08:26:47 +00:00
2015-04-16 15:41:10 +02:00
m_nMode = BrowserMode : : COLUMNSELECTION | BrowserMode : : HIDESELECT
| BrowserMode : : KEEPHIGHLIGHT | BrowserMode : : HIDECURSOR
| BrowserMode : : HLINES | BrowserMode : : VLINES
| BrowserMode : : HEADERBAR_NEW ;
2001-02-05 08:26:47 +00:00
2015-04-20 14:00:04 +01:00
m_pTextCell = VclPtr < Edit > : : Create ( & GetDataWindow ( ) , 0 ) ;
m_pVisibleCell = VclPtr < CheckBoxControl > : : Create ( & GetDataWindow ( ) ) ;
m_pTableCell = VclPtr < ListBoxControl > : : Create ( & GetDataWindow ( ) ) ; m_pTableCell - > SetDropDownLineCount ( 20 ) ;
m_pFieldCell = VclPtr < ComboBoxControl > : : Create ( & GetDataWindow ( ) ) ; m_pFieldCell - > SetDropDownLineCount ( 20 ) ;
m_pOrderCell = VclPtr < ListBoxControl > : : Create ( & GetDataWindow ( ) ) ;
m_pFunctionCell = VclPtr < ListBoxControl > : : Create ( & GetDataWindow ( ) ) ; m_pFunctionCell - > SetDropDownLineCount ( 20 ) ;
2001-02-05 08:26:47 +00:00
2010-07-10 18:21:24 +02:00
m_pVisibleCell - > SetHelpId ( HID_QRYDGN_ROW_VISIBLE ) ;
m_pTableCell - > SetHelpId ( HID_QRYDGN_ROW_TABLE ) ;
m_pFieldCell - > SetHelpId ( HID_QRYDGN_ROW_FIELD ) ;
m_pOrderCell - > SetHelpId ( HID_QRYDGN_ROW_ORDER ) ;
m_pFunctionCell - > SetHelpId ( HID_QRYDGN_ROW_FUNCTION ) ;
2001-02-05 08:26:47 +00:00
2015-08-03 09:14:58 +02:00
// switch off triState of css::form::CheckBox
2014-02-21 12:53:51 +01:00
m_pVisibleCell - > GetBox ( ) . EnableTriState ( false ) ;
2001-02-05 08:26:47 +00:00
2015-05-19 14:37:07 +02:00
vcl : : Font aTitleFont = OutputDevice : : GetDefaultFont ( DefaultFontType : : SANS_UNICODE , Window : : GetSettings ( ) . GetLanguageTag ( ) . getLanguageType ( ) , GetDefaultFontFlags : : OnlyOne ) ;
2016-02-03 10:13:00 +11:00
aTitleFont . SetFontSize ( Size ( 0 , 6 ) ) ;
2001-02-05 08:26:47 +00:00
SetTitleFont ( aTitleFont ) ;
2018-09-09 10:24:44 +02:00
const OUString aTxt ( DBA_RES ( STR_QUERY_SORTTEXT ) ) ;
for ( sal_Int32 nIdx { 0 } ; nIdx > = 0 ; )
m_pOrderCell - > InsertEntry ( aTxt . getToken ( 0 , ' ; ' , nIdx ) ) ;
2001-02-05 08:26:47 +00:00
2017-03-02 11:28:17 +02:00
m_bVisibleRow . insert ( m_bVisibleRow . end ( ) , BROW_ROW_CNT , true ) ;
2001-02-05 08:26:47 +00:00
2014-01-28 20:02:35 +01:00
m_bVisibleRow [ BROW_FUNCTION_ROW ] = false ; // first hide
2001-04-18 12:20:48 +00:00
m_timerInvalidate . SetTimeout ( 200 ) ;
2017-01-23 19:37:51 +01:00
m_timerInvalidate . SetInvokeHandler ( LINK ( this , OSelectionBrowseBox , OnInvalidateTimer ) ) ;
2001-04-18 12:20:48 +00:00
m_timerInvalidate . Start ( ) ;
2001-02-05 08:26:47 +00:00
}
OSelectionBrowseBox : : ~ OSelectionBrowseBox ( )
{
2015-03-10 09:07:06 +02:00
disposeOnce ( ) ;
2015-01-16 15:29:28 +02:00
}
2001-02-05 08:26:47 +00:00
2015-01-16 15:29:28 +02:00
void OSelectionBrowseBox : : dispose ( )
{
2015-04-10 10:44:13 +01:00
m_pTextCell . disposeAndClear ( ) ;
m_pVisibleCell . disposeAndClear ( ) ;
m_pFieldCell . disposeAndClear ( ) ;
m_pTableCell . disposeAndClear ( ) ;
m_pOrderCell . disposeAndClear ( ) ;
m_pFunctionCell . disposeAndClear ( ) ;
2015-01-16 15:29:28 +02:00
: : svt : : EditBrowseBox : : dispose ( ) ;
2001-02-05 08:26:47 +00:00
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
void OSelectionBrowseBox : : initialize ( )
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2003-12-01 09:38:48 +00:00
if ( xConnection . is ( ) )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
const IParseContext & rContext = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getParser ( ) . getContext ( ) ;
2016-03-28 17:12:04 +02:00
const IParseContext : : InternationalKeyCode eFunctions [ ] = {
IParseContext : : InternationalKeyCode : : Avg , IParseContext : : InternationalKeyCode : : Count , IParseContext : : InternationalKeyCode : : Max
2016-02-24 16:25:57 +02:00
, IParseContext : : InternationalKeyCode : : Min , IParseContext : : InternationalKeyCode : : Sum
, IParseContext : : InternationalKeyCode : : Every
, IParseContext : : InternationalKeyCode : : Any
, IParseContext : : InternationalKeyCode : : Some
, IParseContext : : InternationalKeyCode : : StdDevPop
, IParseContext : : InternationalKeyCode : : StdDevSamp
, IParseContext : : InternationalKeyCode : : VarSamp
, IParseContext : : InternationalKeyCode : : VarPop
, IParseContext : : InternationalKeyCode : : Collect
, IParseContext : : InternationalKeyCode : : Fusion
, IParseContext : : InternationalKeyCode : : Intersection
2008-08-19 08:56:31 +00:00
} ;
2005-10-24 07:32:22 +00:00
2018-11-07 22:28:55 +01:00
OUString sGroup = m_aFunctionStrings . copy ( m_aFunctionStrings . lastIndexOf ( ' ; ' ) + 1 ) ;
2013-09-27 12:04:57 +02:00
m_aFunctionStrings = m_aFunctionStrings . getToken ( 0 , ' ; ' ) ;
2005-10-24 07:32:22 +00:00
2016-04-25 10:56:28 +02:00
for ( IParseContext : : InternationalKeyCode eFunction : eFunctions )
2005-10-24 07:32:22 +00:00
{
2018-09-09 12:25:08 +02:00
m_aFunctionStrings + = " ; " + OStringToOUString ( rContext . getIntlKeywordAscii ( eFunction ) , RTL_TEXTENCODING_UTF8 ) ;
2010-11-25 01:16:20 +00:00
}
2018-09-09 12:25:08 +02:00
m_aFunctionStrings + = " ; " + sGroup ;
2005-10-24 07:32:22 +00:00
2012-02-09 18:47:32 +01:00
// Aggregate functions in general available only with Core SQL
// We slip in a few optionals one, too.
2003-12-01 09:38:48 +00:00
if ( lcl_SupportsCoreSQLGrammar ( xConnection ) )
{
2018-09-09 10:24:44 +02:00
for ( sal_Int32 nIdx { 0 } ; nIdx > = 0 ; )
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 0 , ' ; ' , nIdx ) ) ;
2003-12-01 09:38:48 +00:00
}
2012-02-09 18:47:32 +01:00
else // else only COUNT(*) and COUNT("table".*)
2003-12-01 09:38:48 +00:00
{
2013-09-27 12:04:57 +02:00
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 0 , ' ; ' ) ) ;
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 2 , ' ; ' ) ) ; // 2 -> COUNT
2003-12-01 09:38:48 +00:00
}
try
2001-03-01 14:45:02 +00:00
{
2001-07-12 11:14:47 +00:00
Reference < XDatabaseMetaData > xMetaData = xConnection - > getMetaData ( ) ;
2003-12-01 09:38:48 +00:00
if ( xMetaData . is ( ) )
2001-07-12 11:14:47 +00:00
{
2003-12-01 09:38:48 +00:00
m_bOrderByUnRelated = xMetaData - > supportsOrderByUnrelated ( ) ;
m_bGroupByUnRelated = xMetaData - > supportsGroupByUnrelated ( ) ;
2001-07-12 11:14:47 +00:00
}
2001-03-01 14:45:02 +00:00
}
2003-12-01 09:38:48 +00:00
catch ( Exception & )
{
}
2001-02-05 08:26:47 +00:00
}
Init ( ) ;
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
OQueryDesignView * OSelectionBrowseBox : : getDesignView ( )
{
OSL_ENSURE ( static_cast < const OQueryDesignView * > ( GetParent ( ) ) , " Parent isn't an OQueryDesignView! " ) ;
return static_cast < OQueryDesignView * > ( GetParent ( ) ) ;
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
OQueryDesignView * OSelectionBrowseBox : : getDesignView ( ) const
{
OSL_ENSURE ( static_cast < const OQueryDesignView * > ( GetParent ( ) ) , " Parent isn't an OQueryDesignView! " ) ;
return static_cast < OQueryDesignView * > ( GetParent ( ) ) ;
}
2013-08-17 23:43:14 +02:00
2002-08-19 07:01:32 +00:00
namespace
{
class OSelectionBrwBoxHeader : public : : svt : : EditBrowserHeader
{
2015-03-09 14:29:30 +02:00
VclPtr < OSelectionBrowseBox > m_pBrowseBox ;
2002-08-19 07:01:32 +00:00
protected :
2015-10-12 16:04:04 +02:00
virtual void Select ( ) override ;
2002-08-19 07:01:32 +00:00
public :
2015-07-22 20:12:48 +01:00
explicit OSelectionBrwBoxHeader ( OSelectionBrowseBox * pParent ) ;
2016-09-13 13:09:01 +02:00
virtual ~ OSelectionBrwBoxHeader ( ) override { disposeOnce ( ) ; }
2015-10-12 16:04:04 +02:00
virtual void dispose ( ) override { m_pBrowseBox . clear ( ) ; : : svt : : EditBrowserHeader : : dispose ( ) ; }
2002-08-19 07:01:32 +00:00
} ;
2002-08-30 10:14:45 +00:00
OSelectionBrwBoxHeader : : OSelectionBrwBoxHeader ( OSelectionBrowseBox * pParent )
2002-08-19 07:01:32 +00:00
: : : svt : : EditBrowserHeader ( pParent , WB_BUTTONSTYLE | WB_DRAG )
, m_pBrowseBox ( pParent )
{
}
void OSelectionBrwBoxHeader : : Select ( )
{
EditBrowserHeader : : Select ( ) ;
2002-08-30 10:14:45 +00:00
m_pBrowseBox - > GrabFocus ( ) ;
2002-08-19 07:01:32 +00:00
BrowserMode nMode = m_pBrowseBox - > GetMode ( ) ;
if ( 0 = = m_pBrowseBox - > GetSelectColumnCount ( ) )
{
m_pBrowseBox - > DeactivateCell ( ) ;
2017-03-27 23:41:27 +02:00
// we are in the right mode if a row has been selected row
2015-05-28 15:33:16 +02:00
if ( nMode & BrowserMode : : HIDESELECT )
2002-08-19 07:01:32 +00:00
{
2015-04-16 15:41:10 +02:00
nMode & = ~ BrowserMode : : HIDESELECT ;
nMode | = BrowserMode : : MULTISELECTION ;
2002-08-19 07:01:32 +00:00
m_pBrowseBox - > SetMode ( nMode ) ;
}
}
m_pBrowseBox - > SelectColumnId ( GetCurItemId ( ) ) ;
2004-08-02 15:14:02 +00:00
m_pBrowseBox - > DeactivateCell ( ) ;
2002-08-19 07:01:32 +00:00
}
}
2001-02-05 08:26:47 +00:00
2015-04-17 16:55:41 +02:00
VclPtr < BrowserHeader > OSelectionBrowseBox : : imp_CreateHeaderBar ( BrowseBox * /*pParent*/ )
2002-08-19 07:01:32 +00:00
{
2015-04-20 14:00:04 +01:00
return VclPtr < OSelectionBrwBoxHeader > : : Create ( this ) ;
2002-08-19 07:01:32 +00:00
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : ColumnMoved ( sal_uInt16 nColId , bool _bCreateUndo )
2002-08-19 07:01:32 +00:00
{
EditBrowseBox : : ColumnMoved ( nColId ) ;
// swap the two columns
2011-01-14 15:00:11 +01:00
sal_uInt16 nNewPos = GetColumnPos ( nColId ) ;
2002-08-19 07:01:32 +00:00
OTableFields & rFields = getFields ( ) ;
2011-01-14 15:00:11 +01:00
if ( rFields . size ( ) > sal_uInt16 ( nNewPos - 1 ) )
2002-08-19 07:01:32 +00:00
{
2011-01-14 15:00:11 +01:00
sal_uInt16 nOldPos = 0 ;
2018-03-10 14:49:40 +01:00
bool bFoundElem = false ;
for ( auto const & field : rFields )
{
if ( field - > GetColumnId ( ) = = nColId )
{
bFoundElem = true ;
break ;
}
+ + nOldPos ;
}
2002-08-19 07:01:32 +00:00
2006-01-16 14:30:24 +00:00
OSL_ENSURE ( ( nNewPos - 1 ) ! = nOldPos & & nOldPos < rFields . size ( ) , " Old and new position are equal! " ) ;
2018-03-10 14:49:40 +01:00
if ( bFoundElem )
2002-08-19 07:01:32 +00:00
{
2006-01-16 14:30:24 +00:00
OTableFieldDescRef pOldEntry = rFields [ nOldPos ] ;
rFields . erase ( rFields . begin ( ) + nOldPos ) ;
rFields . insert ( rFields . begin ( ) + nNewPos - 1 , pOldEntry ) ;
// create the undo action
if ( ! m_bInUndoMode & & _bCreateUndo )
{
2018-10-08 11:22:10 +02:00
std : : unique_ptr < OTabFieldMovedUndoAct > pUndoAct ( new OTabFieldMovedUndoAct ( this ) ) ;
2006-01-16 14:30:24 +00:00
pUndoAct - > SetColumnPosition ( nOldPos + 1 ) ;
pUndoAct - > SetTabFieldDescr ( pOldEntry ) ;
2002-08-19 07:01:32 +00:00
2018-10-08 11:22:10 +02:00
getDesignView ( ) - > getController ( ) . addUndoActionAndInvalidate ( std : : move ( pUndoAct ) ) ;
2010-11-25 01:16:20 +00:00
}
2002-08-19 07:01:32 +00:00
}
}
else
2011-03-12 12:04:35 +01:00
OSL_FAIL ( " Invalid column id! " ) ;
2002-08-19 07:01:32 +00:00
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
void OSelectionBrowseBox : : Init ( )
{
2002-08-19 07:01:32 +00:00
2001-06-29 07:45:10 +00:00
EditBrowseBox : : Init ( ) ;
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
// set the header bar
2016-11-10 12:53:02 +02:00
VclPtr < BrowserHeader > pNewHeaderBar = CreateHeaderBar ( this ) ;
2014-02-21 12:53:51 +01:00
pNewHeaderBar - > SetMouseTransparent ( false ) ;
2002-08-19 07:01:32 +00:00
2006-06-20 02:27:27 +00:00
SetHeaderBar ( pNewHeaderBar ) ;
2002-08-19 07:01:32 +00:00
SetMode ( m_nMode ) ;
2014-09-16 10:09:58 +02:00
vcl : : Font aFont ( GetDataWindow ( ) . GetFont ( ) ) ;
2001-02-05 08:26:47 +00:00
aFont . SetWeight ( WEIGHT_NORMAL ) ;
GetDataWindow ( ) . SetFont ( aFont ) ;
2008-12-10 13:41:25 +00:00
Size aHeight ;
const Control * pControls [ ] = { m_pTextCell , m_pVisibleCell , m_pTableCell , m_pFieldCell } ;
2012-05-31 12:36:21 +01:00
2016-04-25 10:56:28 +02:00
for ( const Control * pControl : pControls )
2008-12-10 13:41:25 +00:00
{
2016-04-25 10:56:28 +02:00
const Size aTemp ( pControl - > GetOptimalSize ( ) ) ;
2008-12-10 13:41:25 +00:00
if ( aTemp . Height ( ) > aHeight . Height ( ) )
2018-02-13 15:24:42 +02:00
aHeight . setHeight ( aTemp . Height ( ) ) ;
2010-11-25 01:16:20 +00:00
}
2008-12-10 13:41:25 +00:00
SetDataRowHeight ( aHeight . Height ( ) ) ;
2001-02-05 08:26:47 +00:00
SetTitleLines ( 1 ) ;
2013-03-02 15:06:22 +01:00
// get number of visible rows
2001-02-05 08:26:47 +00:00
for ( long i = 0 ; i < BROW_ROW_CNT ; i + + )
{
if ( m_bVisibleRow [ i ] )
m_nVisibleCount + + ;
}
2014-03-19 14:11:04 +02:00
RowInserted ( 0 , m_nVisibleCount , false ) ;
2001-10-08 06:32:36 +00:00
try
2001-03-01 14:45:02 +00:00
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2001-10-08 06:32:36 +00:00
if ( xConnection . is ( ) )
{
Reference < XDatabaseMetaData > xMetaData = xConnection - > getMetaData ( ) ;
2003-12-01 09:38:48 +00:00
m_nMaxColumns = xMetaData . is ( ) ? xMetaData - > getMaxColumnsInSelect ( ) : 0 ;
2001-10-08 06:32:36 +00:00
}
else
m_nMaxColumns = 0 ;
2001-03-01 14:45:02 +00:00
}
2001-10-08 06:32:36 +00:00
catch ( const SQLException & )
{
2017-06-26 19:49:37 +02:00
OSL_FAIL ( " Caught Exception when asking for database metadata options! " ) ;
2001-03-01 14:45:02 +00:00
m_nMaxColumns = 0 ;
2001-10-08 06:32:36 +00:00
}
2001-02-05 08:26:47 +00:00
}
2001-04-30 12:02:01 +00:00
void OSelectionBrowseBox : : PreFill ( )
2001-02-05 08:26:47 +00:00
{
2014-03-19 14:11:04 +02:00
SetUpdateMode ( false ) ;
2001-02-05 08:26:47 +00:00
if ( GetCurRow ( ) ! = 0 )
GoToRow ( 0 ) ;
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . clearFields ( ) ;
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
RemoveColumns ( ) ;
2018-07-21 11:04:19 +02:00
InsertHandleColumn ( HANDLE_COLUMN_WIDTH ) ;
2014-03-19 14:11:04 +02:00
SetUpdateMode ( true ) ;
2001-02-05 08:26:47 +00:00
}
2013-08-17 23:43:14 +02:00
2001-04-30 12:02:01 +00:00
void OSelectionBrowseBox : : ClearAll ( )
{
2014-03-19 14:11:04 +02:00
SetUpdateMode ( false ) ;
2001-04-30 12:02:01 +00:00
2016-03-28 19:17:45 +02:00
OTableFields : : const_reverse_iterator aIter = getFields ( ) . rbegin ( ) ;
2006-07-10 14:44:07 +00:00
for ( ; aIter ! = getFields ( ) . rend ( ) ; + + aIter )
2001-04-30 12:02:01 +00:00
{
2006-07-10 14:44:07 +00:00
if ( ! ( * aIter ) - > IsEmpty ( ) )
{
RemoveField ( ( * aIter ) - > GetColumnId ( ) ) ;
aIter = getFields ( ) . rbegin ( ) ;
}
2001-04-30 12:02:01 +00:00
}
2012-03-20 11:01:12 +01:00
m_nLastSortColumn = SORT_COLUMN_NONE ;
2014-03-19 14:11:04 +02:00
SetUpdateMode ( true ) ;
2001-04-30 12:02:01 +00:00
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : SetReadOnly ( bool bRO )
2001-02-05 08:26:47 +00:00
{
if ( bRO )
{
DeactivateCell ( ) ;
2015-04-16 15:41:10 +02:00
m_nMode & = ~ BrowserMode : : HIDECURSOR ;
2001-02-05 08:26:47 +00:00
SetMode ( m_nMode ) ;
}
else
{
2015-04-16 15:41:10 +02:00
m_nMode | = BrowserMode : : HIDECURSOR ;
2001-02-05 08:26:47 +00:00
SetMode ( m_nMode ) ;
ActivateCell ( ) ;
}
}
2001-06-29 07:45:10 +00:00
CellController * OSelectionBrowseBox : : GetController ( long nRow , sal_uInt16 nColId )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
if ( nColId > getFields ( ) . size ( ) )
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-10-05 05:49:21 +00:00
OTableFieldDescRef pEntry = getFields ( ) [ nColId - 1 ] ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( pEntry . is ( ) , " OSelectionBrowseBox::GetController : invalid FieldDescription ! " ) ;
2001-02-05 08:26:47 +00:00
2010-10-15 12:22:54 -05:00
if ( ! pEntry . is ( ) )
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-02-05 08:26:47 +00:00
2008-06-25 11:54:03 +00:00
if ( static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isReadOnly ( ) )
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-02-05 08:26:47 +00:00
long nCellIndex = GetRealRow ( nRow ) ;
switch ( nCellIndex )
{
case BROW_FIELD_ROW :
2001-06-29 07:45:10 +00:00
return new ComboBoxCellController ( m_pFieldCell ) ;
2001-02-05 08:26:47 +00:00
case BROW_TABLE_ROW :
2001-06-29 07:45:10 +00:00
return new ListBoxCellController ( m_pTableCell ) ;
2001-02-05 08:26:47 +00:00
case BROW_VIS_ROW :
2001-06-29 07:45:10 +00:00
return new CheckBoxCellController ( m_pVisibleCell ) ;
2001-02-05 08:26:47 +00:00
case BROW_ORDER_ROW :
2001-06-29 07:45:10 +00:00
return new ListBoxCellController ( m_pOrderCell ) ;
2001-02-05 08:26:47 +00:00
case BROW_FUNCTION_ROW :
2001-06-29 07:45:10 +00:00
return new ListBoxCellController ( m_pFunctionCell ) ;
2001-02-05 08:26:47 +00:00
default :
2001-06-29 07:45:10 +00:00
return new EditCellController ( m_pTextCell ) ;
2001-02-05 08:26:47 +00:00
}
}
2006-06-20 02:27:27 +00:00
void OSelectionBrowseBox : : InitController ( CellControllerRef & /*rController*/ , long nRow , sal_uInt16 nColId )
2001-02-05 08:26:47 +00:00
{
2005-12-21 12:37:05 +00:00
OSL_ENSURE ( nColId ! = BROWSER_INVALIDID , " An Invalid Id was set! " ) ;
if ( nColId = = BROWSER_INVALIDID )
return ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2006-06-20 02:27:27 +00:00
if ( nPos = = 0 | | nPos = = BROWSER_INVALIDID | | nPos > getFields ( ) . size ( ) )
2005-12-21 12:37:05 +00:00
return ;
OTableFieldDescRef pEntry = getFields ( ) [ nPos - 1 ] ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( pEntry . is ( ) , " OSelectionBrowseBox::InitController : invalid FieldDescription ! " ) ;
2001-02-05 08:26:47 +00:00
long nCellIndex = GetRealRow ( nRow ) ;
switch ( nCellIndex )
{
case BROW_FIELD_ROW :
{
m_pFieldCell - > Clear ( ) ;
2013-09-27 12:04:57 +02:00
m_pFieldCell - > SetText ( OUString ( ) ) ;
2001-02-05 08:26:47 +00:00
2013-03-26 17:29:01 -03:00
OUString aField ( pEntry - > GetField ( ) ) ;
2013-04-04 16:33:41 +02:00
OUString aTable ( pEntry - > GetAlias ( ) ) ;
2001-02-05 08:26:47 +00:00
getDesignView ( ) - > fillValidFields ( aTable , m_pFieldCell ) ;
2013-03-02 19:16:26 +01:00
// replace with alias.*
2013-04-04 15:37:31 +02:00
if ( aField . trim ( ) = = " * " )
2001-02-05 08:26:47 +00:00
{
2013-04-04 15:37:51 +02:00
aField = aTable + " .* " ;
2001-02-05 08:26:47 +00:00
}
m_pFieldCell - > SetText ( aField ) ;
} break ;
case BROW_TABLE_ROW :
{
m_pTableCell - > Clear ( ) ;
2001-10-05 05:49:21 +00:00
enableControl ( pEntry , m_pTableCell ) ;
2006-07-10 14:44:07 +00:00
if ( ! pEntry - > isCondition ( ) )
2001-02-05 08:26:47 +00:00
{
2018-03-10 14:49:40 +01:00
for ( auto const & tabWin : getDesignView ( ) - > getTableView ( ) - > GetTabWinMap ( ) )
m_pTableCell - > InsertEntry ( static_cast < OQueryTableWindow * > ( tabWin . second . get ( ) ) - > GetAliasName ( ) ) ;
2001-02-05 08:26:47 +00:00
2017-06-11 20:56:30 +01:00
m_pTableCell - > InsertEntry ( DBA_RES ( STR_QUERY_NOTABLE ) , 0 ) ;
2014-06-18 12:14:29 +02:00
if ( ! pEntry - > GetAlias ( ) . isEmpty ( ) )
m_pTableCell - > SelectEntry ( pEntry - > GetAlias ( ) ) ;
else
2017-06-11 20:56:30 +01:00
m_pTableCell - > SelectEntry ( DBA_RES ( STR_QUERY_NOTABLE ) ) ;
2001-02-05 08:26:47 +00:00
}
} break ;
case BROW_VIS_ROW :
{
m_pVisibleCell - > GetBox ( ) . Check ( pEntry - > IsVisible ( ) ) ;
m_pVisibleCell - > GetBox ( ) . SaveValue ( ) ;
2001-10-05 05:49:21 +00:00
enableControl ( pEntry , m_pTextCell ) ;
2001-02-05 08:26:47 +00:00
if ( ! pEntry - > IsVisible ( ) & & pEntry - > GetOrderDir ( ) ! = ORDER_NONE & & ! m_bOrderByUnRelated )
{
2013-03-02 15:06:22 +01:00
// a column has to visible in order to show up in ORDER BY
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
m_pVisibleCell - > GetBox ( ) . Check ( pEntry - > IsVisible ( ) ) ;
m_pVisibleCell - > GetBox ( ) . SaveValue ( ) ;
m_pVisibleCell - > GetBox ( ) . Disable ( ) ;
2014-01-28 20:02:35 +01:00
m_pVisibleCell - > GetBox ( ) . EnableInput ( false ) ;
2017-06-11 20:56:30 +01:00
OUString aMessage ( DBA_RES ( STR_QRY_ORDERBY_UNRELATED ) ) ;
2001-02-08 14:33:28 +00:00
OQueryDesignView * paDView = getDesignView ( ) ;
2018-02-21 21:20:15 +00:00
std : : unique_ptr < weld : : MessageDialog > xInfoBox ( Application : : CreateMessageDialog ( paDView ? paDView - > GetFrameWeld ( ) : nullptr ,
VclMessageType : : Info , VclButtonsType : : Ok ,
aMessage ) ) ;
xInfoBox - > run ( ) ;
2001-02-05 08:26:47 +00:00
}
} break ;
case BROW_ORDER_ROW :
2006-10-12 12:43:07 +00:00
m_pOrderCell - > SelectEntryPos (
2011-01-14 15:00:11 +01:00
sal : : static_int_cast < sal_uInt16 > ( pEntry - > GetOrderDir ( ) ) ) ;
2001-10-05 05:49:21 +00:00
enableControl ( pEntry , m_pOrderCell ) ;
break ;
2001-02-05 08:26:47 +00:00
case BROW_COLUMNALIAS_ROW :
2001-10-05 05:49:21 +00:00
setTextCellContext ( pEntry , pEntry - > GetFieldAlias ( ) , HID_QRYDGN_ROW_ALIAS ) ;
2001-02-05 08:26:47 +00:00
break ;
case BROW_FUNCTION_ROW :
2002-08-30 10:14:45 +00:00
setFunctionCell ( pEntry ) ;
break ;
default :
2001-02-05 08:26:47 +00:00
{
2003-12-01 09:38:48 +00:00
sal_uInt16 nIdx = sal_uInt16 ( nCellIndex - BROW_CRIT1_ROW ) ;
2002-08-30 10:14:45 +00:00
setTextCellContext ( pEntry , pEntry - > GetCriteria ( nIdx ) , HID_QRYDGN_ROW_CRIT ) ;
}
}
Controller ( ) - > ClearModified ( ) ;
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : notifyTableFieldChanged ( const OUString & _sOldAlias , const OUString & _sAlias , bool & _bListAction , sal_uInt16 _nColumnId )
2002-08-30 10:14:45 +00:00
{
appendUndoAction ( _sOldAlias , _sAlias , BROW_TABLE_ROW , _bListAction ) ;
if ( m_bVisibleRow [ BROW_TABLE_ROW ] )
RowModified ( GetBrowseRow ( BROW_TABLE_ROW ) , _nColumnId ) ;
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : notifyFunctionFieldChanged ( const OUString & _sOldFunctionName , const OUString & _sFunctionName , bool & _bListAction , sal_uInt16 _nColumnId )
2002-08-30 10:14:45 +00:00
{
appendUndoAction ( _sOldFunctionName , _sFunctionName , BROW_FUNCTION_ROW , _bListAction ) ;
if ( ! m_bVisibleRow [ BROW_FUNCTION_ROW ] )
2014-04-17 11:16:55 +02:00
SetRowVisible ( BROW_FUNCTION_ROW , true ) ;
2002-08-30 10:14:45 +00:00
RowModified ( GetBrowseRow ( BROW_FUNCTION_ROW ) , _nColumnId ) ;
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
void OSelectionBrowseBox : : clearEntryFunctionField ( const OUString & _sFieldName , OTableFieldDescRef const & _pEntry , bool & _bListAction , sal_uInt16 _nColumnId )
2002-08-30 10:14:45 +00:00
{
2013-12-20 11:25:37 +01:00
if ( isFieldNameAsterisk ( _sFieldName ) & & ( ! _pEntry - > isNoneFunction ( ) | | _pEntry - > IsGroupBy ( ) ) )
2002-08-30 10:14:45 +00:00
{
2013-09-23 07:19:08 +01:00
OUString sFunctionName ;
2002-08-30 10:14:45 +00:00
GetFunctionName ( SQL_TOKEN_COUNT , sFunctionName ) ;
2013-09-27 12:04:57 +02:00
OUString sOldLocalizedFunctionName = _pEntry - > GetFunction ( ) ;
if ( sOldLocalizedFunctionName ! = sFunctionName | | _pEntry - > IsGroupBy ( ) )
2002-08-30 10:14:45 +00:00
{
// append undo action for the function field
_pEntry - > SetFunctionType ( FKT_NONE ) ;
2013-04-07 12:06:47 +02:00
_pEntry - > SetFunction ( OUString ( ) ) ;
2015-09-01 14:21:06 +02:00
_pEntry - > SetGroupBy ( false ) ;
2002-08-30 10:14:45 +00:00
notifyFunctionFieldChanged ( sOldLocalizedFunctionName , _pEntry - > GetFunction ( ) , _bListAction , _nColumnId ) ;
}
}
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
bool OSelectionBrowseBox : : fillColumnRef ( const OSQLParseNode * _pColumnRef , const Reference < XConnection > & _rxConnection , OTableFieldDescRef const & _pEntry , bool & _bListAction )
2002-08-30 10:14:45 +00:00
{
OSL_ENSURE ( _pColumnRef , " No valid parsenode! " ) ;
2013-04-07 12:06:47 +02:00
OUString sColumnName , sTableRange ;
2006-12-13 15:53:47 +00:00
OSQLParseTreeIterator : : getColumnRange ( _pColumnRef , _rxConnection , sColumnName , sTableRange ) ;
return fillColumnRef ( sColumnName , sTableRange , _rxConnection - > getMetaData ( ) , _pEntry , _bListAction ) ;
2002-08-30 10:14:45 +00:00
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
bool OSelectionBrowseBox : : fillColumnRef ( const OUString & _sColumnName , const OUString & _sTableRange , const Reference < XDatabaseMetaData > & _xMetaData , OTableFieldDescRef const & _pEntry , bool & _bListAction )
2002-08-30 10:14:45 +00:00
{
2014-04-17 11:16:55 +02:00
bool bError = false ;
2006-08-15 09:56:20 +00:00
: : comphelper : : UStringMixEqual bCase ( _xMetaData - > supportsMixedCaseQuotedIdentifiers ( ) ) ;
2002-08-30 10:14:45 +00:00
// check if the table name is the same
2011-12-19 18:10:37 -02:00
if ( ! _sTableRange . isEmpty ( ) & & ( bCase ( _pEntry - > GetTable ( ) , _sTableRange ) | | bCase ( _pEntry - > GetAlias ( ) , _sTableRange ) ) )
2002-08-30 10:14:45 +00:00
{ // a table was already inserted and the tables contains that column name
if ( ! _pEntry - > GetTabWindow ( ) )
{ // fill tab window
2013-04-07 12:06:47 +02:00
OUString sOldAlias = _pEntry - > GetAlias ( ) ;
2003-04-28 14:49:22 +00:00
if ( ! fillEntryTable ( _pEntry , _pEntry - > GetTable ( ) ) )
2002-08-30 10:14:45 +00:00
fillEntryTable ( _pEntry , _pEntry - > GetAlias ( ) ) ; // only when the first failed
if ( ! bCase ( sOldAlias , _pEntry - > GetAlias ( ) ) )
notifyTableFieldChanged ( sOldAlias , _pEntry - > GetAlias ( ) , _bListAction , GetCurColumnId ( ) ) ;
}
}
// check if the table window
OQueryTableWindow * pEntryTab = static_cast < OQueryTableWindow * > ( _pEntry - > GetTabWindow ( ) ) ;
if ( ! pEntryTab ) // no table found with this name so we have to travel through all tables
{
2014-06-18 12:14:29 +02:00
sal_uInt16 nTabCount = 0 ;
if ( ! static_cast < OQueryTableView * > ( getDesignView ( ) - > getTableView ( ) ) - > FindTableFromField ( _sColumnName , _pEntry , nTabCount ) ) // error occurred: column not in table window
2002-08-30 10:14:45 +00:00
{
2017-06-11 20:56:30 +01:00
OUString sErrorMsg ( DBA_RES ( RID_STR_FIELD_DOESNT_EXIST ) ) ;
2014-06-18 12:14:29 +02:00
sErrorMsg = sErrorMsg . replaceFirst ( " $name$ " , _sColumnName ) ;
2018-03-20 17:17:10 +00:00
OSQLErrorBox aWarning ( GetFrameWeld ( ) , sErrorMsg ) ;
aWarning . run ( ) ;
2014-06-18 12:14:29 +02:00
bError = true ;
}
else
{
pEntryTab = static_cast < OQueryTableWindow * > ( _pEntry - > GetTabWindow ( ) ) ;
notifyTableFieldChanged ( OUString ( ) , _pEntry - > GetAlias ( ) , _bListAction , GetCurColumnId ( ) ) ;
2001-02-05 08:26:47 +00:00
}
2002-08-30 10:14:45 +00:00
}
if ( pEntryTab ) // here we got a valid table
_pEntry - > SetField ( _sColumnName ) ;
return bError ;
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
bool OSelectionBrowseBox : : saveField ( OUString & _sFieldName , OTableFieldDescRef const & _pEntry , bool & _bListAction )
2002-08-30 10:14:45 +00:00
{
2014-04-17 11:16:55 +02:00
bool bError = false ;
2002-08-30 10:14:45 +00:00
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
2002-08-30 10:14:45 +00:00
// first look if the name can be found in our tables
sal_uInt16 nTabCount = 0 ;
2013-09-27 12:04:57 +02:00
OUString sOldAlias = _pEntry - > GetAlias ( ) ;
2002-08-30 10:14:45 +00:00
if ( static_cast < OQueryTableView * > ( getDesignView ( ) - > getTableView ( ) ) - > FindTableFromField ( _sFieldName , _pEntry , nTabCount ) )
{
// append undo action for the alias name
_pEntry - > SetField ( _sFieldName ) ;
notifyTableFieldChanged ( sOldAlias , _pEntry - > GetAlias ( ) , _bListAction , GetCurColumnId ( ) ) ;
clearEntryFunctionField ( _sFieldName , _pEntry , _bListAction , _pEntry - > GetColumnId ( ) ) ;
return bError ;
}
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection ( rController . getConnection ( ) ) ;
2006-10-24 14:15:01 +00:00
Reference < XDatabaseMetaData > xMetaData ;
if ( xConnection . is ( ) )
xMetaData = xConnection - > getMetaData ( ) ;
OSL_ENSURE ( xMetaData . is ( ) , " OSelectionBrowseBox::saveField: invalid connection/meta data! " ) ;
if ( ! xMetaData . is ( ) )
2014-04-17 11:16:55 +02:00
return true ;
2006-10-24 14:15:01 +00:00
2013-04-07 12:06:47 +02:00
OUString sErrorMsg ;
2002-08-30 10:14:45 +00:00
// second test if the name can be set as select columns in a pseudo statement
// we have to look which entries we should quote
2013-04-07 12:06:47 +02:00
const OUString sFieldAlias = _pEntry - > GetFieldAlias ( ) ;
2008-06-25 11:54:03 +00:00
: : connectivity : : OSQLParser & rParser ( rController . getParser ( ) ) ;
2002-08-30 10:14:45 +00:00
{
2013-01-23 15:36:35 +01:00
// automatically add parentheses around subqueries
OUString devnull ;
2018-12-19 16:10:51 +02:00
std : : unique_ptr < OSQLParseNode > pParseNode = rParser . parseTree ( devnull , _sFieldName , true ) ;
2015-11-10 10:13:39 +01:00
if ( pParseNode = = nullptr )
2015-08-12 15:09:51 +02:00
pParseNode = rParser . parseTree ( devnull , _sFieldName ) ;
2015-11-10 10:13:39 +01:00
if ( pParseNode ! = nullptr & & SQL_ISRULE ( pParseNode , select_statement ) )
2013-11-04 13:33:17 +02:00
_sFieldName = " ( " + _sFieldName + " ) " ;
2013-01-23 15:36:35 +01:00
}
2006-11-06 13:42:51 +00:00
2018-12-19 16:10:51 +02:00
std : : unique_ptr < OSQLParseNode > pParseNode ;
2013-01-23 15:36:35 +01:00
{
2018-07-21 18:50:16 +02:00
// 4 passes in trying to interpret the field name
2013-01-23 15:36:35 +01:00
// - don't quote the field name, parse internationally
// - don't quote the field name, parse en-US
// - quote the field name, parse internationally
// - quote the field name, parse en-US
size_t nPass = 4 ;
2013-04-07 12:06:47 +02:00
OUString sQuotedFullFieldName ( : : dbtools : : quoteName ( xMetaData - > getIdentifierQuoteString ( ) , _sFieldName ) ) ;
OUString sFullFieldName ( _sFieldName ) ;
2010-01-08 08:41:34 +01:00
2019-02-10 10:23:21 +01:00
if ( _pEntry - > isAggregateFunction ( ) )
2010-01-08 08:41:34 +01:00
{
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( ! _pEntry - > GetFunction ( ) . isEmpty ( ) , " No empty Function name allowed here! ;-( " ) ;
2013-01-23 15:36:35 +01:00
sQuotedFullFieldName = _pEntry - > GetFunction ( ) + " ( " + sQuotedFullFieldName + " ) " ;
sFullFieldName = _pEntry - > GetFunction ( ) + " ( " + sFullFieldName + " ) " ;
2010-01-08 08:41:34 +01:00
}
2013-01-23 15:36:35 +01:00
do
{
bool bQuote = ( nPass < = 2 ) ;
bool bInternational = ( nPass % 2 ) = = 0 ;
2002-08-30 10:14:45 +00:00
2018-09-09 12:25:08 +02:00
OUString sSql { " SELECT " } ;
2013-01-23 15:36:35 +01:00
if ( bQuote )
sSql + = sQuotedFullFieldName ;
else
sSql + = sFullFieldName ;
if ( ! sFieldAlias . isEmpty ( ) )
{ // always quote the alias name: there cannot be a function in it
2016-08-01 14:51:58 +05:30
sSql + = " " + : : dbtools : : quoteName ( xMetaData - > getIdentifierQuoteString ( ) , sFieldAlias ) ;
2013-01-23 15:36:35 +01:00
}
2013-10-25 17:17:50 +02:00
sSql + = " FROM x " ;
2013-01-23 15:36:35 +01:00
pParseNode = rParser . parseTree ( sErrorMsg , sSql , bInternational ) ;
}
2015-11-10 10:13:39 +01:00
while ( ( pParseNode = = nullptr ) & & ( - - nPass > 0 ) ) ;
2006-11-06 13:42:51 +00:00
}
2015-11-10 10:13:39 +01:00
if ( pParseNode = = nullptr )
2006-11-06 13:42:51 +00:00
{
2013-01-23 15:36:35 +01:00
// something different which we have to check
2017-06-11 20:56:30 +01:00
OUString sErrorMessage ( DBA_RES ( STR_QRY_COLUMN_NOT_FOUND ) ) ;
2013-09-27 12:04:57 +02:00
sErrorMessage = sErrorMessage . replaceFirst ( " $name$ " , _sFieldName ) ;
2018-03-20 17:17:10 +00:00
OSQLErrorBox aWarning ( GetFrameWeld ( ) , sErrorMessage ) ;
aWarning . run ( ) ;
2013-01-23 16:17:39 +01:00
2014-04-17 11:16:55 +02:00
return true ;
2006-11-06 13:42:51 +00:00
}
2002-08-30 10:14:45 +00:00
2006-11-06 13:42:51 +00:00
// we got a valid select column
// find what type of column has be inserted
: : connectivity : : OSQLParseNode * pSelection = pParseNode - > getChild ( 2 ) ;
2013-12-20 11:25:37 +01:00
if ( SQL_ISRULE ( pSelection , selection ) ) // we found the asterisk
2006-11-06 13:42:51 +00:00
{
_pEntry - > SetField ( _sFieldName ) ;
clearEntryFunctionField ( _sFieldName , _pEntry , _bListAction , _pEntry - > GetColumnId ( ) ) ;
2013-01-23 15:36:35 +01:00
}
else // travel through the select column parse node
2006-11-06 13:42:51 +00:00
{
OTableFieldDescRef aSelEntry = _pEntry ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nColumnId = aSelEntry - > GetColumnId ( ) ;
2006-11-06 13:42:51 +00:00
sal_uInt32 nCount = pSelection - > count ( ) ;
for ( sal_uInt32 i = 0 ; i < nCount ; + + i )
{
if ( i > 0 ) // may we have to append more than one field
2002-08-30 10:14:45 +00:00
{
2017-01-07 08:44:44 +01:00
sal_uInt16 nColumnPosition ;
aSelEntry = FindFirstFreeCol ( nColumnPosition ) ;
2010-10-15 12:22:54 -05:00
if ( ! aSelEntry . is ( ) )
2002-08-30 10:14:45 +00:00
{
2015-08-12 15:09:51 +02:00
AppendNewCol ( ) ;
2017-01-07 08:44:44 +01:00
aSelEntry = FindFirstFreeCol ( nColumnPosition ) ;
2002-08-30 10:14:45 +00:00
}
2017-01-07 08:44:44 +01:00
+ + nColumnPosition ;
nColumnId = GetColumnId ( nColumnPosition ) ;
2006-11-06 13:42:51 +00:00
}
2002-08-30 10:14:45 +00:00
2006-11-06 13:42:51 +00:00
: : connectivity : : OSQLParseNode * pChild = pSelection - > getChild ( i ) ;
OSL_ENSURE ( SQL_ISRULE ( pChild , derived_column ) , " No derived column found! " ) ;
// get the column alias
2013-04-07 12:06:47 +02:00
OUString sColumnAlias = OSQLParseTreeIterator : : getColumnAlias ( pChild ) ;
2011-12-19 18:10:37 -02:00
if ( ! sColumnAlias . isEmpty ( ) ) // we found an as clause
2006-11-06 13:42:51 +00:00
{
2013-09-27 12:04:57 +02:00
OUString aSelectionAlias = aSelEntry - > GetFieldAlias ( ) ;
2006-11-06 13:42:51 +00:00
aSelEntry - > SetFieldAlias ( sColumnAlias ) ;
// append undo
appendUndoAction ( aSelectionAlias , aSelEntry - > GetFieldAlias ( ) , BROW_COLUMNALIAS_ROW , _bListAction ) ;
if ( m_bVisibleRow [ BROW_COLUMNALIAS_ROW ] )
RowModified ( GetBrowseRow ( BROW_COLUMNALIAS_ROW ) , nColumnId ) ;
}
2002-08-30 10:14:45 +00:00
2006-11-06 13:42:51 +00:00
: : connectivity : : OSQLParseNode * pColumnRef = pChild - > getChild ( 0 ) ;
if (
2013-01-23 15:36:35 +01:00
pColumnRef - > getKnownRuleID ( ) ! = OSQLParseNode : : subquery & &
2006-11-06 13:42:51 +00:00
pColumnRef - > count ( ) = = 3 & &
SQL_ISPUNCTUATION ( pColumnRef - > getChild ( 0 ) , " ( " ) & &
SQL_ISPUNCTUATION ( pColumnRef - > getChild ( 2 ) , " ) " )
)
pColumnRef = pColumnRef - > getChild ( 1 ) ;
2004-10-22 08:07:06 +00:00
2006-11-06 13:42:51 +00:00
if ( SQL_ISRULE ( pColumnRef , column_ref ) ) // we found a valid column name or more column names
{
// look if we can find the corresponding table
2006-12-13 15:53:47 +00:00
bError = fillColumnRef ( pColumnRef , xConnection , aSelEntry , _bListAction ) ;
2002-08-30 10:14:45 +00:00
2006-11-06 13:42:51 +00:00
// we found a simple column so we must clear the function fields but only when the column name is '*'
// and the function is different to count
clearEntryFunctionField ( _sFieldName , aSelEntry , _bListAction , nColumnId ) ;
}
2019-05-08 10:13:33 +00:00
// do we have an aggregate function and only a function?
2011-10-29 09:07:09 +02:00
else if ( SQL_ISRULE ( pColumnRef , general_set_fct ) )
2006-11-06 13:42:51 +00:00
{
2013-09-23 07:19:08 +01:00
OUString sLocalizedFunctionName ;
2011-10-29 09:07:09 +02:00
if ( GetFunctionName ( pColumnRef - > getChild ( 0 ) - > getTokenID ( ) , sLocalizedFunctionName ) )
2002-08-30 10:14:45 +00:00
{
2013-09-27 12:04:57 +02:00
OUString sOldLocalizedFunctionName = aSelEntry - > GetFunction ( ) ;
2011-10-29 09:07:09 +02:00
aSelEntry - > SetFunction ( sLocalizedFunctionName ) ;
sal_uInt32 nFunCount = pColumnRef - > count ( ) - 1 ;
sal_Int32 nFunctionType = FKT_AGGREGATE ;
2014-04-17 11:16:55 +02:00
bool bQuote = false ;
2011-10-29 09:07:09 +02:00
// may be there exists only one parameter which is a column, fill all information into our fields
if ( nFunCount = = 4 & & SQL_ISRULE ( pColumnRef - > getChild ( 3 ) , column_ref ) )
bError = fillColumnRef ( pColumnRef - > getChild ( 3 ) , xConnection , aSelEntry , _bListAction ) ;
else if ( nFunCount = = 3 ) // we have a COUNT(*) here, so take the first table
2015-11-06 09:35:25 +01:00
bError = fillColumnRef ( " * " , OUString ( ) , xMetaData , aSelEntry , _bListAction ) ;
2011-10-29 09:07:09 +02:00
else
2002-08-30 10:14:45 +00:00
{
2011-10-29 09:07:09 +02:00
nFunctionType | = FKT_NUMERIC ;
2014-04-17 11:16:55 +02:00
bQuote = true ;
2011-10-29 09:07:09 +02:00
aSelEntry - > SetDataType ( DataType : : DOUBLE ) ;
aSelEntry - > SetFieldType ( TAB_NORMAL_FIELD ) ;
2002-08-30 10:14:45 +00:00
}
2006-11-06 13:42:51 +00:00
2011-10-29 09:07:09 +02:00
// now parse the parameters
2013-04-07 12:06:47 +02:00
OUString sParameters ;
2011-10-29 09:07:09 +02:00
for ( sal_uInt32 function = 2 ; function < nFunCount ; + + function ) // we only want to parse the parameters of the function
2014-01-28 20:02:35 +01:00
pColumnRef - > getChild ( function ) - > parseNodeToStr ( sParameters , xConnection , & rParser . getContext ( ) , true , bQuote ) ;
2011-10-29 09:07:09 +02:00
aSelEntry - > SetFunctionType ( nFunctionType ) ;
aSelEntry - > SetField ( sParameters ) ;
if ( aSelEntry - > IsGroupBy ( ) )
{
2018-09-09 10:48:28 +02:00
sOldLocalizedFunctionName = m_aFunctionStrings . copy ( m_aFunctionStrings . lastIndexOf ( ' ; ' ) + 1 ) ;
2015-09-01 14:21:06 +02:00
aSelEntry - > SetGroupBy ( false ) ;
2011-10-29 09:07:09 +02:00
}
// append undo action
notifyFunctionFieldChanged ( sOldLocalizedFunctionName , sLocalizedFunctionName , _bListAction , nColumnId ) ;
2006-11-06 13:42:51 +00:00
}
2009-11-26 12:56:23 +01:00
else
2011-10-29 09:07:09 +02:00
OSL_FAIL ( " Unsupported function inserted! " ) ;
}
else
{
// so we first clear the function field
clearEntryFunctionField ( _sFieldName , aSelEntry , _bListAction , nColumnId ) ;
2013-04-07 12:06:47 +02:00
OUString sFunction ;
2011-10-29 09:07:09 +02:00
pColumnRef - > parseNodeToStr ( sFunction ,
xConnection ,
& rController . getParser ( ) . getContext ( ) ,
2014-01-28 20:02:35 +01:00
true ) ; // quote is to true because we need quoted elements inside the function
2011-10-29 09:07:09 +02:00
getDesignView ( ) - > fillFunctionInfo ( pColumnRef , sFunction , aSelEntry ) ;
2011-10-30 13:34:01 +01:00
if ( SQL_ISRULEOR3 ( pColumnRef , position_exp , extract_exp , fold ) | |
SQL_ISRULEOR3 ( pColumnRef , char_substring_fct , length_exp , char_value_fct ) )
2011-10-29 09:07:09 +02:00
// a calculation has been found ( can be calc and function )
2006-11-06 13:42:51 +00:00
{
2011-10-29 09:07:09 +02:00
// now parse the whole statement
sal_uInt32 nFunCount = pColumnRef - > count ( ) ;
2013-04-07 12:06:47 +02:00
OUString sParameters ;
2011-10-29 09:07:09 +02:00
for ( sal_uInt32 function = 0 ; function < nFunCount ; + + function )
2015-08-12 15:09:51 +02:00
pColumnRef - > getChild ( function ) - > parseNodeToStr ( sParameters , xConnection , & rParser . getContext ( ) , true ) ;
2011-10-29 09:07:09 +02:00
sOldAlias = aSelEntry - > GetAlias ( ) ;
sal_Int32 nNewFunctionType = aSelEntry - > GetFunctionType ( ) | FKT_NUMERIC | FKT_OTHER ;
aSelEntry - > SetFunctionType ( nNewFunctionType ) ;
aSelEntry - > SetField ( sParameters ) ;
}
else
{
aSelEntry - > SetFieldAlias ( sColumnAlias ) ;
if ( SQL_ISRULE ( pColumnRef , set_fct_spec ) )
aSelEntry - > SetFunctionType ( /*FKT_NUMERIC | */ FKT_OTHER ) ;
2009-11-26 12:56:23 +01:00
else
2011-10-29 09:07:09 +02:00
aSelEntry - > SetFunctionType ( FKT_NUMERIC | FKT_OTHER ) ;
2002-08-30 10:14:45 +00:00
}
2009-11-26 12:56:23 +01:00
2013-04-07 12:06:47 +02:00
aSelEntry - > SetAlias ( OUString ( ) ) ;
2011-10-29 09:07:09 +02:00
notifyTableFieldChanged ( sOldAlias , aSelEntry - > GetAlias ( ) , _bListAction , nColumnId ) ;
2002-08-30 10:14:45 +00:00
}
2011-10-29 09:07:09 +02:00
2014-04-17 11:16:55 +02:00
if ( i > 0 & & ! InsertField ( aSelEntry , BROWSER_INVALIDID , true , false ) . is ( ) ) // may we have to append more than one field
2011-10-29 09:07:09 +02:00
{ // the field could not be inserted
2017-06-11 20:56:30 +01:00
OUString sErrorMessage ( DBA_RES ( RID_STR_FIELD_DOESNT_EXIST ) ) ;
2013-09-27 12:04:57 +02:00
sErrorMessage = sErrorMessage . replaceFirst ( " $name$ " , aSelEntry - > GetField ( ) ) ;
2018-03-20 17:17:10 +00:00
OSQLErrorBox aWarning ( GetFrameWeld ( ) , sErrorMessage ) ;
aWarning . run ( ) ;
2014-04-17 11:16:55 +02:00
bError = true ;
2006-11-06 13:42:51 +00:00
}
2001-02-05 08:26:47 +00:00
}
}
2002-08-30 10:14:45 +00:00
return bError ;
}
2013-08-17 23:43:14 +02:00
2014-03-20 11:14:54 +02:00
bool OSelectionBrowseBox : : SaveModified ( )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
2018-09-06 10:33:11 +02:00
OTableFieldDescRef pEntry ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nCurrentColumnPos = GetColumnPos ( GetCurColumnId ( ) ) ;
if ( getFields ( ) . size ( ) > static_cast < sal_uInt16 > ( nCurrentColumnPos - 1 ) )
2006-06-20 02:27:27 +00:00
pEntry = getEntry ( nCurrentColumnPos - 1 ) ;
2001-02-05 08:26:47 +00:00
2014-04-17 11:16:55 +02:00
bool bWasEmpty = pEntry . is ( ) & & pEntry - > IsEmpty ( ) ;
bool bError = false ;
bool bListAction = false ;
2001-02-05 08:26:47 +00:00
2017-01-25 12:03:58 +02:00
if ( pEntry . is ( ) & & Controller ( ) . is ( ) & & Controller ( ) - > IsModified ( ) )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// for the Undo-action
2013-09-27 12:04:57 +02:00
OUString strOldCellContents , sNewValue ;
2001-02-05 08:26:47 +00:00
long nRow = GetRealRow ( GetCurRow ( ) ) ;
2014-04-17 11:16:55 +02:00
bool bAppendRow = false ;
2001-02-05 08:26:47 +00:00
switch ( nRow )
{
case BROW_VIS_ROW :
{
2014-04-17 11:16:55 +02:00
bool bOldValue = m_pVisibleCell - > GetBox ( ) . GetSavedValue ( ) ! = TRISTATE_FALSE ;
2014-12-18 16:44:06 +01:00
strOldCellContents = bOldValue ? OUStringLiteral ( " 1 " ) : OUStringLiteral ( " 0 " ) ;
sNewValue = ! bOldValue ? OUStringLiteral ( " 1 " ) : OUStringLiteral ( " 0 " ) ;
2001-04-18 10:44:59 +00:00
}
if ( ( m_bOrderByUnRelated | | pEntry - > GetOrderDir ( ) = = ORDER_NONE ) & &
( m_bGroupByUnRelated | | ! pEntry - > IsGroupBy ( ) ) )
{
2001-02-05 08:26:47 +00:00
pEntry - > SetVisible ( m_pVisibleCell - > GetBox ( ) . IsChecked ( ) ) ;
}
else
{
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
m_pVisibleCell - > GetBox ( ) . Check ( ) ;
}
break ;
case BROW_FIELD_ROW :
{
2013-09-27 12:04:57 +02:00
OUString aFieldName ( m_pFieldCell - > GetText ( ) ) ;
2003-12-01 09:38:48 +00:00
try
2001-02-05 08:26:47 +00:00
{
2013-09-27 12:04:57 +02:00
if ( aFieldName . isEmpty ( ) )
2003-12-01 09:38:48 +00:00
{
OTableFieldDescRef pNewEntry = new OTableFieldDesc ( ) ;
pNewEntry - > SetColumnId ( pEntry - > GetColumnId ( ) ) ;
2017-02-17 19:06:24 +02:00
std : : replace ( getFields ( ) . begin ( ) , getFields ( ) . end ( ) , pEntry , pNewEntry ) ;
2003-12-01 09:38:48 +00:00
sal_uInt16 nCol = GetCurColumnId ( ) ;
2013-03-02 15:06:22 +01:00
for ( int i = 0 ; i < m_nVisibleCount ; i + + ) // redraw column
2003-12-01 09:38:48 +00:00
RowModified ( i , nCol ) ;
2002-09-24 09:52:28 +00:00
}
else
2003-12-01 09:38:48 +00:00
{
strOldCellContents = pEntry - > GetField ( ) ;
2014-04-17 11:16:55 +02:00
bListAction = true ;
2005-09-23 11:43:59 +00:00
if ( ! m_bInUndoMode )
2017-03-18 18:24:53 +02:00
rController . GetUndoManager ( ) . EnterListAction ( OUString ( ) , OUString ( ) , 0 , ViewShellId ( - 1 ) ) ;
2003-12-01 09:38:48 +00:00
2014-03-01 03:13:28 +01:00
sal_Int32 nPos = m_pFieldCell - > GetEntryPos ( aFieldName ) ;
2013-09-27 12:04:57 +02:00
OUString aAliasName = pEntry - > GetAlias ( ) ;
2018-09-09 12:30:06 +02:00
if ( nPos ! = COMBOBOX_ENTRY_NOTFOUND & & aAliasName . isEmpty ( ) & & aFieldName . indexOf ( ' . ' ) > = 0 )
2003-12-01 09:38:48 +00:00
{ // special case, we have a table field so we must cut the table name
2013-09-27 12:04:57 +02:00
OUString sTableAlias = aFieldName . getToken ( 0 , ' . ' ) ;
2003-12-01 09:38:48 +00:00
pEntry - > SetAlias ( sTableAlias ) ;
2017-07-11 11:04:35 +02:00
OUString sColumnName = aFieldName . copy ( sTableAlias . getLength ( ) + 1 ) ;
2018-10-23 07:47:33 +02:00
const Reference < XConnection > & xConnection = rController . getConnection ( ) ;
2003-12-01 09:38:48 +00:00
if ( ! xConnection . is ( ) )
2014-03-20 11:14:54 +02:00
return false ;
2006-12-13 15:53:47 +00:00
bError = fillColumnRef ( sColumnName , sTableAlias , xConnection - > getMetaData ( ) , pEntry , bListAction ) ;
2003-12-01 09:38:48 +00:00
}
else
2014-04-17 11:16:55 +02:00
bError = true ;
2002-09-24 09:52:28 +00:00
2003-12-01 09:38:48 +00:00
if ( bError )
bError = saveField ( aFieldName , pEntry , bListAction ) ;
}
}
catch ( Exception & )
{
2014-04-17 11:16:55 +02:00
bError = true ;
2002-08-30 10:14:45 +00:00
}
if ( bError )
{
sNewValue = aFieldName ;
2005-09-23 11:43:59 +00:00
if ( ! m_bInUndoMode )
2010-11-17 09:11:03 +01:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . GetUndoManager ( ) . LeaveListAction ( ) ;
2014-04-17 11:16:55 +02:00
bListAction = false ;
2001-02-05 08:26:47 +00:00
}
2002-08-30 10:14:45 +00:00
else
sNewValue = pEntry - > GetField ( ) ;
2008-06-25 11:54:03 +00:00
rController . InvalidateFeature ( ID_BROWSER_QUERY_EXECUTE ) ;
2001-02-05 08:26:47 +00:00
}
break ;
case BROW_TABLE_ROW :
{
2017-09-14 16:50:25 +02:00
OUString aAliasName = m_pTableCell - > GetSelectedEntry ( ) ;
2001-02-05 08:26:47 +00:00
strOldCellContents = pEntry - > GetAlias ( ) ;
2017-09-14 16:57:06 +02:00
if ( m_pTableCell - > GetSelectedEntryPos ( ) ! = 0 )
2001-02-05 08:26:47 +00:00
{
2002-08-30 10:14:45 +00:00
pEntry - > SetAlias ( aAliasName ) ;
// we have to set the table name as well as the table window
2014-06-18 12:14:29 +02:00
OJoinTableView : : OTableWindowMap & rTabWinList = getDesignView ( ) - > getTableView ( ) - > GetTabWinMap ( ) ;
2016-03-28 19:17:45 +02:00
OJoinTableView : : OTableWindowMap : : const_iterator aIter = rTabWinList . find ( aAliasName ) ;
2014-06-18 12:14:29 +02:00
if ( aIter ! = rTabWinList . end ( ) )
2001-02-05 08:26:47 +00:00
{
2015-03-09 14:29:30 +02:00
OQueryTableWindow * pEntryTab = static_cast < OQueryTableWindow * > ( aIter - > second . get ( ) ) ;
2014-06-18 12:14:29 +02:00
if ( pEntryTab )
2001-02-05 08:26:47 +00:00
{
2014-06-18 12:14:29 +02:00
pEntry - > SetTable ( pEntryTab - > GetTableName ( ) ) ;
pEntry - > SetTabWindow ( pEntryTab ) ;
2001-02-05 08:26:47 +00:00
}
}
}
2002-08-30 10:14:45 +00:00
else
{
2013-04-07 12:06:47 +02:00
pEntry - > SetAlias ( OUString ( ) ) ;
pEntry - > SetTable ( OUString ( ) ) ;
2015-11-10 10:13:39 +01:00
pEntry - > SetTabWindow ( nullptr ) ;
2002-08-30 10:14:45 +00:00
}
sNewValue = pEntry - > GetAlias ( ) ;
2001-02-05 08:26:47 +00:00
} break ;
case BROW_ORDER_ROW :
{
2018-01-12 20:25:56 +01:00
strOldCellContents = OUString : : number ( static_cast < sal_uInt16 > ( pEntry - > GetOrderDir ( ) ) ) ;
2017-09-14 16:57:06 +02:00
sal_Int32 nIdx = m_pOrderCell - > GetSelectedEntryPos ( ) ;
2014-03-01 03:13:28 +01:00
if ( nIdx = = LISTBOX_ENTRY_NOTFOUND )
2001-02-05 08:26:47 +00:00
nIdx = 0 ;
pEntry - > SetOrderDir ( EOrderDir ( nIdx ) ) ;
if ( ! m_bOrderByUnRelated )
{
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
m_pVisibleCell - > GetBox ( ) . Check ( ) ;
RowModified ( GetBrowseRow ( BROW_VIS_ROW ) , GetCurColumnId ( ) ) ;
}
2018-01-12 20:25:56 +01:00
sNewValue = OUString : : number ( static_cast < sal_uInt16 > ( pEntry - > GetOrderDir ( ) ) ) ;
2001-02-05 08:26:47 +00:00
} break ;
case BROW_COLUMNALIAS_ROW :
strOldCellContents = pEntry - > GetFieldAlias ( ) ;
pEntry - > SetFieldAlias ( m_pTextCell - > GetText ( ) ) ;
2001-04-18 10:44:59 +00:00
sNewValue = pEntry - > GetFieldAlias ( ) ;
2001-02-05 08:26:47 +00:00
break ;
case BROW_FUNCTION_ROW :
{
strOldCellContents = pEntry - > GetFunction ( ) ;
2017-09-14 16:57:06 +02:00
sal_Int32 nPos = m_pFunctionCell - > GetSelectedEntryPos ( ) ;
2013-03-02 15:06:22 +01:00
// these functions are only available in CORE
2013-09-27 12:04:57 +02:00
OUString sFunctionName = m_pFunctionCell - > GetEntry ( nPos ) ;
2018-09-09 10:48:28 +02:00
OUString sGroupFunctionName = m_aFunctionStrings . copy ( m_aFunctionStrings . lastIndexOf ( ' ; ' ) + 1 ) ;
2014-04-17 11:16:55 +02:00
bool bGroupBy = false ;
2017-07-13 09:56:52 +02:00
if ( sGroupFunctionName = = sFunctionName ) // check if the function name is GROUP
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
bGroupBy = true ;
2002-08-30 10:14:45 +00:00
if ( ! m_bGroupByUnRelated & & ! pEntry - > IsVisible ( ) )
{
2015-09-29 17:48:29 +02:00
// we have to change the visible flag, so we must append also an undo action
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2002-08-30 10:14:45 +00:00
m_pVisibleCell - > GetBox ( ) . Check ( ) ;
2014-12-18 13:22:10 +01:00
appendUndoAction ( " 0 " , " 1 " , BROW_VIS_ROW , bListAction ) ;
2002-08-30 10:14:45 +00:00
RowModified ( GetBrowseRow ( BROW_VIS_ROW ) , GetCurColumnId ( ) ) ;
}
2013-09-27 12:04:57 +02:00
pEntry - > SetFunction ( OUString ( ) ) ;
2002-08-30 10:14:45 +00:00
pEntry - > SetFunctionType ( pEntry - > GetFunctionType ( ) & ~ FKT_AGGREGATE ) ;
}
else if ( nPos ) // we found an aggregate function
{
pEntry - > SetFunctionType ( pEntry - > GetFunctionType ( ) | FKT_AGGREGATE ) ;
pEntry - > SetFunction ( sFunctionName ) ;
2001-02-05 08:26:47 +00:00
}
else
{
2014-12-18 13:22:10 +01:00
sFunctionName . clear ( ) ;
2013-09-27 12:04:57 +02:00
pEntry - > SetFunction ( OUString ( ) ) ;
2002-08-30 10:14:45 +00:00
pEntry - > SetFunctionType ( pEntry - > GetFunctionType ( ) & ~ FKT_AGGREGATE ) ;
2001-02-05 08:26:47 +00:00
}
2002-08-30 10:14:45 +00:00
pEntry - > SetGroupBy ( bGroupBy ) ;
sNewValue = sFunctionName ;
2001-02-05 08:26:47 +00:00
}
break ;
default :
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2001-03-01 14:45:02 +00:00
if ( ! xConnection . is ( ) )
break ;
2001-02-05 08:26:47 +00:00
2003-12-01 09:38:48 +00:00
sal_uInt16 nIdx = sal_uInt16 ( nRow - BROW_CRIT1_ROW ) ;
2013-09-27 12:04:57 +02:00
OUString aText = comphelper : : string : : stripStart ( m_pTextCell - > GetText ( ) , ' ' ) ;
2001-02-05 08:26:47 +00:00
2013-04-07 12:06:47 +02:00
OUString aCrit ;
2013-09-27 12:04:57 +02:00
if ( ! aText . isEmpty ( ) )
2001-02-05 08:26:47 +00:00
{
2013-04-07 12:06:47 +02:00
OUString aErrorMsg ;
2001-02-05 08:26:47 +00:00
Reference < XPropertySet > xColumn ;
2018-12-19 16:10:51 +02:00
std : : unique_ptr < OSQLParseNode > pParseNode = getDesignView ( ) - > getPredicateTreeFromEntry ( pEntry , aText , aErrorMsg , xColumn ) ;
2001-02-05 08:26:47 +00:00
if ( pParseNode )
{
pParseNode - > parseNodeToPredicateStr ( aCrit ,
2006-12-13 15:53:47 +00:00
xConnection ,
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getNumberFormatter ( ) ,
2001-02-05 08:26:47 +00:00
xColumn ,
2013-04-26 12:14:33 +02:00
pEntry - > GetAlias ( ) ,
2001-02-05 08:26:47 +00:00
getDesignView ( ) - > getLocale ( ) ,
2019-10-08 20:43:03 +02:00
getDesignView ( ) - > getDecimalSeparator ( ) ,
2008-06-25 11:54:03 +00:00
& ( static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getParser ( ) . getContext ( ) ) ) ;
2001-02-05 08:26:47 +00:00
}
else
{
if ( xColumn . is ( ) )
{
sal_Int32 nType = 0 ;
xColumn - > getPropertyValue ( PROPERTY_TYPE ) > > = nType ;
switch ( nType )
{
case DataType : : CHAR :
case DataType : : VARCHAR :
case DataType : : LONGVARCHAR :
2009-11-11 14:07:55 +01:00
case DataType : : CLOB :
2013-10-21 10:21:01 +02:00
if ( ! aText . startsWith ( " ' " ) | | ! aText . endsWith ( " ' " ) )
2001-02-05 08:26:47 +00:00
{
2013-09-27 12:04:57 +02:00
aText = aText . replaceAll ( " ' " , " '' " ) ;
aText = " ' " + aText + " ' " ;
2001-02-05 08:26:47 +00:00
}
break ;
default :
;
}
2008-06-25 11:54:03 +00:00
: : connectivity : : OSQLParser & rParser = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getParser ( ) ;
2006-07-10 14:44:07 +00:00
pParseNode = rParser . predicateTree ( aErrorMsg ,
2001-09-27 05:19:05 +00:00
aText ,
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getNumberFormatter ( ) ,
2001-09-27 05:19:05 +00:00
xColumn ) ;
2001-02-05 08:26:47 +00:00
if ( pParseNode )
{
pParseNode - > parseNodeToPredicateStr ( aCrit ,
2006-12-13 15:53:47 +00:00
xConnection ,
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getNumberFormatter ( ) ,
2001-02-05 08:26:47 +00:00
xColumn ,
2013-04-26 12:14:33 +02:00
pEntry - > GetAlias ( ) ,
2001-02-05 08:26:47 +00:00
getDesignView ( ) - > getLocale ( ) ,
2019-10-08 20:43:03 +02:00
getDesignView ( ) - > getDecimalSeparator ( ) ,
2008-06-25 11:54:03 +00:00
& ( static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getParser ( ) . getContext ( ) ) ) ;
2001-02-05 08:26:47 +00:00
}
else
{
2004-03-15 11:43:58 +00:00
if ( ! m_bDisableErrorBox )
{
2018-03-20 17:17:10 +00:00
OSQLWarningBox aWarning ( GetFrameWeld ( ) , aErrorMsg ) ;
aWarning . run ( ) ;
2004-03-15 11:43:58 +00:00
}
2014-04-17 11:16:55 +02:00
bError = true ;
2001-02-05 08:26:47 +00:00
}
}
else
{
2004-03-15 11:43:58 +00:00
if ( ! m_bDisableErrorBox )
{
2018-03-20 17:17:10 +00:00
OSQLWarningBox aWarning ( GetFrameWeld ( ) , aErrorMsg ) ;
aWarning . run ( ) ;
2004-03-15 11:43:58 +00:00
}
2014-04-17 11:16:55 +02:00
bError = true ;
2001-02-05 08:26:47 +00:00
}
}
}
strOldCellContents = pEntry - > GetCriteria ( nIdx ) ;
pEntry - > SetCriteria ( nIdx , aCrit ) ;
2001-04-18 10:44:59 +00:00
sNewValue = pEntry - > GetCriteria ( nIdx ) ;
2011-12-19 18:10:37 -02:00
if ( ! aCrit . isEmpty ( ) & & nRow > = ( GetRowCount ( ) - 1 ) )
2014-04-17 11:16:55 +02:00
bAppendRow = true ;
2001-02-05 08:26:47 +00:00
}
}
2017-01-25 12:03:58 +02:00
if ( ! bError & & Controller ( ) . is ( ) )
2001-02-05 08:26:47 +00:00
Controller ( ) - > ClearModified ( ) ;
RowModified ( GetCurRow ( ) , GetCurColumnId ( ) ) ;
2005-12-21 12:37:05 +00:00
if ( bAppendRow )
{
2015-10-19 17:49:41 +02:00
RowInserted ( GetRowCount ( ) - 1 ) ;
2014-01-28 20:02:35 +01:00
m_bVisibleRow . push_back ( true ) ;
2005-12-21 12:37:05 +00:00
+ + m_nVisibleCount ;
}
2001-03-20 07:12:13 +00:00
if ( ! bError )
{
2013-03-02 15:06:22 +01:00
// and now the undo-action for the total
2001-04-18 10:44:59 +00:00
appendUndoAction ( strOldCellContents , sNewValue , nRow ) ;
2002-08-30 10:14:45 +00:00
2001-03-20 07:12:13 +00:00
}
2001-02-05 08:26:47 +00:00
}
2013-03-02 15:06:22 +01:00
// did I store data in a FieldDescription which was empty before and which is not empty anymore after the changes?
2010-10-15 12:22:54 -05:00
if ( pEntry . is ( ) & & bWasEmpty & & ! pEntry - > IsEmpty ( ) & & ! bError )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// Default to visible
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2014-12-18 13:22:10 +01:00
appendUndoAction ( " 0 " , " 1 " , BROW_VIS_ROW , bListAction ) ;
2001-02-05 08:26:47 +00:00
RowModified ( BROW_VIS_ROW , GetCurColumnId ( ) ) ;
2013-03-02 15:06:22 +01:00
// if required add empty columns
2011-01-14 15:00:11 +01:00
sal_uInt16 nDummy ;
2001-02-05 08:26:47 +00:00
CheckFreeColumns ( nDummy ) ;
}
2005-09-23 11:43:59 +00:00
if ( bListAction & & ! m_bInUndoMode )
2010-11-17 09:11:03 +01:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . GetUndoManager ( ) . LeaveListAction ( ) ;
2002-08-30 10:14:45 +00:00
2015-11-10 10:13:39 +01:00
return pEntry ! = nullptr & & ! bError ;
2001-02-05 08:26:47 +00:00
}
2014-03-19 14:11:04 +02:00
bool OSelectionBrowseBox : : SeekRow ( long nRow )
2001-02-05 08:26:47 +00:00
{
m_nSeekRow = nRow ;
2014-03-19 14:11:04 +02:00
return nRow < m_nVisibleCount ;
2001-02-05 08:26:47 +00:00
}
2017-03-30 20:27:55 +02:00
void OSelectionBrowseBox : : PaintCell ( OutputDevice & rDev , const tools : : Rectangle & rRect , sal_uInt16 nColumnId ) const
2001-02-05 08:26:47 +00:00
{
2014-09-27 14:52:40 +02:00
rDev . SetClipRegion ( vcl : : Region ( rRect ) ) ;
2001-02-05 08:26:47 +00:00
2018-09-06 10:33:11 +02:00
OTableFieldDescRef pEntry ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColumnId ) ;
2002-08-19 07:01:32 +00:00
if ( getFields ( ) . size ( ) > sal_uInt16 ( nPos - 1 ) )
pEntry = getFields ( ) [ nPos - 1 ] ;
2001-02-05 08:26:47 +00:00
2010-10-15 12:22:54 -05:00
if ( ! pEntry . is ( ) )
2001-02-05 08:26:47 +00:00
return ;
long nRow = GetRealRow ( m_nSeekRow ) ;
if ( nRow = = BROW_VIS_ROW )
2017-05-03 15:06:07 +02:00
PaintTristate ( rRect , pEntry - > IsVisible ( ) ? TRISTATE_TRUE : TRISTATE_FALSE ) ;
2001-02-05 08:26:47 +00:00
else
2015-05-18 13:36:39 +02:00
rDev . DrawText ( rRect , GetCellText ( nRow , nColumnId ) , DrawTextFlags : : VCenter ) ;
2001-02-05 08:26:47 +00:00
rDev . SetClipRegion ( ) ;
}
2017-03-30 20:27:55 +02:00
void OSelectionBrowseBox : : PaintStatusCell ( OutputDevice & rDev , const tools : : Rectangle & rRect ) const
2001-02-05 08:26:47 +00:00
{
2017-03-30 20:27:55 +02:00
tools : : Rectangle aRect ( rRect ) ;
2018-02-16 12:48:27 +02:00
aRect . TopLeft ( ) . AdjustY ( - 2 ) ;
2017-06-11 20:56:30 +01:00
OUString aLabel ( DBA_RES ( STR_QUERY_HANDLETEXT ) ) ;
2001-02-05 08:26:47 +00:00
2013-03-02 15:06:22 +01:00
// from BROW_CRIT2_ROW onwards all rows are shown "or"
2014-01-15 15:26:41 +00:00
sal_Int32 nToken = ( m_nSeekRow > = GetBrowseRow ( BROW_CRIT2_ROW ) )
? BROW_CRIT2_ROW : GetRealRow ( m_nSeekRow ) ;
2015-05-18 13:36:39 +02:00
rDev . DrawText ( aRect , aLabel . getToken ( nToken , ' ; ' ) , DrawTextFlags : : VCenter ) ;
2001-02-05 08:26:47 +00:00
}
2011-01-14 15:00:11 +01:00
void OSelectionBrowseBox : : RemoveColumn ( sal_uInt16 _nColumnId )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
2001-04-30 12:02:01 +00:00
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( _nColumnId ) ;
2013-03-02 15:06:22 +01:00
// the control should always have exactly one more column: the HandleColumn
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( ( nPos = = 0 ) | | ( nPos < = getFields ( ) . size ( ) ) , " OSelectionBrowseBox::RemoveColumn : invalid parameter nColId " ) ;
2013-03-02 15:06:22 +01:00
// ColId is synonymous to Position, and the condition should be valid
2001-02-05 08:26:47 +00:00
sal_uInt16 nCurCol = GetCurColumnId ( ) ;
2006-06-20 02:27:27 +00:00
long nCurrentRow = GetCurRow ( ) ;
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
2002-08-19 07:01:32 +00:00
getFields ( ) . erase ( getFields ( ) . begin ( ) + ( nPos - 1 ) ) ;
OTableFieldDescRef pEntry = new OTableFieldDesc ( ) ;
pEntry - > SetColumnId ( _nColumnId ) ;
getFields ( ) . push_back ( pEntry ) ;
EditBrowseBox : : RemoveColumn ( _nColumnId ) ;
2015-10-20 11:45:11 +02:00
InsertDataColumn ( _nColumnId , OUString ( ) , DEFAULT_SIZE ) ;
2001-02-05 08:26:47 +00:00
2017-05-14 15:55:54 +02:00
// redraw
2017-03-30 20:27:55 +02:00
tools : : Rectangle aInvalidRect = GetInvalidRect ( _nColumnId ) ;
2001-02-05 08:26:47 +00:00
Invalidate ( aInvalidRect ) ;
2006-06-20 02:27:27 +00:00
ActivateCell ( nCurrentRow , nCurCol ) ;
2001-02-05 08:26:47 +00:00
2016-04-20 17:16:13 +02:00
rController . setModified ( true ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
invalidateUndoRedo ( ) ;
2001-02-05 08:26:47 +00:00
}
2006-06-20 02:27:27 +00:00
void OSelectionBrowseBox : : RemoveField ( sal_uInt16 nColumnId )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
2001-02-05 08:26:47 +00:00
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColumnId ) ;
2002-08-19 07:01:32 +00:00
OSL_ENSURE ( getFields ( ) . size ( ) > sal_uInt16 ( nPos - 1 ) , " ID is to great! " ) ;
2001-04-30 12:02:01 +00:00
2018-01-12 20:25:56 +01:00
OTableFieldDescRef pDesc = getEntry ( static_cast < sal_uInt32 > ( nPos - 1 ) ) ;
pDesc - > SetColWidth ( static_cast < sal_uInt16 > ( GetColumnWidth ( nColumnId ) ) ) ; // was not stored this before
2001-02-05 08:26:47 +00:00
2013-03-02 15:06:22 +01:00
// trigger UndoAction
2005-09-23 11:43:59 +00:00
if ( ! m_bInUndoMode )
{
2018-10-08 11:22:10 +02:00
std : : unique_ptr < OTabFieldDelUndoAct > pUndoAction ( new OTabFieldDelUndoAct ( this ) ) ;
2005-09-23 11:43:59 +00:00
pUndoAction - > SetTabFieldDescr ( pDesc ) ;
pUndoAction - > SetColumnPosition ( nPos ) ;
2018-10-08 11:22:10 +02:00
rController . addUndoActionAndInvalidate ( std : : move ( pUndoAction ) ) ;
2005-09-23 11:43:59 +00:00
}
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
RemoveColumn ( nColumnId ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
invalidateUndoRedo ( ) ;
2001-02-05 08:26:47 +00:00
}
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : adjustSelectionMode ( bool _bClickedOntoHeader , bool _bClickedOntoHandleCol )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// if a Header has been selected it should be shown otherwise not
2002-05-24 11:58:56 +00:00
if ( _bClickedOntoHeader )
2001-02-05 08:26:47 +00:00
{
2002-05-24 11:58:56 +00:00
if ( 0 = = GetSelectColumnCount ( ) )
2013-03-02 15:06:22 +01:00
// I am in the correct mode if a selected column exists
2015-04-16 15:41:10 +02:00
if ( BrowserMode : : HIDESELECT = = ( m_nMode & BrowserMode : : HIDESELECT ) )
2001-02-05 08:26:47 +00:00
{
2015-04-16 15:41:10 +02:00
m_nMode & = ~ BrowserMode : : HIDESELECT ;
m_nMode | = BrowserMode : : MULTISELECTION ;
2002-05-24 11:58:56 +00:00
SetMode ( m_nMode ) ;
2001-02-05 08:26:47 +00:00
}
2002-05-24 11:58:56 +00:00
}
2015-04-16 15:41:10 +02:00
else if ( BrowserMode : : HIDESELECT ! = ( m_nMode & BrowserMode : : HIDESELECT ) )
2002-05-24 11:58:56 +00:00
{
if ( GetSelectColumnCount ( ) ! = 0 )
SetNoSelection ( ) ;
if ( _bClickedOntoHandleCol )
{
2015-04-16 15:41:10 +02:00
m_nMode | = BrowserMode : : HIDESELECT ;
m_nMode & = ~ BrowserMode : : MULTISELECTION ;
2002-05-24 11:58:56 +00:00
SetMode ( m_nMode ) ;
2001-02-05 08:26:47 +00:00
}
}
2002-05-24 11:58:56 +00:00
}
void OSelectionBrowseBox : : MouseButtonDown ( const BrowserMouseEvent & rEvt )
{
if ( rEvt . IsLeft ( ) )
{
2014-04-17 11:16:55 +02:00
bool bOnHandle = HANDLE_ID = = rEvt . GetColumnId ( ) ;
bool bOnHeader = ( rEvt . GetRow ( ) < 0 ) & & ! bOnHandle ;
2002-05-24 11:58:56 +00:00
adjustSelectionMode ( bOnHeader , bOnHandle ) ;
}
2001-06-29 07:45:10 +00:00
EditBrowseBox : : MouseButtonDown ( rEvt ) ;
2001-02-05 08:26:47 +00:00
}
void OSelectionBrowseBox : : MouseButtonUp ( const BrowserMouseEvent & rEvt )
{
2001-06-29 07:45:10 +00:00
EditBrowseBox : : MouseButtonUp ( rEvt ) ;
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( ID_BROWSER_QUERY_EXECUTE ) ;
2001-02-05 08:26:47 +00:00
}
void OSelectionBrowseBox : : KeyInput ( const KeyEvent & rEvt )
{
if ( IsColumnSelected ( GetCurColumnId ( ) ) )
{
if ( rEvt . GetKeyCode ( ) . GetCode ( ) = = KEY_DELETE & & // Delete rows
! rEvt . GetKeyCode ( ) . IsShift ( ) & &
! rEvt . GetKeyCode ( ) . IsMod1 ( ) )
{
RemoveField ( GetCurColumnId ( ) ) ;
return ;
}
}
2001-06-29 07:45:10 +00:00
EditBrowseBox : : KeyInput ( rEvt ) ;
2001-02-05 08:26:47 +00:00
}
2001-03-30 12:06:46 +00:00
sal_Int8 OSelectionBrowseBox : : AcceptDrop ( const BrowserAcceptDropEvent & rEvt )
2001-02-05 08:26:47 +00:00
{
2002-06-21 06:09:34 +00:00
sal_Int8 nDropAction = DND_ACTION_NONE ;
2006-06-20 02:27:27 +00:00
if ( rEvt . GetRow ( ) > = - 1 )
2002-06-21 06:09:34 +00:00
{
if ( IsEditing ( ) )
{
2013-12-20 11:25:37 +01:00
// allow the asterisk again
2014-04-17 11:16:55 +02:00
m_bDisableErrorBox = true ;
2002-06-21 06:09:34 +00:00
SaveModified ( ) ;
2014-04-17 11:16:55 +02:00
m_bDisableErrorBox = false ;
2002-06-21 06:09:34 +00:00
DeactivateCell ( ) ;
}
// check if the format is already supported, if not deactivate the current cell and try again
if ( OJoinExchObj : : isFormatAvailable ( GetDataFlavors ( ) ) )
nDropAction = DND_ACTION_LINK ;
}
2001-03-30 12:06:46 +00:00
2002-06-21 06:09:34 +00:00
return nDropAction ;
2001-03-30 12:06:46 +00:00
}
sal_Int8 OSelectionBrowseBox : : ExecuteDrop ( const BrowserExecuteDropEvent & _rEvt )
{
TransferableDataHelper aDropped ( _rEvt . maDropEvent . Transferable ) ;
if ( ! OJoinExchObj : : isFormatAvailable ( aDropped . GetDataFlavorExVector ( ) ) )
2001-02-05 08:26:47 +00:00
{
2011-02-25 17:47:41 +01:00
OSL_FAIL ( " OSelectionBrowseBox::ExecuteDrop: this should never have passed AcceptDrop! " ) ;
2001-03-30 12:06:46 +00:00
return DND_ACTION_NONE ;
2001-02-05 08:26:47 +00:00
}
2001-03-30 12:06:46 +00:00
2015-08-05 10:48:40 +02:00
rtl : : Reference < OTableFieldDesc > aInfo ;
2013-03-02 15:06:22 +01:00
// insert the field at the selected position
2001-03-30 12:06:46 +00:00
OJoinExchangeData jxdSource = OJoinExchObj : : GetSourceDescription ( _rEvt . maDropEvent . Transferable ) ;
InsertField ( jxdSource ) ;
return DND_ACTION_LINK ;
2001-02-05 08:26:47 +00:00
}
2018-01-02 15:10:58 +02:00
OTableFieldDescRef const & OSelectionBrowseBox : : AppendNewCol ( sal_uInt16 nCnt )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// one or more can be created, but the first one will is not returned
2001-10-05 05:49:21 +00:00
sal_uInt32 nCount = getFields ( ) . size ( ) ;
2001-02-05 08:26:47 +00:00
for ( sal_uInt16 i = 0 ; i < nCnt ; i + + )
{
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEmptyEntry = new OTableFieldDesc ( ) ;
getFields ( ) . push_back ( pEmptyEntry ) ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nColumnId = sal : : static_int_cast < sal_uInt16 > ( getFields ( ) . size ( ) ) ;
2002-08-19 07:01:32 +00:00
pEmptyEntry - > SetColumnId ( nColumnId ) ;
2015-10-20 11:45:11 +02:00
InsertDataColumn ( nColumnId , OUString ( ) , DEFAULT_SIZE ) ;
2001-02-05 08:26:47 +00:00
}
2001-10-05 05:49:21 +00:00
return getFields ( ) [ nCount ] ;
2001-02-05 08:26:47 +00:00
}
2013-09-27 12:04:57 +02:00
void OSelectionBrowseBox : : DeleteFields ( const OUString & rAliasName )
2001-02-05 08:26:47 +00:00
{
2001-10-05 05:49:21 +00:00
if ( ! getFields ( ) . empty ( ) )
2001-02-05 08:26:47 +00:00
{
sal_uInt16 nColId = GetCurColumnId ( ) ;
sal_uInt32 nRow = GetCurRow ( ) ;
2014-04-17 11:16:55 +02:00
bool bWasEditing = IsEditing ( ) ;
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
2019-02-24 17:09:03 +03:00
auto aIter = std : : find_if ( getFields ( ) . rbegin ( ) , getFields ( ) . rend ( ) ,
[ & rAliasName ] ( const OTableFieldDescRef pEntry ) { return pEntry - > GetAlias ( ) = = rAliasName ; } ) ;
if ( aIter ! = getFields ( ) . rend ( ) )
2001-02-05 08:26:47 +00:00
{
2019-02-24 17:09:03 +03:00
sal_uInt16 nPos = sal : : static_int_cast < sal_uInt16 > ( std : : distance ( aIter , getFields ( ) . rend ( ) ) ) ;
RemoveField ( GetColumnId ( nPos ) ) ;
2001-02-05 08:26:47 +00:00
}
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
ActivateCell ( nRow , nColId ) ;
}
}
void OSelectionBrowseBox : : SetColWidth ( sal_uInt16 nColId , long nNewWidth )
{
2014-04-17 11:16:55 +02:00
bool bWasEditing = IsEditing ( ) ;
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
2013-03-02 15:06:22 +01:00
// create the BaseClass
2001-02-05 08:26:47 +00:00
SetColumnWidth ( nColId , nNewWidth ) ;
2013-03-02 15:06:22 +01:00
// tell it the FieldDescription
2002-08-30 10:14:45 +00:00
OTableFieldDescRef pEntry = getEntry ( GetColumnPos ( nColId ) - 1 ) ;
2010-10-15 12:22:54 -05:00
if ( pEntry . is ( ) )
2001-02-23 14:04:37 +00:00
pEntry - > SetColWidth ( sal_uInt16 ( GetColumnWidth ( nColId ) ) ) ;
2001-02-05 08:26:47 +00:00
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
ActivateCell ( GetCurRow ( ) , GetCurColumnId ( ) ) ;
}
2017-03-30 20:27:55 +02:00
tools : : Rectangle OSelectionBrowseBox : : GetInvalidRect ( sal_uInt16 nColId )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// The rectangle is the full output area of the window
2017-03-30 20:27:55 +02:00
tools : : Rectangle aInvalidRect ( Point ( 0 , 0 ) , GetOutputSizePixel ( ) ) ;
2001-02-05 08:26:47 +00:00
2013-03-02 15:06:22 +01:00
// now update the left side
2017-03-30 20:27:55 +02:00
tools : : Rectangle aFieldRect ( GetCellRect ( 0 , nColId ) ) ; // used instead of GetFieldRectPixel
2018-02-13 15:24:42 +02:00
aInvalidRect . SetLeft ( aFieldRect . Left ( ) ) ;
2001-02-05 08:26:47 +00:00
return aInvalidRect ;
}
2016-04-12 11:16:51 +02:00
void OSelectionBrowseBox : : InsertColumn ( const OTableFieldDescRef & pEntry , sal_uInt16 & _nColumnPosition )
2001-02-05 08:26:47 +00:00
{
2013-03-02 15:06:22 +01:00
// the control should have exactly one more column: the HandleColumn
2018-01-12 20:25:56 +01:00
OSL_ENSURE ( _nColumnPosition = = BROWSER_INVALIDID | | ( _nColumnPosition < = static_cast < long > ( getFields ( ) . size ( ) ) ) , " OSelectionBrowseBox::InsertColumn : invalid parameter nColId. " ) ;
2013-03-02 15:06:22 +01:00
// -1 means at the end. Count means at the end, others denotes a correct position
2001-02-05 08:26:47 +00:00
sal_uInt16 nCurCol = GetCurColumnId ( ) ;
2006-06-20 02:27:27 +00:00
long nCurrentRow = GetCurRow ( ) ;
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
2014-04-11 09:21:31 +02:00
// remember the column id of the current position
2011-09-12 14:58:12 +02:00
sal_uInt16 nColumnId = GetColumnId ( _nColumnPosition ) ;
2019-05-08 10:13:33 +00:00
// put at the end of the list if too small or too big,
2013-03-02 15:06:22 +01:00
if ( ( _nColumnPosition = = BROWSER_INVALIDID ) | | ( _nColumnPosition > = getFields ( ) . size ( ) ) ) // append the field
2001-02-05 08:26:47 +00:00
{
2015-11-10 10:13:39 +01:00
if ( FindFirstFreeCol ( _nColumnPosition ) = = nullptr ) // no more free columns
2001-02-05 08:26:47 +00:00
{
2015-08-12 15:09:51 +02:00
AppendNewCol ( ) ;
2011-09-12 14:58:12 +02:00
_nColumnPosition = sal : : static_int_cast < sal_uInt16 > (
2006-10-12 12:43:07 +00:00
getFields ( ) . size ( ) ) ;
2001-02-05 08:26:47 +00:00
}
else
2013-03-02 15:06:22 +01:00
+ + _nColumnPosition ; // within the list
2011-09-12 14:58:12 +02:00
nColumnId = GetColumnId ( _nColumnPosition ) ;
2002-08-19 07:01:32 +00:00
pEntry - > SetColumnId ( nColumnId ) ;
2011-09-12 14:58:12 +02:00
getFields ( ) [ _nColumnPosition - 1 ] = pEntry ;
2001-02-05 08:26:47 +00:00
}
2002-08-19 07:01:32 +00:00
// check if the column ids are identical, if not we have to move
if ( pEntry - > GetColumnId ( ) ! = nColumnId )
{
2011-01-14 15:00:11 +01:00
sal_uInt16 nOldPosition = GetColumnPos ( pEntry - > GetColumnId ( ) ) ;
2002-08-19 07:01:32 +00:00
OSL_ENSURE ( nOldPosition ! = 0 , " Old position was 0. Not possible! " ) ;
2011-09-12 14:58:12 +02:00
SetColumnPos ( pEntry - > GetColumnId ( ) , _nColumnPosition ) ;
2002-08-19 07:01:32 +00:00
// we have to delete an empty field for the fields list, because the columns must have equal length
if ( nOldPosition > 0 & & nOldPosition < = getFields ( ) . size ( ) )
getFields ( ) [ nOldPosition - 1 ] = pEntry ;
2014-04-17 11:16:55 +02:00
ColumnMoved ( pEntry - > GetColumnId ( ) , false ) ;
2010-11-29 23:29:33 +09:00
}
2008-12-01 12:31:27 +00:00
2017-07-06 14:49:15 +02:00
if ( pEntry - > GetFunctionType ( ) & FKT_AGGREGATE )
2008-12-01 12:31:27 +00:00
{
2013-09-23 07:19:08 +01:00
OUString sFunctionName = pEntry - > GetFunction ( ) ;
2008-12-01 12:31:27 +00:00
if ( GetFunctionName ( sal_uInt32 ( - 1 ) , sFunctionName ) )
pEntry - > SetFunction ( sFunctionName ) ;
2002-08-19 07:01:32 +00:00
}
2001-02-05 08:26:47 +00:00
2008-12-09 07:25:38 +00:00
nColumnId = pEntry - > GetColumnId ( ) ;
SetColWidth ( nColumnId , getDesignView ( ) - > getColWidth ( GetColumnPos ( nColumnId ) - 1 ) ) ;
2013-03-02 15:06:22 +01:00
// redraw
2017-03-30 20:27:55 +02:00
tools : : Rectangle aInvalidRect = GetInvalidRect ( nColumnId ) ;
2001-02-05 08:26:47 +00:00
Invalidate ( aInvalidRect ) ;
2006-06-20 02:27:27 +00:00
ActivateCell ( nCurrentRow , nCurCol ) ;
2016-04-20 17:16:13 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
invalidateUndoRedo ( ) ;
2001-02-05 08:26:47 +00:00
}
2016-03-07 08:09:35 +02:00
OTableFieldDescRef OSelectionBrowseBox : : InsertField ( const OJoinExchangeData & jxdSource )
2001-02-05 08:26:47 +00:00
{
OQueryTableWindow * pSourceWin = static_cast < OQueryTableWindow * > ( jxdSource . pListBox - > GetTabWin ( ) ) ;
if ( ! pSourceWin )
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-02-05 08:26:47 +00:00
2013-03-02 15:06:22 +01:00
// name and position of the selected field
2013-09-27 12:04:57 +02:00
OUString aFieldName = jxdSource . pListBox - > GetEntryText ( jxdSource . pEntry ) ;
2001-02-05 08:26:47 +00:00
sal_uInt32 nFieldIndex = jxdSource . pListBox - > GetModel ( ) - > GetAbsPos ( jxdSource . pEntry ) ;
OTableFieldInfo * pInf = static_cast < OTableFieldInfo * > ( jxdSource . pEntry - > GetUserData ( ) ) ;
2013-03-02 15:06:22 +01:00
// construct DragInfo, such that I use the other InsertField
2001-10-05 05:49:21 +00:00
OTableFieldDescRef aInfo = new OTableFieldDesc ( pSourceWin - > GetTableName ( ) , aFieldName ) ;
aInfo - > SetTabWindow ( pSourceWin ) ;
aInfo - > SetFieldIndex ( nFieldIndex ) ;
aInfo - > SetFieldType ( pInf - > GetKeyType ( ) ) ;
aInfo - > SetAlias ( pSourceWin - > GetAliasName ( ) ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
aInfo - > SetDataType ( pInf - > GetDataType ( ) ) ;
2016-03-04 14:51:52 +02:00
aInfo - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
2016-03-07 08:09:35 +02:00
return InsertField ( aInfo ) ;
2001-02-05 08:26:47 +00:00
}
2014-04-17 11:16:55 +02:00
OTableFieldDescRef OSelectionBrowseBox : : InsertField ( const OTableFieldDescRef & _rInfo , sal_uInt16 _nColumnPosition , bool bVis , bool bActivate )
2001-02-05 08:26:47 +00:00
{
if ( m_nMaxColumns & & m_nMaxColumns < = FieldsCount ( ) )
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-02-05 08:26:47 +00:00
if ( bActivate )
SaveModified ( ) ;
2013-03-02 15:06:22 +01:00
// new column description
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = _rInfo ;
2001-02-05 08:26:47 +00:00
pEntry - > SetVisible ( bVis ) ;
2013-03-02 15:06:22 +01:00
// insert column
2011-09-12 14:58:12 +02:00
InsertColumn ( pEntry , _nColumnPosition ) ;
2001-02-05 08:26:47 +00:00
2005-09-23 11:43:59 +00:00
if ( ! m_bInUndoMode )
{
2013-03-02 15:06:22 +01:00
// trigger UndoAction
2018-10-08 11:22:10 +02:00
std : : unique_ptr < OTabFieldCreateUndoAct > pUndoAction ( new OTabFieldCreateUndoAct ( this ) ) ;
2005-09-23 11:43:59 +00:00
pUndoAction - > SetTabFieldDescr ( pEntry ) ;
2011-09-12 14:58:12 +02:00
pUndoAction - > SetColumnPosition ( _nColumnPosition ) ;
2018-10-08 11:22:10 +02:00
getDesignView ( ) - > getController ( ) . addUndoActionAndInvalidate ( std : : move ( pUndoAction ) ) ;
2005-09-23 11:43:59 +00:00
}
2001-02-05 08:26:47 +00:00
return pEntry ;
}
sal_uInt16 OSelectionBrowseBox : : FieldsCount ( )
{
sal_uInt16 nCount = 0 ;
2018-03-10 14:49:40 +01:00
for ( auto const & field : getFields ( ) )
2001-02-05 08:26:47 +00:00
{
2018-03-10 14:49:40 +01:00
if ( field . is ( ) & & ! field - > IsEmpty ( ) )
2001-10-22 08:57:52 +00:00
+ + nCount ;
2001-02-05 08:26:47 +00:00
}
return nCount ;
}
2011-01-14 15:00:11 +01:00
OTableFieldDescRef OSelectionBrowseBox : : FindFirstFreeCol ( sal_uInt16 & _rColumnPosition )
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
_rColumnPosition = BROWSER_INVALIDID ;
2018-03-10 14:49:40 +01:00
for ( auto const & field : getFields ( ) )
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
+ + _rColumnPosition ;
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
OTableFieldDescRef pEntry = field ;
if ( pEntry . is ( ) & & pEntry - > IsEmpty ( ) )
return pEntry ;
2001-02-05 08:26:47 +00:00
}
2015-11-10 10:13:39 +01:00
return nullptr ;
2001-02-05 08:26:47 +00:00
}
2011-01-14 15:00:11 +01:00
void OSelectionBrowseBox : : CheckFreeColumns ( sal_uInt16 & _rColumnPosition )
2001-02-05 08:26:47 +00:00
{
2015-11-10 10:13:39 +01:00
if ( FindFirstFreeCol ( _rColumnPosition ) = = nullptr )
2001-02-05 08:26:47 +00:00
{
2018-07-08 14:58:53 +02:00
// it is full, so append a pack of columns
2001-02-05 08:26:47 +00:00
AppendNewCol ( DEFAULT_QUERY_COLS ) ;
2010-10-15 12:22:54 -05:00
OSL_VERIFY ( FindFirstFreeCol ( _rColumnPosition ) . is ( ) ) ;
2001-02-05 08:26:47 +00:00
}
}
2013-08-17 23:43:14 +02:00
2017-02-27 18:09:13 +01:00
void OSelectionBrowseBox : : AddGroupBy ( const OTableFieldDescRef & rInfo )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2001-03-01 14:45:02 +00:00
if ( ! xConnection . is ( ) )
return ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( ! rInfo - > IsEmpty ( ) , " AddGroupBy:: OTableFieldDescRef should not be empty! " ) ;
2001-10-05 05:49:21 +00:00
OTableFieldDescRef pEntry ;
2008-06-25 11:54:03 +00:00
const Reference < XDatabaseMetaData > xMeta = xConnection - > getMetaData ( ) ;
const : : comphelper : : UStringMixEqual bCase ( xMeta . is ( ) & & xMeta - > supportsMixedCaseQuotedIdentifiers ( ) ) ;
//sal_Bool bAppend = sal_False;
2005-03-10 15:53:16 +00:00
2018-03-10 14:49:40 +01:00
bool bAllFieldsSearched = true ;
for ( auto const & field : getFields ( ) )
2001-02-05 08:26:47 +00:00
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry = field ;
2010-10-15 12:22:54 -05:00
OSL_ENSURE ( pEntry . is ( ) , " OTableFieldDescRef was null! " ) ;
2001-02-05 08:26:47 +00:00
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
const OUString aField = pEntry - > GetField ( ) ;
const OUString aAlias = pEntry - > GetAlias ( ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
if ( bCase ( aField , rInfo - > GetField ( ) ) & &
bCase ( aAlias , rInfo - > GetAlias ( ) ) & &
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > GetFunctionType ( ) = = rInfo - > GetFunctionType ( ) & &
pEntry - > GetFunction ( ) = = rInfo - > GetFunction ( ) )
2001-02-05 08:26:47 +00:00
{
2019-02-10 10:23:21 +01:00
if ( pEntry - > isNumericOrAggregateFunction ( ) & & rInfo - > IsGroupBy ( ) )
2009-11-23 10:33:17 +01:00
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > SetGroupBy ( false ) ;
2018-03-10 14:49:40 +01:00
// we do want to consider that bAllFieldsSearched still true here
// bAllFieldsSearched = false;
2009-11-23 10:33:17 +01:00
break ;
}
else
2001-02-05 08:26:47 +00:00
{
2009-11-23 10:33:17 +01:00
if ( ! pEntry - > IsGroupBy ( ) & & ! pEntry - > HasCriteria ( ) ) // here we have a where condition which is no having clause
2005-03-10 15:53:16 +00:00
{
pEntry - > SetGroupBy ( rInfo - > IsGroupBy ( ) ) ;
if ( ! m_bGroupByUnRelated & & pEntry - > IsGroupBy ( ) )
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2018-03-10 14:49:40 +01:00
bAllFieldsSearched = false ;
2009-11-23 10:33:17 +01:00
break ;
2005-03-10 15:53:16 +00:00
}
2001-02-05 08:26:47 +00:00
}
2009-11-23 10:33:17 +01:00
2001-02-05 08:26:47 +00:00
}
}
2018-03-10 14:49:40 +01:00
if ( bAllFieldsSearched )
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
OTableFieldDescRef pTmp = InsertField ( rInfo , BROWSER_INVALIDID , false , false ) ;
2019-02-10 10:23:21 +01:00
if ( pTmp - > isNumericOrAggregateFunction ( ) & & rInfo - > IsGroupBy ( ) ) // the GroupBy is inherited from rInfo
2015-09-01 14:21:06 +02:00
pTmp - > SetGroupBy ( false ) ;
2001-02-05 08:26:47 +00:00
}
}
2013-08-17 23:43:14 +02:00
2009-11-11 14:07:55 +01:00
void OSelectionBrowseBox : : DuplicateConditionLevel ( const sal_uInt16 nLevel )
{
const sal_uInt16 nNewLevel = nLevel + 1 ;
2018-03-10 14:49:40 +01:00
for ( auto const & field : getFields ( ) )
2009-11-11 14:07:55 +01:00
{
2018-10-23 07:47:33 +02:00
const OTableFieldDescRef & pEntry = field ;
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
OUString sValue = pEntry - > GetCriteria ( nLevel ) ;
2011-12-19 18:10:37 -02:00
if ( ! sValue . isEmpty ( ) )
2009-11-11 14:07:55 +01:00
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > SetCriteria ( nNewLevel , sValue ) ;
2009-11-11 14:07:55 +01:00
if ( nNewLevel = = ( m_nVisibleCount - BROW_CRIT1_ROW - 1 ) )
{
2015-10-19 17:49:41 +02:00
RowInserted ( GetRowCount ( ) - 1 ) ;
2014-01-28 20:02:35 +01:00
m_bVisibleRow . push_back ( true ) ;
2009-11-11 14:07:55 +01:00
+ + m_nVisibleCount ;
}
2014-01-28 20:02:35 +01:00
m_bVisibleRow [ BROW_CRIT1_ROW + nNewLevel ] = true ;
2010-11-25 01:16:20 +00:00
}
}
2009-11-11 14:07:55 +01:00
}
2013-08-17 23:43:14 +02:00
2013-09-27 12:04:57 +02:00
void OSelectionBrowseBox : : AddCondition ( const OTableFieldDescRef & rInfo , const OUString & rValue , const sal_uInt16 nLevel , bool _bAddOrOnOneLine )
2001-02-05 08:26:47 +00:00
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2001-03-01 14:45:02 +00:00
if ( ! xConnection . is ( ) )
return ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( rInfo . is ( ) & & ! rInfo - > IsEmpty ( ) , " AddCondition:: OTableFieldDescRef should not be Empty! " ) ;
2001-10-05 05:49:21 +00:00
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
OTableFieldDescRef pLastEntry ;
2003-12-01 09:38:48 +00:00
Reference < XDatabaseMetaData > xMeta = xConnection - > getMetaData ( ) ;
2006-08-15 09:56:20 +00:00
: : comphelper : : UStringMixEqual bCase ( xMeta . is ( ) & & xMeta - > supportsMixedCaseQuotedIdentifiers ( ) ) ;
2001-02-05 08:26:47 +00:00
2018-03-10 14:49:40 +01:00
bool bAllFieldsSearched = true ;
for ( auto const & field : getFields ( ) )
2001-02-05 08:26:47 +00:00
{
2018-10-23 07:47:33 +02:00
const OTableFieldDescRef & pEntry = field ;
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
const OUString aField = pEntry - > GetField ( ) ;
const OUString aAlias = pEntry - > GetAlias ( ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
if ( bCase ( aField , rInfo - > GetField ( ) ) & &
bCase ( aAlias , rInfo - > GetAlias ( ) ) & &
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > GetFunctionType ( ) = = rInfo - > GetFunctionType ( ) & &
pEntry - > GetFunction ( ) = = rInfo - > GetFunction ( ) & &
pEntry - > IsGroupBy ( ) = = rInfo - > IsGroupBy ( ) )
2001-02-05 08:26:47 +00:00
{
2019-02-10 10:23:21 +01:00
if ( pEntry - > isNumericOrAggregateFunction ( ) & & rInfo - > IsGroupBy ( ) )
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > SetGroupBy ( false ) ;
2001-02-05 08:26:47 +00:00
else
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
if ( ! m_bGroupByUnRelated & & pEntry - > IsGroupBy ( ) )
pEntry - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
}
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
if ( pEntry - > GetCriteria ( nLevel ) . isEmpty ( ) )
2001-02-05 08:26:47 +00:00
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > SetCriteria ( nLevel , rValue ) ;
2001-02-05 08:26:47 +00:00
if ( nLevel = = ( m_nVisibleCount - BROW_CRIT1_ROW - 1 ) )
{
2015-10-19 17:49:41 +02:00
RowInserted ( GetRowCount ( ) - 1 ) ;
2014-01-28 20:02:35 +01:00
m_bVisibleRow . push_back ( true ) ;
2001-02-05 08:26:47 +00:00
+ + m_nVisibleCount ;
}
2014-01-28 20:02:35 +01:00
m_bVisibleRow [ BROW_CRIT1_ROW + nLevel ] = true ;
2018-03-10 14:49:40 +01:00
bAllFieldsSearched = false ;
2001-02-05 08:26:47 +00:00
break ;
2010-11-25 01:16:20 +00:00
}
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
if ( _bAddOrOnOneLine )
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pLastEntry = pEntry ;
2001-02-05 08:26:47 +00:00
}
}
2010-11-25 01:16:20 +00:00
}
2010-10-15 12:22:54 -05:00
if ( pLastEntry . is ( ) )
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
{
2013-09-27 12:04:57 +02:00
OUString sCriteria = rValue ;
OUString sOldCriteria = pLastEntry - > GetCriteria ( nLevel ) ;
if ( ! sOldCriteria . isEmpty ( ) )
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
{
2016-08-01 14:51:58 +05:30
sCriteria = " ( " + sOldCriteria + " OR " + rValue + " ) " ;
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
}
pLastEntry - > SetCriteria ( nLevel , sCriteria ) ;
if ( nLevel = = ( m_nVisibleCount - BROW_CRIT1_ROW - 1 ) )
{
2015-10-19 17:49:41 +02:00
RowInserted ( GetRowCount ( ) - 1 ) ;
2014-01-28 20:02:35 +01:00
m_bVisibleRow . push_back ( true ) ;
CWS-TOOLING: integrate CWS dba32c
2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion
2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time
2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths
2009-06-29 10:08:54 +0200 fs r273455 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties
2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning
2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed
2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc
2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux
2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux
2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar
2009-06-15 14:11:27 +0200 fs r272983 : added since tag
2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted
2009-06-15 11:08:53 +0200 fs r272969 : #i10000#
2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701#
2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src
2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50)
2009-06-02 09:53:10 +0200 fs r272483 : #i10000#
2009-05-29 15:55:03 +0200 fs r272465 : #i100818#
2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any
2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition
2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex
2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed
2009-05-27 14:53:36 +0200 fs r272347 : #i10000#
2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast
2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly
2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used
2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function
2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well
2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution
2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set
2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition
2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria
2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR
2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein
2009-05-25 15:49:57 +0200 fs r272254 : #i999704#
2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property
2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString
2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein
2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property
2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property)
2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default
2009-05-25 14:39:31 +0200 fs r272243 : removed dead import
2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns
2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent
2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel
2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event
2009-05-22 21:42:47 +0200 fs r272211 : #i102003#
2009-05-22 21:42:20 +0200 fs r272210 : grammar
2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously
2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear
2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG
2009-05-22 12:03:42 +0200 fs r272180 : #i88878#
provided by noel.power@novell.com
implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs
2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them
2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values
2009-05-15 15:08:31 +0200 fs r271937 : includes
2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint
2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity
2009-05-15 10:15:44 +0200 fs r271928 : #i10000#
2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique
2009-05-14 20:23:23 +0200 fs r271919 : #i101622#
2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids
2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b)
2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48
2009-05-07 14:43:19 +0200 fs r271670 : #i101477#
2009-05-07 14:37:30 +0200 fs r271668 : #i101477#
2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch
2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics
2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47)
2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control
2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
+ + m_nVisibleCount ;
}
2014-01-28 20:02:35 +01:00
m_bVisibleRow [ BROW_CRIT1_ROW + nLevel ] = true ;
2001-02-05 08:26:47 +00:00
}
2018-03-10 14:49:40 +01:00
else if ( bAllFieldsSearched )
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
OTableFieldDescRef pTmp = InsertField ( rInfo , BROWSER_INVALIDID , false , false ) ;
2019-02-10 10:23:21 +01:00
if ( pTmp - > isNumericOrAggregateFunction ( ) & & rInfo - > IsGroupBy ( ) ) // the GroupBy was inherited from rInfo
2015-09-01 14:21:06 +02:00
pTmp - > SetGroupBy ( false ) ;
2010-10-15 12:22:54 -05:00
if ( pTmp . is ( ) )
2001-02-05 08:26:47 +00:00
{
pTmp - > SetCriteria ( nLevel , rValue ) ;
if ( nLevel = = ( m_nVisibleCount - BROW_CRIT1_ROW - 1 ) )
{
2015-10-19 17:49:41 +02:00
RowInserted ( GetRowCount ( ) - 1 ) ;
2014-01-28 20:02:35 +01:00
m_bVisibleRow . push_back ( true ) ;
2001-02-05 08:26:47 +00:00
+ + m_nVisibleCount ;
}
}
}
}
2005-03-10 15:53:16 +00:00
void OSelectionBrowseBox : : AddOrder ( const OTableFieldDescRef & rInfo , const EOrderDir eDir , sal_uInt32 _nCurrentPos )
2001-02-05 08:26:47 +00:00
{
2012-03-20 11:01:12 +01:00
if ( _nCurrentPos = = 0 )
m_nLastSortColumn = SORT_COLUMN_NONE ;
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2001-03-01 14:45:02 +00:00
if ( ! xConnection . is ( ) )
return ;
2012-03-20 11:01:12 +01:00
OSL_ENSURE ( ! rInfo - > IsEmpty ( ) , " AddOrder:: OTableFieldDescRef should not be Empty! " ) ;
2001-10-05 05:49:21 +00:00
OTableFieldDescRef pEntry ;
2003-12-01 09:38:48 +00:00
Reference < XDatabaseMetaData > xMeta = xConnection - > getMetaData ( ) ;
2006-08-15 09:56:20 +00:00
: : comphelper : : UStringMixEqual bCase ( xMeta . is ( ) & & xMeta - > supportsMixedCaseQuotedIdentifiers ( ) ) ;
2001-02-05 08:26:47 +00:00
2014-04-17 11:16:55 +02:00
bool bAppend = false ;
2018-03-10 14:49:40 +01:00
sal_uInt32 nPos = 0 ;
bool bAllFieldsSearched = true ;
for ( auto const & field : getFields ( ) )
2001-02-05 08:26:47 +00:00
{
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry = field ;
OUString aField = pEntry - > GetField ( ) ;
OUString aAlias = pEntry - > GetAlias ( ) ;
2001-02-05 08:26:47 +00:00
2001-10-05 05:49:21 +00:00
if ( bCase ( aField , rInfo - > GetField ( ) ) & &
bCase ( aAlias , rInfo - > GetAlias ( ) ) )
2001-02-05 08:26:47 +00:00
{
2012-03-20 11:01:12 +01:00
bAppend = ( m_nLastSortColumn ! = SORT_COLUMN_NONE ) & & ( nPos < = m_nLastSortColumn ) ;
2005-03-10 15:53:16 +00:00
if ( bAppend )
2018-03-10 14:49:40 +01:00
{
// we do want to consider that bAllFieldsSearched still true here
// bAllFieldsSearched = false;
break ;
}
2005-03-10 15:53:16 +00:00
else
{
if ( ! m_bOrderByUnRelated )
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10
bt:
0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85
1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68
2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105
3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54
4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131
5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this=
0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284
6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419
7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357
the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx
but also fixed some other pbs like:
warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null!
Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c
Reviewed-on: https://gerrit.libreoffice.org/52527
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-04-07 00:10:33 +02:00
pEntry - > SetVisible ( ) ;
pEntry - > SetOrderDir ( eDir ) ;
2012-03-20 11:01:12 +01:00
m_nLastSortColumn = nPos ;
2005-03-10 15:53:16 +00:00
}
2018-03-10 14:49:40 +01:00
bAllFieldsSearched = false ;
2001-02-05 08:26:47 +00:00
break ;
}
2018-03-10 14:49:40 +01:00
+ + nPos ;
2001-02-05 08:26:47 +00:00
}
2018-03-10 14:49:40 +01:00
if ( bAllFieldsSearched )
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
OTableFieldDescRef pTmp = InsertField ( rInfo , BROWSER_INVALIDID , false , false ) ;
2010-10-15 12:22:54 -05:00
if ( pTmp . is ( ) )
2001-02-05 08:26:47 +00:00
{
2012-03-20 11:01:12 +01:00
m_nLastSortColumn = pTmp - > GetColumnId ( ) - 1 ;
2005-03-10 15:53:16 +00:00
if ( ! m_bOrderByUnRelated & & ! bAppend )
2015-08-12 15:09:51 +02:00
pTmp - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
pTmp - > SetOrderDir ( eDir ) ;
}
}
}
2014-04-17 11:16:55 +02:00
bool OSelectionBrowseBox : : Save ( )
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
bool bRet = true ;
2001-02-05 08:26:47 +00:00
if ( IsModified ( ) )
2001-09-27 05:19:05 +00:00
bRet = SaveModified ( ) ;
return bRet ;
2001-02-05 08:26:47 +00:00
}
void OSelectionBrowseBox : : CellModified ( )
{
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_VIS_ROW :
{
2002-08-30 10:14:45 +00:00
OTableFieldDescRef pEntry = getEntry ( GetColumnPos ( GetCurColumnId ( ) ) - 1 ) ;
2001-10-05 05:49:21 +00:00
2017-09-14 16:57:06 +02:00
sal_Int32 nIdx = m_pOrderCell - > GetSelectedEntryPos ( ) ;
2001-03-20 09:56:40 +00:00
if ( ! m_bOrderByUnRelated & & nIdx > 0 & &
2014-03-01 03:13:28 +01:00
nIdx ! = LISTBOX_ENTRY_NOTFOUND & &
2001-03-20 09:56:40 +00:00
! pEntry - > IsEmpty ( ) & &
pEntry - > GetOrderDir ( ) ! = ORDER_NONE )
2001-02-05 08:26:47 +00:00
{
m_pVisibleCell - > GetBox ( ) . Check ( ) ;
2015-08-12 15:09:51 +02:00
pEntry - > SetVisible ( ) ;
2001-02-05 08:26:47 +00:00
}
else
pEntry - > SetVisible ( m_pVisibleCell - > GetBox ( ) . IsChecked ( ) ) ;
}
break ;
}
2016-04-20 17:16:13 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
2001-02-05 08:26:47 +00:00
}
void OSelectionBrowseBox : : Fill ( )
{
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( ColCount ( ) > = 1 , " OSelectionBrowseBox::Fill : please call only after inserting the handle column ! " ) ;
2001-02-05 08:26:47 +00:00
sal_uInt16 nColCount = ColCount ( ) - 1 ;
if ( nColCount < DEFAULT_QUERY_COLS )
AppendNewCol ( DEFAULT_QUERY_COLS - nColCount ) ;
}
2002-05-24 11:58:56 +00:00
Size OSelectionBrowseBox : : CalcOptimalSize ( const Size & _rAvailable )
{
Size aReturn ( _rAvailable . Width ( ) , GetTitleHeight ( ) ) ;
2018-02-16 12:48:27 +02:00
aReturn . AdjustHeight ( ( m_nVisibleCount ? m_nVisibleCount : 15 ) * GetDataRowHeight ( ) ) ;
aReturn . AdjustHeight ( 40 ) ; // just some space
2002-05-24 11:58:56 +00:00
return aReturn ;
}
2001-02-05 08:26:47 +00:00
void OSelectionBrowseBox : : Command ( const CommandEvent & rEvt )
{
switch ( rEvt . GetCommand ( ) )
{
2015-05-07 15:25:20 +02:00
case CommandEventId : : ContextMenu :
2001-02-05 08:26:47 +00:00
{
2002-05-24 11:58:56 +00:00
Point aMenuPos ( rEvt . GetMousePosPixel ( ) ) ;
2001-02-05 08:26:47 +00:00
if ( ! rEvt . IsMouseEvent ( ) )
{
2002-05-24 11:58:56 +00:00
if ( 1 = = GetSelectColumnCount ( ) )
{
2006-10-12 12:43:07 +00:00
sal_uInt16 nSelId = GetColumnId (
2011-01-14 15:00:11 +01:00
sal : : static_int_cast < sal_uInt16 > (
2006-10-12 12:43:07 +00:00
FirstSelectedColumn ( ) ) ) ;
2017-03-30 20:27:55 +02:00
: : tools : : Rectangle aColRect ( GetFieldRectPixel ( 0 , nSelId , false ) ) ;
2002-05-24 11:58:56 +00:00
aMenuPos = aColRect . TopCenter ( ) ;
}
else
{
EditBrowseBox : : Command ( rEvt ) ;
return ;
}
2001-02-05 08:26:47 +00:00
}
2002-08-19 07:01:32 +00:00
sal_uInt16 nColId = GetColumnId ( GetColumnAtXPosPixel ( aMenuPos . X ( ) ) ) ;
2002-05-24 11:58:56 +00:00
long nRow = GetRowAtYPosPixel ( aMenuPos . Y ( ) ) ;
2001-02-05 08:26:47 +00:00
2002-05-24 11:58:56 +00:00
if ( nRow < 0 & & nColId > HANDLE_ID )
2001-02-05 08:26:47 +00:00
{
2002-05-24 11:58:56 +00:00
if ( ! IsColumnSelected ( nColId ) )
{
2014-04-17 11:16:55 +02:00
adjustSelectionMode ( true /* clicked onto a header */ , false /* not onto the handle col */ ) ;
2002-05-24 11:58:56 +00:00
SelectColumnId ( nColId ) ;
}
2008-06-25 11:54:03 +00:00
if ( ! static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isReadOnly ( ) )
2001-02-05 08:26:47 +00:00
{
2017-04-07 11:02:54 +01:00
VclBuilder aBuilder ( nullptr , VclBuilderContainer : : getUIRootDir ( ) , " dbaccess/ui/querycolmenu.ui " , " " ) ;
VclPtr < PopupMenu > aContextMenu ( aBuilder . get_menu ( " menu " ) ) ;
sal_uInt16 nItemId = aContextMenu - > Execute ( this , aMenuPos ) ;
if ( nItemId = = aContextMenu - > GetItemId ( " delete " ) )
RemoveField ( nColId ) ;
else if ( nItemId = = aContextMenu - > GetItemId ( " width " ) )
adjustBrowseBoxColumnWidth ( this , nColId ) ;
2001-02-05 08:26:47 +00:00
}
}
else if ( nRow > = 0 & & nColId < = HANDLE_ID )
{
2008-06-25 11:54:03 +00:00
if ( ! static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isReadOnly ( ) )
2001-02-05 08:26:47 +00:00
{
2017-04-18 11:40:32 +01:00
VclBuilder aBuilder ( nullptr , VclBuilderContainer : : getUIRootDir ( ) , " dbaccess/ui/queryfuncmenu.ui " , " " ) ;
VclPtr < PopupMenu > aContextMenu ( aBuilder . get_menu ( " menu " ) ) ;
2018-04-12 21:53:29 +03:00
aContextMenu - > CheckItem ( " functions " , m_bVisibleRow [ BROW_FUNCTION_ROW ] ) ;
aContextMenu - > CheckItem ( " tablename " , m_bVisibleRow [ BROW_TABLE_ROW ] ) ;
aContextMenu - > CheckItem ( " alias " , m_bVisibleRow [ BROW_COLUMNALIAS_ROW ] ) ;
aContextMenu - > CheckItem ( " distinct " , static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isDistinct ( ) ) ;
2017-04-18 11:40:32 +01:00
aContextMenu - > Execute ( this , aMenuPos ) ;
2001-02-05 08:26:47 +00:00
2017-04-18 11:40:32 +01:00
OString sIdent = aContextMenu - > GetCurItemIdent ( ) ;
if ( sIdent = = " functions " )
{
SetRowVisible ( BROW_FUNCTION_ROW , ! IsRowVisible ( BROW_FUNCTION_ROW ) ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_QUERY_VIEW_FUNCTIONS ) ;
}
else if ( sIdent = = " tablename " )
{
SetRowVisible ( BROW_TABLE_ROW , ! IsRowVisible ( BROW_TABLE_ROW ) ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_QUERY_VIEW_TABLES ) ;
}
else if ( sIdent = = " alias " )
{
SetRowVisible ( BROW_COLUMNALIAS_ROW , ! IsRowVisible ( BROW_COLUMNALIAS_ROW ) ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_QUERY_VIEW_ALIASES ) ;
}
else if ( sIdent = = " distinct " )
2001-02-05 08:26:47 +00:00
{
2017-04-18 11:40:32 +01:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setDistinct ( ! static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isDistinct ( ) ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_QUERY_DISTINCT_VALUES ) ;
2001-02-05 08:26:47 +00:00
}
2016-04-20 17:16:13 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
2001-02-05 08:26:47 +00:00
}
}
else
{
2001-06-29 07:45:10 +00:00
EditBrowseBox : : Command ( rEvt ) ;
2001-02-05 08:26:47 +00:00
return ;
}
2016-05-10 16:42:16 +02:00
2018-12-08 09:46:01 +01:00
[[fallthrough]] ;
2001-02-05 08:26:47 +00:00
}
default :
2001-06-29 07:45:10 +00:00
EditBrowseBox : : Command ( rEvt ) ;
2001-02-05 08:26:47 +00:00
}
}
2014-04-17 11:16:55 +02:00
bool OSelectionBrowseBox : : IsRowVisible ( sal_uInt16 _nWhich ) const
2001-02-05 08:26:47 +00:00
{
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( _nWhich < ( m_bVisibleRow . size ( ) ) , " OSelectionBrowseBox::IsRowVisible : invalid parameter ! " ) ;
2001-02-05 08:26:47 +00:00
return m_bVisibleRow [ _nWhich ] ;
}
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : SetRowVisible ( sal_uInt16 _nWhich , bool _bVis )
2001-02-05 08:26:47 +00:00
{
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( _nWhich < m_bVisibleRow . size ( ) , " OSelectionBrowseBox::SetRowVisible : invalid parameter ! " ) ;
2001-02-05 08:26:47 +00:00
2014-04-17 11:16:55 +02:00
bool bWasEditing = IsEditing ( ) ;
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
// do this before removing or inserting rows, as this triggers ActivateCell-calls, which rely on m_bVisibleRow
m_bVisibleRow [ _nWhich ] = ! m_bVisibleRow [ _nWhich ] ;
long nId = GetBrowseRow ( _nWhich ) ;
if ( _bVis )
{
2015-10-19 17:49:41 +02:00
RowInserted ( nId ) ;
2001-10-23 11:30:27 +00:00
+ + m_nVisibleCount ;
2001-02-05 08:26:47 +00:00
}
else
{
2015-10-19 17:49:41 +02:00
RowRemoved ( nId ) ;
2001-10-23 11:30:27 +00:00
- - m_nVisibleCount ;
2001-02-05 08:26:47 +00:00
}
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
ActivateCell ( ) ;
}
long OSelectionBrowseBox : : GetBrowseRow ( long nRowId ) const
{
2011-01-14 15:00:11 +01:00
sal_uInt16 nCount ( 0 ) ;
2015-05-28 16:48:15 +02:00
for ( long i = 0 ; i < nRowId ; + + i )
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
if ( m_bVisibleRow [ i ] )
+ + nCount ;
2001-02-05 08:26:47 +00:00
}
return nCount ;
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
long OSelectionBrowseBox : : GetRealRow ( long nRowId ) const
{
long nErg = 0 , i ;
2007-11-01 14:32:32 +00:00
const long nCount = m_bVisibleRow . size ( ) ;
2002-08-19 07:01:32 +00:00
for ( i = 0 ; i < nCount ; + + i )
2001-02-05 08:26:47 +00:00
{
2018-11-06 10:19:19 +02:00
if ( m_bVisibleRow [ i ] & & nErg + + = = nRowId )
break ;
2001-02-05 08:26:47 +00:00
}
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( nErg < = long ( m_bVisibleRow . size ( ) ) , " nErg cannot be greater than BROW_ROW_CNT! " ) ;
2001-02-05 08:26:47 +00:00
return i ;
}
2013-08-17 23:43:14 +02:00
2013-08-04 00:25:32 +09:00
static const long nVisibleRowMask [ ] =
2001-02-05 08:26:47 +00:00
{
0x0001 ,
0x0002 ,
0x0004 ,
0x0008 ,
0x0010 ,
0x0020 ,
0x0040 ,
0x0080 ,
0x0100 ,
0x0200 ,
0x0400 ,
0x0800
} ;
sal_Int32 OSelectionBrowseBox : : GetNoneVisibleRows ( ) const
{
sal_Int32 nErg ( 0 ) ;
2019-08-27 23:09:41 +02:00
// only the first 11 rows are interesting
2017-06-22 16:05:11 +02:00
sal_Int32 const nSize = SAL_N_ELEMENTS ( nVisibleRowMask ) ;
2001-02-05 08:26:47 +00:00
for ( sal_Int32 i = 0 ; i < nSize ; i + + )
{
if ( ! m_bVisibleRow [ i ] )
nErg | = nVisibleRowMask [ i ] ;
}
return nErg ;
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
void OSelectionBrowseBox : : SetNoneVisbleRow ( long nRows )
{
2019-08-27 23:09:41 +02:00
// only the first 11 rows are interesting
2017-06-22 16:05:11 +02:00
sal_Int32 const nSize = SAL_N_ELEMENTS ( nVisibleRowMask ) ;
2001-02-05 08:26:47 +00:00
for ( sal_Int32 i = 0 ; i < nSize ; i + + )
m_bVisibleRow [ i ] = ! ( nRows & nVisibleRowMask [ i ] ) ;
}
2013-08-17 23:43:14 +02:00
2013-07-11 13:52:33 +01:00
OUString OSelectionBrowseBox : : GetCellText ( long nRow , sal_uInt16 nColId ) const
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = getFields ( ) [ nPos - 1 ] ;
2015-11-10 10:13:39 +01:00
OSL_ENSURE ( pEntry ! = nullptr , " OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... " ) ;
2002-08-30 10:14:45 +00:00
if ( pEntry - > IsEmpty ( ) )
2013-07-11 13:52:33 +01:00
return OUString ( ) ;
2001-02-05 08:26:47 +00:00
2013-09-27 12:04:57 +02:00
OUString aText ;
2001-02-05 08:26:47 +00:00
switch ( nRow )
{
case BROW_TABLE_ROW :
aText = pEntry - > GetAlias ( ) ;
break ;
case BROW_FIELD_ROW :
{
2013-09-27 12:04:57 +02:00
OUString aField = pEntry - > GetField ( ) ;
2017-05-14 15:55:54 +02:00
if ( ! aField . isEmpty ( ) & & aField [ 0 ] = = ' * ' ) // * replace with alias.*
2001-02-05 08:26:47 +00:00
{
aField = pEntry - > GetAlias ( ) ;
2013-09-27 12:04:57 +02:00
if ( ! aField . isEmpty ( ) )
aField + = " . " ;
aField + = " * " ;
2001-02-05 08:26:47 +00:00
}
aText = aField ;
} break ;
case BROW_ORDER_ROW :
if ( pEntry - > GetOrderDir ( ) ! = ORDER_NONE )
2017-06-11 20:56:30 +01:00
aText = DBA_RES ( STR_QUERY_SORTTEXT ) . getToken ( sal : : static_int_cast < sal_uInt16 > ( pEntry - > GetOrderDir ( ) ) , ' ; ' ) ;
2001-02-05 08:26:47 +00:00
break ;
case BROW_VIS_ROW :
break ;
case BROW_COLUMNALIAS_ROW :
aText = pEntry - > GetFieldAlias ( ) ;
break ;
case BROW_FUNCTION_ROW :
2002-08-30 10:14:45 +00:00
// we always show the group function at first
if ( pEntry - > IsGroupBy ( ) )
2018-09-09 10:48:28 +02:00
aText = m_aFunctionStrings . copy ( m_aFunctionStrings . lastIndexOf ( ' ; ' ) + 1 ) ;
2019-02-10 10:23:21 +01:00
else if ( pEntry - > isNumericOrAggregateFunction ( ) )
2002-08-30 10:14:45 +00:00
aText = pEntry - > GetFunction ( ) ;
2001-02-05 08:26:47 +00:00
break ;
default :
2003-12-01 09:38:48 +00:00
aText = pEntry - > GetCriteria ( sal_uInt16 ( nRow - BROW_CRIT1_ROW ) ) ;
2001-02-05 08:26:47 +00:00
}
return aText ;
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
bool OSelectionBrowseBox : : GetFunctionName ( sal_uInt32 _nFunctionTokenId , OUString & rFkt )
2001-02-05 08:26:47 +00:00
{
2002-08-30 10:14:45 +00:00
switch ( _nFunctionTokenId )
2001-02-05 08:26:47 +00:00
{
2002-08-30 10:14:45 +00:00
case SQL_TOKEN_COUNT :
rFkt = ( m_pFunctionCell - > GetEntryCount ( ) < 3 ) ? m_pFunctionCell - > GetEntry ( 1 ) : m_pFunctionCell - > GetEntry ( 2 ) ;
break ;
case SQL_TOKEN_AVG :
rFkt = m_pFunctionCell - > GetEntry ( 1 ) ;
break ;
case SQL_TOKEN_MAX :
rFkt = m_pFunctionCell - > GetEntry ( 3 ) ;
break ;
case SQL_TOKEN_MIN :
rFkt = m_pFunctionCell - > GetEntry ( 4 ) ;
break ;
case SQL_TOKEN_SUM :
rFkt = m_pFunctionCell - > GetEntry ( 5 ) ;
break ;
2008-12-01 12:31:27 +00:00
case SQL_TOKEN_EVERY :
rFkt = m_pFunctionCell - > GetEntry ( 6 ) ;
break ;
case SQL_TOKEN_ANY :
rFkt = m_pFunctionCell - > GetEntry ( 7 ) ;
break ;
case SQL_TOKEN_SOME :
rFkt = m_pFunctionCell - > GetEntry ( 8 ) ;
break ;
case SQL_TOKEN_STDDEV_POP :
rFkt = m_pFunctionCell - > GetEntry ( 9 ) ;
break ;
case SQL_TOKEN_STDDEV_SAMP :
rFkt = m_pFunctionCell - > GetEntry ( 10 ) ;
break ;
case SQL_TOKEN_VAR_SAMP :
rFkt = m_pFunctionCell - > GetEntry ( 11 ) ;
break ;
case SQL_TOKEN_VAR_POP :
rFkt = m_pFunctionCell - > GetEntry ( 12 ) ;
break ;
case SQL_TOKEN_COLLECT :
rFkt = m_pFunctionCell - > GetEntry ( 13 ) ;
break ;
case SQL_TOKEN_FUSION :
rFkt = m_pFunctionCell - > GetEntry ( 14 ) ;
break ;
case SQL_TOKEN_INTERSECTION :
rFkt = m_pFunctionCell - > GetEntry ( 15 ) ;
break ;
2002-08-30 10:14:45 +00:00
default :
2001-02-05 08:26:47 +00:00
{
2018-09-09 11:29:29 +02:00
const sal_Int32 nStopIdx = m_aFunctionStrings . lastIndexOf ( ' ; ' ) ; // grouping is not counted
for ( sal_Int32 nIdx { 0 } ; nIdx < nStopIdx ; )
2002-08-30 10:14:45 +00:00
{
2018-09-09 11:29:29 +02:00
const OUString sFunc { m_aFunctionStrings . getToken ( 0 , ' ; ' , nIdx ) } ;
if ( rFkt . equalsIgnoreAsciiCase ( sFunc ) )
2002-08-30 10:14:45 +00:00
{
2018-09-09 11:29:29 +02:00
rFkt = sFunc ;
return true ;
2002-08-30 10:14:45 +00:00
}
}
2018-09-09 12:26:59 +02:00
return false ;
2001-02-05 08:26:47 +00:00
}
}
2002-08-30 10:14:45 +00:00
2018-09-09 12:26:59 +02:00
return true ;
2001-02-05 08:26:47 +00:00
}
2013-08-17 23:43:14 +02:00
2013-09-27 12:04:57 +02:00
OUString OSelectionBrowseBox : : GetCellContents ( sal_Int32 nCellIndex , sal_uInt16 nColId )
2001-02-05 08:26:47 +00:00
{
2005-09-23 11:43:59 +00:00
if ( GetCurColumnId ( ) = = nColId & & ! m_bInUndoMode )
2003-03-19 16:57:12 +00:00
SaveModified ( ) ;
2001-02-05 08:26:47 +00:00
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = getFields ( ) [ nPos - 1 ] ;
2015-11-10 10:13:39 +01:00
OSL_ENSURE ( pEntry ! = nullptr , " OSelectionBrowseBox::GetCellContents : invalid column id, prepare for GPF ... " ) ;
2001-02-05 08:26:47 +00:00
2001-04-18 10:44:59 +00:00
switch ( nCellIndex )
2001-02-05 08:26:47 +00:00
{
case BROW_VIS_ROW :
2014-12-18 16:44:06 +01:00
return pEntry - > IsVisible ( ) ? OUStringLiteral ( " 1 " ) : OUStringLiteral ( " 0 " ) ;
2001-02-05 08:26:47 +00:00
case BROW_ORDER_ROW :
{
2017-09-14 16:57:06 +02:00
sal_Int32 nIdx = m_pOrderCell - > GetSelectedEntryPos ( ) ;
2014-03-01 03:13:28 +01:00
if ( nIdx = = LISTBOX_ENTRY_NOTFOUND )
2001-02-05 08:26:47 +00:00
nIdx = 0 ;
2015-06-19 10:11:31 +02:00
return OUString : : number ( nIdx ) ;
2001-02-05 08:26:47 +00:00
}
default :
2002-08-19 07:01:32 +00:00
return GetCellText ( nCellIndex , nColId ) ;
2001-02-05 08:26:47 +00:00
}
}
2013-09-27 12:04:57 +02:00
void OSelectionBrowseBox : : SetCellContents ( sal_Int32 nRow , sal_uInt16 nColId , const OUString & strNewText )
2001-02-05 08:26:47 +00:00
{
2014-04-17 11:16:55 +02:00
bool bWasEditing = IsEditing ( ) & & ( GetCurColumnId ( ) = = nColId ) & & IsRowVisible ( static_cast < sal_uInt16 > ( nRow ) ) & & ( GetCurRow ( ) = = static_cast < sal_uInt16 > ( GetBrowseRow ( nRow ) ) ) ;
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2001-02-05 08:26:47 +00:00
DeactivateCell ( ) ;
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = getEntry ( nPos - 1 ) ;
2015-11-10 10:13:39 +01:00
OSL_ENSURE ( pEntry ! = nullptr , " OSelectionBrowseBox::SetCellContents : invalid column id, prepare for GPF ... " ) ;
2001-02-05 08:26:47 +00:00
2001-04-18 10:44:59 +00:00
switch ( nRow )
2001-02-05 08:26:47 +00:00
{
case BROW_VIS_ROW :
2014-12-18 13:22:10 +01:00
pEntry - > SetVisible ( strNewText = = " 1 " ) ;
2001-02-05 08:26:47 +00:00
break ;
case BROW_FIELD_ROW :
pEntry - > SetField ( strNewText ) ;
break ;
case BROW_TABLE_ROW :
pEntry - > SetAlias ( strNewText ) ;
break ;
case BROW_ORDER_ROW :
{
2018-01-12 20:25:56 +01:00
sal_uInt16 nIdx = static_cast < sal_uInt16 > ( strNewText . toInt32 ( ) ) ;
2001-02-05 08:26:47 +00:00
pEntry - > SetOrderDir ( EOrderDir ( nIdx ) ) ;
} break ;
case BROW_COLUMNALIAS_ROW :
pEntry - > SetFieldAlias ( strNewText ) ;
break ;
case BROW_FUNCTION_ROW :
2002-08-30 10:14:45 +00:00
{
2018-09-09 10:48:28 +02:00
OUString sGroupFunctionName = m_aFunctionStrings . copy ( m_aFunctionStrings . lastIndexOf ( ' ; ' ) + 1 ) ;
2001-02-05 08:26:47 +00:00
pEntry - > SetFunction ( strNewText ) ;
2002-08-30 10:14:45 +00:00
// first reset this two member
sal_Int32 nFunctionType = pEntry - > GetFunctionType ( ) ;
nFunctionType & = ~ FKT_AGGREGATE ;
pEntry - > SetFunctionType ( nFunctionType ) ;
2013-09-23 07:19:08 +01:00
if ( pEntry - > IsGroupBy ( ) & & ! sGroupFunctionName . equalsIgnoreAsciiCase ( strNewText ) )
2015-09-01 14:21:06 +02:00
pEntry - > SetGroupBy ( false ) ;
2002-08-30 10:14:45 +00:00
2013-09-23 07:19:08 +01:00
if ( sGroupFunctionName . equalsIgnoreAsciiCase ( strNewText ) )
2014-04-17 11:16:55 +02:00
pEntry - > SetGroupBy ( true ) ;
2013-09-27 12:04:57 +02:00
else if ( ! strNewText . isEmpty ( ) )
2002-08-30 10:14:45 +00:00
{
nFunctionType | = FKT_AGGREGATE ;
pEntry - > SetFunctionType ( nFunctionType ) ;
}
} break ;
2001-02-05 08:26:47 +00:00
default :
2003-12-01 09:38:48 +00:00
pEntry - > SetCriteria ( sal_uInt16 ( nRow - BROW_CRIT1_ROW ) , strNewText ) ;
2001-02-05 08:26:47 +00:00
}
2001-04-18 10:44:59 +00:00
long nCellIndex = GetRealRow ( nRow ) ;
2011-01-14 15:00:11 +01:00
if ( IsRowVisible ( static_cast < sal_uInt16 > ( nRow ) ) )
2002-08-19 07:01:32 +00:00
RowModified ( nCellIndex , nColId ) ;
2001-02-05 08:26:47 +00:00
2013-03-02 15:06:22 +01:00
// the appropriate field-description is now empty -> set Visible to sal_False (now it is consistent to normal empty rows)
2001-02-05 08:26:47 +00:00
if ( pEntry - > IsEmpty ( ) )
2014-04-17 11:16:55 +02:00
pEntry - > SetVisible ( false ) ;
2001-02-05 08:26:47 +00:00
2001-10-26 06:49:36 +00:00
if ( bWasEditing )
2002-08-19 07:01:32 +00:00
ActivateCell ( nCellIndex , nColId ) ;
2001-02-05 08:26:47 +00:00
2016-04-20 17:16:13 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
2001-02-05 08:26:47 +00:00
}
2013-08-17 23:43:14 +02:00
2001-02-05 08:26:47 +00:00
void OSelectionBrowseBox : : ColumnResized ( sal_uInt16 nColId )
{
2008-06-25 11:54:03 +00:00
if ( static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . isReadOnly ( ) )
2001-02-05 08:26:47 +00:00
return ;
// The resizing of columns can't be suppressed (BrowseBox doesn't support that) so we have to do this
// fake. It's not _that_ bad : the user may change column widths while in read-only mode to see all details
// but the changes aren't permanent ...
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( nPos < = getFields ( ) . size ( ) , " ColumnResized:: nColId should not be greater than List::count! " ) ;
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = getEntry ( nPos - 1 ) ;
2017-03-24 08:26:23 +00:00
OSL_ENSURE ( pEntry . is ( ) , " OSelectionBrowseBox::ColumnResized : invalid FieldDescription ! " ) ;
2016-04-20 17:16:13 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . setModified ( true ) ;
2001-06-29 07:45:10 +00:00
EditBrowseBox : : ColumnResized ( nColId ) ;
2001-02-05 08:26:47 +00:00
2010-10-15 12:22:54 -05:00
if ( pEntry . is ( ) )
2001-02-05 08:26:47 +00:00
{
2005-09-23 11:43:59 +00:00
if ( ! m_bInUndoMode )
{
// create the undo action
2018-10-08 11:22:10 +02:00
std : : unique_ptr < OTabFieldSizedUndoAct > pUndo ( new OTabFieldSizedUndoAct ( this ) ) ;
2005-09-23 11:43:59 +00:00
pUndo - > SetColumnPosition ( nPos ) ;
pUndo - > SetOriginalWidth ( pEntry - > GetColWidth ( ) ) ;
2018-10-08 11:22:10 +02:00
getDesignView ( ) - > getController ( ) . addUndoActionAndInvalidate ( std : : move ( pUndo ) ) ;
2005-09-23 11:43:59 +00:00
}
2001-02-23 14:04:37 +00:00
pEntry - > SetColWidth ( sal_uInt16 ( GetColumnWidth ( nColId ) ) ) ;
2001-02-05 08:26:47 +00:00
}
}
sal_uInt32 OSelectionBrowseBox : : GetTotalCellWidth ( long nRowId , sal_uInt16 nColId )
{
2011-01-14 15:00:11 +01:00
sal_uInt16 nPos = GetColumnPos ( nColId ) ;
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( ( nPos = = 0 ) | | ( nPos < = getFields ( ) . size ( ) ) , " OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId " ) ;
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = getFields ( ) [ nPos - 1 ] ;
2011-02-03 00:33:36 +01:00
OSL_ENSURE ( pEntry . is ( ) , " OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription ! " ) ;
2001-02-05 08:26:47 +00:00
long nRow = GetRealRow ( nRowId ) ;
2013-09-27 12:04:57 +02:00
OUString strText ( GetCellText ( nRow , nColId ) ) ;
2001-02-05 08:26:47 +00:00
return GetDataWindow ( ) . LogicToPixel ( Size ( GetDataWindow ( ) . GetTextWidth ( strText ) , 0 ) ) . Width ( ) ;
}
2019-09-04 16:08:36 +02:00
bool OSelectionBrowseBox : : isCutAllowed ( ) const
2001-04-18 10:44:59 +00:00
{
2014-04-17 11:16:55 +02:00
bool bCutAllowed = false ;
2001-04-18 10:44:59 +00:00
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_VIS_ROW :
case BROW_ORDER_ROW :
case BROW_TABLE_ROW :
case BROW_FUNCTION_ROW :
break ;
case BROW_FIELD_ROW :
2013-01-31 10:18:04 +01:00
bCutAllowed = ! m_pFieldCell - > GetSelected ( ) . isEmpty ( ) ;
2001-04-18 10:44:59 +00:00
break ;
default :
2013-01-31 10:18:04 +01:00
bCutAllowed = ! m_pTextCell - > GetSelected ( ) . isEmpty ( ) ;
2001-04-18 10:44:59 +00:00
break ;
}
return bCutAllowed ;
}
2013-08-17 23:43:14 +02:00
2001-04-18 10:44:59 +00:00
void OSelectionBrowseBox : : cut ( )
{
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_FIELD_ROW :
m_pFieldCell - > Cut ( ) ;
2001-08-13 07:34:13 +00:00
m_pFieldCell - > SetModifyFlag ( ) ;
2001-04-18 10:44:59 +00:00
break ;
default :
m_pTextCell - > Cut ( ) ;
2001-08-13 07:34:13 +00:00
m_pTextCell - > SetModifyFlag ( ) ;
2001-04-18 10:44:59 +00:00
}
2001-08-13 07:34:13 +00:00
SaveModified ( ) ;
2001-04-18 10:44:59 +00:00
RowModified ( GetBrowseRow ( nRow ) , GetCurColumnId ( ) ) ;
2001-10-05 05:49:21 +00:00
invalidateUndoRedo ( ) ;
2001-04-18 10:44:59 +00:00
}
2013-08-17 23:43:14 +02:00
2001-04-18 10:44:59 +00:00
void OSelectionBrowseBox : : paste ( )
{
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_FIELD_ROW :
m_pFieldCell - > Paste ( ) ;
2001-08-30 12:35:55 +00:00
m_pFieldCell - > SetModifyFlag ( ) ;
2001-04-18 10:44:59 +00:00
break ;
default :
m_pTextCell - > Paste ( ) ;
2001-08-30 12:35:38 +00:00
m_pTextCell - > SetModifyFlag ( ) ;
2001-04-18 10:44:59 +00:00
}
RowModified ( GetBrowseRow ( nRow ) , GetCurColumnId ( ) ) ;
2001-10-05 05:49:21 +00:00
invalidateUndoRedo ( ) ;
2001-04-18 10:44:59 +00:00
}
2013-08-17 23:43:14 +02:00
2019-09-04 16:08:36 +02:00
bool OSelectionBrowseBox : : isPasteAllowed ( ) const
2003-04-01 13:05:21 +00:00
{
2014-04-17 11:16:55 +02:00
bool bPasteAllowed = true ;
2003-04-01 13:05:21 +00:00
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_VIS_ROW :
case BROW_ORDER_ROW :
case BROW_TABLE_ROW :
case BROW_FUNCTION_ROW :
2014-04-17 11:16:55 +02:00
bPasteAllowed = false ;
2003-04-01 13:05:21 +00:00
break ;
}
return bPasteAllowed ;
}
2013-08-17 23:43:14 +02:00
2019-09-04 16:08:36 +02:00
bool OSelectionBrowseBox : : isCopyAllowed ( ) const
2003-04-01 13:05:21 +00:00
{
return isCutAllowed ( ) ;
}
2013-08-17 23:43:14 +02:00
2001-04-18 10:44:59 +00:00
void OSelectionBrowseBox : : copy ( )
{
long nRow = GetRealRow ( GetCurRow ( ) ) ;
switch ( nRow )
{
case BROW_FIELD_ROW :
m_pFieldCell - > Copy ( ) ;
break ;
default :
m_pTextCell - > Copy ( ) ;
}
}
2013-08-17 23:43:14 +02:00
2014-04-17 11:16:55 +02:00
void OSelectionBrowseBox : : appendUndoAction ( const OUString & _rOldValue , const OUString & _rNewValue , sal_Int32 _nRow , bool & _bListAction )
2002-08-30 10:14:45 +00:00
{
2013-09-27 12:04:57 +02:00
if ( ! m_bInUndoMode & & _rNewValue ! = _rOldValue )
2002-08-30 10:14:45 +00:00
{
if ( ! _bListAction )
{
2014-04-17 11:16:55 +02:00
_bListAction = true ;
2017-03-18 18:24:53 +02:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . GetUndoManager ( ) . EnterListAction ( OUString ( ) , OUString ( ) , 0 , ViewShellId ( - 1 ) ) ;
2002-08-30 10:14:45 +00:00
}
appendUndoAction ( _rOldValue , _rNewValue , _nRow ) ;
}
}
2013-08-17 23:43:14 +02:00
2013-09-27 12:04:57 +02:00
void OSelectionBrowseBox : : appendUndoAction ( const OUString & _rOldValue , const OUString & _rNewValue , sal_Int32 _nRow )
2001-04-18 10:44:59 +00:00
{
2013-09-27 12:04:57 +02:00
if ( ! m_bInUndoMode & & _rNewValue ! = _rOldValue )
2001-04-18 10:44:59 +00:00
{
2018-10-08 11:22:10 +02:00
std : : unique_ptr < OTabFieldCellModifiedUndoAct > pUndoAct ( new OTabFieldCellModifiedUndoAct ( this ) ) ;
2001-04-18 10:44:59 +00:00
pUndoAct - > SetCellIndex ( _nRow ) ;
2003-03-19 16:57:12 +00:00
OSL_ENSURE ( GetColumnPos ( GetCurColumnId ( ) ) ! = BROWSER_INVALIDID , " Current position isn't valid! " ) ;
2002-08-30 10:14:45 +00:00
pUndoAct - > SetColumnPosition ( GetColumnPos ( GetCurColumnId ( ) ) ) ;
2001-04-18 10:44:59 +00:00
pUndoAct - > SetCellContents ( _rOldValue ) ;
2018-10-08 11:22:10 +02:00
getDesignView ( ) - > getController ( ) . addUndoActionAndInvalidate ( std : : move ( pUndoAct ) ) ;
2001-04-18 10:44:59 +00:00
}
}
2013-08-17 23:43:14 +02:00
2016-10-05 07:56:12 +02:00
IMPL_LINK_NOARG ( OSelectionBrowseBox , OnInvalidateTimer , Timer * , void )
2001-04-18 12:20:48 +00:00
{
2008-06-25 11:54:03 +00:00
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_CUT ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_COPY ) ;
static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . InvalidateFeature ( SID_PASTE ) ;
2001-04-18 12:20:48 +00:00
if ( ! m_bStopTimer )
m_timerInvalidate . Start ( ) ;
}
2013-08-17 23:43:14 +02:00
2001-04-18 12:20:48 +00:00
void OSelectionBrowseBox : : stopTimer ( )
{
2014-04-17 11:16:55 +02:00
m_bStopTimer = true ;
2001-04-18 12:20:48 +00:00
if ( m_timerInvalidate . IsActive ( ) )
m_timerInvalidate . Stop ( ) ;
}
2013-08-17 23:43:14 +02:00
2001-04-18 12:20:48 +00:00
void OSelectionBrowseBox : : startTimer ( )
{
2014-04-17 11:16:55 +02:00
m_bStopTimer = false ;
2001-04-18 12:20:48 +00:00
if ( ! m_timerInvalidate . IsActive ( ) )
m_timerInvalidate . Start ( ) ;
}
2013-08-17 23:43:14 +02:00
2001-10-05 05:49:21 +00:00
OTableFields & OSelectionBrowseBox : : getFields ( ) const
2001-04-30 12:02:01 +00:00
{
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
return rController . getTableFieldDesc ( ) ;
2001-04-30 12:02:01 +00:00
}
2013-08-17 23:43:14 +02:00
2001-10-05 05:49:21 +00:00
void OSelectionBrowseBox : : enableControl ( const OTableFieldDescRef & _rEntry , Window * _pControl )
{
2014-04-17 11:16:55 +02:00
bool bEnable = ! _rEntry - > isCondition ( ) ;
2001-10-05 05:49:21 +00:00
_pControl - > Enable ( bEnable ) ;
_pControl - > EnableInput ( bEnable ) ;
}
2013-08-17 23:43:14 +02:00
2013-09-27 12:04:57 +02:00
void OSelectionBrowseBox : : setTextCellContext ( const OTableFieldDescRef & _rEntry , const OUString & _sText , const OString & _sHelpId )
2001-10-05 05:49:21 +00:00
{
m_pTextCell - > SetText ( _sText ) ;
m_pTextCell - > ClearModifyFlag ( ) ;
if ( ! m_pTextCell - > HasFocus ( ) )
m_pTextCell - > GrabFocus ( ) ;
enableControl ( _rEntry , m_pTextCell ) ;
2010-07-10 18:21:24 +02:00
if ( m_pTextCell - > GetHelpId ( ) ! = _sHelpId )
2013-03-02 15:06:22 +01:00
// as TextCell is used in various contexts I will delete the cached HelpText
2013-09-27 12:04:57 +02:00
m_pTextCell - > SetHelpText ( OUString ( ) ) ;
2010-07-10 18:21:24 +02:00
m_pTextCell - > SetHelpId ( _sHelpId ) ;
2001-10-05 05:49:21 +00:00
}
2013-08-17 23:43:14 +02:00
2001-10-05 05:49:21 +00:00
void OSelectionBrowseBox : : invalidateUndoRedo ( )
{
2008-06-25 11:54:03 +00:00
OQueryController & rController = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) ;
rController . InvalidateFeature ( ID_BROWSER_UNDO ) ;
rController . InvalidateFeature ( ID_BROWSER_REDO ) ;
rController . InvalidateFeature ( ID_BROWSER_QUERY_EXECUTE ) ;
2001-10-05 05:49:21 +00:00
}
2013-08-17 23:43:14 +02:00
2001-10-05 05:49:21 +00:00
OTableFieldDescRef OSelectionBrowseBox : : getEntry ( OTableFields : : size_type _nPos )
{
// we have to check if we need a new entry at this position
OTableFields & aFields = getFields ( ) ;
OSL_ENSURE ( aFields . size ( ) > _nPos , " ColID is to great! " ) ;
2001-04-18 12:20:48 +00:00
2001-10-05 05:49:21 +00:00
OTableFieldDescRef pEntry = aFields [ _nPos ] ;
2010-10-15 12:22:54 -05:00
OSL_ENSURE ( pEntry . is ( ) , " Invalid entry! " ) ;
if ( ! pEntry . is ( ) )
2001-10-05 05:49:21 +00:00
{
pEntry = new OTableFieldDesc ( ) ;
2006-10-12 12:43:07 +00:00
pEntry - > SetColumnId (
2011-01-14 15:00:11 +01:00
GetColumnId ( sal : : static_int_cast < sal_uInt16 > ( _nPos + 1 ) ) ) ;
2001-10-05 05:49:21 +00:00
aFields [ _nPos ] = pEntry ;
}
return pEntry ;
}
2013-08-17 23:43:14 +02:00
2001-10-22 08:57:52 +00:00
void OSelectionBrowseBox : : GetFocus ( )
{
2001-10-23 11:30:27 +00:00
if ( ! IsEditing ( ) & & ! m_bWasEditing )
2001-10-22 08:57:52 +00:00
ActivateCell ( ) ;
EditBrowseBox : : GetFocus ( ) ;
}
2013-08-17 23:43:14 +02:00
2014-03-20 11:14:54 +02:00
void OSelectionBrowseBox : : DeactivateCell ( bool _bUpdate )
2001-10-26 06:49:36 +00:00
{
2014-04-17 11:16:55 +02:00
m_bWasEditing = true ;
2001-10-26 06:49:36 +00:00
EditBrowseBox : : DeactivateCell ( _bUpdate ) ;
2014-04-17 11:16:55 +02:00
m_bWasEditing = false ;
2001-10-26 06:49:36 +00:00
}
2013-08-17 23:43:14 +02:00
2013-04-07 12:06:47 +02:00
OUString OSelectionBrowseBox : : GetRowDescription ( sal_Int32 _nRow ) const
2002-04-23 06:58:14 +00:00
{
2017-06-11 20:56:30 +01:00
OUString aLabel ( DBA_RES ( STR_QUERY_HANDLETEXT ) ) ;
2002-04-23 06:58:14 +00:00
2013-03-02 15:06:22 +01:00
// from BROW_CRIT2_ROW onwards all rows are shown as "or"
2014-01-15 15:26:41 +00:00
sal_Int32 nToken = ( _nRow > = GetBrowseRow ( BROW_CRIT2_ROW ) )
? BROW_CRIT2_ROW : GetRealRow ( _nRow ) ;
2013-09-27 12:04:57 +02:00
return aLabel . getToken ( nToken , ' ; ' ) ;
2002-04-23 06:58:14 +00:00
}
2013-08-17 23:43:14 +02:00
2018-11-17 21:37:50 +00:00
OUString OSelectionBrowseBox : : GetAccessibleObjectName ( : : vcl : : AccessibleBrowseBoxObjType _eObjType , sal_Int32 _nPosition ) const
2002-04-23 06:58:14 +00:00
{
2013-04-07 12:06:47 +02:00
OUString sRetText ;
2002-04-23 06:58:14 +00:00
switch ( _eObjType )
{
2018-11-17 21:37:50 +00:00
case : : vcl : : BBTYPE_ROWHEADERCELL :
2002-04-23 06:58:14 +00:00
sRetText = GetRowDescription ( _nPosition ) ;
break ;
default :
2006-06-20 02:27:27 +00:00
sRetText = EditBrowseBox : : GetAccessibleObjectDescription ( _eObjType , _nPosition ) ;
2002-04-23 06:58:14 +00:00
}
return sRetText ;
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
bool OSelectionBrowseBox : : fillEntryTable ( OTableFieldDescRef const & _pEntry , const OUString & _sTableName )
2002-08-30 10:14:45 +00:00
{
2014-04-17 11:16:55 +02:00
bool bRet = false ;
2014-06-18 12:14:29 +02:00
OJoinTableView : : OTableWindowMap & rTabWinList = getDesignView ( ) - > getTableView ( ) - > GetTabWinMap ( ) ;
2016-03-28 19:17:45 +02:00
OJoinTableView : : OTableWindowMap : : const_iterator aIter = rTabWinList . find ( _sTableName ) ;
2014-06-18 12:14:29 +02:00
if ( aIter ! = rTabWinList . end ( ) )
2002-08-30 10:14:45 +00:00
{
2015-03-09 14:29:30 +02:00
OQueryTableWindow * pEntryTab = static_cast < OQueryTableWindow * > ( aIter - > second . get ( ) ) ;
2014-06-18 12:14:29 +02:00
if ( pEntryTab )
2002-08-30 10:14:45 +00:00
{
2014-06-18 12:14:29 +02:00
_pEntry - > SetTable ( pEntryTab - > GetTableName ( ) ) ;
_pEntry - > SetTabWindow ( pEntryTab ) ;
bRet = true ;
2002-08-30 10:14:45 +00:00
}
}
return bRet ;
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
void OSelectionBrowseBox : : setFunctionCell ( OTableFieldDescRef const & _pEntry )
2002-08-30 10:14:45 +00:00
{
2008-06-25 11:54:03 +00:00
Reference < XConnection > xConnection = static_cast < OQueryController & > ( getDesignView ( ) - > getController ( ) ) . getConnection ( ) ;
2002-08-30 10:14:45 +00:00
if ( xConnection . is ( ) )
{
2012-02-09 18:47:32 +01:00
// Aggregate functions in general only available with Core SQL
2003-12-01 09:38:48 +00:00
if ( lcl_SupportsCoreSQLGrammar ( xConnection ) )
2002-08-30 10:14:45 +00:00
{
2018-11-09 20:29:42 +01:00
sal_Int32 nIdx { 0 } ;
2013-12-20 11:25:37 +01:00
// if we have an asterisk, no other function than count is allowed
2002-08-30 10:14:45 +00:00
m_pFunctionCell - > Clear ( ) ;
2018-11-09 20:29:42 +01:00
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 0 , ' ; ' , nIdx ) ) ;
2013-12-20 11:25:37 +01:00
if ( isFieldNameAsterisk ( _pEntry - > GetField ( ) ) )
2018-11-09 20:29:42 +01:00
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 1 , ' ; ' , nIdx ) ) ; // 2nd token: COUNT
2002-08-30 10:14:45 +00:00
else
{
2018-11-09 20:32:23 +01:00
const bool bSkipLastToken { _pEntry - > isNumeric ( ) } ;
while ( nIdx > 0 )
{
const OUString sTok { m_aFunctionStrings . getToken ( 0 , ' ; ' , nIdx ) } ;
if ( bSkipLastToken & & nIdx < 0 )
break ;
m_pFunctionCell - > InsertEntry ( sTok ) ;
}
2002-08-30 10:14:45 +00:00
}
if ( _pEntry - > IsGroupBy ( ) )
{
OSL_ENSURE ( ! _pEntry - > isNumeric ( ) , " Not allowed to combine group by and numeric values! " ) ;
m_pFunctionCell - > SelectEntry ( m_pFunctionCell - > GetEntry ( m_pFunctionCell - > GetEntryCount ( ) - 1 ) ) ;
}
2017-05-19 17:18:33 +02:00
else if ( m_pFunctionCell - > GetEntryPos ( _pEntry - > GetFunction ( ) ) ! = COMBOBOX_ENTRY_NOTFOUND )
m_pFunctionCell - > SelectEntry ( _pEntry - > GetFunction ( ) ) ;
2002-08-30 10:14:45 +00:00
else
m_pFunctionCell - > SelectEntryPos ( 0 ) ;
enableControl ( _pEntry , m_pFunctionCell ) ;
}
else
{
2012-02-09 18:47:32 +01:00
// only COUNT(*) and COUNT("table".*) allowed
2014-04-17 11:16:55 +02:00
bool bCountRemoved = ! isFieldNameAsterisk ( _pEntry - > GetField ( ) ) ;
2006-07-19 15:06:23 +00:00
if ( bCountRemoved )
2002-08-30 10:14:45 +00:00
m_pFunctionCell - > RemoveEntry ( 1 ) ;
if ( ! bCountRemoved & & m_pFunctionCell - > GetEntryCount ( ) < 2 )
2013-09-27 12:04:57 +02:00
m_pFunctionCell - > InsertEntry ( m_aFunctionStrings . getToken ( 2 , ' ; ' ) ) ; // 2 -> COUNT
2002-08-30 10:14:45 +00:00
2017-05-19 17:18:33 +02:00
if ( m_pFunctionCell - > GetEntryPos ( _pEntry - > GetFunction ( ) ) ! = COMBOBOX_ENTRY_NOTFOUND )
2002-08-30 10:14:45 +00:00
m_pFunctionCell - > SelectEntry ( _pEntry - > GetFunction ( ) ) ;
else
m_pFunctionCell - > SelectEntryPos ( 0 ) ;
}
}
}
2013-08-17 23:43:14 +02:00
2003-05-19 11:56:04 +00:00
Reference < XAccessible > OSelectionBrowseBox : : CreateAccessibleCell ( sal_Int32 _nRow , sal_uInt16 _nColumnPos )
{
2018-09-06 10:33:11 +02:00
OTableFieldDescRef pEntry ;
2003-05-19 11:56:04 +00:00
if ( getFields ( ) . size ( ) > sal_uInt16 ( _nColumnPos - 1 ) )
pEntry = getFields ( ) [ _nColumnPos - 1 ] ;
2010-10-15 12:22:54 -05:00
if ( _nRow = = BROW_VIS_ROW & & pEntry . is ( ) )
2014-02-24 12:25:02 +01:00
return EditBrowseBox : : CreateAccessibleCheckBoxCell ( _nRow , _nColumnPos , pEntry - > IsVisible ( ) ? TRISTATE_TRUE : TRISTATE_FALSE ) ;
2003-05-19 11:56:04 +00:00
return EditBrowseBox : : CreateAccessibleCell ( _nRow , _nColumnPos ) ;
}
2013-08-17 23:43:14 +02:00
2017-07-31 12:26:12 +02:00
bool OSelectionBrowseBox : : HasFieldByAliasName ( const OUString & rFieldName , OTableFieldDescRef const & rInfo ) const
2008-12-10 13:41:25 +00:00
{
2018-03-10 14:49:40 +01:00
for ( auto const & field : getFields ( ) )
2008-12-10 13:41:25 +00:00
{
2018-03-10 14:49:40 +01:00
if ( field - > GetFieldAlias ( ) = = rFieldName )
2008-12-10 13:41:25 +00:00
{
2018-03-10 14:49:40 +01:00
* rInfo = * field ;
return true ;
2008-12-10 13:41:25 +00:00
}
}
2018-03-10 14:49:40 +01:00
return false ;
2008-12-10 13:41:25 +00:00
}
2003-12-01 09:38:48 +00:00
2010-10-12 15:59:03 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */