Bugzilla – Attachment 60462 Details for
Bug 31005
EasyHack: Table Autoformats does not save (and of course apply) all properties (Writer and Calc)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch.
0001-fdo-31005-Table-Autoformats-do-not-save-apply-all-pr.patch (text/plain), 66.44 KB, created by
Muhammad Haggag
on 2012-04-22 12:24:42 UTC
(
hide
)
Description:
Proposed patch.
Filename:
MIME Type:
Creator:
Muhammad Haggag
Created:
2012-04-22 12:24:42 UTC
Size:
66.44 KB
patch
obsolete
>From 515de5c04d863f6411218ba410e671c865391a5b Mon Sep 17 00:00:00 2001 >From: Muhammad Haggag <muhammad@muhammad-ubuntu-pc.(none)> >Date: Sun, 22 Apr 2012 21:20:25 +0200 >Subject: [PATCH] fdo#31005 Table Autoformats do not save/apply all properties > >This change expands the number of properties supported by autoformats, mainly for Writer. >Some improvements affect Calc as well (e.g. border styles are now preserved for Calc). > >Common: boxitem.hxx, frmitems.cxx >* Added a new version for SvxBoxItem serialization that includes border styles. >* Updated SvxBoxItem and SvxBorderLine serialization logic accordingly. > >Writer: fmtornt.hxx, attrfrm.cxx >* Added serialization/deserialization logic for SwFmtVertOrient. > >Writer: tblafmt.hxx, tblafmt.cxx, ndtbl.cxx >* Updated file version for autotbl.fmt to be SOFFICE_FILEFORMAT_50. >* Autoformats now record the text orientation and vertical alignment of table cells. >* Autoformats now record the following table-level properties: > - Break > - Keep with next paragraph > - Repeat heading > - Allow table split across pages > - Allow rows to break across pages > - Merge adjacent line styles > - Table shadow > >Writer: UndoTable.hxx, undtbl.cxx >* Undo support for "Repeat Heading" in autoformat application. > >Calc: autoform.hxx, autoform.cxx >* Added support for reading/writing writer-specific data as binary blobs. >* Updated file version for autotbl.fmt to be SOFFICE_FILEFORMAT_50. >--- > cui/source/tabpages/border.cxx | 6 +- > editeng/inc/editeng/boxitem.hxx | 9 + > editeng/source/items/frmitems.cxx | 63 +++++-- > sc/inc/autoform.hxx | 75 +++++++- > sc/source/core/tool/autoform.cxx | 217 +++++++++++---------- > sw/inc/doc.hxx | 10 + > sw/inc/fmtornt.hxx | 3 + > sw/inc/tblafmt.hxx | 79 +++++++- > sw/source/core/doc/tblafmt.cxx | 377 +++++++++++++++++++++++++++++-------- > sw/source/core/docnode/ndtbl.cxx | 9 +- > sw/source/core/inc/UndoTable.hxx | 1 + > sw/source/core/layout/atrfrm.cxx | 27 +++ > sw/source/core/undo/untbl.cxx | 8 +- > sw/source/ui/table/tabledlg.cxx | 4 +- > 14 files changed, 685 insertions(+), 203 deletions(-) > >diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx >index fd9c63c..65d3177 100644 >--- a/cui/source/tabpages/border.cxx >+++ b/cui/source/tabpages/border.cxx >@@ -606,7 +606,7 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) > const SfxPoolItem* pOld = 0; > > //------------------ >- // Umrandung aussen: >+ // External border: > //------------------ > typedef ::std::pair<svx::FrameBorderType,sal_uInt16> TBorderPair; > TBorderPair eTypes1[] = { >@@ -620,7 +620,7 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) > aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second ); > > //-------------------------------- >- // Umrandung hor/ver und TableFlag >+ // Horizontal/Vertical border and TableFlag > //-------------------------------- > TBorderPair eTypes2[] = { > TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI), >@@ -633,7 +633,7 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) > aBoxInfoItem.EnableVer( mbVerEnabled ); > > //------------------- >- // Abstand nach Innen >+ // Inner distance > //------------------- > if( aLeftMF.IsVisible() ) > { >diff --git a/editeng/inc/editeng/boxitem.hxx b/editeng/inc/editeng/boxitem.hxx >index 4659770..1d9062f 100644 >--- a/editeng/inc/editeng/boxitem.hxx >+++ b/editeng/inc/editeng/boxitem.hxx >@@ -48,7 +48,16 @@ namespace rtl { class OUString; } > #define BOX_LINE_LEFT ((sal_uInt16)2) > #define BOX_LINE_RIGHT ((sal_uInt16)3) > >+/** >+This version causes SvxBoxItem to store the 4 cell spacing distances separately >+when serializing to stream. >+*/ > #define BOX_4DISTS_VERSION ((sal_uInt16)1) >+/** >+This version causes SvxBoxItem to store the styles for its border lines when >+serializing to stream. >+*/ >+#define BOX_BORDER_STYLE_VERSION ((sal_uInt16)2) > > class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem > { >diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx >index efdcadb..559d472 100644 >--- a/editeng/source/items/frmitems.cxx >+++ b/editeng/source/items/frmitems.cxx >@@ -124,6 +124,54 @@ inline void SetValueProp( XubString& rStr, const short nValue, > > // ----------------------------------------------------------------------- > >+/* >+SvxBorderLine is not an SfxPoolItem, and has no Store/Create serialization/deserialization methods. >+Since border line information needs to be serialized by the table autoformat code, these file-local >+methods are defined to encapsulate the necessary serialization logic. >+*/ >+namespace >+{ >+ /// Item version for saved border lines. The old version saves the line without style information. >+ const int BORDER_LINE_OLD_VERSION = 0; >+ /// Item version for saved border lies. The new version includes line style. >+ const int BORDER_LINE_WITH_STYLE_VERSION = 1; >+ >+ /// Store a border line to a stream. >+ SvStream& StoreBorderLine(SvStream &stream, const SvxBorderLine &l, sal_uInt16 version) >+ { >+ stream << l.GetColor() >+ << l.GetOutWidth() >+ << l.GetInWidth() >+ << l.GetDistance(); >+ >+ if (version >= BORDER_LINE_WITH_STYLE_VERSION) >+ stream << static_cast<sal_uInt16>(l.GetStyle()); >+ >+ return stream; >+ } >+ >+ /// Creates a border line from a stream. >+ SvxBorderLine CreateBorderLine(SvStream &stream, sal_uInt16 version) >+ { >+ sal_uInt16 nOutline, nInline, nDistance, nStyle = NO_STYLE; >+ Color aColor; >+ stream >> aColor >> nOutline >> nInline >> nDistance; >+ >+ if (version >= BORDER_LINE_WITH_STYLE_VERSION) >+ stream >> nStyle; >+ >+ SvxBorderLine border(&aColor); >+ border.GuessLinesWidths(static_cast<SvxBorderStyle>(nStyle), nOutline, nInline, nDistance); >+ return border; >+ } >+ >+ /// Retrieves a BORDER_LINE_* version from a BOX_BORDER_* version. >+ sal_uInt16 BorderLineVersionFromBoxVersion(sal_uInt16 boxVersion) >+ { >+ return (boxVersion >= BOX_BORDER_STYLE_VERSION)? BORDER_LINE_WITH_STYLE_VERSION : BORDER_LINE_OLD_VERSION; >+ } >+} >+ > TYPEINIT1_FACTORY(SvxPaperBinItem, SfxByteItem, new SvxPaperBinItem(0)); > TYPEINIT1_FACTORY(SvxSizeItem, SfxPoolItem, new SvxSizeItem(0)); > TYPEINIT1_FACTORY(SvxLRSpaceItem, SfxPoolItem, new SvxLRSpaceItem(0)); >@@ -2204,11 +2252,8 @@ SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const > const SvxBorderLine* l = pLine[ i ]; > if( l ) > { >- rStrm << (sal_Int8) i >- << l->GetColor() >- << (sal_uInt16) l->GetOutWidth() >- << (sal_uInt16) l->GetInWidth() >- << (sal_uInt16) l->GetDistance(); >+ rStrm << static_cast<sal_Int8>(i); >+ StoreBorderLine(rStrm, *l, BorderLineVersionFromBoxVersion(nItemVersion)); > } > } > sal_Int8 cLine = 4; >@@ -2242,7 +2287,7 @@ sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const > SOFFICE_FILEFORMAT_50==nFFVer, > "SvxBoxItem: Gibt es ein neues Fileformat?" ); > return SOFFICE_FILEFORMAT_31==nFFVer || >- SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_4DISTS_VERSION; >+ SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_BORDER_STYLE_VERSION; > } > > // ----------------------------------------------------------------------- >@@ -2285,12 +2330,8 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const > > if( cLine > 3 ) > break; >- sal_uInt16 nOutline, nInline, _nDistance; >- Color aColor; >- rStrm >> aColor >> nOutline >> nInline >> _nDistance; >- SvxBorderLine aBorder( &aColor ); >- aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, _nDistance ); > >+ SvxBorderLine aBorder = CreateBorderLine(rStrm, BorderLineVersionFromBoxVersion(nIVersion)); > pAttr->SetLine( &aBorder, aLineMap[cLine] ); > } > >diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx >index b6d07ee..47d6fc3 100644 >--- a/sc/inc/autoform.hxx >+++ b/sc/inc/autoform.hxx >@@ -70,8 +70,72 @@ > > #include <boost/ptr_container/ptr_map.hpp> > >-struct ScAfVersions; >+/** >+A binary blob of writer-specific data. This data typically consists of types that are >+unavailable to Calc (e.g. SwFmtVertOrient), or that Calc doesn't care about. >+ >+@remarks Note that in autoformat versions prior to AUTOFORMAT_DATA_ID_31005, Calc >+logic handled and stored several writer-specific items (such as ScAutoFormatDataField::aAdjust). >+That logic was preserved. From _31005 onward, writer-specific data should be handled by >+blobs to avoid needlessly complicating the Calc logic. >+*/ >+struct AutoFormatSwBlob : ::boost::noncopyable >+{ >+ sal_uInt8 *pData; >+ sal_Size size; >+ >+ AutoFormatSwBlob() : pData(0), size(0) >+ { >+ } >+ >+ ~AutoFormatSwBlob() >+ { >+ Reset(); >+ } >+ >+ void Reset() >+ { >+ delete[] pData; >+ pData = 0; >+ size = 0; >+ } >+}; > >+/// Struct with version numbers of the Items >+struct ScAfVersions >+{ >+public: >+ sal_uInt16 nFontVersion; >+ sal_uInt16 nFontHeightVersion; >+ sal_uInt16 nWeightVersion; >+ sal_uInt16 nPostureVersion; >+ sal_uInt16 nUnderlineVersion; >+ sal_uInt16 nOverlineVersion; >+ sal_uInt16 nCrossedOutVersion; >+ sal_uInt16 nContourVersion; >+ sal_uInt16 nShadowedVersion; >+ sal_uInt16 nColorVersion; >+ sal_uInt16 nBoxVersion; >+ sal_uInt16 nLineVersion; >+ sal_uInt16 nBrushVersion; >+ >+ sal_uInt16 nAdjustVersion; >+ AutoFormatSwBlob swVersions; >+ >+ sal_uInt16 nHorJustifyVersion; >+ sal_uInt16 nVerJustifyVersion; >+ sal_uInt16 nOrientationVersion; >+ sal_uInt16 nMarginVersion; >+ sal_uInt16 nBoolVersion; >+ sal_uInt16 nInt32Version; >+ sal_uInt16 nRotateModeVersion; >+ >+ sal_uInt16 nNumFmtVersion; >+ >+ ScAfVersions(); >+ void Load( SvStream& rStream, sal_uInt16 nVer ); >+ void Write(SvStream& rStream, sal_uInt16 fileVersion); >+}; > > /// Contains all items for one cell of a table autoformat. > class ScAutoFormatDataField >@@ -105,6 +169,7 @@ private: > > // Writer specific > SvxAdjustItem aAdjust; >+ AutoFormatSwBlob swFields; > > // Calc specific > SvxHorJustifyItem aHorJustify; >@@ -189,7 +254,7 @@ public: > void SetRotateMode( const SvxRotateModeItem& rRotateMode ) { aRotateMode.SetValue( rRotateMode.GetValue() ); } > > sal_Bool Load( SvStream& rStream, const ScAfVersions& rVersions, sal_uInt16 nVer ); >- sal_Bool Save( SvStream& rStream ); >+ sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ); > > #ifdef READ_OLDVERS > sal_Bool LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); >@@ -212,6 +277,9 @@ private: > bool bIncludeValueFormat : 1; > bool bIncludeWidthHeight : 1; > >+ // Writer-specific data >+ AutoFormatSwBlob swFields; >+ > ScAutoFormatDataField** ppDataField; > > SC_DLLPRIVATE ScAutoFormatDataField& GetField( sal_uInt16 nIndex ); >@@ -251,7 +319,7 @@ public: > void GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat ); > > bool Load( SvStream& rStream, const ScAfVersions& rVersions ); >- bool Save( SvStream& rStream ); >+ bool Save( SvStream& rStream, sal_uInt16 fileVersion ); > > #ifdef READ_OLDVERS > sal_Bool LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); >@@ -263,6 +331,7 @@ class SC_DLLPUBLIC ScAutoFormat > typedef boost::ptr_map<rtl::OUString, ScAutoFormatData> MapType; > MapType maData; > bool mbSaveLater; >+ ScAfVersions aVersions; > > public: > typedef MapType::const_iterator const_iterator; >diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx >index 5151105..7550cc8 100644 >--- a/sc/source/core/tool/autoform.cxx >+++ b/sc/source/core/tool/autoform.cxx >@@ -85,9 +85,13 @@ const sal_uInt16 AUTOFORMAT_DATA_ID_680DR25 = 10022; > const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031; > const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; > >-// aktuelle Version >-const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_300OVRLN; >-const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_300OVRLN; >+// --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc) >+const sal_uInt16 AUTOFORMAT_ID_31005 = 10041; >+const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042; >+ >+// current version >+const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_31005; >+const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_31005; > > > #ifdef READ_OLDVERS >@@ -96,42 +100,41 @@ const sal_uInt16 AUTOFORMAT_OLD_DATA_ID = 4202; > const sal_uInt16 AUTOFORMAT_OLD_ID_NEW = 4203; > #endif > >+namespace >+{ >+ /// Read an AutoFormatSwBlob from stream. >+ SvStream& operator>>(SvStream &stream, AutoFormatSwBlob &blob) >+ { >+ blob.Reset(); > >-// Struct mit Versionsnummern der Items >+ sal_uInt64 endOfBlob = 0; >+ stream >> endOfBlob; > >-struct ScAfVersions >-{ >-public: >- sal_uInt16 nFontVersion; >- sal_uInt16 nFontHeightVersion; >- sal_uInt16 nWeightVersion; >- sal_uInt16 nPostureVersion; >- sal_uInt16 nUnderlineVersion; >- sal_uInt16 nOverlineVersion; >- sal_uInt16 nCrossedOutVersion; >- sal_uInt16 nContourVersion; >- sal_uInt16 nShadowedVersion; >- sal_uInt16 nColorVersion; >- sal_uInt16 nBoxVersion; >- sal_uInt16 nLineVersion; >- sal_uInt16 nBrushVersion; >- >- sal_uInt16 nAdjustVersion; >- >- sal_uInt16 nHorJustifyVersion; >- sal_uInt16 nVerJustifyVersion; >- sal_uInt16 nOrientationVersion; >- sal_uInt16 nMarginVersion; >- sal_uInt16 nBoolVersion; >- sal_uInt16 nInt32Version; >- sal_uInt16 nRotateModeVersion; >- >- sal_uInt16 nNumFmtVersion; >- >- ScAfVersions(); >- void Load( SvStream& rStream, sal_uInt16 nVer ); >- static void Write(SvStream& rStream); >-}; >+ const sal_uInt64 currentPosition = stream.Tell(); >+ const sal_uInt64 blobSize = endOfBlob - currentPosition; >+ // A zero-size indicates an empty blob. This happens when Calc creates a new autoformat, >+ // since it (naturally) doesn't have any writer-specific data to write. >+ if (blobSize) >+ { >+ blob.pData = new sal_uInt8[blobSize]; >+ blob.size = static_cast<sal_Size>(blobSize); >+ stream.Read(blob.pData, blob.size); >+ } >+ >+ return stream; >+ } >+ >+ /// Write an AutoFormatSwBlob to stream. >+ SvStream& operator<<(SvStream &stream, AutoFormatSwBlob &blob) >+ { >+ const sal_uInt64 endOfBlob = stream.Tell() + sizeof(sal_uInt64) + blob.size; >+ stream << endOfBlob; >+ if (blob.size) >+ stream.Write(blob.pData, blob.size); >+ >+ return stream; >+ } >+} > > ScAfVersions::ScAfVersions() : > nFontVersion(0), >@@ -177,6 +180,8 @@ void ScAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) > rStream >> nLineVersion; > rStream >> nBrushVersion; > rStream >> nAdjustVersion; >+ if (nVer >= AUTOFORMAT_ID_31005) >+ rStream >> swVersions; > rStream >> nHorJustifyVersion; > rStream >> nVerJustifyVersion; > rStream >> nOrientationVersion; >@@ -190,31 +195,33 @@ void ScAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) > rStream >> nNumFmtVersion; > } > >-void ScAfVersions::Write(SvStream& rStream) >+void ScAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion) > { >- rStream << SvxFontItem(ATTR_FONT).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxFontHeightItem(240, 100, ATTR_FONT_HEIGHT).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxWeightItem(WEIGHT_NORMAL, ATTR_FONT_WEIGHT).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxPostureItem(ITALIC_NONE, ATTR_FONT_POSTURE).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxUnderlineItem(UNDERLINE_NONE, ATTR_FONT_UNDERLINE).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxOverlineItem(UNDERLINE_NONE, ATTR_FONT_OVERLINE).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxCrossedOutItem(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxContourItem(false, ATTR_FONT_CONTOUR).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxShadowedItem(false, ATTR_FONT_SHADOWED).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxColorItem(ATTR_FONT_COLOR).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxBoxItem(ATTR_BORDER).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxLineItem(SID_FRAME_LINESTYLE).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxBrushItem(ATTR_BACKGROUND).GetVersion(SOFFICE_FILEFORMAT_40); >- >- rStream << SvxAdjustItem(SVX_ADJUST_LEFT, 0).GetVersion(SOFFICE_FILEFORMAT_40); >- >- rStream << SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxMarginItem(ATTR_MARGIN).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SfxBoolItem(ATTR_LINEBREAK).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SfxInt32Item(ATTR_ROTATE_VALUE).GetVersion(SOFFICE_FILEFORMAT_40); >- rStream << SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD,0).GetVersion(SOFFICE_FILEFORMAT_40); >+ rStream << SvxFontItem(ATTR_FONT).GetVersion(fileVersion); >+ rStream << SvxFontHeightItem(240, 100, ATTR_FONT_HEIGHT).GetVersion(fileVersion); >+ rStream << SvxWeightItem(WEIGHT_NORMAL, ATTR_FONT_WEIGHT).GetVersion(fileVersion); >+ rStream << SvxPostureItem(ITALIC_NONE, ATTR_FONT_POSTURE).GetVersion(fileVersion); >+ rStream << SvxUnderlineItem(UNDERLINE_NONE, ATTR_FONT_UNDERLINE).GetVersion(fileVersion); >+ rStream << SvxOverlineItem(UNDERLINE_NONE, ATTR_FONT_OVERLINE).GetVersion(fileVersion); >+ rStream << SvxCrossedOutItem(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT).GetVersion(fileVersion); >+ rStream << SvxContourItem(false, ATTR_FONT_CONTOUR).GetVersion(fileVersion); >+ rStream << SvxShadowedItem(false, ATTR_FONT_SHADOWED).GetVersion(fileVersion); >+ rStream << SvxColorItem(ATTR_FONT_COLOR).GetVersion(fileVersion); >+ rStream << SvxBoxItem(ATTR_BORDER).GetVersion(fileVersion); >+ rStream << SvxLineItem(SID_FRAME_LINESTYLE).GetVersion(fileVersion); >+ rStream << SvxBrushItem(ATTR_BACKGROUND).GetVersion(fileVersion); >+ >+ rStream << SvxAdjustItem(SVX_ADJUST_LEFT, 0).GetVersion(fileVersion); >+ if (fileVersion >= SOFFICE_FILEFORMAT_50) >+ rStream << swVersions; >+ >+ rStream << SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY).GetVersion(fileVersion); >+ rStream << SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY).GetVersion(fileVersion); >+ rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion(fileVersion); >+ rStream << SvxMarginItem(ATTR_MARGIN).GetVersion(fileVersion); >+ rStream << SfxBoolItem(ATTR_LINEBREAK).GetVersion(fileVersion); >+ rStream << SfxInt32Item(ATTR_ROTATE_VALUE).GetVersion(fileVersion); >+ rStream << SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD,0).GetVersion(fileVersion); > > rStream << (sal_uInt16)0; // Num-Format > } >@@ -353,6 +360,9 @@ sal_Bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVe > SetAdjust( *(SvxAdjustItem*)pNew ); > delete pNew; > >+ if (nVer >= AUTOFORMAT_DATA_ID_31005) >+ rStream >> swFields; >+ > READ( aHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion) > READ( aVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion) > READ( aOrientation, SvxOrientationItem, rVersions.nOrientationVersion) >@@ -425,49 +435,51 @@ sal_Bool ScAutoFormatDataField::LoadOld( SvStream& rStream, const ScAfVersions& > } > #endif > >-sal_Bool ScAutoFormatDataField::Save( SvStream& rStream ) >+sal_Bool ScAutoFormatDataField::Save( SvStream& rStream, sal_uInt16 fileVersion ) > { > SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 ); > >- aFont.Store ( rStream, aFont.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aHeight.Store ( rStream, aHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aWeight.Store ( rStream, aWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aPosture.Store ( rStream, aPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aFont.Store ( rStream, aFont.GetVersion( fileVersion ) ); >+ aHeight.Store ( rStream, aHeight.GetVersion( fileVersion ) ); >+ aWeight.Store ( rStream, aWeight.GetVersion( fileVersion ) ); >+ aPosture.Store ( rStream, aPosture.GetVersion( fileVersion ) ); > // --- from 641 on: CJK and CTL font settings >- aCJKFont.Store ( rStream, aCJKFont.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCJKHeight.Store ( rStream, aCJKHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCJKWeight.Store ( rStream, aCJKWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCJKPosture.Store ( rStream, aCJKPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCTLFont.Store ( rStream, aCTLFont.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCTLHeight.Store ( rStream, aCTLHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCTLWeight.Store ( rStream, aCTLWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCTLPosture.Store ( rStream, aCTLPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- >- aUnderline.Store ( rStream, aUnderline.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aCJKFont.Store ( rStream, aCJKFont.GetVersion( fileVersion ) ); >+ aCJKHeight.Store ( rStream, aCJKHeight.GetVersion( fileVersion ) ); >+ aCJKWeight.Store ( rStream, aCJKWeight.GetVersion( fileVersion ) ); >+ aCJKPosture.Store ( rStream, aCJKPosture.GetVersion( fileVersion ) ); >+ aCTLFont.Store ( rStream, aCTLFont.GetVersion( fileVersion ) ); >+ aCTLHeight.Store ( rStream, aCTLHeight.GetVersion( fileVersion ) ); >+ aCTLWeight.Store ( rStream, aCTLWeight.GetVersion( fileVersion ) ); >+ aCTLPosture.Store ( rStream, aCTLPosture.GetVersion( fileVersion ) ); >+ >+ aUnderline.Store ( rStream, aUnderline.GetVersion( fileVersion ) ); > // --- from DEV300/overline2 on: overline support >- aOverline.Store ( rStream, aOverline.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aCrossedOut.Store ( rStream, aCrossedOut.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aContour.Store ( rStream, aContour.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aShadowed.Store ( rStream, aShadowed.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aColor.Store ( rStream, aColor.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aBox.Store ( rStream, aBox.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aOverline.Store ( rStream, aOverline.GetVersion( fileVersion ) ); >+ aCrossedOut.Store ( rStream, aCrossedOut.GetVersion( fileVersion ) ); >+ aContour.Store ( rStream, aContour.GetVersion( fileVersion ) ); >+ aShadowed.Store ( rStream, aShadowed.GetVersion( fileVersion ) ); >+ aColor.Store ( rStream, aColor.GetVersion( fileVersion ) ); >+ aBox.Store ( rStream, aBox.GetVersion( fileVersion ) ); > > // --- from 680/dr14 on: diagonal frame lines >- aTLBR.Store ( rStream, aTLBR.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aBLTR.Store ( rStream, aBLTR.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aTLBR.Store ( rStream, aTLBR.GetVersion( fileVersion ) ); >+ aBLTR.Store ( rStream, aBLTR.GetVersion( fileVersion ) ); > >- aBackground.Store ( rStream, aBackground.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aBackground.Store ( rStream, aBackground.GetVersion( fileVersion ) ); > >- aAdjust.Store ( rStream, aAdjust.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aAdjust.Store ( rStream, aAdjust.GetVersion( fileVersion ) ); >+ if (fileVersion >= SOFFICE_FILEFORMAT_50) >+ rStream << swFields; > >- aHorJustify.Store ( rStream, aHorJustify.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aVerJustify.Store ( rStream, aVerJustify.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aOrientation.Store ( rStream, aOrientation.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aMargin.Store ( rStream, aMargin.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aLinebreak.Store ( rStream, aLinebreak.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aHorJustify.Store ( rStream, aHorJustify.GetVersion( fileVersion ) ); >+ aVerJustify.Store ( rStream, aVerJustify.GetVersion( fileVersion ) ); >+ aOrientation.Store ( rStream, aOrientation.GetVersion( fileVersion ) ); >+ aMargin.Store ( rStream, aMargin.GetVersion( fileVersion ) ); >+ aLinebreak.Store ( rStream, aLinebreak.GetVersion( fileVersion ) ); > // Rotation ab SO5 >- aRotateAngle.Store ( rStream, aRotateAngle.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >- aRotateMode.Store ( rStream, aRotateMode.GetVersion( SOFFICE_FILEFORMAT_40 ) ); >+ aRotateAngle.Store ( rStream, aRotateAngle.GetVersion( fileVersion ) ); >+ aRotateMode.Store ( rStream, aRotateMode.GetVersion( fileVersion ) ); > > // --- from 680/dr25 on: store strings as UTF-8 > aNumFormat.Save( rStream, RTL_TEXTENCODING_UTF8 ); >@@ -825,6 +837,9 @@ bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions ) > rStream >> b; bIncludeValueFormat = b; > rStream >> b; bIncludeWidthHeight = b; > >+ if (nVer >= AUTOFORMAT_DATA_ID_31005) >+ rStream >> swFields; >+ > bRet = 0 == rStream.GetError(); > for( sal_uInt16 i = 0; bRet && i < 16; ++i ) > bRet = GetField( i ).Load( rStream, rVersions, nVer ); >@@ -862,7 +877,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers > } > #endif > >-bool ScAutoFormatData::Save(SvStream& rStream) >+bool ScAutoFormatData::Save(SvStream& rStream, sal_uInt16 fileVersion) > { > sal_uInt16 nVal = AUTOFORMAT_DATA_ID; > sal_Bool b; >@@ -878,9 +893,12 @@ bool ScAutoFormatData::Save(SvStream& rStream) > rStream << ( b = bIncludeValueFormat ); > rStream << ( b = bIncludeWidthHeight ); > >+ if (fileVersion >= SOFFICE_FILEFORMAT_50) >+ rStream << swFields; >+ > sal_Bool bRet = 0 == rStream.GetError(); > for (sal_uInt16 i = 0; bRet && (i < 16); i++) >- bRet = GetField( i ).Save( rStream ); >+ bRet = GetField( i ).Save( rStream, fileVersion ); > > return bRet; > } >@@ -1099,8 +1117,6 @@ bool ScAutoFormat::Load() > rStream >> nVal; > bRet = 0 == rStream.GetError(); > >- ScAfVersions aVersions; >- > if (bRet) > { > if( nVal == AUTOFORMAT_ID_358 || >@@ -1197,8 +1213,9 @@ bool ScAutoFormat::Save() > bRet = (pStream && pStream->GetError() == 0); > if (bRet) > { >+ const sal_uInt16 fileVersion = SOFFICE_FILEFORMAT_50; > SvStream& rStream = *pStream; >- rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); >+ rStream.SetVersion( fileVersion ); > > // Achtung hier muss ein allgemeiner Header gespeichert werden > sal_uInt16 nVal = AUTOFORMAT_ID; >@@ -1206,7 +1223,7 @@ bool ScAutoFormat::Save() > << (sal_uInt8)2 // Anzahl von Zeichen des Headers incl. diesem > << (sal_uInt8)::GetSOStoreTextEncoding( > osl_getThreadTextEncoding() ); >- ScAfVersions::Write(rStream); // Item-Versionen >+ aVersions.Write(rStream, fileVersion); > > bRet = (rStream.GetError() == 0); > //----------------------------------------------------------- >@@ -1214,7 +1231,7 @@ bool ScAutoFormat::Save() > bRet = (rStream.GetError() == 0); > MapType::iterator it = maData.begin(), itEnd = maData.end(); > for (++it; bRet && it != itEnd; ++it) // Skip the first item. >- bRet = it->second->Save(rStream); >+ bRet = it->second->Save(rStream, fileVersion); > > rStream.Flush(); > >diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx >index b71b98f..7f4a1cc 100644 >--- a/sw/inc/doc.hxx >+++ b/sw/inc/doc.hxx >@@ -1900,6 +1900,16 @@ public: > const editeng::SvxBorderLine* pBorderLine ); > void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const; > void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ); >+ /** >+ Retrieves a box attribute from the given cursor. >+ >+ @return Whether the property is set over the current box selection. >+ >+ @remarks A property is 'set' if it's set to the same value over all boxes in the current selection. >+ The property value is retrieved from the first box in the current selection. It is then compared to >+ the values of the same property over any other boxes in the selection; if any value is different from >+ that of the first box, the property is unset (and sal_False is returned). >+ */ > sal_Bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ) const; > void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign ); > sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const; >diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx >index ac19641..a4055da 100644 >--- a/sw/inc/fmtornt.hxx >+++ b/sw/inc/fmtornt.hxx >@@ -64,6 +64,9 @@ public: > virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; > virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); > >+ SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const; >+ SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const; >+ > sal_Int16 GetVertOrient() const { return eOrient; } > sal_Int16 GetRelationOrient() const { return eRelation; } > void SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; } >diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx >index 6ab318a..214a6e8 100644 >--- a/sw/inc/tblafmt.hxx >+++ b/sw/inc/tblafmt.hxx >@@ -53,9 +53,17 @@ > #include <editeng/brshitem.hxx> > #include <editeng/adjitem.hxx> > #include <editeng/justifyitem.hxx> >+#include <editeng/brkitem.hxx> >+#include <editeng/keepitem.hxx> >+#include <editeng/frmdiritem.hxx> >+#include <editeng/shaditem.hxx> > #include <svx/rotmodit.hxx> > #include <svl/intitem.hxx> > #include <editeng/bolnitem.hxx> >+#include <fmtpdsc.hxx> >+#include <fmtlsplt.hxx> >+#include <fmtrowsplt.hxx> >+#include <fmtornt.hxx> > #include "swdllapi.h" > > struct SwAfVersions; >@@ -94,6 +102,8 @@ class SwBoxAutoFmt > > // Writer specific > SvxAdjustItem aAdjust; >+ SvxFrameDirectionItem aTextOrientation; >+ SwFmtVertOrient aVerticalAlignment; > > // Calc specific > SvxHorJustifyItem aHorJustify; >@@ -136,6 +146,8 @@ public: > const SvxShadowedItem &GetShadowed() const { return aShadowed; } > const SvxColorItem &GetColor() const { return aColor; } > const SvxAdjustItem &GetAdjust() const { return aAdjust; } >+ const SvxFrameDirectionItem& GetTextOrientation() const { return aTextOrientation; } >+ const SwFmtVertOrient& GetVerticalAlignment() const { return aVerticalAlignment; } > const SvxBoxItem &GetBox() const { return aBox; } > const SvxLineItem &GetTLBR() const { return aTLBR; } > const SvxLineItem &GetBLTR() const { return aBLTR; } >@@ -168,14 +180,16 @@ public: > aAdjust.SetOneWord( rNew.GetOneWord() ); > aAdjust.SetLastBlock( rNew.GetLastBlock() ); > } >+ void SetTextOrientation(const SvxFrameDirectionItem& rNew) { aTextOrientation = rNew; } >+ void SetVerticalAlignment(const SwFmtVertOrient& rNew) { aVerticalAlignment = rNew; } > void SetBox( const SvxBoxItem& rNew ) { aBox = rNew; } > void SetBackground( const SvxBrushItem& rNew ) { aBackground = rNew; } > void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys ) > { sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; } > > sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ); >- sal_Bool Save( SvStream& rStream ) const; >- sal_Bool SaveVerionNo( SvStream& rStream ) const; >+ sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; >+ sal_Bool SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const; > > #ifdef READ_OLDVERS > // load old version. >@@ -183,6 +197,50 @@ public: > #endif > }; > >+/* >+@remarks >+A table has a number of lines. These lines seem to correspond with rows, except in the case of >+rows spanning more than one line. Each line contains a number of boxes/cells. >+ >+AutoFormat properties are retrieved and stored in a grid of 16 table boxes. A sampling approach >+is used to read the data. 4 lines are picked, and 4 boxes are picked from each. >+ >+The line picking and box picking algorithms are similar. We start at the first line/box, and pick >+lines/boxes one by one for a maximum of 3. The 4th line/box is the last line/box in the current >+table/line. If we hit the end of lines/boxes, the last line/box encountered is picked several times. >+ >+For example, in a 2x3 table, the 4 lines will be [0, 1, 1, 1]. In each line, the boxes will be >+[0, 1, 2, 2]. In a 6x5 table, the 4 lines will be [0, 1, 2, 4] and the boxes per line will be >+[0, 1, 2, 5]. >+ >+As you can see, property extraction/application is lossless for tables that are 4x4 or smaller >+(and in fact has a bit of redundnacy). For larger tables, we lose any individual cell formatting >+for the range [(3,rows - 1) -> (3, cols - 1)]. That formatting is replaced by formatting from >+the saved cells: >+ >+ 0 1 2 3 4 5 >+ +-----------------------------------------------------------------------+ >+ 0 | Saved | Saved | Saved | | | Saved | >+ +-----------------------------------------------------------------------+ >+ 1 | Saved | Saved | Saved | | | Saved | >+ +-----------------------------------------------------------------------+ >+ 2 | Saved | Saved | Saved | | | Saved | >+ +-----------------------------------------------------------------------+ >+ 3 | | | | | | | >+ +-----------------------------------------------------------------------+ >+ 4 | | | | | | | >+ +-----------------------------------------------------------------------+ >+ 5 | Saved | Saved | Saved | | | Saved | >+ +-----------+-----------+-----------+-----------+-----------+-----------+ >+ >+The properties saved are divided into three categories: >+ 1. Character properties: Font, font size, weight, etc. >+ 2. Box properties: Box, cell background >+ 3. Table properties: Properties that are set in the Table->Table Properties dialog. >+ >+Character and box properties are stored per cell (and are lossy for tables larger than 4x4). Table >+properties are stored per-table, and are lossless. >+*/ > class SW_DLLPUBLIC SwTableAutoFmt > { > friend void _FinitCore(); // To destroy dflt. pointer. >@@ -203,6 +261,16 @@ class SW_DLLPUBLIC SwTableAutoFmt > > SwBoxAutoFmt* aBoxAutoFmt[ 16 ]; > >+ // Writer-specific options >+ SvxFmtBreakItem aBreak; >+ SwFmtPageDesc aPageDesc; >+ SvxFmtKeepItem aKeepWithNextPara; >+ sal_uInt16 aRepeatHeading; >+ sal_Bool bLayoutSplit; >+ sal_Bool bRowSplit; >+ sal_Bool bCollapsingBorders; >+ SvxShadowItem aShadow; >+ > public: > SwTableAutoFmt( const String& rName ); > SwTableAutoFmt( const SwTableAutoFmt& rNew ); >@@ -217,11 +285,14 @@ public: > const String& GetName() const { return aName; } > > enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 }; >- SwBoxAutoFmt& UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, >+ void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, > UpdateFlags eFlags, SvNumberFormatter* ); > void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags, > SvNumberFormatter* ) const ; > >+ void RestoreTableProperties(SwTable &table) const; >+ void StoreTableProperties(const SwTable &table); >+ > sal_Bool IsFont() const { return bInclFont; } > sal_Bool IsJustify() const { return bInclJustify; } > sal_Bool IsFrame() const { return bInclFrame; } >@@ -236,7 +307,7 @@ public: > void SetWidthHeight( const sal_Bool bNew ) { bInclWidthHeight = bNew; } > > sal_Bool Load( SvStream& rStream, const SwAfVersions& ); >- sal_Bool Save( SvStream& rStream ) const; >+ sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; > > #ifdef READ_OLDVERS > // Load old versions. >diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx >index 266db7f..4c1869a 100644 >--- a/sw/source/core/doc/tblafmt.cxx >+++ b/sw/source/core/doc/tblafmt.cxx >@@ -40,6 +40,9 @@ > #include <sfx2/app.hxx> > #include <svx/dialmgr.hxx> > #include <svx/dialogs.hrc> >+#include <swtable.hxx> >+#include <swtblfmt.hxx> >+#include <com/sun/star/text/VertOrientation.hpp> > > #define READ_OLDVERS // read the old version for a start > #include <swtypes.hxx> >@@ -48,6 +51,9 @@ > #include <tblafmt.hxx> > #include <cellatr.hxx> > #include <SwStyleNameMapper.hxx> >+#include <hintids.hxx> >+#include <fmtornt.hxx> >+#include <editsh.hxx> > > using ::editeng::SvxBorderLine; > >@@ -80,9 +86,14 @@ const sal_uInt16 AUTOFORMAT_DATA_ID_680DR25 = 10022; > const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031; > const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; > >+// --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc) >+const sal_uInt16 AUTOFORMAT_ID_31005 = 10041; >+const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042; >+ > // current version >-const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_300OVRLN; >-const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_300OVRLN; >+const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_31005; >+const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_31005; >+const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50; > > > #ifdef READ_OLDVERS >@@ -99,6 +110,73 @@ SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0; > // SwTable AutoFormat Table > SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* ) > >+namespace >+{ >+ /// Begins a writer-specific data block. Call before serializing any writer-specific properties. >+ sal_uInt64 BeginSwBlock(SvStream& rStream) >+ { >+ // We need to write down the offset of the end of the writer-specific data, so that >+ // calc can skip it. We'll only have that value after writing the data, so we >+ // write a placeholder value first, write the data, then jump back and write the >+ // real offset. >+ >+ // Note that we explicitly use sal_uInt64 instead of sal_Size (which can be 32 >+ // or 64 depending on platform) to ensure 64-bit portability on this front. I don't >+ // actually know if autotbl.fmt as a whole is portable, since that requires all serialization >+ // logic to be written with portability in mind. >+ sal_uInt64 whereToWriteEndOfSwBlock = rStream.Tell(); >+ >+ sal_uInt64 endOfSwBlock = 0; >+ rStream << endOfSwBlock; >+ >+ return whereToWriteEndOfSwBlock; >+ } >+ >+ /// Ends a writer-specific data block. Call after serializing writer-specific properties. >+ /// Closes a corresponding BeginSwBlock call. >+ void EndSwBlock(SvStream& rStream, sal_uInt64 whereToWriteEndOfSwBlock) >+ { >+ sal_uInt64 endOfSwBlock = rStream.Tell(); >+ rStream.Seek(whereToWriteEndOfSwBlock); >+ rStream << endOfSwBlock; >+ rStream.Seek(endOfSwBlock); >+ } >+ >+ /** >+ Helper class for writer-specific blocks. Begins a writer-specific block on construction, >+ and closes it on destruction. >+ >+ See also: BeginSwBlock and EndSwBlock. >+ */ >+ class WriterSpecificAutoFormatBlock : ::boost::noncopyable >+ { >+ public: >+ WriterSpecificAutoFormatBlock(SvStream &rStream) : _rStream(rStream) >+ { >+ _whereToWriteEndOfBlock = BeginSwBlock(rStream); >+ } >+ >+ ~WriterSpecificAutoFormatBlock() >+ { >+ EndSwBlock(_rStream, _whereToWriteEndOfBlock); >+ } >+ >+ private: >+ SvStream &_rStream; >+ sal_uInt64 _whereToWriteEndOfBlock; >+ }; >+ >+ /// Checks whether a writer-specific block exists (i.e. size is not zero) >+ sal_Bool WriterSpecificBlockExists(SvStream &stream) >+ { >+ sal_uInt64 endOfSwBlock = 0; >+ stream >> endOfSwBlock; >+ >+ // end-of-block pointing to itself indicates a zero-size block. >+ return endOfSwBlock != stream.Tell(); >+ } >+} >+ > > // Struct with version numbers of the Items > >@@ -120,6 +198,8 @@ public: > sal_uInt16 nBrushVersion; > > sal_uInt16 nAdjustVersion; >+ sal_uInt16 nTextOrientationVersion; >+ sal_uInt16 nVerticalAlignmentVersion; > > sal_uInt16 nHorJustifyVersion; > sal_uInt16 nVerJustifyVersion; >@@ -150,6 +230,8 @@ SwAfVersions::SwAfVersions() : > nLineVersion(0), > nBrushVersion(0), > nAdjustVersion(0), >+ nTextOrientationVersion(0), >+ nVerticalAlignmentVersion(0), > nHorJustifyVersion(0), > nVerJustifyVersion(0), > nOrientationVersion(0), >@@ -179,6 +261,12 @@ void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) > rStream >> nLineVersion; > rStream >> nBrushVersion; > rStream >> nAdjustVersion; >+ if (nVer >= AUTOFORMAT_ID_31005 && WriterSpecificBlockExists(rStream)) >+ { >+ rStream >> nTextOrientationVersion; >+ rStream >> nVerticalAlignmentVersion; >+ } >+ > rStream >> nHorJustifyVersion; > rStream >> nVerJustifyVersion; > rStream >> nOrientationVersion; >@@ -221,6 +309,8 @@ SwBoxAutoFmt::SwBoxAutoFmt() > aBLTR( 0 ), > aBackground( RES_BACKGROUND ), > aAdjust( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ), >+ aTextOrientation(FRMDIR_ENVIRONMENT, RES_FRAMEDIR), >+ aVerticalAlignment(0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME), > aHorJustify( SVX_HOR_JUSTIFY_STANDARD, 0), > aVerJustify( SVX_VER_JUSTIFY_STANDARD, 0), > aStacked( 0 ), >@@ -262,6 +352,8 @@ SwBoxAutoFmt::SwBoxAutoFmt( const SwBoxAutoFmt& rNew ) > aBLTR( rNew.aBLTR ), > aBackground( rNew.aBackground ), > aAdjust( rNew.aAdjust ), >+ aTextOrientation(rNew.aTextOrientation), >+ aVerticalAlignment(rNew.aVerticalAlignment), > aHorJustify( rNew.aHorJustify ), > aVerJustify( rNew.aVerJustify ), > aStacked( rNew.aStacked ), >@@ -301,6 +393,8 @@ SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew ) > aShadowed = rNew.aShadowed; > aColor = rNew.aColor; > SetAdjust( rNew.aAdjust ); >+ aTextOrientation = rNew.aTextOrientation; >+ aVerticalAlignment = rNew.aVerticalAlignment; > aBox = rNew.aBox; > aTLBR = rNew.aTLBR; > aBLTR = rNew.aBLTR; >@@ -377,8 +471,15 @@ sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, s > SetAdjust( *(SvxAdjustItem*)pNew ); > delete pNew; > >+ if (nVer >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream)) >+ { >+ READ(aTextOrientation, SvxFrameDirectionItem, rVersions.nTextOrientationVersion); >+ READ(aVerticalAlignment, SwFmtVertOrient, rVersions.nVerticalAlignmentVersion); >+ } >+ > READ( aHorJustify, SvxHorJustifyItem , rVersions.nHorJustifyVersion) > READ( aVerJustify, SvxVerJustifyItem , rVersions.nVerJustifyVersion) >+ > READ( aOrientation, SvxOrientationItem , rVersions.nOrientationVersion) > READ( aMargin, SvxMarginItem , rVersions.nMarginVersion) > >@@ -447,43 +548,50 @@ sal_Bool SwBoxAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] ) > #endif > > >-sal_Bool SwBoxAutoFmt::Save( SvStream& rStream ) const >+sal_Bool SwBoxAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const > { > SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 ); > >- aFont.Store( rStream, aFont.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aHeight.Store( rStream, aHeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aWeight.Store( rStream, aWeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aPosture.Store( rStream, aPosture.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCJKFont.Store( rStream, aCJKFont.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCJKHeight.Store( rStream, aCJKHeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCJKWeight.Store( rStream, aCJKWeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCJKPosture.Store( rStream, aCJKPosture.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCTLFont.Store( rStream, aCTLFont.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCTLHeight.Store( rStream, aCTLHeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCTLWeight.Store( rStream, aCTLWeight.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCTLPosture.Store( rStream, aCTLPosture.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aUnderline.Store( rStream, aUnderline.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aOverline.Store( rStream, aOverline.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aCrossedOut.Store( rStream, aCrossedOut.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aContour.Store( rStream, aContour.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aShadowed.Store( rStream, aShadowed.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aColor.Store( rStream, aColor.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aBox.Store( rStream, aBox.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aTLBR.Store( rStream, aTLBR.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aBLTR.Store( rStream, aBLTR.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aBackground.Store( rStream, aBackground.GetVersion(SOFFICE_FILEFORMAT_40) ); >- >- aAdjust.Store( rStream, aAdjust.GetVersion(SOFFICE_FILEFORMAT_40) ); >- >- aHorJustify.Store( rStream, aHorJustify.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aVerJustify.Store( rStream, aVerJustify.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aOrientation.Store( rStream, aOrientation.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aMargin.Store( rStream, aMargin.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aLinebreak.Store( rStream, aLinebreak.GetVersion(SOFFICE_FILEFORMAT_40) ); >+ aFont.Store( rStream, aFont.GetVersion(fileVersion) ); >+ aHeight.Store( rStream, aHeight.GetVersion(fileVersion) ); >+ aWeight.Store( rStream, aWeight.GetVersion(fileVersion) ); >+ aPosture.Store( rStream, aPosture.GetVersion(fileVersion) ); >+ aCJKFont.Store( rStream, aCJKFont.GetVersion(fileVersion) ); >+ aCJKHeight.Store( rStream, aCJKHeight.GetVersion(fileVersion) ); >+ aCJKWeight.Store( rStream, aCJKWeight.GetVersion(fileVersion) ); >+ aCJKPosture.Store( rStream, aCJKPosture.GetVersion(fileVersion) ); >+ aCTLFont.Store( rStream, aCTLFont.GetVersion(fileVersion) ); >+ aCTLHeight.Store( rStream, aCTLHeight.GetVersion(fileVersion) ); >+ aCTLWeight.Store( rStream, aCTLWeight.GetVersion(fileVersion) ); >+ aCTLPosture.Store( rStream, aCTLPosture.GetVersion(fileVersion) ); >+ aUnderline.Store( rStream, aUnderline.GetVersion(fileVersion) ); >+ aOverline.Store( rStream, aOverline.GetVersion(fileVersion) ); >+ aCrossedOut.Store( rStream, aCrossedOut.GetVersion(fileVersion) ); >+ aContour.Store( rStream, aContour.GetVersion(fileVersion) ); >+ aShadowed.Store( rStream, aShadowed.GetVersion(fileVersion) ); >+ aColor.Store( rStream, aColor.GetVersion(fileVersion) ); >+ aBox.Store( rStream, aBox.GetVersion(fileVersion) ); >+ aTLBR.Store( rStream, aTLBR.GetVersion(fileVersion) ); >+ aBLTR.Store( rStream, aBLTR.GetVersion(fileVersion) ); >+ aBackground.Store( rStream, aBackground.GetVersion(fileVersion) ); >+ >+ aAdjust.Store( rStream, aAdjust.GetVersion(fileVersion) ); >+ if (fileVersion >= SOFFICE_FILEFORMAT_50) >+ { >+ WriterSpecificAutoFormatBlock block(rStream); >+ >+ aTextOrientation.Store(rStream, aTextOrientation.GetVersion(fileVersion)); >+ aVerticalAlignment.Store(rStream, aVerticalAlignment.GetVersion(fileVersion)); >+ } >+ >+ aHorJustify.Store( rStream, aHorJustify.GetVersion(fileVersion) ); >+ aVerJustify.Store( rStream, aVerJustify.GetVersion(fileVersion) ); >+ aOrientation.Store( rStream, aOrientation.GetVersion(fileVersion) ); >+ aMargin.Store( rStream, aMargin.GetVersion(fileVersion) ); >+ aLinebreak.Store( rStream, aLinebreak.GetVersion(fileVersion) ); > // Calc Rotation from SO5 >- aRotateAngle.Store( rStream, aRotateAngle.GetVersion(SOFFICE_FILEFORMAT_40) ); >- aRotateMode.Store( rStream, aRotateMode.GetVersion(SOFFICE_FILEFORMAT_40) ); >+ aRotateAngle.Store( rStream, aRotateAngle.GetVersion(fileVersion) ); >+ aRotateMode.Store( rStream, aRotateMode.GetVersion(fileVersion) ); > > // --- from 680/dr25 on: store strings as UTF-8 > write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, sNumFmtString, >@@ -494,31 +602,39 @@ sal_Bool SwBoxAutoFmt::Save( SvStream& rStream ) const > } > > >-sal_Bool SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const >+sal_Bool SwBoxAutoFmt::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const > { >- rStream << aFont.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aHeight.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aWeight.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aPosture.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aUnderline.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aOverline.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aCrossedOut.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aContour.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aShadowed.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aColor.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aBox.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aTLBR.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aBackground.GetVersion( SOFFICE_FILEFORMAT_40 ); >- >- rStream << aAdjust.GetVersion( SOFFICE_FILEFORMAT_40 ); >- >- rStream << aHorJustify.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aVerJustify.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aMargin.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aLinebreak.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aRotateAngle.GetVersion( SOFFICE_FILEFORMAT_40 ); >- rStream << aRotateMode.GetVersion( SOFFICE_FILEFORMAT_40 ); >+ rStream << aFont.GetVersion( fileVersion ); >+ rStream << aHeight.GetVersion( fileVersion ); >+ rStream << aWeight.GetVersion( fileVersion ); >+ rStream << aPosture.GetVersion( fileVersion ); >+ rStream << aUnderline.GetVersion( fileVersion ); >+ rStream << aOverline.GetVersion( fileVersion ); >+ rStream << aCrossedOut.GetVersion( fileVersion ); >+ rStream << aContour.GetVersion( fileVersion ); >+ rStream << aShadowed.GetVersion( fileVersion ); >+ rStream << aColor.GetVersion( fileVersion ); >+ rStream << aBox.GetVersion( fileVersion ); >+ rStream << aTLBR.GetVersion( fileVersion ); >+ rStream << aBackground.GetVersion( fileVersion ); >+ >+ rStream << aAdjust.GetVersion( fileVersion ); >+ >+ if (fileVersion >= SOFFICE_FILEFORMAT_50) >+ { >+ WriterSpecificAutoFormatBlock block(rStream); >+ >+ rStream << aTextOrientation.GetVersion(fileVersion); >+ rStream << aVerticalAlignment.GetVersion(fileVersion); >+ } >+ >+ rStream << aHorJustify.GetVersion( fileVersion ); >+ rStream << aVerJustify.GetVersion( fileVersion ); >+ rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion( fileVersion ); >+ rStream << aMargin.GetVersion( fileVersion ); >+ rStream << aLinebreak.GetVersion( fileVersion ); >+ rStream << aRotateAngle.GetVersion( fileVersion ); >+ rStream << aRotateMode.GetVersion( fileVersion ); > > rStream << (sal_uInt16)0; // NumberFormat > >@@ -528,7 +644,16 @@ sal_Bool SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const > > > SwTableAutoFmt::SwTableAutoFmt( const String& rName ) >- : aName( rName ), nStrResId( USHRT_MAX ) >+ : >+ aName( rName ), >+ nStrResId( USHRT_MAX ), >+ aBreak( SVX_BREAK_NONE, RES_BREAK ), >+ aKeepWithNextPara( sal_False, RES_KEEP ), >+ aRepeatHeading( 0 ), >+ bLayoutSplit( sal_True ), >+ bRowSplit( sal_True ), >+ bCollapsingBorders(sal_True), >+ aShadow( RES_SHADOW ) > { > bInclFont = sal_True; > bInclJustify = sal_True; >@@ -542,6 +667,10 @@ SwTableAutoFmt::SwTableAutoFmt( const String& rName ) > > > SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew ) >+ : >+ aBreak( rNew.aBreak ), >+ aKeepWithNextPara( sal_False, RES_KEEP ), >+ aShadow( RES_SHADOW ) > { > for( sal_uInt8 n = 0; n < 16; ++n ) > aBoxAutoFmt[ n ] = 0; >@@ -571,6 +700,15 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew ) > bInclValueFormat = rNew.bInclValueFormat; > bInclWidthHeight = rNew.bInclWidthHeight; > >+ aBreak = rNew.aBreak; >+ aPageDesc = rNew.aPageDesc; >+ aKeepWithNextPara = rNew.aKeepWithNextPara; >+ aRepeatHeading = rNew.aRepeatHeading; >+ bLayoutSplit = rNew.bLayoutSplit; >+ bRowSplit = rNew.bRowSplit; >+ bCollapsingBorders = rNew.bCollapsingBorders; >+ aShadow = rNew.aShadow; >+ > return *this; > } > >@@ -614,10 +752,10 @@ const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const > > > >-SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, >- const SfxItemSet& rSet, >- UpdateFlags eFlags, >- SvNumberFormatter* pNFmtr ) >+void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, >+ const SfxItemSet& rSet, >+ UpdateFlags eFlags, >+ SvNumberFormatter* pNFmtr) > { > OSL_ENSURE( nPos < 16, "wrong area" ); > >@@ -657,6 +795,8 @@ SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, > // pFmt->SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) ); > // pFmt->SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) ); > pFmt->SetBackground( (SvxBrushItem&)rSet.Get( RES_BACKGROUND ) ); >+ pFmt->SetTextOrientation(static_cast<const SvxFrameDirectionItem&>(rSet.Get(RES_FRAMEDIR))); >+ pFmt->SetVerticalAlignment(static_cast<const SwFmtVertOrient&>(rSet.Get(RES_VERT_ORIENT))); > > const SwTblBoxNumFormat* pNumFmtItem; > const SvNumberformat* pNumFormat = 0; >@@ -673,14 +813,13 @@ SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, > static_cast<LanguageType>(::GetAppLanguage() )); > } > } >- // we cannot handle the rest, that's specific to StarCalc > >- return *pFmt; >+ // we cannot handle the rest, that's specific to StarCalc > } > > >-void SwTableAutoFmt::UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, >- UpdateFlags eFlags, SvNumberFormatter* pNFmtr ) const >+void SwTableAutoFmt::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet, >+ UpdateFlags eFlags, SvNumberFormatter* pNFmtr) const > { > const SwBoxAutoFmt& rChg = GetBoxFmt( nPos ); > >@@ -745,6 +884,9 @@ void SwTableAutoFmt::UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, > if( IsBackground() ) > rSet.Put( rChg.GetBackground() ); > >+ rSet.Put(rChg.GetTextOrientation()); >+ rSet.Put(rChg.GetVerticalAlignment()); >+ > if( IsValueFormat() && pNFmtr ) > { > String sFmt; LanguageType eLng, eSys; >@@ -766,6 +908,62 @@ void SwTableAutoFmt::UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, > // we cannot handle the rest, that's specific to StarCalc > } > >+void SwTableAutoFmt::RestoreTableProperties(SwTable &table) const >+{ >+ SwTableFmt *pFormat = table.GetTableFmt(); >+ if (!pFormat) >+ return; >+ >+ SwDoc *pDoc = pFormat->GetDoc(); >+ if (!pDoc) >+ return; >+ >+ SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange); >+ >+ rSet.Put(aBreak); >+ rSet.Put(aPageDesc); >+ rSet.Put(SwFmtLayoutSplit(bLayoutSplit)); >+ rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, bCollapsingBorders)); >+ rSet.Put(aKeepWithNextPara); >+ rSet.Put(aShadow); >+ >+ pFormat->SetFmtAttr(rSet); >+ >+ SwEditShell *pShell = pDoc->GetEditShell(); >+ pDoc->SetRowSplit(*pShell->getShellCrsr(false), SwFmtRowSplit(bRowSplit)); >+ >+ table.SetRowsToRepeat(aRepeatHeading); >+} >+ >+void SwTableAutoFmt::StoreTableProperties(const SwTable &table) >+{ >+ SwTableFmt *pFormat = table.GetTableFmt(); >+ if (!pFormat) >+ return; >+ >+ SwDoc *pDoc = pFormat->GetDoc(); >+ if (!pDoc) >+ return; >+ >+ SwEditShell *pShell = pDoc->GetEditShell(); >+ SwFmtRowSplit *pRowSplit = 0; >+ pDoc->GetRowSplit(*pShell->getShellCrsr(false), pRowSplit); >+ bRowSplit = pRowSplit? pRowSplit->GetValue() : sal_False; >+ delete pRowSplit; >+ pRowSplit = 0; >+ >+ const SfxItemSet &rSet = pFormat->GetAttrSet(); >+ >+ aBreak = static_cast<const SvxFmtBreakItem&>(rSet.Get(RES_BREAK)); >+ aPageDesc = static_cast<const SwFmtPageDesc&>(rSet.Get(RES_PAGEDESC)); >+ const SwFmtLayoutSplit &layoutSplit = static_cast<const SwFmtLayoutSplit&>(rSet.Get(RES_LAYOUT_SPLIT)); >+ bLayoutSplit = layoutSplit.GetValue(); >+ bCollapsingBorders = static_cast<const SfxBoolItem&>(rSet.Get(RES_COLLAPSING_BORDERS)).GetValue(); >+ >+ aKeepWithNextPara = static_cast<const SvxFmtKeepItem&>(rSet.Get(RES_KEEP)); >+ aRepeatHeading = table.GetRowsToRepeat(); >+ aShadow = static_cast<const SvxShadowItem&>(rSet.Get(RES_SHADOW)); >+} > > sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions ) > { >@@ -800,9 +998,22 @@ sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions > rStream >> b; bInclValueFormat = b; > rStream >> b; bInclWidthHeight = b; > >+ if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream)) >+ { >+ SfxPoolItem* pNew = 0; >+ >+ READ(aBreak, SvxFmtBreakItem, AUTOFORMAT_FILE_VERSION); >+ READ(aPageDesc, SwFmtPageDesc, AUTOFORMAT_FILE_VERSION); >+ READ(aKeepWithNextPara, SvxFmtKeepItem, AUTOFORMAT_FILE_VERSION); >+ >+ rStream >> aRepeatHeading >> bLayoutSplit >> bRowSplit >> bCollapsingBorders; >+ >+ READ(aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION); >+ } >+ > bRet = 0 == rStream.GetError(); > >- for( sal_uInt8 i = 0; i < 16; ++i ) >+ for( sal_uInt8 i = 0; bRet && i < 16; ++i ) > { > SwBoxAutoFmt* pFmt = new SwBoxAutoFmt; > bRet = pFmt->Load( rStream, rVersions, nVal ); >@@ -855,7 +1066,7 @@ sal_Bool SwTableAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] ) > #endif > > >-sal_Bool SwTableAutoFmt::Save( SvStream& rStream ) const >+sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const > { > sal_uInt16 nVal = AUTOFORMAT_DATA_ID; > sal_Bool b; >@@ -871,6 +1082,16 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream ) const > rStream << ( b = bInclValueFormat ); > rStream << ( b = bInclWidthHeight ); > >+ { >+ WriterSpecificAutoFormatBlock block(rStream); >+ >+ aBreak.Store(rStream, aBreak.GetVersion(fileVersion)); >+ aPageDesc.Store(rStream, aPageDesc.GetVersion(fileVersion)); >+ aKeepWithNextPara.Store(rStream, aKeepWithNextPara.GetVersion(fileVersion)); >+ rStream << aRepeatHeading << bLayoutSplit << bRowSplit << bCollapsingBorders; >+ aShadow.Store(rStream, aShadow.GetVersion(fileVersion)); >+ } >+ > sal_Bool bRet = 0 == rStream.GetError(); > > for( int i = 0; bRet && i < 16; ++i ) >@@ -883,7 +1104,7 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream ) const > pDfltBoxAutoFmt = new SwBoxAutoFmt; > pFmt = pDfltBoxAutoFmt; > } >- bRet = pFmt->Save( rStream ); >+ bRet = pFmt->Save( rStream, fileVersion ); > } > return bRet; > } >@@ -987,15 +1208,17 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream ) > { > SwAfVersions aVersions; > >+ // Default version is 5.0, unless we detect an old format ID. >+ sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_50; >+ if(nVal < AUTOFORMAT_ID_31005) >+ nFileVers = SOFFICE_FILEFORMAT_40; >+ > if( nVal == AUTOFORMAT_ID_358 || > (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) ) > { >- sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_40; > sal_uInt8 nChrSet, nCnt; > long nPos = rStream.Tell(); > rStream >> nCnt >> nChrSet; >-// if( 4 <= nCnt ) >-// rStream >> nFileVers; > if( rStream.Tell() != sal_uLong(nPos + nCnt) ) > { > OSL_ENSURE( !this, "The Header contains more or newer Data" ); >@@ -1073,7 +1296,7 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const > sal_Bool bRet = 0 == rStream.GetError(); > if (bRet) > { >- rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); >+ rStream.SetVersion(AUTOFORMAT_FILE_VERSION); > > // Attention: We need to save a general Header here > sal_uInt16 nVal = AUTOFORMAT_ID; >@@ -1084,7 +1307,7 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const > bRet = 0 == rStream.GetError(); > > // Write this version number for all attributes >- (*this)[ 0 ]->GetBoxFmt( 0 ).SaveVerionNo( rStream ); >+ (*this)[ 0 ]->GetBoxFmt( 0 ).SaveVersionNo( rStream, AUTOFORMAT_FILE_VERSION ); > > rStream << (sal_uInt16)(Count() - 1); > bRet = 0 == rStream.GetError(); >@@ -1092,7 +1315,7 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const > for( sal_uInt16 i = 1; bRet && i < Count(); ++i ) > { > SwTableAutoFmt* pFmt = (*this)[ i ]; >- bRet = pFmt->Save( rStream ); >+ bRet = pFmt->Save( rStream, AUTOFORMAT_FILE_VERSION ); > } > } > rStream.Flush(); >diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx >index 7be23f3..f3d2b3e 100644 >--- a/sw/source/core/docnode/ndtbl.cxx >+++ b/sw/source/core/docnode/ndtbl.cxx >@@ -3721,7 +3721,8 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& > if( !aFndBox.GetLines().Count() ) > return sal_False; > >- pTblNd->GetTable().SetHTMLTableLayout( 0 ); >+ SwTable &table = pTblNd->GetTable(); >+ table.SetHTMLTableLayout( 0 ); > > _FndBox* pFndBox = &aFndBox; > while( 1 == pFndBox->GetLines().Count() && >@@ -3742,6 +3743,8 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& > GetIDocumentUndoRedo().DoUndo(false); > } > >+ rNew.RestoreTableProperties(table); >+ > _SetAFmtTabPara aPara( rNew ); > _FndLines& rFLns = pFndBox->GetLines(); > _FndLine* pLine; >@@ -3799,6 +3802,10 @@ sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet > if( !aFndBox.GetLines().Count() ) > return sal_False; > >+ // Store table properties >+ SwTable &table = pTblNd->GetTable(); >+ rGet.StoreTableProperties(table); >+ > _FndBox* pFndBox = &aFndBox; > while( 1 == pFndBox->GetLines().Count() && > 1 == pFndBox->GetLines()[0]->GetBoxes().Count() ) >diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx >index 3f14ca4..8031fa6 100644 >--- a/sw/source/core/inc/UndoTable.hxx >+++ b/sw/source/core/inc/UndoTable.hxx >@@ -162,6 +162,7 @@ class SwUndoTblAutoFmt : public SwUndo > _SaveTable* pSaveTbl; > ::std::vector< ::boost::shared_ptr<SwUndoTblNumFmt> > m_Undos; > sal_Bool bSaveCntntAttr; >+ sal_uInt16 nRepeatHeading; > > void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext); > >diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx >index e836f62..b8db355 100644 >--- a/sw/source/core/layout/atrfrm.cxx >+++ b/sw/source/core/layout/atrfrm.cxx >@@ -639,6 +639,17 @@ SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc ) > { > } > >+SwFmtPageDesc &SwFmtPageDesc::operator=(const SwFmtPageDesc &rCpy) >+{ >+ if (rCpy.GetPageDesc()) >+ RegisterToPageDesc(*const_cast<SwPageDesc*>(rCpy.GetPageDesc())); >+ nNumOffset = rCpy.nNumOffset; >+ nDescNameIdx = rCpy.nDescNameIdx; >+ pDefinedIn = 0; >+ >+ return *this; >+} >+ > SwFmtPageDesc::~SwFmtPageDesc() {} > > bool SwFmtPageDesc::KnowsPageDesc() const >@@ -1230,6 +1241,22 @@ bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) > return bRet; > } > >+SvStream& SwFmtVertOrient::Store(SvStream &rStream, sal_uInt16 version) const >+{ >+ rStream << nYPos << eOrient << eRelation; >+ return rStream; >+} >+ >+SfxPoolItem* SwFmtVertOrient::Create(SvStream &rStream, sal_uInt16 itemVersion) const >+{ >+ SwTwips yPos; >+ sal_Int16 orient; >+ sal_Int16 relation; >+ rStream >> yPos >> orient >> relation; >+ >+ return new SwFmtVertOrient(yPos, orient, relation); >+} >+ > // class SwFmtVertOrient > // Partially implemented inline in hxx > >diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx >index 0f295a1..305d093 100644 >--- a/sw/source/core/undo/untbl.cxx >+++ b/sw/source/core/undo/untbl.cxx >@@ -1472,7 +1472,8 @@ SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd, > const SwTableAutoFmt& rAFmt ) > : SwUndo( UNDO_TABLE_AUTOFMT ), > nSttNode( rTblNd.GetIndex() ), >- bSaveCntntAttr( sal_False ) >+ bSaveCntntAttr( sal_False ), >+ nRepeatHeading( rTblNd.GetTable().GetRowsToRepeat() ) > { > pSaveTbl = new _SaveTable( rTblNd.GetTable() ); > >@@ -1504,7 +1505,8 @@ SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext) > SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); > OSL_ENSURE( pTblNd, "kein TabellenNode" ); > >- _SaveTable* pOrig = new _SaveTable( pTblNd->GetTable() ); >+ SwTable& table = pTblNd->GetTable(); >+ _SaveTable* pOrig = new _SaveTable( table ); > // dann auch noch ueber die ContentNodes der EndBoxen und > // und alle Absatz-Attribute zusammen sammeln > if( bSaveCntntAttr ) >@@ -1516,6 +1518,8 @@ SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext) > { > m_Undos.at(n-1)->UndoImpl(rContext); > } >+ >+ table.SetRowsToRepeat(nRepeatHeading); > } > > pSaveTbl->RestoreAttr( pTblNd->GetTable(), !bUndo ); >diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx >index 23fb5bc..9053b15 100644 >--- a/sw/source/ui/table/tabledlg.cxx >+++ b/sw/source/ui/table/tabledlg.cxx >@@ -1409,7 +1409,7 @@ sal_Bool SwTextFlowPage::FillItemSet( SfxItemSet& rSet ) > { > sal_Bool bModified = sal_False; > >- //Ueberschrift wiederholen >+ // Repeat Heading > if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() || > String::CreateFromInt32( static_cast< sal_Int32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() ) > { >@@ -1432,7 +1432,7 @@ sal_Bool SwTextFlowPage::FillItemSet( SfxItemSet& rSet ) > > sal_Bool bState = aPageCollCB.IsChecked(); > >- //Wenn Seitenvorlage, dann kein Break >+ // If we have a page style, then there's no break > sal_Bool bPageItemPut = sal_False; > if ( bState != aPageCollCB.GetSavedValue() || > ( bState && >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 31005
: 60462