summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx1
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx13
-rw-r--r--sw/source/filter/ww8/ww8par.cxx64
-rw-r--r--sw/source/filter/ww8/ww8par.hxx3
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx1
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx46
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx12
8 files changed, 136 insertions, 11 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index daa881ba0d1f..74020ab39e4a 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -449,7 +449,6 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
for (rtfSections::myrDummyIter aI = maSegments.maDummyPageNos.rbegin(); aI != aDEnd; ++aI)
pDoc->DelPageDesc(*aI);
-
if( aFlyArr.Count() )
SetFlysInDoc();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 41d0f2f3738c..8249c5d9b9c2 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3757,8 +3757,17 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
UINT16 nHeight = rGrid.GetBaseHeight() + rGrid.GetRubyHeight();
m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch );
m_rWW8Export.InsUInt16( nHeight );
- sal_uInt32 nPageCharSize = ItemGet<SvxFontHeightItem>(*(m_rWW8Export.pStyles->GetSwFmt()),
- RES_CHRATR_CJK_FONTSIZE).GetHeight();
+
+ WW8WrtStyle * pStyles = rWrtWW8.pStyles;
+ SwFmt * pSwFmt = pStyles->GetSwFmt();
+
+ sal_uInt32 nPageCharSize = 0;
+
+ if (pSwFmt != NULL)
+ {
+ nPageCharSize = ItemGet<SvxFontHeightItem>
+ (*pSwFmt, RES_CHRATR_CJK_FONTSIZE).GetHeight();
+ }
INT32 nCharWidth = rGrid.GetBaseWidth() - nPageCharSize;
INT32 nFraction = 0;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0aaa52152310..af28c6c66704 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2181,6 +2181,66 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
switch (pLang->GetLanguage())
{
case LANGUAGE_CZECH:
+ case LANGUAGE_HUNGARIAN:
+ case LANGUAGE_POLISH:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1250;
+ break;
+ case LANGUAGE_RUSSIAN:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1251;
+ break;
+ case LANGUAGE_GREEK:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1253;
+ break;
+ case LANGUAGE_TURKISH:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1254;
+ break;
+ default:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1252;
+ break;
+ }
+ }
+ }
+ }
+ return eSrcCharSet;
+}
+
+//Takashi Ono for CJK
+CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
+{
+ /*
+ #i2015
+ If the hard charset is set use it, if not see if there is an open
+ character run that has set the charset, if not then fallback to the
+ current underlying paragraph style.
+ */
+ CharSet eSrcCharSet = eHardCharSet;
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ {
+ if (!maFontSrcCJKCharSets.empty())
+ eSrcCharSet = maFontSrcCJKCharSets.top();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
+ eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ { // patch from cmc for #i52786#
+ /*
+ #i22206#/#i52786#
+ The (default) character set used for a run of text is the default
+ character set for the version of Word that last saved the document.
+
+ This is a bit tentative, more might be required if the concept is correct.
+ When later version of word write older 6/95 documents the charset is
+ correctly set in the character runs involved, so its hard to reproduce
+ documents that require this to be sure of the process involved.
+ */
+ const SvxLanguageItem *pLang =
+ (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE);
+ if (pLang)
+ {
+ switch (pLang->GetLanguage())
+ {
+ case LANGUAGE_CZECH:
eSrcCharSet = RTL_TEXTENCODING_MS_1250;
break;
default:
@@ -2339,6 +2399,8 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() :
RTL_TEXTENCODING_MS_1252;
+ const CharSet eSrcCJKCharSet = bVer67 ? GetCurrentCJKCharSet() :
+ RTL_TEXTENCODING_MS_1252;
// (re)alloc UniString data
String sPlainCharsBuf;
@@ -2399,7 +2461,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
sal_Char aTest[2];
aTest[0] = static_cast< sal_Char >((nUCode & 0xFF00) >> 8);
aTest[1] = static_cast< sal_Char >(nUCode & 0x00FF);
- String aTemp(aTest, 2, eSrcCharSet);
+ String aTemp(aTest, 2, eSrcCJKCharSet);
ASSERT(aTemp.Len() == 1, "so much for that theory");
*pWork = aTemp.GetChar(0);
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 777b2e0055c3..93a20df1576c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -933,6 +933,7 @@ private:
Stack of textencoding being used as we progress through the document text
*/
std::stack<rtl_TextEncoding> maFontSrcCharSets;
+ std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
/*
Winword numbering gets imported as SwNumRules, there is a problem that
@@ -1173,6 +1174,7 @@ private:
rtl_TextEncoding&);
bool SetNewFontAttr(USHORT nFCode, bool bSetEnums, USHORT nWhich);
void ResetCharSetVars();
+ void ResetCJKCharSetVars();
const SfxPoolItem* GetFmtAttr( USHORT nWhich );
bool JoinNode(SwPaM &rPam, bool bStealAttr = false);
@@ -1615,6 +1617,7 @@ public: // eigentlich private, geht aber leider nur public
// Laden eines kompletten DocFiles
ULONG LoadDoc( SwPaM&,WW8Glossary *pGloss=0);
CharSet GetCurrentCharSet();
+ CharSet GetCurrentCJKCharSet();
void PostProcessAttrs();
};
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0dffb74b6dd0..e578de63ca9b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4725,4 +4725,11 @@ CharSet SwWW8StyInf::GetCharSet() const
return eLTRFontSrcCharSet;
}
+CharSet SwWW8StyInf::GetCJKCharSet() const
+{
+ if ((pFmt) && (pFmt->GetFrmDir().GetValue() == FRMDIR_HORI_RIGHT_TOP))
+ return eRTLFontSrcCharSet;
+ return eCJKFontSrcCharSet;
+}
+
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index 1d26e384a61c..302227fca0fe 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -224,6 +224,7 @@ public:
return pOutlineNumrule;
}
CharSet GetCharSet() const;
+ CharSet GetCJKCharSet() const;
};
class WW8RStyle: public WW8Style
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index ab60c37a899b..c01991b51343 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3557,11 +3557,32 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums,
//off the stack will keep in sync
if (!pAktColl && IsListOrDropcap())
{
- if (!maFontSrcCharSets.empty())
- eSrcCharSet = maFontSrcCharSets.top();
+ if (nWhich == RES_CHRATR_CJK_FONT)
+ {
+ if (!maFontSrcCJKCharSets.empty())
+ {
+ eSrcCharSet = maFontSrcCJKCharSets.top();
+ }
+ else
+ {
+ eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
+ }
+
+ maFontSrcCJKCharSets.push(eSrcCharSet);
+ }
else
- eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
- maFontSrcCharSets.push(eSrcCharSet);
+ {
+ if (!maFontSrcCharSets.empty())
+ {
+ eSrcCharSet = maFontSrcCharSets.top();
+ }
+ else
+ {
+ eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
+ }
+
+ maFontSrcCharSets.push(eSrcCharSet);
+ }
}
return false;
}
@@ -3591,7 +3612,10 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums,
else if (IsListOrDropcap())
{
//Add character text encoding to stack
- maFontSrcCharSets.push(eSrcCharSet);
+ if (nWhich == RES_CHRATR_CJK_FONT)
+ maFontSrcCJKCharSets.push(eSrcCharSet);
+ else
+ maFontSrcCharSets.push(eSrcCharSet);
}
}
@@ -3607,6 +3631,13 @@ void SwWW8ImplReader::ResetCharSetVars()
maFontSrcCharSets.pop();
}
+void SwWW8ImplReader::ResetCJKCharSetVars()
+{
+ ASSERT(!maFontSrcCJKCharSets.empty(),"no charset to remove");
+ if (!maFontSrcCJKCharSets.empty())
+ maFontSrcCJKCharSets.pop();
+}
+
/*
Font ein oder ausschalten:
*/
@@ -3637,7 +3668,10 @@ void SwWW8ImplReader::Read_FontCode( USHORT nId, const BYTE* pData, short nLen )
if( nLen < 0 ) // Ende des Attributes
{
pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
- ResetCharSetVars();
+ if (nId == RES_CHRATR_CJK_FONT)
+ ResetCJKCharSetVars();
+ else
+ ResetCharSetVars();
}
else
{
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f3a4c3630e4c..3a1f6e96c651 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1498,8 +1498,15 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
}
INT32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
if( 8 <= pWw8Fib->nVersion )
+ {
nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart,
bIsUnicode );
+ }
+ else
+ {
+ if (pWw8Fib->fExtChar)
+ bIsUnicode=true;
+ }
INT32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1);
/*
@@ -1581,7 +1588,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
if (8 > pWw8Fib->nVersion)
- *pIsUnicode = false;
+ if (pWw8Fib->fExtChar)
+ *pIsUnicode=true;
+ else
+ *pIsUnicode = false;
else
nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode );