#89657# check name

This commit is contained in:
Ocke Janssen
2001-07-16 06:56:28 +00:00
parent 0861aa8014
commit eeea84397e
15 changed files with 233 additions and 99 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: FieldDescControl.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: oj $ $Date: 2001-05-31 13:37:37 $
* last change: $Author: oj $ $Date: 2001-07-16 07:44:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2120,6 +2120,17 @@ void OFieldDescControl::LoseFocus()
TabPage::LoseFocus();
}
// -----------------------------------------------------------------------------
sal_Bool OFieldDescControl::isCopyAllowed()
{
sal_Bool bAllowed = (m_pActFocusWindow != NULL) &&
(m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName) &&
reinterpret_cast<Edit*>(m_pActFocusWindow)->GetSelected().Len() != 0;
return bAllowed;
}
// -----------------------------------------------------------------------------
sal_Bool OFieldDescControl::isCutAllowed()
{
sal_Bool bAllowed = (m_pActFocusWindow != NULL) &&

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: SqlNameEdit.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: oj $ $Date: 2001-07-06 09:01:34 $
* last change: $Author: oj $ $Date: 2001-07-16 07:44:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,26 +74,49 @@ namespace dbaui
}
//------------------------------------------------------------------
void OSQLNameEdit::Modify()
sal_Bool OSQLNameChecker::checkString( const ::rtl::OUString& _sOldValue,
const ::rtl::OUString& _sToCheck,
::rtl::OUString& _rsCorrected)
{
sal_Bool bCorrected = sal_False;
if(m_bCheck)
{
XubString sSavedValue = GetSavedValue();
XubString sText = GetText();
xub_StrLen nMatch = 0;//sText.Search(sSavedValue);
XubString sSavedValue = _sOldValue;
XubString sText = _sToCheck;
xub_StrLen nMatch = 0;
for(xub_StrLen i=nMatch;i < sText.Len();++i)
{
if(!isCharOk(sText.GetBuffer()[i],i == 0,m_bOnlyUpperCase,m_sAllowedChars))
{
if(i) // only set when not first char
sSavedValue = sText.Copy(nMatch,i-nMatch);
SetText(sSavedValue);
_rsCorrected = sSavedValue;
bCorrected = sal_True;
break;
}
}
}
return bCorrected;
}
//------------------------------------------------------------------
void OSQLNameEdit::Modify()
{
::rtl::OUString sCorrected;
if(checkString(GetSavedValue(),GetText(),sCorrected))
SetText(sCorrected);
SaveValue();
Edit::Modify();
}
//------------------------------------------------------------------
void OSQLNameComboBox::Modify()
{
::rtl::OUString sCorrected;
if(checkString(GetSavedValue(),GetText(),sCorrected))
{
SetText(sCorrected);
SaveValue();
}
Edit::Modify();
ComboBox::Modify();
}
}
// -----------------------------------------------------------------------------

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: sqledit.cxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-04-18 13:20:48 $
* last change: $Author: oj $ $Date: 2001-07-16 07:44:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -208,7 +208,6 @@ void OSqlEdit::OverloadedSetText(const String& rNewText)
MultiLineEdit::SetText(rNewText);
m_strOrigText = rNewText;
static_cast<OQueryContainerWindow*>(m_pView->GetParent())->getView()->getRealView()->getController()->setModified(sal_True);
}
// -----------------------------------------------------------------------------
void OSqlEdit::stopTimer()

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: UserAdmin.cxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-07-09 07:07:20 $
* last change: $Author: oj $ $Date: 2001-07-16 07:46:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -264,7 +264,7 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
Reference<XUser> xUser;
m_xUsers->getByName(GetUser()) >>= xUser;
if(xUser.is())
xUser->changePassword(sOldPwd,aPwdDlg.GetPassword());
xUser->changePassword(sOldPwd.ToUpperAscii(),aPwdDlg.GetPassword().ToUpperAscii());
}
}
}

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: dlgsave.cxx,v $
*
* $Revision: 1.12 $
* $Revision: 1.13 $
*
* last change: $Author: oj $ $Date: 2001-07-06 09:01:35 $
* last change: $Author: oj $ $Date: 2001-07-16 07:46:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
#endif
#ifndef _DBAUI_SQLMESSAGE_HXX_
#include "sqlmessage.hxx"
#endif
@@ -149,24 +152,6 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent,
break;
case CommandType::TABLE:
{
OSL_ENSURE(m_xMetaData.is(),"The metadata can not be null!");
if(m_aName.Search('.') != STRING_NOTFOUND)
{
::rtl::OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(_rxMetaData,
m_aName,
sCatalog,
sSchema,
sTable);
m_aCatalog.SetText(sCatalog);
m_aSchema.SetText(sSchema);
m_aTitle.SetText(sTable);
}
else
m_aTitle.SetText(m_aName);
m_aLabel.SetText(m_sTblLabel);
Point aPos(m_aPB_OK.GetPosPixel());
if(!_rxMetaData->supportsCatalogsInTableDefinitions())
@@ -182,6 +167,25 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent,
m_aSchemaLbl.SetPosPixel(m_aCatalogLbl.GetPosPixel());
m_aSchema.SetPosPixel(m_aCatalog.GetPosPixel());
}
else
{
// now fill the catalogs
try
{
Reference<XResultSet> xRes = m_xMetaData->getCatalogs();
Reference<XRow> xRow(xRes,UNO_QUERY);
::rtl::OUString sCatalog;
while(xRes.is() && xRes->next())
{
sCatalog = xRow->getString(1);
if(!xRow->wasNull())
m_aCatalog.InsertEntry(sCatalog);
}
}
catch(const SQLException&)
{
}
}
if(!_rxMetaData->supportsSchemasInTableDefinitions())
{
@@ -193,6 +197,46 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent,
m_aLabel.SetPosPixel(m_aSchemaLbl.GetPosPixel());
m_aTitle.SetPosPixel(m_aSchema.GetPosPixel());
}
else
{
// now fill the schemata
try
{
Reference<XResultSet> xRes = m_xMetaData->getSchemas();
Reference<XRow> xRow(xRes,UNO_QUERY);
::rtl::OUString sSchema;
while(xRes.is() && xRes->next())
{
sSchema = xRow->getString(1);
if(!xRow->wasNull() && m_aSchema.GetEntryPos(XubString(sSchema)) == COMBOBOX_ENTRY_NOTFOUND)
m_aSchema.InsertEntry(sSchema);
}
m_aSchema.SetText(m_xMetaData->getUserName());
}
catch(const SQLException&)
{
}
}
OSL_ENSURE(m_xMetaData.is(),"The metadata can not be null!");
if(m_aName.Search('.') != STRING_NOTFOUND)
{
::rtl::OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(_rxMetaData,
m_aName,
sCatalog,
sSchema,
sTable);
m_aCatalog.SetText(sCatalog);
if(sSchema.getLength())
m_aSchema.SetText(sSchema);
m_aTitle.SetText(sTable);
}
else
m_aTitle.SetText(m_aName);
m_aPB_OK.SetPosPixel(Point(m_aPB_OK.GetPosPixel().X(),aPos.Y()));
m_aPB_CANCEL.SetPosPixel(Point(m_aPB_CANCEL.GetPosPixel().X(),aPos.Y()));
m_aPB_HELP.SetPosPixel(Point(m_aPB_HELP.GetPosPixel().X(),aPos.Y()));

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: dlgsave.src,v $
*
* $Revision: 1.23 $
* $Revision: 1.24 $
*
* last change: $Author: kz $ $Date: 2001-07-13 21:16:00 $
* last change: $Author: oj $ $Date: 2001-07-16 07:47:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,13 +136,15 @@ ModalDialog DLG_SAVE_AS
Text[ catalan ] = "~Cat<61>logo";
Text[ finnish ] = "~Catalog";
};
Edit ET_CATALOG
ComboBox ET_CATALOG
{
Border = TRUE ;
Pos = MAP_APPFONT ( 77 , 25 ) ;
Size = MAP_APPFONT ( 89 , 12 ) ;
Text = "" ;
SVLook = TRUE ;
TabStop = TRUE ;
DropDown = TRUE ;
AutoHScroll = TRUE ;
};
FixedText FT_SCHEMA
{
@@ -171,13 +173,15 @@ ModalDialog DLG_SAVE_AS
Text[ catalan ] = "~Esquema";
Text[ finnish ] = "~Schema";
};
Edit ET_SCHEMA
ComboBox ET_SCHEMA
{
Border = TRUE ;
Pos = MAP_APPFONT ( 77 , 42 ) ;
Size = MAP_APPFONT ( 89 , 12 ) ;
Text = "" ;
SVLook = TRUE ;
TabStop = TRUE ;
DropDown = TRUE ;
AutoHScroll = TRUE ;
};
FixedText FT_TITLE
{

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: FieldDescControl.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-03-22 07:47:44 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -227,6 +227,8 @@ namespace dbaui
// Resize aufegrufen
void CheckScrollBars();
sal_Bool isCutAllowed();
sal_Bool isCopyAllowed();
void cut();
void copy();
void paste();

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: SqlNameEdit.hxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: oj $ $Date: 2001-07-06 09:01:35 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,28 +64,21 @@
#ifndef _SV_EDIT_HXX
#include <vcl/edit.hxx>
#endif
#ifndef _SV_COMBOBOX_HXX
#include <vcl/combobox.hxx>
#endif
namespace dbaui
{
//==================================================================
class OSQLNameEdit : public Edit
class OSQLNameChecker
{
::rtl::OUString m_sAllowedChars;
sal_Bool m_bOnlyUpperCase;
sal_Bool m_bCheck; // true when we should check for invalid chars
public:
OSQLNameEdit(Window* _pParent,const ::rtl::OUString& _rAllowedChars, WinBits nStyle = WB_BORDER)
: Edit(_pParent,nStyle)
,m_sAllowedChars(_rAllowedChars)
OSQLNameChecker(const ::rtl::OUString& _rAllowedChars)
:m_sAllowedChars(_rAllowedChars)
,m_bOnlyUpperCase(sal_False)
,m_bCheck(sal_True)
{
}
OSQLNameEdit(Window* _pParent,const ResId& _rRes,const ::rtl::OUString& _rAllowedChars = ::rtl::OUString())
: Edit(_pParent,_rRes)
,m_sAllowedChars(_rAllowedChars)
,m_bOnlyUpperCase(sal_False)
,m_bCheck(sal_True)
{
}
@@ -102,6 +95,23 @@ namespace dbaui
{
m_bCheck = _bCheck;
}
sal_Bool checkString(const ::rtl::OUString& _sOldValue,const ::rtl::OUString& _sToCheck,::rtl::OUString& _rsCorrected);
};
//==================================================================
class OSQLNameEdit : public Edit
,public OSQLNameChecker
{
public:
OSQLNameEdit(Window* _pParent,const ::rtl::OUString& _rAllowedChars, WinBits nStyle = WB_BORDER)
: Edit(_pParent,nStyle)
,OSQLNameChecker(_rAllowedChars)
{
}
OSQLNameEdit(Window* _pParent,const ResId& _rRes,const ::rtl::OUString& _rAllowedChars = ::rtl::OUString())
: Edit(_pParent,_rRes)
,OSQLNameChecker(_rAllowedChars)
{
}
// Window overload
// virtual long PreNotify( NotifyEvent& rNEvt );
@@ -109,6 +119,26 @@ namespace dbaui
virtual void Modify();
};
class OSQLNameComboBox : public ComboBox
,public OSQLNameChecker
{
public:
OSQLNameComboBox(Window* _pParent,const ::rtl::OUString& _rAllowedChars, WinBits nStyle = WB_BORDER)
: ComboBox(_pParent,nStyle)
,OSQLNameChecker(_rAllowedChars)
{
}
OSQLNameComboBox(Window* _pParent,const ResId& _rRes,const ::rtl::OUString& _rAllowedChars = ::rtl::OUString())
: ComboBox(_pParent,_rRes)
,OSQLNameChecker(_rAllowedChars)
{
}
// Window overload
// Edit
virtual void Modify();
};
}
#endif // DBAUI_SQLNAMEEDIT_HXX

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: TableController.hxx,v $
*
* $Revision: 1.18 $
* $Revision: 1.19 $
*
* last change: $Author: oj $ $Date: 2001-07-06 08:13:55 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: TableDesignView.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-04-24 14:34:10 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -137,6 +137,7 @@ namespace dbaui
::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
virtual sal_Bool isCutAllowed();
virtual sal_Bool isCopyAllowed();
virtual void copy();
virtual void cut();
virtual void paste();

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: UITools.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-07-02 10:31:49 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,6 +153,10 @@ namespace dbaui
class OFieldDescription;
void setColumnProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
const OFieldDescription* _pFieldDesc);
::rtl::OUString createDefaultName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xTables,
const ::rtl::OUString& _sName);
// .........................................................................
}
// .........................................................................

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: dlgsave.hxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: oj $ $Date: 2001-03-29 06:46:52 $
* last change: $Author: oj $ $Date: 2001-07-16 07:50:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,9 +100,9 @@ namespace dbaui
private:
FixedText m_aDescription;
FixedText m_aCatalogLbl;
OSQLNameEdit m_aCatalog;
OSQLNameComboBox m_aCatalog;
FixedText m_aSchemaLbl;
OSQLNameEdit m_aSchema;
OSQLNameComboBox m_aSchema;
FixedText m_aLabel;
OSQLNameEdit m_aTitle;
OKButton m_aPB_OK;

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTextView.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: fs $ $Date: 2001-06-08 08:41:55 $
* last change: $Author: oj $ $Date: 2001-07-16 07:54:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -303,8 +303,7 @@ void OQueryTextView::clear()
// -----------------------------------------------------------------------------
void OQueryTextView::setStatement(const ::rtl::OUString& _rsStatement)
{
m_pEdit->SetText(_rsStatement);
m_pEdit->Modify();
m_pEdit->OverloadedSetText(_rsStatement);
}
// -----------------------------------------------------------------------------
void OQueryTextView::copy()

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.cxx,v $
*
* $Revision: 1.45 $
* $Revision: 1.46 $
*
* last change: $Author: fs $ $Date: 2001-06-21 17:45:28 $
* last change: $Author: oj $ $Date: 2001-07-16 07:54:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -196,6 +196,9 @@
#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
#include <com/sun/star/util/XFlushable.hpp>
#endif
#ifndef DBAUI_TOOLS_HXX
#include "UITools.hxx"
#endif
extern "C" void SAL_CALL createRegistryInfo_OQueryControl()
{
@@ -1074,6 +1077,9 @@ void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sa
bNew = bNew || _bSaveAs;
if(bNew)
{
Reference<XDatabaseMetaData> xMetaData;
if(m_xConnection.is())
xMetaData = m_xConnection->getMetaData();
String aDefaultName;
if(_bSaveAs && !bNew)
aDefaultName = String(m_sName);
@@ -1081,15 +1087,16 @@ void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sa
{
String aName = String(ModuleRes(m_bCreateView ? STR_VIEW_TITLE : STR_QRY_TITLE));
aName = aName.GetToken(0,' ');
if(m_bCreateView && m_xConnection.is())
aDefaultName = ::dbaui::createDefaultName(xMetaData,_xElements,aName);
else
aDefaultName = String(::dbtools::createUniqueName(_xElements,aName));
}
Reference<XDatabaseMetaData> xMeta;
if(m_xConnection.is())
xMeta = m_xConnection->getMetaData();
OSaveAsDlg aDlg(
getView(), m_bCreateView ? CommandType::TABLE : CommandType::QUERY, _xElements,
xMeta, aDefaultName,
xMetaData, aDefaultName,
_bSaveAs ? SAD_OVERWRITE : SAD_DEFAULT);
if(aDlg.Execute() == RET_OK)

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: table.src,v $
*
* $Revision: 1.30 $
* $Revision: 1.31 $
*
* last change: $Author: kz $ $Date: 2001-07-13 20:48:40 $
* last change: $Author: oj $ $Date: 2001-07-16 07:56:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -951,6 +951,11 @@ ToolBox RID_BRW_TABLEDESIGN_TOOLBOX
Text[ finnish ] = "Tallenna";
};
ToolBoxItem
{
ITEM_FILE_SAVEASDOC
Command = ".uno:SaveAsDoc";
};
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
@@ -1980,6 +1985,11 @@ Menu RID_TABLE_DESIGN_MAIN_MENU
Command = ".uno:Save";
};
MenuItem
{
ITEM_FILE_SAVEASDOC
Command = ".uno:SaveAsDoc";
};
MenuItem
{
Separator = TRUE ;
};