summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/dbgoutsw.hxx2
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx96
-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
-rw-r--r--sw/source/ui/cctrl/actctrl.cxx9
-rw-r--r--sw/source/ui/inc/actctrl.hxx6
12 files changed, 232 insertions, 28 deletions
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index 26dc49d1fa27..635141a1bdc5 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -54,6 +54,7 @@ class SwNumRuleTbl;
class SwNumRule;
class SwOutlineNodes;
class SwTxtFmtColl;
+class SwNodeRange;
#define DBG_OUT_HERE printf("%s(%d):", __FILE__, __LINE__)
#define DBG_OUT_HERE_FN printf("%s(%d) %s:", __FILE__, __LINE__, __FUNCTION__)
@@ -88,6 +89,7 @@ SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule);
SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt);
SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts);
SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl);
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange);
template<typename tKey, typename tMember, typename fHashFunction>
String lcl_dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 4d88fbd1cb7a..e86a7d23b600 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -542,7 +542,7 @@ String lcl_dbg_out(const SwNode & rNode)
String aTmpStr;
aTmpStr += String("<node ", RTL_TEXTENCODING_ASCII_US);
- aTmpStr += String("index =\"", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String("index=\"", RTL_TEXTENCODING_ASCII_US);
aTmpStr += String::CreateFromInt32(rNode.GetIndex());
aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US);
@@ -672,7 +672,15 @@ String lcl_dbg_out(const SwNode & rNode)
}
}
else if (rNode.IsStartNode())
- aTmpStr += String("<start/>", RTL_TEXTENCODING_ASCII_US);
+ {
+ aTmpStr += String("<start end=\"", RTL_TEXTENCODING_ASCII_US);
+
+ const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode);
+ if (pStartNode != NULL)
+ aTmpStr += String::CreateFromInt32(pStartNode->EndOfSectionNode()->GetIndex());
+
+ aTmpStr += String("\"/>", RTL_TEXTENCODING_ASCII_US);
+ }
else if (rNode.IsEndNode())
aTmpStr += String("<end/>", RTL_TEXTENCODING_ASCII_US);
@@ -722,25 +730,68 @@ BOOL lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs)
return TRUE;
}
-String lcl_dbg_out(SwNodes & rNodes)
+void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, ULONG & nIndex)
{
- String aStr("<nodes>", RTL_TEXTENCODING_ASCII_US);
+ SwNode * pNode = rNodes[nIndex];
+ SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode);
+
+ SwNode * pEndNode = NULL;
+ if (pStartNode != NULL)
+ pEndNode = pStartNode->EndOfSectionNode();
+
+ ULONG nCount = rNodes.Count();
+ ULONG nStartIndex = nIndex;
+
+ bool bDone = false;
+
+ String aTag;
+ if (pNode->IsTableNode())
+ aTag += String("table", RTL_TEXTENCODING_ASCII_US);
+ else if (pNode->IsSectionNode())
+ aTag += String("section", RTL_TEXTENCODING_ASCII_US);
+ else
+ aTag += String("nodes", RTL_TEXTENCODING_ASCII_US);
- for (ULONG i = 0; i < rNodes.Count(); i++)
+ aStr += String("<", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">", RTL_TEXTENCODING_ASCII_US);
+
+ while (! bDone)
{
- SwNode * pNode = rNodes[i];
+ if (pNode->IsStartNode() && nIndex != nStartIndex)
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
+ else
+ {
+ aStr += lcl_dbg_out(*pNode);
+ aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
- if (pNode->IsEndNode())
- aStr += String("</nodes>\n", RTL_TEXTENCODING_ASCII_US);
+ nIndex++;
+ }
- aStr += lcl_dbg_out(*pNode);
- aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+ if (pNode == pEndNode || nIndex >= nCount)
+ bDone = true;
+ else
+ pNode = rNodes[nIndex];
+ }
+
+ aStr += String("</", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">\n", RTL_TEXTENCODING_ASCII_US);
+}
- if (pNode->IsStartNode())
- aStr += String("<nodes>", RTL_TEXTENCODING_ASCII_US);
+String lcl_dbg_out(SwNodes & rNodes)
+{
+ String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US);
+
+ ULONG nIndex = 0;
+ ULONG nCount = rNodes.Count();
+
+ while (nIndex < nCount)
+ {
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
}
- aStr += String("</nodes>\n", RTL_TEXTENCODING_ASCII_US);
+ aStr += String("</nodes-array>\n", RTL_TEXTENCODING_ASCII_US);
return aStr;
}
@@ -1028,5 +1079,24 @@ SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens)
{
return dbg_out(lcl_dbg_out(rTokens));
}
+
+String lcl_dbg_out(const SwNodeRange & rRange)
+{
+ String aStr("[", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += lcl_dbg_out(rRange.aStart);
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(rRange.aEnd);
+
+ aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange)
+{
+ return dbg_out(lcl_dbg_out(rRange));
+}
+
#endif // DEBUG
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 );
diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
index 4fbbbb9048bf..dfb2ef0ae4e6 100644
--- a/sw/source/ui/cctrl/actctrl.cxx
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -71,6 +71,15 @@ long NumEditAction::Notify( NotifyEvent& rNEvt )
Beschreibung: KeyInput fuer ShortName - Edits ohne Spaces
------------------------------------------------------------------------*/
+NoSpaceEdit::NoSpaceEdit( Window* pParent, const ResId& rResId)
+ : Edit(pParent, rResId),
+ sForbiddenChars(String::CreateFromAscii(" "))
+{
+}
+
+NoSpaceEdit::~NoSpaceEdit()
+{
+}
void NoSpaceEdit::KeyInput(const KeyEvent& rEvt)
{
diff --git a/sw/source/ui/inc/actctrl.hxx b/sw/source/ui/inc/actctrl.hxx
index d087a0a55753..789d6883c29a 100644
--- a/sw/source/ui/inc/actctrl.hxx
+++ b/sw/source/ui/inc/actctrl.hxx
@@ -66,10 +66,8 @@ protected:
virtual void Modify();
public:
- NoSpaceEdit( Window* pParent, const ResId& rResId)
- : Edit(pParent, rResId),
- sForbiddenChars(String::CreateFromAscii(" "))
- {}
+ NoSpaceEdit( Window* pParent, const ResId& rResId);
+ virtual ~NoSpaceEdit();
void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;}
const String& GetForbiddenChars(){return sForbiddenChars;}
};