internal override void PerformAction()
        {
            TreeListColumn columnToCopy = _mainForm.GetMultiCellSelector().GetColumnIfExactlyOneSelected();

            if (columnToCopy == null)
            {
                _actionIsCanceled = true;
                return;
            }

            foreach (TreeListNode selectedNode in _mainForm.GetMultiCellSelector().GetSelectedNodes(true, true))
            {
                foreach (TreeListColumn column in _mainForm.treeList.Columns)
                {
                    if (column.Tag != null &&
                        !_mainForm.GetTreeListManager().GetIDsOfHiddenSystems().Contains((column.Tag as SystemTreeListTag).GetSystemRow().ID))
                    {
                        string value = selectedNode.GetValue((columnToCopy.Tag as SystemTreeListTag).GetSystemRow().Name).ToString();
                        (selectedNode.Tag as BaseTreeListTag).StoreChangedValue(value, (column.Tag as SystemTreeListTag).GetSystemRow());
                        selectedNode.SetValue(column, value);

                        //enforce updating of the info provided by combo-boxes and Intelli-sense if Def-functions are changed
                        TreeListManager.UpdateIntelliAndTUBoxInfo((selectedNode.Tag as BaseTreeListTag).GetFunctionName(), column);
                    }
                }
            }
        }
Beispiel #2
0
 void PasteIntoCell(TreeListNode node, TreeListColumn column, string value)
 {
     //account for the destination of the value to paste, i.e. to which column it should be pasted ...
     //... system column: i.e. either a parameter value or a switch of a policy or function
     if (TreeListBuilder.IsSystemColumn(column))
     {
         BaseTreeListTag treeListTag = (node.Tag as BaseTreeListTag);
         DataSets.CountryConfig.SystemRow systemRow = (column.Tag as SystemTreeListTag).GetSystemRow();
         if (!treeListTag.IsPermittedPasteValue(value, systemRow.ID))
         {
             return;                                                          // e.g. trying to paste 'grumml' into a policy-switch
         }
         treeListTag.StoreChangedValue(value, systemRow);
         TreeListManager.UpdateIntelliAndTUBoxInfo((node.Tag as BaseTreeListTag).GetFunctionName(), column);
     }
     //... comment column: i.e. a comment (to a parameter, function or policy)
     else if (TreeListBuilder.IsCommentColumn(column))
     {
         (node.Tag as BaseTreeListTag).SetComment(value);
     }
     //... policy column: ...
     else if (TreeListBuilder.IsPolicyColumn(column))
     {   //... an editable policy column belongs to a parameter and contains e.g. a component of an incomelist, the name of a constant/variable, etc.
         if ((node.Tag as BaseTreeListTag).IsPolicyColumnEditable())
         {
             foreach (CountryConfig.ParameterRow parameterRow in (node.Tag as ParameterTreeListTag).GetParameterRows())
             {
                 parameterRow.Name = value;
             }
         }
         else
         {
             return;  //no action if a policy-, function- or parameter-name
         }
     }
     //... group column:
     else if (TreeListBuilder.IsGroupColumn(column))
     {
         //... an editable group column belongs to a parameter
         if ((node.Tag as BaseTreeListTag).IsGroupColumnEditable())
         {
             foreach (CountryConfig.ParameterRow parameterRow in (node.Tag as ParameterTreeListTag).GetParameterRows())
             {
                 parameterRow.Group = value;
             }
         }
         else
         {
             return;  //group column of policies and functions is not editable
         }
     }
     else
     {
         return;                   //does not happen
     }
     node.SetValue(column, value); //update nodes here to avoid having to redraw the tree (to enhance performance)
 }
 internal UnhideRowsForm(List <KeyValuePair <TreeListNode, TreeListNode> > rangesOfHiddenNodes, TreeListManager treeListManager)
 {
     InitializeComponent();
     foreach (KeyValuePair <TreeListNode, TreeListNode> fromNodeToNode in rangesOfHiddenNodes)
     {
         ListViewItem item = lstHiddenRows.Items.Add(TreeListManager.GetNodeRowNumber(fromNodeToNode.Key, fromNodeToNode.Key.ParentNode) + " - " +
                                                     TreeListManager.GetNodeRowNumber(fromNodeToNode.Value, fromNodeToNode.Value.ParentNode));
         item.Tag = fromNodeToNode;
     }
 }
Beispiel #4
0
 internal static void HideAllOtherRows(TreeListNode node)
 {
     if (node == null)
     {
         return;
     }
     node.TreeList.BeginUpdate();
     EM_AppContext.Instance.GetActiveCountryMainForm().ClearCellSelection();  //clear any existing selection of cells (to avoid that actions on selected cells change hidden rows)
     foreach (TreeListNode siblingNode in TreeListManager.GetSiblingNodes(node))
     {
         siblingNode.Visible = false;
     }
     node.TreeList.EndUpdate();
 }
Beispiel #5
0
        internal override void PerformAction()
        {
            if (_newValue == string.Empty || _changeInTree)
            {
                if (_newValue == string.Empty)
                {
                    _newValue = DefPar.Value.NA;  //developer's wish: do not leave cell empty, but set to n/a instead
                }
                _senderNode.SetValue(_senderColumn, _newValue);
            }
            (_senderNode.Tag as BaseTreeListTag).StoreChangedValue(_newValue, (_senderColumn.Tag as SystemTreeListTag).GetSystemRow());

            //enforce updating of the info provided by combo-boxes and Intelli-sense if Def-functions are changed
            TreeListManager.UpdateIntelliAndTUBoxInfo((_senderNode.Tag as BaseTreeListTag).GetFunctionName(), _senderColumn);
        }
Beispiel #6
0
        internal ContextMenuStrip GetContextMenu(TreeListNode senderNode)
        {
            _senderNode = senderNode;
            List <TreeListNode> nodeList = EM_AppContext.Instance.GetActiveCountryMainForm().GetMultiCellSelector().GetSelectedNodes();

            mniHideSelectedRows.Enabled = (nodeList.Count > 0);
            //fill drop-down menu for 'Hide Rows unto ...' with the rownumber of the node itself (e.g. 1.2) and all its successors on the same level (e.g. 1.3, 1.4, ...)
            cboHideRowsUnto.Items.Clear();
            cboHideRowsUnto.Items.Add(TreeListManager.GetNodeRowNumber(_senderNode, _senderNode.ParentNode));
            foreach (TreeListNode siblingNodeAfter in TreeListManager.GetSiblingNodesAfter(_senderNode))
            {
                cboHideRowsUnto.Items.Add(TreeListManager.GetNodeRowNumber(siblingNodeAfter, siblingNodeAfter.ParentNode));
            }
            cboHideRowsUnto.SelectedIndex = 0; //put starting node into textfield of drop-down

            return(mnuRow);
        }
Beispiel #7
0
        void cboHideRowsUnto_DropDownClosed(object sender, EventArgs e)
        {
            mnuRow.Hide();

            EM_AppContext.Instance.GetActiveCountryMainForm().ClearCellSelection();  //clear any existing selection of cells (to avoid that actions on selected cells change hidden rows)

            //hide all nodes from the one the context menu was started from to the one selected from the combo-box with nodes after
            int index = 0;

            _senderNode.Visible = false;
            foreach (TreeListNode siblingNodeAfter in TreeListManager.GetSiblingNodesAfter(_senderNode))
            {
                if (index >= cboHideRowsUnto.SelectedIndex)
                {
                    break;
                }
                siblingNodeAfter.Visible = false;
                ++index;
            }
        }
Beispiel #8
0
        void mniUnhideRows_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <TreeListNode, TreeListNode> > rangesOfHiddenNodes = new List <KeyValuePair <TreeListNode, TreeListNode> >();

            TreeListManager.GetRangesOfHiddenNodes(_mainForm.treeList.Nodes, ref rangesOfHiddenNodes);

            UnhideRowsForm unhideRowForm = new UnhideRowsForm(rangesOfHiddenNodes, _mainForm.GetTreeListManager());

            if (unhideRowForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            _mainForm.ClearCellSelection();
            _mainForm.treeList.BeginUpdate();
            foreach (KeyValuePair <TreeListNode, TreeListNode> fromNodeToNode in unhideRowForm.GetRangesOfNodesToHide())
            {
                _mainForm.GetTreeListManager().UnhideNodeRange(fromNodeToNode.Key, fromNodeToNode.Value);
            }
            _mainForm.treeList.EndUpdate();
        }
        void FindNextPrev(bool findNext)
        {
            if (IsSearchFieldEmpty())
            {
                return;
            }

            //put the search/replace string into the combo-box (if not already in) to have a 'history' of searches
            AddToHistory(cboFind);
            AddToHistory(cboReplaceBy);

            //find the matching cells
            //remark: finding all cells is probably faster than finding the next cell by using the functions which delivers the visible index (i.e. not an internal index, but what the user sees)
            if (!FindMatches())
            {
                return; //no matches found (respective notification is displayed in FindMatches)
            }
            //sort the list of matching cells with respect of sort-order (next/previous) as well as sort-by (column/row)
            List <List <int> > sortedMatchInfo = new List <List <int> >();

            for (int iUnsorted = 0; iUnsorted < _foundCells.Count; ++iUnsorted)
            {
                KeyValuePair <TreeListColumn, TreeListNode> cellToSortIn = _foundCells.ElementAt(iUnsorted);
                int colToSortIn = GetActiveMainForm().treeList.Columns.IndexOf(cellToSortIn.Key);
                int rowToSortIn = TreeListManager.GetNodeVirtualRow(cellToSortIn.Value);

                List <int> matchInfoToSortIn = new List <int>();
                matchInfoToSortIn.Add(iUnsorted);
                matchInfoToSortIn.Add(colToSortIn);
                matchInfoToSortIn.Add(rowToSortIn);

                int i = 0;
                for (; i < sortedMatchInfo.Count; ++i)
                {
                    int indexYetIn = sortedMatchInfo.ElementAt(i).ElementAt(0);
                    int colYetIn   = sortedMatchInfo.ElementAt(i).ElementAt(1);
                    int rowYetIn   = sortedMatchInfo.ElementAt(i).ElementAt(2);
                    if (findNext && radSearchByColumns.Checked)
                    {
                        if (colYetIn > colToSortIn || (colYetIn == colToSortIn && rowYetIn > rowToSortIn))
                        {
                            break;
                        }
                    }
                    if (findNext && radSearchByRows.Checked)
                    {
                        if (rowYetIn > rowToSortIn || (rowYetIn == rowToSortIn && colYetIn > colToSortIn))
                        {
                            break;
                        }
                    }
                    if (!findNext && radSearchByColumns.Checked)
                    {
                        if (colYetIn < colToSortIn || (colYetIn == colToSortIn && rowYetIn < rowToSortIn))
                        {
                            break;
                        }
                    }
                    if (!findNext && radSearchByRows.Checked)
                    {
                        if (rowYetIn < rowToSortIn || (rowYetIn == rowToSortIn && colYetIn < colToSortIn))
                        {
                            break;
                        }
                    }
                }
                sortedMatchInfo.Insert(i, matchInfoToSortIn);
            }

            //assess the visible indices of the currently focused cell, search it in the list to assess the next/previous cell
            int index = findNext ? 0 : sortedMatchInfo.Count - 1; //focus first/last matching cell if no match or no focus

            if (GetActiveMainForm().treeList.FocusedNode != null && GetActiveMainForm().treeList.FocusedColumn != null)
            {
                int focusedRow    = TreeListManager.GetNodeVirtualRow(GetActiveMainForm().treeList.FocusedNode);
                int focusedColumn = GetActiveMainForm().treeList.Columns.IndexOf(GetActiveMainForm().treeList.FocusedColumn);

                int Criterion1        = radSearchByColumns.Checked ? 1 : 2;
                int Criterion2        = radSearchByColumns.Checked ? 2 : 1;
                int focusedCriterion1 = radSearchByColumns.Checked ? focusedColumn : focusedRow;
                int focusedCriterion2 = radSearchByColumns.Checked ? focusedRow : focusedColumn;
                int prevNextConverter = findNext ? 1 : -1;

                for (int i = 0; i < sortedMatchInfo.Count; ++i)
                {
                    int matchInfoIndex      = sortedMatchInfo.ElementAt(i).ElementAt(0);
                    int matchInfoCriterion1 = sortedMatchInfo.ElementAt(i).ElementAt(Criterion1);
                    int matchInfoCriterion2 = sortedMatchInfo.ElementAt(i).ElementAt(Criterion2);

                    if (matchInfoCriterion1 * prevNextConverter > focusedCriterion1 * prevNextConverter ||
                        (matchInfoCriterion1 == focusedCriterion1 && matchInfoCriterion2 * prevNextConverter > focusedCriterion2 * prevNextConverter))
                    {
                        index = matchInfoIndex;
                        break;
                    }
                }
            }

            //focus next/previous matching cell or first/last if no next/previous match found
            TreeListNode   node   = _foundCells.ElementAt(index).Value;
            TreeListColumn column = _foundCells.ElementAt(index).Key;

            //expand the parent nodes to make the match visible
            for (TreeListNode parentNode = node.ParentNode; parentNode != null; parentNode = parentNode.ParentNode)
            {
                parentNode.Expanded = true;
            }
            node.TreeList.FocusedNode   = node;
            node.TreeList.FocusedColumn = column;
        }
Beispiel #10
0
        //returns the footnote parameters which need to be added when a formula was changed
        //e.g. formula contains 'Amount#4711' (and did not contain that before the change): footnote parameter #Amount with group 4711 must be added
        internal static Dictionary <KeyValuePair <string, string>, DefinitionAdmin.Par> GetFootnoteParametersToAdd(TreeListNode node, ref string formulaText)
        {
            Dictionary <KeyValuePair <string, string>, DefinitionAdmin.Par> footnoteParametersToAdd =
                new Dictionary <KeyValuePair <string, string>,       //name and group of new footnote parameter
                                DefinitionAdmin.Par>();              //definition (from config file) of new parameter

            int    nextFootnote = TreeListManager.GetNextAvailableFootnoteCounter(node.ParentNode);
            string functionName = node.ParentNode.GetDisplayText(TreeListBuilder._policyColumnName);

            //search for Amount#xi (i.e Amount#x1, Amount#x2, etc.)
            for (int indexLabelAmount = formulaText.ToLower().IndexOf(DefPar.Value.AMOUNT.ToLower() + "#x"), indexNonDigit;
                 indexLabelAmount >= 0;
                 indexLabelAmount = formulaText.ToLower().IndexOf(DefPar.Value.AMOUNT.ToLower() + "#x"))
            {
                for (indexNonDigit = indexLabelAmount + DefPar.Value.AMOUNT.Length + 2;
                     indexNonDigit < formulaText.Length && EM_Helpers.IsDigit(formulaText.ElementAt(indexNonDigit));
                     ++indexNonDigit)
                {
                    ;                                              //search first non digit after Amount#x
                }
                string parameterName = "#_" + DefPar.Value.AMOUNT; //#_Amount
                DefinitionAdmin.Par           parDef = DefinitionAdmin.GetParDefinition(functionName, parameterName);
                KeyValuePair <string, string> parameterNameAndGroup = new KeyValuePair <string, string>(parameterName, nextFootnote.ToString());
                footnoteParametersToAdd.Add(parameterNameAndGroup, parDef);                           //put parameter into list of footnote parameters which need to be generated
                string toReplace = SubstringFromTo(formulaText, indexLabelAmount, indexNonDigit - 1); //Amount#xi (e.g. Amount#x1)
                string replaceBy = DefPar.Value.AMOUNT + "#" + nextFootnote.ToString();               //Amount#f (e.g. Amount#x3)
                formulaText = formulaText.Replace(toReplace, replaceBy);                              //replace all occurrences (there might be more than one)
                ++nextFootnote;
            }

            //search for #xi[_yyy] (i.e. #x1[_Level], #x2[_Level], #x1[_UpLim], etc.)
            for (int indexPlaceholder = formulaText.IndexOf("[_");
                 indexPlaceholder >= 0;
                 indexPlaceholder = formulaText.IndexOf("[_"))
            {
                int iStart = formulaText.Substring(0, indexPlaceholder).LastIndexOf("#x");
                int iEnd   = formulaText.Substring(indexPlaceholder).IndexOf("]") + indexPlaceholder;
                if (iStart >= 0 && iEnd >= 0 &&
                    EM_Helpers.IsNonNegInteger(SubstringFromTo(formulaText, iStart + 2, indexPlaceholder - 1)))
                {
                    string parameterName       = "#" + SubstringFromTo(formulaText, indexPlaceholder + 1, iEnd - 1); //#_yyy (e.g. #_Level)
                    DefinitionAdmin.Fun funDef = DefinitionAdmin.GetFunDefinition(functionName, false);              // check if function allows for this footnote
                    if (funDef != null && (from p in funDef.GetParList() where p.Value.isFootnote && p.Key.ToLower() == parameterName.ToLower() select p).Count() > 0)
                    {
                        DefinitionAdmin.Par           parDef = DefinitionAdmin.GetParDefinition(functionName, parameterName);
                        KeyValuePair <string, string> parameterNameAndGroup = new KeyValuePair <string, string>(parameterName, nextFootnote.ToString());
                        footnoteParametersToAdd.Add(parameterNameAndGroup, parDef);    //put parameter into list of footnote parameters which need to be generated
                        string toReplace = SubstringFromTo(formulaText, iStart, iEnd); //#xi_yyy (e.g. #x1[_Level])
                        string replaceBy = "#" + nextFootnote.ToString();              //#f_yyy (e.g. #4)
                        formulaText = formulaText.Replace(toReplace, replaceBy);       //replace all occurrences (there might be more than one)
                        ++nextFootnote;
                    }
                    else
                    {
                        break; //should not happen (though can), but to avoid infinite loop
                    }
                }
                else
                {
                    break; //should not happen (though can), but to avoid infinite loop
                }
            }

            //search for query#x (e.g. isNtoMchild#x)
            for (int indexPlaceholder = formulaText.IndexOf("#x");
                 indexPlaceholder >= 0;
                 indexPlaceholder = formulaText.IndexOf("#x"))
            {
                string theQuery = string.Empty;
                foreach (string queryName in DefinitionAdmin.GetQueryNamesAndDesc().Keys)
                {
                    string potQueryName = SubstringFromTo(formulaText, indexPlaceholder - (queryName.Length - 2), indexPlaceholder + 1).ToLower();
                    if (potQueryName == queryName.ToLower())
                    {
                        theQuery = queryName;
                        break;
                    }
                }
                if (theQuery == string.Empty)
                {
                    formulaText = formulaText.Substring(0, indexPlaceholder) + "#°" +
                                  formulaText.Substring(indexPlaceholder + 2);   //no query found, replace #x preliminary by #° (change back below)
                }
                else //add all parameters of the query
                {
                    Dictionary <string, DefinitionAdmin.Par> queryParameters = new Dictionary <string, DefinitionAdmin.Par>();
                    DefinitionAdmin.GetQueryDefinition(theQuery, out DefinitionAdmin.Query queryDef, out string dummy, false);
                    if (queryDef != null)
                    {
                        queryParameters = queryDef.par;
                    }
                    List <string> alreadyCoveredByAlias = new List <string>(); // avoid adding e.g. #_income as well as #_info
                    foreach (var q in queryParameters)
                    {
                        string queryParName = q.Key; DefinitionAdmin.Par queryParDef = q.Value;
                        if (alreadyCoveredByAlias.Contains(queryParName))
                        {
                            continue;
                        }
                        footnoteParametersToAdd.Add(new KeyValuePair <string, string>(queryParName, nextFootnote.ToString()), queryParDef); //put parameter into list of footnote parameters which need to be generated
                        alreadyCoveredByAlias.AddRange(queryParDef.substitutes);
                    }
                    formulaText = formulaText.Substring(0, indexPlaceholder) + "#" + nextFootnote.ToString() +
                                  formulaText.Substring(indexPlaceholder + 2); //replace #x by #f (e.g. #x by #5)
                    ++nextFootnote;
                }
            }
            formulaText = formulaText.Replace("#°", "#x");

            return(footnoteParametersToAdd);
        }
        List <IntelliItem> GetIntelliItems()
        {
            List <IntelliItem> intelliItems = new List <IntelliItem>();

            intelliItems.Clear();

            try
            {
                if (_treeList.FocusedNode.Tag == null)
                {
                    return(intelliItems); //should not happen
                }
                BaseTreeListTag   nodeTag   = _treeList.FocusedNode.Tag as BaseTreeListTag;
                SystemTreeListTag systemTag = null;

                //first assess which intelli-items should be shown in dependece of the edited cell ...
                List <int> specficIntelliItems = null;
                if (TreeListBuilder.IsPolicyColumn(_treeList.FocusedColumn)) //editited cell is an exceptionally editable policy-column-cell (e.g. functions DefIL, DefConst, SetDefault, etc.)
                {
                    //take system specific intelli-items (e.g. incomelists) from any existing system, as one cannot know for which system the user wants to define the parameter
                    TreeListColumn anySystemColumn = _treeList.Columns.ColumnByName(nodeTag.GetDefaultPolicyRow().SystemRow.Name);
                    if (anySystemColumn != null)
                    {
                        systemTag = anySystemColumn.Tag as SystemTreeListTag;
                    }
                    //in dependence of the function define the available intelli-items (e.g. only variables or variables and incomelists, etc.)
                    specficIntelliItems = GetIntelliItemsForEditablePolicyColumn(nodeTag.GetDefaultFunctionRow().Name);
                }
                else if (TreeListBuilder.IsSystemColumn(_treeList.FocusedColumn))
                {
                    //in dependence of the parameter-value-type define the available intelli-items (usually everything, but e.g. for output_variables only variables)
                    systemTag           = _treeList.FocusedColumn.Tag as SystemTreeListTag;
                    specficIntelliItems = nodeTag.GetTypeSpecificIntelliItems(systemTag);
                }
                else
                {
                    return(intelliItems); //should not happen
                }
                //... then gather the respective intelli-items
                //constants defined by function DefConst
                if ((specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsDefConst)) && systemTag != null)
                {
                    foreach (DataSets.CountryConfig.ParameterRow parameterRow in systemTag.GetParameterRowsConstants())
                    {
                        if (parameterRow.Name.ToLower() == DefPar.DefVar.EM2_Var_Name.ToLower())
                        {
                            intelliItems.Add(new IntelliItem(parameterRow.Value, parameterRow.Comment, _intelliImageConstant));
                        }
                        else if (parameterRow.Name.ToLower() == DefPar.DefConst.Condition.ToLower())
                        {
                            continue;
                        }
                        else
                        {
                            intelliItems.Add(new IntelliItem(parameterRow.Name, GetConstDescription(parameterRow) + " " + parameterRow.Comment, _intelliImageConstant));
                        }
                    }
                }

                //variables defined by function DefVar
                if ((specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsDefVar)) && systemTag != null)
                {
                    foreach (DataSets.CountryConfig.ParameterRow parameterRow in systemTag.GetParameterRowsDefVariables())
                    {
                        if (parameterRow.Name.ToLower() == DefPar.DefVar.EM2_Var_Name.ToLower())
                        {
                            intelliItems.Add(new IntelliItem(parameterRow.Value, parameterRow.Comment, _intelliImageVariable));
                        }
                        else
                        {
                            intelliItems.Add(new IntelliItem(parameterRow.Name, parameterRow.Comment, _intelliImageVariable));
                        }
                    }
                }

                // uprating factors
                if (specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsUpRateFactor))
                {
                    string cc = EM_AppContext.Instance.GetActiveCountryMainForm().GetCountryShortName();
                    CountryConfigFacade ccf = CountryAdministration.CountryAdministrator.GetCountryConfigFacade(cc);
                    foreach (CountryConfig.UpratingIndexRow ur in ccf.GetUpratingIndices())
                    {
                        intelliItems.Add(new IntelliItem(ur.Reference, ur.Description, _intelliImageConstant));
                    }
                }

                //standard variables defined in VarConfig (idhh, yem, poa, ...)
                if (specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsStandardVar))
                {
                    string countryShortName = systemTag == null ? string.Empty : systemTag.GetSystemRow().CountryRow.ShortName;
                    Dictionary <string, string> standardVariables = EM_AppContext.Instance.GetVarConfigFacade().GetVariables_NamesAndDescriptions(countryShortName);
                    foreach (string standardVariable in standardVariables.Keys)
                    {
                        intelliItems.Add(new IntelliItem(standardVariable, standardVariables[standardVariable], _intelliImageVariable));
                    }
                }

                //incomelists defined by function DefIL
                if ((specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsDefIL)) && systemTag != null)
                {
                    foreach (DataSets.CountryConfig.ParameterRow parameterRow in systemTag.GetParameterRowsILs())
                    {
                        intelliItems.Add(new IntelliItem(parameterRow.Value, systemTag.GetILTUComment(parameterRow), _intelliImageIL));
                    }
                }

                //queries (IsDepChild, ...)
                if (specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsQueries))
                {
                    foreach (var q in DefinitionAdmin.GetQueryNamesAndDesc())
                    {
                        string queryName = q.Key, queryDesc = q.Value;
                        intelliItems.Add(new IntelliItem(queryName, queryDesc, _intelliImageConfiguration)); //first add normally ...
                        intelliItems.Add(new IntelliItem(_queryPrefix + queryName,                           //.. then add with query prefix to allow users to see all available queries (is removed before query is inserted)
                                                         queryDesc, _intelliImageConfiguration));
                    }
                }

                //footnotes
                if (specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsFootnotes))
                {
                    //placeholders for new footnote parameters (#x1[_Level], #x2[_UpLim], etc.)
                    Dictionary <string, string> footnotes = GetFootnoteParametersForIntelli();
                    foreach (string footnote in footnotes.Keys)
                    {
                        intelliItems.Add(new IntelliItem(footnote, footnotes[footnote], _intelliImageFootnote));
                    }

                    //existing footnote amount parameters (#_Amount reverserd to Amount#x)
                    footnotes = TreeListManager.GetFunctionsExistingAmountParameters(_treeList.FocusedNode.ParentNode, _treeList.FocusedColumn.GetCaption());
                    foreach (string footnote in footnotes.Keys)
                    {
                        intelliItems.Add(new IntelliItem(footnote, footnotes[footnote], _intelliImageFootnote));
                    }

                    //other existing footnote parameters (#_Level, #_UpLim, etc.)
                    footnotes = TreeListManager.GetFunctionsExistingFootnoteParameters(_treeList.FocusedNode.ParentNode, _treeList.FocusedColumn.GetCaption());
                    foreach (string footnote in footnotes.Keys)
                    {
                        intelliItems.Add(new IntelliItem(footnote, footnotes[footnote], _intelliImageFootnote));
                    }
                }

                if (specficIntelliItems == null || specficIntelliItems.Contains(_intelliContainsRandAbsMinMax))
                {
                    intelliItems.Add(new IntelliItem("rand", "Random number", _intelliImageConfiguration));
                    intelliItems.Add(new IntelliItem("<abs>()", "Absolute value operator", _intelliImageConfiguration));
                    intelliItems.Add(new IntelliItem("<min> ", "Minimum operator", _intelliImageConfiguration));
                    intelliItems.Add(new IntelliItem("<max> ", "Maximum operator", _intelliImageConfiguration));
                }

                // special case for parameter DefTU/Members: show the options, e.g. Partner, OwnDepChild, ...
                if (specficIntelliItems != null && specficIntelliItems.Contains(_intelliContainsDefTUMembers))
                {
                    ParameterTreeListTag parTag = nodeTag as ParameterTreeListTag;
                    if (parTag != null)
                    {
                        foreach (string tuMember in new List <string>()
                        {
                            DefPar.DefTu.MEMBER_TYPE.PARTNER_CAMEL_CASE, DefPar.DefTu.MEMBER_TYPE.OWNCHILD_CAMEL_CASE,
                            DefPar.DefTu.MEMBER_TYPE.DEPCHILD_CAMEL_CASE, DefPar.DefTu.MEMBER_TYPE.OWNDEPCHILD_CAMEL_CASE, DefPar.DefTu.MEMBER_TYPE.LOOSEDEPCHILD_CAMEL_CASE,
                            DefPar.DefTu.MEMBER_TYPE.DEPPARENT_CAMEL_CASE, DefPar.DefTu.MEMBER_TYPE.DEPRELATIVE_CAMEL_CASE
                        })
                        {
                            intelliItems.Add(new IntelliItem(tuMember, string.Empty, _intelliImageConfiguration));
                        }
                    }
                }

                //taxunits defined by function DefTU: only for add-ons, which use formulas for all parameters (i.e. also for taxunit parameters)
                if ((_treeList.Parent as EM_UI_MainForm)._isAddOn && systemTag != null)
                {
                    foreach (DataSets.CountryConfig.ParameterRow parameterRow in systemTag.GetParameterRowsTUs())
                    {
                        intelliItems.Add(new IntelliItem(parameterRow.Value, systemTag.GetILTUComment(parameterRow), _intelliImageTU));
                    }
                }
                return(intelliItems);
            }
            catch
            {
                //do not jeopardise the UI-stability because IntelliItems cannot be gathered but try if problem can be fixed by updating the info
                UpdateInfo();
                return(intelliItems);
            }

            List <int> GetIntelliItemsForEditablePolicyColumn(string functionName)
            {
                functionName = functionName.ToLower();
                List <int> items = new List <int>();

                if (functionName == DefFun.SetDefault.ToLower() || functionName == DefFun.Uprate.ToLower())
                {
                    items.Add(_intelliContainsStandardVar);
                    items.Add(_intelliContainsDefVar); //not sure whether variables defined by DefVar should be displayed (?)
                }
                if (functionName == DefFun.DefIl.ToLower())
                {
                    items.Add(_intelliContainsStandardVar);
                    items.Add(_intelliContainsDefVar);
                    items.Add(_intelliContainsDefConst);
                    items.Add(_intelliContainsDefIL);
                }
                //other functions with editable policy column (DefConst, DefVar): no intelliItems (i.e. no suggestions for e.g. constant names)
                return(items);
            }
        }
        public override void Execute(TreeListNode senderNode)
        {
            if (senderNode.Tag == null || (senderNode.Tag as BaseTreeListTag).GetParameterName() == null)
            {
                return; //policy- or function-node
            }
            ParameterTreeListTag nodeTag = senderNode.Tag as ParameterTreeListTag;

            UsedComponent usedComponent = new UsedComponent();

            foreach (CountryConfig.ParameterRow parameterRow in nodeTag.GetParameterRows())
            {
                if (!_systemIDs.Contains(parameterRow.FunctionRow.PolicyRow.SystemID))
                {
                    continue;
                }

                if (_ignoreIfSwitchedOff && (parameterRow.FunctionRow.Switch.ToLower() == DefPar.Value.OFF ||
                                             parameterRow.FunctionRow.PolicyRow.Switch.ToLower() == DefPar.Value.OFF))
                {
                    continue;
                }

                //formulas and conditions need a special comparison operation ...
                if (parameterRow.ValueType.ToLower() == DefinitionAdmin.ParTypeToString(DefPar.PAR_TYPE.CONDITION).ToLower() ||
                    parameterRow.ValueType.ToLower() == DefinitionAdmin.ParTypeToString(DefPar.PAR_TYPE.FORMULA).ToLower())
                {
                    if (!_doPatternSearch)
                    {
                        if (!EM_Helpers.DoesFormulaContainComponent(parameterRow.Value, _componentName))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (!EM_Helpers.DoesValueMatchPattern(_componentName, parameterRow.Value, false, true))
                        {
                            continue;
                        }
                    }
                }
                //... for other parameter types it's enough to compare the value
                else
                {
                    if (!_doPatternSearch)
                    {
                        if (parameterRow.Value.ToLower() != _componentName.ToLower())
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (!EM_Helpers.DoesValueMatchPattern(_componentName, parameterRow.Value, false, true))
                        {
                            continue;
                        }
                    }
                }

                usedComponent._systemNames.Add(parameterRow.FunctionRow.PolicyRow.SystemRow.Name);
            }

            //take account of the fact that the policy column also may contain components (i.e. variables in DefIL, SetDefault, Uprate, etc.)
            if (nodeTag.IsPolicyColumnEditable())
            {
                string contentPolicyColumn = senderNode.GetDisplayText(senderNode.TreeList.Columns.ColumnByName(TreeListBuilder._policyColumnName));
                if (EM_Helpers.DoesValueMatchPattern(_componentName, contentPolicyColumn, false, false))
                {
                    usedComponent._row = TreeListManager.GetNodeRowNumber(senderNode, senderNode.ParentNode);
                }
            }

            if (usedComponent._systemNames.Count == 0 && usedComponent._row == string.Empty)
            {
                return;
            }

            usedComponent._policyName   = nodeTag.GetPolicyName();
            usedComponent._functionName = nodeTag.GetFunctionName();
            if (usedComponent._row == string.Empty)
            {
                usedComponent._parameterName = nodeTag.GetParameterName();
            }
            usedComponent._row  = TreeListManager.GetNodeRowNumber(senderNode, senderNode.ParentNode);
            usedComponent._node = senderNode;
            _usedComponents.Add(usedComponent);
        }