summaryrefslogtreecommitdiff
path: root/sw/source/filter/rtf
diff options
context:
space:
mode:
authorjp <jp@openoffice.org>2001-02-13 08:24:35 +0000
committerjp <jp@openoffice.org>2001-02-13 08:24:35 +0000
commit105757787eed83f991c3424dcf1bc3a8b59f12c1 (patch)
treede818d607f8301bb5ee6b5d4d0bd9312f7c7fa87 /sw/source/filter/rtf
parentad355e2b2449421786c0abe8f9ee740e9153eae3 (diff)
Bug #83787#: export default attributes, which are different to RTF-specification
Diffstat (limited to 'sw/source/filter/rtf')
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx114
-rw-r--r--sw/source/filter/rtf/wrtrtf.cxx11
2 files changed, 115 insertions, 10 deletions
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index aa8788aa6fc0..21d4f8f8ca2c 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtfatr.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: jp $ $Date: 2000-12-21 16:20:36 $
+ * last change: $Author: jp $ $Date: 2001-02-13 09:24:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -88,6 +88,9 @@
#ifndef _RTFKEYWD_HXX //autogen
#include <svtools/rtfkeywd.hxx>
#endif
+#ifndef _SFX_WHITER_HXX
+#include <svtools/whiter.hxx>
+#endif
#ifndef _RTFOUT_HXX
#include <svtools/rtfout.hxx>
#endif
@@ -387,6 +390,101 @@ Writer& OutRTF_AsByteString( Writer& rWrt, const String& rStr )
return rWrt;
}
+void SwRTFWriter::Get_StyleDefaults( const SwFmt& rFmt )
+{
+ BOOL aFlags[ RES_FRMATR_END - RES_CHRATR_BEGIN ];
+ USHORT nStt = RES_CHRATR_BEGIN, nEnd, n;
+ SfxItemSet** ppSet;
+ if( RES_CHRFMT == rFmt.Which() )
+ {
+ ppSet = &pCharDefaults;
+ nEnd = RES_TXTATR_END;
+ }
+ else
+ {
+ ppSet = &pParaDefaults;
+ nEnd = RES_FRMATR_END;
+ }
+
+ *ppSet = new SfxItemSet( *rFmt.GetAttrSet().GetPool(), nStt, nEnd );
+
+ // dynamic defaults
+ const SfxItemPool& rPool = *rFmt.GetAttrSet().GetPool();
+ for( n = nStt; n < nEnd; ++n )
+ aFlags[ n - RES_CHRATR_BEGIN ] = 0 != rPool.GetPoolDefaultItem( n );
+
+ // static defaults, that differs between WinWord and SO
+ if( RES_CHRFMT != rFmt.Which() )
+ {
+ aFlags[ RES_PARATR_WIDOWS - RES_CHRATR_BEGIN ] = 1;
+ aFlags[ RES_PARATR_HYPHENZONE - RES_CHRATR_BEGIN ] = 1;
+ }
+ aFlags[ RES_CHRATR_FONTSIZE - RES_CHRATR_BEGIN ] = 1;
+// aFlags[ RES_CHRATR_CJK_FONTSIZE - RES_CHRATR_BEGIN ] = 1;
+// aFlags[ RES_CHRATR_CTL_FONTSIZE - RES_CHRATR_BEGIN ] = 1;
+
+ aFlags[ RES_CHRATR_LANGUAGE - RES_CHRATR_BEGIN ] = 1;
+// aFlags[ RES_CHRATR_CJK_LANGUAGE - RES_CHRATR_BEGIN ] = 1;
+// aFlags[ RES_CHRATR_CTL_LANGUAGE - RES_CHRATR_BEGIN ] = 1;
+
+ const BOOL* pFlags = aFlags + ( nStt - RES_CHRATR_BEGIN );
+ for( n = nStt; n < nEnd; ++n, ++pFlags )
+ if( *pFlags && SFX_ITEM_SET != rFmt.GetItemState( n, FALSE ))
+ (*ppSet)->Put( rFmt.GetAttr( n, TRUE ));
+}
+
+
+void OutRTF_SfxItemSet( Writer& rWrt, const SfxItemSet& rSet )
+{
+ // erst die eigenen Attribute ausgeben
+ const SfxItemPool& rPool = *rSet.GetPool();
+ SfxWhichIter aIter( rSet );
+ const SfxPoolItem* pItem;
+ FnAttrOut pOut;
+ register USHORT nWhich = aIter.FirstWhich();
+ while( nWhich )
+ {
+ if( SFX_ITEM_SET == rSet.GetItemState( nWhich, TRUE, &pItem ))
+ {
+ pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN];
+ if( pOut &&
+ ( *pItem != rPool.GetDefaultItem( nWhich )
+ || ( rSet.GetParent() &&
+ *pItem != rSet.GetParent()->Get( nWhich ) )
+ ) )
+ ;
+ else
+ pOut = 0;
+ }
+ else if( 0 != ( pItem = rPool.GetPoolDefaultItem( nWhich )) )
+ pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN];
+ else
+ switch( nWhich )
+ {
+ case RES_CHRATR_FONTSIZE:
+// case RES_CHRATR_CJK_FONTSIZE:
+// case RES_CHRATR_CTL_FONTSIZE:
+
+ case RES_CHRATR_LANGUAGE:
+// case RES_CHRATR_CJK_LANGUAGE:
+// case RES_CHRATR_CTL_LANGUAGE:
+
+ case RES_PARATR_WIDOWS:
+ case RES_PARATR_HYPHENZONE:
+ pItem = &rPool.GetDefaultItem( nWhich );
+ pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN];
+ break;
+
+ default:
+ pOut = 0;
+ }
+
+ if( pOut )
+ (*pOut)( rWrt, *pItem );
+ nWhich = aIter.NextWhich();
+ }
+}
+
// fuer die Formate muesste eine einzige Ausgabe-Funktion genuegen !
/*
* Formate wie folgt ausgeben:
@@ -436,7 +534,7 @@ Writer& OutRTF_SwFmt( Writer& rWrt, const SwFmt& rFmt )
aLR.SetTxtFirstLineOfst( pNFmt->GetFirstLineOffset() );
aSet.Put( aLR );
- Out_SfxItemSet( aRTFAttrFnTab, rWrt, aSet, TRUE );
+ OutRTF_SfxItemSet( rWrt, aSet );
bOutItemSet = FALSE;
}
}
@@ -459,7 +557,8 @@ Writer& OutRTF_SwFmt( Writer& rWrt, const SwFmt& rFmt )
}
if( bOutItemSet )
- Out_SfxItemSet( aRTFAttrFnTab, rWrt, rFmt.GetAttrSet(), TRUE );
+ OutRTF_SfxItemSet( rWrt, rFmt.GetAttrSet() );
+
return rWrt;
}
@@ -677,7 +776,7 @@ RTFEndPosLst::RTFEndPosLst( SwRTFWriter& rWriter, const SwTxtNode& rNd )
while( nChg < nLen )
{
USHORT nScript = pBreakIt->xBreak->getScriptType( rTxt, nChg );
- nChg = pBreakIt->xBreak->endOfScript( rTxt, nChg, nScript );
+ nChg = (xub_StrLen)pBreakIt->xBreak->endOfScript( rTxt, nChg, nScript );
switch( nScript )
{
case ::com::sun::star::i18n::ScriptType::LATIN:
@@ -3400,11 +3499,14 @@ SwNodeFnTab aRTFNodeFnTab = {
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/rtf/rtfatr.cxx,v 1.9 2000-12-21 16:20:36 jp Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/rtf/rtfatr.cxx,v 1.10 2001-02-13 09:24:35 jp Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
+ Revision 1.9 2000/12/21 16:20:36 jp
+ writegraphic optional in original format and not general as JPG
+
Revision 1.8 2000/12/12 14:37:48 jp
Bug #81815#: export rtl fonts with F instead of AF token
diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx
index a253bccf62c5..4d1df0b2ec7e 100644
--- a/sw/source/filter/rtf/wrtrtf.cxx
+++ b/sw/source/filter/rtf/wrtrtf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtrtf.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: mib $ $Date: 2001-02-06 15:55:19 $
+ * last change: $Author: jp $ $Date: 2001-02-13 09:24:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -229,7 +229,7 @@ ULONG SwRTFWriter::WriteStream()
bOutStyleTab = bOutTable = bOutPageDesc = bOutPageDescTbl =
bAutoAttrSet = bOutListNumTxt = bOutLeftHeadFoot = bIgnoreNextPgBreak =
- FALSE;
+ bTxtAttr = FALSE;
pCurEndPosLst = 0;
nBkmkTabPos = USHRT_MAX;
@@ -1418,11 +1418,14 @@ void GetRTFWriter( const String& rFltName, WriterRef& xRet )
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/rtf/wrtrtf.cxx,v 1.4 2001-02-06 15:55:19 mib Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/rtf/wrtrtf.cxx,v 1.5 2001-02-13 09:24:35 jp Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
+ Revision 1.4 2001/02/06 15:55:19 mib
+ real 6.0 file format
+
Revision 1.3 2000/11/16 09:57:36 jp
export CJK attributes