summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-05-23 13:12:05 +0300
committerTor Lillqvist <tml@collabora.com>2014-05-23 13:12:22 +0300
commit7933b269ba4c5a49dd394eef15e98c55a19038ef (patch)
tree465b91926a6a8f320beb14e2ec49ed0f5d8b7b8d /lingucomponent
parent2c66056bec75105566c5dcbb9726dd77b83be768 (diff)
Reintroduce Win_GetShortPathName()
Change-Id: Id15d1d4d9b7fb9bb2a0a5f52b5ec1928c38bd27b
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 9f7028bd31e8..94abeb9deda0 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -507,6 +507,29 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling(
return NULL;
}
+#if defined(WNT)
+static OString Win_GetShortPathName( const OUString &rLongPathName )
+{
+ OString aRes;
+
+ sal_Unicode aShortBuffer[1024] = {0};
+ sal_Int32 nShortBufSize = SAL_N_ELEMENTS( aShortBuffer );
+
+ // use the version of 'GetShortPathName' that can deal with Unicode...
+ sal_Int32 nShortLen = GetShortPathNameW(
+ reinterpret_cast<LPCWSTR>( rLongPathName.getStr() ),
+ reinterpret_cast<LPWSTR>( aShortBuffer ),
+ nShortBufSize );
+
+ if (nShortLen < nShortBufSize) // conversion successful?
+ aRes = OString( OU2ENC( OUString( aShortBuffer, nShortLen ), osl_getThreadTextEncoding()) );
+ else
+ OSL_FAIL( "Win_GetShortPathName: buffer to short" );
+
+ return aRes;
+}
+#endif //defined(WNT)
+
Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const OUString& aWord,
const ::com::sun::star::lang::Locale& aLocale,
const ::com::sun::star::beans::PropertyValues& aProperties )