summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/doc/tblafmt.cxx15
-rw-r--r--sw/source/core/layout/atrfrm.cxx32
2 files changed, 32 insertions, 15 deletions
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 4c66817309de..8235c52f77dd 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -149,13 +149,13 @@ namespace
};
/// Checks whether a writer-specific block exists (i.e. size is not zero)
- bool WriterSpecificBlockExists(SvStream &stream)
+ sal_Int64 WriterSpecificBlockExists(SvStream &stream)
{
sal_uInt64 endOfSwBlock = 0;
stream.ReadUInt64( endOfSwBlock );
// end-of-block pointing to itself indicates a zero-size block.
- return endOfSwBlock != stream.Tell();
+ return endOfSwBlock - stream.Tell();
}
}
@@ -452,10 +452,15 @@ bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sa
SetAdjust( *static_cast<SvxAdjustItem*>(pNew) );
delete pNew;
- if (nVer >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
+ if (nVer >= AUTOFORMAT_DATA_ID_31005)
{
- READ(m_aTextOrientation, SvxFrameDirectionItem, rVersions.m_nTextOrientationVersion);
- READ(m_aVerticalAlignment, SwFormatVertOrient, rVersions.m_nVerticalAlignmentVersion);
+ sal_Int64 const nSize(WriterSpecificBlockExists(rStream));
+ if (0 < nSize && nSize < std::numeric_limits<sal_uInt16>::max())
+ {
+ READ(m_aTextOrientation, SvxFrameDirectionItem, rVersions.m_nTextOrientationVersion);
+ // HORRIBLE HACK to read both 32-bit and 64-bit "long": abuse nSize
+ READ(m_aVerticalAlignment, SwFormatVertOrient, /*rVersions.m_nVerticalAlignmentVersion*/ nSize);
+ }
}
READ( m_aHorJustify, SvxHorJustifyItem , rVersions.nHorJustifyVersion)
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index d03983a46fd4..76bc2b14a944 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1265,20 +1265,32 @@ SvStream& SwFormatVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) c
return rStream;
}
-SfxPoolItem* SwFormatVertOrient::Create(SvStream &rStream, sal_uInt16 /*itemVersion*/) const
+SfxPoolItem* SwFormatVertOrient::Create(SvStream &rStream, sal_uInt16 nVersionAbusedAsSize) const
{
SwTwips yPos(0);
sal_Int16 orient(0);
sal_Int16 relation(0);
- // compatibility hack for Table Auto Format: SwTwips is "long" :(
- // (this means that the file format is platform dependent)
-#if SAL_TYPES_SIZEOFLONG == 8
- rStream.ReadInt64(yPos);
-#else
- sal_Int32 n;
- rStream.ReadInt32(n);
- yPos = n;
-#endif
+ switch (nVersionAbusedAsSize)
+ {
+ // compatibility hack for Table Auto Format: SwTwips is "long" :(
+ // (this means that the file format is platform dependent)
+ case 14:
+ {
+ sal_Int64 n(0);
+ rStream.ReadInt64(n);
+ yPos = n;
+ }
+ break;
+ case 10:
+ {
+ sal_Int32 n(0);
+ rStream.ReadInt32(n);
+ yPos = n;
+ }
+ break;
+ default:
+ SAL_WARN("sw.core", "SwFormatVertOrient::Create: unknown size");
+ }
rStream.ReadInt16( orient ).ReadInt16( relation );
return new SwFormatVertOrient(yPos, orient, relation);