This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push: new 9c522e7 Removed whitespace, fixed typos 9c522e7 is described below commit 9c522e709ae5226bd266b22d70e5203681fe6286 Author: mseidel <msei...@apache.org> AuthorDate: Tue Jul 14 17:29:55 2020 +0200 Removed whitespace, fixed typos --- .../FlatXmlFilterDetection/filterdetect.cxx | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/main/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx b/main/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx index ef8b774..4098c0d 100644 --- a/main/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx +++ b/main/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -60,7 +60,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::ucb; -OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) +OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) throw( RuntimeException ) { // type name to return @@ -70,7 +70,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) // stream of the document to be detected Reference< XInputStream > xInStream; for ( sal_Int32 i = 0 ; i < aArguments.getLength(); i++) - { + { OUString aName = aArguments[i].Name; if (aName.equalsAscii("TypeName" ) ) aArguments[i].Value >>= sOriginalTypeName; @@ -80,15 +80,15 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) aArguments[i].Value >>= xInStream; } - if (!xInStream.is()) + if (!xInStream.is()) { - // open the stream if it was not suplied by the framework + // open the stream if it was not supplied by the framework Reference< XSimpleFileAccess > xSFI(mxMSF->createInstance( OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); if (sURL.getLength() > 0 && xSFI.is()) { try - { + { xInStream = xSFI->openFileRead( sURL); } catch( Exception& ) @@ -102,19 +102,19 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) } // flatxml starts with an office:document element. this element - // conatains a clas="..." attribut by which we can deduct the + // contains a class="..." attribute by which we can deduct the // type of document that is to be loaded - // + // // WARNING: // parsing the plain text of the document is an easy way to do this - // but not the purest solution, since namespaces and other xml details + // but not the purest solution, since namespaces and other xml details // may lead to another syntactic expression of the same document. // this example works for the way the office serializes it's XML stream // but might need extension for other data sources... static OString aDocToken("office:document"); // static OString aClassToken("office:class=\""); static OString aMimeTypeToken("office:mimetype=\""); - + sal_Int32 nHeadSize = 4096; Sequence< sal_Int8 > aHeadData(nHeadSize); @@ -126,9 +126,9 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) long bytestRead = xInStream->readBytes(aHeadData, nHeadSize); OString aHead = OString((const sal_Char *)aHeadData.getConstArray(), bytestRead).toAsciiLowerCase(); - + // check for document element of flatxml format - if (aHead.indexOf(aDocToken) >= 0) + if (aHead.indexOf(aDocToken) >= 0) { // read document class sal_Int32 n = aHead.indexOf(aMimeTypeToken); @@ -138,26 +138,26 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) OString aMimeType = aHead.copy(n, aHead.indexOf('\"', n) - n); // return type for class found if (aMimeType.equals("application/x-vnd.oasis.opendocument.text") || - aMimeType.equals("application/vnd.oasis.opendocument.text")) + aMimeType.equals("application/vnd.oasis.opendocument.text")) sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_writer"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.text-master") || - aMimeType.equals("application/vnd.oasis.opendocument.text-master")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); + aMimeType.equals("application/vnd.oasis.opendocument.text-master")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); else if (aMimeType.equals("application/x-vnd.oasis.openoffice.text-global") || - aMimeType.equals("application/vnd.oasis.openoffice.text-global")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); + aMimeType.equals("application/vnd.oasis.openoffice.text-global")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.spreadsheet") || - aMimeType.equals("application/vnd.oasis.opendocument.spreadsheet")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_calc"); + aMimeType.equals("application/vnd.oasis.opendocument.spreadsheet")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_calc"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.drawing") || - aMimeType.equals("application/vnd.oasis.opendocument.drawing")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_draw"); + aMimeType.equals("application/vnd.oasis.opendocument.drawing")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_draw"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.presentation") || - aMimeType.equals("application/vnd.oasis.opendocument.presentation")) + aMimeType.equals("application/vnd.oasis.opendocument.presentation")) sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.presentation") || aMimeType.equals("application/vnd.oasis.opendocument.presentation")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); } } return sTypeName; @@ -165,7 +165,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) // XInitialization -void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) +void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) { Sequence < PropertyValue > aAnySeq; @@ -175,10 +175,10 @@ void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) const PropertyValue * pValue = aAnySeq.getConstArray(); nLength = aAnySeq.getLength(); for ( sal_Int32 i = 0 ; i < nLength; i++) - { + { if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) ) { - pValue[i].Value >>= msFilterName; + pValue[i].Value >>= msFilterName; } else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "UserData" ) ) ) { @@ -200,13 +200,13 @@ OUString FilterDetect_getImplementationName () #define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection" -sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName ) throw (RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ); } -Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) +Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) throw (RuntimeException) { Sequence < OUString > aRet(2); @@ -224,19 +224,19 @@ Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< X } // XServiceInfo -OUString SAL_CALL FilterDetect::getImplementationName( ) +OUString SAL_CALL FilterDetect::getImplementationName( ) throw (RuntimeException) { return FilterDetect_getImplementationName(); } -sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) +sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) throw (RuntimeException) { return FilterDetect_supportsService( rServiceName ); } -Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( ) +Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( ) throw (RuntimeException) { return FilterDetect_getSupportedServiceNames();