You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2023/09/18 21:19:42 UTC
[openoffice] branch AOO42X updated: Maintenance cleanup
This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new facfa769b2 Maintenance cleanup
facfa769b2 is described below
commit facfa769b24085cdd3483ec17d21b4f42b335e99
Author: mseidel <ms...@apache.org>
AuthorDate: Mon Sep 18 23:16:55 2023 +0200
Maintenance cleanup
(cherry picked from commit ce48dd1f26396c7ab9fed48d2df6a6b2bfcf6e06)
---
main/filter/source/msfilter/svxmsbas.cxx | 579 +++++++++---------
main/idlc/source/options.cxx | 582 +++++++++---------
main/l10ntools/source/help/HelpCompiler.cxx | 915 ++++++++++++++--------------
main/l10ntools/source/help/HelpCompiler.hxx | 402 ++++++------
main/svtools/inc/svtools/svparser.hxx | 70 +--
main/svtools/source/svrtf/parrtf.cxx | 234 ++++---
main/sw/source/filter/ascii/parasc.cxx | 198 +++---
7 files changed, 1484 insertions(+), 1496 deletions(-)
diff --git a/main/filter/source/msfilter/svxmsbas.cxx b/main/filter/source/msfilter/svxmsbas.cxx
index 4f7a279ae1..44d97512ec 100644
--- a/main/filter/source/msfilter/svxmsbas.cxx
+++ b/main/filter/source/msfilter/svxmsbas.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.
- *
+ *
*************************************************************/
@@ -24,7 +24,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_filter.hxx"
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#include <tools/debug.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/app.hxx>
@@ -59,14 +58,14 @@ using namespace com::sun::star;
using rtl::OUString;
-static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
+static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- sal_Bool bAsComment, sal_Bool bStripped )
+ const String &rSubStorageName,
+ sal_Bool bAsComment, sal_Bool bStripped )
{
- std::vector< String > codeNames;
- return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
+ std::vector< String > codeNames;
+ return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
}
int SvxImportMSVBasic::Import( const String& rStorageName,
@@ -79,8 +78,8 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
bAsComment, bStripped ))
nRet |= 1;
- if (bImport)
- ImportForms_Impl(rStorageName, rSubStorageName);
+ if (bImport)
+ ImportForms_Impl(rStorageName, rSubStorageName);
if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
nRet |= 2;
@@ -89,105 +88,105 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
}
bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- const String& rSubStorageName)
+ const String& rSubStorageName)
{
- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-
- std::vector<String> aUserForms;
- SvStorageInfoList aContents;
- xVBAStg->FillInfoList(&aContents);
- for (sal_uInt16 nI = 0; nI < aContents.Count(); ++nI)
- {
- SvStorageInfo& rInfo = aContents.GetObject(nI);
- if (!rInfo.IsStream() && rInfo.GetName() != rSubStorageName)
- aUserForms.push_back(rInfo.GetName());
- }
-
- if (aUserForms.empty())
- return false;
-
- bool bRet = true;
- try
- {
- Reference<XMultiServiceFactory> xSF(comphelper::getProcessServiceFactory());
-
- Reference<XComponentContext> xContext;
- Reference<XPropertySet> xProps(xSF, UNO_QUERY);
- xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext;
-
-
- Reference<XLibraryContainer> xLibContainer = rDocSh.GetDialogContainer();
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
- Reference<XNameContainer> xLib;
- if (xLibContainer.is())
- {
- if( !xLibContainer->hasByName(aLibName))
- xLibContainer->createLibrary(aLibName);
-
- Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
-
- if(xLib.is())
- {
- typedef std::vector<String>::iterator myIter;
- myIter aEnd = aUserForms.end();
- for (myIter aIter = aUserForms.begin(); aIter != aEnd; ++aIter)
- {
- SvStorageRef xForm (xVBAStg->OpenSotStorage(*aIter,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
-
- if (!xForm.Is() || xForm->GetError())
- continue;
-
- SvStorageStreamRef xFrame = xForm->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "\3VBFrame" ) ),
- STREAM_STD_READ | STREAM_NOCREATE);
-
- if (!xFrame.Is() || xFrame->GetError())
- continue;
-
- SvStorageStreamRef xTypes = xForm->OpenSotStream(
- String( 'f' ), STREAM_STD_READ | STREAM_NOCREATE);
-
- if (!xTypes.Is() || xTypes->GetError())
- continue;
-
- //<UserForm Name=""><VBFrame></VBFrame>"
- String sData;
- String sLine;
- while(xFrame->ReadByteStringLine(sLine, RTL_TEXTENCODING_MS_1252))
- {
- sData += sLine;
- sData += '\n';
- }
- sData.ConvertLineEnd();
-
- Reference<container::XNameContainer> xDialog(
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
-
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
- DBG_ASSERT(bOk, "Had unexpected content, not risking this module");
- if (bOk)
- aForm.Import(xLib);
- }
- }
- }
- catch(...)
- {
- DBG_ERRORFILE( "SvxImportMSVBasic::ImportForms_Impl - any exception caught" );
- //bRet = false;
- }
- return bRet;
+ SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
+ if (!xVBAStg.Is() || xVBAStg->GetError())
+ return false;
+
+ std::vector<String> aUserForms;
+ SvStorageInfoList aContents;
+ xVBAStg->FillInfoList(&aContents);
+ for (sal_uInt16 nI = 0; nI < aContents.Count(); ++nI)
+ {
+ SvStorageInfo& rInfo = aContents.GetObject(nI);
+ if (!rInfo.IsStream() && rInfo.GetName() != rSubStorageName)
+ aUserForms.push_back(rInfo.GetName());
+ }
+
+ if (aUserForms.empty())
+ return false;
+
+ bool bRet = true;
+ try
+ {
+ Reference<XMultiServiceFactory> xSF(comphelper::getProcessServiceFactory());
+
+ Reference<XComponentContext> xContext;
+ Reference<XPropertySet> xProps(xSF, UNO_QUERY);
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext;
+
+
+ Reference<XLibraryContainer> xLibContainer = rDocSh.GetDialogContainer();
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ Reference<XNameContainer> xLib;
+ if (xLibContainer.is())
+ {
+ if( !xLibContainer->hasByName(aLibName))
+ xLibContainer->createLibrary(aLibName);
+
+ Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+
+ if(xLib.is())
+ {
+ typedef std::vector<String>::iterator myIter;
+ myIter aEnd = aUserForms.end();
+ for (myIter aIter = aUserForms.begin(); aIter != aEnd; ++aIter)
+ {
+ SvStorageRef xForm (xVBAStg->OpenSotStorage(*aIter,
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
+
+ if (!xForm.Is() || xForm->GetError())
+ continue;
+
+ SvStorageStreamRef xFrame = xForm->OpenSotStream(
+ String( RTL_CONSTASCII_USTRINGPARAM( "\3VBFrame" ) ),
+ STREAM_STD_READ | STREAM_NOCREATE);
+
+ if (!xFrame.Is() || xFrame->GetError())
+ continue;
+
+ SvStorageStreamRef xTypes = xForm->OpenSotStream(
+ String( 'f' ), STREAM_STD_READ | STREAM_NOCREATE);
+
+ if (!xTypes.Is() || xTypes->GetError())
+ continue;
+
+ //<UserForm Name=""><VBFrame></VBFrame>"
+ String sData;
+ String sLine;
+ while(xFrame->ReadByteStringLine(sLine, RTL_TEXTENCODING_MS_1252))
+ {
+ sData += sLine;
+ sData += '\n';
+ }
+ sData.ConvertLineEnd();
+
+ Reference<container::XNameContainer> xDialog(
+ xSF->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
+
+ OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
+ aForm.pDocSh = &rDocSh;
+ sal_Bool bOk = aForm.Read(xTypes);
+ DBG_ASSERT(bOk, "Had unexpected content, not risking this module");
+ if (bOk)
+ aForm.Import(xLib);
+ }
+ }
+ }
+ catch(...)
+ {
+ DBG_ERRORFILE( "SvxImportMSVBasic::ImportForms_Impl - any exception caught" );
+ //bRet = false;
+ }
+ return bRet;
}
@@ -206,7 +205,7 @@ sal_Bool SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
STREAM_SHARE_DENYALL ));
if( xVBASubStg.Is() && !xVBASubStg->GetError() )
{
- // then we will copy these storages into the (temporary) storage of the document
+ // then we will copy these storages into the (temporary) storage of the document
bValidStg = sal_True;
}
}
@@ -215,19 +214,19 @@ sal_Bool SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
if( bValidStg )
{
String aDstStgName( GetMSBasicStorageName() );
- SotStorageRef xDst = SotStorage::OpenOLEStorage( rDocSh.GetStorage(), aDstStgName, STREAM_READWRITE | STREAM_TRUNC );
- SotStorageRef xSrc = xRoot->OpenSotStorage( rStorageName, STREAM_STD_READ );
-
- // TODO/LATER: should we commit the storage?
- xSrc->CopyTo( xDst );
- xDst->Commit();
- ErrCode nError = xDst->GetError();
- if ( nError == ERRCODE_NONE )
- nError = xSrc->GetError();
- if ( nError != ERRCODE_NONE )
- xRoot->SetError( nError );
- else
- bValidStg = sal_True;
+ SotStorageRef xDst = SotStorage::OpenOLEStorage( rDocSh.GetStorage(), aDstStgName, STREAM_READWRITE | STREAM_TRUNC );
+ SotStorageRef xSrc = xRoot->OpenSotStorage( rStorageName, STREAM_STD_READ );
+
+ // TODO/LATER: should we commit the storage?
+ xSrc->CopyTo( xDst );
+ xDst->Commit();
+ ErrCode nError = xDst->GetError();
+ if ( nError == ERRCODE_NONE )
+ nError = xSrc->GetError();
+ if ( nError != ERRCODE_NONE )
+ xRoot->SetError( nError );
+ else
+ bValidStg = sal_True;
}
return bValidStg;
@@ -242,54 +241,54 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
VBA_Impl aVBA( *xRoot, bAsComment );
if( aVBA.Open(rStorageName,rSubStorageName) )
{
- Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
+ Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- /* Set library container to VBA compatibility mode. This will create
- the VBA Globals object and store it in the Basic manager of the
- document. */
- if( !bAsComment ) try
- {
- Reference< vba::XVBACompatibility >( xLibContainer, UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True );
- }
- catch( Exception& )
- {
- }
-
- sal_uInt16 nStreamCount = aVBA.GetNoStreams();
+
+ /* Set library container to VBA compatibility mode. This will create
+ the VBA Globals object and store it in the Basic manager of the
+ document. */
+ if( !bAsComment ) try
+ {
+ Reference< vba::XVBACompatibility >( xLibContainer, UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True );
+ }
+ catch( Exception& )
+ {
+ }
+
+ sal_uInt16 nStreamCount = aVBA.GetNoStreams();
Reference<XNameContainer> xLib;
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
- if( xLibContainer.is() && nStreamCount )
- {
- if( !xLibContainer->hasByName( aLibName ) )
- xLibContainer->createLibrary( aLibName );
-
- Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if( xLibContainer.is() && nStreamCount )
+ {
+ if( !xLibContainer->hasByName( aLibName ) )
+ xLibContainer->createLibrary( aLibName );
+
+ Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
if( xLib.is() )
{
- Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
- Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
+ Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
if ( !bAsComment )
- {
- Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
- if ( xSF.is() )
- {
- try
- {
- xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
- }
- catch( Exception& ) { }
- }
- }
- typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
+ {
+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
+ if ( xSF.is() )
+ {
+ try
+ {
+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
+ }
+ catch( Exception& ) { }
+ }
+ }
+ typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
::std::equal_to< ::rtl::OUString > > NameModuleDataHash;
- typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash,
+ typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash,
::std::equal_to< ::rtl::OUString > > NameModuleInfoHash;
- NameModuleDataHash moduleData;
- NameModuleInfoHash moduleInfos;
+ NameModuleDataHash moduleData;
+ NameModuleInfoHash moduleInfos;
for( sal_uInt16 i=0; i<nStreamCount;i++)
{
@@ -310,53 +309,53 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
const String sBasicModule(sByteBasic,
RTL_TEXTENCODING_ASCII_US);
#else
- const String &sBasicModule = aVBA.GetStreamName( i);
+ const String &sBasicModule = aVBA.GetStreamName( i);
#endif
- /* #117718# expose information regarding type of Module
- * Class, Form or plain 'ould VBA module with a REM statement
- * at the top of the module. Mapping of Module Name
- * to type is performed in VBA_Impl::Open() method,
- * ( msvbasic.cxx ) by examining the PROJECT stream.
- */
-
- // using name from aVBA.GetStreamName
- // because the encoding of the same returned
- // is the same as the encoding for the names
- // that are keys in the map used by GetModuleType method
- const String &sOrigVBAModName = aVBA.GetStreamName( i );
- ModType mType = aVBA.GetModuleType( sOrigVBAModName );
-
- rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-
- rtl::OUString modeTypeComment;
-
- switch( mType )
- {
- case ModuleType::CLASS:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
- break;
- case ModuleType::FORM:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
- break;
- case ModuleType::DOCUMENT:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
- break;
- case ModuleType::NORMAL:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
- break;
- case ModuleType::UNKNOWN:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
- break;
- default:
- DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
- break;
- }
- static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
+ /* #117718# expose information regarding type of Module
+ * Class, Form or plain 'ould VBA module with a REM statement
+ * at the top of the module. Mapping of Module Name
+ * to type is performed in VBA_Impl::Open() method,
+ * ( msvbasic.cxx ) by examining the PROJECT stream.
+ */
+
+ // using name from aVBA.GetStreamName
+ // because the encoding of the same returned
+ // is the same as the encoding for the names
+ // that are keys in the map used by GetModuleType method
+ const String &sOrigVBAModName = aVBA.GetStreamName( i );
+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
+
+ rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
+
+ rtl::OUString modeTypeComment;
+
+ switch( mType )
+ {
+ case ModuleType::CLASS:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
+ break;
+ case ModuleType::FORM:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
+ break;
+ case ModuleType::DOCUMENT:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
+ break;
+ case ModuleType::NORMAL:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
+ break;
+ case ModuleType::UNKNOWN:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
+ break;
+ default:
+ DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
+ break;
+ }
+ static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
if ( !bAsComment )
{
modeTypeComment += sVBAOption;
@@ -364,55 +363,55 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
modeTypeComment += sClassOption;
}
- String sModule(sBasicModule); //#i52606# no need to split Macros in 64KB blocks any more!
+ String sModule(sBasicModule); // #i52606# no need to split Macros in 64KB blocks any more!
String sTemp;
if (bAsComment)
{
sTemp+=String(RTL_CONSTASCII_USTRINGPARAM( "Sub " ));
String sMunge(sModule);
- //Streams can have spaces in them, but modulenames
- //cannot !
+ // Streams can have spaces in them, but modulenames
+ // cannot !
sMunge.SearchAndReplaceAll(' ','_');
sTemp += sMunge;
sTemp.AppendAscii("\n");
};
- ::rtl::OUString aSource(sTemp);
+ ::rtl::OUString aSource(sTemp);
for(sal_uLong j=0;j<aDecompressed.GetSize();j++)
{
if (bStripped)
{
- String *pStr = aDecompressed.Get(j);
- bool bMac = true;
- xub_StrLen nBegin = pStr->Search('\x0D');
- if ((STRING_NOTFOUND != nBegin) && (pStr->Len() > 1) && (pStr->GetChar(nBegin+1) == '\x0A'))
- bMac = false;
-
- const char cLineEnd = bMac ? '\x0D' : '\x0A';
- const String sAttribute(String::CreateFromAscii(
- bAsComment ? "Rem Attribute" : "Attribute"));
+ String *pStr = aDecompressed.Get(j);
+ bool bMac = true;
+ xub_StrLen nBegin = pStr->Search('\x0D');
+ if ((STRING_NOTFOUND != nBegin) && (pStr->Len() > 1) && (pStr->GetChar(nBegin+1) == '\x0A'))
+ bMac = false;
+
+ const char cLineEnd = bMac ? '\x0D' : '\x0A';
+ const String sAttribute(String::CreateFromAscii(
+ bAsComment ? "Rem Attribute" : "Attribute"));
nBegin = 0;
while (STRING_NOTFOUND != (nBegin = pStr->Search(sAttribute, nBegin)))
{
- if ((nBegin) && pStr->GetChar(nBegin-1) != cLineEnd)
+ if ((nBegin) && pStr->GetChar(nBegin-1) != cLineEnd)
{
- // npower #i63766# Need to skip instances of Attribute
+ // npower #i63766# Need to skip instances of Attribute
// that are NOT Attribute statements
nBegin = nBegin + sAttribute.Len();
- continue;
+ continue;
}
xub_StrLen nEnd = pStr->Search(cLineEnd ,nBegin);
- // DR #i26521# catch STRING_NOTFOUND, will loop endless otherwise
- if( nEnd == STRING_NOTFOUND )
- pStr->Erase();
- else
- pStr->Erase(nBegin, (nEnd-nBegin)+1);
+ // DR #i26521# catch STRING_NOTFOUND, will loop endless otherwise
+ if( nEnd == STRING_NOTFOUND )
+ pStr->Erase();
+ else
+ pStr->Erase(nBegin, (nEnd-nBegin)+1);
}
}
if( aDecompressed.Get(j)->Len() )
{
- aSource+=::rtl::OUString( *aDecompressed.Get(j) );
+ aSource+=::rtl::OUString( *aDecompressed.Get(j) );
}
}
@@ -424,64 +423,64 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
aSource = modeTypeComment + aSource;
Any aSourceAny;
- OSL_TRACE("erm %d", mType );
- aSourceAny <<= aSource;
- if ( !bAsComment )
- {
- OSL_TRACE("vba processing %d", mType );
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleType = mType;
- moduleInfos[ aModName ] = sModuleInfo;
- }
+ OSL_TRACE("erm %d", mType );
+ aSourceAny <<= aSource;
+ if ( !bAsComment )
+ {
+ OSL_TRACE("vba processing %d", mType );
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = mType;
+ moduleInfos[ aModName ] = sModuleInfo;
+ }
moduleData[ aModName ] = aSourceAny;
- }
- // Hack for missing codenames ( only know to happen in excel but... )
- // only makes sense to do this if we are importing non-commented basic
- if ( !bAsComment )
- {
- for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
- {
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleType = ModuleType::DOCUMENT;
- moduleInfos[ *it ] = sModuleInfo;
- moduleData[ *it ] = uno::makeAny( sVBAOption );
- }
- }
- NameModuleDataHash::iterator it_end = moduleData.end();
- for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
- {
- NameModuleInfoHash::iterator it_info = moduleInfos.find( it->first );
- if ( it_info != moduleInfos.end() )
- {
- ModuleInfo& sModuleInfo = it_info->second;
- if ( sModuleInfo.ModuleType == ModuleType::FORM )
- // hack, the module ( imo document basic should...
- // know the XModel... ) but it doesn't
- sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
- // document modules, we should be able to access
- // the api objects at this time
- else if ( sModuleInfo.ModuleType == ModuleType::DOCUMENT )
- {
- if ( xVBACodeNamedObjectAccess.is() )
- {
- try
- {
- sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( it->first ), uno::UNO_QUERY );
- OSL_TRACE("** Straight up creation of Module");
- }
- catch(uno::Exception& e)
- {
- OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- }
- }
- xVBAModuleInfo->insertModuleInfo( it->first, sModuleInfo );
- }
-
- if( xLib->hasByName( it->first ) )
- xLib->replaceByName( it->first, it->second );
- else
- xLib->insertByName( it->first, it->second );
+ }
+ // Hack for missing codenames ( only known to happen in Excel but... )
+ // only makes sense to do this if we are importing non-commented basic
+ if ( !bAsComment )
+ {
+ for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
+ {
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = ModuleType::DOCUMENT;
+ moduleInfos[ *it ] = sModuleInfo;
+ moduleData[ *it ] = uno::makeAny( sVBAOption );
+ }
+ }
+ NameModuleDataHash::iterator it_end = moduleData.end();
+ for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
+ {
+ NameModuleInfoHash::iterator it_info = moduleInfos.find( it->first );
+ if ( it_info != moduleInfos.end() )
+ {
+ ModuleInfo& sModuleInfo = it_info->second;
+ if ( sModuleInfo.ModuleType == ModuleType::FORM )
+ // hack, the module ( imo document basic should...
+ // know the XModel... ) but it doesn't
+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
+ // document modules, we should be able to access
+ // the api objects at this time
+ else if ( sModuleInfo.ModuleType == ModuleType::DOCUMENT )
+ {
+ if ( xVBACodeNamedObjectAccess.is() )
+ {
+ try
+ {
+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( it->first ), uno::UNO_QUERY );
+ OSL_TRACE("** Straight up creation of Module");
+ }
+ catch(uno::Exception& e)
+ {
+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+ xVBAModuleInfo->insertModuleInfo( it->first, sModuleInfo );
+ }
+
+ if( xLib->hasByName( it->first ) )
+ xLib->replaceByName( it->first, it->second );
+ else
+ xLib->insertByName( it->first, it->second );
}
bRet = true;
}
@@ -489,4 +488,4 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
return bRet;
}
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/idlc/source/options.cxx b/main/idlc/source/options.cxx
index a2f1bf9a00..3bab89c0c7 100644
--- a/main/idlc/source/options.cxx
+++ b/main/idlc/source/options.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.
- *
+ *
*************************************************************/
@@ -34,21 +34,21 @@
#include "osl/file.hxx"
#ifdef WNT
-# include <windows.h>
+# include <windows.h>
#endif
/*
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# ifdef _MSC_VER
-# pragma warning(push,1)
-# endif
-# include <windows.h>
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif
-# include <tchar.h>
-# undef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# ifdef _MSC_VER
+# pragma warning(push,1)
+# endif
+# include <windows.h>
+# ifdef _MSC_VER
+# pragma warning(pop)
+# endif
+# include <tchar.h>
+# undef WIN32_LEAN_AND_MEAN
#endif
*/
@@ -65,9 +65,9 @@ using rtl::OStringBuffer;
#endif
Options::Options(char const * progname)
- : m_program(progname), m_stdin(false), m_verbose(false), m_quiet(false)
+ : m_program(progname), m_stdin(false), m_verbose(false), m_quiet(false)
{
-}
+}
Options::~Options()
{
@@ -76,145 +76,145 @@ Options::~Options()
// static
bool Options::checkArgument (std::vector< std::string > & rArgs, char const * arg, size_t len)
{
- bool result = ((arg != 0) && (len > 0));
- OSL_PRECOND(result, "idlc::Options::checkArgument(): invalid arguments");
- if (result)
- {
- switch(arg[0])
- {
- case '@':
- if ((result = (len > 1)) == true)
- {
- // "@<cmdfile>"
- result = Options::checkCommandFile (rArgs, &(arg[1]));
- }
- break;
- case '-':
- if ((result = (len > 1)) == true)
- {
- // "-<option>"
- switch (arg[1])
- {
- case 'O':
- case 'I':
- case 'D':
- {
- // "-<option>[<param>]
- std::string option(&(arg[0]), 2);
- rArgs.push_back(option);
- if (len > 2)
- {
- // "-<option><param>"
- std::string param(&(arg[2]), len - 2);
- rArgs.push_back(param);
- }
- break;
- }
- default:
- // "-<option>" ([long] option, w/o param)
- rArgs.push_back(std::string(arg, len));
- break;
- }
- }
- break;
- default:
- // "<param>"
- rArgs.push_back(std::string(arg, len));
- break;
- }
- }
- return (result);
+ bool result = ((arg != 0) && (len > 0));
+ OSL_PRECOND(result, "idlc::Options::checkArgument(): invalid arguments");
+ if (result)
+ {
+ switch(arg[0])
+ {
+ case '@':
+ if ((result = (len > 1)) == true)
+ {
+ // "@<cmdfile>"
+ result = Options::checkCommandFile (rArgs, &(arg[1]));
+ }
+ break;
+ case '-':
+ if ((result = (len > 1)) == true)
+ {
+ // "-<option>"
+ switch (arg[1])
+ {
+ case 'O':
+ case 'I':
+ case 'D':
+ {
+ // "-<option>[<param>]
+ std::string option(&(arg[0]), 2);
+ rArgs.push_back(option);
+ if (len > 2)
+ {
+ // "-<option><param>"
+ std::string param(&(arg[2]), len - 2);
+ rArgs.push_back(param);
+ }
+ break;
+ }
+ default:
+ // "-<option>" ([long] option, w/o param)
+ rArgs.push_back(std::string(arg, len));
+ break;
+ }
+ }
+ break;
+ default:
+ // "<param>"
+ rArgs.push_back(std::string(arg, len));
+ break;
+ }
+ }
+ return (result);
}
// static
bool Options::checkCommandFile (std::vector< std::string > & rArgs, char const * filename)
{
- FILE * fp = fopen(filename, "r");
- if (fp == 0)
- {
- fprintf(stderr, "ERROR: can't open command file \"%s\"\n", filename);
- return (false);
- }
-
- std::string buffer;
- buffer.reserve(256);
-
- bool quoted = false;
- int c = EOF;
- while ((c = fgetc(fp)) != EOF)
- {
- switch(c)
- {
- case '\"':
- quoted = !quoted;
- break;
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- if (!quoted)
- {
- if (!buffer.empty())
- {
- // append current argument.
- if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size()))
- {
- (void) fclose(fp);
- return (false);
- }
- buffer.clear();
- }
- break;
- }
- default:
- // quoted white-space fall through
- buffer.push_back(sal::static_int_cast<char>(c));
- break;
- }
- }
- if (!buffer.empty())
- {
- // append unterminated argument.
- if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size()))
- {
- (void) fclose(fp);
- return (false);
- }
- buffer.clear();
- }
- return (fclose(fp) == 0);
+ FILE * fp = fopen(filename, "r");
+ if (fp == 0)
+ {
+ fprintf(stderr, "ERROR: can't open command file \"%s\"\n", filename);
+ return (false);
+ }
+
+ std::string buffer;
+ buffer.reserve(256);
+
+ bool quoted = false;
+ int c = EOF;
+ while ((c = fgetc(fp)) != EOF)
+ {
+ switch(c)
+ {
+ case '\"':
+ quoted = !quoted;
+ break;
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ if (!quoted)
+ {
+ if (!buffer.empty())
+ {
+ // append current argument.
+ if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size()))
+ {
+ (void) fclose(fp);
+ return (false);
+ }
+ buffer.clear();
+ }
+ break;
+ }
+ default:
+ // quoted white-space fall through
+ buffer.push_back(sal::static_int_cast<char>(c));
+ break;
+ }
+ }
+ if (!buffer.empty())
+ {
+ // append unterminated argument.
+ if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size()))
+ {
+ (void) fclose(fp);
+ return (false);
+ }
+ buffer.clear();
+ }
+ return (fclose(fp) == 0);
}
bool Options::badOption(char const * reason, std::string const & rArg) throw(IllegalArgument)
{
- OStringBuffer message;
- if (reason != 0)
- {
- message.append(reason); message.append(" option '"); message.append(rArg.c_str()); message.append("'");
- throw IllegalArgument(message.makeStringAndClear());
- }
- return false;
+ OStringBuffer message;
+ if (reason != 0)
+ {
+ message.append(reason); message.append(" option '"); message.append(rArg.c_str()); message.append("'");
+ throw IllegalArgument(message.makeStringAndClear());
+ }
+ return false;
}
bool Options::setOption(char const * option, std::string const & rArg)
{
- bool result = (0 == strcmp(option, rArg.c_str()));
- if (result)
- m_options[rArg.c_str()] = OString(rArg.c_str(), rArg.size());
- return (result);
+ bool result = (0 == strcmp(option, rArg.c_str()));
+ if (result)
+ m_options[rArg.c_str()] = OString(rArg.c_str(), rArg.size());
+ return (result);
}
#ifdef WNT
-/* Helper functiopn to convert windows paths including spaces, brackets etc. into
+/* Helper function to convert windows paths including spaces, brackets etc. into
a windows short Url. The ucpp preprocessor has problems with such paths and returns
with error.
*/
OString convertIncPathtoShortWindowsPath(const OString& incPath) {
rtl::OUString path = OStringToOUString(incPath, RTL_TEXTENCODING_UTF8);
- std::vector<sal_Unicode> vec(path.getLength() + 1);
- //GetShortPathNameW only works if the file can be found!
- const DWORD len = GetShortPathNameW(
+ std::vector<sal_Unicode> vec(path.getLength() + 1);
+ //GetShortPathNameW only works if the file can be found!
+ const DWORD len = GetShortPathNameW(
reinterpret_cast<LPCWSTR>(path.getStr()), reinterpret_cast<LPWSTR>(&vec[0]), path.getLength() + 1);
rtl::OUString ret = rtl::OUString(&vec[0], len);
@@ -228,157 +228,157 @@ OString convertIncPathtoShortWindowsPath(const OString& incPath) {
bool Options::initOptions(std::vector< std::string > & rArgs) throw(IllegalArgument)
{
- std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end();
- for (; first != last; ++first)
- {
- if ((*first)[0] != '-')
- {
- OString filename((*first).c_str(), (*first).size());
- OString tmp(filename.toAsciiLowerCase());
- if (tmp.lastIndexOf(".idl") != (tmp.getLength() - 4))
- {
- throw IllegalArgument("'" + filename + "' is not a valid input file, only '*.idl' files will be accepted");
- }
- m_inputFiles.push_back(filename);
- continue;
- }
-
- std::string const option(*first);
- switch((*first)[1])
- {
- case 'O':
- {
- if (!((++first != last) && ((*first)[0] != '-')))
- {
- return badOption("invalid", option);
- }
- OString param((*first).c_str(), (*first).size());
- m_options["-O"] = param;
- break;
- }
- case 'I':
- {
- if (!((++first != last) && ((*first)[0] != '-')))
- {
- return badOption("invalid", option);
- }
- OString param((*first).c_str(), (*first).size());
- {
- // quote param token(s).
- OStringBuffer buffer;
- sal_Int32 k = 0;
- do
- {
- OStringBuffer token;
- token.append("-I");
+ std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end();
+ for (; first != last; ++first)
+ {
+ if ((*first)[0] != '-')
+ {
+ OString filename((*first).c_str(), (*first).size());
+ OString tmp(filename.toAsciiLowerCase());
+ if (tmp.lastIndexOf(".idl") != (tmp.getLength() - 4))
+ {
+ throw IllegalArgument("'" + filename + "' is not a valid input file, only '*.idl' files will be accepted");
+ }
+ m_inputFiles.push_back(filename);
+ continue;
+ }
+
+ std::string const option(*first);
+ switch((*first)[1])
+ {
+ case 'O':
+ {
+ if (!((++first != last) && ((*first)[0] != '-')))
+ {
+ return badOption("invalid", option);
+ }
+ OString param((*first).c_str(), (*first).size());
+ m_options["-O"] = param;
+ break;
+ }
+ case 'I':
+ {
+ if (!((++first != last) && ((*first)[0] != '-')))
+ {
+ return badOption("invalid", option);
+ }
+ OString param((*first).c_str(), (*first).size());
+ {
+ // quote param token(s).
+ OStringBuffer buffer;
+ sal_Int32 k = 0;
+ do
+ {
+ OStringBuffer token;
+ token.append("-I");
#ifdef WNT
rtl::OString incpath = convertIncPathtoShortWindowsPath(param.getToken(0, ';', k));
#else
rtl::OString incpath = param.getToken(0, ';', k);
#endif
token.append(incpath);
- //token.append(param.getToken(0, ';', k));
- if (buffer.getLength() > 0)
- buffer.append(' ');
- buffer.append(token);
- } while (k != -1);
- param = buffer.makeStringAndClear();
- }
- if (m_options.count("-I") > 0)
- {
- // append param.
- OStringBuffer buffer(m_options["-I"]);
- buffer.append(' '); buffer.append(param);
- param = buffer.makeStringAndClear();
- }
- m_options["-I"] = param;
- break;
- }
- case 'D':
- {
- if (!((++first != last) && ((*first)[0] != '-')))
- {
- return badOption("invalid", option);
- }
- OString param("-D"); param += OString((*first).c_str(), (*first).size());
- if (m_options.count("-D") > 0)
- {
- OStringBuffer buffer(m_options["-D"]);
- buffer.append(' '); buffer.append(param);
- param = buffer.makeStringAndClear();
- }
- m_options["-D"] = param;
- break;
- }
- case 'C':
- {
- if (!setOption("-C", option))
- {
- return badOption("invalid", option);
- }
- break;
- }
- case 'c':
- {
- if (!setOption("-cid", option))
- {
- return badOption("invalid", option);
- }
- break;
- }
- case 'q':
- {
- if (!setOption("-quiet", option))
- {
- return badOption("invalid", option);
- }
- m_quiet = true;
- break;
- }
- case 'v':
- {
- if (!setOption("-verbose", option))
- {
- return badOption("invalid", option);
- }
- m_verbose = true;
- break;
- }
- case 'w':
- {
- if (!(setOption("-w", option) || setOption("-we", option)))
- {
- return badOption("invalid", option);
- }
- break;
- }
- case 'h':
- case '?':
- {
- if (!(setOption("-h", option) || setOption("-?", option)))
- {
- return badOption("invalid", option);
- }
- {
- (void) fprintf(stdout, "%s", prepareHelp().getStr());
- return (false);
- }
- // break; // Unreachable
- }
- case 's':
- {
- if (!setOption("-stdin", option))
- {
- return badOption("invalid", option);
- }
- m_stdin = true;
- break;
- }
- default:
- return badOption("unknown", option);
- }
- }
- return (true);
+ //token.append(param.getToken(0, ';', k));
+ if (buffer.getLength() > 0)
+ buffer.append(' ');
+ buffer.append(token);
+ } while (k != -1);
+ param = buffer.makeStringAndClear();
+ }
+ if (m_options.count("-I") > 0)
+ {
+ // append param.
+ OStringBuffer buffer(m_options["-I"]);
+ buffer.append(' '); buffer.append(param);
+ param = buffer.makeStringAndClear();
+ }
+ m_options["-I"] = param;
+ break;
+ }
+ case 'D':
+ {
+ if (!((++first != last) && ((*first)[0] != '-')))
+ {
+ return badOption("invalid", option);
+ }
+ OString param("-D"); param += OString((*first).c_str(), (*first).size());
+ if (m_options.count("-D") > 0)
+ {
+ OStringBuffer buffer(m_options["-D"]);
+ buffer.append(' '); buffer.append(param);
+ param = buffer.makeStringAndClear();
+ }
+ m_options["-D"] = param;
+ break;
+ }
+ case 'C':
+ {
+ if (!setOption("-C", option))
+ {
+ return badOption("invalid", option);
+ }
+ break;
+ }
+ case 'c':
+ {
+ if (!setOption("-cid", option))
+ {
+ return badOption("invalid", option);
+ }
+ break;
+ }
+ case 'q':
+ {
+ if (!setOption("-quiet", option))
+ {
+ return badOption("invalid", option);
+ }
+ m_quiet = true;
+ break;
+ }
+ case 'v':
+ {
+ if (!setOption("-verbose", option))
+ {
+ return badOption("invalid", option);
+ }
+ m_verbose = true;
+ break;
+ }
+ case 'w':
+ {
+ if (!(setOption("-w", option) || setOption("-we", option)))
+ {
+ return badOption("invalid", option);
+ }
+ break;
+ }
+ case 'h':
+ case '?':
+ {
+ if (!(setOption("-h", option) || setOption("-?", option)))
+ {
+ return badOption("invalid", option);
+ }
+ {
+ (void) fprintf(stdout, "%s", prepareHelp().getStr());
+ return (false);
+ }
+ // break; // Unreachable
+ }
+ case 's':
+ {
+ if (!setOption("-stdin", option))
+ {
+ return badOption("invalid", option);
+ }
+ m_stdin = true;
+ break;
+ }
+ default:
+ return badOption("unknown", option);
+ }
+ }
+ return (true);
}
OString Options::prepareHelp()
@@ -388,12 +388,12 @@ OString Options::prepareHelp()
help += " <file_n> = file_n specifies one or more idl files.\n";
help += " Only files with the extension '.idl' are valid.\n";
help += " @<filename> = filename specifies the name of a command file.\n";
- help += " -stdin = read idl file from standard input.\n";
+ help += " -stdin = read idl file from standard input.\n";
help += " Options:\n";
help += " -O<path> = path specifies the output directory.\n";
help += " The generated output is a registry file with\n";
help += " the same name as the idl input file (or 'stdin'\n";
- help += " for -stdin).\n";
+ help += " for -stdin).\n";
help += " -I<path> = path specifies a directory where include\n";
help += " files will be searched by the preprocessor.\n";
help += " Multiple directories can be combined with ';'.\n";
@@ -401,31 +401,31 @@ OString Options::prepareHelp()
help += " -C = generate complete type information, including\n";
help += " documentation.\n";
help += " -cid = check if identifiers fulfill the UNO naming\n";
- help += " requirements.\n";
+ help += " requirements.\n";
help += " -w = display warning messages.\n";
help += " -we = treat warnings as errors.\n";
help += " -h|-? = print this help message and exit.\n\n";
help += prepareVersion();
-
+
return help;
-}
+}
OString Options::prepareVersion()
{
OString version(m_program);
version += " Version 1.1\n\n";
return version;
-}
+}
const OString& Options::getProgramName() const
{
return m_program;
-}
+}
bool Options::isValid(const OString& option)
{
- return (m_options.count(option) > 0);
-}
+ return (m_options.count(option) > 0);
+}
const OString& Options::getOption(const OString& option)
throw( IllegalArgument )
@@ -434,6 +434,6 @@ const OString& Options::getOption(const OString& option)
{
throw IllegalArgument("Option is not valid or currently not set.");
}
- return m_options[option];
+ return m_options[option];
}
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/l10ntools/source/help/HelpCompiler.cxx b/main/l10ntools/source/help/HelpCompiler.cxx
index ecec06534c..a7f426b221 100644
--- a/main/l10ntools/source/help/HelpCompiler.cxx
+++ b/main/l10ntools/source/help/HelpCompiler.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,21 +7,20 @@
* 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.
- *
+ *
*************************************************************/
-
#include "HelpCompiler.hxx"
#include <limits.h>
#include <stdlib.h>
@@ -38,36 +37,36 @@
static void impl_sleep( sal_uInt32 nSec )
{
- TimeValue aTime;
- aTime.Seconds = nSec;
- aTime.Nanosec = 0;
+ TimeValue aTime;
+ aTime.Seconds = nSec;
+ aTime.Nanosec = 0;
- osl::Thread::wait( aTime );
+ osl::Thread::wait( aTime );
}
-HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile,
- const fs::path &in_src, const fs::path &in_resEmbStylesheet,
- const std::string &in_module, const std::string &in_lang, bool in_bExtensionMode)
- : streamTable(in_streamTable), inputFile(in_inputFile),
- src(in_src), module(in_module), lang(in_lang), resEmbStylesheet(in_resEmbStylesheet),
+HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile,
+ const fs::path &in_src, const fs::path &in_resEmbStylesheet,
+ const std::string &in_module, const std::string &in_lang, bool in_bExtensionMode)
+ : streamTable(in_streamTable), inputFile(in_inputFile),
+ src(in_src), module(in_module), lang(in_lang), resEmbStylesheet(in_resEmbStylesheet),
bExtensionMode( in_bExtensionMode )
{
- xmlKeepBlanksDefaultValue = 0;
+ xmlKeepBlanksDefaultValue = 0;
}
-xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
+xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
{
- static const char *params[4 + 1];
- static xsltStylesheetPtr cur = NULL;
+ static const char *params[4 + 1];
+ static xsltStylesheetPtr cur = NULL;
xmlDocPtr res;
if( bExtensionMode )
{
res = xmlParseFile(filePath.native_file_string().c_str());
- if( !res ){
- impl_sleep( 3 );
- res = xmlParseFile(filePath.native_file_string().c_str());
- }
+ if( !res ){
+ impl_sleep( 3 );
+ res = xmlParseFile(filePath.native_file_string().c_str());
+ }
}
else
{
@@ -75,7 +74,7 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
{
static std::string fsroot('\'' + src.toUTF8() + '\'');
static std::string esclang('\'' + lang + '\'');
-
+
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
cur = xsltParseStylesheetFile((const xmlChar *)resEmbStylesheet.native_file_string().c_str());
@@ -89,415 +88,415 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
}
xmlDocPtr doc = xmlParseFile(filePath.native_file_string().c_str());
if( !doc )
- {
- impl_sleep( 3 );
- doc = xmlParseFile(filePath.native_file_string().c_str());
- }
+ {
+ impl_sleep( 3 );
+ doc = xmlParseFile(filePath.native_file_string().c_str());
+ }
//???res = xmlParseFile(filePath.native_file_string().c_str());
- res = xsltApplyStylesheet(cur, doc, params);
+ res = xsltApplyStylesheet(cur, doc, params);
xmlFreeDoc(doc);
}
- return res;
+ return res;
}
HashSet HelpCompiler::switchFind(xmlDocPtr doc)
{
- HashSet hs;
- xmlChar *xpath = (xmlChar*)"//switchinline";
-
- xmlXPathContextPtr context = xmlXPathNewContext(doc);
- xmlXPathObjectPtr result = xmlXPathEvalExpression(xpath, context);
- xmlXPathFreeContext(context);
- if (result)
- {
- xmlNodeSetPtr nodeset = result->nodesetval;
- for (int i = 0; i < nodeset->nodeNr; i++)
- {
- xmlNodePtr el = nodeset->nodeTab[i];
- xmlChar *select = xmlGetProp(el, (xmlChar*)"select");
- if (select)
- {
- if (!strcmp((const char*)select, "appl"))
- {
- xmlNodePtr n1 = el->xmlChildrenNode;
- while (n1)
- {
- if ((!xmlStrcmp(n1->name, (const xmlChar*)"caseinline")))
- {
- xmlChar *appl = xmlGetProp(n1, (xmlChar*)"select");
- hs.push_back(std::string((const char*)appl));
- xmlFree(appl);
- }
- else if ((!xmlStrcmp(n1->name, (const xmlChar*)"defaultinline")))
- hs.push_back(std::string("DEFAULT"));
- n1 = n1->next;
- }
- }
- xmlFree(select);
- }
- }
- xmlXPathFreeObject(result);
- }
- hs.push_back(std::string("DEFAULT"));
- return hs;
+ HashSet hs;
+ xmlChar *xpath = (xmlChar*)"//switchinline";
+
+ xmlXPathContextPtr context = xmlXPathNewContext(doc);
+ xmlXPathObjectPtr result = xmlXPathEvalExpression(xpath, context);
+ xmlXPathFreeContext(context);
+ if (result)
+ {
+ xmlNodeSetPtr nodeset = result->nodesetval;
+ for (int i = 0; i < nodeset->nodeNr; i++)
+ {
+ xmlNodePtr el = nodeset->nodeTab[i];
+ xmlChar *select = xmlGetProp(el, (xmlChar*)"select");
+ if (select)
+ {
+ if (!strcmp((const char*)select, "appl"))
+ {
+ xmlNodePtr n1 = el->xmlChildrenNode;
+ while (n1)
+ {
+ if ((!xmlStrcmp(n1->name, (const xmlChar*)"caseinline")))
+ {
+ xmlChar *appl = xmlGetProp(n1, (xmlChar*)"select");
+ hs.push_back(std::string((const char*)appl));
+ xmlFree(appl);
+ }
+ else if ((!xmlStrcmp(n1->name, (const xmlChar*)"defaultinline")))
+ hs.push_back(std::string("DEFAULT"));
+ n1 = n1->next;
+ }
+ }
+ xmlFree(select);
+ }
+ }
+ xmlXPathFreeObject(result);
+ }
+ hs.push_back(std::string("DEFAULT"));
+ return hs;
}
// returns a node representing the whole stuff compiled for the current
// application.
xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl)
{
- xmlNodePtr parent = xmlCopyNode(node, 2);
- xmlNodePtr n = node->xmlChildrenNode;
- while (n != NULL)
- {
- bool isappl = false;
- if ( (!strcmp((const char*)n->name, "switchinline")) ||
- (!strcmp((const char*)n->name, "switch")) )
- {
- xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
- if (select)
- {
- if (!strcmp((const char*)select, "appl"))
- isappl = true;
- xmlFree(select);
- }
- }
- if (isappl)
- {
- xmlNodePtr caseNode = n->xmlChildrenNode;
- if (appl == "DEFAULT")
- {
- while (caseNode)
- {
- if (!strcmp((const char*)caseNode->name, "defaultinline"))
- {
- xmlNodePtr cnl = caseNode->xmlChildrenNode;
- while (cnl)
- {
- xmlAddChild(parent, clone(cnl, appl));
- cnl = cnl->next;
- }
- break;
- }
- caseNode = caseNode->next;
- }
- }
- else
- {
- while (caseNode)
- {
- isappl=false;
- if (!strcmp((const char*)caseNode->name, "caseinline"))
- {
- xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
- if (select)
- {
- if (!strcmp((const char*)select, appl.c_str()))
- isappl = true;
- xmlFree(select);
- }
- if (isappl)
- {
- xmlNodePtr cnl = caseNode->xmlChildrenNode;
- while (cnl)
- {
- xmlAddChild(parent, clone(cnl, appl));
- cnl = cnl->next;
- }
- break;
- }
-
- }
- caseNode = caseNode->next;
- }
- }
-
- }
- else
- xmlAddChild(parent, clone(n, appl));
-
- n = n->next;
- }
- return parent;
+ xmlNodePtr parent = xmlCopyNode(node, 2);
+ xmlNodePtr n = node->xmlChildrenNode;
+ while (n != NULL)
+ {
+ bool isappl = false;
+ if ( (!strcmp((const char*)n->name, "switchinline")) ||
+ (!strcmp((const char*)n->name, "switch")) )
+ {
+ xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
+ if (select)
+ {
+ if (!strcmp((const char*)select, "appl"))
+ isappl = true;
+ xmlFree(select);
+ }
+ }
+ if (isappl)
+ {
+ xmlNodePtr caseNode = n->xmlChildrenNode;
+ if (appl == "DEFAULT")
+ {
+ while (caseNode)
+ {
+ if (!strcmp((const char*)caseNode->name, "defaultinline"))
+ {
+ xmlNodePtr cnl = caseNode->xmlChildrenNode;
+ while (cnl)
+ {
+ xmlAddChild(parent, clone(cnl, appl));
+ cnl = cnl->next;
+ }
+ break;
+ }
+ caseNode = caseNode->next;
+ }
+ }
+ else
+ {
+ while (caseNode)
+ {
+ isappl=false;
+ if (!strcmp((const char*)caseNode->name, "caseinline"))
+ {
+ xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
+ if (select)
+ {
+ if (!strcmp((const char*)select, appl.c_str()))
+ isappl = true;
+ xmlFree(select);
+ }
+ if (isappl)
+ {
+ xmlNodePtr cnl = caseNode->xmlChildrenNode;
+ while (cnl)
+ {
+ xmlAddChild(parent, clone(cnl, appl));
+ cnl = cnl->next;
+ }
+ break;
+ }
+
+ }
+ caseNode = caseNode->next;
+ }
+ }
+
+ }
+ else
+ xmlAddChild(parent, clone(n, appl));
+
+ n = n->next;
+ }
+ return parent;
}
class myparser
{
public:
- std::string documentId;
- std::string fileName;
- std::string title;
- HashSet *hidlist;
- Hashtable *keywords;
- Stringtable *helptexts;
+ std::string documentId;
+ std::string fileName;
+ std::string title;
+ HashSet *hidlist;
+ Hashtable *keywords;
+ Stringtable *helptexts;
private:
- HashSet extendedHelpText;
+ HashSet extendedHelpText;
public:
- myparser(const std::string &indocumentId, const std::string &infileName,
- const std::string &intitle) : documentId(indocumentId), fileName(infileName),
- title(intitle)
- {
- hidlist = new HashSet;
- keywords = new Hashtable;
- helptexts = new Stringtable;
- }
- void traverse( xmlNodePtr parentNode );
+ myparser(const std::string &indocumentId, const std::string &infileName,
+ const std::string &intitle) : documentId(indocumentId), fileName(infileName),
+ title(intitle)
+ {
+ hidlist = new HashSet;
+ keywords = new Hashtable;
+ helptexts = new Stringtable;
+ }
+ void traverse( xmlNodePtr parentNode );
private:
- std::string dump(xmlNodePtr node);
+ std::string dump(xmlNodePtr node);
};
std::string myparser::dump(xmlNodePtr node)
{
- std::string app;
- if (node->xmlChildrenNode)
- {
- xmlNodePtr list = node->xmlChildrenNode;
- while (list)
- {
- app += dump(list);
- list = list->next;
- }
- }
- if (xmlNodeIsText(node))
- {
- xmlChar *pContent = xmlNodeGetContent(node);
- app += std::string((const char*)pContent);
- xmlFree(pContent);
- // std::cout << app << std::endl;
- }
- return app;
+ std::string app;
+ if (node->xmlChildrenNode)
+ {
+ xmlNodePtr list = node->xmlChildrenNode;
+ while (list)
+ {
+ app += dump(list);
+ list = list->next;
+ }
+ }
+ if (xmlNodeIsText(node))
+ {
+ xmlChar *pContent = xmlNodeGetContent(node);
+ app += std::string((const char*)pContent);
+ xmlFree(pContent);
+ // std::cout << app << std::endl;
+ }
+ return app;
}
void trim(std::string& str)
{
- std::string::size_type pos = str.find_last_not_of(' ');
- if(pos != std::string::npos)
- {
- str.erase(pos + 1);
- pos = str.find_first_not_of(' ');
- if(pos != std::string::npos)
- str.erase(0, pos);
- }
- else
- str.erase(str.begin(), str.end());
+ std::string::size_type pos = str.find_last_not_of(' ');
+ if(pos != std::string::npos)
+ {
+ str.erase(pos + 1);
+ pos = str.find_first_not_of(' ');
+ if(pos != std::string::npos)
+ str.erase(0, pos);
+ }
+ else
+ str.erase(str.begin(), str.end());
}
void myparser::traverse( xmlNodePtr parentNode )
{
- // traverse all nodes that belong to the parent
- xmlNodePtr test ;
- for (test = parentNode->xmlChildrenNode; test; test = test->next)
- {
- if (fileName.empty() && !strcmp((const char*)test->name, "filename"))
- {
- xmlNodePtr node = test->xmlChildrenNode;
- if (xmlNodeIsText(node))
- {
- xmlChar *pContent = xmlNodeGetContent(node);
- fileName = std::string((const char*)pContent);
- xmlFree(pContent);
- }
- }
- else if (title.empty() && !strcmp((const char*)test->name, "title"))
- {
- title = dump(test);
- if (title.empty())
- title = "<notitle>";
- }
- else if (!strcmp((const char*)test->name, "bookmark"))
- {
- xmlChar *branchxml = xmlGetProp(test, (const xmlChar*)"branch");
- xmlChar *idxml = xmlGetProp(test, (const xmlChar*)"id");
- std::string branch((const char*)branchxml);
- std::string anchor((const char*)idxml);
- xmlFree (branchxml);
- xmlFree (idxml);
-
- std::string hid;
-
- if (branch.find("hid") == 0)
- {
- size_t index = branch.find('/');
- if (index != std::string::npos)
- {
- hid = branch.substr(1 + index);
- // one shall serve as a documentId
- if (documentId.empty())
- documentId = hid;
- extendedHelpText.push_back(hid);
- std::string foo = anchor.empty() ? hid : hid + "#" + anchor;
- HCDBG(std::cerr << "hid pushback" << foo << std::endl);
- hidlist->push_back( anchor.empty() ? hid : hid + "#" + anchor);
- }
- else
- continue;
- }
- else if (branch.compare("index") == 0)
- {
- LinkedList ll;
-
- for (xmlNodePtr nd = test->xmlChildrenNode; nd; nd = nd->next)
- {
- if (strcmp((const char*)nd->name, "bookmark_value"))
- continue;
-
- std::string embedded;
- xmlChar *embeddedxml = xmlGetProp(nd, (const xmlChar*)"embedded");
- if (embeddedxml)
- {
- embedded = std::string((const char*)embeddedxml);
- xmlFree (embeddedxml);
- std::transform (embedded.begin(), embedded.end(),
- embedded.begin(), tolower);
- }
-
- bool isEmbedded = !embedded.empty() && embedded.compare("true") == 0;
- if (isEmbedded)
- continue;
-
- std::string keyword = dump(nd);
- size_t keywordSem = keyword.find(';');
- if (keywordSem != std::string::npos)
- {
- std::string tmppre =
- keyword.substr(0,keywordSem);
- trim(tmppre);
- std::string tmppos =
- keyword.substr(1+keywordSem);
- trim(tmppos);
- keyword = tmppre + ";" + tmppos;
- }
- ll.push_back(keyword);
- }
- if (!ll.empty())
- (*keywords)[anchor] = ll;
- }
- else if (branch.compare("contents") == 0)
- {
- // currently not used
- }
- }
- else if (!strcmp((const char*)test->name, "ahelp"))
- {
- std::string text = dump(test);
- trim(text);
- std::string name;
-
- HashSet::const_iterator aEnd = extendedHelpText.end();
- for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd;
- ++iter)
- {
- name = *iter;
- (*helptexts)[name] = text;
- }
- extendedHelpText.clear();
- }
-
- // traverse children
- traverse(test);
- }
+ // traverse all nodes that belong to the parent
+ xmlNodePtr test ;
+ for (test = parentNode->xmlChildrenNode; test; test = test->next)
+ {
+ if (fileName.empty() && !strcmp((const char*)test->name, "filename"))
+ {
+ xmlNodePtr node = test->xmlChildrenNode;
+ if (xmlNodeIsText(node))
+ {
+ xmlChar *pContent = xmlNodeGetContent(node);
+ fileName = std::string((const char*)pContent);
+ xmlFree(pContent);
+ }
+ }
+ else if (title.empty() && !strcmp((const char*)test->name, "title"))
+ {
+ title = dump(test);
+ if (title.empty())
+ title = "<notitle>";
+ }
+ else if (!strcmp((const char*)test->name, "bookmark"))
+ {
+ xmlChar *branchxml = xmlGetProp(test, (const xmlChar*)"branch");
+ xmlChar *idxml = xmlGetProp(test, (const xmlChar*)"id");
+ std::string branch((const char*)branchxml);
+ std::string anchor((const char*)idxml);
+ xmlFree (branchxml);
+ xmlFree (idxml);
+
+ std::string hid;
+
+ if (branch.find("hid") == 0)
+ {
+ size_t index = branch.find('/');
+ if (index != std::string::npos)
+ {
+ hid = branch.substr(1 + index);
+ // one shall serve as a documentId
+ if (documentId.empty())
+ documentId = hid;
+ extendedHelpText.push_back(hid);
+ std::string foo = anchor.empty() ? hid : hid + "#" + anchor;
+ HCDBG(std::cerr << "hid pushback" << foo << std::endl);
+ hidlist->push_back( anchor.empty() ? hid : hid + "#" + anchor);
+ }
+ else
+ continue;
+ }
+ else if (branch.compare("index") == 0)
+ {
+ LinkedList ll;
+
+ for (xmlNodePtr nd = test->xmlChildrenNode; nd; nd = nd->next)
+ {
+ if (strcmp((const char*)nd->name, "bookmark_value"))
+ continue;
+
+ std::string embedded;
+ xmlChar *embeddedxml = xmlGetProp(nd, (const xmlChar*)"embedded");
+ if (embeddedxml)
+ {
+ embedded = std::string((const char*)embeddedxml);
+ xmlFree (embeddedxml);
+ std::transform (embedded.begin(), embedded.end(),
+ embedded.begin(), tolower);
+ }
+
+ bool isEmbedded = !embedded.empty() && embedded.compare("true") == 0;
+ if (isEmbedded)
+ continue;
+
+ std::string keyword = dump(nd);
+ size_t keywordSem = keyword.find(';');
+ if (keywordSem != std::string::npos)
+ {
+ std::string tmppre =
+ keyword.substr(0,keywordSem);
+ trim(tmppre);
+ std::string tmppos =
+ keyword.substr(1+keywordSem);
+ trim(tmppos);
+ keyword = tmppre + ";" + tmppos;
+ }
+ ll.push_back(keyword);
+ }
+ if (!ll.empty())
+ (*keywords)[anchor] = ll;
+ }
+ else if (branch.compare("contents") == 0)
+ {
+ // currently not used
+ }
+ }
+ else if (!strcmp((const char*)test->name, "ahelp"))
+ {
+ std::string text = dump(test);
+ trim(text);
+ std::string name;
+
+ HashSet::const_iterator aEnd = extendedHelpText.end();
+ for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd;
+ ++iter)
+ {
+ name = *iter;
+ (*helptexts)[name] = text;
+ }
+ extendedHelpText.clear();
+ }
+
+ // traverse children
+ traverse(test);
+ }
}
bool HelpCompiler::compile( void ) throw( HelpProcessingException )
{
- // we now have the jaroutputstream, which will contain the document.
- // now determine the document as a dom tree in variable docResolved
-
- xmlDocPtr docResolvedOrg = getSourceDocument(inputFile);
-
- // now add path to the document
- // resolve the dom
- if (!docResolvedOrg)
- {
- impl_sleep( 3 );
- docResolvedOrg = getSourceDocument(inputFile);
- if( !docResolvedOrg )
- {
- std::stringstream aStrStream;
- aStrStream << "ERROR: file not existing: " << inputFile.native_file_string().c_str() << std::endl;
- throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
- }
- }
-
- // now find all applications for which one has to compile
- std::string documentId;
- std::string fileName;
- std::string title;
- // returns all applications for which one has to compile
- HashSet applications = switchFind(docResolvedOrg);
-
- HashSet::const_iterator aEnd = applications.end();
- for (HashSet::const_iterator aI = applications.begin(); aI != aEnd; ++aI)
- {
- std::string appl = *aI;
- std::string modulename = appl;
- if (modulename[0] == 'S')
- {
- modulename = modulename.substr(1);
- std::transform(modulename.begin(), modulename.end(), modulename.begin(), tolower);
- }
- if (modulename != "DEFAULT" && modulename != module)
- continue;
-
- // returns a clone of the document with swich-cases resolved
- xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl);
- myparser aparser(documentId, fileName, title);
- aparser.traverse(docResolved);
-
- documentId = aparser.documentId;
- fileName = aparser.fileName;
- title = aparser.title;
-
- HCDBG(std::cerr << documentId << " : " << fileName << " : " << title << std::endl);
-
- xmlDocPtr docResolvedDoc = xmlCopyDoc(docResolvedOrg, false);
- xmlDocSetRootElement(docResolvedDoc, docResolved);
-
- if (modulename == "DEFAULT")
- {
- streamTable.dropdefault();
- streamTable.default_doc = docResolvedDoc;
- streamTable.default_hidlist = aparser.hidlist;
- streamTable.default_helptexts = aparser.helptexts;
- streamTable.default_keywords = aparser.keywords;
- }
- else if (modulename == module)
- {
- streamTable.dropappl();
- streamTable.appl_doc = docResolvedDoc;
- streamTable.appl_hidlist = aparser.hidlist;
- streamTable.appl_helptexts = aparser.helptexts;
- streamTable.appl_keywords = aparser.keywords;
- }
- else
- {
+ // we now have the jaroutputstream, which will contain the document.
+ // now determine the document as a dom tree in variable docResolved
+
+ xmlDocPtr docResolvedOrg = getSourceDocument(inputFile);
+
+ // now add path to the document
+ // resolve the dom
+ if (!docResolvedOrg)
+ {
+ impl_sleep( 3 );
+ docResolvedOrg = getSourceDocument(inputFile);
+ if( !docResolvedOrg )
+ {
std::stringstream aStrStream;
- aStrStream << "ERROR: Found unexpected module name \"" << modulename
+ aStrStream << "ERROR: file not existing: " << inputFile.native_file_string().c_str() << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ }
+
+ // now find all applications for which one has to compile
+ std::string documentId;
+ std::string fileName;
+ std::string title;
+ // returns all applications for which one has to compile
+ HashSet applications = switchFind(docResolvedOrg);
+
+ HashSet::const_iterator aEnd = applications.end();
+ for (HashSet::const_iterator aI = applications.begin(); aI != aEnd; ++aI)
+ {
+ std::string appl = *aI;
+ std::string modulename = appl;
+ if (modulename[0] == 'S')
+ {
+ modulename = modulename.substr(1);
+ std::transform(modulename.begin(), modulename.end(), modulename.begin(), tolower);
+ }
+ if (modulename != "DEFAULT" && modulename != module)
+ continue;
+
+ // returns a clone of the document with switch-cases resolved
+ xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl);
+ myparser aparser(documentId, fileName, title);
+ aparser.traverse(docResolved);
+
+ documentId = aparser.documentId;
+ fileName = aparser.fileName;
+ title = aparser.title;
+
+ HCDBG(std::cerr << documentId << " : " << fileName << " : " << title << std::endl);
+
+ xmlDocPtr docResolvedDoc = xmlCopyDoc(docResolvedOrg, false);
+ xmlDocSetRootElement(docResolvedDoc, docResolved);
+
+ if (modulename == "DEFAULT")
+ {
+ streamTable.dropdefault();
+ streamTable.default_doc = docResolvedDoc;
+ streamTable.default_hidlist = aparser.hidlist;
+ streamTable.default_helptexts = aparser.helptexts;
+ streamTable.default_keywords = aparser.keywords;
+ }
+ else if (modulename == module)
+ {
+ streamTable.dropappl();
+ streamTable.appl_doc = docResolvedDoc;
+ streamTable.appl_hidlist = aparser.hidlist;
+ streamTable.appl_helptexts = aparser.helptexts;
+ streamTable.appl_keywords = aparser.keywords;
+ }
+ else
+ {
+ std::stringstream aStrStream;
+ aStrStream << "ERROR: Found unexpected module name \"" << modulename
<< "\" in file" << src.native_file_string().c_str() << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
- }
-
- } // end iteration over all applications
-
- streamTable.document_id = documentId;
- streamTable.document_path = fileName;
- streamTable.document_title = title;
- std::string actMod = module;
- if ( !bExtensionMode && !fileName.empty())
- {
- if (fileName.find("/text/") == 0)
- {
- int len = strlen("/text/");
- actMod = fileName.substr(len);
- actMod = actMod.substr(0, actMod.find('/'));
- }
- }
- streamTable.document_module = actMod;
-
- xmlFreeDoc(docResolvedOrg);
- return true;
+ }
+
+ } // end iteration over all applications
+
+ streamTable.document_id = documentId;
+ streamTable.document_path = fileName;
+ streamTable.document_title = title;
+ std::string actMod = module;
+ if ( !bExtensionMode && !fileName.empty())
+ {
+ if (fileName.find("/text/") == 0)
+ {
+ int len = strlen("/text/");
+ actMod = fileName.substr(len);
+ actMod = actMod.substr(0, actMod.find('/'));
+ }
+ }
+ streamTable.document_module = actMod;
+
+ xmlFreeDoc(docResolvedOrg);
+ return true;
}
namespace fs
@@ -514,73 +513,73 @@ namespace fs
return nThreadTextEncoding;
}
- void create_directory(const fs::path indexDirName)
- {
- HCDBG(
- std::cerr << "creating " <<
- rtl::OUStringToOString(indexDirName.data, RTL_TEXTENCODING_UTF8).getStr()
- << std::endl
- );
- osl::Directory::createPath(indexDirName.data);
- }
-
- void rename(const fs::path &src, const fs::path &dest)
- {
- osl::File::move(src.data, dest.data);
- }
-
- void copy(const fs::path &src, const fs::path &dest)
- {
- osl::File::copy(src.data, dest.data);
- }
-
- bool exists(const fs::path &in)
- {
- osl::File tmp(in.data);
- return (tmp.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None);
- }
-
- void remove(const fs::path &in)
- {
- osl::File::remove(in.data);
- }
-
- void removeRecursive(rtl::OUString const& _suDirURL)
- {
- {
- osl::Directory aDir(_suDirURL);
- aDir.open();
- if (aDir.isOpen())
- {
- osl::DirectoryItem aItem;
- osl::FileStatus aStatus(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes);
- while (aDir.getNextItem(aItem) == ::osl::FileBase::E_None)
- {
- if (osl::FileBase::E_None == aItem.getFileStatus(aStatus) &&
- aStatus.isValid(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes))
- {
- rtl::OUString suFilename = aStatus.getFileName();
- rtl::OUString suFullFileURL;
- suFullFileURL += _suDirURL;
- suFullFileURL += rtl::OUString::createFromAscii("/");
- suFullFileURL += suFilename;
-
- if (aStatus.getFileType() == osl::FileStatus::Directory)
- removeRecursive(suFullFileURL);
- else
- osl::File::remove(suFullFileURL);
- }
- }
- aDir.close();
- }
- }
- osl::Directory::remove(_suDirURL);
- }
-
- void remove_all(const fs::path &in)
- {
- removeRecursive(in.data);
- }
+ void create_directory(const fs::path indexDirName)
+ {
+ HCDBG(
+ std::cerr << "creating " <<
+ rtl::OUStringToOString(indexDirName.data, RTL_TEXTENCODING_UTF8).getStr()
+ << std::endl
+ );
+ osl::Directory::createPath(indexDirName.data);
+ }
+
+ void rename(const fs::path &src, const fs::path &dest)
+ {
+ osl::File::move(src.data, dest.data);
+ }
+
+ void copy(const fs::path &src, const fs::path &dest)
+ {
+ osl::File::copy(src.data, dest.data);
+ }
+
+ bool exists(const fs::path &in)
+ {
+ osl::File tmp(in.data);
+ return (tmp.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None);
+ }
+
+ void remove(const fs::path &in)
+ {
+ osl::File::remove(in.data);
+ }
+
+ void removeRecursive(rtl::OUString const& _suDirURL)
+ {
+ {
+ osl::Directory aDir(_suDirURL);
+ aDir.open();
+ if (aDir.isOpen())
+ {
+ osl::DirectoryItem aItem;
+ osl::FileStatus aStatus(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes);
+ while (aDir.getNextItem(aItem) == ::osl::FileBase::E_None)
+ {
+ if (osl::FileBase::E_None == aItem.getFileStatus(aStatus) &&
+ aStatus.isValid(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes))
+ {
+ rtl::OUString suFilename = aStatus.getFileName();
+ rtl::OUString suFullFileURL;
+ suFullFileURL += _suDirURL;
+ suFullFileURL += rtl::OUString::createFromAscii("/");
+ suFullFileURL += suFilename;
+
+ if (aStatus.getFileType() == osl::FileStatus::Directory)
+ removeRecursive(suFullFileURL);
+ else
+ osl::File::remove(suFullFileURL);
+ }
+ }
+ aDir.close();
+ }
+ }
+ osl::Directory::remove(_suDirURL);
+ }
+
+ void remove_all(const fs::path &in)
+ {
+ removeRecursive(in.data);
+ }
}
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/l10ntools/source/help/HelpCompiler.hxx b/main/l10ntools/source/help/HelpCompiler.hxx
index dcd76854cc..7e473bb183 100644
--- a/main/l10ntools/source/help/HelpCompiler.hxx
+++ b/main/l10ntools/source/help/HelpCompiler.hxx
@@ -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.
- *
+ *
*************************************************************/
@@ -53,162 +53,162 @@
#define EMULATEORIGINAL 1
#ifdef CMCDEBUG
- #define HCDBG(foo) do { if (1) foo; } while(0)
+ #define HCDBG(foo) do { if (1) foo; } while(0)
#else
- #define HCDBG(foo) do { if (0) foo; } while(0)
+ #define HCDBG(foo) do { if (0) foo; } while(0)
#endif
namespace fs
{
rtl_TextEncoding getThreadTextEncoding( void );
- enum convert { native };
- class path
- {
- public:
- ::rtl::OUString data;
- public:
- path() {}
- path(const path &rOther) : data(rOther.data) {}
- path(const std::string &in, convert)
- {
- rtl::OUString sWorkingDir;
- osl_getProcessWorkingDir(&sWorkingDir.pData);
-
- rtl::OString tmp(in.c_str());
- rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
- osl::File::getFileURLFromSystemPath(ustrSystemPath, data);
- osl::File::getAbsoluteFileURL(sWorkingDir, data, data);
- }
- path(const std::string &FileURL)
+ enum convert { native };
+ class path
+ {
+ public:
+ ::rtl::OUString data;
+ public:
+ path() {}
+ path(const path &rOther) : data(rOther.data) {}
+ path(const std::string &in, convert)
{
- rtl::OString tmp(FileURL.c_str());
- data = rtl::OStringToOUString(tmp, getThreadTextEncoding());
+ rtl::OUString sWorkingDir;
+ osl_getProcessWorkingDir(&sWorkingDir.pData);
+
+ rtl::OString tmp(in.c_str());
+ rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
+ osl::File::getFileURLFromSystemPath(ustrSystemPath, data);
+ osl::File::getAbsoluteFileURL(sWorkingDir, data, data);
+ }
+ path(const std::string &FileURL)
+ {
+ rtl::OString tmp(FileURL.c_str());
+ data = rtl::OStringToOUString(tmp, getThreadTextEncoding());
+ }
+ std::string native_file_string() const
+ {
+ ::rtl::OUString ustrSystemPath;
+ osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
+ rtl::OString tmp(rtl::OUStringToOString(ustrSystemPath, getThreadTextEncoding()));
+ HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl);
+ return std::string(tmp.getStr());
}
- std::string native_file_string() const
- {
- ::rtl::OUString ustrSystemPath;
- osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
- rtl::OString tmp(rtl::OUStringToOString(ustrSystemPath, getThreadTextEncoding()));
- HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl);
- return std::string(tmp.getStr());
- }
#ifdef WNT
- wchar_t const * native_file_string_w() const
- {
- ::rtl::OUString ustrSystemPath;
- osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
- return reinterpret_cast< wchar_t const * >(ustrSystemPath.getStr());
- }
+ wchar_t const * native_file_string_w() const
+ {
+ ::rtl::OUString ustrSystemPath;
+ osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
+ return reinterpret_cast< wchar_t const * >(ustrSystemPath.getStr());
+ }
#endif
- std::string native_directory_string() const { return native_file_string(); }
- std::string toUTF8() const
- {
- rtl::OString tmp(rtl::OUStringToOString(data, RTL_TEXTENCODING_UTF8));
- return std::string(tmp.getStr());
- }
- bool empty() const { return data.getLength() == 0; }
- path operator/(const std::string &in) const
- {
- path ret(*this);
- HCDBG(std::cerr << "orig was " <<
- rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
- rtl::OString tmp(in.c_str());
- rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
- ret.data += rtl::OUString(sal_Unicode('/'));
- ret.data += ustrSystemPath;
- HCDBG(std::cerr << "final is " <<
- rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
- return ret;
- }
- void append(const char *in)
- {
- rtl::OString tmp(in);
- rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
- data = data + ustrSystemPath;
- }
- void append(const std::string &in) { append(in.c_str()); }
- };
-
- void create_directory(const fs::path indexDirName);
- void rename(const fs::path &src, const fs::path &dest);
- void copy(const fs::path &src, const fs::path &dest);
- bool exists(const fs::path &in);
- void remove_all(const fs::path &in);
- void remove(const fs::path &in);
+ std::string native_directory_string() const { return native_file_string(); }
+ std::string toUTF8() const
+ {
+ rtl::OString tmp(rtl::OUStringToOString(data, RTL_TEXTENCODING_UTF8));
+ return std::string(tmp.getStr());
+ }
+ bool empty() const { return data.getLength() == 0; }
+ path operator/(const std::string &in) const
+ {
+ path ret(*this);
+ HCDBG(std::cerr << "orig was " <<
+ rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
+ rtl::OString tmp(in.c_str());
+ rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
+ ret.data += rtl::OUString(sal_Unicode('/'));
+ ret.data += ustrSystemPath;
+ HCDBG(std::cerr << "final is " <<
+ rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
+ return ret;
+ }
+ void append(const char *in)
+ {
+ rtl::OString tmp(in);
+ rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding()));
+ data = data + ustrSystemPath;
+ }
+ void append(const std::string &in) { append(in.c_str()); }
+ };
+
+ void create_directory(const fs::path indexDirName);
+ void rename(const fs::path &src, const fs::path &dest);
+ void copy(const fs::path &src, const fs::path &dest);
+ bool exists(const fs::path &in);
+ void remove_all(const fs::path &in);
+ void remove(const fs::path &in);
}
struct joaat_hash
{
- size_t operator()(const std::string &str) const
- {
- size_t hash = 0;
- const char *key = str.data();
- for (size_t i = 0; i < str.size(); i++)
- {
- hash += key[i];
- hash += (hash << 10);
- hash ^= (hash >> 6);
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
- return hash;
- }
+ size_t operator()(const std::string &str) const
+ {
+ size_t hash = 0;
+ const char *key = str.data();
+ for (size_t i = 0; i < str.size(); i++)
+ {
+ hash += key[i];
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ }
+ hash += (hash << 3);
+ hash ^= (hash >> 11);
+ hash += (hash << 15);
+ return hash;
+ }
};
#define get16bits(d) ((((sal_uInt32)(((const sal_uInt8 *)(d))[1])) << 8)\
- +(sal_uInt32)(((const sal_uInt8 *)(d))[0]) )
+ +(sal_uInt32)(((const sal_uInt8 *)(d))[0]) )
struct SuperFastHash
{
- size_t operator()(const std::string &str) const
- {
- const char * data = str.data();
- int len = str.size();
- size_t hash = len, tmp;
- if (len <= 0 || data == NULL) return 0;
-
- int rem = len & 3;
- len >>= 2;
-
- /* Main loop */
- for (;len > 0; len--)
- {
- hash += get16bits (data);
- tmp = (get16bits (data+2) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2*sizeof (sal_uInt16);
- hash += hash >> 11;
- }
-
- /* Handle end cases */
- switch (rem)
- {
- case 3: hash += get16bits (data);
- hash ^= hash << 16;
- hash ^= data[sizeof (sal_uInt16)] << 18;
- hash += hash >> 11;
- break;
- case 2: hash += get16bits (data);
- hash ^= hash << 11;
- hash += hash >> 17;
- break;
- case 1: hash += *data;
- hash ^= hash << 10;
- hash += hash >> 1;
- }
-
- /* Force "avalanching" of final 127 bits */
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 4;
- hash += hash >> 17;
- hash ^= hash << 25;
- hash += hash >> 6;
-
- return hash;
- }
+ size_t operator()(const std::string &str) const
+ {
+ const char * data = str.data();
+ int len = str.size();
+ size_t hash = len, tmp;
+ if (len <= 0 || data == NULL) return 0;
+
+ int rem = len & 3;
+ len >>= 2;
+
+ /* Main loop */
+ for (;len > 0; len--)
+ {
+ hash += get16bits (data);
+ tmp = (get16bits (data+2) << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ data += 2*sizeof (sal_uInt16);
+ hash += hash >> 11;
+ }
+
+ /* Handle end cases */
+ switch (rem)
+ {
+ case 3: hash += get16bits (data);
+ hash ^= hash << 16;
+ hash ^= data[sizeof (sal_uInt16)] << 18;
+ hash += hash >> 11;
+ break;
+ case 2: hash += get16bits (data);
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ break;
+ case 1: hash += *data;
+ hash ^= hash << 10;
+ hash += hash >> 1;
+ }
+
+ /* Force "avalanching" of final 127 bits */
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 4;
+ hash += hash >> 17;
+ hash ^= hash << 25;
+ hash += hash >> 6;
+
+ return hash;
+ }
};
#define pref_hash joaat_hash
@@ -222,44 +222,44 @@ typedef std::hash_map<std::string, LinkedList, pref_hash> Hashtable;
class StreamTable
{
public:
- std::string document_id;
- std::string document_path;
- std::string document_module;
- std::string document_title;
-
- HashSet *appl_hidlist;
- Hashtable *appl_keywords;
- Stringtable *appl_helptexts;
- xmlDocPtr appl_doc;
-
- HashSet *default_hidlist;
- Hashtable *default_keywords;
- Stringtable *default_helptexts;
- xmlDocPtr default_doc;
-
- StreamTable() :
- appl_hidlist(NULL), appl_keywords(NULL), appl_helptexts(NULL), appl_doc(NULL),
- default_hidlist(NULL), default_keywords(NULL), default_helptexts(NULL), default_doc(NULL)
- {}
- void dropdefault()
- {
- delete default_hidlist;
- delete default_keywords;
- delete default_helptexts;
- if (default_doc) xmlFreeDoc(default_doc);
- }
- void dropappl()
- {
- delete appl_hidlist;
- delete appl_keywords;
- delete appl_helptexts;
- if (appl_doc) xmlFreeDoc(appl_doc);
- }
- ~StreamTable()
- {
- dropappl();
- dropdefault();
- }
+ std::string document_id;
+ std::string document_path;
+ std::string document_module;
+ std::string document_title;
+
+ HashSet *appl_hidlist;
+ Hashtable *appl_keywords;
+ Stringtable *appl_helptexts;
+ xmlDocPtr appl_doc;
+
+ HashSet *default_hidlist;
+ Hashtable *default_keywords;
+ Stringtable *default_helptexts;
+ xmlDocPtr default_doc;
+
+ StreamTable() :
+ appl_hidlist(NULL), appl_keywords(NULL), appl_helptexts(NULL), appl_doc(NULL),
+ default_hidlist(NULL), default_keywords(NULL), default_helptexts(NULL), default_doc(NULL)
+ {}
+ void dropdefault()
+ {
+ delete default_hidlist;
+ delete default_keywords;
+ delete default_helptexts;
+ if (default_doc) xmlFreeDoc(default_doc);
+ }
+ void dropappl()
+ {
+ delete appl_hidlist;
+ delete appl_keywords;
+ delete appl_helptexts;
+ if (appl_doc) xmlFreeDoc(appl_doc);
+ }
+ ~StreamTable()
+ {
+ dropappl();
+ dropdefault();
+ }
};
struct HelpProcessingException
@@ -283,34 +283,34 @@ struct HelpProcessingException
class HelpCompiler
{
-public:
- HelpCompiler(StreamTable &streamTable,
- const fs::path &in_inputFile,
- const fs::path &in_src,
- const fs::path &in_resEmbStylesheet,
- const std::string &in_module,
- const std::string &in_lang,
+public:
+ HelpCompiler(StreamTable &streamTable,
+ const fs::path &in_inputFile,
+ const fs::path &in_src,
+ const fs::path &in_resEmbStylesheet,
+ const std::string &in_module,
+ const std::string &in_lang,
bool in_bExtensionMode);
- bool compile( void ) throw (HelpProcessingException);
- void addEntryToJarFile(const std::string &prefix,
- const std::string &entryName, const std::string &bytesToAdd);
- void addEntryToJarFile(const std::string &prefix,
- const std::string &entryName, const HashSet &bytesToAdd);
- void addEntryToJarFile(const std::string &prefix,
- const std::string &entryName, const Stringtable &bytesToAdd);
- void addEntryToJarFile(const std::string &prefix,
- const std::string &entryName, const Hashtable &bytesToAdd);
+ bool compile( void ) throw (HelpProcessingException);
+ void addEntryToJarFile(const std::string &prefix,
+ const std::string &entryName, const std::string &bytesToAdd);
+ void addEntryToJarFile(const std::string &prefix,
+ const std::string &entryName, const HashSet &bytesToAdd);
+ void addEntryToJarFile(const std::string &prefix,
+ const std::string &entryName, const Stringtable &bytesToAdd);
+ void addEntryToJarFile(const std::string &prefix,
+ const std::string &entryName, const Hashtable &bytesToAdd);
private:
- xmlDocPtr getSourceDocument(const fs::path &filePath);
- HashSet switchFind(xmlDocPtr doc);
- xmlNodePtr clone(xmlNodePtr node, const std::string& appl);
- StreamTable &streamTable;
- const fs::path inputFile, src;
- const std::string module, lang;
- const fs::path resEmbStylesheet;
+ xmlDocPtr getSourceDocument(const fs::path &filePath);
+ HashSet switchFind(xmlDocPtr doc);
+ xmlNodePtr clone(xmlNodePtr node, const std::string& appl);
+ StreamTable &streamTable;
+ const fs::path inputFile, src;
+ const std::string module, lang;
+ const fs::path resEmbStylesheet;
bool bExtensionMode;
};
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/svtools/inc/svtools/svparser.hxx b/main/svtools/inc/svtools/svparser.hxx
index ddf7a23545..a9fcddc99b 100644
--- a/main/svtools/inc/svtools/svparser.hxx
+++ b/main/svtools/inc/svtools/svparser.hxx
@@ -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,22 +7,20 @@
* 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.
- *
+ *
*************************************************************/
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
#ifndef _SVPARSER_HXX
#define _SVPARSER_HXX
@@ -53,34 +51,34 @@ class SVT_DLLPUBLIC SvParser : public SvRefBase
protected:
SvStream& rInput;
- String aToken; // gescanntes Token
- sal_uLong nlLineNr; // akt. Zeilen Nummer
- sal_uLong nlLinePos; // akt. Spalten Nummer
+ String aToken; // gescanntes Token
+ sal_uLong nlLineNr; // akt. Zeilen Nummer
+ sal_uLong nlLinePos; // akt. Spalten Nummer
SvParser_Impl *pImplData; // interne Daten
- long nTokenValue; // zusaetzlicher Wert (RTF)
- sal_Bool bTokenHasValue; // indicates whether nTokenValue is valid
+ long nTokenValue; // zusaetzlicher Wert (RTF)
+ sal_Bool bTokenHasValue; // indicates whether nTokenValue is valid
SvParserState eState; // Status auch in abgl. Klassen
rtl_TextEncoding eSrcEnc; // Source encoding
- sal_uLong nNextChPos;
- sal_Unicode nNextCh; // Akt. Zeichen fuer die "lex"
+ sal_uLong nNextChPos;
+ sal_Unicode nNextCh; // Akt. Zeichen fuer die "lex"
sal_Bool bDownloadingFile : 1;// sal_True: Es wird gerade ein externes
// File geladen. d.h. alle
// DataAvailable Links muessen
// ignoriert werden.
- // Wenn keibes der folgenden
+ // Wenn keines der folgenden
// Flags gesetzt ist, wird der
// Stream als ANSI gelesen,
// aber als CharSet DONTKNOW
// zurueckgegeben.
- sal_Bool bUCS2BSrcEnc : 1; // oder als big-endian UCS2
- sal_Bool bSwitchToUCS2 : 1; // Umschalten des ist erlaubt
+ sal_Bool bUCS2BSrcEnc : 1; // oder als big-endian UCS2
+ sal_Bool bSwitchToUCS2 : 1; // Umschalten ist erlaubt
- sal_Bool bRTF_InTextRead : 1; // only for RTF-Parser!!!
+ sal_Bool bRTF_InTextRead : 1; // only for RTF-Parser!!!
struct TokenStackType
{
@@ -133,7 +131,7 @@ public:
inline sal_uLong SetLinePos( sal_uLong nlPos ); // inline unten
sal_Unicode GetNextChar();
- void RereadLookahead();
+ void RereadLookahead();
inline int IsParserWorking() const { return SVPAR_WORKING == eState; }
@@ -201,9 +199,7 @@ inline sal_uInt16 SvParser::GetCharSize() const
/*========================================================================
- *
* SvKeyValue.
- *
*======================================================================*/
SV_DECL_REF(SvKeyValueIterator)
@@ -248,34 +244,32 @@ public:
};
/*========================================================================
- *
* SvKeyValueIterator.
- *
*======================================================================*/
class SvKeyValueList_Impl;
class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase,
- private boost::noncopyable
+ private boost::noncopyable
{
- /** Representation.
- */
- SvKeyValueList_Impl* m_pList;
- sal_uInt16 m_nPos;
+ /** Representation.
+ */
+ SvKeyValueList_Impl* m_pList;
+ sal_uInt16 m_nPos;
public:
- /** Construction/Destruction.
- */
- SvKeyValueIterator (void);
- virtual ~SvKeyValueIterator (void);
-
- /** Operation.
- */
- virtual sal_Bool GetFirst (SvKeyValue &rKeyVal);
- virtual sal_Bool GetNext (SvKeyValue &rKeyVal);
- virtual void Append (const SvKeyValue &rKeyVal);
+ /** Construction/Destruction.
+ */
+ SvKeyValueIterator (void);
+ virtual ~SvKeyValueIterator (void);
+
+ /** Operation.
+ */
+ virtual sal_Bool GetFirst (SvKeyValue &rKeyVal);
+ virtual sal_Bool GetNext (SvKeyValue &rKeyVal);
+ virtual void Append (const SvKeyValue &rKeyVal);
};
SV_IMPL_REF(SvKeyValueIterator);
#endif //_SVPARSER_HXX
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/svtools/source/svrtf/parrtf.cxx b/main/svtools/source/svrtf/parrtf.cxx
index 065637168b..fd610f21e7 100644
--- a/main/svtools/source/svrtf/parrtf.cxx
+++ b/main/svtools/source/svrtf/parrtf.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.
- *
+ *
*************************************************************/
@@ -24,9 +24,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
-#include <stdio.h> // for EOF
+#include <stdio.h> // for EOF
#include <rtl/tencinfo.h>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
@@ -42,10 +40,10 @@ const int MAX_TOKEN_LEN = 128;
SvRTFParser::SvRTFParser( SvStream& rIn, sal_uInt8 nStackSize )
: SvParser( rIn, nStackSize ),
- eUNICodeSet( RTL_TEXTENCODING_MS_1252 ), // default ist ANSI-CodeSet
+ eUNICodeSet( RTL_TEXTENCODING_MS_1252 ), // default is ANSI code set
nUCharOverread( 1 )
{
- // default ist ANSI-CodeSet
+ // default is ANSI code set
SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
bRTF_InTextRead = false;
}
@@ -90,7 +88,7 @@ int SvRTFParser::_GetNextToken()
case ':': // subentry in an index entry
nRet = RTF_SUBENTRYINDEX;
break;
- case '|': // formula-charakter
+ case '|': // formula-character
nRet = RTF_FORMULA;
break;
@@ -113,7 +111,7 @@ int SvRTFParser::_GetNextToken()
if( MAX_TOKEN_LEN == nStrLen )
{
aToken += aStrBuffer;
- aToken.GetBufferAccess(); // make unique string!
+ aToken.GetBufferAccess(); // make unique string!
nStrLen = 0;
}
nNextCh = GetNextChar();
@@ -146,12 +144,12 @@ int SvRTFParser::_GetNextToken()
nTokenValue = -nTokenValue;
bTokenHasValue=true;
}
- else if( bNegValue ) // das Minus wieder zurueck
+ else if( bNegValue ) // das Minus wieder zurueck
{
nNextCh = '-';
rInput.SeekRel( -1 );
}
- if( ' ' == nNextCh ) // Blank gehoert zum Token!
+ if( ' ' == nNextCh ) // Blank gehoert zum Token!
nNextCh = GetNextChar();
// suche das Token in der Tabelle:
@@ -168,7 +166,7 @@ int SvRTFParser::_GetNextToken()
{
nUCharOverread = (sal_uInt8)nTokenValue;
#if 1
- //cmc: other ifdef breaks #i3584
+ // cmc: other ifdef breaks #i3584
aParserStates.top().
nUCharOverread = nUCharOverread;
#else
@@ -187,11 +185,11 @@ int SvRTFParser::_GetNextToken()
case RTF_UPR:
if (!_inSkipGroup) {
// UPR - overread the group with the ansi
- // informations
+ // information
while( '{' != _GetNextToken() )
;
SkipGroup();
- _GetNextToken(); // overread the last bracket
+ _GetNextToken(); // overread the last bracket
nRet = 0;
}
break;
@@ -245,12 +243,12 @@ int SvRTFParser::_GetNextToken()
if( 0 <= nOpenBrakets )
{
RtfParserState_Impl aState( nUCharOverread, GetSrcEncoding() );
- aParserStates.push( aState );
+ aParserStates.push( aState );
}
++nOpenBrakets;
- DBG_ASSERT(
- static_cast<size_t>(nOpenBrakets) == aParserStates.size(),
- "ParserStateStack unequal to bracket count" );
+ DBG_ASSERT(
+ static_cast<size_t>(nOpenBrakets) == aParserStates.size(),
+ "ParserStateStack unequal to bracket count" );
nRet = nNextCh;
}
break;
@@ -259,7 +257,7 @@ int SvRTFParser::_GetNextToken()
--nOpenBrakets;
if( 0 <= nOpenBrakets )
{
- aParserStates.pop();
+ aParserStates.pop();
if( !aParserStates.empty() )
{
const RtfParserState_Impl& rRPS =
@@ -273,9 +271,9 @@ int SvRTFParser::_GetNextToken()
SetSrcEncoding( GetCodeSet() );
}
}
- DBG_ASSERT(
- static_cast<size_t>(nOpenBrakets) == aParserStates.size(),
- "ParserStateStack unequal to bracket count" );
+ DBG_ASSERT(
+ static_cast<size_t>(nOpenBrakets) == aParserStates.size(),
+ "ParserStateStack unequal to bracket count" );
nRet = nNextCh;
break;
@@ -336,20 +334,20 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
{
#if 0
- // #i35653 patch from cmc
- ByteString aByteString(static_cast<char>(GetHexValue()));
- if (aByteString.Len())
- aStrBuffer.Append(String(aByteString, GetSrcEncoding()));
+ // #i35653 patch from cmc
+ ByteString aByteString(static_cast<char>(GetHexValue()));
+ if (aByteString.Len())
+ aStrBuffer.Append(String(aByteString, GetSrcEncoding()));
#else
- ByteString aByteString;
- while (1)
- {
- aByteString.Append((char)GetHexValue());
-
- bool bBreak = false;
- sal_Char nSlash = '\\';
- while (!bBreak)
- {
+ ByteString aByteString;
+ while (1)
+ {
+ aByteString.Append((char)GetHexValue());
+
+ bool bBreak = false;
+ sal_Char nSlash = '\\';
+ while (!bBreak)
+ {
wchar_t __next=GetNextChar();
if (__next>0xFF) // fix for #i43933# and #i35653#
{
@@ -360,39 +358,39 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
aByteString.Erase();
continue;
}
- nSlash = (sal_Char)__next;
- while (nSlash == 0xD || nSlash == 0xA)
- nSlash = (sal_Char)GetNextChar();
-
- switch (nSlash)
- {
- case '{':
- case '}':
- case '\\':
- bBreak = true;
- break;
- default:
- aByteString.Append(nSlash);
- break;
- }
- }
-
- nNextCh = GetNextChar();
-
- if (nSlash != '\\' || nNextCh != '\'')
- {
- rInput.SeekRel(-1);
- nNextCh = nSlash;
- break;
- }
- }
-
- bNextCh = false;
-
- if (aByteString.Len())
- aStrBuffer.Append(String(aByteString, GetSrcEncoding()));
+ nSlash = (sal_Char)__next;
+ while (nSlash == 0xD || nSlash == 0xA)
+ nSlash = (sal_Char)GetNextChar();
+
+ switch (nSlash)
+ {
+ case '{':
+ case '}':
+ case '\\':
+ bBreak = true;
+ break;
+ default:
+ aByteString.Append(nSlash);
+ break;
+ }
+ }
+
+ nNextCh = GetNextChar();
+
+ if (nSlash != '\\' || nNextCh != '\'')
+ {
+ rInput.SeekRel(-1);
+ nNextCh = nSlash;
+ break;
+ }
+ }
+
+ bNextCh = false;
+
+ if (aByteString.Len())
+ aStrBuffer.Append(String(aByteString, GetSrcEncoding()));
#endif
- }
+ }
break;
case '\\':
case '}':
@@ -422,14 +420,14 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
String sSave( aToken );
nNextCh = '\\';
- #ifdef DBG_UTIL
+ #ifdef DBG_UTIL
int nToken =
- #endif
- _GetNextToken();
+ #endif
+ _GetNextToken();
DBG_ASSERT( RTF_U == nToken, "doch kein UNI-Code Zeichen" );
// dont convert symbol chars
aStrBuffer.Append(
- static_cast< sal_Unicode >(nTokenValue));
+ static_cast< sal_Unicode >(nTokenValue));
// overread the next n "RTF" characters. This
// can be also \{, \}, \'88
@@ -454,7 +452,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
else
{
nNextCh = '\\';
- bWeiter = false; // Abbrechen, String zusammen
+ bWeiter = false; // Abbrechen, String zusammen
}
}
break;
@@ -462,7 +460,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
default:
rInput.SeekRel( -1 );
nNextCh = '\\';
- bWeiter = false; // Abbrechen, String zusammen
+ bWeiter = false; // Abbrechen, String zusammen
break;
}
}
@@ -491,15 +489,15 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
if (sal_Unicode(EOF) == (nNextCh = GetNextChar()))
{
- if (aStrBuffer.Len())
- aToken += aStrBuffer;
+ if (aStrBuffer.Len())
+ aToken += aStrBuffer;
return;
}
} while
- (
- (RTF_ISALPHA(nNextCh) || RTF_ISDIGIT(nNextCh)) &&
- (aStrBuffer.Len() < MAX_STRING_LEN)
- );
+ (
+ (RTF_ISALPHA(nNextCh) || RTF_ISDIGIT(nNextCh)) &&
+ (aStrBuffer.Len() < MAX_STRING_LEN)
+ );
bNextCh = false;
}
}
@@ -518,36 +516,36 @@ short SvRTFParser::_inSkipGroup=0;
void SvRTFParser::SkipGroup()
{
short nBrackets=1;
-if (_inSkipGroup>0)
+if (_inSkipGroup>0)
return;
_inSkipGroup++;
-#if 1 //#i16185# fecking \bin keyword
- do
- {
- switch (nNextCh)
- {
- case '{':
- ++nBrackets;
- break;
- case '}':
+#if 1 // #i16185# fecking \bin keyword
+ do
+ {
+ switch (nNextCh)
+ {
+ case '{':
+ ++nBrackets;
+ break;
+ case '}':
if (!--nBrackets) {
_inSkipGroup--;
- return;
+ return;
}
- break;
- }
- int nToken = _GetNextToken();
- if (nToken == RTF_BIN)
- {
- rInput.SeekRel(-1);
- rInput.SeekRel(nTokenValue);
- nNextCh = GetNextChar();
- }
+ break;
+ }
+ int nToken = _GetNextToken();
+ if (nToken == RTF_BIN)
+ {
+ rInput.SeekRel(-1);
+ rInput.SeekRel(nTokenValue);
+ nNextCh = GetNextChar();
+ }
while (nNextCh==0xa || nNextCh==0xd)
{
nNextCh = GetNextChar();
}
- } while (sal_Unicode(EOF) != nNextCh && IsParserWorking());
+ } while (sal_Unicode(EOF) != nNextCh && IsParserWorking());
#else
sal_Unicode cPrev = 0;
do {
@@ -586,7 +584,7 @@ void SvRTFParser::ReadOLEData() { SkipGroup(); }
SvParserState SvRTFParser::CallParser()
{
sal_Char cFirstCh;
- nNextChPos = rInput.Tell();
+ nNextChPos = rInput.Tell();
rInput >> cFirstCh; nNextCh = cFirstCh;
eState = SVPAR_WORKING;
nOpenBrakets = 0;
@@ -648,21 +646,21 @@ void SvRTFParser::Continue( int nToken )
case RTF_UNKNOWNCONTROL:
break; // unbekannte Token ueberspringen
case RTF_NEXTTYPE:
- case RTF_ANSITYPE:
- SetEncoding( eCodeSet = RTL_TEXTENCODING_MS_1252 );
- break;
- case RTF_MACTYPE:
- SetEncoding( eCodeSet = RTL_TEXTENCODING_APPLE_ROMAN );
- break;
- case RTF_PCTYPE:
- SetEncoding( eCodeSet = RTL_TEXTENCODING_IBM_437 );
- break;
- case RTF_PCATYPE:
- SetEncoding( eCodeSet = RTL_TEXTENCODING_IBM_850 );
- break;
+ case RTF_ANSITYPE:
+ SetEncoding( eCodeSet = RTL_TEXTENCODING_MS_1252 );
+ break;
+ case RTF_MACTYPE:
+ SetEncoding( eCodeSet = RTL_TEXTENCODING_APPLE_ROMAN );
+ break;
+ case RTF_PCTYPE:
+ SetEncoding( eCodeSet = RTL_TEXTENCODING_IBM_437 );
+ break;
+ case RTF_PCATYPE:
+ SetEncoding( eCodeSet = RTL_TEXTENCODING_IBM_850 );
+ break;
case RTF_ANSICPG:
- eCodeSet = rtl_getTextEncodingFromWindowsCodePage(nTokenValue);
- SetEncoding(eCodeSet);
+ eCodeSet = rtl_getTextEncodingFromWindowsCodePage(nTokenValue);
+ SetEncoding(eCodeSet);
break;
default:
NEXTTOKEN:
@@ -700,4 +698,4 @@ void SvRTFParser::RestoreState()
}
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/sw/source/filter/ascii/parasc.cxx b/main/sw/source/filter/ascii/parasc.cxx
index 94493c5614..7049927cc5 100644
--- a/main/sw/source/filter/ascii/parasc.cxx
+++ b/main/sw/source/filter/ascii/parasc.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,24 +7,22 @@
* 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.
- *
+ *
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
#include <tools/stream.hxx>
#include <hintids.hxx>
@@ -45,9 +43,9 @@
#include <breakit.hxx>
#include <swerror.h>
#ifndef _STATSTR_HRC
-#include <statstr.hrc> // ResId fuer Statusleiste
+#include <statstr.hrc> // ResId fuer Statusleiste
#endif
-#include <mdiexp.hxx> // ...Percent()
+#include <mdiexp.hxx> // ...Percent()
#include <poolfmt.hxx>
#include "vcl/metric.hxx"
@@ -104,7 +102,7 @@ sal_uLong AsciiReader::Read( SwDoc &rDoc, const String&, SwPaM &rPam, const Stri
}
SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc, const SwAsciiOptions& rOpts)
+ int bReadNewDoc, const SwAsciiOptions& rOpts)
: pDoc(pD), rInput(rIn), rOpt(rOpts), nScript(0), bNewDoc(bReadNewDoc)
{
pPam = new SwPaM( *rCrsr.GetPoint() );
@@ -128,10 +126,10 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
if( rOpt.GetFontName().Len() )
{
Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
- if( pDoc->getPrinter( false ) )
- aTextFont = pDoc->getPrinter( false )->GetFontMetric( aTextFont );
+ if( pDoc->getPrinter( false ) )
+ aTextFont = pDoc->getPrinter( false )->GetFontMetric( aTextFont );
SvxFontItem aFont( aTextFont.GetFamily(), aTextFont.GetName(),
- aEmptyStr, aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
+ aEmptyStr, aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
pItemSet->Put( aFont );
pItemSet->Put( aFont, RES_CHRATR_CJK_FONT );
pItemSet->Put( aFont, RES_CHRATR_CTL_FONT );
@@ -167,16 +165,16 @@ sal_uLong SwASCIIParser::CallParser()
nSttCntnt = pPam->GetPoint()->nContent.GetIndex();
}
- SwTxtFmtColl *pColl = 0;
+ SwTxtFmtColl *pColl = 0;
- if (bNewDoc)
- {
- pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_HTML_PRE, false);
- if (!pColl)
- pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD,false);
- if (pColl)
- pDoc->SetTxtFmtColl(*pPam, pColl);
- }
+ if (bNewDoc)
+ {
+ pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_HTML_PRE, false);
+ if (!pColl)
+ pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD,false);
+ if (pColl)
+ pDoc->SetTxtFmtColl(*pPam, pColl);
+ }
sal_uLong nError = ReadChars();
@@ -202,37 +200,37 @@ sal_uLong SwASCIIParser::CallParser()
{
if( bNewDoc )
{
- if (pColl)
- {
- // Using the pool defaults for the font causes significant
- // trouble for the HTML filter, because it is not able
- // to export the pool defaults (or to be more precise:
- // the HTML filter is not able to detect whether a pool
- // default has changed or not. Even a comparison with the
- // HTMLi template does not work, because the defaults are
- // not copied when a new doc is created. The result of
- // comparing pool defaults therfor would be that the
- // defaults are exported always if the have changed for
- // text documents in general. That's not sensible, as well
- // as it is not sensible to export them always.
- sal_uInt16 aWhichIds[4] =
- {
- RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
- RES_CHRATR_CTL_FONT, 0
- };
- sal_uInt16 *pWhichIds = aWhichIds;
- while (*pWhichIds)
- {
- const SfxPoolItem *pItem;
- if (SFX_ITEM_SET == pItemSet->GetItemState(*pWhichIds,
- false, &pItem))
- {
- pColl->SetFmtAttr( *pItem );
- pItemSet->ClearItem( *pWhichIds );
- }
- ++pWhichIds;
- }
- }
+ if (pColl)
+ {
+ // Using the pool defaults for the font causes significant
+ // trouble for the HTML filter, because it is not able
+ // to export the pool defaults (or to be more precise:
+ // the HTML filter is not able to detect whether a pool
+ // default has changed or not. Even a comparison with the
+ // HTMLi template does not work, because the defaults are
+ // not copied when a new doc is created. The result of
+ // comparing pool defaults therefor would be that the
+ // defaults are exported always if the have changed for
+ // text documents in general. That's not sensible, as well
+ // as it is not sensible to export them always.
+ sal_uInt16 aWhichIds[4] =
+ {
+ RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT, 0
+ };
+ sal_uInt16 *pWhichIds = aWhichIds;
+ while (*pWhichIds)
+ {
+ const SfxPoolItem *pItem;
+ if (SFX_ITEM_SET == pItemSet->GetItemState(*pWhichIds,
+ false, &pItem))
+ {
+ pColl->SetFmtAttr( *pItem );
+ pItemSet->ClearItem( *pWhichIds );
+ }
+ ++pWhichIds;
+ }
+ }
if (pItemSet->Count())
pDoc->SetDefault(*pItemSet);
}
@@ -246,7 +244,7 @@ sal_uLong SwASCIIParser::CallParser()
// !!!!!
ASSERT( sal_False, "Have to change - hard attr. to para. style" );
- pDoc->InsertItemSet( *pInsPam, *pItemSet, 0 );
+ pDoc->InsertItemSet( *pInsPam, *pItemSet, 0 );
}
}
delete pItemSet, pItemSet = 0;
@@ -264,31 +262,31 @@ sal_uLong SwASCIIParser::ReadChars()
sal_Unicode *pStt = 0, *pEnd = 0, *pLastStt = 0;
long nReadCnt = 0, nLineLen = 0;
sal_Unicode cLastCR = 0;
- bool bSwapUnicode = false;
-
- const SwAsciiOptions *pUseMe=&rOpt;
- SwAsciiOptions aEmpty;
- if (nFileSize >= 2 &&
- aEmpty.GetFontName() == rOpt.GetFontName() &&
- aEmpty.GetCharSet() == rOpt.GetCharSet() &&
- aEmpty.GetLanguage() == rOpt.GetLanguage() &&
- aEmpty.GetParaFlags() == rOpt.GetParaFlags())
- {
- sal_uLong nLen, nOrig;
- nOrig = nLen = rInput.Read(pArr, ASC_BUFFLEN);
- CharSet eCharSet;
- bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode);
- ASSERT(bRet, "Autodetect of text import without nag dialog must "
- "have failed");
- if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW)
- {
- aEmpty.SetCharSet(eCharSet);
- rInput.SeekRel(-(long(nLen)));
- }
- else
- rInput.SeekRel(-(long(nOrig)));
- pUseMe=&aEmpty;
- }
+ bool bSwapUnicode = false;
+
+ const SwAsciiOptions *pUseMe=&rOpt;
+ SwAsciiOptions aEmpty;
+ if (nFileSize >= 2 &&
+ aEmpty.GetFontName() == rOpt.GetFontName() &&
+ aEmpty.GetCharSet() == rOpt.GetCharSet() &&
+ aEmpty.GetLanguage() == rOpt.GetLanguage() &&
+ aEmpty.GetParaFlags() == rOpt.GetParaFlags())
+ {
+ sal_uLong nLen, nOrig;
+ nOrig = nLen = rInput.Read(pArr, ASC_BUFFLEN);
+ CharSet eCharSet;
+ bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode);
+ ASSERT(bRet, "Autodetect of text import without nag dialog must "
+ "have failed");
+ if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW)
+ {
+ aEmpty.SetCharSet(eCharSet);
+ rInput.SeekRel(-(long(nLen)));
+ }
+ else
+ rInput.SeekRel(-(long(nOrig)));
+ pUseMe=&aEmpty;
+ }
rtl_TextToUnicodeConverter hConverter=0;
rtl_TextToUnicodeContext hContext=0;
@@ -296,15 +294,15 @@ sal_uLong SwASCIIParser::ReadChars()
if (RTL_TEXTENCODING_UCS2 != currentCharSet)
{
if( currentCharSet == RTL_TEXTENCODING_DONTKNOW )
- currentCharSet = RTL_TEXTENCODING_ASCII_US;
+ currentCharSet = RTL_TEXTENCODING_ASCII_US;
hConverter = rtl_createTextToUnicodeConverter( currentCharSet );
ASSERT( hConverter, "no string convert available" );
if (!hConverter)
- return ERROR_SW_READ_BASE;
+ return ERROR_SW_READ_BASE;
bSwapUnicode = false;
hContext = rtl_createTextToUnicodeContext( hConverter );
}
- else if (pUseMe != &aEmpty) //Already successfully figured out type
+ else if (pUseMe != &aEmpty) // Already successfully figured out type
{
rInput.StartReadingUnicodeText( currentCharSet );
bSwapUnicode = rInput.IsEndianSwap();
@@ -326,20 +324,20 @@ sal_uLong SwASCIIParser::ReadChars()
ASC_BUFFLEN - nArrOffset )))
break; // aus der WHILE-Schleife heraus
- /*
- #98380#
- If there was some unconverted bytes on the last cycle then they
- were put at the beginning of the array, so total bytes available
- to convert this cycle includes them. If we found 0 following bytes
- then we ignore the previous partial character.
- */
- lGCount+=nArrOffset;
+ /*
+ #98380#
+ If there was some unconverted bytes on the last cycle then they
+ were put at the beginning of the array, so total bytes available
+ to convert this cycle includes them. If we found 0 following bytes
+ then we ignore the previous partial character.
+ */
+ lGCount+=nArrOffset;
if( hConverter )
{
sal_uInt32 nInfo;
sal_Size nNewLen = lGCount, nCntBytes;
- sal_Unicode* pBuf = sWork.AllocBuffer( static_cast< xub_StrLen >(nNewLen) );
+ sal_Unicode* pBuf = sWork.AllocBuffer( static_cast< xub_StrLen >(nNewLen) );
nNewLen = rtl_convertTextToUnicode( hConverter, hContext,
pArr, lGCount, pBuf, nNewLen,
@@ -347,13 +345,13 @@ sal_uLong SwASCIIParser::ReadChars()
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT |
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE
+ RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE
),
&nInfo,
&nCntBytes );
if( 0 != ( nArrOffset = lGCount - nCntBytes ) )
memmove( pArr, pArr + nCntBytes, nArrOffset );
- sWork.ReleaseBufferAccess( static_cast< xub_StrLen >(nNewLen) );
+ sWork.ReleaseBufferAccess( static_cast< xub_StrLen >(nNewLen) );
pStt = pLastStt = sWork.GetBufferAccess();
pEnd = pStt + nNewLen;
@@ -386,7 +384,7 @@ sal_uLong SwASCIIParser::ReadChars()
pLastStt = ++pStt;
cLastCR = 0;
nLineLen = 0;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
+ // JP 03.04.96: das letzte am Ende nehmen wir nicht
if( !rInput.IsEof() || !(pEnd == pStt ||
( !*pEnd && pEnd == pStt+1 ) ) )
pDoc->SplitNode( *pPam->GetPoint(), false );
@@ -409,7 +407,7 @@ sal_uLong SwASCIIParser::ReadChars()
*pStt = 0;
++pStt;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
+ // JP 03.04.96: das letzte am Ende nehmen wir nicht
if( !rInput.IsEof() || pEnd != pStt )
bSplitNode = true;
}
@@ -435,7 +433,7 @@ sal_uLong SwASCIIParser::ReadChars()
else
bChkSplit = true;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
+ // JP 03.04.96: das letzte am Ende nehmen wir nicht
if( bChkSplit && ( !rInput.IsEof() || pEnd != pStt ))
bSplitNode = true;
}
@@ -452,8 +450,8 @@ sal_uLong SwASCIIParser::ReadChars()
InsertText( String( pLastStt ));
}
pDoc->SplitNode( *pPam->GetPoint(), false );
- pDoc->InsertPoolItem(
- *pPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0);
+ pDoc->InsertPoolItem(
+ *pPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0);
pLastStt = pStt;
nLineLen = 0;
bIns = false;
@@ -464,7 +462,7 @@ sal_uLong SwASCIIParser::ReadChars()
if( nReadCnt == nFileSize && pStt+1 == pEnd )
*pStt = 0;
else
- *pStt = '#'; // Ersatzdarstellung
+ *pStt = '#'; // Ersatzdarstellung
break;
case '\t': break;
@@ -513,11 +511,11 @@ sal_uLong SwASCIIParser::ReadChars()
void SwASCIIParser::InsertText( const String& rStr )
{
- pDoc->InsertString( *pPam, rStr );
+ pDoc->InsertString( *pPam, rStr );
if( pItemSet && pBreakIt && nScript != ( SCRIPTTYPE_LATIN |
SCRIPTTYPE_ASIAN |
SCRIPTTYPE_COMPLEX ) )
nScript |= pBreakIt->GetAllScriptsOfText( rStr );
}
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim: set noet sw=4 ts=4: */