diff options
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/help/HelpIndexer.cxx | 22 | ||||
-rw-r--r-- | l10ntools/source/help/HelpIndexer.hxx | 69 | ||||
-rw-r--r-- | l10ntools/source/help/HelpIndexer_main.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/help/makefile.mk | 20 |
4 files changed, 29 insertions, 84 deletions
diff --git a/l10ntools/source/help/HelpIndexer.cxx b/l10ntools/source/help/HelpIndexer.cxx index f86d265d33be..b54814a41895 100644 --- a/l10ntools/source/help/HelpIndexer.cxx +++ b/l10ntools/source/help/HelpIndexer.cxx @@ -1,4 +1,4 @@ -#include "HelpIndexer.hxx" +#include <l10ntools/HelpIndexer.hxx> #define TODO @@ -100,11 +100,27 @@ bool HelpIndexer::scanForFiles(rtl::OUString const & path) { return true; } +std::vector<TCHAR> OUStringToTCHARVec(rtl::OUString const &rStr) +{ + //UTF-16 + if (sizeof(wchar_t) == sizeof(sal_Unicode)) + return std::vector<TCHAR>(rStr.getStr(), rStr.getStr() + rStr.getLength()); + + //UTF-32 + std::vector<TCHAR> aRet; + for (sal_Int32 nStrIndex = 0; nStrIndex < rStr.getLength();) + { + const sal_uInt32 nCode = rStr.iterateCodePoints(&nStrIndex); + aRet.push_back(nCode); + } + return aRet; +} + bool HelpIndexer::helpDocument(rtl::OUString const & fileName, Document *doc) { // Add the help path as an indexed, untokenized field. rtl::OUString path = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#HLP#")) + d_module + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + fileName; - // FIXME: the (TCHAR*) cast is a problem, because TCHAR does not match sal_Unicode - doc->add(*new Field(_T("path"), (TCHAR*)path.getStr(), Field::STORE_YES | Field::INDEX_UNTOKENIZED)); + std::vector<TCHAR> aPath(OUStringToTCHARVec(path)); + doc->add(*new Field(_T("path"), &aPath[0], Field::STORE_YES | Field::INDEX_UNTOKENIZED)); // Add the caption as a field. rtl::OUString captionPath = d_captionDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + fileName; diff --git a/l10ntools/source/help/HelpIndexer.hxx b/l10ntools/source/help/HelpIndexer.hxx deleted file mode 100644 index 833e5e74bba3..000000000000 --- a/l10ntools/source/help/HelpIndexer.hxx +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef HELPINDEXER_HXX -#define HELPINDEXER_HXX - -#include <CLucene/StdHeader.h> -#include <CLucene.h> - -#include <rtl/ustring.hxx> -#include <set> - -// I assume that TCHAR is defined as wchar_t throughout - -class HelpIndexer { - private: - rtl::OUString d_lang; - rtl::OUString d_module; - rtl::OUString d_captionDir; - rtl::OUString d_contentDir; - rtl::OUString d_indexDir; - rtl::OUString d_error; - std::set<rtl::OUString> d_files; - - public: - - /** - * @param lang Help files language. - * @param module The module of the helpfiles. - * @param captionDir The directory to scan for caption files. - * @param contentDir The directory to scan for content files. - * @param indexDir The directory to write the index to. - */ - HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module, - rtl::OUString const &captionDir, rtl::OUString const &contentDir, - rtl::OUString const &indexDir); - - /** - * Run the indexer. - * @return true if index successfully generated. - */ - bool indexDocuments(); - - /** - * Get the error string (empty if no error occurred). - */ - rtl::OUString const & getErrorMessage(); - - private: - - /** - * Scan the caption & contents directories for help files. - */ - bool scanForFiles(); - - /** - * Scan for files in the given directory. - */ - bool scanForFiles(rtl::OUString const &path); - - /** - * Fill the Document with information on the given help file. - */ - bool helpDocument(rtl::OUString const & fileName, lucene::document::Document *doc); - - /** - * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist. - */ - lucene::util::Reader *helpFileReader(rtl::OUString const & path); -}; - -#endif diff --git a/l10ntools/source/help/HelpIndexer_main.cxx b/l10ntools/source/help/HelpIndexer_main.cxx index 3d6963081e0a..ecea92847735 100644 --- a/l10ntools/source/help/HelpIndexer_main.cxx +++ b/l10ntools/source/help/HelpIndexer_main.cxx @@ -1,4 +1,4 @@ -#include "HelpIndexer.hxx" +#include <l10ntools/HelpIndexer.hxx> #include <string> #include <iostream> diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk index 12835358fcd6..2ae32329d546 100644 --- a/l10ntools/source/help/makefile.mk +++ b/l10ntools/source/help/makefile.mk @@ -29,13 +29,15 @@ PRJ = ..$/.. PRJNAME = l10ntools TARGET = HelpLinker LIBBASENAME = helplinker -PACKAGE = com$/sun$/star$/help TARGETTYPE=CUI +ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : helplinker.pmk + +CFLAGS+=-DL10N_DLLIMPLEMENTATION .IF "$(SYSTEM_LIBXSLT)" == "YES" CFLAGS+= $(LIBXSLT_CFLAGS) @@ -52,18 +54,14 @@ CFLAGS+=-DSYSTEM_EXPAT OBJFILES=\ $(OBJ)$/HelpLinker.obj \ - $(OBJ)$/HelpCompiler.obj -SLOFILES=\ - $(SLO)$/HelpLinker.obj \ - $(SLO)$/HelpCompiler.obj - -EXCEPTIONSFILES=\ - $(OBJ)$/HelpLinker.obj \ $(OBJ)$/HelpCompiler.obj \ $(OBJ)$/HelpIndexer.obj \ - $(OBJ)$/HelpIndexer_main.obj \ + $(OBJ)$/HelpIndexer_main.obj + +SLOFILES=\ $(SLO)$/HelpLinker.obj \ - $(SLO)$/HelpCompiler.obj + $(SLO)$/HelpCompiler.obj \ + $(SLO)$/HelpIndexer.obj .IF "$(OS)" == "MACOSX" && "$(CPU)" == "P" && "$(COM)" == "GCC" # There appears to be a GCC 4.0.1 optimization error causing _file:good() to @@ -100,7 +98,7 @@ SHL1IMPLIB =i$(LIBBASENAME) SHL1IMPLIB =$(LIBBASENAME)$(DLLPOSTFIX) .ENDIF SHL1DEF =$(MISC)$/$(SHL1TARGET).def -SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) +SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) $(PKGCONFIG_LIBS) SHL1USE_EXPORTS =ordinal DEF1NAME =$(SHL1TARGET) |