On Fri, Mar 10, 2017 at 01:52:36PM +0100, Stephan Bergmann wrote:
svtools' BrowseBox class (include/svtools/brwbox.hxx; effectively a
collection of BrowseColumn via the BrowseBox::pCols member) apparently
distinguishes between a column's index/position/number (i.e., the
BrowseColumn's position within the BrowseBox::pCols vector) and its ID
(i.e., the BrowseColumn::_nId member, svtools/source/brwbox/datwin.hxx).
Does anybody (Lionel?) known something about that DbGridControl code? Would
this be a bug (if so, any idea how to reproduce it at the GUI?) or is it
maybe an invariant of such a DbGridControl that it's columns' ID always
match the columns' positions?
No, it is not an invariant. Consider
file fmgridcl.cxx function FmGridControl::InitColumnsByModels
for (i = 0; i < xColumns->getCount(); ++i)
{
...
AppendColumn(aName, (sal_uInt16)nWidth);
...
}
// now all columns are inserted with identical id and pos
...
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((sal_uInt16)i));
}
And HideColumn calls
DbGridControl::HideColumn(nId);
which calls
DbGridControl_base::HideColumn(nId);
that is
BrowseBox::RemoveColumn
which does
BrowserColumns::iterator it = pCols->begin();
::std::advance( it, nPos );
delete *it;
pCols->erase( it );
As soon as there is a hidden column, the position and id of the
columns after that one don't match anymore.
--
Lionel
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.