/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
sal_Int8 FmGridHeader::AcceptDrop( const AcceptDropEvent& rEvt )
{ // drop allowed in design mode only if (!static_cast<FmGridControl*>(GetParent())->IsDesignMode()) return DND_ACTION_NONE;
// search for recognized formats const DataFlavorExVector& rFlavors = GetDataFlavorExVector(); if (OColumnTransferable::canExtractColumnDescriptor(rFlavors, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR | ColumnTransferFormatFlags::FIELD_DESCRIPTOR)) return rEvt.mnAction;
// check the formats bool bColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(aDroppedData.GetDataFlavorExVector(), ColumnTransferFormatFlags::COLUMN_DESCRIPTOR); bool bFieldDescriptor = OColumnTransferable::canExtractColumnDescriptor(aDroppedData.GetDataFlavorExVector(), ColumnTransferFormatFlags::FIELD_DESCRIPTOR); if (!bColumnDescriptor && !bFieldDescriptor)
{
OSL_FAIL("FmGridHeader::ExecuteDrop: should never have reached this (no extractable format)!"); return DND_ACTION_NONE;
}
ODataAccessDescriptor aColumn = OColumnTransferable::extractColumnDescriptor(aDroppedData); if (aColumn.has(DataAccessDescriptorProperty::DataSource)) aColumn[DataAccessDescriptorProperty::DataSource] >>= sDatasource; if (aColumn.has(DataAccessDescriptorProperty::DatabaseLocation)) aColumn[DataAccessDescriptorProperty::DatabaseLocation] >>= sDatabaseLocation; if (aColumn.has(DataAccessDescriptorProperty::Command)) aColumn[DataAccessDescriptorProperty::Command] >>= sCommand; if (aColumn.has(DataAccessDescriptorProperty::CommandType)) aColumn[DataAccessDescriptorProperty::CommandType] >>= nCommandType; if (aColumn.has(DataAccessDescriptorProperty::ColumnName)) aColumn[DataAccessDescriptorProperty::ColumnName] >>= sFieldName; if (aColumn.has(DataAccessDescriptorProperty::ColumnObject))aColumn[DataAccessDescriptorProperty::ColumnObject] >>= xField; if (aColumn.has(DataAccessDescriptorProperty::Connection)) aColumn[DataAccessDescriptorProperty::Connection] >>= xConnection;
if ( sFieldName.isEmpty()
|| sCommand.isEmpty()
|| ( sDatasource.isEmpty()
&& sDatabaseLocation.isEmpty()
&& !xConnection.is()
)
)
{
OSL_FAIL( "FmGridHeader::ExecuteDrop: somebody started a nonsense drag operation!!" ); return DND_ACTION_NONE;
}
try
{ // need a connection if (!xConnection.is())
{ // the transferable did not contain the connection -> build an own one try
{
OUString sSignificantSource( sDatasource.isEmpty() ? sDatabaseLocation : sDatasource );
xConnection = getConnection_withFeedback(sSignificantSource, OUString(), OUString(), static_cast<FmGridControl*>(GetParent())->getContext(), nullptr );
} catch(NoSuchElementException&)
{ // allowed, means sDatasource isn't a valid data source name...
} catch(Exception&)
{
OSL_FAIL("FmGridHeader::ExecuteDrop: could not retrieve the database access object !");
}
if (!xConnection.is())
{
OSL_FAIL("FmGridHeader::ExecuteDrop: could not retrieve the database access object !"); return DND_ACTION_NONE;
}
}
// try to obtain the column object if (!xField.is())
{ #ifdef DBG_UTIL
Reference< XServiceInfo > xServiceInfo(xConnection, UNO_QUERY);
DBG_ASSERT(xServiceInfo.is() && xServiceInfo->supportsService(SRV_SDB_CONNECTION), "FmGridHeader::ExecuteDrop: invalid connection (no database access connection !)"); #endif
if (xFields.is() && xFields->hasByName(sFieldName))
xFields->getByName(sFieldName) >>= xField;
if (!xField.is())
{
::comphelper::disposeComponent(xStatement); return DND_ACTION_NONE;
}
}
// do the drop asynchronously // (85957 - UI actions within the drop are not allowed, but we want to open a popup menu)
m_pImpl->aDropData = std::move(aColumn);
m_pImpl->aDropData[DataAccessDescriptorProperty::Connection] <<= xConnection;
m_pImpl->aDropData[DataAccessDescriptorProperty::ColumnObject] <<= xField;
try
{ // need number formats
Reference< XNumberFormatsSupplier > xSupplier = getNumberFormats(xConnection, true);
Reference< XNumberFormats > xNumberFormats; if (xSupplier.is())
xNumberFormats = xSupplier->getNumberFormats(); if (!xNumberFormats.is())
{
::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
::comphelper::disposeComponent(m_pImpl->xDroppedStatement); return;
}
// The field now needs two pieces of information: // a.) Name of the field for label and ControlSource // b.) FormatKey, to determine which field is to be created
sal_Int32 nDataType = 0;
xField->getPropertyValue(FM_PROP_FIELDTYPE) >>= nDataType; // these datatypes can not be processed in Gridcontrol switch (nDataType)
{ case DataType::BLOB: case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: case DataType::OTHER:
::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
::comphelper::disposeComponent(m_pImpl->xDroppedStatement); return;
}
if (!xCol.is() || (bDateNTimeCol && !xSecondCol.is()))
{
::comphelper::disposeComponent(xCol); // in case only the creation of the second column failed
::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
::comphelper::disposeComponent(m_pImpl->xDroppedStatement); return;
}
// is the component::Form tied to the database?
Reference< XFormComponent > xFormCp(xCols, UNO_QUERY);
Reference< XPropertySet > xForm(xFormCp->getParent(), UNO_QUERY); if (xForm.is())
{ if (::comphelper::getString(xForm->getPropertyValue(FM_PROP_DATASOURCE)).isEmpty())
{ if ( !sDatasource.isEmpty() )
xForm->setPropertyValue(FM_PROP_DATASOURCE, Any(sDatasource)); else
xForm->setPropertyValue(FM_PROP_URL, Any(sURL));
}
if (::comphelper::getString(xForm->getPropertyValue(FM_PROP_COMMAND)).isEmpty())
{
xForm->setPropertyValue(FM_PROP_COMMAND, Any(sCommand));
Any aCommandType; switch (nCommandType)
{ case CommandType::TABLE:
aCommandType <<= sal_Int32(CommandType::TABLE); break; case CommandType::QUERY:
aCommandType <<= sal_Int32(CommandType::QUERY); break; default:
aCommandType <<= sal_Int32(CommandType::COMMAND);
xForm->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, css::uno::Any(2 == nCommandType)); break;
}
xForm->setPropertyValue(FM_PROP_COMMANDTYPE, aCommandType);
}
}
} catch (Exception&)
{
TOOLS_WARN_EXCEPTION("svx", "caught an exception while creatin' the column !");
::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
::comphelper::disposeComponent(m_pImpl->xDroppedStatement); return;
}
Reference< css::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); // Building of the Insert Menu // mark the column if nColId != HEADERBAR_ITEM_NOTFOUND if(nColId > 0)
{
sal_uInt16 nPos2 = GetModelColumnPos(nColId);
Reference< css::io::XPersistObject > xServiceQuestion(xPropSet, UNO_QUERY);
sal_Int32 nColType = xServiceQuestion.is() ? getColumnTypeByModelName(xServiceQuestion->getServiceName()) : 0; if (nColType == TYPE_TEXTFIELD)
{ // edit fields and formatted fields have the same service name, thus getColumnTypeByModelName returns TYPE_TEXTFIELD // in both cases. And as columns don't have a css::lang::XServiceInfo interface, we have to distinguish both // types via the existence of special properties if (xPropSet.is())
{
Reference< css::beans::XPropertySetInfo > xPropsInfo = xPropSet->getPropertySetInfo(); if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER))
nColType = TYPE_FORMATTEDFIELD;
}
}
if (bDesignMode)
{ int nMenuPos = 0; if (nColType != TYPE_TEXTFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_TEXTFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_EDIT), RID_SVXBMP_EDITBOX); if (nColType != TYPE_CHECKBOX)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_CHECKBOX"1"_ustr, SvxResId(RID_STR_PROPTITLE_CHECKBOX), RID_SVXBMP_CHECKBOX); if (nColType != TYPE_COMBOBOX)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_COMBOBOX"1"_ustr, SvxResId(RID_STR_PROPTITLE_COMBOBOX), RID_SVXBMP_COMBOBOX); if (nColType != TYPE_LISTBOX)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_LISTBOX"1"_ustr, SvxResId(RID_STR_PROPTITLE_LISTBOX), RID_SVXBMP_LISTBOX); if (nColType != TYPE_DATEFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_DATEFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_DATEFIELD), RID_SVXBMP_DATEFIELD); if (nColType != TYPE_TIMEFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_TIMEFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_TIMEFIELD), RID_SVXBMP_TIMEFIELD); if (nColType != TYPE_NUMERICFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_NUMERICFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_NUMERICFIELD), RID_SVXBMP_NUMERICFIELD); if (nColType != TYPE_CURRENCYFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_CURRENCYFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_CURRENCYFIELD), RID_SVXBMP_CURRENCYFIELD); if (nColType != TYPE_PATTERNFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_PATTERNFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_PATTERNFIELD), RID_SVXBMP_PATTERNFIELD); if (nColType != TYPE_FORMATTEDFIELD)
InsertMenuItem(rChangeMenu, nMenuPos++, u"" FM_COL_FORMATTEDFIELD"1"_ustr, SvxResId(RID_STR_PROPTITLE_FORMATTED), RID_SVXBMP_FORMATTEDFIELD);
}
sal_uInt16 nHiddenCols = 0; if (xCols.is())
{ // check for hidden cols
Reference< css::beans::XPropertySet > xCurCol;
Any aHidden,aName; for (sal_Int32 i=0; i<xCols->getCount(); ++i)
{
xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY);
DBG_ASSERT(xCurCol.is(), "FmGridHeader::PreExecuteColumnContextMenu : the Peer has invalid columns !");
aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN);
DBG_ASSERT(aHidden.getValueTypeClass() == TypeClass_BOOLEAN, "FmGridHeader::PreExecuteColumnContextMenu : the property 'hidden' should be boolean !"); if (::comphelper::getBOOL(aHidden))
{ // put the column name into the 'show col' menu if (nHiddenCols < 16)
{ // (only the first 16 items to keep the menu rather small)
aName = xCurCol->getPropertyValue(FM_PROP_LABEL); // the ID is arbitrary, but should be unique within the whole menu
rMenu.insert(nHiddenCols, OUString::number(nHiddenCols + 1), ::comphelper::getString(aName),
nullptr, nullptr, nullptr, TRISTATE_INDET);
}
++nHiddenCols;
}
}
}
rShowMenu.set_visible(u"more"_ustr, xCols.is() && (nHiddenCols > 16));
rMenu.set_visible(u"show"_ustr, xCols.is() && (nHiddenCols > 0));
rMenu.set_sensitive(u"show"_ustr, xCols.is() && (nHiddenCols > 0));
// allow the 'hide column' item ? bool bAllowHide = bMarked; // a column is marked
bAllowHide = bAllowHide || (!bDesignMode && (nPos != sal_uInt16(-1))); // OR we are in alive mode and have hit a column
bAllowHide = bAllowHide && xCols.is(); // AND we have a column container
bAllowHide = bAllowHide && (xCols->getCount()-nHiddenCols > 1); // AND there are at least two visible columns
rMenu.set_visible(u"hide"_ustr, bAllowHide);
rMenu.set_sensitive(u"hide"_ustr, bAllowHide);
if (!bMarked) return;
SfxViewFrame* pCurrentFrame = SfxViewFrame::Current(); // ask the bindings of the current view frame (which should be the one we're residing in) for the state if (pCurrentFrame)
{
std::unique_ptr<SfxBoolItem> pItem;
SfxItemState eState = pCurrentFrame->GetBindings().QueryState(SID_FM_CTL_PROPERTIES, pItem);
Point aRelativePos( pMyHeader->ScreenToOutputPixel( OutputToScreenPixel( aColRect.TopCenter() ) ) );
pMyHeader->triggerColumnContextMenu(aRelativePos);
// handled return;
}
}
}
DbGridControl::Command( _rEvt );
}
// css::beans::XPropertyChangeListener void FmGridControl::propertyChange(const css::beans::PropertyChangeEvent& evt)
{ if (evt.PropertyName == FM_PROP_ROWCOUNT)
{ // if we're not in the main thread call AdjustRows asynchronously
implAdjustInSolarThread(true); return;
}
const DbGridRowRef& xRow = GetCurrentRow(); // no adjustment of the properties is carried out during positioning
Reference<XPropertySet> xSet(evt.Source,UNO_QUERY); if (!(xRow.is() && (::cppu::any2bool(xSet->getPropertyValue(FM_PROP_ISNEW))|| CompareBookmark(getDataSource()->getBookmark(), xRow->GetBookmark())))) return;
if (evt.PropertyName == FM_PROP_ISMODIFIED)
{ // modified or clean ?
GridRowStatus eStatus = ::comphelper::getBOOL(evt.NewValue) ? GridRowStatus::Modified : GridRowStatus::Clean; if (eStatus != xRow->GetStatus())
{
xRow->SetStatus(eStatus);
SolarMutexGuard aGuard;
RowModified(GetCurrentPos());
}
}
}
if (!bMode)
{ // cancel selection
markColumn(USHRT_MAX);
} else
{
Reference< css::container::XIndexContainer > xColumns(GetPeer()->getColumns());
Reference< css::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY); if (xSelSupplier.is())
{
Any aSelection = xSelSupplier->getSelection();
Reference< css::beans::XPropertySet > xColumn; if (aSelection.getValueTypeClass() == TypeClass_INTERFACE)
xColumn.set(aSelection, css::uno::UNO_QUERY);
Reference< XInterface > xCurrent; for (sal_Int32 i=0; i<xColumns->getCount(); ++i)
{
xCurrent.set(xColumns->getByIndex(i), css::uno::UNO_QUERY); if (xCurrent == xColumn)
{
markColumn(GetColumnIdFromModelPos(i)); break;
}
}
}
}
}
void FmGridControl::DeleteSelectedRows()
{ if (!m_pSeekCursor) return;
// how many rows are selected?
sal_Int32 nSelectedRows = GetSelectRowCount();
// the current line should be deleted but it is currently in edit mode if ( IsCurrentAppending() ) return; // is the insert row selected if (GetEmptyRow().is() && IsRowSelected(GetRowCount() - 1))
nSelectedRows -= 1;
// nothing to do if (nSelectedRows <= 0) return;
// try to confirm the delete
Reference< css::frame::XDispatchProvider > xDispatcher = static_cast<css::frame::XDispatchProvider*>(GetPeer()); if (xDispatcher.is())
{
css::util::URL aUrl;
aUrl.Complete = FMURL_CONFIRM_DELETION;
Reference< css::util::XURLTransformer > xTransformer(
css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
xTransformer->parseStrict( aUrl );
xUpdateCursor->moveToInsertRow();
} catch(const Exception&)
{
TOOLS_WARN_EXCEPTION("svx", "Exception caught while deleting rows!");
} // adapt to the data cursor
AdjustDataSource(true);
EndCursorAction();
SetUpdateMode(true);
} else
{
Reference< css::sdbcx::XDeleteRows > xDeleteThem(Reference< XInterface >(*getDataSource()), UNO_QUERY);
// collect the bookmarks of the selected rows
Sequence < Any> aBookmarks = getSelectionBookmarks();
// determine the next row to position after deletion
Any aBookmark; bool bNewPos = false; // if the current row isn't selected we take the row as row after deletion
OSL_ENSURE( GetCurrentRow().is(), "FmGridControl::DeleteSelectedRows: no current row here?" ); // crash reports suggest it can happen we don't have a current row - how? // #154303# / 2008-04-23 / frank.schoenheit@sun.com if ( !IsRowSelected( GetCurrentPos() ) && !IsCurrentAppending() && GetCurrentRow().is() )
{
aBookmark = GetCurrentRow()->GetBookmark();
bNewPos = true;
} else
{ // we look for the first row after the selected block for selection
tools::Long nIdx = LastSelectedRow() + 1; if (nIdx < GetRowCount() - 1)
{ // there is a next row to position on if (SeekCursor(nIdx))
{
GetSeekRow()->SetState(m_pSeekCursor.get(), true);
bNewPos = true; // if it's not the row for inserting we keep the bookmark if (!IsInsertionRow(nIdx))
aBookmark = m_pSeekCursor->getBookmark();
}
} else
{ // we look for the first row before the selected block for selection after deletion
nIdx = FirstSelectedRow() - 1; if (nIdx >= 0 && SeekCursor(nIdx))
{
GetSeekRow()->SetState(m_pSeekCursor.get(), true);
// Are all rows selected? // Second condition if no insertion line exists bool bAllSelected = GetTotalCount() == nSelectedRows || GetRowCount() == nSelectedRows;
// how many rows are deleted?
sal_Int32 nDeletedRows = static_cast<sal_Int32>(std::count_if(std::cbegin(aDeletedRows), std::cend(aDeletedRows),
[](const sal_Int32 nRow) { return nRow != 0; }));
// have rows been deleted? if (nDeletedRows)
{
SetUpdateMode(false);
SetNoSelection(); try
{ // did we delete all the rows than try to move to the next possible row if (nDeletedRows == aDeletedRows.getLength())
{ // there exists a new position to move on if (bNewPos)
{ if (aBookmark.hasValue())
getDataSource()->moveToBookmark(aBookmark); // no valid bookmark so move to the insert row else
{
Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY);
xUpdateCursor->moveToInsertRow();
}
} else
{
Reference< css::beans::XPropertySet > xSet(Reference< XInterface >(*m_pDataCursor), UNO_QUERY);
sal_Int32 nRecordCount(0);
xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount; if ( m_pDataCursor->rowDeleted() )
--nRecordCount;
// there are no rows left and we have an insert row if (!nRecordCount && GetEmptyRow().is())
{
Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY);
xUpdateCursor->moveToInsertRow();
} elseif (nRecordCount) // move to the first row
getDataSource()->first();
}
} // not all the rows where deleted, so move to the first row which remained in the resultset else
{ auto pRow = std::find(std::cbegin(aDeletedRows), std::cend(aDeletedRows), 0); if (pRow != std::cend(aDeletedRows))
{ auto i = static_cast<sal_Int32>(std::distance(std::cbegin(aDeletedRows), pRow));
getDataSource()->moveToBookmark(aBookmarks[i]);
}
}
} catch(const Exception&)
{ try
{ // positioning went wrong so try to move to the first row
getDataSource()->first();
} catch(const Exception&)
{
}
}
// adapt to the data cursor
AdjustDataSource(true);
// not all rows could be deleted; // never select again there the ones that could not be deleted if (nDeletedRows < nSelectedRows)
{ // were all selected if (bAllSelected)
{
SelectAll(); if (IsInsertionRow(GetRowCount() - 1)) // not the insertion row
SelectRow(GetRowCount() - 1, false);
} else
{ // select the remaining rows for (const sal_Int32 nSuccess : aDeletedRows)
{ try
{ if (!nSuccess)
{
m_pSeekCursor->moveToBookmark(m_pDataCursor->getBookmark());
SetSeekPos(m_pSeekCursor->getRow() - 1);
SelectRow(GetSeekPos());
}
} catch(const Exception&)
{ // keep the seekpos in all cases
SetSeekPos(m_pSeekCursor->getRow() - 1);
}
}
}
}
EndCursorAction();
SetUpdateMode(true);
} else// row could not be deleted
{
EndCursorAction(); try
{ // currentrow is the insert row? if (!IsCurrentAppending())
getDataSource()->refreshRow();
} catch(const Exception&)
{
}
}
}
// if there is no selection anymore we can start editing if (!GetSelectRowCount())
ActivateCell();
}
// XCurrentRecordListener void FmGridControl::positioned()
{
SAL_INFO("svx.fmcomp", "FmGridControl::positioned"); // position on the data source (force it to be done in the main thread)
implAdjustInSolarThread(false);
}
bool FmGridControl::commit()
{ // execute commit only if an update is not already executed by the // css::form::component::GridControl if (!IsUpdating())
{ if (Controller().is() && Controller()->IsValueChangedFromSaved())
{ if (!SaveModified()) returnfalse;
}
} returntrue;
}
if (xColumns.is())
{ // locate the column and move in the model; // get ColumnPos
DbGridColumn* pCol = DbGridControl::GetColumns()[ GetModelColumnPos(nId) ].get();
Reference< css::beans::XPropertySet > xCol;
// inserting must be based on the column positions
sal_Int32 i;
Reference< XInterface > xCurrent; for (i = 0; !xCol.is() && i < xColumns->getCount(); i++)
{
xCurrent.set(xColumns->getByIndex(i), css::uno::UNO_QUERY); if (xCurrent == pCol->getModel())
{
xCol = pCol->getModel(); break;
}
}
DBG_ASSERT(i < xColumns->getCount(), "Wrong css::sdbcx::Index");
xColumns->removeByIndex(i);
Any aElement;
aElement <<= xCol;
xColumns->insertByIndex(GetModelColumnPos(nId), aElement);
pCol->setModel(xCol); // if the column which is shown here is selected ... if ( isColumnSelected(pCol) )
markColumn(nId); // ... -> mark it
}
m_bInColumnMove = false;
}
void FmGridControl::InitColumnsByModels(const Reference< css::container::XIndexContainer >& xColumns)
{ // reset columns; // if there is only one HandleColumn, then don't if (GetModelColCount())
{
RemoveColumns();
InsertHandleColumn();
}
if (!xColumns.is()) return;
SetUpdateMode(false);
// inserting must be based on the column positions
sal_Int32 i;
Any aWidth; for (i = 0; i < xColumns->getCount(); ++i)
{
Reference< css::beans::XPropertySet > xCol(
xColumns->getByIndex(i), css::uno::UNO_QUERY);
AppendColumn(aName, static_cast<sal_uInt16>(nWidth));
DbGridColumn* pCol = DbGridControl::GetColumns()[ i ].get();
pCol->setModel(xCol);
}
// and now remove the hidden columns as well // (we did not already make it in the upper loop, since we would then have gotten // problems with the IDs of the columns: AppendColumn allocates them automatically, // but the column _after_ a hidden one needs an ID increased by one ...)
Any aHidden; for (i = 0; i < xColumns->getCount(); ++i)
{
Reference< css::beans::XPropertySet > xCol( xColumns->getByIndex(i), css::uno::UNO_QUERY);
aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden))
HideColumn(GetColumnIdFromModelPos(static_cast<sal_uInt16>(i)));
}
SetUpdateMode(true);
}
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.