summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-14 14:38:38 +0200
committerobo <obo@openoffice.org>2010-06-14 14:38:38 +0200
commit286ef2265ee71a2c7bb1ff64000ff3e468f4b842 (patch)
tree30a46eab229fd437e3c0b563a76a69e0735d241e /sw
parentf536dbf880c747403a9aed3a047487b8075d282f (diff)
parentfc05fe92f96dbc40329e87f6cf9296cc6dee4511 (diff)
CWS-TOOLING: integrate CWS hb33issues01
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/swtblfmt.hxx2
-rw-r--r--sw/source/filter/rtf/wrtrtf.cxx4
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx36
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.hxx13
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx12
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx38
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx91
10 files changed, 157 insertions, 50 deletions
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 33d38e42ba55..96479197cde6 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -31,7 +31,7 @@
class SwDoc;
-class SwTableFmt : public SwFrmFmt
+class SW_DLLPUBLIC SwTableFmt : public SwFrmFmt
{
friend class SwDoc;
diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx
index 34fe44eae053..8e17bee3874b 100644
--- a/sw/source/filter/rtf/wrtrtf.cxx
+++ b/sw/source/filter/rtf/wrtrtf.cxx
@@ -85,9 +85,6 @@ const sal_Char SwRTFWriter::sNewLine = '\012';
const sal_Char __FAR_DATA SwRTFWriter::sNewLine[] = "\015\012";
#endif
-static ::rtl::OUString aEmpty;
-
-
SV_DECL_VARARR( RTFColorTbl, Color, 5, 8 )
SV_IMPL_VARARR( RTFColorTbl, Color )
@@ -1302,6 +1299,7 @@ void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos)
OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKEND ) << ' ';
{
+ ::rtl::OUString aEmpty;
::rtl::OUString & rBookmarkName = aEmpty;
if (pAsBookmark)
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 4bee56fa12ef..f0aada5068ab 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -53,6 +53,7 @@ WW8TableNodeInfoInner::WW8TableNodeInfoInner(WW8TableNodeInfo * pParent)
, mnShadowsAfter(0)
, mbEndOfLine(false)
, mbEndOfCell(false)
+, mbFirstInTable(false)
, mbVertMerge(false)
, mpTableBox(NULL)
, mpTable(NULL)
@@ -98,7 +99,13 @@ void WW8TableNodeInfoInner::setEndOfCell(bool bEndOfCell)
mbEndOfCell = bEndOfCell;
}
+void WW8TableNodeInfoInner::setFirstInTable(bool bFirstInTable)
+{
+ mbFirstInTable = bFirstInTable;
+}
+
void WW8TableNodeInfoInner::setVertMerge(bool bVertMerge)
+
{
mbVertMerge = bVertMerge;
}
@@ -153,6 +160,11 @@ bool WW8TableNodeInfoInner::isEndOfLine() const
return mbEndOfLine;
}
+bool WW8TableNodeInfoInner::isFirstInTable() const
+{
+ return mbFirstInTable;
+}
+
const SwNode * WW8TableNodeInfoInner::getNode() const
{
const SwNode * pResult = NULL;
@@ -400,11 +412,25 @@ void WW8TableNodeInfo::setEndOfCell(bool bEndOfCell)
#endif
}
+void WW8TableNodeInfo::setFirstInTable(bool bFirstInTable)
+{
+ WW8TableNodeInfoInner::Pointer_t pInner = getInnerForDepth(mnDepth);
+
+ pInner->setFirstInTable(bFirstInTable);
+
+#ifdef DEBUG
+ ::std::clog << "<firstInTable depth=\"" << mnDepth << "\">"
+ << toString() << "</firstInTable>" << ::std::endl;
+#endif
+}
+
void WW8TableNodeInfo::setVertMerge(bool bVertMerge)
{
WW8TableNodeInfoInner::Pointer_t pInner = getInnerForDepth(mnDepth);
+
pInner->setVertMerge(bVertMerge);
+
#ifdef DEBUG
::std::clog << "<vertMerge depth=\"" << mnDepth << "\">"
<< toString() << "</vertMerge>" << ::std::endl;
@@ -868,6 +894,16 @@ WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo
pNodeInfo->setCell(nCell);
pNodeInfo->setRow(nRow);
+ if (pNode->IsTxtNode())
+ {
+ FirstInTableMap_t::const_iterator aIt = mFirstInTableMap.find(pTable);
+ if (aIt == mFirstInTableMap.end())
+ {
+ mFirstInTableMap[pTable] = pNode;
+ pNodeInfo->setFirstInTable(true);
+ }
+ }
+
if (pRect)
{
WW8TableCellGrid::Pointer_t pCellGrid = getCellGridForTable(pTable);
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx
index 47397310bd2d..b844615fecad 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -67,6 +67,7 @@ class WW8TableNodeInfoInner
sal_uInt32 mnShadowsAfter;
bool mbEndOfLine;
bool mbEndOfCell;
+ bool mbFirstInTable;
bool mbVertMerge;
const SwTableBox * mpTableBox;
const SwTable * mpTable;
@@ -85,6 +86,7 @@ public:
void setShadowsAfter(sal_uInt32 nShadowsAfter);
void setEndOfLine(bool bEndOfLine);
void setEndOfCell(bool bEndOfCell);
+ void setFirstInTable(bool bFirstInTable);
void setVertMerge(bool bVertMErge);
void setTableBox(const SwTableBox * pTableBox);
void setTable(const SwTable * pTable);
@@ -97,6 +99,7 @@ public:
sal_uInt32 getShadowsAfter() const;
bool isEndOfCell() const;
bool isEndOfLine() const;
+ bool isFirstInTable() const;
bool isVertMerge() const;
const SwTableBox * getTableBox() const;
const SwTable * getTable() const;
@@ -140,6 +143,7 @@ public:
void setDepth(sal_uInt32 nDepth);
void setEndOfLine(bool bEndOfLine);
void setEndOfCell(bool bEndOfCell);
+ void setFirstInTable(bool bFirstInTable);
void setVertMerge(bool bVertMerge);
void setTableBox(const SwTableBox *pTableBox);
void setTable(const SwTable * pTable);
@@ -155,6 +159,7 @@ public:
sal_uInt32 getDepth() const;
bool isEndOfLine() const;
bool isEndOfCell() const;
+ bool isFirstInTable() const;
const SwNode * getNode() const;
const SwTableBox * getTableBox() const;
const SwTable * getTable() const;
@@ -247,11 +252,14 @@ class WW8TableInfo
{
friend class WW8TableNodeInfoInner;
typedef hash_map<const SwNode *, WW8TableNodeInfo::Pointer_t, hashNode > Map_t;
- typedef hash_map<const SwTable *, WW8TableCellGrid::Pointer_t, hashTable > CellGridMap_t;
-
Map_t mMap;
+
+ typedef hash_map<const SwTable *, WW8TableCellGrid::Pointer_t, hashTable > CellGridMap_t;
CellGridMap_t mCellGridMap;
+ typedef hash_map<const SwTable *, const SwNode *, hashTable > FirstInTableMap_t;
+ FirstInTableMap_t mFirstInTableMap;
+
WW8TableNodeInfo *
processTableLine(const SwTable * pTable,
const SwTableLine * pTableLine,
@@ -295,6 +303,7 @@ public:
WW8TableNodeInfo * processSwTableByLayout(const SwTable * pTable);
WW8TableNodeInfo::Pointer_t getTableNodeInfo(const SwNode * pNode);
const SwNode * getNextNode(const SwNode * pNode);
+ const WW8TableNodeInfo * getFirstTableNodeInfo() const;
WW8TableNodeInfo * reorderByLayout(const SwTable * pTable);
};
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 5e1ca48b5ab3..6f69f8e591a5 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -232,6 +232,8 @@ public:
virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) = 0;
+ virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) = 0;
+
virtual void TableRowEnd( sal_uInt32 nDepth ) = 0;
/// Start of the styles table.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2e22e3518c90..0a6151b98388 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1440,6 +1440,13 @@ void DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_
OSL_TRACE( "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" );
}
+void DocxAttributeOutput::TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO: DocxAttributeOutput::TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" );
+#endif
+}
+
void DocxAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ )
{
OSL_TRACE( "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 76ad1dc354ea..6e6dcf813767 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -77,6 +77,7 @@
#include <doc.hxx>
#include <docary.hxx>
#include <swtable.hxx>
+#include <swtblfmt.hxx>
#include <section.hxx>
#include <pagedesc.hxx>
#include <swrect.hxx>
@@ -1899,6 +1900,17 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
#endif
AttrOutput().TableInfoCell( pTextNodeInfoInner );
+ if (pTextNodeInfoInner->isFirstInTable())
+ {
+ const SwTable * pTable = pTextNodeInfoInner->getTable();
+ const SwTableFmt * pTabFmt =
+ dynamic_cast<const SwTableFmt *>(pTable->GetRegisteredIn());
+ if (pTabFmt != NULL)
+ {
+ if (pTabFmt->GetBreak().GetBreak() == SVX_BREAK_PAGE_BEFORE)
+ AttrOutput().PageBreakBefore(true);
+ }
+ }
}
if ( !bFlyInTable )
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index d5cdbf731375..d46b59d91249 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -58,10 +58,12 @@
#include <filter/msfilter/msoleexp.hxx>
#include <filter/msfilter/msocximex.hxx>
#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brshitem.hxx>
#include <swtypes.hxx>
#include <swrect.hxx>
+#include <swtblfmt.hxx>
#include <txatbase.hxx>
#include <fmtcntnt.hxx>
#include <fmtpdsc.hxx>
@@ -1911,6 +1913,7 @@ void WW8AttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTa
TableBidi( pTableTextNodeInfoInner );
TableVerticalCell( pTableTextNodeInfoInner );
TableOrientation( pTableTextNodeInfoInner );
+ TableSpacing( pTableTextNodeInfoInner );
}
}
}
@@ -2093,6 +2096,41 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t
}
}
+void WW8AttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+{
+ const SwTable * pTable = pTableTextNodeInfoInner->getTable();
+ const SwTableFmt * pTableFmt = dynamic_cast<const SwTableFmt *>(pTable->GetRegisteredIn());
+
+ if (pTableFmt != NULL)
+ {
+ const SvxULSpaceItem & rUL = pTableFmt->GetULSpace();
+
+ if (rUL.GetUpper() > 0)
+ {
+ sal_uInt8 nPadding = 2;
+ sal_uInt8 nPcVert = 0;
+ sal_uInt8 nPcHorz = 0;
+
+ sal_uInt8 nTPc = (nPadding << 4) | (nPcVert << 2) | nPcHorz;
+
+ m_rWW8Export.InsUInt16(NS_sprm::LN_TPc);
+ m_rWW8Export.pO->Insert( nTPc, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16(NS_sprm::LN_TDyaAbs);
+ m_rWW8Export.InsUInt16(rUL.GetUpper());
+
+ m_rWW8Export.InsUInt16(NS_sprm::LN_TDyaFromText);
+ m_rWW8Export.InsUInt16(rUL.GetUpper());
+ }
+
+ if (rUL.GetLower() > 0)
+ {
+ m_rWW8Export.InsUInt16(NS_sprm::LN_TDyaFromTextBottom);
+ m_rWW8Export.InsUInt16(rUL.GetLower());
+ }
+ }
+}
+
void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index b9d9038b484b..b9d9ba38c246 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -124,6 +124,8 @@ public:
virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+ virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
virtual void TableRowEnd( sal_uInt32 nDepth = 1 );
/// Start of the styles table.
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5808e3981223..983bc9c73c77 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -573,60 +573,63 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
aSet.Put( SdrTextVertAdjustItem( eTVA ) );
aSet.Put( SdrTextHorzAdjustItem( eTHA ) );
- pObj->SetMergedItemSet(aSet);
- pObj->SetModel(pSdrModel);
+ if (pObj != NULL)
+ {
+ pObj->SetMergedItemSet(aSet);
+ pObj->SetModel(pSdrModel);
- if (bVerticalText && dynamic_cast< SdrTextObj* >( pObj ) )
- dynamic_cast< SdrTextObj* >( pObj )->SetVerticalWriting(sal_True);
+ if (bVerticalText && dynamic_cast< SdrTextObj* >( pObj ) )
+ dynamic_cast< SdrTextObj* >( pObj )->SetVerticalWriting(sal_True);
- if ( bIsSimpleDrawingTextBox )
- {
- if ( nTextRotationAngle )
+ if ( bIsSimpleDrawingTextBox )
{
- long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ?
- rTextRect.GetWidth() : rTextRect.GetHeight();
- nMinWH /= 2;
- Point aPivot(rTextRect.TopLeft());
- aPivot.X() += nMinWH;
- aPivot.Y() += nMinWH;
- double a = nTextRotationAngle * nPi180;
- pObj->NbcRotate(aPivot, nTextRotationAngle, sin(a), cos(a));
+ if ( nTextRotationAngle )
+ {
+ long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ?
+ rTextRect.GetWidth() : rTextRect.GetHeight();
+ nMinWH /= 2;
+ Point aPivot(rTextRect.TopLeft());
+ aPivot.X() += nMinWH;
+ aPivot.Y() += nMinWH;
+ double a = nTextRotationAngle * nPi180;
+ pObj->NbcRotate(aPivot, nTextRotationAngle, sin(a), cos(a));
+ }
}
- }
- if ( ( ( rObjData.nSpFlags & SP_FFLIPV ) || mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) )
- {
- SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj );
+ if ( ( ( rObjData.nSpFlags & SP_FFLIPV ) || mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) )
+ {
+ SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj );
- double fExtraTextRotation = 0.0;
- if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape ) & 4 ) )
- { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false
- fExtraTextRotation = -mnFix16Angle;
- }
- if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text
- { // remains unchanged, so we have to take back the flipping here
- fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped.
+ double fExtraTextRotation = 0.0;
+ if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape ) & 4 ) )
+ { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false
+ fExtraTextRotation = -mnFix16Angle;
+ }
+ if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text
+ { // remains unchanged, so we have to take back the flipping here
+ fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped.
+ }
+ fExtraTextRotation += nTextRotationAngle;
+ if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) )
+ {
+ fExtraTextRotation /= 100.0;
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ com::sun::star::beans::PropertyValue aPropVal;
+ aPropVal.Name = sTextRotateAngle;
+ aPropVal.Value <<= fExtraTextRotation;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ pCustomShape->SetMergedItem( aGeometryItem );
+ }
}
- fExtraTextRotation += nTextRotationAngle;
- if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) )
+ else if ( mnFix16Angle )
{
- fExtraTextRotation /= 100.0;
- SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
- com::sun::star::beans::PropertyValue aPropVal;
- aPropVal.Name = sTextRotateAngle;
- aPropVal.Value <<= fExtraTextRotation;
- aGeometryItem.SetPropertyValue( aPropVal );
- pCustomShape->SetMergedItem( aGeometryItem );
+ // rotate text with shape ?
+ double a = mnFix16Angle * nPi180;
+ pObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle,
+ sin( a ), cos( a ) );
}
}
- else if ( mnFix16Angle )
- {
- // rotate text with shape ?
- double a = mnFix16Angle * nPi180;
- pObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle,
- sin( a ), cos( a ) );
- }
}
else if( !pObj )
{