%% start of file `moderncvskillmatrix.sty'.
%% Copyright 2021 David Seus (cryptointerest@posteo.de).
%
% This package provides a skill matrix template for the moderncv package.
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


%-------------------------------------------------------------------------------
%                identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvskillmatrix}[2021/01/18 v2.1.0 modern curriculum vitae and letter skill matrix]

% The definitions need to be adjusted depending on which moderncvbody<i-v>.sty style is usde. 
% body type options: "moderncvbodyi" (default), "moderncvbodyii", "moderncvbodyiii", "moderncvbodyiv" or "moderncvbodyv" 
\@initializeif{\if@moderncvbodyi}\@moderncvbodyifalse
\DeclareOption{moderncvbodyi}{\@moderncvbodyitrue\@moderncvbodyiifalse\@moderncvbodyiiifalse\@moderncvbodyivfalse\@moderncvbodyvfalse}
\@initializeif{\if@moderncvbodyii}\@moderncvbodyiifalse
\DeclareOption{moderncvbodyii}{\@moderncvbodyifalse\@moderncvbodyiitrue\@moderncvbodyiiifalse\@moderncvbodyivfalse\@moderncvbodyvfalse}
\@initializeif{\if@moderncvbodyiii}\@moderncvbodyiiifalse
\DeclareOption{moderncvbodyiii}{\@moderncvbodyifalse\@moderncvbodyiifalse\@moderncvbodyiiitrue\@moderncvbodyivfalse\@moderncvbodyvfalse}
\@initializeif{\if@moderncvbodyiv}\@moderncvbodyivfalse
\DeclareOption{moderncvbodyiv}{\@moderncvbodyifalse\@moderncvbodyiifalse\@moderncvbodyiiifalse\@moderncvbodyivtrue\@moderncvbodyvfalse}
\@initializeif{\if@moderncvbodyv}\@moderncvbodyvfalse
\DeclareOption{moderncvbodyv}{\@moderncvbodyifalse\@moderncvbodyiifalse\@moderncvbodyiiifalse\@moderncvbodyivfalse\@moderncvbodyvtrue}

\DeclareOption*{}% avoid choking on unknown options
\ExecuteOptions{moderncvbodyi}
\ProcessOptions*\relax% \ProcessOptions* processes the options in the order provided (i.e., with the later ones possibly overriding the former ones), while \ProcessOptions processes them in the order of the package

%-------------------------------------------------------------------------------
%                required packages
%-------------------------------------------------------------------------------
\RequirePackage{tikz}
\RequirePackage{multirow}
% package arydshln is needed for the dashed lines but is incompatible with fancy style
\if@moderncvbodyv%
%     \RequirePackage{arydshln} % incompatible with fancy style
\else%
    \RequirePackage{arydshln} % incompatible with fancy style
\fi

% %-------------------------------------------------------------------------------
% %                \cvSkill command
% %-------------------------------------------------------------------------------
% The code for the Skilllevel illustration with the little boxes.
% This is idea stolen from the limecv package
\@initializelength{\cvSkill@RectangleSize}
\setlength{\cvSkill@RectangleSize}{1.2ex}
\newcount\my@repeat@count
\DeclareDocumentCommand{\cvSkill}{m}{%
    \begingroup
        \my@repeat@count=\z@
        \@whilenum\my@repeat@count<#1\do{\tikz\filldraw[color1] (0, 0) rectangle (\cvSkill@RectangleSize, \cvSkill@RectangleSize);\advance%
        \my@repeat@count\@ne\,}%
        \my@repeat@count=\numexpr5-\z@\relax
        \@whilenum\my@repeat@count>#1\do{\tikz\filldraw[color2!30] (0, 0) rectangle (\cvSkill@RectangleSize, \cvSkill@RectangleSize);\advance%
        \my@repeat@count\m@ne\,}%
    \endgroup
}

% %-------------------------------------------------------------------------------
% %                \recomputecvskillmatrixlengths
% %-------------------------------------------------------------------------------

% initialise lengths needed for the skillmatrix
\@initializelength{\cvskill@width}
\@initializelength{\cvskill@descriptorwidth}
\@initializelength{\cvskilllegend@descriptorwidth}
\@initializelength{\cvskill@experiencewidth}
\@initializelength{\skillmatrix@columnwidth}
\@initializelength{\skillmatrix@commentwidth}
\@initializelength{\skillmatrix@commentpadding}
\@initializelength{\skillmatrix@hintscolumnwidth}
\@initializelength{\skilllegend@hintscolumnwidth}
% \separatorrulewidth is defined in moderncvbodyv.sty and we need to 
% define it to not throw an error in the other cases
\if@moderncvbodyv%
%     \RequirePackage{arydshln} % incompatible with fancy style
\else%
    \@initializelength{\separatorrulewidth}
    \setlength{\separatorrulewidth}{1ex}
\fi

%% DEFINITION \recomputecvskillmatrixlengths
% declare the command \recomputecvskillmatrixlengths empty
\DeclareDocumentCommand{\recomputecvskillmatrixlengths}{}{}%
% the command gets redifined depending on which option is given
\if@moderncvbodyi%
    \RenewDocumentCommand{\recomputecvskillmatrixlengths}{}{%
        \setlength{\skillmatrix@commentpadding}{1ex}
        \setlength{\skillmatrix@hintscolumnwidth}{\hintscolumnwidth}
        \setlength{\skilllegend@hintscolumnwidth}{\hintscolumnwidth}
        \setlength{\cvskill@width}{\widthof{\cvSkill{5}}}
        \setlength{\cvskill@experiencewidth}{\widthof{``Jahre''}}
        \setlength{\skillmatrix@columnwidth}{0.45\maincolumnwidth}%
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\maincolumnwidth-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
        \setlength{\cvskilllegend@descriptorwidth}{0.5\maincolumnwidth-\cvskill@width-\skillmatrix@commentpadding}
    }
\fi

\if@moderncvbodyiii%
    \RenewDocumentCommand{\recomputecvskillmatrixlengths}{}{%
        \setlength{\skillmatrix@commentpadding}{1ex}
        \setlength{\separatorcolumnwidth}{\skillmatrix@commentpadding}
        \setlength{\skillmatrix@hintscolumnwidth}{\widthof{``Language''}}
        \setlength{\skilllegend@hintscolumnwidth}{\skillmatrix@hintscolumnwidth}%
        \setlength{\cvskill@width}{\widthof{\cvSkill{5}}}
        \setlength{\cvskill@experiencewidth}{\widthof{``Jahre''}}
        \@initializelength{\skillmatrix@bodylength}
        \setlength{\skillmatrix@bodylength}{\maincolumnwidth-\skillmatrix@hintscolumnwidth-\separatorcolumnwidth}
        \setlength{\skillmatrix@columnwidth}{0.45\skillmatrix@bodylength}%
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\skillmatrix@bodylength-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
        \setlength{\cvskilllegend@descriptorwidth}{0.5\skillmatrix@bodylength-\cvskill@width-\skillmatrix@commentpadding}
    }
\fi

\if@moderncvbodyiv%
    \RenewDocumentCommand{\recomputecvskillmatrixlengths}{}{%
        \setlength{\skillmatrix@commentpadding}{1ex}
        \setlength{\separatorcolumnwidth}{\skillmatrix@commentpadding}
        \setlength{\skillmatrix@hintscolumnwidth}{\widthof{``Languagi''}}
        \setlength{\skilllegend@hintscolumnwidth}{0ex}%\skillmatrix@hintscolumnwidth
        \setlength{\cvskill@width}{\widthof{\cvSkill{5}}}
        \setlength{\cvskill@experiencewidth}{\widthof{``Jahre''}}
        \@initializelength{\skillmatrix@bodylength}
        \setlength{\skillmatrix@bodylength}{\maincolumnwidth-\skillmatrix@hintscolumnwidth-\separatorcolumnwidth}
        \setlength{\skillmatrix@columnwidth}{0.45\skillmatrix@bodylength}%
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\skillmatrix@bodylength-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
        \setlength{\cvskilllegend@descriptorwidth}{0.5\maincolumnwidth-\cvskill@width-\skillmatrix@commentpadding}
    }
\fi

\if@moderncvbodyv%
    \RenewDocumentCommand{\recomputecvskillmatrixlengths}{}{%
        \setlength{\skillmatrix@commentpadding}{1ex}
        \setlength{\skillmatrix@hintscolumnwidth}{\widthof{``Languages''}}
        \setlength{\skilllegend@hintscolumnwidth}{\skillmatrix@hintscolumnwidth}
        \setlength{\cvskill@width}{\widthof{\cvSkill{5}}}
        \setlength{\cvskill@experiencewidth}{\widthof{``Jahre''}}
        \@initializelength{\skillmatrix@bodylength}
        \setlength{\skillmatrix@bodylength}{\maincolumnwidth-\skillmatrix@hintscolumnwidth-\skillmatrix@commentpadding}%\skillmatrix@hintscolumnwidth
        \setlength{\skillmatrix@columnwidth}{0.45\skillmatrix@bodylength}%
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\skillmatrix@bodylength-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
        \setlength{\cvskilllegend@descriptorwidth}{0.5\maincolumnwidth-\cvskill@width-\skillmatrix@commentpadding}
    }
\fi

% command to adjust the width of the first colum of the skillmatrix
% and the colum 3rd (Skill) column. It takes two optional arguments.
% \skillMatrixColumnWidth[<width>][<factor>], where <width> is a length smaller than 
% \textwidth and 0 < <factor> < 1 is a factor influencing the width of the skill column,
% aka \skillmatrix@columnwidth
\DeclareDocumentCommand{\skillMatrixColumnWidth}{+O{} +O{}}{}%
\RenewDocumentCommand{\skillMatrixColumnWidth}{+O{\skillmatrix@hintscolumnwidth} +O{0.45}}{
    \def\arg@new@hintscolumnwidth{#1}%
    \def\arg@new@bodyLengthFactor{#2}%
    % Check for empty arguments. Defaults are given. Thus a call of \skillMatrixColumnWidth 
    % without any arguments leads to nonempty arguments \arg@new@hintscolumnwidth and
    % \def\arg@new@bodyLengthFactor{#2}. However, we need to take care of calls like 
    % \skillMatrixColumnWidth[], \skillMatrixColumnWidth[][] or even 
    % \skillMatrixColumnWidth[<somelength>][] \skillMatrixColumnWidth[][<somefactor>]
    \ifdefempty{\arg@new@hintscolumnwidth}{%
        % Case \skillMatrixColumnWidth[], \skillMatrixColumnWidth[][] or \skillMatrixColumnWidth[][<somefactor>]
        \ifdefempty{\arg@new@bodyLengthFactor}{
            % Case \skillMatrixColumnWidth[][] do nothing here and use default
            % \skillmatrix@columnwidth
        }{%
            % Case \skillMatrixColumnWidth[][<somefactor>]
            \setlength{\skillmatrix@columnwidth}{\arg@new@bodyLengthFactor\skillmatrix@bodylength}%
        }
        % Case \skillMatrixColumnWidth[] and recalculate lengths affected by the change
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\skillmatrix@bodylength-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
    }{% 
        % Case \skillMatrixColumnWidth, \skillMatrixColumnWidth[<width>], \skillMatrixColumnWidth[<width>][] 
        % or \skillMatrixColumnWidth[<width>][<somefactor>]
        \setlength{\skillmatrix@hintscolumnwidth}{\arg@new@hintscolumnwidth}%
        \setlength{\skillmatrix@bodylength}{\maincolumnwidth-\skillmatrix@hintscolumnwidth-\separatorcolumnwidth}
        % in case second argument is given but left empty use default
        \ifdefempty{\arg@new@bodyLengthFactor}{
            % Case \skillMatrixColumnWidth[<width>][] do nothing here and use default
            % \skillmatrix@columnwidth
        }{%
            % Case \skillMatrixColumnWidth, \skillMatrixColumnWidth[<width>], \skillMatrixColumnWidth[<width>][<somefactor>]
            \setlength{\skillmatrix@columnwidth}{\arg@new@bodyLengthFactor\skillmatrix@bodylength}%
        }
        \setlength{\cvskill@descriptorwidth}{\skillmatrix@columnwidth-\cvskill@width-\cvskill@experiencewidth}
        \setlength{\skillmatrix@commentwidth}{\skillmatrix@bodylength-\skillmatrix@columnwidth-\skillmatrix@commentpadding}%
    }%
}

% %-------------------------------------------------------------------------------
% %                \cvSkillMatrixLegend 
% %-------------------------------------------------------------------------------
\NewDocumentCommand\skillLegend@FontSize{}{\scriptsize}
\DeclareDocumentCommand\cvSkillMatrixLegend{s +O{} +O{} +O{} +O{} +O{} +O{} +m}{}%
% The following definition is valid for moderncvbodyi, moderncvbodyii, moderncvbodyiii
\RenewDocumentCommand\cvSkillMatrixLegend{s +O{.25em} +O{basic knowledge} +O{intermediate knowledge with experience in projects} +O{extensive experience in projects} +O{deep expert knowledge} +O{expert/guru} +m}{%
    \IfBooleanTF#1{% if a star is given, add dashed line
        \begingroup
        \arrayrulecolor{color1}
        \begin{tabular}{@{}p{\skilllegend@hintscolumnwidth}
                        @{\hspace{\separatorcolumnwidth}}p{\cvskill@width}@{};{.6pt/1pt}p{\cvskilllegend@descriptorwidth}  @{\hspace{2\skillmatrix@commentpadding}}p{\cvskill@width}@{};{.6pt/1pt}p{\cvskilllegend@descriptorwidth}@{}}%
            \raggedleft\hintstyle{#8}  & \cvSkill{1}\, & \,{\skillLegend@FontSize #3} & \cvSkill{3}\, &\,{\skillLegend@FontSize #5 } \\
                        %
                    & \cvSkill{2}\, & \,\multirow{2}{\cvskilllegend@descriptorwidth}{{\skillLegend@FontSize #4}} & \cvSkill{4}\,  &\,{\skillLegend@FontSize #6 } \\
                %         
                    &  &   & \cvSkill{5}\, &\,{\skillLegend@FontSize #7 } 
        \end{tabular}%
        \endgroup
        \par\addvspace{#2}}{
        % if no star is given, do not add dashed line
        \begin{tabular}{@{}p{\skilllegend@hintscolumnwidth}
                        @{\hspace{\separatorcolumnwidth}}p{\cvskill@width}@{}p{\cvskilllegend@descriptorwidth}  @{\hspace{2\skillmatrix@commentpadding}}p{\cvskill@width}@{}p{\cvskilllegend@descriptorwidth}@{}}%
            \raggedleft\hintstyle{#8}  & \cvSkill{1}\, & \,{\skillLegend@FontSize #3} & \cvSkill{3}\, &\,{\skillLegend@FontSize #5 } \\
                        %
                    & \cvSkill{2}\, & \,\multirow{2}{\cvskilllegend@descriptorwidth}{{\skillLegend@FontSize #4}} & \cvSkill{4}\,  &\,{\skillLegend@FontSize #6 } \\
                %         
                    &  &   & \cvSkill{5}\, &\,{\skillLegend@FontSize #7 } 
        \end{tabular}%
        \par\addvspace{#2}
    }
}

\if@moderncvbodyiv%
    \RenewDocumentCommand\cvSkillMatrixLegend{s +O{.25em} +O{basic knowledge} +O{intermediate knowledge with experience in projects} +O{extensive experience in projects} +O{deep expert knowledge} +O{expert/guru} +m}{%
        \def\arg@legendString{#8}%
        \ifdefempty{\arg@legendString}{%
        }{%
            \cvitem[0.25em]{\hintstyle{#8}}{}%
        }%
        \IfBooleanTF#1{% if a star is given, add dashed line
            \begingroup
            \arrayrulecolor{color1}
            \begin{tabular}{@{}p{\skilllegend@hintscolumnwidth}
                            @{\hspace{\separatorcolumnwidth}}p{\cvskill@width}@{};{.6pt/1pt}p{0.9\cvskilllegend@descriptorwidth}  @{\hspace{2\skillmatrix@commentpadding}}p{\cvskill@width}@{};{.6pt/1pt}p{1.1\cvskilllegend@descriptorwidth}@{}}%
                \raggedleft\hintstyle{}  & \cvSkill{1}\, & \,{\skillLegend@FontSize #3} & \cvSkill{3}\, &\,{\skillLegend@FontSize #5 } \\
                            %
                        & \cvSkill{2}\, & \,\multirow{2}{\cvskilllegend@descriptorwidth}{{\skillLegend@FontSize #4}} & \cvSkill{4}\,  &\,{\skillLegend@FontSize #6 } \\
                    %         
                        &  &   & \cvSkill{5}\, &\,{\skillLegend@FontSize #7 } 
            \end{tabular}%
            \endgroup
            \par\addvspace{#2}}{
            % if no star is given, do not add dashed line
                        \begin{tabular}{@{}p{\skilllegend@hintscolumnwidth}
                            @{\hspace{\separatorcolumnwidth}}p{\cvskill@width}@{};{.6pt/1pt}p{0.9\cvskilllegend@descriptorwidth}  @{\hspace{2\skillmatrix@commentpadding}}p{\cvskill@width}@{};{.6pt/1pt}p{1.1\cvskilllegend@descriptorwidth}@{}}%
                \raggedleft\hintstyle{}  & \cvSkill{1}\, & \,{\skillLegend@FontSize #3} & \cvSkill{3}\, &\,{\skillLegend@FontSize #5 } \\
                            %
                        & \cvSkill{2}\, & \,\multirow{2}{\cvskilllegend@descriptorwidth}{{\skillLegend@FontSize #4}} & \cvSkill{4}\,  &\,{\skillLegend@FontSize #6 } \\
                    %         
                        &  &   & \cvSkill{5}\, &\,{\skillLegend@FontSize #7 } 
            \end{tabular}%
            \par\addvspace{#2}
        }
    }
\fi

% in case moderncvbodyv is used we need a redefinition of \cvSkillMatrixLegend
\if@moderncvbodyv%
    \DeclareDocumentCommand\@starIndependentTabular{}{}%
        \RenewDocumentCommand\cvSkillMatrixLegend{s +O{.25em} +O{basic knowledge} +O{intermediate knowledge with experience in projects} +O{extensive experience in projects} +O{deep expert knowledge} +O{expert/guru} +m}{%
        % check whether Argument #8 is given and if so provide it as cvitem
        \def\arg@legendString{#8}%
        \ifdefempty{\arg@legendString}{%
            \vspace*{-\separatorrulewidth}% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
        }{%
            \cvitem[-0.5em]{#8}{}%
        }%
        \arrayrulecolor{color1}%
        \setlength\arrayrulewidth{\separatorrulewidth}%
        \RenewDocumentCommand{\@starIndependentTabular}{}{%
            \begingroup%
%             \renewcommand{\arraystretch}{1.0}%
            \begin{tabular}[t]{@{}p{\hintscolumnwidth}%\skilllegend@hintscolumnwidth
                            @{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}
                            p{\cvskill@width}@{} 
                            p{0.9\cvskilllegend@descriptorwidth}  @{\hspace{2\skillmatrix@commentpadding}}
                            p{\cvskill@width}@{}p{1.1\cvskilllegend@descriptorwidth}@{}}%
                \@moderncvstrut{4pt}{16pt}  & \cvSkill{1}\, & \,{\skillLegend@FontSize #3} & \cvSkill{3}\, &\,{\skillLegend@FontSize #5 } \\
                            %
                        & \cvSkill{2}\, & \,\multirow{2}{\cvskilllegend@descriptorwidth}{{\skillLegend@FontSize #4}} & \cvSkill{4}\,  &\,{\skillLegend@FontSize #6 } \\
                    %         
                        &  &   & \cvSkill{5}\, &\,{\skillLegend@FontSize #7 } \\[#2]% the spacing needs to be inside the cell for the vertical rule to extend correctly
            \end{tabular}%
            \endgroup%
            \par\@aftersectionfalse\ignorespaces%    
        }%
        % because of this weird style and the position of the parameter [#2], the dashed lines of the other version look bad. So no lines. 
        \IfBooleanTF#1{%
                \@starIndependentTabular%
            }{% 
                \@starIndependentTabular%
        }
    }%
\fi

% %-------------------------------------------------------------------------------
% %                \cvSkillMatrix@HeadFont 
% %-------------------------------------------------------------------------------
\NewDocumentCommand\cvSkillMatrix@HeadFont{}{\normalfont}
\DeclareDocumentCommand\cvSkillMatrixHead{+O{} +O{} +O{} +O{} +O{}}{}%
% The following definition is valid for moderncvbodyi, moderncvbodyii, moderncvbodyiii, moderncvbodyiv
\RenewDocumentCommand\cvSkillMatrixHead{O{.25em} +O{Level} +O{Skill} +O{Years} +O{Comment}}{%
    \begingroup
        \renewcommand{\arraystretch}{1.25}
        \arrayrulecolor{color1}
        \begin{tabular}{@{}p{\skillmatrix@hintscolumnwidth}
                        @{\hspace{\separatorcolumnwidth}}p{\cvskill@width}@{}@{}p{\cvskill@descriptorwidth}@{} p{\cvskill@experiencewidth} @{\hspace{\skillmatrix@commentpadding}}p{\skillmatrix@commentwidth}@{}}%
                & \centering{\cvSkillMatrix@HeadFont #2} & \centering{\cvSkillMatrix@HeadFont #3} & \centering{\cvSkillMatrix@HeadFont #4} & {\cvSkillMatrix@HeadFont #5}  
%                 \\\cdashline{2-5}[.6pt/1pt]
        \end{tabular}%
    \endgroup
    \par\addvspace{#1}
}
% in case moderncvbodyv is used we need a redefinition of \cvSkillMatrixHead
\if@moderncvbodyv%
    \RenewDocumentCommand\cvSkillMatrixHead{O{.25em} +O{Level} +O{Skill} +O{Years} +O{Comment}}{%
        \arrayrulecolor{color1}%
        \setlength\arrayrulewidth{\separatorrulewidth}%
        \vspace*{-\separatorrulewidth}% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
        \begingroup%
    %     \renewcommand{\arraystretch}{1.25}%
        \begin{tabular}[t]{@{}p{\hintscolumnwidth}%
                        @{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}%
                        p{\skillmatrix@hintscolumnwidth}%
                        @{\hspace{\skillmatrix@commentpadding}}p{\cvskill@width}@{}%
                        p{\cvskill@descriptorwidth}@{}%
                        p{\cvskill@experiencewidth}%
                        @{\hspace{\skillmatrix@commentpadding}}p{\skillmatrix@commentwidth}@{}}%
            & & \centering{\cvSkillMatrix@HeadFont#2} & \centering{\cvSkillMatrix@HeadFont#3} & \centering{\cvSkillMatrix@HeadFont#4} & {\cvSkillMatrix@HeadFont#5} \\[#1]% the spacing needs to be inside the cell for the vertical rule to extend correctly
        \end{tabular}%
        \endgroup%
        \par\@aftersectionfalse\ignorespaces%    
    }
\fi

% %-------------------------------------------------------------------------------
% %                \cvSkillMatrixEntry 
% %-------------------------------------------------------------------------------
\DeclareDocumentCommand\cvSkillMatrixEntry{s +O{} +m +m +m +m +m}{}%
% The following definition is valid for moderncvbodyi, moderncvbodyii, moderncvbodyiii, moderncvbodyiv
\RenewDocumentCommand\cvSkillMatrixEntry{s +O{.25em} +m +m +m +m +m}{%
    %test for the star * in the command
    \IfBooleanTF{#1}{% If a star is seen a dotted line is drawn above the entry
        \begingroup
        \renewcommand{\arraystretch}{1.25}
        \arrayrulecolor{color1}
        \begin{tabular}{@{}p{\skillmatrix@hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}%
        p{\cvskill@width}@{}%
        p{\cvskill@descriptorwidth}@{}%
        p{\cvskill@experiencewidth} @{\hspace{\skillmatrix@commentpadding}}%
        p{\skillmatrix@commentwidth}@{}}%
            \cdashline{2-5}[.6pt/1pt]
            \raggedleft\hintstyle{#3} &\centering \cvSkill{#4} &\centering {#5} & \centering {#6} &{\itshape#7}%
        \end{tabular}%
        \endgroup
        \par\addvspace{#2}
    }{% If no star is seen no line is drawn
        \begin{tabular}{@{}p{\skillmatrix@hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}%
        p{\cvskill@width}@{}%
        p{\cvskill@descriptorwidth}@{}%
        p{\cvskill@experiencewidth}%
        @{\hspace{\skillmatrix@commentpadding}}%
        p{\skillmatrix@commentwidth}@{}}%
            \raggedleft\hintstyle{#3} &\centering \cvSkill{#4} &\centering {#5} & \centering {#6} &{\itshape#7}%
        \end{tabular}%
        \par\addvspace{#2}
    }
}
% in case moderncvbodyv is used we need a redefinition of \cvSkillMatrixEntry
\if@moderncvbodyv%
    \DeclareDocumentCommand\@starIndependentMatrixEntry{}{}%
    \RenewDocumentCommand\cvSkillMatrixEntry{s O{.25em} +m +m +m +m +m}{%
        \arrayrulecolor{color1}%
        \setlength\arrayrulewidth{\separatorrulewidth}%
        \vspace*{-\separatorrulewidth}% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
        %test for the star * in the command
        \RenewDocumentCommand{\@starIndependentMatrixEntry}{}{
            \begingroup%
                \renewcommand{\arraystretch}{1.25}%
                \begin{tabular}[t]{@{}p{\hintscolumnwidth}%
                                @{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}p{\skillmatrix@hintscolumnwidth}
                                @{\hspace{\skillmatrix@commentpadding}}
                                p{\cvskill@width}@{}
                                p{\cvskill@descriptorwidth}@{}
                                p{\cvskill@experiencewidth} @{\hspace{\skillmatrix@commentpadding}}p{\skillmatrix@commentwidth}@{}}%
    %                 \cline{3-6}%
                    & \raggedleft\hintstyle{#3} &\centering \cvSkill{#4} &\centering {#5} & \centering {#6} &{\itshape#7}\\[#2]%
                \end{tabular}%
            \endgroup%
        }
        \IfBooleanTF{#1}{% the star does not do anything here
            \@starIndependentMatrixEntry
        }{% 
            \@starIndependentMatrixEntry
        }%
        \par\@aftersectionfalse\ignorespaces%
    }
\fi
  
\endinput


%% end of file `moderncvskillmatrix.sty'.
