Files
help/source/text/sbasic/shared/compatibilitymode.xhp
Ilmari Lauhakangas 7e42394ecb tdf#152323 drop name attribute from <link> elements
Replacement done with

find . -name \*.xhp -print0 |xargs -0 -P 0 perl -CS -pi -e \
        's#(<link[^>]*?) +name *="[^"]*" *( [^>]+|) *>#$1$2>#g'

(note some inconsistencies with space between name and = and also having
empty value, and some more complicated expression to also clear up
double space before/after the attribute)

translation files will be prepped with:

find */helpcontent2 -name \*.po -print0 |xargs -0 -P 0 perl -CS -pi -e \
    $'s#(<link[^>]*?) +name=(?:\\\\"[^"]*\\\\"|\'[^\']*\') *( [^>]+|) *(/?>)#$1$2$3#g unless /^#/'

(note that not all languages use the " as quote character for the
attributes, but that also single quotes appera in the po file. Hence
the use of the shell $'string' syntax to be able to quote ' as \'
It also requires to quote the backslash, so that it needs to be escaped
once for the shell, then another time for perl. Also don't work on
obsolete strings (those are prefixed with #~ in the po files)
Also note that <link..></link> gets turned into <link ../> during
translation extraction (along with removal of the space between the
attribute name and the value), so the pattern needs to be slightly
different here)

Change-Id: I95e53a08e6b0095cd894109ea0de154cc4859d8f
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/143713
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2022-12-07 17:39:02 +00:00

93 lines
7.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
* 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/.
*
-->
<meta>
<topic id="text/sbasic/shared/compatibilitymode">
<title id="tit" xml-lang="en-US">CompatibilityMode function</title>
<filename>/text/sbasic/shared/compatibilitymode.xhp</filename>
</topic>
</meta>
<body>
<bookmark branch="index" id="N0103">
<bookmark_value>CompatibilityMode</bookmark_value>
<bookmark_value>VBA compatibility mode</bookmark_value>
</bookmark>
<section id="compatibilitymodefunction">
<h1 id="N0118"><variable id="compatibilitymodeh1"><link href="text/sbasic/shared/compatibilitymode.xhp">CompatibilityMode() Function</link></variable></h1>
<paragraph role="paragraph" id="N0120"><literal>CompatibilityMode()</literal> function controls or queries runtime mode. It affects all code executed after setting or resetting the runtime mode. </paragraph>
</section>
<warning id="N0119">Use this feature with caution, limit it to document conversion for example.</warning>
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
<bascode>
<paragraph role="bascode" id="bas_id751645014686110">CompatibilityMode(Optional Enable As Boolean) As Boolean</paragraph>
</bascode>
<embed href="text/sbasic/shared/00000003.xhp#functvalue"/>
<paragraph role="paragraph" id="par_id551648117368688"><literal>CompatibilityMode</literal> function always returns the mode that is active after its execution. That is if called with argument, it returns the new mode, if called without argument, it returns active mode without modifying it.</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id971648117815981"><emph>Enable</emph>: Sets or unsets new compatibility mode when the argument is present.</paragraph>
<note id="par_id371648123169691"><literal>CompatibilityMode</literal> function relates to <link href="text/sbasic/shared/03103350.xhp#vbasupportstatement">Option VBASupport 1</link>, in which case it always returns <literal>True</literal>. It is unrelated to <link href="text/sbasic/shared/compatible.xhp#compatiblestatement">Option Compatible</link> compiler directive.</note>
<paragraph role="paragraph" id="N0121">This function may affect or help in the following situations:</paragraph>
<list type="unordered">
<listitem><paragraph id="par_id301645018760314" role="listitem">Scoping of variables.</paragraph></listitem>
<listitem><paragraph role="listitem" id="N0124">Running <literal>RmDir</literal> command in VBA mode. In VBA only empty directories are removed by <literal>RmDir</literal> while %PRODUCTNAME Basic removes a directory recursively.</paragraph></listitem>
<listitem><paragraph role="listitem" id="N0125">Changing behavior of Basic <literal>Dir</literal> command. The directory flag (16) for the <literal>Dir</literal> command means that only directories are returned in %PRODUCTNAME Basic, while in VBA normal files and directories are returned.</paragraph></listitem>
<listitem>
<paragraph id="par_id901639929393688" role="listitem">Color components calculation with the <link href="text/sbasic/shared/03010303.xhp"><literal>Red</literal></link> and <link href="text/sbasic/shared/03010301.xhp"><literal>Blue</literal></link> functions which <emph>are interchanged</emph> (The <link href="text/sbasic/shared/03010302.xhp"><literal>Green</literal></link> function is not affected).</paragraph>
</listitem>
</list>
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
<paragraph role="paragraph" id="par_id541561646705787">Given a NOT empty directory at <emph>file:///home/me/Test</emph></paragraph>
<bascode>
<paragraph role="bascode" id="par_id491561646553280" localize="false">Sub RemoveDir</paragraph>
<paragraph role="paragraph" id="par_id731546017105932" localize="false"> MsgBox CompatibilityMode() ' False</paragraph>
<paragraph role="paragraph" id="par_id341645017408891" localize="false"></paragraph>
<paragraph role="bascode" id="par_id771561646565613" localize="false"> CompatibilityMode( True )</paragraph>
<paragraph role="bascode" id="par_id311561646572637" localize="false"> RmDir( "file:///home/me/Test" )</paragraph>
<paragraph role="bascode" id="bas_id761645015439188" localize="false"> CompatibilityMode False </paragraph>
<paragraph role="bascode" id="bas_id51645017464045" localize="false"></paragraph>
<paragraph role="paragraph" id="par_id731645017105932" localize="false"> MsgBox CompatibilityMode ' False</paragraph>
<paragraph role="bascode" id="par_id851561646579895" localize="false">End Sub</paragraph>
</bascode>
<paragraph role="paragraph" id="par_id461561646613414">With <literal>CompatibilityMode( True )</literal> the program raises an error, otherwise the <literal>Test</literal> directory and all its content is deleted.</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
<paragraph role="paragraph" id="par_id411561647797398">Modifying <literal>Dir</literal> behavior</paragraph>
<bascode>
<paragraph role="bascode" id="par_id941561647889938" localize="false">Sub VBADirCommand</paragraph>
<paragraph role="bascode" id="par_id831561647900147" xml-lang="en-US"> CompatibilityMode( Enable := True ) ' Shows also normal files</paragraph>
<paragraph role="bascode" id="par_id931561647920869" localize="false"> Entry$ = Dir( "file:///home/me/Tmp/*.*", 16 )</paragraph>
<paragraph role="bascode" id="par_id31561647939939" localize="false"> Total$ = ""</paragraph>
<paragraph role="bascode" id="par_id71561647964220" localize="false"> While Entry$ &lt;&gt; ""</paragraph>
<paragraph role="bascode" id="par_id51561647969918" localize="false"> Total$ = Total$ + Entry$ + Chr$(13)</paragraph>
<paragraph role="bascode" id="par_id111561647975134" localize="false"> Entry$ = Dir</paragraph>
<paragraph role="bascode" id="par_id751561647979743" localize="false"> Wend</paragraph>
<paragraph role="bascode" id="par_id401561647986945" localize="false"> MsgBox Total$</paragraph>
<paragraph role="bascode" id="bas_id641645017016611" xml-lang="en-US"> CompatibilityMode Enable := False ' Shows only directories</paragraph>
<paragraph role="bascode" id="par_id111561647991525" localize="false">End Sub</paragraph>
</bascode>
<section id="relatedtopics">
<embed href="text/sbasic/shared/compatible.xhp#compatiblestatement"/>
<embed href="text/sbasic/shared/03090407.xhp#remstatement"/>
<paragraph role="paragraph" id="N0131">
Variables scope modification in <link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link> with <literal>CompatibilityMode()</literal> function.
</paragraph>
<embed href="text/sbasic/shared/03103200.xhp#optionbasestatement"/>
<embed href="text/sbasic/shared/03103300.xhp#explicitstatement"/>
<embed href="text/sbasic/shared/03103350.xhp#vbasupportstatement"/>
<embed href="text/sbasic/shared/classmodule.xhp#classmodulestatement"/>
</section>
</body>
</helpdocument>