summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-09-16 23:45:34 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-09-16 23:45:34 +0300
commit0b089fb93d8e00dca5f436fc9715f527e3f6fdca (patch)
tree580f8aeb3232cbf63d9bd8b0019633293dae0f95
parentb3781d43adbc0c9701af80d393c302c9c2252ba2 (diff)
Remove SwTableAutoFmt from implementation
Remove the aforementioned class from the implementation, replacing it completely with SwTableFmt. May require further testing, but there seems to be no loss in functionality. Some of the functions of the AutoFormat dialog do not work completely, but the dialog needs to be modified alltogheter, so it is not a major issue. Also, saving/loading tables with styles applied does not work, but it will be remedied with the implementation of the the styles import/ export using the filters. Change-Id: I985655344ec88ecc33dae1d15e112d7e2302c700
-rw-r--r--sw/inc/doc.hxx15
-rw-r--r--sw/inc/editsh.hxx5
-rw-r--r--sw/inc/fesh.hxx5
-rw-r--r--sw/inc/swabstdlg.hxx12
-rw-r--r--sw/inc/swtblfmt.hxx6
-rw-r--r--sw/inc/tblafmt.hxx55
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/doc/tblafmt.cxx457
-rw-r--r--sw/source/core/doc/tblrwcl.cxx5
-rw-r--r--sw/source/core/docnode/ndcopy.cxx3
-rw-r--r--sw/source/core/docnode/ndtbl.cxx34
-rw-r--r--sw/source/core/edit/edtab.cxx8
-rw-r--r--sw/source/core/frmedt/fetab.cxx8
-rw-r--r--sw/source/core/inc/UndoTable.hxx9
-rw-r--r--sw/source/core/undo/untbl.cxx42
-rw-r--r--sw/source/core/unocore/unotbl.cxx27
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx39
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx14
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx10
-rw-r--r--sw/source/ui/inc/convert.hxx6
-rw-r--r--sw/source/ui/inc/dbinsdlg.hxx4
-rw-r--r--sw/source/ui/inc/instable.hxx7
-rw-r--r--sw/source/ui/inc/tautofmt.hxx13
-rw-r--r--sw/source/ui/shells/basesh.cxx47
-rw-r--r--sw/source/ui/table/convert.cxx12
-rw-r--r--sw/source/ui/table/instable.cxx18
-rw-r--r--sw/source/ui/table/tautofmt.cxx81
27 files changed, 299 insertions, 645 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 0ae40c861493..7ae0883b9690 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -162,8 +162,7 @@ class SwTOXType;
class SwTOXTypes;
class SwTabCols;
class SwTable;
-class SwTableAutoFmt;
-class SwTableAutoFmtTbl;
+class SwTableFmtTbl;
class SwTableBox;
class SwTableBoxFmt;
class SwTableFmt;
@@ -311,7 +310,7 @@ class SW_DLLPUBLIC SwDoc :
SwFrmFmts *mpSpzFrmFmtTbl;
SwSectionFmts *mpSectionFmtTbl;
SwFrmFmts *mpTblFrmFmtTbl; ///< For tables
- SwTableAutoFmtTbl *mpTblStyleTbl; ///< Table styles
+ SwTableFmtTbl *mpTblStyleTbl; ///< Table styles
SwTxtFmtColls *mpTxtFmtCollTbl; ///< FormatCollections
SwGrfFmtColls *mpGrfFmtCollTbl;
@@ -1285,7 +1284,7 @@ public:
SwTableFmt* MakeTblFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
void DelTblFrmFmt( SwTableFmt* pFmt );
SwTableFmt* FindTblFmtByName( const String& rName, sal_Bool bAll = sal_False ) const;
- SwTableAutoFmtTbl* GetTableStyles() { return mpTblStyleTbl; };
+ SwTableFmtTbl* GetTableStyles() { return mpTblStyleTbl; };
/** Access to frames.
Iterate over Flys - forr Basic-Collections. */
@@ -1606,7 +1605,7 @@ public:
const SwTable* InsertTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
const SwPosition& rPos, sal_uInt16 nRows,
sal_uInt16 nCols, short eAdjust,
- const SwTableAutoFmt* pTAFmt = 0,
+ const SwTableFmt* pTableStyle = 0,
const std::vector<sal_uInt16> *pColArr = 0,
sal_Bool bCalledFromShell = sal_False,
sal_Bool bNewModel = sal_True );
@@ -1619,7 +1618,7 @@ public:
const SwTable* TextToTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER,
const SwPaM& rRange, sal_Unicode cCh,
short eAdjust,
- const SwTableAutoFmt* = 0 );
+ const SwTableFmt* = 0 );
/// text to table conversion - API support
const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
@@ -1669,10 +1668,10 @@ public:
void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
/// AutoFormat for table/table selection.
- sal_Bool SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew );
+ sal_Bool SetTableStyle( const SwSelBoxes& rBoxes, const SwTableFmt* pStyle );
/// Query attributes.
- sal_Bool GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet );
+ sal_Bool GetTableStyle( const SwSelBoxes& rBoxes, SwTableFmt*& prStyle );
void AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable );
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 6e4972193a7f..b21c8c0426d5 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -82,7 +82,6 @@ class SwSectionFmt;
class SwTOXMarks;
class SwTOXBase;
class SwTOXType;
-class SwTableAutoFmt;
class SwPageDesc;
class SwTxtINetFmt;
class SwSeqFldList;
@@ -687,7 +686,7 @@ public:
const SwTable& InsertTable( const SwInsertTableOptions& rInsTblOpts, ///< ALL_TBL_INS_ATTR
sal_uInt16 nRows, sal_uInt16 nCols,
sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
- const SwTableAutoFmt* pTAFmt = 0 );
+ const SwTableFmt* pTableStyle = 0 );
void InsertDDETable( const SwInsertTableOptions& rInsTblOpts, ///< HEADLINE_NO_BORDER
SwDDEFieldType* pDDEType,
@@ -701,7 +700,7 @@ public:
sal_Bool TextToTable( const SwInsertTableOptions& rInsTblOpts, ///< ALL_TBL_INS_ATTR
sal_Unicode cCh,
sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
- const SwTableAutoFmt* pTAFmt = 0 );
+ const SwTableFmt* pTableStyle = 0 );
sal_Bool TableToText( sal_Unicode cCh );
sal_Bool IsTextToTableAvailable() const;
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index c68a6c055944..3c330888b381 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -40,7 +40,6 @@ class SwFlyFrm;
class SwTabCols;
class SvxBrushItem;
class SvxFrameDirectionItem;
-class SwTableAutoFmt;
class SwFrm;
class SwFmtFrmSize;
class SwFmtRowSplit;
@@ -678,9 +677,9 @@ public:
sal_Bool BalanceCellWidth( sal_Bool bTstOnly );
/// AutoFormat for table/ table selection.
- sal_Bool SetTableAutoFmt( const SwTableAutoFmt& rNew );
+ sal_Bool SetTableStyle( const SwTableFmt* pStyle );
- sal_Bool GetTableAutoFmt( SwTableAutoFmt& rGet );
+ sal_Bool GetTableStyle( SwTableFmt* pStyle );
sal_Bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index a7563b8c441f..f2f782139835 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -55,7 +55,7 @@ class SvStream;
class SwWrtShell;
class SfxRequest;
class SwView;
-class SwTableAutoFmt;
+class SwTableFmt;
class SwTOXMgr;
class SwForm;
struct CurTOXType;
@@ -123,8 +123,8 @@ class AbstractInsTableDlg : public VclAbstractDialog //add for SwInsTableDlg
{
public:
virtual void GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
- SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
- SwTableAutoFmt *& prTAFmt ) = 0;
+ SwInsertTableOptions& rInsTblFlags, String& rStyleName,
+ SwTableFmt *& prStyle ) = 0;
};
class AbstractJavaEditDialog : public VclAbstractDialog //add for SwJavaEditDialog
@@ -224,7 +224,7 @@ class AbstractSwConvertTableDlg : public VclAbstractDialog // add for SwConvert
public:
virtual void GetValues( sal_Unicode& rDelim,
SwInsertTableOptions& rInsTblFlags,
- SwTableAutoFmt const*& prTAFmt ) = 0;
+ SwTableFmt const*& prStyle ) = 0;
};
class AbstractSwInsertDBColAutoPilot : public VclAbstractDialog // add for SwInsertDBColAutoPilot
@@ -262,7 +262,7 @@ public:
class AbstractSwAutoFormatDlg : public VclAbstractDialog //add for SwAutoFormatDlg
{
public:
- virtual void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const = 0;
+ virtual void FillAutoFmtOfIndex( SwTableFmt*& rToFill ) const = 0;
};
class AbstractSwFldDlg : public SfxAbstractTabDialog //add for SwFldDlg
@@ -377,7 +377,7 @@ public:
virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg
sal_Bool bSetAutoFmt = sal_True,
- const SwTableAutoFmt* pSelFmt = 0 ) = 0;
+ const SwTableFmt* pSelFmt = 0 ) = 0;
virtual SfxAbstractDialog * CreateSwBorderDlg ( Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId ) = 0;//add for SwBorderDlg
virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, sal_Bool bDrawMode, int nResId ) = 0; //add for SwWrapDlg
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 6aecafc52260..30a324ed836a 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -63,6 +63,8 @@ class SwTableBoxFmt;
class SW_DLLPUBLIC SwTableFmt : public SwFrmFmt
{
friend class SwDoc;
+ friend class SwTableFmtTbl;
+ sal_uInt16 nStrResId;
protected:
SwTableFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
@@ -138,7 +140,7 @@ public:
static void AssignLineParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableBoxFmt* pSrcBoxFmt, SwTableBox& rBox );
static void AssignBoxParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableBoxFmt* pSrcBoxFmt, SwTableLine& rLine );
- sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc, sal_uInt16 nVal );
+ static SwTableFmt* Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc );
TYPEINFO(); // Already in base class Content.
@@ -244,8 +246,6 @@ public:
sal_Bool IsValueFormat() const;
sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer );
- sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
- sal_Bool SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const;
TYPEINFO(); // Already in base class Content.
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 05de6182283c..97c986a6cfdc 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -107,61 +107,28 @@ The properties saved are divided into three categories:
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
-{
- SwTableFmt* m_pTableStyle;
- sal_uInt16 nStrResId;
-
-public:
- SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle );
- SwTableAutoFmt( const SwTableAutoFmt& rNew );
-
- SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
-
- SwTableFmt* GetTableStyle() const { return m_pTableStyle; }
- SwTableFmt* GetTableStyle() { return m_pTableStyle; }
-
- void SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos );
- SwTableBoxFmt* GetBoxFmt( sal_uInt8 nPos ) const;
-
- void SetName( const String& rNew ) { m_pTableStyle->SetName( rNew ); nStrResId = USHRT_MAX; }
- const String& GetName() const { return m_pTableStyle->GetName(); }
-
- void RestoreTableProperties(SwTable &table) const;
- void StoreTableProperties(const SwTable &table);
-
- sal_Bool IsFont() const { return m_pTableStyle->IsFont(); }
- sal_Bool IsJustify() const { return m_pTableStyle->IsJustify(); }
- sal_Bool IsFrame() const { return m_pTableStyle->IsFrame(); }
- sal_Bool IsBackground() const { return m_pTableStyle->IsBackground(); }
- sal_Bool IsValueFormat() const { return m_pTableStyle->IsValueFormat(); }
-
- static SwTableAutoFmt* Load( SvStream& rStream, const SwAfVersions&, SwDoc* pDoc );
- sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
-};
-class SW_DLLPUBLIC SwTableAutoFmtTbl
+class SW_DLLPUBLIC SwTableFmtTbl
{
- struct Impl;
- ::boost::scoped_ptr<Impl> m_pImpl;
+ std::vector<SwTableFmt*> m_TableStyles;
SwDoc* m_pDoc;
SW_DLLPRIVATE sal_Bool Load( SvStream& rStream );
- SW_DLLPRIVATE sal_Bool Save( SvStream& rStream ) const;
public:
- explicit SwTableAutoFmtTbl(SwDoc* pDoc);
- ~SwTableAutoFmtTbl();
+ explicit SwTableFmtTbl(SwDoc* pDoc);
+ ~SwTableFmtTbl();
size_t size() const;
- SwTableAutoFmt const& operator[](size_t i) const;
- SwTableAutoFmt & operator[](size_t i);
- void InsertAutoFmt(size_t i, SwTableAutoFmt * pFmt);
- void EraseAutoFmt(size_t i);
- void MoveAutoFmt(size_t target, size_t source);
+ SwTableFmt const* operator[](size_t i) const;
+ SwTableFmt * operator[](size_t i);
+ SwTableFmt* MakeStyle( OUString sName );
+ SwTableFmt* FindStyle( OUString sName );
+ void InsertStyle(size_t i, SwTableFmt * pFmt);
+ void EraseStyle(size_t i);
+ void MoveStyle(size_t target, size_t source);
sal_Bool Load();
- sal_Bool Save() const;
};
#endif
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 9c699b3fa041..ae8947395ce8 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -355,7 +355,7 @@ SwDoc::SwDoc()
mpFrmFmtTbl->push_back(mpDfltFrmFmt);
mpCharFmtTbl->push_back(mpDfltCharFmt);
- mpTblStyleTbl = new SwTableAutoFmtTbl( this );
+ mpTblStyleTbl = new SwTableFmtTbl( this );
mpTblStyleTbl->Load();
/* FmtColls */
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 2ff9b387e40f..964f5b3d6e46 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -433,228 +433,14 @@ sal_Bool SwTableBoxFmt::Load( SvStream& rStream, const SwAfVersions& rVersions,
return 0 == rStream.GetError();
}
-sal_Bool SwTableBoxFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
-{
- SvxFontItem aFont = GetFont();
- aFont.Store( rStream, aFont.GetVersion(fileVersion) );
-
- SvxFontHeightItem aHeight = GetHeight();
- aHeight.Store( rStream, aHeight.GetVersion(fileVersion) );
-
- SvxWeightItem aWeight = GetWeight();
- aWeight.Store( rStream, aWeight.GetVersion(fileVersion) );
-
- SvxPostureItem aPosture = GetPosture();
- aPosture.Store( rStream, aPosture.GetVersion(fileVersion) );
-
- SvxFontItem aCJKFont = GetCJKFont();
- aCJKFont.Store( rStream, aCJKFont.GetVersion(fileVersion) );
-
- SvxFontHeightItem aCJKHeight = GetCJKHeight();
- aCJKHeight.Store( rStream, aCJKHeight.GetVersion(fileVersion) );
-
- SvxWeightItem aCJKWeight = GetCJKWeight();
- aCJKWeight.Store( rStream, aCJKWeight.GetVersion(fileVersion) );
-
- SvxPostureItem aCJKPosture = GetCJKPosture();
- aCJKPosture.Store( rStream, aCJKPosture.GetVersion(fileVersion) );
-
- SvxFontItem aCTLFont = GetCTLFont();
- aCTLFont.Store( rStream, aCTLFont.GetVersion(fileVersion) );
-
- SvxFontHeightItem aCTLHeight = GetCTLHeight();
- aCTLHeight.Store( rStream, aCTLHeight.GetVersion(fileVersion) );
-
- SvxWeightItem aCTLWeight = GetCTLWeight();
- aCTLWeight.Store( rStream, aCTLWeight.GetVersion(fileVersion) );
-
- SvxPostureItem aCTLPosture = GetCTLPosture();
- aCTLPosture.Store( rStream, aCTLPosture.GetVersion(fileVersion) );
-
- SvxUnderlineItem aUnderline = GetUnderline();
- aUnderline.Store( rStream, aUnderline.GetVersion(fileVersion) );
-
- SvxOverlineItem aOverline = GetOverline();
- aOverline.Store( rStream, aOverline.GetVersion(fileVersion) );
-
- SvxCrossedOutItem aCrossedOut = GetCrossedOut();
- aCrossedOut.Store( rStream, aCrossedOut.GetVersion(fileVersion) );
-
- SvxContourItem aContour = GetContour();
- aContour.Store( rStream, aContour.GetVersion(fileVersion) );
-
- SvxShadowedItem aShadowed = GetShadowed();
- aShadowed.Store( rStream, aShadowed.GetVersion(fileVersion) );
-
- SvxColorItem aColor = GetColor();
- aColor.Store( rStream, aColor.GetVersion(fileVersion) );
-
- SvxBoxItem aBox = GetBox();
- aBox.Store( rStream, aBox.GetVersion(fileVersion) );
-
- SvxBrushItem aBackground = GetBackground();
- aBackground.Store( rStream, aBackground.GetVersion(fileVersion) );
-
- SvxAdjustItem aAdjust = GetAdjust();
- aAdjust.Store( rStream, aAdjust.GetVersion(fileVersion) );
-
- if (fileVersion >= SOFFICE_FILEFORMAT_50)
- {
- WriterSpecificAutoFormatBlock block(rStream);
-
- SvxFrameDirectionItem aTextOrientation = GetTextOrientation();
- aTextOrientation.Store(rStream, aTextOrientation.GetVersion(fileVersion));
-
- SwFmtVertOrient aVerticalAlignment = GetVerticalAlignment();
- aVerticalAlignment.Store(rStream, aVerticalAlignment.GetVersion(fileVersion));
- }
-
- // --- from 680/dr25 on: store strings as UTF-8
- write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, sNumFmtString,
- RTL_TEXTENCODING_UTF8);
- rStream << (sal_uInt16)eSysLanguage << (sal_uInt16)eNumFmtLanguage;
-
- return 0 == rStream.GetError();
-}
-
-
-sal_Bool SwTableBoxFmt::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const
-{
- rStream << GetFont().GetVersion( fileVersion );
- rStream << GetHeight().GetVersion( fileVersion );
- rStream << GetWeight().GetVersion( fileVersion );
- rStream << GetPosture().GetVersion( fileVersion );
- rStream << GetUnderline().GetVersion( fileVersion );
- rStream << GetOverline().GetVersion( fileVersion );
- rStream << GetCrossedOut().GetVersion( fileVersion );
- rStream << GetContour().GetVersion( fileVersion );
- rStream << GetShadowed().GetVersion( fileVersion );
- rStream << GetColor().GetVersion( fileVersion );
- rStream << GetBox().GetVersion( fileVersion );
- rStream << GetBackground().GetVersion( fileVersion );
- rStream << GetAdjust().GetVersion( fileVersion );
-
- if (fileVersion >= SOFFICE_FILEFORMAT_50)
- {
- WriterSpecificAutoFormatBlock block(rStream);
-
- rStream << GetTextOrientation().GetVersion(fileVersion);
- rStream << GetVerticalAlignment().GetVersion(fileVersion);
- }
-
- rStream << (sal_uInt16)0; // NumberFormat
-
- return 0 == rStream.GetError();
-}
-
-
-
-SwTableAutoFmt::SwTableAutoFmt( const String& rName, SwTableFmt* pTableStyle )
- : m_pTableStyle( pTableStyle )
- , nStrResId( USHRT_MAX )
-{
- m_pTableStyle->SetName( rName );
-}
-
-
-SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew )
-{
- *this = rNew;
-}
-
-SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
-{
- if (&rNew == this)
- return *this;
-
- m_pTableStyle = rNew.m_pTableStyle;
- nStrResId = rNew.nStrResId;
-
- return *this;
-}
-
-void SwTableAutoFmt::SetBoxFmt( const SwTableBoxFmt& rNew, sal_uInt8 nPos )
-{
- m_pTableStyle->SetBoxFmt( rNew, nPos );
-}
-
-
-SwTableBoxFmt* SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
-{
- return m_pTableStyle->GetBoxFmt( nPos );
-}
-
-void SwTableAutoFmt::RestoreTableProperties(SwTable &table) const
-{
- SwTableFmt::RestoreTableProperties( m_pTableStyle, table );
-}
-
-void SwTableAutoFmt::StoreTableProperties(const SwTable &table)
-{
- m_pTableStyle = SwTableFmt::StoreTableProperties( table );
-}
-
-sal_Bool SwTableFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc, sal_uInt16 nVal )
+SwTableFmt* SwTableFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc )
{
+ SwTableFmt* pRet = NULL;
sal_Bool bRet = 0 == rStream.GetError();
- if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
- {
- SfxPoolItem* pNew = 0;
-
- SvxFmtBreakItem aBreak = SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK );
- READ( aBreak, SvxFmtBreakItem, AUTOFORMAT_FILE_VERSION );
- SetBreak( aBreak );
-
- SwFmtPageDesc aPageDesc;
- READ( aPageDesc, SwFmtPageDesc, AUTOFORMAT_FILE_VERSION );
- SetPageDesc( aPageDesc );
-
- SvxFmtKeepItem aKeepWithNextPara = SvxFmtKeepItem( sal_False, RES_KEEP );
- READ( aKeepWithNextPara, SvxFmtKeepItem, AUTOFORMAT_FILE_VERSION );
- SetKeepWithNextPara( aKeepWithNextPara );
-
- sal_uInt16 aRepeatHeading;
- sal_Bool bLayoutSplit;
- sal_Bool bRowSplit;
- sal_Bool bCollapsingBorders;
- rStream >> aRepeatHeading >> bLayoutSplit >> bRowSplit >> bCollapsingBorders;
- SetRepeatHeading( aRepeatHeading );
- SetRowSplit( bRowSplit );
- SetLayoutSplit( bLayoutSplit );
- SetCollapsingBorders( bCollapsingBorders );
-
- SvxShadowItem aShadow = SvxShadowItem( RES_SHADOW );
- READ( aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION );
- SetShadow( aShadow );
- }
-
- bRet = 0 == rStream.GetError();
-
- for( sal_uInt8 i = 0; bRet && i < 16; ++i )
- {
- SwTableBoxFmt* pFmt = pDoc->MakeTableBoxFmt();
-
- bRet = pFmt->Load( rStream, rVersions, nVal );
- if( bRet )
- SetBoxFmt( *pFmt, i );
- else
- {
- delete pFmt;
- break;
- }
- }
-
- return bRet;
-}
-
-SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, SwDoc* pDoc )
-{
- SwTableAutoFmt* pRet = NULL;
-
sal_uInt16 nVal = 0;
rStream >> nVal;
- sal_Bool bRet = 0 == rStream.GetError();
+ bRet = 0 == rStream.GetError();
if( bRet && (nVal == AUTOFORMAT_DATA_ID_X ||
(AUTOFORMAT_DATA_ID_504 <= nVal && nVal <= AUTOFORMAT_DATA_ID)) )
@@ -677,13 +463,7 @@ SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVe
nStrResId = USHRT_MAX;
}
- // FIXME Yuk! we are creating the table styles ATM, but in the targetted
- // ideal, the table styles are created with the document
- SwTableFmt* pStyle = pDoc->FindTblFmtByName(aName);
- if ( !pStyle )
- pStyle = pDoc->MakeTblFrmFmt( aName, pDoc->GetDfltFrmFmt() );
- pRet = new SwTableAutoFmt( aName, pStyle );
-
+ pRet = pDoc->GetTableStyles()->MakeStyle( aName );
pRet->nStrResId = nStrResId;
// No longer needed, but still read to not misread other data
@@ -695,107 +475,131 @@ SwTableAutoFmt* SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVe
rStream >> b;
// <- close
- bRet = pStyle->Load( rStream, rVersions, pDoc, nVal );
+ if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
+ {
+ SfxPoolItem* pNew = 0;
+
+ SvxFmtBreakItem aBreak = SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK );
+ READ( aBreak, SvxFmtBreakItem, AUTOFORMAT_FILE_VERSION );
+ pRet->SetBreak( aBreak );
+
+ SwFmtPageDesc aPageDesc;
+ READ( aPageDesc, SwFmtPageDesc, AUTOFORMAT_FILE_VERSION );
+ pRet->SetPageDesc( aPageDesc );
+
+ SvxFmtKeepItem aKeepWithNextPara = SvxFmtKeepItem( sal_False, RES_KEEP );
+ READ( aKeepWithNextPara, SvxFmtKeepItem, AUTOFORMAT_FILE_VERSION );
+ pRet->SetKeepWithNextPara( aKeepWithNextPara );
+
+ sal_uInt16 aRepeatHeading;
+ sal_Bool bLayoutSplit;
+ sal_Bool bRowSplit;
+ sal_Bool bCollapsingBorders;
+ rStream >> aRepeatHeading >> bLayoutSplit >> bRowSplit >> bCollapsingBorders;
+ pRet->SetRepeatHeading( aRepeatHeading );
+ pRet->SetRowSplit( bRowSplit );
+ pRet->SetLayoutSplit( bLayoutSplit );
+ pRet->SetCollapsingBorders( bCollapsingBorders );
+
+ SvxShadowItem aShadow = SvxShadowItem( RES_SHADOW );
+ READ( aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION );
+ pRet->SetShadow( aShadow );
+ }
+
+ bRet = 0 == rStream.GetError();
+
+ for( sal_uInt8 i = 0; bRet && i < 16; ++i )
+ {
+ SwTableBoxFmt* pFmt = pDoc->MakeTableBoxFmt();
+
+ bRet = pFmt->Load( rStream, rVersions, nVal );
+ if( bRet )
+ pRet->SetBoxFmt( *pFmt, i );
+ else
+ {
+ delete pFmt;
+ break;
+ }
+ }
}
if ( !bRet )
{
delete pRet;
pRet = NULL;
}
+
return pRet;
}
-sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
+size_t SwTableFmtTbl::size() const
{
- sal_uInt16 nVal = AUTOFORMAT_DATA_ID;
- rStream << nVal;
- // --- from 680/dr25 on: store strings as UTF-8
- write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, GetName(),
- RTL_TEXTENCODING_UTF8 );
- rStream << nStrResId;
-
- {
- WriterSpecificAutoFormatBlock block(rStream);
-
- SvxFmtBreakItem m_aBreak = m_pTableStyle->GetBreak();
- m_aBreak.Store(rStream, m_aBreak.GetVersion(fileVersion));
-
- SwFmtPageDesc m_aPageDesc = m_pTableStyle->GetPageDesc();
- m_aPageDesc.Store(rStream, m_aPageDesc.GetVersion(fileVersion));
-
- SvxFmtKeepItem m_aKeepWithNextPara = m_pTableStyle->GetKeepWithNextPara();
- m_aKeepWithNextPara.Store(rStream, m_aKeepWithNextPara.GetVersion(fileVersion));
-
- rStream << m_pTableStyle->GetRepeatHeading();
- rStream << m_pTableStyle->GetLayoutSplit();
- rStream << m_pTableStyle->GetRowSplit();
- rStream << m_pTableStyle->GetCollapsingBorders();
-
- SvxShadowItem m_aShadow = m_pTableStyle->GetShadow();
- m_aShadow.Store(rStream, m_aShadow.GetVersion(fileVersion));
- }
-
- sal_Bool bRet = 0 == rStream.GetError();
-
- for( int i = 0; bRet && i < 16; ++i )
- {
- SwTableBoxFmt* pFmt = GetBoxFmt( i );
-
- bRet = pFmt->Save( rStream, fileVersion );
- }
- return bRet;
+ return m_TableStyles.size();
}
-
-struct SwTableAutoFmtTbl::Impl
+SwTableFmt const* SwTableFmtTbl::operator[](size_t const i) const
{
- boost::ptr_vector<SwTableAutoFmt> m_AutoFormats;
-};
-
-size_t SwTableAutoFmtTbl::size() const
+ return m_TableStyles[i];
+}
+SwTableFmt * SwTableFmtTbl::operator[](size_t const i)
{
- return m_pImpl->m_AutoFormats.size();
+ return m_TableStyles[i];
}
-SwTableAutoFmt const& SwTableAutoFmtTbl::operator[](size_t const i) const
+SwTableFmt* SwTableFmtTbl::MakeStyle( OUString sName )
{
- return m_pImpl->m_AutoFormats[i];
+ SwTableFmt* pStyle = new SwTableFmt( m_pDoc->GetAttrPool(), sName, m_pDoc->GetDfltFrmFmt() );
+ m_TableStyles.push_back( pStyle );
+ m_pDoc->SetModified();
+
+ return pStyle;
}
-SwTableAutoFmt & SwTableAutoFmtTbl::operator[](size_t const i)
+
+SwTableFmt* SwTableFmtTbl::FindStyle( OUString sName )
{
- return m_pImpl->m_AutoFormats[i];
+ SwTableFmt* pFnd = 0;
+ for( sal_uInt16 n = 0; n < m_TableStyles.size(); n++ )
+ {
+ if( m_TableStyles[ n ]->GetName() == sName )
+ {
+ pFnd = m_TableStyles[ n ];
+ break;
+ }
+ }
+
+ return pFnd;
}
-void
-SwTableAutoFmtTbl::InsertAutoFmt(size_t const i, SwTableAutoFmt *const pFmt)
+void SwTableFmtTbl::InsertStyle(size_t const i, SwTableFmt * pFmt)
{
- m_pImpl->m_AutoFormats.insert(m_pImpl->m_AutoFormats.begin() + i, pFmt);
+ m_TableStyles.insert(m_TableStyles.begin() + i, pFmt);
}
-void SwTableAutoFmtTbl::EraseAutoFmt(size_t const i)
+void SwTableFmtTbl::EraseStyle(size_t const i)
{
- m_pImpl->m_AutoFormats.erase(m_pImpl->m_AutoFormats.begin() + i);
+ m_TableStyles.erase(m_TableStyles.begin() + i);
}
-void SwTableAutoFmtTbl::MoveAutoFmt(size_t const target, size_t source)
+void SwTableFmtTbl::MoveStyle(size_t const target, size_t source)
{
- m_pImpl->m_AutoFormats.transfer(m_pImpl->m_AutoFormats.begin() + target,
- m_pImpl->m_AutoFormats.begin() + source, m_pImpl->m_AutoFormats);
+ m_TableStyles.insert( m_TableStyles.begin() + target, m_TableStyles[ source ] );
+ m_TableStyles.erase( m_TableStyles.begin() + source );
}
-SwTableAutoFmtTbl::~SwTableAutoFmtTbl()
+SwTableFmtTbl::~SwTableFmtTbl()
{
+ for( sal_uInt16 n = 0; n < m_TableStyles.size(); n++ )
+ {
+ delete m_TableStyles[ n ];
+ m_TableStyles.erase( m_TableStyles.begin() + n );
+ }
}
-SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
- : m_pImpl(new Impl)
- , m_pDoc( pDoc)
+SwTableFmtTbl::SwTableFmtTbl(SwDoc* pDoc)
+ : m_pDoc( pDoc)
{
OUString sNm;
sNm = SwStyleNameMapper::GetUIName( RES_POOLCOLL_STANDARD, sNm );
- SwTableFmt* pStyle = pDoc->MakeTblFrmFmt( sNm, pDoc->GetDfltFrmFmt() );
-
- SwTableAutoFmt* pNewTableAutoFmt = new SwTableAutoFmt( sNm, pStyle );
+ SwTableFmt* pNewTableStyle = MakeStyle( sNm );
SwTableBoxFmt* pNewBoxFmt = pDoc->MakeTableBoxFmt();
@@ -807,13 +611,13 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
pNewBoxFmt->SetColor( SvxColorItem(Color( COL_WHITE ), RES_CHRATR_COLOR) );
for( i = 0; i < 4; ++i )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
// 70% gray
aBrushItem.SetColor( RGB_COLORDATA( 0x4d, 0x4d, 0x4d ) );
pNewBoxFmt->SetBackground( aBrushItem );
for( i = 4; i <= 12; i += 4 )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
// 20% gray
aBrushItem.SetColor( RGB_COLORDATA( 0xcc, 0xcc, 0xcc ) );
@@ -821,16 +625,16 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
aColor.SetColor( COL_BLACK );
pNewBoxFmt->SetColor( SvxColorItem( aColor, RES_CHRATR_COLOR) );
for( i = 7; i <= 15; i += 4 )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
for( i = 13; i <= 14; ++i )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
aBrushItem.SetColor( Color( COL_WHITE ) );
pNewBoxFmt->SetBackground( aBrushItem );
for( i = 5; i <= 6; ++i )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
for( i = 9; i <= 10; ++i )
- pNewTableAutoFmt->SetBoxFmt( *pNewBoxFmt, i );
+ pNewTableStyle->SetBoxFmt( *pNewBoxFmt, i );
SvxBoxItem aBox( RES_BOX );
@@ -843,13 +647,11 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl(SwDoc* pDoc)
{
aBox.SetLine( i <= 3 ? &aLn : 0, BOX_LINE_TOP );
aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, BOX_LINE_RIGHT );
- pNewTableAutoFmt->GetBoxFmt( i )->SetBox( aBox );
+ pNewTableStyle->GetBoxFmt( i )->SetBox( aBox );
}
-
- m_pImpl->m_AutoFormats.push_back(pNewTableAutoFmt);
}
-sal_Bool SwTableAutoFmtTbl::Load()
+sal_Bool SwTableFmtTbl::Load()
{
sal_Bool bRet = sal_False;
String sNm(OUString(sAutoTblFmtName));
@@ -864,17 +666,7 @@ sal_Bool SwTableAutoFmtTbl::Load()
return bRet;
}
-sal_Bool SwTableAutoFmtTbl::Save() const
-{
- SvtPathOptions aPathOpt;
- String sNm( aPathOpt.GetUserConfigPath() );
- sNm += INET_PATH_TOKEN;
- sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName ));
- SfxMedium aStream(sNm, STREAM_STD_WRITE );
- return Save( *aStream.GetOutStream() ) && aStream.Commit();
-}
-
-sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
+sal_Bool SwTableFmtTbl::Load( SvStream& rStream )
{
sal_Bool bRet = 0 == rStream.GetError();
if (bRet)
@@ -913,7 +705,7 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
{
aVersions.Load( rStream, nVal ); // Item versions
- SwTableAutoFmt* pNew;
+ SwTableFmt* pNew;
sal_uInt16 nAnz = 0;
rStream >> nAnz;
@@ -921,12 +713,8 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
for( sal_uInt16 i = 0; i < nAnz; ++i )
{
- pNew = SwTableAutoFmt::Load( rStream, aVersions, m_pDoc );
- if( pNew )
- {
- m_pImpl->m_AutoFormats.push_back(pNew);
- }
- else
+ pNew = SwTableFmt::Load( rStream, aVersions, m_pDoc );
+ if( !pNew )
{
bRet = false;
break;
@@ -942,39 +730,4 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
return bRet;
}
-
-sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
-{
- sal_Bool bRet = 0 == rStream.GetError();
- if (bRet)
- {
- rStream.SetVersion(AUTOFORMAT_FILE_VERSION);
-
- // Attention: We need to save a general Header here
- sal_uInt16 nVal = AUTOFORMAT_ID;
- rStream << nVal
- << (sal_uInt8)2 // Character count of the Header including this value
- << (sal_uInt8)GetStoreCharSet( ::osl_getThreadTextEncoding() );
-
- bRet = 0 == rStream.GetError();
-
- // Write this version number for all attributes
- m_pImpl->m_AutoFormats[0].GetBoxFmt(0)->SaveVersionNo(
- rStream, AUTOFORMAT_FILE_VERSION);
-
- rStream << static_cast<sal_uInt16>(m_pImpl->m_AutoFormats.size() - 1);
- bRet = 0 == rStream.GetError();
-
- for (sal_uInt16 i = 1; bRet && i < m_pImpl->m_AutoFormats.size(); ++i)
- {
- SwTableAutoFmt const& rFmt = m_pImpl->m_AutoFormats[i];
- bRet = rFmt.Save(rStream, AUTOFORMAT_FILE_VERSION);
- }
- }
- rStream.Flush();
- return bRet;
-}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 53514b19c9fb..1fd52400ce63 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -2154,14 +2154,11 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
}
SwTableFmt* pStyle = (SwTableFmt*)GetTableFmt()->GetRegisteredIn();
- SwTableAutoFmt* pAutoFmt = 0;
- if( pStyle )
- pAutoFmt = new SwTableAutoFmt( pStyle->GetName(), pStyle );
SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable(
SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
rPos, 1, 1, GetFrmFmt()->GetHoriOrient().GetHoriOrient(),
- pAutoFmt, 0, sal_False, IsNewModel() );
+ pStyle, 0, sal_False, IsNewModel() );
if( !pNewTbl )
return false;
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 370807d94ffa..22d7f4e47309 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -37,6 +37,7 @@
#include <mvsave.hxx>
#include <cellatr.hxx>
#include <swtblfmt.hxx>
+#include <tblafmt.hxx>
#include <swddetbl.hxx>
#include <docary.hxx>
#include <fmtcnct.hxx>
@@ -429,7 +430,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
}
SwTableFmt* pStyle = (SwTableFmt*)GetTable().GetTableFmt()->GetRegisteredIn();
- SwTableFmt* pActualStyle = pStyle ? pDoc->FindTblFmtByName( pStyle->GetName() , sal_True ) : 0;
+ SwTableFmt* pActualStyle = pStyle ? pDoc->GetTableStyles()->FindStyle( pStyle->GetName() ) : 0;
if( !pActualStyle )
pActualStyle = pStyle;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d67ca3af7860..971cffa87dd8 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -306,7 +306,7 @@ sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd,
const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
const SwPosition& rPos, sal_uInt16 nRows,
sal_uInt16 nCols, sal_Int16 eAdjust,
- const SwTableAutoFmt* pTAFmt,
+ const SwTableFmt* pTableStyle,
const std::vector<sal_uInt16> *pColArr,
sal_Bool bCalledFromShell,
sal_Bool bNewModel )
@@ -332,7 +332,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
{
GetIDocumentUndoRedo().AppendUndo(
new SwUndoInsTbl( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust),
- rInsTblOpts, pTAFmt, pColArr,
+ rInsTblOpts, pTableStyle, pColArr,
aTblName));
}
@@ -368,8 +368,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
// Create the Box/Line/Table construct
SwTableLineFmt* pLineFmt = MakeTableLineFmt();
- SwTableFmt* pTableStyle = pTAFmt ? pTAFmt->GetTableStyle() : NULL;
- SwTableFmt* pTableFmt = MakeTblFrmFmt( aTblName, pTableStyle );
+ SwTableFmt* pTableFmt = MakeTblFrmFmt( aTblName, const_cast<SwTableFmt*>( pTableStyle ) );
/* If the node to insert the table at is a context node and has a
non-default FRAMEDIR propagate it to the table. */
@@ -464,7 +463,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
if( bDfltBorders )
{
sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
- pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTAFmt == 0);
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTableStyle == 0);
}
else
pBoxF = pBoxFmt;
@@ -492,7 +491,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
}
}
- SwTableFmt::AssignFormatParents( pTableStyle, *pNdTbl );
+ SwTableFmt::AssignFormatParents( const_cast<SwTableFmt*>( pTableStyle ), *pNdTbl );
// Insert Frms
GetNodes().GoNext( &aNdIdx ); // Go to the next ContentNode
@@ -580,7 +579,7 @@ SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx,
const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
const SwPaM& rRange, sal_Unicode cCh,
sal_Int16 eAdjust,
- const SwTableAutoFmt* pTAFmt )
+ const SwTableFmt* pTableStyle )
{
// See if the selection contains a Table
const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
@@ -603,7 +602,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
{
GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL );
pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh,
- static_cast<sal_uInt16>(eAdjust), pTAFmt );
+ static_cast<sal_uInt16>(eAdjust), pTableStyle );
GetIDocumentUndoRedo().AppendUndo( pUndo );
// Do not add splitting the TextNode to the Undo history
@@ -652,8 +651,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
// Create the Box/Line/Table construct
SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
SwTableLineFmt* pLineFmt = MakeTableLineFmt();
- SwTableFmt* pTableStyle = pTAFmt ? pTAFmt->GetTableStyle() : NULL;
- SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), pTableStyle );
+ SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), const_cast<SwTableFmt*>( pTableStyle ) );
// All Lines have a left-to-right Fill Order
pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
@@ -706,7 +704,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
pNdTbl->RegisterToFormat( *pTableFmt );
- if( pTAFmt || rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER )
+ if( pTableStyle || rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER )
{
sal_uInt8 nBoxArrLen = 4;
boost::scoped_ptr< DfltBoxAttrList_t > aBoxFmtArr1;
@@ -733,10 +731,10 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
sal_uInt8 nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
if( bUseBoxFmt )
- ::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId, pTAFmt == 0 );
+ ::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId, pTableStyle == 0 );
else
{
- pBoxF = ::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTAFmt == 0 );
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTableStyle == 0 );
pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
pBox->ChgFrmFmt( pBoxF );
}
@@ -744,7 +742,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
}
}
- SwTableFmt::AssignFormatParents( pTableStyle, *pNdTbl );
+ SwTableFmt::AssignFormatParents( const_cast<SwTableFmt*>( pTableStyle ), *pNdTbl );
// Check the Boxes' for Numbers
if( IsInsTblFormatNum() )
@@ -3553,7 +3551,7 @@ sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev,
/**
* AutoFormat for the Table/TableSelection
*/
-sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew )
+sal_Bool SwDoc::SetTableStyle( const SwSelBoxes& rBoxes, const SwTableFmt* pStyle )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
@@ -3582,7 +3580,7 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
GetIDocumentUndoRedo().DoUndo(false);
}
- rNew.RestoreTableProperties(table);
+ SwTableFmt::RestoreTableProperties( const_cast<SwTableFmt*>( pStyle ), table );
if( pUndo )
{
@@ -3599,7 +3597,7 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
/**
* Find out who has the Attributes
*/
-sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet )
+sal_Bool SwDoc::GetTableStyle( const SwSelBoxes& rBoxes, SwTableFmt*& prStyle )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
@@ -3617,7 +3615,7 @@ sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet
// Store table properties
SwTable &table = pTblNd->GetTable();
- rGet.GetTableStyle()->StoreTableProperties(table);
+ prStyle = SwTableFmt::StoreTableProperties( table );
return sal_True;
}
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index a0b5de7592e2..33bdd581595c 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -91,7 +91,7 @@ sal_Bool ConvertTableToText( const SwTableNode *pConstTableNode, sal_Unicode cCh
const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts,
sal_uInt16 nRows, sal_uInt16 nCols,
sal_Int16 eAdj,
- const SwTableAutoFmt* pTAFmt )
+ const SwTableFmt* pTableStyle )
{
StartAllAction();
SwPosition* pPos = GetCrsr()->GetPoint();
@@ -107,7 +107,7 @@ const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts
// from pPos to the new content nodes in the table.
const SwTable *pTable = GetDoc()->InsertTable( rInsTblOpts, *pPos,
nRows, nCols,
- eAdj, pTAFmt,
+ eAdj, pTableStyle,
0, sal_True );
if( bEndUndo )
EndUndo( UNDO_END );
@@ -119,7 +119,7 @@ const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts
sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
sal_Unicode cCh,
sal_Int16 eAdj,
- const SwTableAutoFmt* pTAFmt )
+ const SwTableFmt* pTableStyle )
{
SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
sal_Bool bRet = sal_False;
@@ -127,7 +127,7 @@ sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() )
bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, *PCURCRSR, cCh,
- eAdj, pTAFmt );
+ eAdj, pTableStyle );
FOREACHPAM_END()
EndAllAction();
return bRet;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 24424386ba21..314833fcff8c 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1251,7 +1251,7 @@ sal_Bool SwFEShell::IsAdjustCellWidthAllowed( sal_Bool bBalance ) const
}
// AutoFormat for the table/table selection
-sal_Bool SwFEShell::SetTableAutoFmt( const SwTableAutoFmt& rNew )
+sal_Bool SwFEShell::SetTableStyle( const SwTableFmt* pStyle )
{
SwTableNode *pTblNd = (SwTableNode*)IsCrsrInTbl();
if( !pTblNd || pTblNd->GetTable().IsTblComplex() )
@@ -1280,7 +1280,7 @@ sal_Bool SwFEShell::SetTableAutoFmt( const SwTableAutoFmt& rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- bRet = GetDoc()->SetTableAutoFmt( aBoxes, rNew );
+ bRet = GetDoc()->SetTableStyle( aBoxes, pStyle );
DELETEZ( pLastCols );
DELETEZ( pLastRows );
EndAllActionAndCall();
@@ -1290,7 +1290,7 @@ sal_Bool SwFEShell::SetTableAutoFmt( const SwTableAutoFmt& rNew )
return bRet;
}
-sal_Bool SwFEShell::GetTableAutoFmt( SwTableAutoFmt& rGet )
+sal_Bool SwFEShell::GetTableStyle( SwTableFmt* pStyle )
{
const SwTableNode *pTblNd = IsCrsrInTbl();
if( !pTblNd || pTblNd->GetTable().IsTblComplex() )
@@ -1314,7 +1314,7 @@ sal_Bool SwFEShell::GetTableAutoFmt( SwTableAutoFmt& rGet )
}
}
- return GetDoc()->GetTableAutoFmt( aBoxes, rGet );
+ return GetDoc()->GetTableStyle( aBoxes, pStyle );
}
/***********************************************************************
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index ebd871dbe4e5..5229c44884ca 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -44,7 +44,6 @@ class SwTableBox;
class SwStartNode;
class SwTableNode;
class SwTableFmt;
-class SwTableAutoFmt;
class SwTableSortBoxes;
class SwUndoInsTbl : public SwUndo
@@ -54,7 +53,7 @@ class SwUndoInsTbl : public SwUndo
SwDDEFieldType* pDDEFldType;
std::vector<sal_uInt16> *pColWidth;
SwRedlineData* pRedlData;
- SwTableAutoFmt* pAutoFmt;
+ OUString sStyleName;
sal_uLong nSttNode;
sal_uInt16 nRows, nCols;
sal_uInt16 nAdjust;
@@ -62,7 +61,7 @@ class SwUndoInsTbl : public SwUndo
public:
SwUndoInsTbl( const SwPosition&, sal_uInt16 nCols, sal_uInt16 nRows,
sal_uInt16 eAdjust, const SwInsertTableOptions& rInsTblOpts,
- const SwTableAutoFmt* pTAFmt, const std::vector<sal_uInt16> *pColArr,
+ const SwTableFmt* pStyle, const std::vector<sal_uInt16> *pColArr,
const String & rName);
virtual ~SwUndoInsTbl();
@@ -79,7 +78,7 @@ class SwUndoTxtToTbl : public SwUndo, public SwUndRng
String sTblNm;
SwInsertTableOptions aInsTblOpts;
std::vector<sal_uLong>* pDelBoxes;
- SwTableAutoFmt* pAutoFmt;
+ OUString sStyleName;
SwHistory* pHistory;
sal_Unicode cTrenner;
sal_uInt16 nAdjust;
@@ -88,7 +87,7 @@ class SwUndoTxtToTbl : public SwUndo, public SwUndRng
public:
SwUndoTxtToTbl( const SwPaM&, const SwInsertTableOptions&, sal_Unicode,
sal_uInt16,
- const SwTableAutoFmt* pAFmt );
+ const SwTableFmt* pStyle );
virtual ~SwUndoTxtToTbl();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 5fa3d2affa8e..462e26f88b0d 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -223,19 +223,22 @@ sal_uInt16 aSave_BoxCntntSet[] = {
SwUndoInsTbl::SwUndoInsTbl( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt16 nRw,
sal_uInt16 nAdj, const SwInsertTableOptions& rInsTblOpts,
- const SwTableAutoFmt* pTAFmt,
+ const SwTableFmt* pTableStyle,
const std::vector<sal_uInt16> *pColArr,
const String & rName)
: SwUndo( UNDO_INSTABLE ),
- aInsTblOpts( rInsTblOpts ), pDDEFldType( 0 ), pColWidth( 0 ), pRedlData( 0 ), pAutoFmt( 0 ),
+ aInsTblOpts( rInsTblOpts ), pDDEFldType( 0 ), pColWidth( 0 ), pRedlData( 0 ),
nSttNode( rPos.nNode.GetIndex() ), nRows( nRw ), nCols( nCl ), nAdjust( nAdj )
{
+ if( pTableStyle )
+ sStyleName = pTableStyle->GetName();
+ else
+ sStyleName = UniString::EmptyString();
+
if( pColArr )
{
pColWidth = new std::vector<sal_uInt16>(*pColArr);
}
- if( pTAFmt )
- pAutoFmt = new SwTableAutoFmt( *pTAFmt );
// consider redline
SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
@@ -253,7 +256,6 @@ SwUndoInsTbl::~SwUndoInsTbl()
delete pDDEFldType;
delete pColWidth;
delete pRedlData;
- delete pAutoFmt;
}
void SwUndoInsTbl::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -305,9 +307,9 @@ void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
SwPosition const aPos(SwNodeIndex(rDoc.GetNodes(), nSttNode));
+ SwTableFmt* pStyle = rDoc.GetTableStyles()->FindStyle( sStyleName );
const SwTable* pTbl = rDoc.InsertTable( aInsTblOpts, aPos, nRows, nCols,
- nAdjust,
- pAutoFmt, pColWidth );
+ nAdjust,pStyle, pColWidth );
((SwFrmFmt*)pTbl->GetFrmFmt())->SetName( sTblNm );
SwTableNode* pTblNode = (SwTableNode*)rDoc.GetNodes()[nSttNode]->GetTableNode();
@@ -344,9 +346,10 @@ void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext)
void SwUndoInsTbl::RepeatImpl(::sw::RepeatContext & rContext)
{
+ SwTableFmt* pStyle = rContext.GetDoc().GetTableStyles()->FindStyle( sStyleName );
rContext.GetDoc().InsertTable(
aInsTblOpts, *rContext.GetRepeatPaM().GetPoint(),
- nRows, nCols, nAdjust, pAutoFmt, pColWidth );
+ nRows, nCols, nAdjust, pStyle, pColWidth );
}
SwRewriter SwUndoInsTbl::GetRewriter() const
@@ -691,13 +694,14 @@ void SwUndoTblToTxt::AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx
SwUndoTxtToTbl::SwUndoTxtToTbl( const SwPaM& rRg,
const SwInsertTableOptions& rInsTblOpts,
sal_Unicode cCh, sal_uInt16 nAdj,
- const SwTableAutoFmt* pAFmt )
+ const SwTableFmt* pStyle )
: SwUndo( UNDO_TEXTTOTABLE ), SwUndRng( rRg ), aInsTblOpts( rInsTblOpts ),
- pDelBoxes( 0 ), pAutoFmt( 0 ),
- pHistory( 0 ), cTrenner( cCh ), nAdjust( nAdj )
+ pDelBoxes( 0 ), pHistory( 0 ), cTrenner( cCh ), nAdjust( nAdj )
{
- if( pAFmt )
- pAutoFmt = new SwTableAutoFmt( *pAFmt );
+ if( pStyle )
+ sStyleName = pStyle->GetName();
+ else
+ sStyleName = UniString::EmptyString();
const SwPosition* pEnd = rRg.End();
SwNodes& rNds = rRg.GetDoc()->GetNodes();
@@ -709,7 +713,6 @@ SwUndoTxtToTbl::SwUndoTxtToTbl( const SwPaM& rRg,
SwUndoTxtToTbl::~SwUndoTxtToTbl()
{
delete pDelBoxes;
- delete pAutoFmt;
}
void SwUndoTxtToTbl::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -796,8 +799,9 @@ void SwUndoTxtToTbl::RedoImpl(::sw::UndoRedoContext & rContext)
RemoveIdxFromRange(rPam, false);
SetPaM(rPam);
+ SwTableFmt* pStyle = rContext.GetDoc().GetTableStyles()->FindStyle( sStyleName );
SwTable const*const pTable = rContext.GetDoc().TextToTable(
- aInsTblOpts, rPam, cTrenner, nAdjust, pAutoFmt );
+ aInsTblOpts, rPam, cTrenner, nAdjust, pStyle );
((SwFrmFmt*)pTable->GetFrmFmt())->SetName( sTblNm );
}
@@ -806,9 +810,9 @@ void SwUndoTxtToTbl::RepeatImpl(::sw::RepeatContext & rContext)
// no Table In Table
if (!rContext.GetRepeatPaM().GetNode()->FindTableNode())
{
+ SwTableFmt* pStyle = rContext.GetDoc().GetTableStyles()->FindStyle( sStyleName );
rContext.GetDoc().TextToTable( aInsTblOpts, rContext.GetRepeatPaM(),
- cTrenner, nAdjust,
- pAutoFmt );
+ cTrenner, nAdjust, pStyle );
}
}
@@ -982,7 +986,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, bool bMdfyBox )
SwTableFmt::RestoreTableProperties( NULL, rTbl );
else
{
- SwTableFmt* pStyle = pDoc->FindTblFmtByName( sSaveFmtName, sal_True );
+ SwTableFmt* pStyle = pDoc->GetTableStyles()->FindStyle( sSaveFmtName );
SwTableFmt::RestoreTableProperties( pStyle, rTbl );
}
@@ -1454,7 +1458,7 @@ SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext)
SwTableFmt::RestoreTableProperties( NULL, table );
else
{
- pStyle = rDoc.FindTblFmtByName( sSaveFmtName, sal_True );
+ pStyle = rDoc.GetTableStyles()->FindStyle( sSaveFmtName );
SwTableFmt::RestoreTableProperties( pStyle, table );
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index ff5757d6e3ba..bd1f12489c08 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2992,23 +2992,16 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen
if(!pTable->IsTblComplex())
{
- String sAutoFmtName(aName);
- SwTableAutoFmtTbl aAutoFmtTbl( pFmt->GetDoc() );
- aAutoFmtTbl.Load();
- for (sal_uInt16 i = aAutoFmtTbl.size(); i;)
- if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
- {
- SwSelBoxes aBoxes;
- const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
- for (size_t n = 0; n < rTBoxes.size(); ++n)
- {
- SwTableBox* pBox = rTBoxes[ n ];
- aBoxes.insert( pBox );
- }
- UnoActionContext aContext( pFmt->GetDoc() );
- pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] );
- break;
- }
+ SwTableFmt* pStyle = pFmt->GetDoc()->GetTableStyles()->FindStyle( aName );
+ SwSelBoxes aBoxes;
+ const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
+ for (size_t n = 0; n < rTBoxes.size(); ++n)
+ {
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.insert( pBox );
+ }
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SetTableStyle( aBoxes, pStyle );
}
}
else
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 0df3f7014bc9..aff6f584044f 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -236,7 +236,7 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
aOldNumFmtLnk( aLbDbFmtFromUsr.GetSelectHdl() ),
sNoTmpl( SW_RES( STR_NOTEMPL )),
pView( &rView ),
- pTAutoFmt( 0 ),
+ pTableStyle( 0 ),
pTblSet( 0 ),
pRep( 0 )
{
@@ -424,8 +424,6 @@ SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot()
{
delete pTblSet;
delete pRep;
-
- delete pTAutoFmt;
}
IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton )
@@ -766,10 +764,10 @@ IMPL_LINK( SwInsertDBColAutoPilot, AutoFmtHdl, PushButton*, pButton )
SwAbstractDialogFactory* pFact = swui::GetFactory();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pView->GetWrtShellPtr(), sal_False, pTAutoFmt);
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pView->GetWrtShellPtr(), sal_False, pTableStyle);
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if( RET_OK == pDlg->Execute())
- pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ pDlg->FillAutoFmtOfIndex( pTableStyle );
delete pDlg;
return 0;
}
@@ -1026,7 +1024,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
sal_Bool bHTML = 0 != (::GetHtmlMode( pView->GetDocShell() ) & HTMLMODE_ON);
rSh.InsertTable(
pModOpt->GetInsTblFlags(bHTML),
- nRows, nCols, text::HoriOrientation::FULL, (pSelection ? pTAutoFmt : 0) );
+ nRows, nCols, text::HoriOrientation::FULL, (pSelection ? pTableStyle : 0) );
rSh.MoveTable( GetfnTablePrev(), GetfnTableStart() );
if( pSelection && pTblSet )
@@ -1166,13 +1164,13 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
}
rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() );
- if( !pSelection && ( pTblSet || pTAutoFmt ))
+ if( !pSelection && ( pTblSet || pTableStyle ))
{
if( pTblSet )
SetTabSet();
- if( pTAutoFmt )
- rSh.SetTableAutoFmt( *pTAutoFmt );
+ if( pTableStyle )
+ rSh.SetTableStyle( pTableStyle );
}
rSh.SetAutoUpdateCells( bIsAutoUpdateCells );
}
@@ -1422,15 +1420,15 @@ void SwInsertDBColAutoPilot::SetTabSet()
SwWrtShell& rSh = pView->GetWrtShell();
const SfxPoolItem* pItem;
- if( pTAutoFmt )
+ if( pTableStyle )
{
- if( pTAutoFmt->IsFrame() )
+ if( pTableStyle->IsFrame() )
{
// border is from AutoFormat
pTblSet->ClearItem( RES_BOX );
pTblSet->ClearItem( SID_ATTR_BORDER_INNER );
}
- if( pTAutoFmt->IsBackground() )
+ if( pTableStyle->IsBackground() )
{
pTblSet->ClearItem( RES_BACKGROUND );
pTblSet->ClearItem( SID_ATTR_BRUSH_ROW );
@@ -1599,8 +1597,8 @@ void SwInsertDBColAutoPilot::Commit()
if( sNoTmpl != (sTmp = aLbDbParaColl.GetSelectEntry()) )
pValues[5].Value <<= OUString(sTmp);
- if( pTAutoFmt )
- pValues[6].Value <<= OUString(pTAutoFmt->GetName());
+ if( pTableStyle )
+ pValues[6].Value <<= OUString(pTableStyle->GetName());
const Type& rBoolType = ::getBooleanCppuType();
sal_Bool bTmp = aRbAsTable.IsChecked();
@@ -1799,20 +1797,11 @@ void SwInsertDBColAutoPilot::Load()
else
aLbDbParaColl.SelectEntryPos( 0 );
- delete pTAutoFmt, pTAutoFmt = 0;
+ pTableStyle = 0;
sTmp = pNewData->sTAutoFmtNm;
if( sTmp.Len() )
{
- // then load the AutoFmt file and look for Autoformat first
- SwDoc* pDoc = pView->GetWrtShell().GetDoc();
- SwTableAutoFmtTbl aAutoFmtTbl(pDoc);
- aAutoFmtTbl.Load();
- for( sal_uInt16 nAutoFmt = aAutoFmtTbl.size(); nAutoFmt; )
- if( sTmp == aAutoFmtTbl[ --nAutoFmt ].GetName() )
- {
- pTAutoFmt = new SwTableAutoFmt( aAutoFmtTbl[ nAutoFmt ] );
- break;
- }
+ pTableStyle = pView->GetWrtShell().GetDoc()->GetTableStyles()->FindStyle( sTmp );
}
aRbAsTable.Check( pNewData->bIsTable );
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 81f62b11d0c3..444f7cebace9 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -226,9 +226,9 @@ sal_uInt16 AbstractSwBreakDlg_Impl:: GetPageNumber()
}
void AbstractSwConvertTableDlg_Impl::GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
- SwTableAutoFmt const*& prTAFmt)
+ SwTableFmt const*& prStyle)
{
- pDlg->GetValues(rDelim,rInsTblFlags, prTAFmt);
+ pDlg->GetValues(rDelim,rInsTblFlags, prStyle);
}
void AbstractSwInsertDBColAutoPilot_Impl::DataToDoc( const uno::Sequence< uno::Any >& rSelection,
@@ -309,7 +309,7 @@ void AbstractSwSelGlossaryDlg_Impl::SelectEntryPos(sal_uInt16 nIdx)
pDlg->SelectEntryPos( nIdx );
}
-void AbstractSwAutoFormatDlg_Impl::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
+void AbstractSwAutoFormatDlg_Impl::FillAutoFmtOfIndex( SwTableFmt*& rToFill ) const
{
pDlg->FillAutoFmtOfIndex(rToFill);
}
@@ -439,10 +439,10 @@ void AbstractInsFootNoteDlg_Impl::SetText( const OUString& rStr )
}
void AbstractInsTableDlg_Impl::GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
- SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
- SwTableAutoFmt *& prTAFmt )
+ SwInsertTableOptions& rInsTblFlags, String& rStyleName,
+ SwTableFmt *& prStyle )
{
- pDlg->GetValues( rName, rRow, rCol, rInsTblFlags, rTableAutoFmtName, prTAFmt);
+ pDlg->GetValues( rName, rRow, rCol, rInsTblFlags, rStyleName, prStyle);
}
OUString AbstractJavaEditDialog_Impl::GetText()
@@ -892,7 +892,7 @@ AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg
}
AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(Window* pParent,
- SwWrtShell* pShell, sal_Bool bSetAutoFmt, const SwTableAutoFmt* pSelFmt)
+ SwWrtShell* pShell, sal_Bool bSetAutoFmt, const SwTableFmt* pSelFmt)
{
SwAutoFormatDlg* pDlg = new SwAutoFormatDlg(pParent, pShell, bSetAutoFmt, pSelFmt);
return new AbstractSwAutoFormatDlg_Impl(pDlg);
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index c46abe634f37..348c943f951f 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -161,7 +161,7 @@ class AbstractSwConvertTableDlg_Impl : public AbstractSwConvertTableDlg // add
{
DECL_ABSTDLG_BASE( AbstractSwConvertTableDlg_Impl,SwConvertTableDlg)
virtual void GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
- SwTableAutoFmt const*& prTAFmt);
+ SwTableFmt const*& prStyle);
};
//add for SwConvertTableDlg end
@@ -216,7 +216,7 @@ class AbstractSwSelGlossaryDlg_Impl : public AbstractSwSelGlossaryDlg
class AbstractSwAutoFormatDlg_Impl : public AbstractSwAutoFormatDlg
{
DECL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl,SwAutoFormatDlg )
- virtual void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const;
+ virtual void FillAutoFmtOfIndex( SwTableFmt*& rToFill ) const;
};
//add for SwAutoFormatDlg end
@@ -301,8 +301,8 @@ class AbstractInsTableDlg_Impl : public AbstractInsTableDlg
{
DECL_ABSTDLG_BASE(AbstractInsTableDlg_Impl,SwInsTableDlg)
virtual void GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
- SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
- SwTableAutoFmt *& prTAFmt );
+ SwInsertTableOptions& rInsTblFlags, String& rStyleName,
+ SwTableFmt *& prStyle );
};
//for SwInsTableDlg end
@@ -477,7 +477,7 @@ public:
virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg
sal_Bool bSetAutoFmt = sal_True,
- const SwTableAutoFmt* pSelFmt = 0 );
+ const SwTableFmt* pSelFmt = 0 );
virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, sal_uInt16 nType,int nResId );//add for SwBorderDlg
virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, sal_Bool bDrawMode, int nResId ); //add for SwWrapDlg
diff --git a/sw/source/ui/inc/convert.hxx b/sw/source/ui/inc/convert.hxx
index aa53428b1967..4e03e85a5c04 100644
--- a/sw/source/ui/inc/convert.hxx
+++ b/sw/source/ui/inc/convert.hxx
@@ -24,7 +24,7 @@
#include <vcl/edit.hxx>
#include <sfx2/basedlgs.hxx>
-class SwTableAutoFmt;
+class SwTableFmt;
class SwView;
class SwWrtShell;
class NumericField;
@@ -52,7 +52,7 @@ class SwConvertTableDlg: public SfxModalDialog
PushButton* mpAutoFmtBtn;
String sConvertTextTable;
- SwTableAutoFmt* pTAutoFmt;
+ SwTableFmt* pTableStyle;
SwWrtShell* pShell;
DECL_LINK( AutoFmtHdl, PushButton* );
@@ -66,7 +66,7 @@ public:
void GetValues( sal_Unicode& rDelim,
SwInsertTableOptions& rInsTblOpts,
- SwTableAutoFmt const*& prTAFmt );
+ SwTableFmt const*& prStyle );
};
diff --git a/sw/source/ui/inc/dbinsdlg.hxx b/sw/source/ui/inc/dbinsdlg.hxx
index aa1207fc553f..6e43955e40a3 100644
--- a/sw/source/ui/inc/dbinsdlg.hxx
+++ b/sw/source/ui/inc/dbinsdlg.hxx
@@ -47,7 +47,7 @@ namespace com{namespace sun{namespace star{
}
}}}
-class SwTableAutoFmt;
+class SwTableFmt;
class SwView;
class SfxItemSet;
class SwTableRep;
@@ -136,7 +136,7 @@ class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
String sNoTmpl;
SwView* pView;
- SwTableAutoFmt* pTAutoFmt;
+ SwTableFmt* pTableStyle;
SfxItemSet* pTblSet;
SwTableRep* pRep;
diff --git a/sw/source/ui/inc/instable.hxx b/sw/source/ui/inc/instable.hxx
index 00a3155a074a..7b8942cde82b 100644
--- a/sw/source/ui/inc/instable.hxx
+++ b/sw/source/ui/inc/instable.hxx
@@ -27,7 +27,6 @@
#include <actctrl.hxx>
class SwWrtShell;
-class SwTableAutoFmt;
class SwView;
struct SwInsertTableOptions;
@@ -51,7 +50,7 @@ class SwInsTableDlg : public SfxModalDialog
PushButton* m_pAutoFmtBtn;
SwWrtShell* pShell;
- SwTableAutoFmt* pTAutoFmt;
+ SwTableFmt* pTableStyle;
sal_Int64 nEnteredValRepeatHeaderNF;
DECL_LINK( ModifyName, Edit * );
@@ -67,8 +66,8 @@ public:
~SwInsTableDlg();
void GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
- SwInsertTableOptions& rInsTblOpts, String& rTableAutoFmtName,
- SwTableAutoFmt *& prTAFmt );
+ SwInsertTableOptions& rInsTblOpts, String& rStyleName,
+ SwTableFmt *& prStyle );
};
#endif
diff --git a/sw/source/ui/inc/tautofmt.hxx b/sw/source/ui/inc/tautofmt.hxx
index 4ef8d55f9297..923068e84b05 100644
--- a/sw/source/ui/inc/tautofmt.hxx
+++ b/sw/source/ui/inc/tautofmt.hxx
@@ -30,9 +30,8 @@
#include <vcl/virdev.hxx>
-class SwTableAutoFmt;
class AutoFmtPreview;
-class SwTableAutoFmtTbl;
+class SwTableFmtTbl;
class SwWrtShell;
//------------------------------------------------------------------------
@@ -66,15 +65,15 @@ class SwAutoFormatDlg : public SfxModalDialog
//------------------------
SwWrtShell* pShell;
- SwTableAutoFmtTbl* pTableTbl;
+ SwTableFmtTbl* pTableTbl;
sal_uInt8 nIndex;
sal_uInt8 nDfltStylePos;
sal_Bool bCoreDataChanged : 1;
sal_Bool bSetAutoFmt : 1;
- void Init( const SwTableAutoFmt* pSelFmt );
- void UpdateChecks( const SwTableAutoFmt&, sal_Bool bEnableBtn );
+ void Init( const SwTableFmt* pSelFmt );
+ void UpdateChecks( const SwTableFmt*, sal_Bool bEnableBtn );
//------------------------
DECL_LINK( CheckHdl, Button * );
DECL_LINK(OkHdl, void *);
@@ -86,10 +85,10 @@ class SwAutoFormatDlg : public SfxModalDialog
public:
SwAutoFormatDlg( Window* pParent, SwWrtShell* pShell,
sal_Bool bSetAutoFmt = sal_True,
- const SwTableAutoFmt* pSelFmt = 0 );
+ const SwTableFmt* pSelFmt = 0 );
virtual ~SwAutoFormatDlg();
- void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const;
+ void FillAutoFmtOfIndex( SwTableFmt*& rToFill ) const;
};
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 5c08e633f1cb..9269a4cd57c4 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -766,9 +766,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
bToTable = true;
SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
- SwTableAutoFmt const* pTAFmt = 0;
- SwTableAutoFmtTbl* pAutoFmtTbl = 0;
- bool bDeleteFormat = true;
+ SwTableFmt const* pTableStyle = 0;
if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem))
{
aInsTblOpts.mnInsMode = 0;
@@ -781,19 +779,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
{
String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue();
- pAutoFmtTbl = new SwTableAutoFmtTbl(GetShell().GetDoc());
- pAutoFmtTbl->Load();
-
- for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->size(); i < nCount; i++ )
- {
- SwTableAutoFmt const*const pFmt = &(*pAutoFmtTbl)[ i ];
- if( pFmt->GetName() == sAutoFmt )
- {
- pTAFmt = pFmt;
- bDeleteFormat = false;
- break;
- }
- }
+ pTableStyle = GetShell().GetDoc()->GetTableStyles()->FindStyle( sAutoFmt );
}
//WithHeader
if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_True, &pItem) &&
@@ -821,7 +807,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if( RET_OK == pDlg->Execute() )
{
- pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt );
+ pDlg->GetValues( cDelim, aInsTblOpts, pTableStyle );
}
delete pDlg;
@@ -840,8 +826,8 @@ void SwBaseShell::Execute(SfxRequest &rReq)
aReq.AppendItem( SfxStringItem( FN_PARAM_1, OUString(cDelim) ));
if(bToTable)
{
- if(pTAFmt)
- aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName()));
+ if(pTableStyle)
+ aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTableStyle->GetName()));
aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE)));
aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat ));
aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
@@ -854,16 +840,13 @@ void SwBaseShell::Execute(SfxRequest &rReq)
rSh.TableToText( cDelim );
else
{
- bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt );
+ bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTableStyle );
}
rSh.EnterStdMode();
if( bInserted )
rSaveView.AutoCaption( TABLE_CAP );
}
- if(bDeleteFormat)
- delete pTAFmt;
- delete pAutoFmtTbl;
}
break;
case SID_STYLE_WATERCAN:
@@ -2537,7 +2520,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
sal_uInt16 nRows = 0;
SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
String aTableName, aAutoName;
- SwTableAutoFmt* pTAFmt = 0;
+ SwTableFmt* pTableStyle = 0;
if( pArgs && pArgs->Count() >= 2 )
{
@@ -2558,16 +2541,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
aAutoName = pAuto->GetValue();
if ( aAutoName.Len() )
{
- SwTableAutoFmtTbl aTableTbl(GetShell().GetDoc());
- aTableTbl.Load();
- for ( sal_uInt16 n=0; n<aTableTbl.size(); n++ )
- {
- if ( aTableTbl[n].GetName() == aAutoName )
- {
- pTAFmt = new SwTableAutoFmt( aTableTbl[n] );
- break;
- }
- }
+ pTableStyle = GetShell().GetDoc()->GetTableStyles()->FindStyle( aAutoName );
}
}
@@ -2588,7 +2562,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if( RET_OK == pDlg->Execute() )
{
- pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt );
+ pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTableStyle );
}
else
_rRequest.Ignore();
@@ -2613,7 +2587,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
if( rSh.HasSelection() )
rSh.DelRight();
- rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt );
+ rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTableStyle );
rSh.MoveTable( fnTablePrev, fnTableStart );
if( aTableName.Len() && !rSh.GetTblStyle( aTableName ) )
@@ -2622,7 +2596,6 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
rSh.EndAllAction();
rTempView.AutoCaption(TABLE_CAP);
}
- delete pTAFmt;
}
if( bCallEndUndo )
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index 96cf83db5867..f4c6e27873f1 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -47,7 +47,7 @@ static sal_Unicode uOther = ',';
void SwConvertTableDlg::GetValues( sal_Unicode& rDelim,
SwInsertTableOptions& rInsTblOpts,
- SwTableAutoFmt const*& prTAFmt )
+ SwTableFmt const*& prStyle )
{
if( mpTabBtn->IsChecked() )
{
@@ -91,8 +91,7 @@ void SwConvertTableDlg::GetValues( sal_Unicode& rDelim,
if (!mpDontSplitCB->IsChecked())
nInsMode |= tabopts::SPLIT_LAYOUT;
- if( pTAutoFmt )
- prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
+ prStyle = pTableStyle;
rInsTblOpts.mnInsMode = nInsMode;
}
@@ -101,7 +100,7 @@ void SwConvertTableDlg::GetValues( sal_Unicode& rDelim,
SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
: SfxModalDialog(&rView.GetViewFrame()->GetWindow(), "ConvertTextTableDialog", "modules/swriter/ui/converttexttable.ui" )
, sConvertTextTable(SW_RES(STR_CONVERT_TEXT_TABLE))
- , pTAutoFmt(0)
+ , pTableStyle(0)
, pShell(&rView.GetWrtShell())
{
get(mpTabBtn, "tabs");
@@ -179,7 +178,6 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
SwConvertTableDlg:: ~SwConvertTableDlg()
{
- delete pTAutoFmt;
}
IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton )
@@ -187,10 +185,10 @@ IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton )
SwAbstractDialogFactory* pFact = swui::GetFactory();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, sal_False, pTAutoFmt);
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, sal_False, pTableStyle);
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if( RET_OK == pDlg->Execute())
- pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ pDlg->FillAutoFmtOfIndex( pTableStyle );
delete pDlg;
return 0;
}
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index 6b00aac8ec72..31ea9316d514 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -43,8 +43,8 @@ namespace swui
#define ROW_COL_PROD 16384
void SwInsTableDlg::GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
- SwInsertTableOptions& rInsTblOpts, String& rAutoName,
- SwTableAutoFmt *& prTAFmt )
+ SwInsertTableOptions& rInsTblOpts, String& rStyleName,
+ SwTableFmt *& prStyle )
{
sal_uInt16 nInsMode = 0;
rName = m_pNameEdit->GetText();
@@ -61,10 +61,11 @@ void SwInsTableDlg::GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol
rInsTblOpts.mnRowsToRepeat = 0;
if (!m_pDontSplitCB->IsChecked())
nInsMode |= tabopts::SPLIT_LAYOUT;
- if( pTAutoFmt )
+
+ prStyle = pTableStyle;
+ if( pTableStyle )
{
- prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
- rAutoName = prTAFmt->GetName();
+ rStyleName = pTableStyle->GetName();
}
rInsTblOpts.mnInsMode = nInsMode;
@@ -73,7 +74,7 @@ void SwInsTableDlg::GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol
SwInsTableDlg::SwInsTableDlg( SwView& rView )
: SfxModalDialog(rView.GetWindow(), "InsertTableDialog", "modules/swriter/ui/inserttable.ui")
, pShell(&rView.GetWrtShell())
- , pTAutoFmt(0)
+ , pTableStyle(0)
, nEnteredValRepeatHeaderNF(-1)
{
get(m_pNameEdit, "nameedit");
@@ -140,7 +141,6 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl)
SwInsTableDlg::~SwInsTableDlg()
{
- delete pTAutoFmt;
}
IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit )
@@ -192,10 +192,10 @@ IMPL_LINK( SwInsTableDlg, AutoFmtHdl, PushButton*, pButton )
SwAbstractDialogFactory* pFact = swui::GetFactory();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, sal_False, pTAutoFmt);
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, sal_False, pTableStyle);
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if( RET_OK == pDlg->Execute())
- pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ pDlg->FillAutoFmtOfIndex( pTableStyle );
delete pDlg;
return 0;
}
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 41297480a8b1..a8618d922e65 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -51,7 +51,7 @@ public:
AutoFmtPreview(Window* pParent);
~AutoFmtPreview();
- void NotifyChange( const SwTableAutoFmt& rNewData );
+ void NotifyChange( const SwTableFmt* pNewData );
void DetectRTL(SwWrtShell* pWrtShell);
@@ -60,7 +60,7 @@ protected:
virtual void Paint( const Rectangle& rRect );
private:
- SwTableAutoFmt* pCurData;
+ SwTableFmt* pCurData;
VirtualDevice aVD;
SvtScriptedTextHelper aScriptedText;
svx::frame::Array maArray; /// Implementation to draw the frame borders.
@@ -139,7 +139,7 @@ SwStringInputDlg::~SwStringInputDlg()
// AutoFormat-Dialogue:
SwAutoFormatDlg::SwAutoFormatDlg( Window* pParent, SwWrtShell* pWrtShell,
- sal_Bool bSetAutoFormat, const SwTableAutoFmt* pSelFmt )
+ sal_Bool bSetAutoFormat, const SwTableFmt* pSelFmt )
: SfxModalDialog(pParent, "AutoFormatTableDialog", "modules/swriter/ui/autoformattable.ui")
, aStrTitle(SW_RES(STR_ADD_AUTOFORMAT_TITLE))
, aStrLabel(SW_RES(STR_ADD_AUTOFORMAT_LABEL))
@@ -179,7 +179,7 @@ SwAutoFormatDlg::~SwAutoFormatDlg()
{
}
-void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
+void SwAutoFormatDlg::Init( const SwTableFmt* pSelFmt )
{
Link aLk( LINK( this, SwAutoFormatDlg, CheckHdl ) );
m_pBtnBorder->SetClickHdl( aLk );
@@ -208,9 +208,9 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
for (sal_uInt8 i = 0, nCount = static_cast<sal_uInt8>(pTableTbl->size());
i < nCount; i++)
{
- SwTableAutoFmt const& rFmt = (*pTableTbl)[ i ];
- m_pLbFormat->InsertEntry(rFmt.GetName());
- if (pSelFmt && rFmt.GetName() == pSelFmt->GetName())
+ SwTableFmt const* pFmt = (*pTableTbl)[ i ];
+ m_pLbFormat->InsertEntry(pFmt->GetName());
+ if (pSelFmt && pFmt->GetName() == pSelFmt->GetName())
nIndex = i;
}
@@ -218,35 +218,30 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
SelFmtHdl( 0 );
}
-void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFmt& rFmt, sal_Bool bEnable )
+void SwAutoFormatDlg::UpdateChecks( const SwTableFmt* pFmt, sal_Bool bEnable )
{
m_pBtnNumFormat->Enable( bEnable );
- m_pBtnNumFormat->Check( rFmt.IsValueFormat() );
+ m_pBtnNumFormat->Check( pFmt && pFmt->IsValueFormat() );
m_pBtnBorder->Enable( bEnable );
- m_pBtnBorder->Check( rFmt.IsFrame() );
+ m_pBtnBorder->Check( pFmt && pFmt->IsFrame() );
m_pBtnFont->Enable( bEnable );
- m_pBtnFont->Check( rFmt.IsFont() );
+ m_pBtnFont->Check( pFmt && pFmt->IsFont() );
m_pBtnPattern->Enable( bEnable );
- m_pBtnPattern->Check( rFmt.IsBackground() );
+ m_pBtnPattern->Check( pFmt && pFmt->IsBackground() );
m_pBtnAlignment->Enable( bEnable );
- m_pBtnAlignment->Check( rFmt.IsJustify() );
+ m_pBtnAlignment->Check( pFmt && pFmt->IsJustify() );
}
-void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
+void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableFmt*& prToFill ) const
{
if( 255 != nIndex )
- {
- if( rToFill )
- *rToFill = (*pTableTbl)[ nIndex ];
- else
- rToFill = new SwTableAutoFmt( (*pTableTbl)[ nIndex ] );
- }
+ prToFill = (*pTableTbl)[ nIndex ];
else
- delete rToFill, rToFill = 0;
+ prToFill = 0;
}
@@ -254,7 +249,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
{
- SwTableAutoFmt* pData = &(*pTableTbl)[nIndex];
+ SwTableFmt* pData = (*pTableTbl)[nIndex];
sal_Bool bDataChgd = sal_True;
if( pBtn == m_pBtnNumFormat )
@@ -278,7 +273,7 @@ IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
bCoreDataChanged = sal_True;
}
- m_pWndPreview->NotifyChange( *pData );
+ m_pWndPreview->NotifyChange( pData );
}
return 0;
}
@@ -301,26 +296,21 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
{
sal_uInt16 n;
for( n = 0; n < pTableTbl->size(); ++n )
- if( (*pTableTbl)[n].GetName() == aFormatName )
+ if( (*pTableTbl)[n]->GetName() == aFormatName )
break;
if( n >= pTableTbl->size() )
{
// Format with the name does not already exist, so take up.
- SwDoc* pDoc = pShell->GetDoc();
- SwTableFmt* pStyle = pDoc->FindTblFmtByName( aFormatName );
- if ( !pStyle )
- pStyle = pDoc->MakeTblFrmFmt( aFormatName, NULL);
- SwTableAutoFmt* pNewData = new
- SwTableAutoFmt( aFormatName, pStyle );
- pShell->GetTableAutoFmt( *pNewData );
+ SwTableFmt* pStyle = pTableTbl->MakeStyle( aFormatName );
+ pShell->GetTableStyle( pStyle );
// Insert sorted!!
for( n = 1; n < pTableTbl->size(); ++n )
- if( (*pTableTbl)[ n ].GetName() > aFormatName )
+ if( (*pTableTbl)[ n ]->GetName() > aFormatName )
break;
- pTableTbl->InsertAutoFmt(n, pNewData);
+ pTableTbl->InsertStyle(n, pStyle);
m_pLbFormat->InsertEntry( aFormatName, nDfltStylePos + n );
m_pLbFormat->SelectEntryPos( nDfltStylePos + n );
bFmtInserted = true;
@@ -366,7 +356,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl)
m_pLbFormat->RemoveEntry( nDfltStylePos + nIndex );
m_pLbFormat->SelectEntryPos( nDfltStylePos + nIndex-1 );
- pTableTbl->EraseAutoFmt(nIndex);
+ pTableTbl->EraseStyle(nIndex);
nIndex--;
if( !nIndex )
@@ -406,26 +396,26 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
{
sal_uInt16 n;
for( n = 0; n < pTableTbl->size(); ++n )
- if ((*pTableTbl)[n].GetName() == aFormatName)
+ if ((*pTableTbl)[n]->GetName() == aFormatName)
break;
if( n >= pTableTbl->size() )
{
// no format with this name exists, so rename it
m_pLbFormat->RemoveEntry( nDfltStylePos + nIndex );
- SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ];
+ SwTableFmt* p = (*pTableTbl)[ nIndex ];
p->SetName( aFormatName );
// keep all arrays sorted!
for( n = 1; n < pTableTbl->size(); ++n )
if ((n != nIndex) &&
- ((*pTableTbl)[n].GetName() > aFormatName))
+ ((*pTableTbl)[n]->GetName() > aFormatName))
{
break;
}
- pTableTbl->MoveAutoFmt(n, nIndex);
+ pTableTbl->MoveStyle(n, nIndex);
m_pLbFormat->InsertEntry( aFormatName, nDfltStylePos + n );
m_pLbFormat->SelectEntryPos( nDfltStylePos + n );
@@ -476,13 +466,10 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl)
// ideal, the table styles are created with the document
sNm = SwStyleNameMapper::GetUIName( RES_POOLCOLL_STANDARD, sNm );
SwTableFmt* pStyle = pShell->GetDoc()->FindTblFmtByName(sNm);
- if ( !pStyle )
- pStyle = pShell->GetDoc()->MakeTblFrmFmt(sNm, NULL);
- SwTableAutoFmt aTmp( sNm, pStyle );
if( nOldIdx != nIndex )
- m_pWndPreview->NotifyChange( *(SwTableAutoFmt*)0 );
- UpdateChecks( aTmp, sal_False );
+ m_pWndPreview->NotifyChange( NULL );
+ UpdateChecks( pStyle, sal_False );
}
m_pBtnRemove->Enable( bBtnEnable );
@@ -494,7 +481,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl)
IMPL_LINK_NOARG_INLINE_START(SwAutoFormatDlg, OkHdl)
{
if( bSetAutoFmt )
- pShell->SetTableAutoFmt( (*pTableTbl)[ nIndex ] );
+ pShell->SetTableStyle( (*pTableTbl)[ nIndex ] );
EndDialog( RET_OK );
return sal_True;
}
@@ -536,7 +523,7 @@ void AutoFmtPreview::Resize()
nDataColWidth1 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3;
nDataColWidth2 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4;
nRowHeight = (aPrvSize.Height() - 4) / 5;
- NotifyChange(*pCurData);
+ NotifyChange(pCurData);
}
void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell)
@@ -864,9 +851,9 @@ void AutoFmtPreview::CalcLineMap()
}
}
-void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData )
+void AutoFmtPreview::NotifyChange( const SwTableFmt* pNewData )
{
- pCurData = const_cast< SwTableAutoFmt* >( &rNewData );
+ pCurData = const_cast< SwTableFmt* >( pNewData );
bFitWidth = pCurData && pCurData->IsJustify();//sal_True; //???
CalcCellArray( bFitWidth );
CalcLineMap();