while( !aVbaTextStrm.isEof() )
{
OUString aCodeLine = aVbaTextStrm.readLine(); if( aCodeLine.match( "Attribute " ) )
{ // attribute int index = aCodeLine.indexOf( ".VB_ProcData.VB_Invoke_Func = " ); if ( index != -1 )
{ // format is // 'Attribute Procedure.VB_ProcData.VB_Invoke_Func = "*\n14"' // where 'Procedure' is the procedure name and '*' is the shortcut key // note: his is only relevant for Excel, seems that // word doesn't store the shortcut in the module // attributes int nSpaceIndex = aCodeLine.indexOf(' ');
OUString sProc = aCodeLine.copy( nSpaceIndex + 1, index - nSpaceIndex - 1); // for Excel short cut key seems limited to cntrl+'a-z, A-Z'
std::u16string_view sKey = aCodeLine.subView( aCodeLine.lastIndexOf("= ") + 3, 1 ); // only alpha key valid for key shortcut, however the api will accept other keys if ( rtl::isAsciiAlpha( sKey[ 0 ] ) )
{ // cntrl modifier is explicit ( but could be cntrl+shift ), parseKeyEvent // will handle and uppercase letter appropriately
OUString sApiKey = OUString::Concat("^") + sKey;
maKeyBindings.push_back({sApiKey, sProc});
}
}
} else
{ // Hack here to weed out any unmatched End Sub / Sub Foo statements. // The behaviour of the vba ide practically guarantees the case and // spacing of Sub statement(s). However, indentation can be arbitrary hence // the trim.
OUString trimLine( aCodeLine.trim() ); if ( mbExecutable && (
trimLine.match("Sub ") ||
trimLine.match("Public Sub ") ||
trimLine.match("Private Sub ") ||
trimLine.match("Static Sub ") ) )
{ // this should never happen, basic doesn't support nested procedures // first Sub Foo must be bogus if ( procInfo.bInProcedure )
{ // comment out the line
aSourceCode.insert( procInfo.nPos, sUnmatchedRemovedTag ); // mark location of this Sub
procInfo.nPos = aSourceCode.getLength();
} else
{
procInfo.bInProcedure = true;
procInfo.nPos = aSourceCode.getLength();
}
} elseif ( mbExecutable && o3tl::starts_with(o3tl::trim(aCodeLine), u"End Sub") )
{ // un-matched End Sub if ( !procInfo.bInProcedure )
{
aSourceCode.append( sUnmatchedRemovedTag );
} else
{
procInfo.bInProcedure = false;
procInfo.nPos = 0;
}
} // normal source code line if( !mbExecutable )
aSourceCode.append( "Rem " );
aSourceCode.append( aCodeLine + "\n" );
}
}
}
} return aSourceCode.makeStringAndClear();
}
¤ 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.0.1Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.