Files
libreoffice/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx

2862 lines
113 KiB
C++
Raw Normal View History

2001-02-05 08:26:47 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2001-02-05 08:26:47 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2001-02-05 08:26:47 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2001-02-05 08:26:47 +00:00
*
* $RCSfile: SelectionBrowseBox.cxx,v $
* $Revision: 1.83 $
2001-02-05 08:26:47 +00:00
*
* This file is part of OpenOffice.org.
2001-02-05 08:26:47 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2001-02-05 08:26:47 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2001-02-05 08:26:47 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2001-02-05 08:26:47 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
2001-02-05 08:26:47 +00:00
#ifndef DBAUI_QUERYDESIGN_OSELECTIONBROWSEBOX_HXX
#include "SelectionBrowseBox.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#ifndef DBAUI_QUERYDESIGNVIEW_HXX
#include "QueryDesignView.hxx"
#endif
#ifndef DBAUI_QUERYCONTROLLER_HXX
#include "querycontroller.hxx"
#endif
#ifndef DBAUI_QUERYTABLEVIEW_HXX
#include "QueryTableView.hxx"
#endif
#ifndef DBACCESS_UI_BROWSER_ID_HXX
#include "browserids.hxx"
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#ifndef DBAUI_TABLEFIELDINFO_HXX
#include "TableFieldInfo.hxx"
#endif
2002-08-19 07:01:32 +00:00
#ifndef _DBU_QRY_HRC_
#include "dbu_qry.hrc"
2001-02-05 08:26:47 +00:00
#endif
2001-09-27 05:19:05 +00:00
#ifndef _DBA_DBACCESS_HELPID_HRC_
2001-02-05 08:26:47 +00:00
#include "dbaccess_helpid.hrc"
2001-09-27 05:19:05 +00:00
#endif
2001-02-05 08:26:47 +00:00
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
#endif
#ifndef DBAUI_QUERY_TABLEWINDOW_HXX
#include "QTableWindow.hxx"
#endif
#ifndef DBAUI_QUERYTABLEVIEW_HXX
#include "QueryTableView.hxx"
#endif
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
#ifndef DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
#include "QueryDesignFieldUndoAct.hxx"
#endif
#ifndef _SVX_DBEXCH_HRC
#include <svx/dbexch.hrc>
#endif
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#endif
#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
2001-02-14 13:54:12 +00:00
#endif
#ifndef _DBAUI_SQLMESSAGE_HXX_
#include "sqlmessage.hxx"
#endif
#ifndef DBAUI_TOOLS_HXX
#include "UITools.hxx"
#endif
2001-02-14 13:54:12 +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;
using namespace ::com::sun::star::accessibility;
2001-02-05 08:26:47 +00:00
const String g_strOne = String::CreateFromAscii("1");
const String g_strZero = String::CreateFromAscii("0");
#define DEFAULT_QUERY_COLS 20
2002-08-19 07:01:32 +00:00
#define DEFAULT_SIZE GetTextWidth(g_strZero) * 30
#define CHECKBOX_SIZE 10
#define HANDLE_ID 0
#define HANDLE_COLUMN_WITDH 70
2001-02-05 08:26:47 +00:00
#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\
(pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
(pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
// -----------------------------------------------------------------------------
namespace
{
sal_Bool isFieldNameAsterix(const ::rtl::OUString& _sFieldName )
{
sal_Bool bAsterix = !(_sFieldName.getLength() && _sFieldName.toChar() != '*');
if ( !bAsterix )
{
String sName = _sFieldName;
xub_StrLen nTokenCount = sName.GetTokenCount('.');
if ( (nTokenCount == 2 && sName.GetToken(1,'.').GetChar(0) == '*' )
|| (nTokenCount == 3 && sName.GetToken(2,'.').GetChar(0) == '*' ) )
{
bAsterix = sal_True;
}
}
return bAsterix;
}
// -----------------------------------------------------------------------------
sal_Bool lcl_SupportsCoreSQLGrammar(const Reference< XConnection>& _xConnection)
{
sal_Bool bSupportsCoreGrammar = sal_False;
if ( _xConnection.is() )
{
try
{
Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
bSupportsCoreGrammar = xMetaData.is() && xMetaData->supportsCoreSQLGrammar();
}
catch(Exception&)
{
}
}
return bSupportsCoreGrammar;
}
}
DBG_NAME(OSelectionBrowseBox)
2001-02-05 08:26:47 +00:00
//------------------------------------------------------------------------------
OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent )
2002-08-19 07:01:32 +00:00
:EditBrowseBox( pParent,EBBF_NOROWPICTURE, WB_3DLOOK, BROWSER_COLUMNSELECTION | BROWSER_KEEPSELECTION | BROWSER_HIDESELECT |
BROWSER_HIDECURSOR | BROWSER_HLINESFULL | BROWSER_VLINESFULL )
2001-02-05 08:26:47 +00:00
,m_aFunctionStrings(ModuleRes(STR_QUERY_FUNCTIONS))
,m_nVisibleCount(0)
2001-02-05 08:26:47 +00:00
,m_bOrderByUnRelated(sal_True)
,m_bGroupByUnRelated(sal_True)
2001-04-18 12:20:48 +00:00
,m_bStopTimer(sal_False)
2001-10-23 11:30:27 +00:00
,m_bWasEditing(sal_False)
,m_bDisableErrorBox(sal_False)
,m_bInUndoMode(sal_False)
2001-02-05 08:26:47 +00:00
{
DBG_CTOR(OSelectionBrowseBox,NULL);
SetHelpId(HID_CTL_QRYDGNCRIT);
2002-08-19 07:01:32 +00:00
m_nMode = BROWSER_COLUMNSELECTION | BROWSER_HIDESELECT
| BROWSER_KEEPSELECTION | BROWSER_HIDECURSOR
| BROWSER_HLINESFULL | BROWSER_VLINESFULL
| BROWSER_HEADERBAR_NEW ;
2001-02-05 08:26:47 +00:00
2001-03-07 08:27:45 +00:00
m_pTextCell = new Edit(&GetDataWindow(), 0);
2001-02-05 08:26:47 +00:00
// m_pTextCell->EnableSpecialCheck(sal_False);
m_pVisibleCell = new CheckBoxControl(&GetDataWindow());
m_pTableCell = new ListBoxControl(&GetDataWindow()); m_pTableCell->SetDropDownLineCount( 20 );
m_pFieldCell = new ComboBoxControl(&GetDataWindow()); m_pFieldCell->SetDropDownLineCount( 20 );
m_pOrderCell = new ListBoxControl(&GetDataWindow());
m_pFunctionCell = new ListBoxControl(&GetDataWindow()); m_pFunctionCell->SetDropDownLineCount( 20 );
2001-02-05 08:26:47 +00: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);
//////////////////////////////////////////////////////////////////////
// TriState der ::com::sun::star::form::CheckBox abschalten
m_pVisibleCell->GetBox().EnableTriState( sal_False );
2002-08-19 07:01:32 +00:00
// m_pEmptyEntry = new OTableFieldDesc();
// m_pEmptyEntry->SetColWidth(DEFAULT_SIZE);
2001-07-12 11:23:31 +00:00
Font aTitleFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE,Window::GetSettings().GetLanguage(),DEFAULTFONT_FLAGS_ONLYONE);
2001-02-05 08:26:47 +00:00
aTitleFont.SetSize(Size(0, 6));
SetTitleFont(aTitleFont);
String aTxt(ModuleRes(STR_QUERY_SORTTEXT));
xub_StrLen nCount = aTxt.GetTokenCount();
xub_StrLen nIdx = 0;
for (; nIdx < nCount; nIdx++)
m_pOrderCell->InsertEntry(aTxt.GetToken(nIdx));
for(long i=0;i < BROW_ROW_CNT;i++)
m_bVisibleRow.push_back(sal_True);
m_bVisibleRow[BROW_FUNCTION_ROW] = sal_False; // zuerst ausblenden
2001-04-18 12:20:48 +00:00
m_timerInvalidate.SetTimeout(200);
m_timerInvalidate.SetTimeoutHdl(LINK(this, OSelectionBrowseBox, OnInvalidateTimer));
m_timerInvalidate.Start();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
OSelectionBrowseBox::~OSelectionBrowseBox()
{
DBG_DTOR(OSelectionBrowseBox,NULL);
delete m_pTextCell;
delete m_pVisibleCell;
delete m_pFieldCell;
delete m_pTableCell;
delete m_pOrderCell;
delete m_pFunctionCell;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::initialize()
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
if(xConnection.is())
2001-02-05 08:26:47 +00:00
{
const IParseContext& rContext = static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext();
IParseContext::InternationalKeyCode eFunctions[] = { IParseContext::KEY_AVG,IParseContext::KEY_COUNT,IParseContext::KEY_MAX
,IParseContext::KEY_MIN,IParseContext::KEY_SUM
,IParseContext::KEY_EVERY
,IParseContext::KEY_ANY
,IParseContext::KEY_SOME
,IParseContext::KEY_STDDEV_POP
,IParseContext::KEY_STDDEV_SAMP
,IParseContext::KEY_VAR_SAMP
,IParseContext::KEY_VAR_POP
,IParseContext::KEY_COLLECT
,IParseContext::KEY_FUSION
,IParseContext::KEY_INTERSECTION
};
String sGroup = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount() - 1);
m_aFunctionStrings = m_aFunctionStrings.GetToken(0);
for (size_t i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i)
{
m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";"));
m_aFunctionStrings += String(ByteString(rContext.getIntlKeywordAscii(eFunctions[i])),RTL_TEXTENCODING_UTF8);
} // for (sal_Int32 i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i)
m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";"));
m_aFunctionStrings += sGroup;
// Diese Funktionen stehen nur unter CORE zur Verf<72>gung
if ( lcl_SupportsCoreSQLGrammar(xConnection) )
{
xub_StrLen nCount = m_aFunctionStrings.GetTokenCount();
for (xub_StrLen nIdx = 0; nIdx < nCount; nIdx++)
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(nIdx));
}
else // sonst nur COUNT(*)
{
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(0));
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT
}
try
2001-03-01 14:45:02 +00:00
{
2001-07-12 11:14:47 +00:00
Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
if ( xMetaData.is() )
2001-07-12 11:14:47 +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
}
catch(Exception&)
{
}
2001-02-05 08:26:47 +00:00
}
Init();
}
//==============================================================================
OQueryDesignView* OSelectionBrowseBox::getDesignView()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OSL_ENSURE(static_cast<const OQueryDesignView*>(GetParent()),"Parent isn't an OQueryDesignView!");
return static_cast<OQueryDesignView*>(GetParent());
}
// -----------------------------------------------------------------------------
OQueryDesignView* OSelectionBrowseBox::getDesignView() const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OSL_ENSURE(static_cast<const OQueryDesignView*>(GetParent()),"Parent isn't an OQueryDesignView!");
return static_cast<OQueryDesignView*>(GetParent());
}
2002-08-19 07:01:32 +00:00
namespace
{
class OSelectionBrwBoxHeader : public ::svt::EditBrowserHeader
{
OSelectionBrowseBox* m_pBrowseBox;
2002-08-19 07:01:32 +00:00
protected:
virtual void Select();
public:
OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent);
2002-08-19 07:01:32 +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();
m_pBrowseBox->GrabFocus();
2002-08-19 07:01:32 +00:00
BrowserMode nMode = m_pBrowseBox->GetMode();
if ( 0 == m_pBrowseBox->GetSelectColumnCount() )
{
m_pBrowseBox->DeactivateCell();
// wenn es schon eine selektierte Spalte gibt, bin ich schon im richtigen Modus
if ( BROWSER_HIDESELECT == ( nMode & BROWSER_HIDESELECT ) )
{
nMode &= ~BROWSER_HIDESELECT;
nMode |= BROWSER_MULTISELECTION;
m_pBrowseBox->SetMode( nMode );
}
}
m_pBrowseBox->SelectColumnId( GetCurItemId() );
m_pBrowseBox->DeactivateCell();
2002-08-19 07:01:32 +00:00
}
}
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
// -----------------------------------------------------------------------------
BrowserHeader* OSelectionBrowseBox::imp_CreateHeaderBar(BrowseBox* /*pParent*/)
2002-08-19 07:01:32 +00:00
{
return new OSelectionBrwBoxHeader(this);
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::ColumnMoved( USHORT nColId,BOOL _bCreateUndo )
{
EditBrowseBox::ColumnMoved( nColId );
// swap the two columns
USHORT nNewPos = GetColumnPos( nColId );
OTableFields& rFields = getFields();
if ( rFields.size() > USHORT(nNewPos-1) )
{
USHORT nOldPos = 0;
OTableFields::iterator aEnd = rFields.end();
OTableFields::iterator aIter = rFields.begin();
for (; aIter != aEnd && ( (*aIter)->GetColumnId() != nColId ); ++aIter,++nOldPos)
;
OSL_ENSURE( (nNewPos-1) != nOldPos && nOldPos < rFields.size(),"Old and new position are equal!");
if ( aIter != aEnd )
2002-08-19 07:01:32 +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 )
{
OTabFieldMovedUndoAct* pUndoAct = new OTabFieldMovedUndoAct(this);
pUndoAct->SetColumnPosition( nOldPos + 1);
pUndoAct->SetTabFieldDescr(pOldEntry);
2002-08-19 07:01:32 +00:00
getDesignView()->getController().addUndoActionAndInvalidate(pUndoAct);
} // if ( !m_bInUndoMode && _bCreateUndo )
2002-08-19 07:01:32 +00:00
}
}
else
OSL_ENSURE(0,"Invalid column id!");
}
2001-02-05 08:26:47 +00:00
//------------------------------------------------------------------------------
void OSelectionBrowseBox::Init()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
EditBrowseBox::Init();
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
// set the header bar
BrowserHeader* pNewHeaderBar = CreateHeaderBar(this);
pNewHeaderBar->SetMouseTransparent(sal_False);
2002-08-19 07:01:32 +00:00
SetHeaderBar(pNewHeaderBar);
2002-08-19 07:01:32 +00:00
SetMode(m_nMode);
2001-02-05 08:26:47 +00:00
Font aFont( GetDataWindow().GetFont() );
aFont.SetWeight( WEIGHT_NORMAL );
GetDataWindow().SetFont( aFont );
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
Size aHeight;
const Control* pControls[] = { m_pTextCell,m_pVisibleCell,m_pTableCell,m_pFieldCell };
for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i)
{
const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
if ( aTemp.Height() > aHeight.Height() )
aHeight.Height() = aTemp.Height();
} // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i
SetDataRowHeight(aHeight.Height());
2001-02-05 08:26:47 +00:00
SetTitleLines(1);
// Anzahl der sichtbaren Zeilen ermitteln
for(long i=0;i<BROW_ROW_CNT;i++)
{
if(m_bVisibleRow[i])
m_nVisibleCount++;
}
RowInserted(0, m_nVisibleCount, sal_False);
try
2001-03-01 14:45:02 +00:00
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
if(xConnection.is())
{
Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
m_nMaxColumns = xMetaData.is() ? xMetaData->getMaxColumnsInSelect() : 0;
}
else
m_nMaxColumns = 0;
2001-03-01 14:45:02 +00:00
}
catch(const SQLException&)
{
OSL_ENSURE(0,"Catched Exception when asking for database metadata options!");
2001-03-01 14:45:02 +00:00
m_nMaxColumns = 0;
}
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
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
SetUpdateMode(sal_False);
if (GetCurRow() != 0)
GoToRow(0);
2001-04-30 12:02:01 +00:00
static_cast< OQueryController& >( getDesignView()->getController() ).clearFields();
2001-02-05 08:26:47 +00:00
DeactivateCell();
RemoveColumns();
2002-08-19 07:01:32 +00:00
InsertHandleColumn( HANDLE_COLUMN_WITDH );
2001-02-05 08:26:47 +00:00
SetUpdateMode(sal_True);
}
2001-04-30 12:02:01 +00:00
//------------------------------------------------------------------------------
void OSelectionBrowseBox::ClearAll()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
SetUpdateMode(sal_False);
OTableFields::reverse_iterator aIter = getFields().rbegin();
for ( ;aIter != getFields().rend(); ++aIter )
2001-04-30 12:02:01 +00:00
{
if ( !(*aIter)->IsEmpty() )
{
RemoveField( (*aIter)->GetColumnId() );
aIter = getFields().rbegin();
}
2001-04-30 12:02:01 +00:00
}
SetUpdateMode(sal_True);
}
2001-02-05 08:26:47 +00:00
//------------------------------------------------------------------------------
void OSelectionBrowseBox::SetReadOnly(sal_Bool bRO)
{
if (bRO)
{
DeactivateCell();
m_nMode &= ~BROWSER_HIDECURSOR;
SetMode(m_nMode);
}
else
{
m_nMode |= BROWSER_HIDECURSOR;
SetMode(m_nMode);
ActivateCell();
}
}
//------------------------------------------------------------------------------
CellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
if ( nColId > getFields().size() )
return NULL;
OTableFieldDescRef pEntry = getFields()[nColId-1];
DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::GetController : keine FieldDescription !");
2001-02-05 08:26:47 +00:00
if (!pEntry.isValid())
2001-02-05 08:26:47 +00:00
return NULL;
if (static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
2001-02-05 08:26:47 +00:00
return NULL;
long nCellIndex = GetRealRow(nRow);
switch (nCellIndex)
{
case BROW_FIELD_ROW:
return new ComboBoxCellController(m_pFieldCell);
2001-02-05 08:26:47 +00:00
case BROW_TABLE_ROW:
return new ListBoxCellController(m_pTableCell);
2001-02-05 08:26:47 +00:00
case BROW_VIS_ROW:
return new CheckBoxCellController(m_pVisibleCell);
2001-02-05 08:26:47 +00:00
case BROW_ORDER_ROW:
return new ListBoxCellController(m_pOrderCell);
2001-02-05 08:26:47 +00:00
case BROW_FUNCTION_ROW:
return new ListBoxCellController(m_pFunctionCell);
2001-02-05 08:26:47 +00:00
default:
return new EditCellController(m_pTextCell);
2001-02-05 08:26:47 +00:00
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColId)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OSL_ENSURE(nColId != BROWSER_INVALIDID,"An Invalid Id was set!");
if ( nColId == BROWSER_INVALIDID )
return;
USHORT nPos = GetColumnPos(nColId);
if ( nPos == 0 || nPos == BROWSER_INVALIDID || nPos > getFields().size() )
return;
OTableFieldDescRef pEntry = getFields()[nPos-1];
DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::InitController : keine FieldDescription !");
2001-02-05 08:26:47 +00:00
long nCellIndex = GetRealRow(nRow);
switch (nCellIndex)
{
case BROW_FIELD_ROW:
{
m_pFieldCell->Clear();
m_pFieldCell->SetText(String());
String aField(pEntry->GetField());
String aTable(pEntry->GetAlias());
getDesignView()->fillValidFields(aTable, m_pFieldCell);
// * durch alias.* ersetzen
if ((aField.GetChar(0) == '*') && aTable.Len())
{
aField = aTable;
aField.AppendAscii(".*");
}
m_pFieldCell->SetText(aField);
} break;
case BROW_TABLE_ROW:
{
m_pTableCell->Clear();
enableControl(pEntry,m_pTableCell);
if ( !pEntry->isCondition() )
2001-02-05 08:26:47 +00:00
{
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if (pTabWinList)
{
OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
for(;aIter != pTabWinList->end();++aIter)
m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName());
m_pTableCell->InsertEntry(String(ModuleRes(STR_QUERY_NOTABLE)), 0);
if (pEntry->GetAlias().getLength())
m_pTableCell->SelectEntry(pEntry->GetAlias());
else
m_pTableCell->SelectEntry(String(ModuleRes(STR_QUERY_NOTABLE)));
}
}
} break;
case BROW_VIS_ROW:
{
m_pVisibleCell->GetBox().Check(pEntry->IsVisible());
m_pVisibleCell->GetBox().SaveValue();
enableControl(pEntry,m_pTextCell);
2001-02-05 08:26:47 +00:00
if(!pEntry->IsVisible() && pEntry->GetOrderDir() != ORDER_NONE && !m_bOrderByUnRelated)
{
// Spalte muss sichtbar sein, um im ORDER BY aufzutauchen
pEntry->SetVisible(sal_True);
m_pVisibleCell->GetBox().Check(pEntry->IsVisible());
m_pVisibleCell->GetBox().SaveValue();
m_pVisibleCell->GetBox().Disable();
m_pVisibleCell->GetBox().EnableInput(sal_False);
String aMessage(ModuleRes(STR_QRY_ORDERBY_UNRELATED));
2001-02-08 14:33:28 +00:00
OQueryDesignView* paDView = getDesignView();
InfoBox(paDView, aMessage).Execute();
2001-02-05 08:26:47 +00:00
}
} break;
case BROW_ORDER_ROW:
m_pOrderCell->SelectEntryPos(
sal::static_int_cast< USHORT >(pEntry->GetOrderDir()));
enableControl(pEntry,m_pOrderCell);
break;
2001-02-05 08:26:47 +00:00
case BROW_COLUMNALIAS_ROW:
setTextCellContext(pEntry,pEntry->GetFieldAlias(),HID_QRYDGN_ROW_ALIAS);
2001-02-05 08:26:47 +00:00
break;
case BROW_FUNCTION_ROW:
setFunctionCell(pEntry);
break;
default:
2001-02-05 08:26:47 +00:00
{
sal_uInt16 nIdx = sal_uInt16(nCellIndex - BROW_CRIT1_ROW);
setTextCellContext(pEntry,pEntry->GetCriteria( nIdx ),HID_QRYDGN_ROW_CRIT);
}
}
Controller()->ClearModified();
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::notifyTableFieldChanged(const String& _sOldAlias,const String& _sAlias,sal_Bool& _bListAction,USHORT _nColumnId)
{
appendUndoAction(_sOldAlias,_sAlias,BROW_TABLE_ROW,_bListAction);
if ( m_bVisibleRow[BROW_TABLE_ROW] )
RowModified(GetBrowseRow(BROW_TABLE_ROW), _nColumnId);
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::notifyFunctionFieldChanged(const String& _sOldFunctionName,const String& _sFunctionName,sal_Bool& _bListAction,USHORT _nColumnId)
{
appendUndoAction(_sOldFunctionName,_sFunctionName,BROW_FUNCTION_ROW,_bListAction);
if ( !m_bVisibleRow[BROW_FUNCTION_ROW] )
SetRowVisible(BROW_FUNCTION_ROW, sal_True);
RowModified(GetBrowseRow(BROW_FUNCTION_ROW), _nColumnId);
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::clearEntryFunctionField(const String& _sFieldName,OTableFieldDescRef& _pEntry,sal_Bool& _bListAction,USHORT _nColumnId)
{
if ( isFieldNameAsterix( _sFieldName ) && (!_pEntry->isNoneFunction() || _pEntry->IsGroupBy()) )
{
String sFunctionName;
GetFunctionName(SQL_TOKEN_COUNT,sFunctionName);
String sOldLocalizedFunctionName = _pEntry->GetFunction();
if ( !sOldLocalizedFunctionName.Equals(sFunctionName) || _pEntry->IsGroupBy() )
{
// append undo action for the function field
_pEntry->SetFunctionType(FKT_NONE);
_pEntry->SetFunction(::rtl::OUString());
_pEntry->SetGroupBy(sal_False);
notifyFunctionFieldChanged(sOldLocalizedFunctionName,_pEntry->GetFunction(),_bListAction,_nColumnId);
}
}
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::fillColumnRef(const OSQLParseNode* _pColumnRef, const Reference< XConnection >& _rxConnection, OTableFieldDescRef& _pEntry, sal_Bool& _bListAction )
{
OSL_ENSURE(_pColumnRef,"No valid parsenode!");
::rtl::OUString sColumnName,sTableRange;
OSQLParseTreeIterator::getColumnRange(_pColumnRef,_rxConnection,sColumnName,sTableRange);
return fillColumnRef(sColumnName,sTableRange,_rxConnection->getMetaData(),_pEntry,_bListAction);
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::fillColumnRef(const ::rtl::OUString& _sColumnName,const ::rtl::OUString& _sTableRange,const Reference<XDatabaseMetaData>& _xMetaData,OTableFieldDescRef& _pEntry,sal_Bool& _bListAction)
{
sal_Bool bError = sal_False;
::comphelper::UStringMixEqual bCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
// check if the table name is the same
if ( _sTableRange.getLength() && (bCase(_pEntry->GetTable(),_sTableRange) || bCase(_pEntry->GetAlias(),_sTableRange)) )
{ // a table was already inserted and the tables contains that column name
if ( !_pEntry->GetTabWindow() )
{ // fill tab window
::rtl::OUString sOldAlias = _pEntry->GetAlias();
if ( !fillEntryTable(_pEntry,_pEntry->GetTable()) )
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
{
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if ( pTabWinList )
{
sal_uInt16 nTabCount = 0;
if ( !static_cast<OQueryTableView*>(getDesignView()->getTableView())->FindTableFromField(_sColumnName,_pEntry,nTabCount) ) // error occured: column not in table window
2001-02-05 08:26:47 +00:00
{
String sTitle(ModuleRes(STR_STAT_WARNING));
String sErrorMsg(ModuleRes(RID_STR_FIELD_DOESNT_EXIST));
sErrorMsg.SearchAndReplaceAscii("$name$",_sColumnName);
OSQLMessageBox aDlg(this,sTitle,sErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning);
aDlg.Execute();
bError = sal_True;
2001-02-05 08:26:47 +00:00
}
else
{
pEntryTab = static_cast<OQueryTableWindow*>(_pEntry->GetTabWindow());
notifyTableFieldChanged(String(),_pEntry->GetAlias(),_bListAction,GetCurColumnId());
2001-02-05 08:26:47 +00:00
}
}
}
if ( pEntryTab ) // here we got a valid table
_pEntry->SetField(_sColumnName);
return bError;
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDescRef& _pEntry,sal_Bool& _bListAction)
{
sal_Bool bError = sal_False;
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
// first look if the name can be found in our tables
sal_uInt16 nTabCount = 0;
String sOldAlias = _pEntry->GetAlias();
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;
}
Reference<XConnection> xConnection( rController.getConnection() );
Reference< XDatabaseMetaData > xMetaData;
if ( xConnection.is() )
xMetaData = xConnection->getMetaData();
OSL_ENSURE( xMetaData.is(), "OSelectionBrowseBox::saveField: invalid connection/meta data!" );
if ( !xMetaData.is() )
return sal_True;
::rtl::OUString sErrorMsg;
// second test if the name can be set as select columns in a pseudo statement
// we have to look which entries we should quote
size_t nPass = 4;
::connectivity::OSQLParser& rParser( rController.getParser() );
OSQLParseNode* pParseNode = NULL;
// 4 passes in trying to interprete the field name
// - 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
do
{
bool bQuote = ( nPass <= 2 );
bool bInternational = ( nPass % 2 ) == 0;
::rtl::OUString sSql;
sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT "));
if ( bQuote )
sSql += ::dbtools::quoteName( xMetaData->getIdentifierQuoteString(), _sFieldName );
else
sSql += _sFieldName;
sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x"));
pParseNode = rParser.parseTree( sErrorMsg, sSql, bInternational );
}
while ( ( pParseNode == NULL ) && ( --nPass > 0 ) );
if ( pParseNode == NULL )
{
// something different which we have to check (may be a select statement)
String sErrorMessage( ModuleRes( STR_QRY_COLUMN_NOT_FOUND ) );
sErrorMessage.SearchAndReplaceAscii("$name$",_sFieldName);
OSQLMessageBox aDlg( this,
String( ModuleRes( STR_STAT_WARNING ) ), sErrorMessage,
WB_OK | WB_DEF_OK, OSQLMessageBox::Warning );
aDlg.Execute();
return sal_True;
}
// we got a valid select column
// find what type of column has be inserted
::connectivity::OSQLParseNode* pSelection = pParseNode->getChild(2);
if ( SQL_ISRULE(pSelection,selection) ) // we found the asterix
{
_pEntry->SetField(_sFieldName);
clearEntryFunctionField(_sFieldName,_pEntry,_bListAction,_pEntry->GetColumnId());
} // travel through the select column parse node
else
{
::comphelper::UStringMixEqual bCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
OTableFieldDescRef aSelEntry = _pEntry;
USHORT nColumnId = aSelEntry->GetColumnId();
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
{
USHORT nColumnPostion;
aSelEntry = FindFirstFreeCol(nColumnPostion);
if ( !aSelEntry.isValid() )
{
AppendNewCol(1);
aSelEntry = FindFirstFreeCol(nColumnPostion);
}
++nColumnPostion;
nColumnId = GetColumnId(nColumnPostion);
}
::connectivity::OSQLParseNode* pChild = pSelection->getChild( i );
OSL_ENSURE(SQL_ISRULE(pChild,derived_column), "No derived column found!");
// get the column alias
::rtl::OUString sColumnAlias = OSQLParseTreeIterator::getColumnAlias(pChild);
if ( sColumnAlias.getLength() ) // we found an as clause
{
String aSelectionAlias = aSelEntry->GetFieldAlias();
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);
}
::connectivity::OSQLParseNode* pColumnRef = pChild->getChild(0);
if (
pColumnRef->count() == 3 &&
SQL_ISPUNCTUATION(pColumnRef->getChild(0),"(") &&
SQL_ISPUNCTUATION(pColumnRef->getChild(2),")")
)
pColumnRef = pColumnRef->getChild(1);
if ( SQL_ISRULE(pColumnRef,column_ref) ) // we found a valid column name or more column names
{
// look if we can find the corresponding table
bError = fillColumnRef( pColumnRef, xConnection, aSelEntry, _bListAction );
// 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);
}
else
{
// first check if we have a aggregate function and only a function
if ( SQL_ISRULE(pColumnRef,general_set_fct) )
{
String sLocalizedFunctionName;
if ( GetFunctionName(pColumnRef->getChild(0)->getTokenID(),sLocalizedFunctionName) )
{
String sOldLocalizedFunctionName = aSelEntry->GetFunction();
aSelEntry->SetFunction(sLocalizedFunctionName);
sal_uInt32 nFunCount = pColumnRef->count() - 1;
sal_Int32 nFunctionType = FKT_AGGREGATE;
sal_Bool bQuote = sal_False;
// 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
bError = fillColumnRef( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), ::rtl::OUString(), xMetaData, aSelEntry, _bListAction );
else
{
nFunctionType |= FKT_NUMERIC;
bQuote = sal_True;
aSelEntry->SetDataType(DataType::DOUBLE);
aSelEntry->SetFieldType(TAB_NORMAL_FIELD);
}
// now parse the parameters
::rtl::OUString sParameters;
for(sal_uInt32 function = 2; function < nFunCount; ++function) // we only want to parse the parameters of the function
pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, bQuote );
aSelEntry->SetFunctionType(nFunctionType);
aSelEntry->SetField(sParameters);
if ( aSelEntry->IsGroupBy() )
{
sOldLocalizedFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1);
aSelEntry->SetGroupBy(sal_False);
}
// append undo action
notifyFunctionFieldChanged(sOldLocalizedFunctionName,sLocalizedFunctionName,_bListAction, nColumnId);
}
else
OSL_ENSURE(0,"Unsupported function inserted!");
}
else if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) ||
SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) ||
SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
// a calculation has been found ( can be calc and function )
{
// append the whole text as field name
// so we first clear the function field
clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId);
sal_Bool bQuote = sal_True;
sal_Int32 nDataType = DataType::DOUBLE;
OSQLParseNode* pFunctionName = pColumnRef->getChild(0);
if ( !SQL_ISPUNCTUATION(pFunctionName,"{") )
{
if ( SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
pFunctionName = pFunctionName->getChild(0);
if ( pFunctionName )
{
::rtl::OUString sFunctionName = pFunctionName->getTokenValue();
if ( !sFunctionName.getLength() )
sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_MS_1252);
nDataType = OSQLParser::getFunctionReturnType(
sFunctionName
,&rController.getParser().getContext());
aSelEntry->SetDataType(nDataType);
}
}
// now parse the whole statement
sal_uInt32 nFunCount = pColumnRef->count();
::rtl::OUString sParameters;
for(sal_uInt32 function = 0; function < nFunCount; ++function)
pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, bQuote );
::rtl::OUString aSelectionAlias = aSelEntry->GetAlias();
aSelEntry->SetAlias(::rtl::OUString());
sal_Int32 nNewFunctionType = aSelEntry->GetFunctionType() | FKT_NUMERIC | FKT_OTHER;
aSelEntry->SetFunctionType(nNewFunctionType);
aSelEntry->SetFieldType(TAB_NORMAL_FIELD);
aSelEntry->SetTabWindow(NULL);
aSelEntry->SetField(sParameters);
notifyTableFieldChanged(aSelectionAlias,aSelEntry->GetAlias(),_bListAction, nColumnId);
}
else
{
clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId);
::rtl::OUString aColumns;
pColumnRef->parseNodeToStr( aColumns,
xConnection,
&rController.getParser().getContext(),
sal_True,
sal_True);
// get the type out of the funtion name
sal_Int32 nDataType = DataType::DOUBLE;
aSelEntry->SetDataType(nDataType);
aSelEntry->SetField(aColumns);
aSelEntry->SetFieldType(TAB_NORMAL_FIELD);
aSelEntry->SetTabWindow(NULL);
aSelEntry->SetAlias(::rtl::OUString());
aSelEntry->SetFieldAlias(sColumnAlias);
aSelEntry->SetFunctionType(FKT_NUMERIC | FKT_OTHER);
notifyTableFieldChanged(sOldAlias,aSelEntry->GetAlias(),_bListAction, nColumnId);
}
}
if ( i > 0 && InsertField(aSelEntry,BROWSER_INVALIDID,sal_True,sal_False).isEmpty() ) // may we have to append more than one field
{ // the field could not be isnerted
String sErrorMessage( ModuleRes( RID_STR_FIELD_DOESNT_EXIST ) );
sErrorMessage.SearchAndReplaceAscii("$name$",aSelEntry->GetField());
OSQLMessageBox aDlg( this,
String( ModuleRes( STR_STAT_WARNING ) ), sErrorMessage,
WB_OK | WB_DEF_OK, OSQLMessageBox::Warning );
aDlg.Execute();
bError = sal_True;
}
2001-02-05 08:26:47 +00:00
}
}
delete pParseNode;
2001-02-05 08:26:47 +00:00
return bError;
}
2001-02-05 08:26:47 +00:00
//------------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::SaveModified()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
OTableFieldDescRef pEntry = NULL;
USHORT nCurrentColumnPos = GetColumnPos(GetCurColumnId());
if(getFields().size() > static_cast<USHORT>(nCurrentColumnPos - 1))
pEntry = getEntry(nCurrentColumnPos - 1);
2001-02-05 08:26:47 +00:00
sal_Bool bWasEmpty = pEntry.isValid() ? pEntry->IsEmpty() : sal_False;
2001-04-18 10:44:59 +00:00
sal_Bool bError = sal_False;
sal_Bool bListAction = sal_False;
2001-02-05 08:26:47 +00:00
if (pEntry.isValid() && Controller().Is() && Controller()->IsModified())
2001-02-05 08:26:47 +00:00
{
// fuer die Undo-Action
2001-04-18 10:44:59 +00:00
String strOldCellContents,sNewValue;
2001-02-05 08:26:47 +00:00
long nRow = GetRealRow(GetCurRow());
sal_Bool bAppendRow = sal_False;
2001-02-05 08:26:47 +00:00
switch (nRow)
{
case BROW_VIS_ROW:
{
sal_Bool bOldValue = m_pVisibleCell->GetBox().GetSavedValue() != STATE_NOCHECK;
2001-04-18 07:38:19 +00:00
strOldCellContents = bOldValue ? g_strOne : g_strZero;
2001-04-18 10:44:59 +00:00
sNewValue = !bOldValue ? g_strOne : g_strZero;
}
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
{
pEntry->SetVisible(sal_True);
m_pVisibleCell->GetBox().Check();
}
break;
case BROW_FIELD_ROW:
{
String aFieldName(m_pFieldCell->GetText());
try
2001-02-05 08:26:47 +00:00
{
if (!aFieldName.Len())
{
OTableFieldDescRef pNewEntry = new OTableFieldDesc();
pNewEntry->SetColumnId( pEntry->GetColumnId() );
::std::replace(getFields().begin(),getFields().end(),pEntry,pNewEntry);
sal_uInt16 nCol = GetCurColumnId();
for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen
RowModified(i,nCol);
}
else
{
strOldCellContents = pEntry->GetField();
bListAction = sal_True;
if ( !m_bInUndoMode )
rController.getUndoMgr()->EnterListAction(String(),String());
USHORT nPos = m_pFieldCell->GetEntryPos(aFieldName);
String aAliasName = pEntry->GetAlias();
if ( nPos != COMBOBOX_ENTRY_NOTFOUND && !aAliasName.Len() && aFieldName.GetTokenCount('.') > 1 )
{ // special case, we have a table field so we must cut the table name
String sTableAlias = aFieldName.GetToken(0,'.');
pEntry->SetAlias(sTableAlias);
String sColumnName = aFieldName.Copy(sTableAlias.Len()+1,aFieldName.Len() - sTableAlias.Len() -1);
Reference<XConnection> xConnection = rController.getConnection();
if ( !xConnection.is() )
return sal_False;
bError = fillColumnRef( sColumnName, sTableAlias, xConnection->getMetaData(), pEntry, bListAction );
}
else
bError = sal_True;
if ( bError )
bError = saveField(aFieldName,pEntry,bListAction);
}
}
catch(Exception&)
{
bError = sal_True;
}
if ( bError )
{
sNewValue = aFieldName;
if ( !m_bInUndoMode )
static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
bListAction = sal_False;
2001-02-05 08:26:47 +00:00
}
else
sNewValue = pEntry->GetField();
rController.InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
2001-02-05 08:26:47 +00:00
}
break;
case BROW_TABLE_ROW:
{
String aAliasName = m_pTableCell->GetSelectEntry();
strOldCellContents = pEntry->GetAlias();
if ( m_pTableCell->GetSelectEntryPos() != 0 )
2001-02-05 08:26:47 +00:00
{
pEntry->SetAlias(aAliasName);
// we have to set the table name as well as the table window
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if (pTabWinList)
2001-02-05 08:26:47 +00:00
{
OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(aAliasName);
if(aIter != pTabWinList->end())
2001-02-05 08:26:47 +00:00
{
OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
if (pEntryTab)
{
pEntry->SetTable(pEntryTab->GetTableName());
pEntry->SetTabWindow(pEntryTab);
}
2001-02-05 08:26:47 +00:00
}
}
}
else
{
pEntry->SetAlias(::rtl::OUString());
pEntry->SetTable(::rtl::OUString());
pEntry->SetTabWindow(NULL);
}
sNewValue = pEntry->GetAlias();
2001-02-05 08:26:47 +00:00
} break;
case BROW_ORDER_ROW:
{
strOldCellContents = String::CreateFromInt32((sal_uInt16)pEntry->GetOrderDir());
2001-02-05 08:26:47 +00:00
sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos();
if (nIdx == sal_uInt16(-1))
nIdx = 0;
pEntry->SetOrderDir(EOrderDir(nIdx));
if(!m_bOrderByUnRelated)
{
pEntry->SetVisible(sal_True);
m_pVisibleCell->GetBox().Check();
RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId());
}
2001-04-18 10:44:59 +00:00
sNewValue = String::CreateFromInt32((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();
sal_uInt16 nPos = m_pFunctionCell->GetSelectEntryPos();
// Diese Funktionen stehen nur unter CORE zur Verf<72>gung
String sFunctionName = m_pFunctionCell->GetEntry(nPos);
String sGroupFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1);
sal_Bool bGroupBy = sal_False;
if ( sGroupFunctionName.Equals(sFunctionName) ) // check if the function name is GROUP
2001-02-05 08:26:47 +00:00
{
bGroupBy = sal_True;
if ( !m_bGroupByUnRelated && !pEntry->IsVisible() )
{
// we have to change the visblie flag, so we must append also an undo action
pEntry->SetVisible(sal_True);
m_pVisibleCell->GetBox().Check();
appendUndoAction(g_strZero,g_strOne,BROW_VIS_ROW,bListAction);
RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId());
}
pEntry->SetFunction(String());
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
{
sFunctionName = String();
2001-02-05 08:26:47 +00:00
pEntry->SetFunction(String());
pEntry->SetFunctionType(pEntry->GetFunctionType() & ~FKT_AGGREGATE );
2001-02-05 08:26:47 +00:00
}
pEntry->SetGroupBy(bGroupBy);
sNewValue = sFunctionName;
2001-02-05 08:26:47 +00:00
}
break;
default:
{
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
sal_uInt16 nIdx = sal_uInt16(nRow - BROW_CRIT1_ROW);
2001-02-05 08:26:47 +00:00
String aText = m_pTextCell->GetText();
aText.EraseLeadingChars();
::rtl::OUString aCrit;
if(aText.Len())
{
2001-09-27 05:19:05 +00:00
::rtl::OUString aErrorMsg;
2001-02-05 08:26:47 +00:00
Reference<XPropertySet> xColumn;
2001-09-27 05:19:05 +00:00
OSQLParseNode* pParseNode = getDesignView()->getPredicateTreeFromEntry(pEntry,aText,aErrorMsg,xColumn);
2001-02-05 08:26:47 +00:00
if (pParseNode)
{
pParseNode->parseNodeToPredicateStr(aCrit,
xConnection,
static_cast<OQueryController&>(getDesignView()->getController()).getNumberFormatter(),
2001-02-05 08:26:47 +00:00
xColumn,
getDesignView()->getLocale(),
static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
&(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
2001-02-05 08:26:47 +00:00
delete pParseNode;
}
else
{
if(xColumn.is())
{
sal_Int32 nType = 0;
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
switch(nType)
{
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
2001-09-27 05:19:05 +00:00
if(aText.GetChar(0) != '\'' || aText.GetChar(aText.Len() -1) != '\'')
2001-02-05 08:26:47 +00:00
{
2001-09-27 05:19:05 +00:00
aText.SearchAndReplaceAll(String::CreateFromAscii("'"),String::CreateFromAscii("''"));
2001-02-05 08:26:47 +00:00
String aTmp(String::CreateFromAscii("'"));
2001-09-27 05:19:05 +00:00
(aTmp += aText) += String::CreateFromAscii("'");
aText = aTmp;
2001-02-05 08:26:47 +00:00
}
break;
default:
;
}
::connectivity::OSQLParser& rParser = static_cast<OQueryController&>(getDesignView()->getController()).getParser();
pParseNode = rParser.predicateTree(aErrorMsg,
2001-09-27 05:19:05 +00:00
aText,
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,
xConnection,
static_cast<OQueryController&>(getDesignView()->getController()).getNumberFormatter(),
2001-02-05 08:26:47 +00:00
xColumn,
getDesignView()->getLocale(),
static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
&(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
2001-02-05 08:26:47 +00:00
delete pParseNode;
}
else
{
if ( !m_bDisableErrorBox )
{
String sTitle(ModuleRes(STR_STAT_WARNING));
OSQLMessageBox aDlg(this,sTitle,aErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning);
aDlg.Execute();
}
2001-02-05 08:26:47 +00:00
bError = sal_True;
}
}
else
{
if ( !m_bDisableErrorBox )
{
String sTitle(ModuleRes(STR_STAT_WARNING));
OSQLMessageBox aDlg(this,sTitle,aErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning);
aDlg.Execute();
}
2001-02-05 08:26:47 +00:00
bError = sal_True;
}
}
2001-09-27 05:19:05 +00:00
// }
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);
2001-02-05 08:26:47 +00:00
if(aCrit.getLength() && nRow >= (GetRowCount()-1))
bAppendRow = sal_True;
2001-02-05 08:26:47 +00:00
}
}
if(!bError && Controller())
Controller()->ClearModified();
RowModified(GetCurRow(), GetCurColumnId());
if ( bAppendRow )
{
RowInserted( GetRowCount()-1, 1, TRUE );
m_bVisibleRow.push_back(sal_True);
++m_nVisibleCount;
}
if(!bError)
{
// und noch die Undo-Action fuer das Ganze
2001-04-18 10:44:59 +00:00
appendUndoAction(strOldCellContents,sNewValue,nRow);
}
2001-02-05 08:26:47 +00:00
}
// habe ich Daten in einer FieldDescription gespeichert, die vorher leer war und es nach den Aenderungen nicht mehr ist ?
if ( pEntry.isValid() && bWasEmpty && !pEntry->IsEmpty() && !bError )
2001-02-05 08:26:47 +00:00
{
// Default auf sichtbar
pEntry->SetVisible(sal_True);
appendUndoAction(g_strZero,g_strOne,BROW_VIS_ROW,bListAction);
2001-02-05 08:26:47 +00:00
RowModified(BROW_VIS_ROW, GetCurColumnId());
// wenn noetig neue freie Spalten anlegen
2002-08-19 07:01:32 +00:00
USHORT nDummy;
2001-02-05 08:26:47 +00:00
CheckFreeColumns(nDummy);
}
if ( bListAction && !m_bInUndoMode )
static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
2001-02-05 08:26:47 +00:00
return pEntry != NULL && !bError;
}
//------------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::SeekRow(long nRow)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
sal_Bool bRet = sal_False;
m_nSeekRow = nRow;
if (nRow < m_nVisibleCount )
bRet = sal_True;
return bRet;
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
rDev.SetClipRegion( rRect );
OTableFieldDescRef pEntry = NULL;
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColumnId);
if(getFields().size() > sal_uInt16(nPos - 1))
pEntry = getFields()[nPos - 1];
2001-02-05 08:26:47 +00:00
if (!pEntry.isValid())
2001-02-05 08:26:47 +00:00
return;
long nRow = GetRealRow(m_nSeekRow);
if (nRow == BROW_VIS_ROW)
PaintTristate(rDev, rRect, pEntry->IsVisible() ? STATE_CHECK : STATE_NOCHECK);
else
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
rDev.DrawText(rRect, GetCellText(nRow, nColumnId),TEXT_DRAW_VCENTER);
2001-02-05 08:26:47 +00:00
rDev.SetClipRegion( );
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
Rectangle aRect(rRect);
aRect.TopLeft().Y() -= 2;
2001-02-05 08:26:47 +00:00
String aLabel(ModuleRes(STR_QUERY_HANDLETEXT));
// ab BROW_CRIT2_ROW werden alle Zeilen mit "oder" angegeben
2001-02-23 14:04:37 +00:00
xub_StrLen nToken = (xub_StrLen) (m_nSeekRow >= GetBrowseRow(BROW_CRIT2_ROW))
2001-02-05 08:26:47 +00:00
?
2001-02-23 14:04:37 +00:00
xub_StrLen(BROW_CRIT2_ROW) : xub_StrLen(GetRealRow(m_nSeekRow));
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
rDev.DrawText(aRect, aLabel.GetToken(nToken),TEXT_DRAW_VCENTER);
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
void OSelectionBrowseBox::RemoveColumn(USHORT _nColumnId)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
2001-04-30 12:02:01 +00:00
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(_nColumnId);
2001-02-05 08:26:47 +00:00
// das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn
2002-08-19 07:01:32 +00:00
DBG_ASSERT((nPos == 0) || (nPos <= getFields().size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId");
2001-02-05 08:26:47 +00:00
// ColId ist bei mir gleichbedeutend mit Position, und da sollte die Bedingung natuerlich zutreffen
sal_uInt16 nCurCol = GetCurColumnId();
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 );
InsertDataColumn( _nColumnId , String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND);
2001-02-05 08:26:47 +00:00
// Neuzeichnen
2002-08-19 07:01:32 +00:00
Rectangle aInvalidRect = GetInvalidRect( _nColumnId );
2001-02-05 08:26:47 +00:00
Invalidate( aInvalidRect );
ActivateCell( nCurrentRow, nCurCol );
2001-02-05 08:26:47 +00:00
rController.setModified();
2001-02-05 08:26:47 +00:00
invalidateUndoRedo();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::RemoveField(sal_uInt16 nColumnId )
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColumnId);
OSL_ENSURE(getFields().size() > sal_uInt16(nPos-1),"ID is to great!");
2001-04-30 12:02:01 +00:00
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pDesc = getEntry((sal_uInt32)(nPos - 1)) ;
pDesc->SetColWidth( (sal_uInt16)GetColumnWidth(nColumnId) ); // hat er sich vorher leider nicht gemerkt
2001-02-05 08:26:47 +00:00
// UndoAction erzeugen
if ( !m_bInUndoMode )
{
OTabFieldDelUndoAct* pUndoAction = new OTabFieldDelUndoAct( this );
pUndoAction->SetTabFieldDescr(pDesc);
pUndoAction->SetColumnPosition(nPos);
rController.addUndoActionAndInvalidate( pUndoAction );
}
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
invalidateUndoRedo();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::adjustSelectionMode( sal_Bool _bClickedOntoHeader, sal_Bool _bClickedOntoHandleCol )
2001-02-05 08:26:47 +00:00
{
// wenn ein Header selectiert wird, mu<6D> die selection angezeigt werden, sonst nicht)
if ( _bClickedOntoHeader )
2001-02-05 08:26:47 +00:00
{
if (0 == GetSelectColumnCount() )
// wenn es schon eine selektierte Spalte gibt, bin ich schon im richtigen Modus
if ( BROWSER_HIDESELECT == ( m_nMode & BROWSER_HIDESELECT ) )
2001-02-05 08:26:47 +00:00
{
m_nMode &= ~BROWSER_HIDESELECT;
m_nMode |= BROWSER_MULTISELECTION;
SetMode( m_nMode );
2001-02-05 08:26:47 +00:00
}
}
else if ( BROWSER_HIDESELECT != ( m_nMode & BROWSER_HIDESELECT ) )
{
if ( GetSelectColumnCount() != 0 )
SetNoSelection();
if ( _bClickedOntoHandleCol )
{
m_nMode |= BROWSER_HIDESELECT;
m_nMode &= ~BROWSER_MULTISELECTION;
SetMode( m_nMode );
2001-02-05 08:26:47 +00:00
}
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
if( rEvt.IsLeft() )
{
sal_Bool bOnHandle = HANDLE_ID == rEvt.GetColumnId();
sal_Bool bOnHeader = ( rEvt.GetRow() < 0 ) && !bOnHandle;
adjustSelectionMode( bOnHeader, bOnHandle );
}
EditBrowseBox::MouseButtonDown(rEvt);
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::MouseButtonUp(const BrowserMouseEvent& rEvt)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
EditBrowseBox::MouseButtonUp( rEvt );
static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::KeyInput( const KeyEvent& rEvt )
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
if (IsColumnSelected(GetCurColumnId()))
{
if (rEvt.GetKeyCode().GetCode() == KEY_DELETE && // Delete rows
!rEvt.GetKeyCode().IsShift() &&
!rEvt.GetKeyCode().IsMod1())
{
RemoveField(GetCurColumnId());
return;
}
}
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
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
sal_Int8 nDropAction = DND_ACTION_NONE;
if ( rEvt.GetRow() >= -1 )
{
if ( IsEditing() )
{
// #100271# OJ allow the asterix again
m_bDisableErrorBox = sal_True;
SaveModified();
m_bDisableErrorBox = sal_False;
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
return nDropAction;
2001-03-30 12:06:46 +00:00
}
//------------------------------------------------------------------------------
sal_Int8 OSelectionBrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& _rEvt )
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
TransferableDataHelper aDropped(_rEvt.maDropEvent.Transferable);
if (!OJoinExchObj::isFormatAvailable(aDropped.GetDataFlavorExVector()))
2001-02-05 08:26:47 +00:00
{
2001-03-30 12:06:46 +00:00
DBG_ERROR("OSelectionBrowseBox::ExecuteDrop: this should never have passed AcceptDrop!");
return DND_ACTION_NONE;
2001-02-05 08:26:47 +00:00
}
2001-03-30 12:06:46 +00:00
OTableFieldDesc aInfo;
// Einfuegen des Feldes an der gewuenschten Position
OJoinExchangeData jxdSource = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable);
InsertField(jxdSource);
return DND_ACTION_LINK;
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
OTableFieldDescRef OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
// es koennen mehrere angelegt werden, aber der Erste
// wird returnt
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);
USHORT nColumnId = sal::static_int_cast< USHORT >(getFields().size());
2002-08-19 07:01:32 +00:00
pEmptyEntry->SetColumnId( nColumnId );
InsertDataColumn( nColumnId , String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND);
2001-02-05 08:26:47 +00:00
}
return getFields()[nCount];
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::DeleteFields(const String& rAliasName)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
if (!getFields().empty())
2001-02-05 08:26:47 +00:00
{
sal_uInt16 nColId = GetCurColumnId();
sal_uInt32 nRow = GetCurRow();
2001-10-26 06:49:36 +00:00
sal_Bool bWasEditing = IsEditing();
if (bWasEditing)
2001-02-05 08:26:47 +00:00
DeactivateCell();
OTableFields::reverse_iterator aIter = getFields().rbegin();
OTableFieldDescRef pEntry = NULL;
for(USHORT nPos=sal::static_int_cast< USHORT >(getFields().size());aIter != getFields().rend();++aIter,--nPos)
2001-02-05 08:26:47 +00:00
{
pEntry = *aIter;
if ( pEntry->GetAlias().equals( rAliasName ) )
{
RemoveField( GetColumnId( nPos ) );
break;
}
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)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2001-10-26 06:49:36 +00:00
sal_Bool bWasEditing = IsEditing();
if (bWasEditing)
2001-02-05 08:26:47 +00:00
DeactivateCell();
// die Basisklasse machen lassen
SetColumnWidth(nColId, nNewWidth);
// der FieldDescription Bescheid sagen
OTableFieldDescRef pEntry = getEntry(GetColumnPos(nColId) - 1);
if (pEntry.isValid())
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());
}
//------------------------------------------------------------------------------
Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId )
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
//////////////////////////////////////////////////////////////////////
// Rechteck ist erst einmal der gesamte Outputbereich des Fensters
Rectangle aInvalidRect( Point(0,0), GetOutputSizePixel() );
//////////////////////////////////////////////////////////////////////
// Dann wird die linke Seite angepasst
2001-02-14 13:54:12 +00:00
Rectangle aFieldRect(GetCellRect( 0, nColId )); // used instead of GetFieldRectPixel
2001-02-05 08:26:47 +00:00
aInvalidRect.Left() = aFieldRect.Left();
return aInvalidRect;
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
void OSelectionBrowseBox::InsertColumn(OTableFieldDescRef pEntry, USHORT& _nColumnPostion)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
// das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn
2002-08-19 07:01:32 +00:00
DBG_ASSERT(_nColumnPostion == BROWSER_INVALIDID || (_nColumnPostion <= (long)getFields().size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId.");
2001-02-05 08:26:47 +00:00
// -1 heisst ganz hinten, Count heisst ganz hinten, der Rest bezeichnet eine richtige Position
sal_uInt16 nCurCol = GetCurColumnId();
long nCurrentRow = GetCurRow();
2001-02-05 08:26:47 +00:00
DeactivateCell();
2002-08-19 07:01:32 +00:00
// remember the column id of the current positon
USHORT nColumnId = GetColumnId(_nColumnPostion);
2001-02-05 08:26:47 +00:00
// Wenn zu klein oder zu gross, auf Ende der Liste setzen
2002-08-19 07:01:32 +00:00
if ((_nColumnPostion == BROWSER_INVALIDID) || (_nColumnPostion >= getFields().size())) // Anhaengen des Feldes
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
if (FindFirstFreeCol(_nColumnPostion) == NULL) // keine freie Column mehr
2001-02-05 08:26:47 +00:00
{
AppendNewCol(1);
_nColumnPostion = sal::static_int_cast< USHORT >(
getFields().size());
2001-02-05 08:26:47 +00:00
}
else
2002-08-19 07:01:32 +00:00
++_nColumnPostion; // innerhalb der vorgegebenen Liste
nColumnId = GetColumnId(_nColumnPostion);
pEntry->SetColumnId( nColumnId );
getFields()[ _nColumnPostion - 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 )
{
USHORT nOldPosition = GetColumnPos(pEntry->GetColumnId());
OSL_ENSURE( nOldPosition != 0,"Old position was 0. Not possible!");
SetColumnPos(pEntry->GetColumnId(),_nColumnPostion);
// 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;
ColumnMoved(pEntry->GetColumnId(),FALSE);
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
} // if ( pEntry->GetColumnId() != nColumnId )
if ( pEntry->GetFunctionType() & (FKT_AGGREGATE) )
{
String sFunctionName = pEntry->GetFunction();
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
CWS-TOOLING: integrate CWS dba31d 2008-12-08 16:22:07 +0100 rt r265005 : Remove DOS lineends 2008-12-05 13:56:24 +0100 fs r264906 : #i10000# removed unreachable statement 2008-11-20 11:41:26 +0100 fs r264037 : merged in the fix for #i95865# (it was wrongly committed to CWS dba32a, should have been here) 2008-11-20 11:34:24 +0100 fs r264036 : line ends 2008-11-14 08:44:50 +0100 lla r263665 : #i10000# comparsion between int and uint fixed 2008-11-13 13:31:12 +0100 lla r263641 : #i10000# build problem fixed 2008-11-13 11:20:01 +0100 lla r263625 : #i96130# hard code name of extension 2008-11-12 11:13:41 +0100 fs r263582 : #i96096# when opening a SRB-report fails due to the missing SRB extension, log this as warning only, and proceed with the migration 2008-11-12 11:11:35 +0100 fs r263581 : #i96096# ContentType handling. Now all contents deliver proper results in XContent::getContentType 2008-11-12 11:10:11 +0100 fs r263580 : #i96096# new ctors taking UNO_QUERY_THROW 2008-11-11 10:10:13 +0100 lla r263546 : CWS-TOOLING: rebase CWS dba31d to trunk@263288 (milestone: DEV300:m35) 2008-11-06 15:55:39 +0100 oj r263393 : #i93452# get field from model fallbackis the name 2008-11-06 15:31:47 +0100 oj r263392 : #i93465# remeber location of floating windows 2008-11-06 13:36:24 +0100 oj r263381 : #i93450# check typemap for null 2008-11-06 13:28:49 +0100 oj r263379 : #i93020# empty column list boxes when new relation should be created 2008-11-06 12:33:53 +0100 oj r263377 : #i93012# set border to default : flat 2008-11-06 12:26:54 +0100 oj r263375 : #i74927# do some less calls for odbc 2008-11-06 09:34:01 +0100 oj r263362 : #i93383# grabFocus in suspend to get allmodified cells 2008-11-03 21:01:39 +0100 oj r263308 : #i86739# check if slash can be valid for tables 2008-11-03 14:40:21 +0100 oj r263287 : #i86739# check if slash can be valid for tables 2008-11-03 14:32:17 +0100 oj r263286 : #i95227# column width 2008-11-03 14:27:26 +0100 oj r263285 : link fwe 2008-11-03 14:24:54 +0100 oj r263284 : #i95235# changed to hold no ref only weak 2008-10-31 11:21:48 +0100 oj r262859 : #i93459# set images add menu entry 2008-10-31 09:06:37 +0100 oj r262851 : #i88629# correct fileopen filter for database odb files 2008-10-30 15:01:04 +0100 oj r262828 : #i95229# set filter at the composer 2008-10-29 15:57:41 +0100 oj r262817 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:19 +0100 oj r262816 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:03 +0100 oj r262815 : #i95235# changed to hold no ref only weak 2008-10-29 15:56:15 +0100 oj r262814 : #i95235# filtermanger changed to hold no ref only weak 2008-10-29 10:32:39 +0100 oj r262773 : #i93474# use correct table name 2008-10-28 13:49:33 +0100 lla r262744 : #i95524# make an Invalidate and refresh on Tables 2008-10-28 10:45:02 +0100 fs r262707 : line ends 2008-10-28 10:34:42 +0100 fs r262706 : #i95522# don't expect the component to live in a TopWindow 2008-10-28 08:30:40 +0100 lla r262696 : #i93176# set preview mode on view 2008-10-28 07:56:57 +0100 oj r262694 : merge cvs svn 2008-10-27 14:13:51 +0100 oj r262673 : #i94129# use dummy data 2008-10-27 12:38:45 +0100 fs r262669 : #i94125# rework ScrollColumns 2008-10-23 15:53:57 +0200 oj r262624 : #i94568# do not load the embeddedobj just copy the storage 2008-10-23 14:39:14 +0200 oj r262622 : #i94129# handle chart correctly 2008-10-22 10:51:19 +0200 lla r262582 : #i94115# problem with left walk chart shape fixed 2008-10-22 07:47:48 +0200 oj r262576 : #i94455# rename now do not use remove insert 2008-10-22 07:47:27 +0200 oj r262575 : #i94455# rename now do not use remove insert 2008-10-21 12:46:26 +0200 lla r262567 : #i93845# extra check if default schema doesn't exists, fix assertion
2008-12-09 07:25:38 +00:00
nColumnId = pEntry->GetColumnId();
SetColWidth(nColumnId,getDesignView()->getColWidth(GetColumnPos(nColumnId)-1));
2001-02-05 08:26:47 +00:00
// Neuzeichnen
CWS-TOOLING: integrate CWS dba31d 2008-12-08 16:22:07 +0100 rt r265005 : Remove DOS lineends 2008-12-05 13:56:24 +0100 fs r264906 : #i10000# removed unreachable statement 2008-11-20 11:41:26 +0100 fs r264037 : merged in the fix for #i95865# (it was wrongly committed to CWS dba32a, should have been here) 2008-11-20 11:34:24 +0100 fs r264036 : line ends 2008-11-14 08:44:50 +0100 lla r263665 : #i10000# comparsion between int and uint fixed 2008-11-13 13:31:12 +0100 lla r263641 : #i10000# build problem fixed 2008-11-13 11:20:01 +0100 lla r263625 : #i96130# hard code name of extension 2008-11-12 11:13:41 +0100 fs r263582 : #i96096# when opening a SRB-report fails due to the missing SRB extension, log this as warning only, and proceed with the migration 2008-11-12 11:11:35 +0100 fs r263581 : #i96096# ContentType handling. Now all contents deliver proper results in XContent::getContentType 2008-11-12 11:10:11 +0100 fs r263580 : #i96096# new ctors taking UNO_QUERY_THROW 2008-11-11 10:10:13 +0100 lla r263546 : CWS-TOOLING: rebase CWS dba31d to trunk@263288 (milestone: DEV300:m35) 2008-11-06 15:55:39 +0100 oj r263393 : #i93452# get field from model fallbackis the name 2008-11-06 15:31:47 +0100 oj r263392 : #i93465# remeber location of floating windows 2008-11-06 13:36:24 +0100 oj r263381 : #i93450# check typemap for null 2008-11-06 13:28:49 +0100 oj r263379 : #i93020# empty column list boxes when new relation should be created 2008-11-06 12:33:53 +0100 oj r263377 : #i93012# set border to default : flat 2008-11-06 12:26:54 +0100 oj r263375 : #i74927# do some less calls for odbc 2008-11-06 09:34:01 +0100 oj r263362 : #i93383# grabFocus in suspend to get allmodified cells 2008-11-03 21:01:39 +0100 oj r263308 : #i86739# check if slash can be valid for tables 2008-11-03 14:40:21 +0100 oj r263287 : #i86739# check if slash can be valid for tables 2008-11-03 14:32:17 +0100 oj r263286 : #i95227# column width 2008-11-03 14:27:26 +0100 oj r263285 : link fwe 2008-11-03 14:24:54 +0100 oj r263284 : #i95235# changed to hold no ref only weak 2008-10-31 11:21:48 +0100 oj r262859 : #i93459# set images add menu entry 2008-10-31 09:06:37 +0100 oj r262851 : #i88629# correct fileopen filter for database odb files 2008-10-30 15:01:04 +0100 oj r262828 : #i95229# set filter at the composer 2008-10-29 15:57:41 +0100 oj r262817 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:19 +0100 oj r262816 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:03 +0100 oj r262815 : #i95235# changed to hold no ref only weak 2008-10-29 15:56:15 +0100 oj r262814 : #i95235# filtermanger changed to hold no ref only weak 2008-10-29 10:32:39 +0100 oj r262773 : #i93474# use correct table name 2008-10-28 13:49:33 +0100 lla r262744 : #i95524# make an Invalidate and refresh on Tables 2008-10-28 10:45:02 +0100 fs r262707 : line ends 2008-10-28 10:34:42 +0100 fs r262706 : #i95522# don't expect the component to live in a TopWindow 2008-10-28 08:30:40 +0100 lla r262696 : #i93176# set preview mode on view 2008-10-28 07:56:57 +0100 oj r262694 : merge cvs svn 2008-10-27 14:13:51 +0100 oj r262673 : #i94129# use dummy data 2008-10-27 12:38:45 +0100 fs r262669 : #i94125# rework ScrollColumns 2008-10-23 15:53:57 +0200 oj r262624 : #i94568# do not load the embeddedobj just copy the storage 2008-10-23 14:39:14 +0200 oj r262622 : #i94129# handle chart correctly 2008-10-22 10:51:19 +0200 lla r262582 : #i94115# problem with left walk chart shape fixed 2008-10-22 07:47:48 +0200 oj r262576 : #i94455# rename now do not use remove insert 2008-10-22 07:47:27 +0200 oj r262575 : #i94455# rename now do not use remove insert 2008-10-21 12:46:26 +0200 lla r262567 : #i93845# extra check if default schema doesn't exists, fix assertion
2008-12-09 07:25:38 +00:00
Rectangle aInvalidRect = GetInvalidRect( nColumnId );
2001-02-05 08:26:47 +00:00
Invalidate( aInvalidRect );
ActivateCell( nCurrentRow, nCurCol );
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
2001-02-05 08:26:47 +00:00
invalidateUndoRedo();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
OTableFieldDescRef OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxdSource, USHORT _nColumnPostion, sal_Bool bVis, sal_Bool bActivate)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(jxdSource.pListBox->GetTabWin());
if (!pSourceWin)
return NULL;
// Namen/Position des selektierten Feldes
String aFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
sal_uInt32 nFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry);
OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(jxdSource.pEntry->GetUserData());
// eine DragInfo aufbauen, damit ich mich auf das andere InsertField zurueckziehen kann
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
aInfo->SetDataType(pInf->GetDataType());
aInfo->SetVisible(bVis);
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
return InsertField(aInfo, _nColumnPostion, bVis, bActivate);
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
OTableFieldDescRef OSelectionBrowseBox::InsertField(const OTableFieldDescRef& _rInfo, USHORT _nColumnPostion, sal_Bool bVis, sal_Bool bActivate)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
if(m_nMaxColumns && m_nMaxColumns <= FieldsCount())
return NULL;
if (bActivate)
SaveModified();
// Neue Spaltenbeschreibung
2002-08-19 07:01:32 +00:00
OTableFieldDescRef pEntry = _rInfo;
2001-02-05 08:26:47 +00:00
pEntry->SetVisible(bVis);
// Spalte einfuegen
2002-08-19 07:01:32 +00:00
InsertColumn( pEntry, _nColumnPostion );
2001-02-05 08:26:47 +00:00
if ( !m_bInUndoMode )
{
// UndoAction erzeugen
OTabFieldCreateUndoAct* pUndoAction = new OTabFieldCreateUndoAct( this );
pUndoAction->SetTabFieldDescr( pEntry );
pUndoAction->SetColumnPosition(_nColumnPostion);
getDesignView()->getController().addUndoActionAndInvalidate( pUndoAction );
}
2001-02-05 08:26:47 +00:00
return pEntry;
}
//------------------------------------------------------------------------------
sal_uInt16 OSelectionBrowseBox::FieldsCount()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OTableFields::iterator aIter = getFields().begin();
2001-02-05 08:26:47 +00:00
sal_uInt16 nCount = 0;
while (aIter != getFields().end())
2001-02-05 08:26:47 +00:00
{
if ((*aIter).isValid() && !(*aIter)->IsEmpty())
++nCount;
2001-02-05 08:26:47 +00:00
++aIter;
}
return nCount;
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
OTableFieldDescRef OSelectionBrowseBox::FindFirstFreeCol(USHORT& _rColumnPosition )
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OTableFields::iterator aIter = getFields().begin();
2002-08-19 07:01:32 +00:00
OTableFields::iterator aEnd = getFields().end();
_rColumnPosition = BROWSER_INVALIDID;
while ( aIter != aEnd )
2001-02-05 08:26:47 +00:00
{
2002-08-19 07:01:32 +00:00
++_rColumnPosition;
OTableFieldDescRef pEntry = (*aIter);
if ( pEntry.isValid() && pEntry->IsEmpty() )
return pEntry;
2001-02-05 08:26:47 +00:00
++aIter;
}
return NULL;
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
void OSelectionBrowseBox::CheckFreeColumns(USHORT& _rColumnPosition)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
if (FindFirstFreeCol(_rColumnPosition) == NULL)
2001-02-05 08:26:47 +00:00
{
// es ist voll, also einen Packen Spalten anhaengen
AppendNewCol(DEFAULT_QUERY_COLS);
2002-08-19 07:01:32 +00:00
OSL_VERIFY(FindFirstFreeCol(_rColumnPosition).isValid());
2001-02-05 08:26:47 +00:00
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt32 /*_nCurrentPos*/)
2001-02-05 08:26:47 +00:00
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
2001-03-01 14:45:02 +00:00
if(!xConnection.is())
return;
2001-02-05 08:26:47 +00:00
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(!rInfo->IsEmpty(),"AddGroupBy:: OTableFieldDescRef sollte nicht Empty sein!");
OTableFieldDescRef pEntry;
const Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
const ::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
//sal_Bool bAppend = sal_False;
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
for(;aIter != rFields.end();++aIter)
2001-02-05 08:26:47 +00:00
{
pEntry = *aIter;
OSL_ENSURE(pEntry.isValid(),"OTableFieldDescRef was null!");
2001-02-05 08:26:47 +00:00
const ::rtl::OUString aField = pEntry->GetField();
const ::rtl::OUString aAlias = pEntry->GetAlias();
2001-02-05 08:26:47 +00:00
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
CWS-TOOLING: integrate CWS dba31h 2009-01-29 10:47:07 +0100 oj r267102 : decl OpCodeMap as friend 2009-01-26 09:41:21 +0100 fs r266905 : #i97137# 2009-01-26 09:10:39 +0100 fs r266903 : #i10000 2009-01-26 09:00:17 +0100 fs r266901 : re-enable user admin for MySQL native 2009-01-23 21:56:08 +0100 fs r266851 : #i97137# 2009-01-23 21:32:40 +0100 fs r266850 : #i97042# 2009-01-23 11:23:59 +0100 msc r266800 : #i98387# 2009-01-23 11:17:05 +0100 msc r266798 : #i98387# 2009-01-23 10:56:33 +0100 fs r266795 : for the moment, disable user administration for MySQL native 2009-01-21 15:08:54 +0100 fs r266672 : removed some advanced settings for MySQL native - letting the user control them does not make sense for this particular type 2009-01-21 13:55:13 +0100 oj r266668 : #i98317# wrong var set 2009-01-21 13:41:22 +0100 fs r266664 : #i98315# 2009-01-21 13:13:09 +0100 oj r266661 : #i97032# enable locking for OOo 2009-01-21 13:11:26 +0100 oj r266660 : #i97032# enable locking for OOo 2009-01-21 10:10:50 +0100 oj r266634 : #i98174# merge conflict resolved 2009-01-21 08:48:58 +0100 fs r266628 : CWS-TOOLING: rebase CWS dba31h to trunk@266428 (milestone: DEV300:m39) 2009-01-20 12:54:32 +0100 fs r266570 : #i98277# 2009-01-19 10:46:31 +0100 fs r266480 : #i97995# 2009-01-19 08:42:09 +0100 fs r266470 : #i97042# provided my mod@openoffice.org: support more SQL comment styles 2009-01-19 07:55:43 +0100 oj r266468 : #i98115# check function name as well 2009-01-16 10:21:28 +0100 oj r266404 : #i97861# remove invalid assertion 2009-01-16 10:18:31 +0100 oj r266403 : #i97861# ini var with false 2009-01-15 14:09:50 +0100 oj r266371 : #i97810# saveas fix 2009-01-15 11:54:18 +0100 oj r266360 : remove : from mysql 2009-01-15 11:07:46 +0100 oj r266355 : insert JNI fixes for method names 2009-01-15 10:54:44 +0100 oj r266351 : fix for parameter subst 2009-01-14 14:41:34 +0100 oj r266308 : parameter subst 2009-01-14 14:40:20 +0100 oj r266307 : add missing try catch 2009-01-14 14:38:34 +0100 oj r266306 : new service for parameter subst 2009-01-14 14:37:52 +0100 oj r266305 : missing types for hyper 2009-01-09 15:28:36 +0100 fs r266090 : #i97889# 2009-01-09 14:16:15 +0100 fs r266082 : #i97892# provided by npower: when reading the xlink:href attrib, use the graphic resolver only if appropriate 2009-01-08 21:31:21 +0100 fs r266041 : #i97346# 2009-01-08 14:51:56 +0100 fs r266012 : #i97871# showPreviewFor: bail out if preview is disabled
2009-02-17 15:39:54 +00:00
pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
pEntry->GetFunction() == rInfo->GetFunction())
2001-02-05 08:26:47 +00:00
{
/*sal_uInt32 nPos = aIter - rFields.begin();
bAppend = _nCurrentPos > nPos && (rInfo->IsGroupBy() != pEntry->IsGroupBy());
if ( bAppend )
aIter = rFields.end();
else*/
2001-02-05 08:26:47 +00:00
{
if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
{
pEntry->SetGroupBy(sal_False);
aIter = rFields.end();
}
else
{
pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
2001-02-05 08:26:47 +00:00
}
break;
}
}
if (aIter == rFields.end())
2001-02-05 08:26:47 +00:00
{
OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, sal_False, sal_False );
if ( (pTmp->isNumericOrAggreateFunction() && rInfo->IsGroupBy()) ) // das GroupBy wird bereits von rInfo "ubernommen
2001-02-05 08:26:47 +00:00
pTmp->SetGroupBy(sal_False);
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const String& rValue, const sal_uInt16 nLevel,bool _bAddOrOnOneLine )
2001-02-05 08:26:47 +00:00
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
2001-03-01 14:45:02 +00:00
if(!xConnection.is())
return;
2001-02-05 08:26:47 +00:00
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(rInfo.isValid() && !rInfo->IsEmpty(),"AddCondition:: OTableFieldDescRef sollte nicht Empty sein!");
OTableFieldDescRef pEntry;
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
2001-02-05 08:26:47 +00:00
OTableFields::iterator aIter = getFields().begin();
for(;aIter != getFields().end();++aIter)
2001-02-05 08:26:47 +00:00
{
pEntry = *aIter;
const ::rtl::OUString aField = pEntry->GetField();
const ::rtl::OUString aAlias = pEntry->GetAlias();
2001-02-05 08:26:47 +00:00
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
CWS-TOOLING: integrate CWS dba31h 2009-01-29 10:47:07 +0100 oj r267102 : decl OpCodeMap as friend 2009-01-26 09:41:21 +0100 fs r266905 : #i97137# 2009-01-26 09:10:39 +0100 fs r266903 : #i10000 2009-01-26 09:00:17 +0100 fs r266901 : re-enable user admin for MySQL native 2009-01-23 21:56:08 +0100 fs r266851 : #i97137# 2009-01-23 21:32:40 +0100 fs r266850 : #i97042# 2009-01-23 11:23:59 +0100 msc r266800 : #i98387# 2009-01-23 11:17:05 +0100 msc r266798 : #i98387# 2009-01-23 10:56:33 +0100 fs r266795 : for the moment, disable user administration for MySQL native 2009-01-21 15:08:54 +0100 fs r266672 : removed some advanced settings for MySQL native - letting the user control them does not make sense for this particular type 2009-01-21 13:55:13 +0100 oj r266668 : #i98317# wrong var set 2009-01-21 13:41:22 +0100 fs r266664 : #i98315# 2009-01-21 13:13:09 +0100 oj r266661 : #i97032# enable locking for OOo 2009-01-21 13:11:26 +0100 oj r266660 : #i97032# enable locking for OOo 2009-01-21 10:10:50 +0100 oj r266634 : #i98174# merge conflict resolved 2009-01-21 08:48:58 +0100 fs r266628 : CWS-TOOLING: rebase CWS dba31h to trunk@266428 (milestone: DEV300:m39) 2009-01-20 12:54:32 +0100 fs r266570 : #i98277# 2009-01-19 10:46:31 +0100 fs r266480 : #i97995# 2009-01-19 08:42:09 +0100 fs r266470 : #i97042# provided my mod@openoffice.org: support more SQL comment styles 2009-01-19 07:55:43 +0100 oj r266468 : #i98115# check function name as well 2009-01-16 10:21:28 +0100 oj r266404 : #i97861# remove invalid assertion 2009-01-16 10:18:31 +0100 oj r266403 : #i97861# ini var with false 2009-01-15 14:09:50 +0100 oj r266371 : #i97810# saveas fix 2009-01-15 11:54:18 +0100 oj r266360 : remove : from mysql 2009-01-15 11:07:46 +0100 oj r266355 : insert JNI fixes for method names 2009-01-15 10:54:44 +0100 oj r266351 : fix for parameter subst 2009-01-14 14:41:34 +0100 oj r266308 : parameter subst 2009-01-14 14:40:20 +0100 oj r266307 : add missing try catch 2009-01-14 14:38:34 +0100 oj r266306 : new service for parameter subst 2009-01-14 14:37:52 +0100 oj r266305 : missing types for hyper 2009-01-09 15:28:36 +0100 fs r266090 : #i97889# 2009-01-09 14:16:15 +0100 fs r266082 : #i97892# provided by npower: when reading the xlink:href attrib, use the graphic resolver only if appropriate 2009-01-08 21:31:21 +0100 fs r266041 : #i97346# 2009-01-08 14:51:56 +0100 fs r266012 : #i97871# showPreviewFor: bail out if preview is disabled
2009-02-17 15:39:54 +00:00
pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
pEntry->GetFunction() == rInfo->GetFunction())
2001-02-05 08:26:47 +00:00
{
if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
2001-02-05 08:26:47 +00:00
pEntry->SetGroupBy(sal_False);
else
{
pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
2001-02-05 08:26:47 +00:00
pEntry->SetVisible(sal_True);
}
if (!pEntry->GetCriteria(nLevel).getLength() || _bAddOrOnOneLine )
2001-02-05 08:26:47 +00:00
{
String sCriteria = rValue;
if ( _bAddOrOnOneLine )
{
String sOldCriteria = pEntry->GetCriteria( nLevel );
if ( sOldCriteria.Len() )
{
sCriteria = String(RTL_CONSTASCII_USTRINGPARAM("("));
sCriteria += sOldCriteria;
sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" OR "));
sCriteria += rValue;
sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(")"));
}
}
pEntry->SetCriteria( nLevel, sCriteria);
2001-02-05 08:26:47 +00:00
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
{
RowInserted( GetRowCount()-1, 1, TRUE );
m_bVisibleRow.push_back(sal_True);
++m_nVisibleCount;
}
m_bVisibleRow[BROW_CRIT1_ROW + nLevel] = sal_True;
2001-02-05 08:26:47 +00:00
break;
}
}
}
if (aIter == getFields().end())
2001-02-05 08:26:47 +00:00
{
OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, sal_False, sal_False );
if ( pTmp->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) // das GroupBy wird bereits von rInfo "ubernommen
2001-02-05 08:26:47 +00:00
pTmp->SetGroupBy(sal_False);
if ( pTmp.isValid() )
2001-02-05 08:26:47 +00:00
{
pTmp->SetCriteria( nLevel, rValue);
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
{
RowInserted( GetRowCount()-1, 1, TRUE );
m_bVisibleRow.push_back(sal_True);
++m_nVisibleCount;
}
}
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt32 _nCurrentPos)
2001-02-05 08:26:47 +00:00
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
2001-03-01 14:45:02 +00:00
if(!xConnection.is())
return;
2001-02-05 08:26:47 +00:00
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(!rInfo->IsEmpty(),"AddOrder:: OTableFieldDescRef sollte nicht Empty sein!");
OTableFieldDescRef pEntry;
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
2001-02-05 08:26:47 +00:00
sal_Bool bAppend = sal_False;
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
for(;aIter != rFields.end();++aIter)
2001-02-05 08:26:47 +00:00
{
pEntry = *aIter;
::rtl::OUString aField = pEntry->GetField();
::rtl::OUString aAlias = pEntry->GetAlias();
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()))
2001-02-05 08:26:47 +00:00
{
sal_uInt32 nPos = aIter - rFields.begin();
bAppend = _nCurrentPos > nPos;
if ( bAppend )
aIter = rFields.end();
else
{
if ( !m_bOrderByUnRelated )
pEntry->SetVisible(sal_True);
pEntry->SetOrderDir( eDir );
}
2001-02-05 08:26:47 +00:00
break;
}
}
if (aIter == rFields.end())
2001-02-05 08:26:47 +00:00
{
OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, sal_False, sal_False );
if(pTmp.isValid())
2001-02-05 08:26:47 +00:00
{
if ( !m_bOrderByUnRelated && !bAppend )
pTmp->SetVisible(sal_True);
2001-02-05 08:26:47 +00:00
pTmp->SetOrderDir( eDir );
}
}
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
EditBrowseBox::ArrangeControls(nX, nY);
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2001-09-27 05:19:05 +00:00
sal_Bool OSelectionBrowseBox::Save()
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2001-09-27 05:19:05 +00:00
sal_Bool bRet = sal_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()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
long nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_VIS_ROW:
{
OTableFieldDescRef pEntry = getEntry(GetColumnPos(GetCurColumnId()) - 1);
2001-02-05 08:26:47 +00:00
sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos();
if(!m_bOrderByUnRelated && nIdx > 0 &&
nIdx != sal_uInt16(-1) &&
!pEntry->IsEmpty() &&
pEntry->GetOrderDir() != ORDER_NONE)
2001-02-05 08:26:47 +00:00
{
m_pVisibleCell->GetBox().Check();
pEntry->SetVisible(sal_True);
}
else
pEntry->SetVisible(m_pVisibleCell->GetBox().IsChecked());
}
break;
}
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::Fill()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(ColCount() >= 1, "OSelectionBrowseBox::Fill : please call only after inserting the handle column !");
sal_uInt16 nColCount = ColCount() - 1;
if (nColCount < DEFAULT_QUERY_COLS)
AppendNewCol(DEFAULT_QUERY_COLS - nColCount);
}
//------------------------------------------------------------------------------
Size OSelectionBrowseBox::CalcOptimalSize( const Size& _rAvailable )
{
Size aReturn( _rAvailable.Width(), GetTitleHeight() );
aReturn.Height() += ( m_nVisibleCount ? m_nVisibleCount : 15 ) * GetDataRowHeight();
aReturn.Height() += 40; // just some space
return aReturn;
}
2001-02-05 08:26:47 +00:00
//------------------------------------------------------------------------------
void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
switch (rEvt.GetCommand())
{
case COMMAND_CONTEXTMENU:
{
Point aMenuPos( rEvt.GetMousePosPixel() );
2001-02-05 08:26:47 +00:00
if (!rEvt.IsMouseEvent())
{
if ( 1 == GetSelectColumnCount() )
{
sal_uInt16 nSelId = GetColumnId(
sal::static_int_cast< USHORT >(
FirstSelectedColumn() ) );
::Rectangle aColRect( GetFieldRectPixel( 0, nSelId, sal_False ) );
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() ));
long nRow = GetRowAtYPosPixel( aMenuPos.Y() );
2001-02-05 08:26:47 +00:00
if (nRow < 0 && nColId > HANDLE_ID )
2001-02-05 08:26:47 +00:00
{
if ( !IsColumnSelected( nColId ) )
{
adjustSelectionMode( sal_True /* clicked onto a header */ , sal_False /* not onto the handle col */ );
SelectColumnId( nColId );
}
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
2001-02-05 08:26:47 +00:00
{
PopupMenu aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
switch (aContextMenu.Execute(this, aMenuPos))
2001-02-05 08:26:47 +00:00
{
case SID_DELETE:
2001-02-05 08:26:47 +00:00
RemoveField(nColId);
break;
case ID_BROWSER_COLWIDTH:
adjustBrowseBoxColumnWidth( this, nColId );
break;
2001-02-05 08:26:47 +00:00
}
}
}
else if(nRow >= 0 && nColId <= HANDLE_ID)
{
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
2001-02-05 08:26:47 +00:00
{
PopupMenu aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU));
aContextMenu.CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]);
aContextMenu.CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]);
aContextMenu.CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
aContextMenu.CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
2001-02-05 08:26:47 +00:00
switch (aContextMenu.Execute(this, aMenuPos))
2001-02-05 08:26:47 +00:00
{
case ID_QUERY_FUNCTION:
SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW));
static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_FUNCTIONS );
2001-02-05 08:26:47 +00:00
break;
case ID_QUERY_TABLENAME:
SetRowVisible(BROW_TABLE_ROW, !IsRowVisible(BROW_TABLE_ROW));
static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_TABLES );
2001-02-05 08:26:47 +00:00
break;
case ID_QUERY_ALIASNAME:
SetRowVisible(BROW_COLUMNALIAS_ROW, !IsRowVisible(BROW_COLUMNALIAS_ROW));
static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_ALIASES );
2001-02-05 08:26:47 +00:00
break;
case ID_QUERY_DISTINCT:
static_cast<OQueryController&>(getDesignView()->getController()).setDistinct(!static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_DISTINCT_VALUES );
2001-02-05 08:26:47 +00:00
break;
}
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
2001-02-05 08:26:47 +00:00
}
}
else
{
EditBrowseBox::Command(rEvt);
2001-02-05 08:26:47 +00:00
return;
}
}
default:
EditBrowseBox::Command(rEvt);
2001-02-05 08:26:47 +00:00
}
}
//------------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::IsRowVisible(sal_uInt16 _nWhich) const
{
DBG_ASSERT(_nWhich<(m_bVisibleRow.size()), "OSelectionBrowseBox::IsRowVisible : invalid parameter !");
2001-02-05 08:26:47 +00:00
return m_bVisibleRow[_nWhich];
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, sal_Bool _bVis)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(_nWhich<m_bVisibleRow.size(), "OSelectionBrowseBox::SetRowVisible : invalid parameter !");
2001-02-05 08:26:47 +00:00
2001-10-26 06:49:36 +00:00
sal_Bool bWasEditing = IsEditing();
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)
{
RowInserted(nId,1);
2001-10-23 11:30:27 +00:00
++m_nVisibleCount;
2001-02-05 08:26:47 +00:00
}
else
{
RowRemoved(nId,1);
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
{
2002-08-19 07:01:32 +00:00
USHORT nCount(0);
for(USHORT 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;
}
//------------------------------------------------------------------------------
long OSelectionBrowseBox::GetRealRow(long nRowId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
long nErg=0,i;
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
{
if(m_bVisibleRow[i])
{
if(nErg++ == nRowId)
break;
}
}
2001-02-23 14:04:37 +00:00
DBG_ASSERT(nErg <= long(m_bVisibleRow.size()),"nErg kann nicht groesser als BROW_ROW_CNT sein!");
2001-02-05 08:26:47 +00:00
return i;
}
static long nVisibleRowMask[] =
{
0x0001,
0x0002,
0x0004,
0x0008,
0x0010,
0x0020,
0x0040,
0x0080,
0x0100,
0x0200,
0x0400,
0x0800
};
//------------------------------------------------------------------------------
sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const
{
sal_Int32 nErg(0);
2001-10-23 11:30:27 +00:00
// only the first 11 row are interesting
2001-02-05 08:26:47 +00:00
sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]);
for(sal_Int32 i=0;i<nSize;i++)
{
if(!m_bVisibleRow[i])
nErg |= nVisibleRowMask[i];
}
return nErg;
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::SetNoneVisbleRow(long nRows)
{
2001-10-23 11:30:27 +00:00
// only the first 11 row are interesting
2001-02-05 08:26:47 +00:00
sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]);
for(sal_Int32 i=0;i< nSize;i++)
m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]);
}
//------------------------------------------------------------------------------
String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColId);
OTableFieldDescRef pEntry = getFields()[nPos-1];
2001-02-05 08:26:47 +00:00
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... ");
if ( pEntry->IsEmpty() )
2001-02-05 08:26:47 +00:00
return String();
String aText;
switch (nRow)
{
case BROW_TABLE_ROW:
aText = pEntry->GetAlias();
break;
case BROW_FIELD_ROW:
{
String aField = pEntry->GetField();
if (aField.GetChar(0) == '*') // * durch alias.* ersetzen
{
aField = pEntry->GetAlias();
if(aField.Len())
aField += '.';
2001-02-05 08:26:47 +00:00
aField += '*';
}
aText = aField;
} break;
case BROW_ORDER_ROW:
if (pEntry->GetOrderDir() != ORDER_NONE)
aText = String(ModuleRes(STR_QUERY_SORTTEXT) ).GetToken(sal::static_int_cast< USHORT >(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:
// we always show the group function at first
if ( pEntry->IsGroupBy() )
2001-02-05 08:26:47 +00:00
aText = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1);
else if ( pEntry->isNumericOrAggreateFunction() )
aText = pEntry->GetFunction();
2001-02-05 08:26:47 +00:00
break;
default:
aText = pEntry->GetCriteria(sal_uInt16(nRow - BROW_CRIT1_ROW));
2001-02-05 08:26:47 +00:00
}
return aText;
}
//------------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::GetFunctionName(sal_uInt32 _nFunctionTokenId,String& rFkt)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
sal_Bool bErg=sal_True;
String aText;
switch(_nFunctionTokenId)
2001-02-05 08:26:47 +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;
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
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;
default:
2001-02-05 08:26:47 +00:00
{
xub_StrLen nCount = m_aFunctionStrings.GetTokenCount();
xub_StrLen i;
for ( i = 0; i < nCount-1; i++) // Gruppierung wird nicht mit gez"ahlt
{
if(rFkt.EqualsIgnoreCaseAscii(m_aFunctionStrings.GetToken(i)))
{
rFkt = m_aFunctionStrings.GetToken(i);
break;
}
}
if(i == nCount-1)
bErg = sal_False;
2001-02-05 08:26:47 +00:00
}
}
2001-02-05 08:26:47 +00:00
return bErg;
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
String OSelectionBrowseBox::GetCellContents(sal_Int32 nCellIndex, USHORT nColId)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2001-04-18 10:44:59 +00:00
// DBG_ASSERT(nCellIndex < (GetRowCount()-1),"CellIndex ist zu gross");
if ( GetCurColumnId() == nColId && !m_bInUndoMode )
SaveModified();
2001-02-05 08:26:47 +00:00
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColId);
OTableFieldDescRef pEntry = getFields()[nPos - 1];
2001-02-05 08:26:47 +00:00
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellContents : invalid column id, prepare for GPF ... ");
2001-04-18 10:44:59 +00:00
switch (nCellIndex)
2001-02-05 08:26:47 +00:00
{
case BROW_VIS_ROW :
return pEntry->IsVisible() ? g_strOne : g_strZero;
case BROW_ORDER_ROW:
{
sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos();
if (nIdx == sal_uInt16(-1))
nIdx = 0;
return String(nIdx);
}
default:
2002-08-19 07:01:32 +00:00
return GetCellText(nCellIndex, nColId);
2001-02-05 08:26:47 +00:00
}
}
//------------------------------------------------------------------------------
2002-08-19 07:01:32 +00:00
void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, USHORT nColId, const String& strNewText)
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
sal_Bool bWasEditing = IsEditing() && (GetCurColumnId() == nColId) && IsRowVisible(static_cast<USHORT>(nRow)) && (GetCurRow() == static_cast<USHORT>(GetBrowseRow(nRow)));
2001-10-26 06:49:36 +00:00
if (bWasEditing)
2001-02-05 08:26:47 +00:00
DeactivateCell();
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColId);
OTableFieldDescRef pEntry = getEntry(nPos - 1);
2001-02-05 08:26:47 +00:00
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::SetCellContents : invalid column id, prepare for GPF ... ");
2001-04-18 10:44:59 +00:00
switch (nRow)
2001-02-05 08:26:47 +00:00
{
case BROW_VIS_ROW:
pEntry->SetVisible(strNewText.Equals(g_strOne));
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:
{
sal_uInt16 nIdx = (sal_uInt16)strNewText.ToInt32();
pEntry->SetOrderDir(EOrderDir(nIdx));
} break;
case BROW_COLUMNALIAS_ROW:
pEntry->SetFieldAlias(strNewText);
break;
case BROW_FUNCTION_ROW:
{
String sOldFunctionName = pEntry->GetFunction();
String sGroupFunctionName = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1);
2001-02-05 08:26:47 +00:00
pEntry->SetFunction(strNewText);
// first reset this two member
sal_Int32 nFunctionType = pEntry->GetFunctionType();
nFunctionType &= ~FKT_AGGREGATE;
pEntry->SetFunctionType(nFunctionType);
if ( pEntry->IsGroupBy() && !sGroupFunctionName.EqualsIgnoreCaseAscii(strNewText) )
pEntry->SetGroupBy(sal_False);
if ( sGroupFunctionName.EqualsIgnoreCaseAscii(strNewText) )
2001-02-05 08:26:47 +00:00
pEntry->SetGroupBy(sal_True);
else if ( strNewText.Len() )
{
nFunctionType |= FKT_AGGREGATE;
pEntry->SetFunctionType(nFunctionType);
}
} break;
2001-02-05 08:26:47 +00:00
default:
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);
2002-08-19 07:01:32 +00:00
if(IsRowVisible(static_cast<USHORT>(nRow)))
RowModified(nCellIndex, nColId);
2001-02-05 08:26:47 +00:00
// die entsprechende Feld-Beschreibung ist jetzt leer -> Visible auf sal_False (damit das konsistent mit normalen leeren Spalten ist)
if (pEntry->IsEmpty())
pEntry->SetVisible(sal_False);
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
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
long nRowId = GetRealRow(nRow);
if (nRowId == BROW_VIS_ROW)
return CHECKBOX_SIZE;
else
return GetDataWindow().GetTextWidth(GetCellText(nRowId, nColId));
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId)
{
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 ...
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColId);
DBG_ASSERT(nPos <= getFields().size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!");
OTableFieldDescRef pEntry = getEntry(nPos-1);
DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::ColumnResized : keine FieldDescription !");
static_cast<OQueryController&>(getDesignView()->getController()).setModified();
EditBrowseBox::ColumnResized(nColId);
2001-02-05 08:26:47 +00:00
if ( pEntry.isValid())
2001-02-05 08:26:47 +00:00
{
if ( !m_bInUndoMode )
{
// create the undo action
OTabFieldSizedUndoAct* pUndo = new OTabFieldSizedUndoAct(this);
pUndo->SetColumnPosition( nPos );
pUndo->SetOriginalWidth(pEntry->GetColWidth());
getDesignView()->getController().addUndoActionAndInvalidate(pUndo);
}
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)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
2002-08-19 07:01:32 +00:00
USHORT nPos = GetColumnPos(nColId);
DBG_ASSERT((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];
DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !");
2001-02-05 08:26:47 +00:00
long nRow = GetRealRow(nRowId);
String strText(GetCellText(nRow, nColId));
return GetDataWindow().LogicToPixel(Size(GetDataWindow().GetTextWidth(strText),0)).Width();
}
//------------------------------------------------------------------------------
sal_uInt16 OSelectionBrowseBox::GetDefaultColumnWidth(const String& /*rName*/) const
2001-02-05 08:26:47 +00:00
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
// die Baissklasse macht das von dem Text abhaengig, ich habe aber keine Spaltenueberschriften, daher haette ich
// hier gern einen anderen Default-Wert
return static_cast<sal_uInt16>(DEFAULT_SIZE);
2001-02-05 08:26:47 +00:00
}
//------------------------------------------------------------------------------
2001-04-18 10:44:59 +00:00
sal_Bool OSelectionBrowseBox::isCutAllowed()
{
sal_Bool bCutAllowed = sal_False;
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:
bCutAllowed = m_pFieldCell->GetSelected().Len() != 0;
break;
default:
bCutAllowed = m_pTextCell->GetSelected().Len() != 0;
break;
}
return bCutAllowed;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::cut()
{
String sOldValue = GetCellContents(GetRealRow(GetCurRow()),GetCurColumnId());
long nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_FIELD_ROW:
m_pFieldCell->Cut();
m_pFieldCell->SetModifyFlag();
2001-04-18 10:44:59 +00:00
break;
default:
m_pTextCell->Cut();
m_pTextCell->SetModifyFlag();
2001-04-18 10:44:59 +00:00
}
SaveModified();
2001-04-18 10:44:59 +00:00
RowModified(GetBrowseRow(nRow), GetCurColumnId());
invalidateUndoRedo();
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());
invalidateUndoRedo();
2001-04-18 10:44:59 +00:00
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::isPasteAllowed()
{
sal_Bool bPasteAllowed = sal_True;
long nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_VIS_ROW:
case BROW_ORDER_ROW:
case BROW_TABLE_ROW:
case BROW_FUNCTION_ROW:
bPasteAllowed = sal_False;
break;
}
return bPasteAllowed;
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::isCopyAllowed()
{
return isCutAllowed();
}
// -----------------------------------------------------------------------------
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();
}
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::appendUndoAction(const String& _rOldValue,const String& _rNewValue,sal_Int32 _nRow,sal_Bool& _bListAction)
{
if ( !m_bInUndoMode && !_rNewValue.Equals(_rOldValue) )
{
if ( !_bListAction )
{
_bListAction = sal_True;
static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->EnterListAction(String(),String());
}
appendUndoAction(_rOldValue,_rNewValue,_nRow);
}
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::appendUndoAction(const String& _rOldValue,const String& _rNewValue,sal_Int32 _nRow)
2001-04-18 10:44:59 +00:00
{
if ( !m_bInUndoMode && !_rNewValue.Equals(_rOldValue) )
2001-04-18 10:44:59 +00:00
{
OTabFieldCellModifiedUndoAct* pUndoAct = new OTabFieldCellModifiedUndoAct(this);
pUndoAct->SetCellIndex(_nRow);
OSL_ENSURE(GetColumnPos(GetCurColumnId()) != BROWSER_INVALIDID,"Current position isn't valid!");
pUndoAct->SetColumnPosition( GetColumnPos(GetCurColumnId()) );
2001-04-18 10:44:59 +00:00
pUndoAct->SetCellContents(_rOldValue);
getDesignView()->getController().addUndoActionAndInvalidate(pUndoAct);
2001-04-18 10:44:59 +00:00
}
}
// -----------------------------------------------------------------------------
2001-04-18 12:20:48 +00:00
IMPL_LINK(OSelectionBrowseBox, OnInvalidateTimer, void*, EMPTYARG)
{
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();
return 0L;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::stopTimer()
{
m_bStopTimer = sal_True;
if (m_timerInvalidate.IsActive())
m_timerInvalidate.Stop();
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::startTimer()
{
m_bStopTimer = sal_False;
if (!m_timerInvalidate.IsActive())
m_timerInvalidate.Start();
}
// -----------------------------------------------------------------------------
OTableFields& OSelectionBrowseBox::getFields() const
2001-04-30 12:02:01 +00:00
{
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
return rController.getTableFieldDesc();
2001-04-30 12:02:01 +00:00
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::enableControl(const OTableFieldDescRef& _rEntry,Window* _pControl)
{
BOOL bEnable = !_rEntry->isCondition();
_pControl->Enable(bEnable);
_pControl->EnableInput(bEnable);
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::setTextCellContext(const OTableFieldDescRef& _rEntry,const String& _sText,ULONG _nHelpId)
{
m_pTextCell->SetText(_sText);
m_pTextCell->ClearModifyFlag();
if (!m_pTextCell->HasFocus())
m_pTextCell->GrabFocus();
enableControl(_rEntry,m_pTextCell);
if (m_pTextCell->GetHelpId() != _nHelpId)
// da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen
m_pTextCell->SetHelpText(String());
m_pTextCell->SetHelpId(_nHelpId);
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::invalidateUndoRedo()
{
OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
rController.InvalidateFeature( ID_BROWSER_UNDO );
rController.InvalidateFeature( ID_BROWSER_REDO );
rController.InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
}
// -----------------------------------------------------------------------------
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
OTableFieldDescRef pEntry = aFields[_nPos];
OSL_ENSURE(pEntry.isValid(),"Invalid entry!");
2002-08-19 07:01:32 +00:00
if ( !pEntry.isValid() )
{
pEntry = new OTableFieldDesc();
pEntry->SetColumnId(
GetColumnId(sal::static_int_cast< USHORT >(_nPos+1)));
aFields[_nPos] = pEntry;
}
return pEntry;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::GetFocus()
{
2001-10-23 11:30:27 +00:00
if(!IsEditing() && !m_bWasEditing)
ActivateCell();
EditBrowseBox::GetFocus();
}
// -----------------------------------------------------------------------------
2001-10-26 06:49:36 +00:00
void OSelectionBrowseBox::DeactivateCell(sal_Bool _bUpdate)
{
m_bWasEditing = sal_True;
EditBrowseBox::DeactivateCell(_bUpdate);
m_bWasEditing = sal_False;
}
// -----------------------------------------------------------------------------
2002-04-23 06:58:14 +00:00
::rtl::OUString OSelectionBrowseBox::GetRowDescription( sal_Int32 _nRow ) const
{
String aLabel(ModuleRes(STR_QUERY_HANDLETEXT));
// ab BROW_CRIT2_ROW werden alle Zeilen mit "oder" angegeben
xub_StrLen nToken = (xub_StrLen) (_nRow >= GetBrowseRow(BROW_CRIT2_ROW))
?
xub_StrLen(BROW_CRIT2_ROW) : xub_StrLen(GetRealRow(_nRow));
return ::rtl::OUString(aLabel.GetToken(nToken));
}
// -----------------------------------------------------------------------------
::rtl::OUString OSelectionBrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eObjType,sal_Int32 _nPosition) const
2002-04-23 06:58:14 +00:00
{
::rtl::OUString sRetText;
switch( _eObjType )
{
case ::svt::BBTYPE_ROWHEADERCELL:
sRetText = GetRowDescription(_nPosition);
break;
default:
sRetText = EditBrowseBox::GetAccessibleObjectDescription(_eObjType,_nPosition);
2002-04-23 06:58:14 +00:00
}
return sRetText;
}
// -----------------------------------------------------------------------------
sal_Bool OSelectionBrowseBox::fillEntryTable(OTableFieldDescRef& _pEntry,const ::rtl::OUString& _sTableName)
{
sal_Bool bRet = sal_False;
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if (pTabWinList)
{
OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(_sTableName);
if(aIter != pTabWinList->end())
{
OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
if (pEntryTab)
{
_pEntry->SetTable(pEntryTab->GetTableName());
_pEntry->SetTabWindow(pEntryTab);
bRet = sal_True;
}
}
}
return bRet;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef& _pEntry)
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
if ( xConnection.is() )
{
// Diese Funktionen stehen nur unter CORE zur Verf<72>gung
if ( lcl_SupportsCoreSQLGrammar(xConnection) )
{
// if we have an asterix, no other function than count is allowed
m_pFunctionCell->Clear();
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(0));
if ( isFieldNameAsterix(_pEntry->GetField()) )
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT
else
{
xub_StrLen nCount = m_aFunctionStrings.GetTokenCount();
if ( _pEntry->isNumeric() )
--nCount;
for (xub_StrLen nIdx = 1; nIdx < nCount; nIdx++)
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(nIdx));
}
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));
}
else if ( m_pFunctionCell->GetEntryPos(String(_pEntry->GetFunction())) != COMBOBOX_ENTRY_NOTFOUND )
m_pFunctionCell->SelectEntry(String(_pEntry->GetFunction()));
else
m_pFunctionCell->SelectEntryPos(0);
enableControl(_pEntry,m_pFunctionCell);
}
else
{
// nur COUNT(*) erlaubt
sal_Bool bCountRemoved = !isFieldNameAsterix(_pEntry->GetField());
if ( bCountRemoved )
m_pFunctionCell->RemoveEntry(1);
if ( !bCountRemoved && m_pFunctionCell->GetEntryCount() < 2)
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT
if(m_pFunctionCell->GetEntryPos(String(_pEntry->GetFunction())) != COMBOBOX_ENTRY_NOTFOUND)
m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
else
m_pFunctionCell->SelectEntryPos(0);
}
}
}
// -----------------------------------------------------------------------------
Reference< XAccessible > OSelectionBrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
{
OTableFieldDescRef pEntry = NULL;
if(getFields().size() > sal_uInt16(_nColumnPos - 1))
pEntry = getFields()[_nColumnPos - 1];
if ( _nRow == BROW_VIS_ROW && pEntry.isValid() )
return EditBrowseBox::CreateAccessibleCheckBoxCell( _nRow, _nColumnPos,pEntry->IsVisible() ? STATE_CHECK : STATE_NOCHECK );
return EditBrowseBox::CreateAccessibleCell( _nRow, _nColumnPos );
}
// -----------------------------------------------------------------------------
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
bool OSelectionBrowseBox::HasFieldByAliasName(const ::rtl::OUString& rFieldName, OTableFieldDescRef& rInfo) const
{
OTableFields& aFields = getFields();
OTableFields::iterator aIter = aFields.begin();
OTableFields::iterator aEnd = aFields.end();
CWS-TOOLING: integrate CWS dba31f 2008-12-10 14:16:09 +0100 oj r265185 : #i96658# remove is 2008-12-10 08:46:07 +0100 oj r265147 : remove duplicate ids 2008-12-10 08:35:02 +0100 oj r265146 : #i96658# remove is 2008-12-09 11:44:35 +0100 oj r265072 : use of tools::StringresourceList 2008-12-09 11:43:41 +0100 oj r265071 : new class to read string elements from a Resource 2008-12-09 11:41:56 +0100 oj r265070 : export StringListResource 2008-12-09 11:38:17 +0100 oj r265068 : change string ; to more string objects 2008-12-08 12:11:43 +0100 oj r264985 : change default-license-id to lic-en-US 2008-12-05 12:06:09 +0100 oj r264896 : disable check to uncheck 2008-12-04 08:58:50 +0100 oj r264814 : #i96517,i96520,i96522# d&d, background, state fixed 2008-12-04 08:53:29 +0100 oj r264813 : #i96434# use document ui name from filter 2008-12-04 08:41:06 +0100 oj r264812 : #i96434# use document ui name from filter 2008-12-02 13:48:49 +0100 lla r264697 : #i96526# extra string for default otr wasn't found 2008-11-28 11:46:31 +0100 oj r264536 : move toolbar and resize add field dlg 2008-11-28 08:38:22 +0100 oj r264526 : load string resources 2008-11-27 19:28:52 +0100 oj r264520 : unsigned 2008-11-27 19:10:19 +0100 oj r264517 : move class into unnamed namespace 2008-11-27 18:33:38 +0100 oj r264514 : wrong param 2008-11-27 16:52:39 +0100 oj r264510 : #i96622# wrong string replacement 2008-11-27 16:46:03 +0100 oj r264509 : remove unused var 2008-11-27 13:37:16 +0100 oj r264484 : #i96432# notify only when not in special mode of the page 2008-11-27 13:16:47 +0100 oj r264479 : #i95224# accept alias in group by 2008-11-27 12:35:19 +0100 oj r264477 : #i95416# always show localized strings in the start marker 2008-11-27 09:49:29 +0100 oj r264455 : #i93460# set split pos 2008-11-27 09:05:27 +0100 oj r264447 : #i96453# use extension from mimetype / mediatype 2008-11-26 16:24:43 +0100 oj r264416 : #i96520# #i96522# #i96519# some changes at the add field dialog 2008-11-26 16:20:27 +0100 oj r264414 : #i93420# prevent to register a none system file url 2008-11-26 16:19:02 +0100 oj r264413 : #i96522# new class to paste multiple objects 2008-11-26 10:06:12 +0100 oj r264349 : #i96191# introduce new error message and check if type was defined aand should not be changed 2008-11-26 10:06:12 +0100 oj r264348 : #i96191# throw error when decimal is to big 2008-11-25 12:08:59 +0100 oj r264281 : #i96431# correct state for align and move 2008-11-25 11:54:47 +0100 oj r264280 : #i96428# when new bind to first table 2008-11-25 11:49:55 +0100 oj r264279 : #i96434# add report output format to inspection 2008-11-25 11:49:05 +0100 oj r264278 : #i96434# add report output format to inspection 2008-11-24 10:46:23 +0100 oj r264215 : #i96458# size width for controls 2008-11-24 09:28:56 +0100 oj r264199 : #i96459# mark detail section when nothing is selected 2008-11-20 12:02:35 +0100 oj r264038 : #i96191# fix check for prec 2008-11-20 08:06:32 +0100 oj r264026 : #i90949# patch MID function 2008-11-11 13:14:58 +0100 oj r263555 : #i96086# apply patch 2008-11-11 11:34:46 +0100 oj r263549 : #i94128# correct height of section when controls moved outside 2008-11-11 07:52:08 +0100 oj r263544 : #i94729# fix string with ; as sep 2008-11-11 07:45:27 +0100 oj r263543 : #i95222# export chart title style 2008-11-11 07:43:37 +0100 oj r263542 : #i92541# fix line height
2008-12-10 13:41:25 +00:00
for(;aIter != aEnd;++aIter)
{
if ( (*aIter)->GetFieldAlias() == rFieldName )
{
rInfo = *aIter;
break;
}
}
return aIter != aEnd;
}
// -----------------------------------------------------------------------------