[Libreoffice-commits] .: sw/inc sw/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Sat Nov 13 18:45:33 PST 2010
sw/inc/ring.hxx | 3
sw/inc/unoframe.hxx | 2
sw/source/filter/rtf/rtffly.cxx | 23 +++++-
sw/source/filter/rtf/swparrtf.cxx | 19 ++++
sw/source/filter/ww8/docxattributeoutput.cxx | 2
sw/source/filter/ww8/rtfattributeoutput.cxx | 103 ++++++++++++++++++++-------
sw/source/filter/ww8/rtfattributeoutput.hxx | 5 -
sw/source/filter/ww8/rtfexport.cxx | 30 ++++++-
sw/source/filter/ww8/rtfexport.hxx | 8 +-
sw/source/filter/ww8/rtfsdrexport.cxx | 20 +++--
sw/source/filter/ww8/rtfsdrexport.hxx | 3
sw/source/filter/ww8/writerhelper.cxx | 16 +++-
sw/source/filter/ww8/writerhelper.hxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 39 ++++++----
sw/source/filter/ww8/wrtw8num.cxx | 2
sw/source/filter/ww8/wrtww8.cxx | 1
sw/source/filter/ww8/wrtww8.hxx | 6 +
sw/source/filter/ww8/ww8atr.cxx | 23 +++---
18 files changed, 226 insertions(+), 81 deletions(-)
New commits:
commit 645acb83118b0b38d82a3d0fd80f09cc9671fe8e
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Sun Nov 14 02:05:55 2010 +0100
RTF: port last changes from CWS
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index de64a96..238067c 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -28,9 +28,10 @@
#ifndef _RING_HXX
#define _RING_HXX
+#include <swdllapi.h>
#include <swtypes.hxx>
-class Ring
+class SW_DLLPUBLIC Ring
{
Ring *pNext;
Ring* pPrev; // zur Optimierung, damit das ein/ausketten schneller geht!
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 3696ea2..63ab263 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -159,7 +159,7 @@ public:
void ResetDescriptor();
//copy text from a given source PaM
void SetSelection(SwPaM& rCopySource);
- static SdrObject *GetOrCreateSdrObject( SwFlyFrmFmt *pFmt );
+ static SW_DLLPUBLIC SdrObject *GetOrCreateSdrObject( SwFlyFrmFmt *pFmt );
};
typedef cppu::WeakImplHelper3
diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index 4f1ba5a..2cfc999 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -61,6 +61,7 @@
#include <txtflcnt.hxx>
#include <fmtflcnt.hxx>
#include <fltini.hxx>
+#include <unoframe.hxx>
#include <deque>
#include <map>
#include <utility>
@@ -1293,7 +1294,7 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf,
aFlySet.Put(aSurroundItem);
}
- SwFrmFmt* pFlyFmt = pDoc->Insert( *pPam,
+ SwFlyFrmFmt* pFlyFmt = pDoc->Insert( *pPam,
rGrfNm, aEmptyStr, // Name der Graphic !!
pGrf,
&aFlySet, // Attribute fuer den FlyFrm
@@ -1305,6 +1306,26 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf,
_SetPictureSize( *pGrfNd, pPos->nNode,
(SfxItemSet&)pFlyFmt->GetAttrSet(),
pPicType );
+ if( pPicType )
+ {
+ PictPropertyNameValuePairs::const_iterator aIt = pPicType->aPropertyPairs.begin();
+ PictPropertyNameValuePairs::const_iterator aEnd = pPicType->aPropertyPairs.end();
+ while( aIt != aEnd)
+ {
+ if( aIt->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "wzDescription") ))
+ {
+ SwXFrame::GetOrCreateSdrObject( pFlyFmt );
+ pDoc->SetFlyFrmDescription( *(pFlyFmt), aIt->second );
+ }
+ else if( aIt->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "wzName") ))
+ {
+ SwXFrame::GetOrCreateSdrObject( pFlyFmt );
+ pDoc->SetFlyFrmTitle( *(pFlyFmt), aIt->second );
+ }
+ ++aIt;
+ }
+ }
+
}
if( pGrfAttrSet )
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 24ab947..b064a4c 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -1376,6 +1376,7 @@ void SwRTFParser::ReadShapeObject()
String shpTxt;
bool bshpTxt=false;
int txflTextFlow=0;
+ ::rtl::OUString sDescription, sName;
while (level>0 && IsParserWorking())
@@ -1433,7 +1434,14 @@ void SwRTFParser::ReadShapeObject()
{
txflTextFlow=aToken.ToInt32();
}
-
+ else if (sn.EqualsAscii("wzDescription"))
+ {
+ sDescription = aToken;
+ }
+ else if(sn.EqualsAscii("wzName"))
+ {
+ sName = aToken;
+ }
}
break;
case RTF_PICT:
@@ -1459,6 +1467,7 @@ void SwRTFParser::ReadShapeObject()
}
SkipToken(-1);
+ SdrObject* pSdrObject = 0;
switch(shapeType)
{
case 202: /* Text Box */
@@ -1478,6 +1487,7 @@ void SwRTFParser::ReadShapeObject()
const Rectangle aRect(FRound(aRange.getMinX()), FRound(aRange.getMinY()), FRound(aRange.getMaxX()), FRound(aRange.getMaxY()));
SdrRectObj* pStroke = new SdrRectObj(aRect);
+ pSdrObject = pStroke;
pStroke->SetSnapRect(aRect);
pDoc->GetOrCreateDrawModel(); // create model
InsertShpObject(pStroke, this->nZOrder++);
@@ -1525,6 +1535,7 @@ void SwRTFParser::ReadShapeObject()
aLine.append(aPointRightBottom);
SdrPathObj* pStroke = new SdrPathObj(OBJ_PLIN, ::basegfx::B2DPolyPolygon(aLine));
+ pSdrObject = pStroke;
//pStroke->SetSnapRect(aRect);
InsertShpObject(pStroke, this->nZOrder++);
@@ -1545,11 +1556,17 @@ void SwRTFParser::ReadShapeObject()
const Rectangle aRect(FRound(aRange.getMinX()), FRound(aRange.getMinY()), FRound(aRange.getMaxX()), FRound(aRange.getMaxY()));
SdrRectObj* pStroke = new SdrGrafObj(aGrf);
+ pSdrObject = pStroke;
pStroke->SetSnapRect(aRect);
InsertShpObject(pStroke, this->nZOrder++);
}
}
+ if( pSdrObject )
+ {
+ pSdrObject->SetDescription(sDescription);
+ pSdrObject->SetTitle(sName);
+ }
}
extern void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich,
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c06c1c8..bbac317 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2434,7 +2434,7 @@ void DocxAttributeOutput::NumberingLevel( BYTE nLevel,
FSNS( XML_w, XML_hint ), "default",
FSEND );
}
- m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN );
+ m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF );
m_pSerializer->endElementNS( XML_w, XML_rPr );
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index d13135b..8e0ed40 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -280,7 +280,8 @@ void RtfAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextN
if ( m_nTableDepth > 0 && !m_bTableCellOpen )
{
ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( pTextNodeInfo->getInnerForDepth( m_nTableDepth ) );
- if ( pDeepInner->getCell() == 0 )
+ OSL_ENSURE( pDeepInner, "TableNodeInfoInner not found");
+ if ( pDeepInner && pDeepInner->getCell() == 0 )
StartTableRow( pDeepInner );
StartTableCell( pDeepInner );
@@ -1393,7 +1394,7 @@ void RtfAttributeOutput::NumberingLevel( BYTE nLevel,
m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_F;
m_rExport.OutULong(m_rExport.maFontHelper.GetId(*pFont));
}
- m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN );
+ m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF );
m_rExport.Strm() << m_aStyles.makeStringAndClear();
}
@@ -1523,7 +1524,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
}
if ( pGrfNode )
- FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ FlyFrameGraphic( dynamic_cast<const SwFlyFrmFmt*>( &rFrame.GetFrmFmt() ), *pGrfNode, rFrame.GetLayoutSize() );
break;
case sw::Frame::eDrawing:
{
@@ -1689,16 +1690,23 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMDROPDOWN)), m_rExport.eCurrentEncoding));
m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list
+ m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultSelection"))) >>= aIntSeq;
- m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
- // a dropdown list can have only one 'selected item by default'
- m_aRun.append((sal_Int32)aIntSeq[0]);
+ if( aIntSeq.getLength() )
+ {
+ m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
+ // a dropdown list can have only one 'selected item by default'
+ m_aRun.append((sal_Int32)aIntSeq[0]);
+ }
xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SelectedItems"))) >>= aIntSeq;
- m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES);
- // a dropdown list can have only one 'currently selected item'
- m_aRun.append((sal_Int32)aIntSeq[0]);
+ if( aIntSeq.getLength() )
+ {
+ m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES);
+ // a dropdown list can have only one 'currently selected item'
+ m_aRun.append((sal_Int32)aIntSeq[0]);
+ }
sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"));
if (xPropSetInfo->hasPropertyByName(sName))
@@ -1729,7 +1737,6 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun.append('}');
}
- m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringItemList"))) >>= aStrSeq;
sal_uInt32 nListItems = aStrSeq.getLength();
@@ -1760,7 +1767,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
{
SwNodeIndex aIdx(*rFrmFmt.GetCntnt().GetCntntIdx(), 1);
SwOLENode& rOLENd = *aIdx.GetNode().GetOLENode();
- FlyFrameOLE(rOLENd, rFrame.GetLayoutSize());
+ FlyFrameOLE(dynamic_cast<const SwFlyFrmFmt*>( &rFrmFmt ), rOLENd, rFrame.GetLayoutSize());
}
}
break;
@@ -2665,15 +2672,33 @@ void RtfAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
{
if( m_rExport.bOutPageDescs )
{
- if( rULSpace.GetUpper() )
+
+ ASSERT( m_rExport.GetCurItemSet(), "Impossible" );
+ if ( !m_rExport.GetCurItemSet() )
+ return;
+
+ HdFtDistanceGlue aDistances( *m_rExport.GetCurItemSet() );
+
+ if ( aDistances.HasHeader() )
{
- m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGTSXN);
- m_aSectionBreaks.append((sal_Int32)rULSpace.GetUpper());
+ if( aDistances.dyaTop )
+ {
+ m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGTSXN);
+ m_aSectionBreaks.append((sal_Int32)aDistances.dyaTop);
+ }
+ m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_HEADERY);
+ m_aSectionBreaks.append((sal_Int32)aDistances.dyaHdrTop);
}
- if( rULSpace.GetLower() )
+
+ if( aDistances.HasFooter() )
{
- m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGBSXN);
- m_aSectionBreaks.append((sal_Int32)rULSpace.GetLower());
+ if( aDistances.dyaBottom )
+ {
+ m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGBSXN);
+ m_aSectionBreaks.append((sal_Int32)aDistances.dyaBottom);
+ }
+ m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_FOOTERY);
+ m_aSectionBreaks.append((sal_Int32)aDistances.dyaHdrBottom);
}
if (!m_bBufferSectionBreaks)
m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear();
@@ -2814,7 +2839,7 @@ void RtfAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
if( !rBrush.GetColor().GetTransparency() )
{
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHCBPAT);
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CBPAT);
m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor()));
}
}
@@ -3175,9 +3200,23 @@ static OString WriteHex(OString sString)
return aRet.makeStringAndClear();
}
-static OString ExportPICT(const Size &rOrig, const Size &rRendered, const Size &rMapped,
+void lcl_AppendSP( OStringBuffer& rBuffer,
+ const char cName[],
+ const ::rtl::OUString& rValue,
+ const RtfExport& rExport )
+{
+ rBuffer.append( "{" OOO_STRING_SVTOOLS_RTF_SP "{" ); // "{\sp{"
+ rBuffer.append( OOO_STRING_SVTOOLS_RTF_SN " " );//" \sn "
+ rBuffer.append( cName ); //"PropName"
+ rBuffer.append( "}{" OOO_STRING_SVTOOLS_RTF_SV " " );
+// "}{ \sv "
+ rBuffer.append( rExport.OutString( rValue, rExport.eCurrentEncoding ) );
+ rBuffer.append( "}}" );
+}
+
+static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, const Size &rRendered, const Size &rMapped,
const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry,
- unsigned long nSize)
+ unsigned long nSize, const RtfExport& rExport )
{
OStringBuffer aRet;
bool bIsWMF = (const char *)pBLIPType == (const char *)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false;
@@ -3185,6 +3224,18 @@ static OString ExportPICT(const Size &rOrig, const Size &rRendered, const Size &
{
aRet.append("{" OOO_STRING_SVTOOLS_RTF_PICT);
+ if( pFlyFrmFmt )
+ {
+ String sDescription = pFlyFrmFmt->GetObjDescription();
+ //write picture properties - wzDescription at first
+ //looks like: "{\*\picprop{\sp{\sn PropertyName}{\sv PropertyValue}}}"
+ aRet.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP );//"{\*\picprop
+ lcl_AppendSP( aRet, "wzDescription", sDescription, rExport );
+ String sName = pFlyFrmFmt->GetObjTitle();
+ lcl_AppendSP( aRet, "wzName", sName, rExport );
+ aRet.append( "}" ); //"}"
+ }
+
long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight());
long nYCroppedSize = rOrig.Height()-(rCr.GetTop() + rCr.GetBottom());
/* #127543#: Graphic with a zero height or width, typically copied from webpages, caused
@@ -3277,7 +3328,7 @@ void RtfAttributeOutput::FlyFrameOLEData( SwOLENode& rOLENode )
}
}
-void RtfAttributeOutput::FlyFrameOLE( SwOLENode& rOLENode, const Size& rSize )
+void RtfAttributeOutput::FlyFrameOLE( const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize )
{
OSL_TRACE("%s", OSL_THIS_FUNC);
@@ -3313,11 +3364,11 @@ void RtfAttributeOutput::FlyFrameOLE( SwOLENode& rOLENode, const Size& rSize )
nHeight-=nFontHeight/20;
m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_DN).append(nHeight);
m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
- m_aRunText.append(ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize));
+ m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
m_aRunText.append("}}}}");
}
-void RtfAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize )
+void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode& rGrfNode, const Size& rSize )
{
OSL_TRACE("%s", OSL_THIS_FUNC);
@@ -3390,7 +3441,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size&
m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
if (pBLIPType)
- m_aRunText.append(ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize));
+ m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport));
else
{
aStream.Seek(0);
@@ -3400,7 +3451,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size&
nSize = aStream.Tell();
pGraphicAry = (sal_uInt8*)aStream.GetData();
- m_aRunText.append(ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize));
+ m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
}
if (!bIsWMF)
@@ -3414,7 +3465,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size&
nSize = aStream.Tell();
pGraphicAry = (sal_uInt8*)aStream.GetData();
- m_aRunText.append(ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize));
+ m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
m_aRunText.append('}');
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 84c50b8..9b3923d 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -45,6 +45,7 @@ class RtfExport;
class SwGrfNode;
class SwOLENode;
class SdrObject;
+class SwFlyFrmFmt;
/// The class that has handlers for various resource types when exporting as RTF
class RtfAttributeOutput : public AttributeOutputBase
@@ -431,8 +432,8 @@ protected:
private:
/// Output graphic fly frames.
- void FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize );
- void FlyFrameOLE( SwOLENode& rOLENode, const Size& rSize );
+ void FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode& rGrfNode, const Size& rSize );
+ void FlyFrameOLE( const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize );
void FlyFrameOLEData( SwOLENode& rOLENode );
/*
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index d18482e..b3c0828 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -348,11 +348,31 @@ void RtfExport::DoComboBox(const rtl::OUString& /*rName*/,
// this is handled in RtfAttributeOutput::OutputFlyFrame_Impl
}
-void RtfExport::DoFormText(const SwInputField* /*pFld*/)
+void RtfExport::DoFormText(const SwInputField* pFld )
{
OSL_TRACE("%s", OSL_THIS_FUNC);
- // this is hanled in RtfAttributeOutput::OutputFlyFrame_Impl
+ ::rtl::OUString sResult = pFld->ExpandField(pDoc->IsClipBoard());
+ ::rtl::OUString sHelp( pFld->GetHelp() );
+ ::rtl::OUString sName = pFld->GetPar2();
+ ::rtl::OUString sStatus = pFld->GetToolTip();
+ m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST "{ FORMTEXT }");
+ m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD " {" OOO_STRING_SVTOOLS_RTF_FFTYPE "0" );
+ if( sHelp.getLength() )
+ m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFOWNHELP );
+ if( sStatus.getLength() )
+ m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFOWNSTAT );
+ m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFTYPETXT "0" );
+
+ if( sName.getLength() )
+ m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ").append( OutString( sName, eDefaultEncoding )).append( "}" );
+ if( sHelp.getLength() )
+ m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ").append( OutString( sHelp, eDefaultEncoding )).append( "}" );
+ m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFDEFTEXT " ").append( OutString( sResult, eDefaultEncoding )).append( "}" );
+ if( sStatus.getLength() )
+ m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ").append( OutString( sStatus, eDefaultEncoding )).append( "}");
+ m_pAttrOutput->RunText().append( "}}}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " " );
+ m_pAttrOutput->RunText().append( OutString( sResult, eDefaultEncoding )).append( "}}" );
}
ULONG RtfExport::ReplaceCr( BYTE )
@@ -765,6 +785,7 @@ RtfExport::RtfExport( RtfExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurren
eCurrentEncoding(eDefaultEncoding),
bRTFFlySyntax(false)
{
+ mbExportModeRTF = true;
// the attribute output for the document
m_pAttrOutput = new RtfAttributeOutput( *this );
// that just causes problems for RTF
@@ -915,7 +936,7 @@ OString RtfExport::OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEn
OString RtfExport::OutString(const String &rStr, rtl_TextEncoding eDestEnc)
{
OSL_TRACE("%s, rStr = '%s'", OSL_THIS_FUNC,
- OUStringToOString( OUString( rStr ), eCurrentEncoding ).getStr());
+ OUStringToOString( OUString( rStr ), eDestEnc ).getStr());
OStringBuffer aBuf;
int nUCMode = 1;
for (xub_StrLen n = 0; n < rStr.Len(); ++n)
@@ -1207,9 +1228,6 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader)
OSL_TRACE("%s start", OSL_THIS_FUNC);
- Strm() << (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY : OOO_STRING_SVTOOLS_RTF_FOOTERY);
- OutLong( pAktPageDesc->GetMaster().
- GetULSpace().GetUpper() );
const sal_Char* pStr = (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADER : OOO_STRING_SVTOOLS_RTF_FOOTER);
/* is this a title page? */
if( pAktPageDesc->GetFollow() && pAktPageDesc->GetFollow() != pAktPageDesc )
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 2f6bfce..5d5a186 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -82,7 +82,7 @@ public:
virtual RtfSdrExport& SdrExporter() const;
/// Hack, unfortunately necessary at some places for now.
- virtual bool HackIsWW8OrHigher() const { return true; }
+ virtual bool HackIsWW8OrHigher() const { return false; }
/// Guess the script (asian/western).
virtual bool CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich );
@@ -172,9 +172,9 @@ public:
SvStream& OutLong( long nVal );
void OutUnicode(const sal_Char *pToken, const String &rContent);
void OutDateTime(const sal_Char* pStr, const util::DateTime& rDT );
- rtl::OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc);
- rtl::OString OutString(const String &rStr, rtl_TextEncoding eDestEnc);
- rtl::OString OutHex(ULONG nHex, BYTE nLen);
+ static rtl::OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc);
+ static rtl::OString OutString(const String &rStr, rtl_TextEncoding eDestEnc);
+ static rtl::OString OutHex(ULONG nHex, BYTE nLen);
void OutPageDescription( const SwPageDesc& rPgDsc, BOOL bWriteReset, BOOL bCheckForFirstPage );
USHORT GetColor( const Color& rColor ) const;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index cfe0d26..f2a97c8 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -222,8 +222,9 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
m_aShapeProps.insert(std::pair<OString,OString>(OString("fNoFillHitTest"), OString::valueOf(sal_Int32(1))));
break;
case ESCHER_Prop_fNoLineDrawDash:
- if (it->nPropValue)
- m_aShapeProps.insert(std::pair<OString,OString>(OString("fNoLineDrawDash"), OString::valueOf(sal_Int32(1))));
+ // for some reason the value is set to 0x90000 if lines are switched off
+ if( it->nPropValue == 0x90000 )
+ m_aShapeProps.insert(std::pair<OString,OString>(OString("fLine"), OString::valueOf(sal_Int32(0))));
break;
case ESCHER_Prop_lineColor:
m_aShapeProps.insert(std::pair<OString,OString>(OString("lineColor"), OString::valueOf(sal_Int32(it->nPropValue))));
@@ -447,6 +448,13 @@ void RtfSdrExport::AddShapeAttribute( sal_Int32 /*nAttribute*/, const rtl::OStri
extern const char* pShapeTypes[];
+void lcl_AppendSP( ::rtl::OStringBuffer& rRunText, const char cName[], const ::rtl::OString& rValue)
+{
+ rRunText.append('{').append(OOO_STRING_SVTOOLS_RTF_SP)
+ .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}')
+ .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append(rValue).append('}')
+ .append('}');
+}
sal_Int32 RtfSdrExport::StartShape()
{
OSL_TRACE("%s", OSL_THIS_FUNC);
@@ -466,10 +474,10 @@ sal_Int32 RtfSdrExport::StartShape()
m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE);
for(std::map<OString,OString>::reverse_iterator i = m_aShapeProps.rbegin(); i != m_aShapeProps.rend(); i++)
- m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SP)
- .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append((*i).first).append('}')
- .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append((*i).second).append('}')
- .append('}');
+ lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first, (*i).second );
+
+ lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", RtfExport::OutString( m_pSdrObject->GetDescription(), m_rExport.eCurrentEncoding));
+ lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", RtfExport::OutString( m_pSdrObject->GetTitle(), m_rExport.eCurrentEncoding));
// now check if we have some text
const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx
index de618d6..b25f519 100644
--- a/sw/source/filter/ww8/rtfsdrexport.hxx
+++ b/sw/source/filter/ww8/rtfsdrexport.hxx
@@ -80,11 +80,13 @@ protected:
/// Start the shape for which we just collected the information.
///
/// Returns the element's tag number, -1 means we wrote nothing.
+ using EscherEx::StartShape;
virtual sal_Int32 StartShape();
/// End the shape.
///
/// The parameter is just what we got from StartShape().
+ using EscherEx::EndShape;
virtual void EndShape( sal_Int32 nShapeElement );
virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
@@ -94,6 +96,7 @@ private:
virtual void OpenContainer( UINT16 nEscherContainer, int nRecInstance = 0 );
virtual void CloseContainer();
+ using EscherEx::EnterGroup;
virtual UINT32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 );
virtual void LeaveGroup();
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 86a1478..9915fe1 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -466,9 +466,21 @@ namespace sw
}
//SetLayer boilerplate end
- void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems)
+ void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems, bool bExportParentItemSet )
{
- if (rSet.Count())
+ if( bExportParentItemSet )
+ {
+ USHORT nTotal = rSet.TotalCount();
+ for( USHORT nItem =0; nItem < nTotal; ++nItem )
+ {
+ const SfxPoolItem* pItem = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetWhichByPos( nItem ), true, &pItem ) )
+ {
+ rItems[pItem->Which()] = pItem;
+ }
+ }
+ }
+ else if( rSet.Count())
{
SfxItemIter aIter(rSet);
if (const SfxPoolItem *pItem = aIter.GetCurItem())
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index f758092..3cdd0c4 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -589,7 +589,7 @@ namespace sw
@author
<a href="mailto:cmc at openoffice.org">Caolán McNamara</a>
*/
- void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems);
+ void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems, bool bExportParentItemSet );
const SfxPoolItem *SearchPoolItems(const PoolItems &rItems,
sal_uInt16 eType);
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 209dad7..79da540 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -477,7 +477,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby )
ClearOverridesFromSet( *pCharFmtItem, aExportSet );
sw::PoolItems aExportItems;
- GetPoolItems( aExportSet, aExportItems );
+ GetPoolItems( aExportSet, aExportItems, false );
sw::cPoolItemIter aEnd = aRangeItems.end();
for ( sw::cPoolItemIter aI = aRangeItems.begin(); aI != aEnd; ++aI )
@@ -1601,7 +1601,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNo
GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos );
xub_StrLen nNextBookmark = nNextPos;
- NearestBookmark( nNextPos );
+ NearestBookmark( nNextPos, nAktPos, false );
return std::min( nNextPos, nNextBookmark );
}
@@ -1610,8 +1610,9 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt
{
xub_StrLen nNextPos;
- // either no bookmark, or it is not at the current position
- if ( !NearestBookmark( nNextPos ) || nNextPos > nAktPos )
+ // go to next attribute if no bookmark is found of if the bookmark is behind the next attribute position
+ bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true );
+ if( !bNextBookmark || nNextPos < aAttrIter->WhereNext() )
aAttrIter->NextPos();
}
@@ -1656,25 +1657,33 @@ public:
}
};
-bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest )
+bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly )
{
bool bHasBookmark = false;
if ( m_rSortedMarksStart.size( ) > 0 )
{
IMark* pMarkStart = m_rSortedMarksStart.front();
- rNearest = pMarkStart->GetMarkStart().nContent.GetIndex();
- bHasBookmark = true;
+ xub_StrLen nNext = pMarkStart->GetMarkStart().nContent.GetIndex();
+ if( !bNextPositionOnly || (nNext > nAktPos ))
+ {
+ rNearest = nNext;
+ bHasBookmark = true;
+ }
}
if ( m_rSortedMarksEnd.size( ) > 0 )
{
IMark* pMarkEnd = m_rSortedMarksEnd[0];
- if ( !bHasBookmark )
- rNearest = pMarkEnd->GetMarkEnd().nContent.GetIndex();
- else
- rNearest = std::min( rNearest, pMarkEnd->GetMarkEnd().nContent.GetIndex() );
- bHasBookmark = true;
+ xub_StrLen nNext = pMarkEnd->GetMarkEnd().nContent.GetIndex();
+ if( !bNextPositionOnly || nNext > nAktPos )
+ {
+ if ( !bHasBookmark )
+ rNearest = nNext;
+ else
+ rNearest = std::min( rNearest, nNext );
+ bHasBookmark = true;
+ }
}
return bHasBookmark;
@@ -1696,10 +1705,10 @@ void MSWordExportBase::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nA
xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex();
xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex();
- if ( nStart > nAktPos )
+ if ( nStart > nAktPos && ( pMark->GetMarkStart().nNode == rNode.GetIndex()) )
aSortedStart.push_back( pMark );
- if ( nEnd > nAktPos )
+ if ( nEnd > nAktPos && nEnd <= ( nAktPos + nLen ) && (pMark->GetMarkEnd().nNode == rNode.GetIndex()) )
aSortedEnd.push_back( pMark );
}
@@ -2298,7 +2307,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
pOutFmtNode = &rNode;
// Pap-Attrs, so script is not necessary
- OutputItemSet( *pNewSet, true, false, i18n::ScriptType::LATIN);
+ OutputItemSet( *pNewSet, true, false, i18n::ScriptType::LATIN, false);
pStyAttr = 0;
pOutFmtNode = pOldMod;
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 8a09059..56ffae3 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -267,7 +267,7 @@ void WW8AttributeOutput::NumberingLevel( BYTE /*nLevel*/,
m_rWW8Export.InsUInt16( nFontID );
}
- m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN );
+ m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rWW8Export.mbExportModeRTF );
m_rWW8Export.pO = pOldpO;
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 1ef3a03..c878cd7 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3325,6 +3325,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0),
pStyles( NULL ),
bHasHdr(false), bHasFtr(false), bSubstituteBullets(true),
+ mbExportModeRTF( false ),
pDoc( pDocument ),
pCurPam( pCurrentPam ),
pOrigPam( pOriginalPam )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index a1529b4..d1ec023 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -543,6 +543,8 @@ public:
BYTE bHasHdr : 1;
BYTE bHasFtr : 1;
BYTE bSubstituteBullets : 1; // true: SubstituteBullet() gets called
+
+ bool mbExportModeRTF;
SwDoc *pDoc;
SwPaM *pCurPam, *pOrigPam;
@@ -593,7 +595,7 @@ public:
void AppendWordBookmark( const String& rName );
/// Use OutputItem() on an item set according to the parameters.
- void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript );
+ void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript, bool bExportParentItemSet );
short GetDefaultFrameDirection( ) const;
@@ -800,7 +802,7 @@ protected:
/// Find the nearest bookmark from the current position.
///
/// Returns false when there is no bookmark.
- bool NearestBookmark( xub_StrLen& rNearest );
+ bool NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly );
void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos,
xub_StrLen nLen );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d17483c..a2163be 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -271,20 +271,21 @@ void MSWordExportBase::ExportPoolItemsToCHP( sw::PoolItems &rItems, USHORT nScri
* - gebe die Attribute aus; ohne Parents!
*/
-void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript )
+void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript,
+ bool bExportParentItemSet )
{
- if ( rSet.Count() )
+ if( bExportParentItemSet || rSet.Count() )
{
const SfxPoolItem* pItem;
pISet = &rSet; // fuer Doppel-Attribute
// If frame dir is set, but not adjust, then force adjust as well
- if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, false ) )
+ if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, bExportParentItemSet ) )
{
// No explicit adjust set ?
- if ( SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_ADJUST, false ) )
+ if ( SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_ADJUST, bExportParentItemSet ) )
{
- if ( 0 != ( pItem = rSet.GetItem( RES_PARATR_ADJUST ) ) )
+ if ( 0 != ( pItem = rSet.GetItem( RES_PARATR_ADJUST, bExportParentItemSet ) ) )
{
// then set the adjust used by the parent format
AttrOutput().OutputItem( *pItem );
@@ -292,7 +293,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool
}
}
- if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pItem ) )
+ if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, bExportParentItemSet, &pItem ) )
{
AttrOutput().OutputItem( *pItem );
@@ -307,7 +308,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool
}
sw::PoolItems aItems;
- GetPoolItems( rSet, aItems );
+ GetPoolItems( rSet, aItems, bExportParentItemSet );
if ( bChpFmt )
ExportPoolItemsToCHP(aItems, nScript);
@@ -783,7 +784,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
aSet.Put( aLR );
CorrectTabStopInSet( aSet, rNFmt.GetAbsLSpace() );
OutputItemSet( aSet, bPapFmt, bChpFmt,
- i18n::ScriptType::LATIN);
+ i18n::ScriptType::LATIN, mbExportModeRTF);
bCallOutSet = false;
}
}
@@ -801,7 +802,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
ItemGet<SvxLRSpaceItem>(aSet, RES_LR_SPACE));
aSet.Put( aLR );
OutputItemSet( aSet, bPapFmt, bChpFmt,
- com::sun::star::i18n::ScriptType::LATIN);
+ com::sun::star::i18n::ScriptType::LATIN, mbExportModeRTF);
bCallOutSet = false;
}
// <--
@@ -841,7 +842,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
bOutFlyFrmAttrs = true;
//script doesn't matter if not exporting chp
OutputItemSet(aSet, true, false,
- i18n::ScriptType::LATIN);
+ i18n::ScriptType::LATIN, mbExportModeRTF);
bOutFlyFrmAttrs = false;
bCallOutSet = false;
@@ -855,7 +856,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
if( bCallOutSet )
OutputItemSet( rFmt.GetAttrSet(), bPapFmt, bChpFmt,
- i18n::ScriptType::LATIN);
+ i18n::ScriptType::LATIN, mbExportModeRTF);
pOutFmtNode = pOldMod;
}
More information about the Libreoffice-commits
mailing list