[Libreoffice-commits] .: 4 commits - sw/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Thu Nov 4 06:57:44 PDT 2010
sw/source/core/txtnode/txtedt.cxx | 206 +++++++++++---------
sw/source/filter/inc/msfilter.hxx | 2
sw/source/filter/rtf/rtffld.cxx | 2
sw/source/filter/ww8/writerwordglue.cxx | 315 ++++++++++++++++----------------
sw/source/filter/ww8/ww8par5.cxx | 3
sw/source/ui/fldui/fldmgr.cxx | 36 +--
6 files changed, 298 insertions(+), 266 deletions(-)
New commits:
commit 4eafac0402c2b9be8c4aa83819721c95cce621ff
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Thu Nov 4 14:55:01 2010 +0100
First fix for i#82680
The dates format for Word 97 files causes troubles: the fix needs to be
checked / completed with Spanish and German word 97 date fields.
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index cfbe19a..946b9d1 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -119,7 +119,7 @@ namespace sw
@author
<a href="mailto:mmaher at openoffice.org">Martin Maher</a
*/
- ULONG MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter, USHORT &rLang, bool bHijri);
+ ULONG MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter, USHORT &rLang, bool bHijri, USHORT nDocLang);
/** Used by MSDateTimeFormatToSwFormat to identify AM time fields
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index fcf0104..a7280cd 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -502,7 +502,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
if( pFormatter )
{
- nFmtIdx = sw::ms::MSDateTimeFormatToSwFormat(aSaveStr, pFormatter, rLang, bHijri);
+ nFmtIdx = sw::ms::MSDateTimeFormatToSwFormat(aSaveStr, pFormatter, rLang, bHijri, rLang);
if (nFmtIdx)
nNumFmtType = pFormatter->GetType(nFmtIdx);
}
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index dfbf2b4..d964aaa 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -60,6 +60,8 @@
# include <frmatr.hxx> //GetLRSpace...
# include <ndtxt.hxx> //SwTxtNode
# include <breakit.hxx> //pBreakIt
+#include <i18npool/mslangid.hxx>
+#endif
#define ASSIGN_CONST_ASC(s) AssignAscii(RTL_CONSTASCII_STRINGPARAM(s))
@@ -806,7 +808,8 @@ namespace sw
}
ULONG MSDateTimeFormatToSwFormat(String& rParams,
- SvNumberFormatter *pFormatter, USHORT &rLang, bool bHijri)
+ SvNumberFormatter *pFormatter, USHORT &rLang, bool bHijri,
+ USHORT nDocLang)
{
// tell the Formatter about the new entry
UINT16 nCheckPos = 0;
@@ -815,9 +818,50 @@ namespace sw
SwapQuotesInField(rParams);
- //#102782#, #102815#, #108341# & #111944# have to work at the same time :-)
- bool bForceJapanese(false);
- bool bForceNatNum(false);
+ // Force to Japanese when finding one of 'geaE'
+ rtl::OUString sJChars = rtl::OUString::createFromAscii( "geE" );
+ bool bForceJapanese = ( STRING_NOTFOUND != rParams.SearchChar( sJChars.getStr() ) );
+ if ( bForceJapanese )
+ {
+ rParams.SearchAndReplaceAll( String::CreateFromAscii( "ee" ),
+ String::CreateFromAscii( "yyyy" ) );
+ rParams.SearchAndReplaceAll( String::CreateFromAscii( "EE" ),
+ String::CreateFromAscii( "YYYY" ) );
+ }
+ if (LANGUAGE_FRENCH != nDocLang)
+ {
+ // Handle the 'a' case here
+ xub_StrLen nLastPos = 0;
+ do
+ {
+ xub_StrLen nPos = rParams.Search( 'a', nLastPos + 1 );
+ bForceJapanese |= ( nPos != STRING_NOTFOUND && IsNotAM( rParams, nPos ) );
+ nLastPos = nPos;
+ } while ( STRING_NOTFOUND != nLastPos );
+ }
+
+ // Force to NatNum when finding one of 'oOA'
+ String sOldParams( rParams );
+ rParams.SearchAndReplaceAll( String::CreateFromAscii( "o" ),
+ String::CreateFromAscii( "m" ) );
+ rParams.SearchAndReplaceAll( String::CreateFromAscii( "O" ),
+ String::CreateFromAscii( "M" ) );
+ bool bForceNatNum = !sOldParams.Equals( rParams );
+ if (LANGUAGE_FRENCH != nDocLang)
+ {
+ // Handle the 'A' case here
+ xub_StrLen nLastPos = 0;
+ do
+ {
+ xub_StrLen nPos = rParams.Search( 'A', nLastPos + 1 );
+ bool bIsCharA = ( nPos != STRING_NOTFOUND && IsNotAM( rParams, nPos ) );
+ bForceNatNum |= bIsCharA;
+ if ( bIsCharA )
+ rParams.SetChar( nPos, 'D' );
+ nLastPos = nPos;
+ } while ( STRING_NOTFOUND != nLastPos );
+ }
+
xub_StrLen nLen = rParams.Len();
xub_StrLen nI = 0;
while (nI < nLen)
@@ -834,46 +878,18 @@ namespace sw
else //normal unquoted section
{
sal_Unicode nChar = rParams.GetChar(nI);
- if (nChar == 'O')
- {
- rParams.SetChar(nI, 'M');
- bForceNatNum = true;
- }
- else if (nChar == 'o')
- {
- rParams.SetChar(nI, 'm');
- bForceNatNum = true;
- }
- else if ((nChar == 'A') && IsNotAM(rParams, nI))
- {
- rParams.SetChar(nI, 'D');
- bForceNatNum = true;
- }
- else if ((nChar == 'g') || (nChar == 'G'))
- bForceJapanese = true;
- else if ((nChar == 'a') && IsNotAM(rParams, nI))
- bForceJapanese = true;
- else if (nChar == 'E')
+
+ // Change the localized word string to english
+ switch ( nDocLang )
{
- if ((nI != nLen-1) && (rParams.GetChar(nI+1) == 'E'))
- {
- rParams.Replace(nI, 2, CREATE_CONST_ASC("YYYY"));
- nLen+=2;
- nI+=3;
- }
- bForceJapanese = true;
+ case LANGUAGE_FRENCH:
+ if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) )
+ rParams.SetChar(nI, 'Y');
+ break;
+ default:
+ ;
}
- else if (nChar == 'e')
- {
- if ((nI != nLen-1) && (rParams.GetChar(nI+1) == 'e'))
- {
- rParams.Replace(nI, 2, CREATE_CONST_ASC("yyyy"));
- nLen+=2;
- nI+=3;
- }
- bForceJapanese = true;
- }
- else if (nChar == '/')
+ if (nChar == '/')
{
// MM We have to escape '/' in case it's used as a char
rParams.Replace(nI, 1, CREATE_CONST_ASC("\\/"));
@@ -886,110 +902,114 @@ namespace sw
// Should be made with i18n framework.
// The list of the mappings and of those "special" locales is to be found at:
// http://l10n.openoffice.org/i18n_framework/LocaleData.html
- switch ( rLang )
+ if ( !bForceJapanese && !bForceNatNum )
{
- case LANGUAGE_FINNISH:
- {
- if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar (nI, 'V');
- else if (nChar == 'm' || nChar == 'M')
- rParams.SetChar (nI, 'K');
- else if (nChar == 'd' || nChar == 'D')
- rParams.SetChar (nI, 'P');
- else if (nChar == 'h' || nChar == 'H')
- rParams.SetChar (nI, 'T');
- }
- break;
- case LANGUAGE_DANISH:
- case LANGUAGE_NORWEGIAN:
- case LANGUAGE_NORWEGIAN_BOKMAL:
- case LANGUAGE_NORWEGIAN_NYNORSK:
- case LANGUAGE_SWEDISH:
- case LANGUAGE_SWEDISH_FINLAND:
- {
- if (nChar == 'h' || nChar == 'H')
- rParams.SetChar (nI, 'T');
- }
- break;
- case LANGUAGE_PORTUGUESE:
- case LANGUAGE_PORTUGUESE_BRAZILIAN:
- case LANGUAGE_SPANISH_MODERN:
- case LANGUAGE_SPANISH_DATED:
- case LANGUAGE_SPANISH_MEXICAN:
- case LANGUAGE_SPANISH_GUATEMALA:
- case LANGUAGE_SPANISH_COSTARICA:
- case LANGUAGE_SPANISH_PANAMA:
- case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC:
- case LANGUAGE_SPANISH_VENEZUELA:
- case LANGUAGE_SPANISH_COLOMBIA:
- case LANGUAGE_SPANISH_PERU:
- case LANGUAGE_SPANISH_ARGENTINA:
- case LANGUAGE_SPANISH_ECUADOR:
- case LANGUAGE_SPANISH_CHILE:
- case LANGUAGE_SPANISH_URUGUAY:
- case LANGUAGE_SPANISH_PARAGUAY:
- case LANGUAGE_SPANISH_BOLIVIA:
- case LANGUAGE_SPANISH_EL_SALVADOR:
- case LANGUAGE_SPANISH_HONDURAS:
- case LANGUAGE_SPANISH_NICARAGUA:
- case LANGUAGE_SPANISH_PUERTO_RICO:
- {
- if (nChar == 'a' || nChar == 'A')
- rParams.SetChar (nI, 'O');
- else if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar (nI, 'A');
- }
- break;
- case LANGUAGE_DUTCH:
- case LANGUAGE_DUTCH_BELGIAN:
+ // Convert to the localized equivalent for OOo
+ switch ( rLang )
{
- if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar (nI, 'J');
- else if (nChar == 'u' || nChar == 'U')
- rParams.SetChar (nI, 'H');
- }
- break;
- case LANGUAGE_ITALIAN:
- case LANGUAGE_ITALIAN_SWISS:
- {
- if (nChar == 'a' || nChar == 'A')
- rParams.SetChar (nI, 'O');
- else if (nChar == 'g' || nChar == 'G')
- rParams.SetChar (nI, 'X');
- else if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar(nI, 'A');
- else if (nChar == 'd' || nChar == 'D')
- rParams.SetChar (nI, 'G');
- }
- break;
- case LANGUAGE_GERMAN:
- case LANGUAGE_GERMAN_SWISS:
- case LANGUAGE_GERMAN_AUSTRIAN:
- case LANGUAGE_GERMAN_LUXEMBOURG:
- case LANGUAGE_GERMAN_LIECHTENSTEIN:
- {
- if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar (nI, 'J');
- else if (nChar == 'd' || nChar == 'D')
- rParams.SetChar (nI, 'T');
- }
- break;
- case LANGUAGE_FRENCH:
- case LANGUAGE_FRENCH_BELGIAN:
- case LANGUAGE_FRENCH_CANADIAN:
- case LANGUAGE_FRENCH_SWISS:
- case LANGUAGE_FRENCH_LUXEMBOURG:
- case LANGUAGE_FRENCH_MONACO:
- {
- if (nChar == 'y' || nChar == 'Y')
- rParams.SetChar (nI, 'A');
- else if (nChar == 'd' || nChar == 'D')
- rParams.SetChar (nI, 'J');
- }
- break;
- default:
- {
- ; // Nothing
+ case LANGUAGE_FINNISH:
+ {
+ if (nChar == 'y' || nChar == 'Y')
+ rParams.SetChar (nI, 'V');
+ else if (nChar == 'm' || nChar == 'M')
+ rParams.SetChar (nI, 'K');
+ else if (nChar == 'd' || nChar == 'D')
+ rParams.SetChar (nI, 'P');
+ else if (nChar == 'h' || nChar == 'H')
+ rParams.SetChar (nI, 'T');
+ }
+ break;
+ case LANGUAGE_DANISH:
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ case LANGUAGE_NORWEGIAN_NYNORSK:
+ case LANGUAGE_SWEDISH:
+ case LANGUAGE_SWEDISH_FINLAND:
+ {
+ if (nChar == 'h' || nChar == 'H')
+ rParams.SetChar (nI, 'T');
+ }
+ break;
+ case LANGUAGE_PORTUGUESE:
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ case LANGUAGE_SPANISH_MODERN:
+ case LANGUAGE_SPANISH_DATED:
+ case LANGUAGE_SPANISH_MEXICAN:
+ case LANGUAGE_SPANISH_GUATEMALA:
+ case LANGUAGE_SPANISH_COSTARICA:
+ case LANGUAGE_SPANISH_PANAMA:
+ case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC:
+ case LANGUAGE_SPANISH_VENEZUELA:
+ case LANGUAGE_SPANISH_COLOMBIA:
+ case LANGUAGE_SPANISH_PERU:
+ case LANGUAGE_SPANISH_ARGENTINA:
+ case LANGUAGE_SPANISH_ECUADOR:
+ case LANGUAGE_SPANISH_CHILE:
+ case LANGUAGE_SPANISH_URUGUAY:
+ case LANGUAGE_SPANISH_PARAGUAY:
+ case LANGUAGE_SPANISH_BOLIVIA:
+ case LANGUAGE_SPANISH_EL_SALVADOR:
+ case LANGUAGE_SPANISH_HONDURAS:
+ case LANGUAGE_SPANISH_NICARAGUA:
+ case LANGUAGE_SPANISH_PUERTO_RICO:
+ {
+ if (nChar == 'a' || nChar == 'A')
+ rParams.SetChar (nI, 'O');
+ else if (nChar == 'y' || nChar == 'Y')
+ rParams.SetChar (nI, 'A');
+ }
+ break;
+ case LANGUAGE_DUTCH:
+ case LANGUAGE_DUTCH_BELGIAN:
+ {
+ if (nChar == 'y' || nChar == 'Y')
+ rParams.SetChar (nI, 'J');
+ else if (nChar == 'u' || nChar == 'U')
+ rParams.SetChar (nI, 'H');
+ }
+ break;
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_ITALIAN_SWISS:
+ {
+ if (nChar == 'a' || nChar == 'A')
+ rParams.SetChar (nI, 'O');
+ else if (nChar == 'g' || nChar == 'G')
+ rParams.SetChar (nI, 'X');
+ else if (nChar == 'y' || nChar == 'Y')
+ rParams.SetChar(nI, 'A');
+ else if (nChar == 'd' || nChar == 'D')
+ rParams.SetChar (nI, 'G');
+ }
+ break;
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_GERMAN_SWISS:
+ case LANGUAGE_GERMAN_AUSTRIAN:
+ case LANGUAGE_GERMAN_LUXEMBOURG:
+ case LANGUAGE_GERMAN_LIECHTENSTEIN:
+ {
+ if (nChar == 'y' || nChar == 'Y')
+ rParams.SetChar (nI, 'J');
+ else if (nChar == 'd' || nChar == 'D')
+ rParams.SetChar (nI, 'T');
+ }
+ break;
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_FRENCH_BELGIAN:
+ case LANGUAGE_FRENCH_CANADIAN:
+ case LANGUAGE_FRENCH_SWISS:
+ case LANGUAGE_FRENCH_LUXEMBOURG:
+ case LANGUAGE_FRENCH_MONACO:
+ {
+ if (nChar == 'y' || nChar == 'Y' || nChar == 'a')
+ rParams.SetChar (nI, 'A');
+ else if (nChar == 'd' || nChar == 'D' || nChar == 'j')
+ rParams.SetChar (nI, 'J');
+ }
+ break;
+ default:
+ {
+ ; // Nothing
+ }
}
}
}
@@ -1037,7 +1057,6 @@ namespace sw
}
}
-
}
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 31d110b..b6a55e5 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -654,7 +654,8 @@ short SwWW8ImplReader::GetTimeDatePara(String& rStr, sal_uInt32& rFormat,
}
ULONG nFmtIdx =
- sw::ms::MSDateTimeFormatToSwFormat(sParams, pFormatter, rLang, bHijri);
+ sw::ms::MSDateTimeFormatToSwFormat(sParams, pFormatter, rLang, bHijri,
+ GetFib().lid);
short nNumFmtType = NUMBERFORMAT_UNDEFINED;
if (nFmtIdx)
nNumFmtType = pFormatter->GetType(nFmtIdx);
commit 335534df4946437a12cd3c18b4a24beee188317b
Author: John LeMoyne Castle <jlc at mail2lee.com>
Date: Tue Nov 2 00:08:15 2010 -0600
Fixes char overcount when selection ends in middle of word
Patch in sw changes only one object: sw/source/core/txtedt.cxx
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 9f05346..c03ab05 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1864,116 +1864,130 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
void SwTxtNode::CountWords( SwDocStat& rStat,
xub_StrLen nStt, xub_StrLen nEnd ) const
{
+ sal_Bool isCountAll = ( (0 == nStt) && (GetTxt().Len() == nEnd) );
+
++rStat.nAllPara; // #i93174#: count _all_ paragraphs
- if( nStt < nEnd )
+ if( nStt >= nEnd )
+ { // empty node or empty selection or bad call
+ return;
+ }
+ if ( IsHidden() )
+ { // not counting hidden paras
+ return;
+ }
+ // Shortcut when counting whole paragraph and current count is clean
+ if ( isCountAll && !IsWordCountDirty() )
{
- if ( !IsHidden() )
- {
- ++rStat.nPara;
- ULONG nTmpWords = 0;
- ULONG nTmpChars = 0;
- ULONG nTmpCharsExcludingSpaces = 0; // Number of characters in actual words (i.e. excluding spaces)
-
- // Shortcut: Whole paragraph should be considered and cached values
- // are valid:
- if ( 0 == nStt && GetTxt().Len() == nEnd && !IsWordCountDirty() )
- {
- nTmpWords = GetParaNumberOfWords();
- nTmpChars = GetParaNumberOfChars();
- nTmpCharsExcludingSpaces = GetParaNumberOfCharsExcludingSpaces();
- }
- else
- {
- String aOldStr( m_Text );
- String& rCastStr = const_cast<String&>(m_Text);
-
- // fills the deleted redlines and hidden ranges with cChar:
- const xub_Unicode cChar(' ');
- const USHORT nNumOfMaskedChars =
- lcl_MaskRedlinesAndHiddenText( *this, rCastStr, nStt, nEnd, cChar, false );
-
- // expand fields
- rtl::OUString aExpandText;
- const ModelToViewHelper::ConversionMap* pConversionMap =
- BuildConversionMap( aExpandText );
+ // accumulate into DocStat record to return the values
+ rStat.nWord += GetParaNumberOfWords();
+ rStat.nChar += GetParaNumberOfChars();
+ rStat.nCharExcludingSpaces += GetParaNumberOfCharsExcludingSpaces();
+ return;
+ }
- const sal_uInt32 nExpandBegin = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nStt );
- const sal_uInt32 nExpandEnd = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nEnd );
+ // make a copy of the text
+ String& rTextCopy = const_cast<String&>(m_Text);
- const bool bCount = aExpandText.getLength() > 0;
+ // mask out the redlined and hidden text with ' '
+ const xub_Unicode cChar(' ');
+ const USHORT nNumOfMaskedChars = lcl_MaskRedlinesAndHiddenText( *this, rTextCopy, nStt, nEnd, cChar, false );
- // count words in 'regular' text:
- if( bCount && pBreakIt->GetBreakIter().is() )
- {
- const String aScannerText( aExpandText );
- SwScanner aScanner( *this, aScannerText, 0, pConversionMap,
- i18n::WordType::WORD_COUNT,
- (xub_StrLen)nExpandBegin, (xub_StrLen)nExpandEnd );
+ // expand text into pConversionMap for scanner
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap = BuildConversionMap( aExpandText );
- const rtl::OUString aBreakWord( CH_TXTATR_BREAKWORD );
+ // map start and end points onto the ConversionMap
+ const sal_uInt32 nExpandBegin = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nStt );
+ const sal_uInt32 nExpandEnd = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nEnd );
- while ( aScanner.NextWord() )
- {
- if( aScanner.GetLen() > 1 ||
- CH_TXTATR_BREAKWORD != aExpandText.match(aBreakWord, aScanner.GetBegin() ))
- ++nTmpWords;
+ if ( aExpandText.getLength() <= 0 )
+ {
+ OSL_ENSURE(aExpandText.getLength() >= 0, "Node text expansion error: length < 0." );
+ return;
+ }
- if( CH_TXTATR_BREAKWORD != aExpandText.match(aBreakWord, aScanner.GetBegin() ))
- nTmpCharsExcludingSpaces += aScanner.GetLen();
+ //do the count
+ // all counts exclude hidden paras and hidden+redlined within para
+ // definition of space/white chars in SwScanner (and BreakIter!)
+ // uses both lcl_IsSkippableWhiteSpace and BreakIter getWordBoundary in SwScanner
+ sal_uInt32 nTmpWords = 0; // count of all contiguous blocks of non-white chars
+ sal_uInt32 nTmpChars = 0; // count of all chars
+ sal_uInt32 nTmpCharsExcludingSpaces = 0; // all non-white chars
- }
- }
+ ++rStat.nPara; // count of non-empty paras
- ASSERT( aExpandText.getLength() >= nNumOfMaskedChars,
- "More characters hidden that characters in string!" )
- nTmpChars = nExpandEnd - nExpandBegin - nNumOfMaskedChars;
+ // count words in masked and expanded text:
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ const String aScannerText( aExpandText );
+ // zero is NULL for pLanguage -----------v last param = true for clipping
+ SwScanner aScanner( *this, aScannerText, 0, pConversionMap, i18n::WordType::WORD_COUNT,
+ (xub_StrLen)nExpandBegin, (xub_StrLen)nExpandEnd, true );
- // count words in numbering string:
- if ( nStt == 0 && bCount )
- {
- // add numbering label
- const String aNumString = GetNumString();
- const xub_StrLen nNumStringLen = aNumString.Len();
- if ( nNumStringLen > 0 )
- {
- LanguageType aLanguage = GetLang( 0 );
+ // used to filter out scanner returning almost empty strings (len=1; unichar=0x0001)
+ const rtl::OUString aBreakWord( CH_TXTATR_BREAKWORD );
- SwScanner aScanner( *this, aNumString, &aLanguage, 0,
- i18n::WordType::WORD_COUNT,
- 0, nNumStringLen );
+ while ( aScanner.NextWord() )
+ {
+ // 1 is len(CH_TXTATR_BREAKWORD) : match returns length of match
+ if( 1 != aExpandText.match(aBreakWord, aScanner.GetBegin() ))
+ {
+ ++nTmpWords;
+ nTmpCharsExcludingSpaces += aScanner.GetLen();
+ }
+ }
+ }
- while ( aScanner.NextWord() )
- ++nTmpWords;
+ nTmpChars = nExpandEnd - nExpandBegin - nNumOfMaskedChars;
+ OSL_ENSURE( nTmpChars >= 0, "Less than zero total characters found!" );
- nTmpChars += nNumStringLen;
- }
- else if ( HasBullet() )
- {
- ++nTmpWords;
- ++nTmpChars;
- }
- }
+ // no nTmpCharsExcludingSpaces adjust needed neither for blanked out MaskedChars
+ // nor for mid-word selection - set scanner bClip = true at creation
- delete pConversionMap;
+ // count words in numbering string if started at beginning of para:
+ if ( nStt == 0 )
+ {
+ // count outline number label - ? no expansion into map
+ // always counts all of number-ish label
+ const String aNumString = GetNumString();
+ const xub_StrLen nNumStringLen = aNumString.Len();
+ if ( nNumStringLen > 0 )
+ {
+ LanguageType aLanguage = GetLang( 0 );
- rCastStr = aOldStr;
+ SwScanner aScanner( *this, aNumString, &aLanguage, 0,
+ i18n::WordType::WORD_COUNT, 0, nNumStringLen, true );
- // If the whole paragraph has been calculated, update cached
- // values:
- if ( 0 == nStt && GetTxt().Len() == nEnd )
- {
- SetParaNumberOfWords( nTmpWords );
- SetParaNumberOfChars( nTmpChars );
- SetParaNumberOfCharsExcludingSpaces( nTmpCharsExcludingSpaces );
- SetWordCountDirty( false );
- }
+ while ( aScanner.NextWord() )
+ {
+ ++nTmpWords;
+ nTmpCharsExcludingSpaces += aScanner.GetLen();
}
- rStat.nWord += nTmpWords;
- rStat.nChar += nTmpChars;
- rStat.nCharExcludingSpaces += nTmpCharsExcludingSpaces;
+ nTmpChars += nNumStringLen;
}
+ else if ( HasBullet() )
+ {
+ ++nTmpWords;
+ ++nTmpChars;
+ ++nTmpCharsExcludingSpaces;
+ }
+ }
+
+ delete pConversionMap;
+
+ // If counting the whole para then update cached values and mark clean
+ if ( isCountAll )
+ {
+ SetParaNumberOfWords( nTmpWords );
+ SetParaNumberOfChars( nTmpChars );
+ SetParaNumberOfCharsExcludingSpaces( nTmpCharsExcludingSpaces );
+ SetWordCountDirty( false );
}
+ // accumulate into DocStat record to return the values
+ rStat.nWord += nTmpWords;
+ rStat.nChar += nTmpChars;
+ rStat.nCharExcludingSpaces += nTmpCharsExcludingSpaces;
}
//
@@ -1981,17 +1995,17 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
//
struct SwParaIdleData_Impl
{
- SwWrongList* pWrong; // for spell checking
+ SwWrongList* pWrong; // for spell checking
SwGrammarMarkUp* pGrammarCheck; // for grammar checking / proof reading
SwWrongList* pSmartTags;
ULONG nNumberOfWords;
ULONG nNumberOfChars;
ULONG nNumberOfCharsExcludingSpaces;
- bool bWordCountDirty : 1;
- bool bWrongDirty : 1; // Ist das Wrong-Feld auf invalid?
- bool bGrammarCheckDirty : 1;
- bool bSmartTagDirty : 1;
- bool bAutoComplDirty : 1; // die ACompl-Liste muss angepasst werden
+ bool bWordCountDirty;
+ bool bWrongDirty; // Ist das Wrong-Feld auf invalid?
+ bool bGrammarCheckDirty;
+ bool bSmartTagDirty;
+ bool bAutoComplDirty; // die ACompl-Liste muss angepasst werden
SwParaIdleData_Impl() :
pWrong ( 0 ),
@@ -1999,7 +2013,7 @@ struct SwParaIdleData_Impl
pSmartTags ( 0 ),
nNumberOfWords ( 0 ),
nNumberOfChars ( 0 ),
- nNumberOfCharsExcludingSpaces ( 0 ),
+ nNumberOfCharsExcludingSpaces ( 0 ),
bWordCountDirty ( true ),
bWrongDirty ( true ),
bGrammarCheckDirty ( true ),
commit 66c52b972ac2d04012c79fbef00ab216976d68db
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Nov 2 16:20:46 2010 +0100
Date fields ww8 import: removed bad conversionfor for dates
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 315f2ed..dfbf2b4 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -981,9 +981,7 @@ namespace sw
case LANGUAGE_FRENCH_LUXEMBOURG:
case LANGUAGE_FRENCH_MONACO:
{
- if (nChar == 'a' || nChar == 'A')
- rParams.SetChar (nI, 'O');
- else if (nChar == 'y' || nChar == 'Y')
+ if (nChar == 'y' || nChar == 'Y')
rParams.SetChar (nI, 'A');
else if (nChar == 'd' || nChar == 'D')
rParams.SetChar (nI, 'J');
@@ -997,7 +995,7 @@ namespace sw
}
++nI;
}
-
+
if (bForceNatNum)
bForceJapanese = true;
commit 44500d2d7a1b9c608ea003292e3c323033c573cf
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Thu Oct 28 17:01:33 2010 +0200
Really easy annoying German comments translated
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 7ad1e8a..a9451a7 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -197,7 +197,7 @@ struct SwFldPack
--------------------------------------------------------------------*/
static const SwFldPack __FAR_DATA aSwFlds[] =
{
- // Dokument
+ // Document
{ TYP_EXTUSERFLD, FLD_EU_BEGIN, FLD_EU_END, 0, 0 },
{ TYP_AUTHORFLD, 0, 0, FMT_AUTHOR_BEGIN, FMT_AUTHOR_END },
{ TYP_DATEFLD, FLD_DATE_BEGIN, FLD_DATE_END, 0, 0 },
@@ -211,7 +211,7 @@ static const SwFldPack __FAR_DATA aSwFlds[] =
{ TYP_CHAPTERFLD, 0, 0, FMT_CHAPTER_BEGIN, FMT_CHAPTER_END },
{ TYP_TEMPLNAMEFLD, 0, 0, FMT_FF_BEGIN, FMT_FF_END },
- // Funktion
+ // Functions
{ TYP_CONDTXTFLD, 0, 0, 0, 0 },
{ TYP_DROPDOWN, 0, 0, 0, 0 },
{ TYP_INPUTFLD, FLD_INPUT_BEGIN, FLD_INPUT_END, 0, 0 },
@@ -221,21 +221,21 @@ static const SwFldPack __FAR_DATA aSwFlds[] =
{ TYP_HIDDENTXTFLD, 0, 0, 0, 0 },
{ TYP_HIDDENPARAFLD, 0, 0, 0, 0 },
- // Referenzen
+ // Cross-References
{ TYP_SETREFFLD, 0, 0, 0, 0 },
{ TYP_GETREFFLD, 0, 0, FMT_REF_BEGIN, FMT_REF_END },
- // Ablage
+ // DocInformation
{ TYP_DOCINFOFLD, 0, 0, FMT_REG_BEGIN, FMT_REG_END },
- // Datenbank
+ // Database
{ TYP_DBFLD, 0, 0, FMT_DBFLD_BEGIN, FMT_DBFLD_END },
{ TYP_DBNEXTSETFLD, 0, 0, 0, 0 },
{ TYP_DBNUMSETFLD, 0, 0, 0, 0 },
{ TYP_DBSETNUMBERFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-2 },
{ TYP_DBNAMEFLD, 0, 0, 0, 0 },
- // Variablen
+ // Variables
{ TYP_SETFLD, 0, 0, FMT_SETVAR_BEGIN, FMT_SETVAR_END },
{ TYP_GETFLD, 0, 0, FMT_GETVAR_BEGIN, FMT_GETVAR_END },
@@ -393,21 +393,21 @@ const SwFldGroupRgn& SwFldMgr::GetGroupRange(BOOL bHtmlMode, USHORT nGrpId) cons
{
static SwFldGroupRgn __READONLY_DATA aRanges[] =
{
- { /* Dokument */ GRP_DOC_BEGIN, GRP_DOC_END },
- { /* Funktionen */ GRP_FKT_BEGIN, GRP_FKT_END },
- { /* Referenzen */ GRP_REF_BEGIN, GRP_REF_END },
- { /* Ablage */ GRP_REG_BEGIN, GRP_REG_END },
- { /* DB */ GRP_DB_BEGIN, GRP_DB_END },
- { /* User */ GRP_VAR_BEGIN, GRP_VAR_END }
+ { /* Document */ GRP_DOC_BEGIN, GRP_DOC_END },
+ { /* Functions */ GRP_FKT_BEGIN, GRP_FKT_END },
+ { /* Cross-Refs */ GRP_REF_BEGIN, GRP_REF_END },
+ { /* DocInfos */ GRP_REG_BEGIN, GRP_REG_END },
+ { /* Database */ GRP_DB_BEGIN, GRP_DB_END },
+ { /* User */ GRP_VAR_BEGIN, GRP_VAR_END }
};
static SwFldGroupRgn __READONLY_DATA aWebRanges[] =
{
- { /* Dokument */ GRP_WEB_DOC_BEGIN, GRP_WEB_DOC_END },
- { /* Funktionen */ GRP_WEB_FKT_BEGIN, GRP_WEB_FKT_END },
- { /* Referenzen */ GRP_WEB_REF_BEGIN, GRP_WEB_REF_END },
- { /* Ablage */ GRP_WEB_REG_BEGIN, GRP_WEB_REG_END },
- { /* DB */ GRP_WEB_DB_BEGIN, GRP_WEB_DB_END },
- { /* User */ GRP_WEB_VAR_BEGIN, GRP_WEB_VAR_END }
+ { /* Document */ GRP_WEB_DOC_BEGIN, GRP_WEB_DOC_END },
+ { /* Functions */ GRP_WEB_FKT_BEGIN, GRP_WEB_FKT_END },
+ { /* Cross-Refs */ GRP_WEB_REF_BEGIN, GRP_WEB_REF_END },
+ { /* DocInfos */ GRP_WEB_REG_BEGIN, GRP_WEB_REG_END },
+ { /* Database */ GRP_WEB_DB_BEGIN, GRP_WEB_DB_END },
+ { /* User */ GRP_WEB_VAR_BEGIN, GRP_WEB_VAR_END }
};
if (bHtmlMode)
More information about the Libreoffice-commits
mailing list