Kaydet (Commit) 73d56840 authored tarafından Michael Stahl's avatar Michael Stahl

*api: convert <listing> and @example

<listing> is called @code / @endcode in doxygen.
@example requires a file name in doxygen.
Also adapt various silly examples that use tools String in C++ or manual
syntax highlighting in Java etc.

Change-Id: I23cff1b688001f438526a6a1364cc5f754b504f7
üst b84bffc8
......@@ -55,7 +55,7 @@ published service FilterFactory
reached by using createInstanceWithArguments() with an optional property "FilterName" only.
See the following example:
<listing>
@code{.java}
private com.sun.star.uno.XInterface createFilterDirect( com.sun.star.lang.XMultiServiceFactory xFilterFactory ,
java.lang.String sInternalFilterName )
{
......@@ -69,7 +69,7 @@ published service FilterFactory
java.lang.Object aFilter = xFilterFactory.createInstanceWithArguments("", lProps);
return (com.sun.star.uno.XInterface)UnoRuntime.queryInterface(com.sun.star.uno.XInterface.class, aFilter);
}
</listing>
@endcode
</p>
<p>
......
......@@ -41,11 +41,9 @@
/** This abstract service is implemented by every page of a
DrawingDocument.
Example to create and insert a couple of LineShapes:
@example create and insert a couple of LineShapes:
<listing>
@code{.bas}
xPage = xDoc.DrawPages(0)
for x% = 0 to 200
xShape = xProv.createInstance( "com::sun::star::drawing::LineShape" )
......@@ -55,7 +53,7 @@
xShape.Size = Size( 300-x%, 20 )
xPage.add( xShape )
next x%
</listing>
@endcode
*/
published service GenericDrawPage
{
......
......@@ -43,8 +43,7 @@
</ul>
</p>
@example Java
<listing>
@code{.java}
XFrame xFrame = getNewEmptyFrame();
XMultiServiceFactory xORB = getORB();
XPropertySet xControlModel = getMyControlModel();
......@@ -62,7 +61,7 @@
XPropertySet.class, xController );
xControllerProps.setPropertyValue( "IntrospectedObject", xControlModel );
</listing>
@endcode
@see com::sun::star::frame::XController
......
......@@ -35,8 +35,7 @@ published interface XFormsSupplier: com::sun::star::uno::XInterface
/** accesses the forms.
@example StarBASIC
<listing>
@code{.bas}
REM ***** BASIC *****
Sub createColorSelectionBox
......@@ -71,7 +70,7 @@ published interface XFormsSupplier: com::sun::star::uno::XInterface
thisComponent.DrawPage.Forms.getByIndex(0).insertByIndex( 0, xControlModel )
thisComponent.DrawPage.add( xShape )
End Sub
</listing>
@endcode
@returns
the container of all the top-level forms belonging to the component.
......
......@@ -67,27 +67,29 @@ published interface XDispatch: com::sun::star::uno::XInterface
optional arguments for this request.
They depend on the real implementation of the dispatch object.
@example
<listing>
<i><font COLOR="#949494">// some code for a click-handler (Java)</font></i>
void <strong>myOnClick</strong>(<em>String</em> sURL,<em>String</em> sTargetFrame,<em>com.sun.star.beans.PropertyValue[]</em> lArguments)
<i>some code for a click-handler (Java)</i>
@code{.java}
void myOnClick(String sURL,String sTargetFrame,
com.sun.star.beans.PropertyValue[] lArguments)
{
&nbsp;&nbsp;com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
&nbsp;&nbsp;aURL[0] = new com.sun.star.util.URL();
&nbsp;&nbsp;aURL[0].Complete = sURL;
com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
aURL[0] = new com.sun.star.util.URL();
aURL[0].Complete = sURL;
&nbsp;&nbsp;com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
&nbsp;&nbsp;&nbsp;&nbsp;com.sun.star.util.XURLTransformer.class,
&nbsp;&nbsp;&nbsp;&nbsp;mxServiceManager.createInstance("com.sun.star.util.URLTransformer"));
com.sun.star.util.XURLTransformer xParser =
(com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
com.sun.star.util.XURLTransformer.class,
mxServiceManager.createInstance("com.sun.star.util.URLTransformer"));
&nbsp;&nbsp;xParser.parseStrict(aURL);
xParser.parseStrict(aURL);
&nbsp;&nbsp;com.sun.star.frame.XDispatch xDispatcher = mxFrame.queryDispatch(aURL[0], sTargetFrame, com.sun.star.frame.FrameSearchFlag.GLOBAL);
com.sun.star.frame.XDispatch xDispatcher =
mxFrame.queryDispatch(aURL[0], sTargetFrame, com.sun.star.frame.FrameSearchFlag.GLOBAL);
&nbsp;&nbsp;if(xDispatcher!=null)
&nbsp;&nbsp;&nbsp;&nbsp;xDispatcher.dispatch(aURL[0], lArguments);
if(xDispatcher!=null)
xDispatcher.dispatch(aURL[0], lArguments);
}
</listing>
@endcode
*/
void dispatch(
[in] com::sun::star::util::URL URL,
......
......@@ -45,22 +45,22 @@
is used transparently there.
</p>
@example
<listing>
<i>XDispatch</i> xDispatcher = xFrame.queryDispatch(aURL,"",0);
<i>XRecordableDispatch</i> xRecordable = (<i>XRecordableDispatch</i>)UnoRuntime.queryInterface(
&nbsp;&nbsp;XRecordableDispatch.class,
&nbsp;&nbsp;xDispatcher);
@code{.java}
XDispatch xDispatcher = xFrame.queryDispatch(aURL,"",0);
XRecordableDispatch xRecordable =
(XRecordableDispatch)UnoRuntime.queryInterface(
XRecordableDispatch.class,
xDispatcher);
xDispatcher.addStatusListener(this,aURL);
<b>if</b> (xRecordable!=<b>null</b>)
&nbsp;&nbsp;xRecordable.dispatchAndRecord(aURL,lArguments,xRecorder);
if (xRecordable != null)
xRecordable.dispatchAndRecord(aURL,lArguments,xRecorder);
else
&nbsp;&nbsp;xDispatcher.dispatch(aURL,lArguments);
xDispatcher.dispatch(aURL,lArguments);
...
xDispatcher.removeStatusListener(this,aURL);
</listing>
@endcode
@see XDispatchRecorderSupplier
@see XDispatch
......
......@@ -169,15 +169,14 @@ published interface XCharacterClassification : com::sun::star::uno::XInterface
A set of additionally allowed characters a name or
identifier may continue with.
@example:C++
<listing>
@code{.cpp}
using namespace ::com::sun::star::i18n;
// First character of an identifier may be any alphabetic or underscore.
sal_Int32 nStartFlags = KParseTokens::ANY_ALPHA | KParseTokens::ASC_UNDERSCORE;
// Continuing characters may be any alphanumeric or underscore or dot.
sal_Int32 nContFlags = KParseTokens::ANY_ALNUM | KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOT;
// No further characters assumed to be contained in an identifier
String aEmptyString;
OUString aEmptyString;
// Parse any token.
ParseResult rRes = xCC->parseAnyToken( aText, nPos, aLocale,
nStartFlags, aEmptyString, nContFlags, aEmptyString );
......@@ -185,16 +184,16 @@ published interface XCharacterClassification : com::sun::star::uno::XInterface
if ( rRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER) )
fValue = rRes.Value;
if ( rRes.TokenType & KParseType::IDENTNAME )
aName = aText.Copy( nPos, rRes.EndPos - nPos );
aName = aText.copy( nPos, rRes.EndPos - nPos );
else if ( rRes.TokenType & KParseType::SINGLE_QUOTE_NAME )
aName = rRes.DequotedNameOrString;
else if ( rRes.TokenType & KParseType::DOUBLE_QUOTE_STRING )
aString = rRes.DequotedNameOrString;
else if ( rRes.TokenType & KParseType::BOOLEAN )
aSymbol = aText.Copy( nPos, rRes.EndPos - nPos );
aSymbol = aText.copy( nPos, rRes.EndPos - nPos );
else if ( rRes.TokenType & KParseType::ONE_SINGLE_CHAR )
aSymbol = aText.Copy( nPos, rRes.EndPos - nPos );
</listing>
aSymbol = aText.copy( nPos, rRes.EndPos - nPos );
@endcode
*/
ParseResult parseAnyToken(
......@@ -220,26 +219,25 @@ published interface XCharacterClassification : com::sun::star::uno::XInterface
@param nTokenType
One or more of the KParseType constants.
@example:C++
<listing>
@code{.cpp}
// Determine if a given name is a valid name (not quoted) and contains
// only allowed characters.
using namespace ::com::sun::star::i18n;
// First character of an identifier may be any alphanumeric or underscore.
sal_Int32 nStartFlags = KParseTokens::ANY_ALNUM | KParseTokens::ASC_UNDERSCORE;
// No further characters assumed to be contained in an identifier start.
String aEmptyString;
OUString aEmptyString;
// Continuing characters may be any alphanumeric or underscore.
sal_Int32 nContFlags = nStartFlags;
// Additionally, continuing characters may contain a blank.
String aContChars( RTL_CONSTASCII_USTRINGPARAM(" ") );
OUString aContChars( RTL_CONSTASCII_USTRINGPARAM(" ") );
// Parse predefined (must be an IDENTNAME) token.
ParseResult rRes = xCC->parsePredefinedToken( KParseType::IDENTNAME, rName, 0, aLocale,
nStartFlags, aEmptyString, nContFlags, aContChars );
// Test if it is an identifier name and if it only is one
// and no more else is following it.
bValid = (rRes.TokenType & KParseType::IDENTNAME) && rRes.EndPos == rName.Len();
</listing>
@endcode
*/
ParseResult parsePredefinedToken(
......
......@@ -66,7 +66,7 @@ interface XColorSpace
corresponds to the number of color channels for this color
space.<p>
@example For the standard RGB color space, ComponentTags
@remark For the standard RGB color space, ComponentTags
consists of three elements, containing RGB_RED, RGB_GREEN and
RGB_BLUE tags, respectively
*/
......
......@@ -59,7 +59,7 @@ interface XIntegerBitmapColorSpace : XColorSpace
order defined here, with the first element starting from the
least significant bits of the pixel, etc.<p>
@example For the typical 32 bit RGBA color data, the four
@remark For the typical 32 bit RGBA color data, the four
values would all contain the value eight. For a 16 bit 1555
ARGB format, with mask values 0x8000 for alpha, 0x7C for red,
0x3E for green and 0x1F for blue, the values would be 5, 5, 5,
......@@ -77,7 +77,7 @@ interface XIntegerBitmapColorSpace : XColorSpace
actual color data bytes might need to get swapped, for the
bits to align properly.<p>
@example with a 16 bit 565 RGB format, written on a big endian
@remark with a 16 bit 565 RGB format, written on a big endian
architecture, a destination machine using little endian CPU
will need to swap the bytes, in order to keep the green
channel bits together.
......
......@@ -123,9 +123,6 @@ published interface XLocale: com::sun::star::uno::XInterface
@param inLocale
specifies the desired user language.
@example
"English (UK)", "Deutch", "Germany"
*/
string getDisplayLanguage( [in] com::sun::star::lang::Locale locale,
[in] com::sun::star::lang::Locale inLocale );
......
......@@ -82,9 +82,9 @@ module com { module sun { module star { module resource {
the <code>XResourceBundle</code> implementation using the
XResourceBundleLoader service:
<listing>
@code{.java}
XResourceBundle myResources = xLoader.getBundle("MyResources", currentLocale);
</listing>
@endcode
<p>The first argument specifies the family name of the resource
bundle that contains the object in question. The second argument
......@@ -129,7 +129,7 @@ module com { module sun { module star { module resource {
example of a <code>XResourceBundle</code> implementation that contains
two key/value pairs:
<listing>
@code{.java}
class MyResource extends com.sun.star.resource.XResourceBundle
{
// some queryInterface stuff
......@@ -141,7 +141,7 @@ module com { module sun { module star { module resource {
return null;
}
}
</listing>
@endcode
<p>Keys are always <code>String</code>s. In this example, the keys
are <code>OkKey</code> and <code>CancelKey</code>. In the above
......@@ -153,10 +153,10 @@ module com { module sun { module star { module resource {
get method. Because <code>OkKey</code> and <code>CancelKey</code>
are both strings, you use <code>getByName</code> to retrieve them:
<listing>
@code{.java}
button1 = new Button(myResourceBundle.getByName("OkKey").getString());
button2 = new Button(myResourceBundle.getByName("CancelKey").getString());
</listing>
@endcode
<p>The get methods all require the key as an argument and return
the object if found. If the object is not found, the get methods
......
......@@ -51,10 +51,10 @@ interface XScript : ::com::sun::star::uno::XInterface {
<br> the call would look like<br>
<code>bar.invoke( {"foo", "foo2", "this-is-ignored" }, aOutParamIndex, aOutParam);</code>
<br> and after the call the out sequences would contain<br>
<listing>
@code{.py}
aOutParamIndex={0,2};
aOutParam={"string from a", "string from c"};
</listing>
@endcode
@returns
the value returned from the function being invoked
......
......@@ -46,15 +46,14 @@ module com { module sun { module star { module sdb {
<p>The list of defined error conditions, by nature, is expected to permanently grow,
so never assume it being finalized.</p>
@example Java
<listing>
@code{.java}
catch ( SQLException e )
{
&nbsp;&nbsp;if ( e.Message.startsWith( "[OOoBase]" ) )
&nbsp;&nbsp;&nbsp;&nbsp;if ( e.ErrorCode + ErrorCondition.SOME_ERROR_CONDITION == 0 )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handleSomeErrorCondition();
if (e.Message.startsWith( "[OOoBase]" ))
if (e.ErrorCode + ErrorCondition.SOME_ERROR_CONDITION == 0)
handleSomeErrorCondition();
}
</listing>
@endcode
*/
constants ErrorCondition
{
......
......@@ -62,12 +62,11 @@
</p>
<p>
Example of setting a parameter; <code>con</code> is an active connection.
@example:StarBASIC
<listing>
@code{.bas}
pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
pstmt.setDouble(1, 153833.00)
pstmt.setLong(2, 110592)
</listing>
@endcode
</p>
<P>
Only one
......
......@@ -65,10 +65,13 @@
is an active connection.
</p>
@example <listing>pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
@code{.bas}
pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
pstmt.setDouble(1, 153833.00)
pstmt.setLong(2, 110592)
</listing>@see com::sun::star::sdbc::XPreparedStatement
@endcode
@see com::sun::star::sdbc::XPreparedStatement
*/
published interface XParameters: com::sun::star::uno::XInterface
{
......
......@@ -29,9 +29,9 @@
/** This abstract service is implemented by every page of a
SpreadsheetDocument.
@example create and insert a couple of com::sun::star::drawing::LineShapes:
Example: create and insert a couple of com::sun::star::drawing::LineShapes:
<listing>
@code{.bas}
xPage = xDoc.DrawPages(0)
for x% = 0 to 200
xShape = xProv.createInstance( "com.sun.star.drawing.LineShape" )
......@@ -41,7 +41,7 @@
xShape.Size = Size( 300-x%, 20 )
xPage.add( xShape )
next x%
</listing>
@endcode
@since OOo 1.1.2
*/
......
......@@ -31,20 +31,18 @@
@see Text
@example StarBasic
<p>This example shows how to create a TextFrame and insert
it at the very beginning of Text component. The macro
is ready to run, if it is a script within a text document. </p>
<listing>
@code{.bas}
Sub Main
oFrame = ThisComponent.createInstance( "com.sun.star.text.TextFrame" )
oFrame.Width = 6000
ThisComponent.Text.insertTextContent( ThisComponent.Text.Start, oFrame, false )
oFrame.Text.String = "Hello, this text is within the frame."
End Sub
</listing>
@endcode
*/
published service TextFrame
{
......
......@@ -53,18 +53,16 @@
tables should be insertable via XText::insertTextContent()
and that interface uses a parameter of that type.</p>
@example
<p>Example: Create and insert a TextTable:</p>
<p>Create and insert a TextTable:</p>
<listing>
@code{.bas}
xTable = xTextDoc.createInstance( "com.sun.star.text.TextTable" )
xTable.initialize(5, 8)
xTable.HoriOrient = 0 'com::sun::star::text::HoriOrientation::NONE
xTable.LeftMargin = 2000
xTable.RightMargin = 1500
xTextDoc.getText.insertTextContent( xTextRange, xTable, false )
</listing>
@endcode
@see com::sun::star::text::Cell
@see com::sun::star::text::CellRange
......
......@@ -41,10 +41,9 @@ published interface XDependentTextField: com::sun::star::text::XTextField
<p>A TextFieldMaster can only be assigned once.
</p>
@example Create and insert a user field (with a
<code>UserField</code>):
Example: Create and insert a user field (with a <code>UserField</code>):
<listing>
@code{.java}
// Create a fieldmaster for our newly created User Text field, and access it's
// XPropertySet interface
XPropertySet xMasterPropSet = (XPropertySet) UnoRuntime.queryInterface(
......@@ -62,7 +61,7 @@ published interface XDependentTextField: com::sun::star::text::XTextField
mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false);
// Insert the user field at the end of the document
mxDocText.insertTextContent(mxDocText.getEnd(), xUserField, false);
</listing>
@endcode
*/
void attachTextFieldMaster( [in] com::sun::star::beans::XPropertySet xFieldMaster )
raises( com::sun::star::lang::IllegalArgumentException );
......
......@@ -95,15 +95,14 @@ published interface XSimpleText: com::sun::star::text::XTextRange
be replaced by <var>aString</var>, otherwise <var>aString</var>
will be inserted at the beginning of <var>xRange</var>.
@example
<listing>
xText.insertString( xTextCursor, "Hello " + aName$ + ",", false )
@code{.java}
xText.insertString( xTextCursor, "Hello " + aName + ",", false )
xText.insertControlCharacter( xTextCursor,
ControlCharacter_PARAGRAPH_BREAK, false );
ControlCharacter.PARAGRAPH_BREAK, false );
xText.insertString( xTextCursor, "more text ...", false )
</listing>
@endcode
*/
void insertString( [in] com::sun::star::text::XTextRange xRange,
[in] string aString,
......
......@@ -68,8 +68,8 @@ published interface XText: com::sun::star::text::XSimpleText
/** removes the specified content from the text object.
@example xDoc.removeTextContent( xDoc.TextTables.MyOwnTableName )
@param xContent
the content that is to be removed.
*/
void removeTextContent( [in] com::sun::star::text::XTextContent xContent )
raises( com::sun::star::container::NoSuchElementException );
......
......@@ -118,7 +118,7 @@ published service ContentResultSet
<p>The following pseudo-code illustrates the usage of a non-blocking
cursor:
<p><pre>
@code{.java}
bProcessedAllRows = false
while ( !bProcessedAllRows )
{
......@@ -148,7 +148,7 @@ published service ContentResultSet
bProcessedAllRows = ...
}
</pre>
@endcode
<p>
If this property is not supported, the implementation needs to provide
......
......@@ -33,14 +33,14 @@ module com { module sun { module star { module util {
/** makes it possible to replace strings in a text described by a
SearchDescriptor.
@example
<listing>
replace all bold words "search for" by "look for"
Example: replace all bold words "search for" by "look for"
@code{.py}
xReplaceDescr = xDocument.createReplaceDescriptor()
xReplaceDescr.SearchString = "search for"
xReplaceDescr.ReplaceString = "look for"
xFound = xDocument.replaceAll( xReplaceDescr )
</listing>
@endcode
*/
published interface XReplaceable: com::sun::star::util::XSearchable
{
......
......@@ -33,11 +33,11 @@ module com { module sun { module star { module util {
/** enables the object to look for specified contents of the object
(in particular, for a text range which contains a specific string pattern).
@example
Example:
in a com::sun::star::text::TextDocument:
set all "search for" to bold using findFirst()/findNext():
<listing>
@code{.bas}
xSearchDescr = xDocument.createSearchDescriptor()
xSearchDescr.SearchString = "search for"
xSearchDescr.SearchCaseSensitive = `TRUE`
......@@ -47,7 +47,7 @@ module com { module sun { module star { module util {
xFound.CharWeight = com.sun.star.awt.FontWeight.BOLD
xFound = xDocument.findNext( xFound.End, xSearchDescr )
loop
</listing>
@endcode
*/
published interface XSearchable: com::sun::star::uno::XInterface
......
......@@ -30,15 +30,14 @@ module com { module sun { module star { module container {
/** allows access to the collections of all content types within the object.
@example
<p>This example prints the names of all tables: </p>
<p>This example prints the names of all tables: </p>
<listing>
@code{.bas}
xTextTableEnum = xTextDoc.createContentEnumeration( "com::sun::star::text::TextTable" )
while xTextTableEnum.hasMoreElements() do
print xTextTableEnum.nextElement().Name
wend
</listing>
@endcode
*/
published interface XContentEnumerationAccess: com::sun::star::uno::XInterface
{
......
......@@ -40,13 +40,12 @@ module com { module sun { module star { module container {
<p>For example (Java), to print all elements of a vector <var>aVect</var>:
</p>
<listing>
for ( XEnumeration xEnum = aVect.elements() ;
xEnum.hasMoreElements() ; )
@code{.java}
for (XEnumeration xEnum = aVect.elements() ; xEnum.hasMoreElements() ; )
{
System.out.println( xEnum.nextElement() );
System.out.println( xEnum.nextElement() );
}
</listing>
@endcode
<p> If the object changed, the behavior of the enumeration is
......
......@@ -27,16 +27,14 @@ module com { module sun { module star { module lang {
<p> You should avoid system-dependent methods if possible.
@example:C++
<listing>
#ifdef __WINDOW // Microsoft Windows
@code{.cpp}
#ifdef _WIN32 // Microsoft Windows
HWND hWin = (HWND)xInterface->getWindowHandle(SystemDependentWIN32);
if( hWin ) ...
#elif( ... ) // other systems
...
#endif
</listing>
@endcode
<p>The Symbols are now prepended with SYSTEM_ thus we avoid collisions
with system headers. </p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment