summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-12-03 18:43:21 +0100
committerKurt Zenker <kz@openoffice.org>2009-12-03 18:43:21 +0100
commit2c09bcf173a6dfe7e647bbf215f9af0b92c1a536 (patch)
treed0301ad470899d9fc7ef9a8c25a4e9d46688c632
parent496c1ec119eb0c82f93c742b7c4f9977aac864d1 (diff)
parent425eb5d131b40020dcafe3204cd52a0a0f1c6b1a (diff)
CWS-TOOLING: integrate CWS fwk125_DEV300
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx50
-rw-r--r--package/source/zippackage/ZipPackage.cxx12
2 files changed, 49 insertions, 13 deletions
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index b24bc6ee80f5..421c243d82e4 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -534,7 +534,7 @@ Reference < XHyphenatedWord > SAL_CALL
Reference< XPossibleHyphens > SAL_CALL
Hyphenator::createPossibleHyphens( const ::rtl::OUString& aWord,
const ::com::sun::star::lang::Locale& aLocale,
- const ::com::sun::star::beans::PropertyValues& /*aProperties*/ )
+ const ::com::sun::star::beans::PropertyValues& aProperties )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
@@ -544,6 +544,10 @@ Reference< XPossibleHyphens > SAL_CALL
char *lcword;
int k;
+ PropertyHelper_Hyphen & rHelper = GetPropHelper();
+ rHelper.SetTmpPropVals(aProperties);
+ sal_Int16 minTrail = rHelper.GetMinTrailing();
+ sal_Int16 minLead = rHelper.GetMinLeading();
HyphenDict *dict = NULL;
rtl_TextEncoding aEnc = 0;
@@ -617,6 +621,9 @@ Reference< XPossibleHyphens > SAL_CALL
wordlen = encWord.getLength();
lcword = new char[wordlen+1];
hyphens = new char[wordlen+5];
+ char ** rep = NULL; // replacements of discretionary hyphenation
+ int * pos = NULL; // array of [hyphenation point] minus [deletion position]
+ int * cut = NULL; // length of deletions in original word
// copy converted word into simple char buffer
strcpy(lcword,encWord.getStr());
@@ -627,10 +634,22 @@ Reference< XPossibleHyphens > SAL_CALL
n++;
// fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr);
if (n > 0) {
- if (hnj_hyphen_hyphenate(dict, lcword, n, hyphens))
+ if (hnj_hyphen_hyphenate3(dict, lcword, n, hyphens, NULL, &rep, &pos, &cut,
+ minLead, minTrail, Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
+ Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2)))))
{
delete[] hyphens;
delete[] lcword;
+
+ if (rep) {
+ for(int j = 0; j < n; j++) {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+
return NULL;
}
}
@@ -643,7 +662,7 @@ Reference< XPossibleHyphens > SAL_CALL
INT16 i;
for ( i = 0; i < encWord.getLength(); i++)
- if (hyphens[i]&1)
+ if (hyphens[i]&1 && (!rep || !rep[i]))
nHyphCount++;
Sequence< INT16 > aHyphPos(nHyphCount);
@@ -652,15 +671,14 @@ Reference< XPossibleHyphens > SAL_CALL
OUString hyphenatedWord;
nHyphCount = 0;
- for (i = 0; i < encWord.getLength(); i++)
- {
+ for (i = 0; i < nWord.getLength(); i++) {
hyphenatedWordBuffer.append(aWord[i]);
- if (hyphens[i]&1)
- {
- pPos[nHyphCount] = i;
- hyphenatedWordBuffer.append(sal_Unicode('='));
- nHyphCount++;
- }
+ // hyphenation position (not alternative)
+ if (hyphens[i]&1 && (!rep || !rep[i])) {
+ pPos[nHyphCount] = i;
+ hyphenatedWordBuffer.append(sal_Unicode('='));
+ nHyphCount++;
+ }
}
hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
@@ -672,6 +690,16 @@ Reference< XPossibleHyphens > SAL_CALL
delete[] hyphens;
delete[] lcword;
+
+ if (rep) {
+ for(int j = 0; j < n; j++) {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+
return xRes;
}
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 6ca9981d2291..759f7d4d7d03 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1370,6 +1370,16 @@ void SAL_CALL ZipPackage::commitChanges()
{
uno::Reference< io::XSeekable > xTempSeek( xTempInStream, uno::UNO_QUERY_THROW );
+ try
+ {
+ xTempSeek->seek( 0 );
+ }
+ catch( uno::Exception& r )
+ {
+ throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Temporary file should be seekable!" ) ),
+ static_cast < OWeakObject * > ( this ), makeAny ( r ) );
+ }
+
// switch to the new temporary stream only after the transfer
PostinitializationGuard aPostInitGuard( xTempInStream, *this );
@@ -1381,8 +1391,6 @@ void SAL_CALL ZipPackage::commitChanges()
// preparation for copy step
try
{
- xTempSeek->seek( 0 );
-
xOutputStream = m_xStream->getOutputStream();
uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY );
if ( !xTruncate.is() )