summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/querydesign
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/querydesign')
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx19
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx16
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx26
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx37
7 files changed, 58 insertions, 56 deletions
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index a02b5e993c194..fe4e3512cb7f9 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -148,8 +148,10 @@ sal_Bool OQueryTableWindow::Init()
if (m_strInitialAlias.getLength() )
// Der Alias wurde explizit mit angegeben
sAliasName = m_strInitialAlias;
- else
+ else if ( GetTable().is() )
GetTable()->getPropertyValue( PROPERTY_NAME ) >>= sAliasName;
+ else
+ return sal_False;
// Alias mit fortlaufender Nummer versehen
if (pContainer->CountTableAlias(sAliasName, m_nAliasNum))
diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
index 34b74f0569e57..0973aeb767fb2 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
@@ -100,7 +100,7 @@ namespace dbaui
public:
OTabFieldSizedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_SIZE_COLUMN), m_nNextWidth(0) { }
- inline void SetOriginalWidth(long nWidth) { OSL_ENSURE(m_nNextWidth != 0,"Width is 0!");m_nNextWidth = nWidth; }
+ inline void SetOriginalWidth(long nWidth) { m_nNextWidth = nWidth; }
virtual void Undo();
virtual void Redo() { Undo(); }
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 87bfaffa6d7cc..713395d0f1246 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2840,20 +2840,13 @@ SqlParseError OQueryDesignView::InsertField( const OTableFieldDescRef& rInfo, sa
return m_pSelectionBox->InsertField( rInfo, BROWSER_INVALIDID,bVis, bActivate ).isValid() ? eOk : eTooManyColumns;
}
// -----------------------------------------------------------------------------
-sal_Bool OQueryDesignView::getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, sal_uInt32& nWidth )
+sal_Int32 OQueryDesignView::getColWidth(sal_uInt16 _nColPos) const
{
- OTableFields& aFields = static_cast<OQueryController&>(getController()).getTableFieldDesc();
- OTableFields::iterator aIter = aFields.begin();
- for(;aIter != aFields.end();++aIter)
- {
- if( rAliasName == (*aIter)->GetFieldAlias() && rFieldName == (*aIter)->GetField())
- {
- nWidth = (*aIter)->GetColWidth();
- return sal_True;
- }
- }
-
- return sal_False;
+ static sal_Int32 s_nDefaultWidth = GetTextWidth(String(RTL_CONSTASCII_USTRINGPARAM("0"))) * 15;
+ sal_Int32 nWidth = static_cast<OQueryController&>(getController()).getColWidth(_nColPos);
+ if ( !nWidth )
+ nWidth = s_nDefaultWidth;
+ return nWidth;
}
//------------------------------------------------------------------------------
void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboBox* pFieldList)
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 241e5f439909a..12b3093e96643 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1658,8 +1658,11 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDescRef pEntry, USHORT& _nColu
pEntry->SetFunction(sFunctionName);
}
+ nColumnId = pEntry->GetColumnId();
+
+ SetColWidth(nColumnId,getDesignView()->getColWidth(GetColumnPos(nColumnId)-1));
// Neuzeichnen
- Rectangle aInvalidRect = GetInvalidRect( pEntry->GetColumnId() );
+ Rectangle aInvalidRect = GetInvalidRect( nColumnId );
Invalidate( aInvalidRect );
ActivateCell( nCurrentRow, nCurCol );
@@ -1707,11 +1710,6 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OTableFieldDescRef& _r
// Neue Spaltenbeschreibung
OTableFieldDescRef pEntry = _rInfo;
pEntry->SetVisible(bVis);
- sal_uInt32 nColWidth;
- if( getDesignView()->getColWidth(_rInfo->GetAlias(), _rInfo->GetField(), nColWidth) )
- pEntry->SetColWidth( (sal_uInt16)nColWidth );
- else
- pEntry->SetColWidth( (sal_uInt16)DEFAULT_SIZE );
// Spalte einfuegen
InsertColumn( pEntry, _nColumnPostion );
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 95fb6bc38681b..11e9da016f0d1 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -156,12 +156,24 @@ namespace dbaui
//------------------------------------------------------------------------
OTableWindow* OTableConnection::GetSourceWin() const
{
- return m_pParent->GetTabWindow( GetData()->getReferencingTable()->GetWinName() );
+ TTableWindowData::value_type pRef = GetData()->getReferencingTable();
+ OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() );
+ if ( !pRet )
+ {
+ pRet = m_pParent->GetTabWindow( pRef->GetComposedName() );
+ }
+ return pRet;
}
//------------------------------------------------------------------------
OTableWindow* OTableConnection::GetDestWin() const
{
- return m_pParent->GetTabWindow( GetData()->getReferencedTable()->GetWinName() );
+ TTableWindowData::value_type pRef = GetData()->getReferencedTable();
+ OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() );
+ if ( !pRet )
+ {
+ pRet = m_pParent->GetTabWindow( pRef->GetComposedName() );
+ }
+ return pRet;
}
//------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index 0b93274c05ae7..0949c8f5dc11a 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -156,42 +156,42 @@ void OTableFieldDesc::Load(const ::com::sun::star::beans::PropertyValue& _rPrope
DBG_CHKTHIS(OTableFieldDesc,NULL);
Sequence<PropertyValue> aFieldDesc;
_rProperty.Value >>= aFieldDesc;
- if ( aFieldDesc.getLength() == 13 )
+ //if ( aFieldDesc.getLength() == 12 )
{
sal_Int32 nCount = aFieldDesc.getLength();
for (sal_Int32 nPos = 0; nPos < nCount; ++nPos)
{
- if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AliasName")) )
+ if ( aFieldDesc[nPos].Name.equalsAscii("AliasName") )
aFieldDesc[nPos].Value >>= m_aAliasName;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("TableName") )
aFieldDesc[nPos].Value >>= m_aTableName;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldName")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("FieldName") )
aFieldDesc[nPos].Value >>= m_aFieldName;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldAlias")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("FieldAlias") )
aFieldDesc[nPos].Value >>= m_aFieldAlias;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionName")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionName") )
aFieldDesc[nPos].Value >>= m_aFunctionName;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataType")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("DataType") )
aFieldDesc[nPos].Value >>= m_eDataType;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionType")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionType") )
aFieldDesc[nPos].Value >>= m_eFunctionType;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldType")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("FieldType") )
{
sal_Int32 nTemp = 0;
aFieldDesc[nPos].Value >>= nTemp;
m_eFieldType = static_cast<ETableFieldType>(nTemp);
}
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OrderDir")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("OrderDir") )
{
sal_Int32 nTemp = 0;
aFieldDesc[nPos].Value >>= nTemp;
m_eOrderDir = static_cast<EOrderDir>(nTemp);
}
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColWidth")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("ColWidth") )
aFieldDesc[nPos].Value >>= m_nColWidth;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GroupBy")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("GroupBy") )
aFieldDesc[nPos].Value >>= m_bGroupBy;
- else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Visible")) )
+ else if ( aFieldDesc[nPos].Name.equalsAscii("Visible") )
aFieldDesc[nPos].Value >>= m_bVisible;
}
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 4bbd4e1dd419f..48f51b31d5fdd 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -931,6 +931,7 @@ void OQueryController::impl_initialize()
}
}
+
getUndoMgr()->Clear();
if ( ( m_bGraphicalDesign )
@@ -1138,39 +1139,36 @@ void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps)
// -----------------------------------------------------------------------------
void OQueryController::loadViewSettings(const Sequence<PropertyValue>& _rViewProps)
{
- //////////////////////////////////////////////////////////////////////
- // Liste loeschen
- OTableFields().swap(m_vTableFieldDesc);
-
const PropertyValue *pIter = _rViewProps.getConstArray();
const PropertyValue *pEnd = pIter + _rViewProps.getLength();
for (; pIter != pEnd; ++pIter)
{
- if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitterPosition")) )
+ if ( pIter->Name.equalsAscii("SplitterPosition") )
{
pIter->Value >>= m_nSplitPos;
}
- else if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleRows")) )
+ else if ( pIter->Name.equalsAscii("VisibleRows") )
{
pIter->Value >>= m_nVisibleRows;
}
- else if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fields")) )
+ else if ( pIter->Name.equalsAscii("Fields") )
{
- Sequence<PropertyValue> aFields;
- pIter->Value >>= aFields;
- m_vTableFieldDesc.reserve(aFields.getLength() + 1);
- const PropertyValue *pFieldIter = aFields.getConstArray();
- const PropertyValue *pFieldEnd = pFieldIter + aFields.getLength();
- for (; pFieldIter != pFieldEnd; ++pFieldIter)
- {
- OTableFieldDescRef pData = new OTableFieldDesc();
- pData->Load(*pFieldIter);
- m_vTableFieldDesc.push_back(pData);
- }
+ pIter->Value >>= m_aFieldInformation;
}
}
}
// -----------------------------------------------------------------------------
+sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const
+{
+ if ( _nColPos < m_aFieldInformation.getLength() )
+ {
+ ::std::auto_ptr<OTableFieldDesc> pField( new OTableFieldDesc());
+ pField->Load(m_aFieldInformation[_nColPos]);
+ return pField->GetColWidth();
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------------
Reference<XNameAccess> OQueryController::getObjectContainer() const
{
Reference< XNameAccess > xElements;
@@ -1595,8 +1593,8 @@ short OQueryController::saveModified()
void OQueryController::impl_reset()
{
bool bValid = false;
- Sequence< PropertyValue > aLayoutInformation;
+ Sequence< PropertyValue > aLayoutInformation;
// get command from the query if a query name was supplied
if ( !editingCommand() )
{
@@ -1657,7 +1655,6 @@ void OQueryController::impl_reset()
DBG_UNHANDLED_EXCEPTION();
}
}
-
if ( m_sStatement.getLength() )
{
setQueryComposer();