33#if !defined WIN32_LEAN_AND_MEAN
34# define WIN32_LEAN_AND_MEAN
46#if OSL_DEBUG_LEVEL > 2
49 for (
auto const& pos : *rElem_in)
51 Dump(
pos.second,
pos.first);
55void HelpParser::Dump(
LangHashMap* rElem_in,
const OString & sKey_in)
59 fprintf(stdout,
"+------------%s-----------+\n",sKey_in.getStr() );
60 for (
auto const& posn : *rElem_in)
63 y=posn.second->ToOString();
64 fprintf(stdout,
"key=%s value=%s\n",
x.getStr(),
y.getStr());
66 fprintf(stdout,
"+--------------------------+\n");
71 : sHelpFile(
std::move( _sHelpFile ))
77 const OString &rPOFile_in,
const OString &sHelpFile,
78 XMLFile* pXmlFile, std::string_view rGsi1){
98 fprintf(stdout,
"Can't open file %s\n",rPOFile_in.getStr());
104 std::vector<OString> order = pXmlFile->
getOrder();
106 for (
auto const&
pos : order)
108 auto posm = aXMLStrHM->find(
pos);
111 XMLElement* pXMLElement = (*pElem)[
"en-US" ];
113 if( pXMLElement !=
nullptr )
117 replaceAll(
"\n",OString()).
118 replaceAll(
"\t",OString()).
trim());
122 posm->first, OString(), OString(), data);
130 fprintf(stdout,
"\nDBG: NullPointer in HelpParser::CreatePO, File %s\n",
sHelpFile.getStr());
145 XMLFile xmlfile( OString(
'0') );
151 MergeSingleFile( &xmlfile , pMergeDataFile , rLanguage , rDestinationFile );
156 OString
const & sPath )
161 static ResData s_ResData(
"",
"");
164 std::vector<OString> order = file->
getOrder();
166 for (
auto const&
pos : order)
168 auto posm = aXMLStrHM->find(
pos);
170#if OSL_DEBUG_LEVEL > 2
171 printf(
"*********************DUMPING HASHMAP***************************************");
173 printf(
"DBG: sHelpFile = %s\n",
sHelpFile.getStr() );
176 s_ResData.
sGId = posm->first;
190 if( sCur.equalsIgnoreAsciiCase(
"en-US") )
193 pXMLElement = (*aLangHM)[
"en-US" ];
194 if( pXMLElement ==
nullptr )
196 printf(
"Error: Can't find en-US entry\n");
212 sal_Int32 nPreSpaces = 0;
213 sal_Int32 nLen = sSourceText.getLength();
214 while ( (nPreSpaces < nLen) && (sSourceText[nPreSpaces] ==
' ') )
221 else if( pMergeDataFile )
224 if( pEntrys !=
nullptr)
226 pEntrys->
GetText( sNewText, sCur,
true );
229 sNewdata = sSourceText.subView(0,nPreSpaces) + sNewText;
233 if (!sNewdata.isEmpty())
238 aLangHM->erase( sCur );
244 "Can't find GID=" << pResData->
sGId <<
" TYP=" << pResData->
sResTyp);
bool Merge(const OString &rDestinationFile_in, const OString &sLanguage, MergeDataFile *pMergeDataFile)
Method merges the String into XMLfile, which must point to an existing file.
void MergeSingleFile(XMLFile *file, MergeDataFile *pMergeDataFile, const OString &sLanguage, OString const &sPath)
HelpParser(OString sHelpFile)
static bool CreatePO(const OString &rPOFile_in, const OString &sHelpFile, XMLFile *pXmlFile, std::string_view rGsi1)
Method append a PO file with the content of a parsed XML file @PRECOND rHelpFile is valid.
static void ProcessHelp(LangHashMap *aLangHM, const OString &sCur, ResData *pResData, MergeDataFile *pMergeDataFile)
Purpose: holds information of data to merge, read from PO file.
MergeEntrys * GetMergeEntrys(ResData *pResData)
Purpose: holds information of data to merge.
static OString GetQTZText(const ResData &rResData, std::string_view rOrigText)
Generate QTZ string with ResData For executable which works one language and without PO files.
bool GetText(OString &rReturn, const OString &nLangIndex, bool bDel=false)
Interface to write po entry to files as output streams.
Purpose: holds mandatory data to export a single res.
validating xml parser, creates a document tree with xml nodes
const XMLError & GetError() const
returns an error struct
bool Execute(const OString &rFileName, XMLFile *pXMLFile)
parse a file, return false on critical errors
Hold information of an element node.
void ChangeLanguageTag(const OString &rValue)
OString ToOString()
Return a Unicode String representation of this object.
Holds information of a XML file, is root node of tree.
void Write(OString const &rFilename)
const std::vector< OString > & getOrder() const
XMLHashMap * GetStrings()
bool CheckExportStatus(XMLChildNode *pCur=nullptr)
void RemoveAndDeleteAllChildren()
void AddChild(XMLChildNode *pChild)
adds a new child
static OString QuotHTML(const OString &rString)
Quot the XML characters.
#define SAL_WARN(area, stream)
void writePoEntry(const OString &rExecutable, PoOfstream &rPoStream, const OString &rSourceFile, std::string_view rResType, const OString &rGroupId, const OString &rLocalId, const OString &rHelpText, const OString &rText, const PoEntry::TYPE eType)
Write out a PoEntry with attention to exceptions.
bool isWellFormedXML(std::string_view text)
Check whether text is a valid XML expression.
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
OString m_sMessage
readable error message
std::unordered_map< OString, LangHashMap * > XMLHashMap
Mapping XML Element string identifier <-> Language Map.
std::unordered_map< OString, XMLElement * > LangHashMap
Mapping numeric Language code <-> XML Element.