summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-09-12 15:32:06 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-09-12 15:32:06 +0300
commit475762597529e621ce8abfe967ab802231cabe83 (patch)
tree3fb203b2ca9725bcebe3bf1d55dce549ce01402b
parentd1b17ec6e6a994f7e835bb25117f335bed90783d (diff)
Use items in attrset to determine properties stored in table style
Replace the current bool methods of SwTableAutoFmt with methods that check whether specific items are in the SwTableFmt's attrset or in one of the cells attrset. Change-Id: I5088cb933ca9e619bfebeb0180f8fd4667bb7744
-rw-r--r--sw/inc/swtblfmt.hxx14
-rw-r--r--sw/inc/tblafmt.hxx10
-rw-r--r--sw/source/core/doc/swtblfmt.cxx92
3 files changed, 110 insertions, 6 deletions
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index b4e709d884d1..6aecafc52260 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -123,6 +123,12 @@ public:
sal_Bool GetRowSplit() const;
sal_uInt16 GetRepeatHeading() const;
+ sal_Bool IsFont() const;
+ sal_Bool IsJustify() const;
+ sal_Bool IsFrame() const;
+ sal_Bool IsBackground() const;
+ sal_Bool IsValueFormat() const;
+
static void RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &rTable );
static SwTableFmt* StoreTableProperties( const SwTable &rTable );
@@ -179,7 +185,7 @@ class SW_DLLPUBLIC SwTableBoxFmt : public SwFrmFmt
{
friend class SwDoc;
- String sNumFmtString;
+ OUString sNumFmtString;
LanguageType eSysLanguage, eNumFmtLanguage;
protected:
@@ -231,6 +237,12 @@ public:
void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const;
+ sal_Bool IsFont() const;
+ sal_Bool IsJustify() const;
+ sal_Bool IsFrame() const;
+ sal_Bool IsBackground() const;
+ 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;
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index af7b0d61084e..d91225139c6b 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -146,11 +146,11 @@ public:
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; }
- sal_Bool IsBackground() const { return bInclBackground; }
- sal_Bool IsValueFormat() const { return bInclValueFormat; }
+ 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(); }
void SetFont( const sal_Bool bNew ) { bInclFont = bNew; }
void SetJustify( const sal_Bool bNew ) { bInclJustify = bNew; }
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index ee5c3f0e5af7..bbd8216f4d4f 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -230,6 +230,56 @@ sal_uInt16 SwTableFmt::GetRepeatHeading() const
return 0;
}
+sal_Bool SwTableFmt::IsFont() const
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( GetBoxFmt( n )->IsFont() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool SwTableFmt::IsJustify() const
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( GetBoxFmt( n )->IsJustify() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool SwTableFmt::IsFrame() const
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( GetBoxFmt( n )->IsFrame() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool SwTableFmt::IsBackground() const
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( GetBoxFmt( n )->IsBackground() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool SwTableFmt::IsValueFormat() const
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( GetBoxFmt( n )->IsValueFormat() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
void SwTableFmt::RestoreTableProperties( SwTableFmt* pSrcFmt, SwTable &rTable )
{
SwTableFmt *pHardFmt = rTable.GetTableFmt();
@@ -637,4 +687,46 @@ void SwTableBoxFmt::GetValueFormat( String& rFmt, LanguageType& rLng, LanguageTy
rSys = eSysLanguage;
}
+sal_Bool SwTableBoxFmt::IsFont() const
+{
+ return ( SFX_ITEM_SET == GetItemState( RES_CHRATR_FONT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_FONTSIZE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_WEIGHT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_POSTURE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CJK_FONT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CJK_FONTSIZE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CJK_WEIGHT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CJK_POSTURE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CTL_FONT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CTL_FONTSIZE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CTL_WEIGHT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CTL_POSTURE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_UNDERLINE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_OVERLINE ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CROSSEDOUT ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_CONTOUR ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_SHADOWED ) )
+ || ( SFX_ITEM_SET == GetItemState( RES_CHRATR_COLOR ) );
+}
+
+sal_Bool SwTableBoxFmt::IsJustify() const
+{
+ return ( SFX_ITEM_SET == GetItemState( RES_PARATR_ADJUST ) );
+}
+
+sal_Bool SwTableBoxFmt::IsFrame() const
+{
+ return ( SFX_ITEM_SET == GetItemState( RES_BOX ) );
+}
+
+sal_Bool SwTableBoxFmt::IsBackground() const
+{
+ return ( SFX_ITEM_SET == GetItemState( RES_BACKGROUND ) );
+}
+
+sal_Bool SwTableBoxFmt::IsValueFormat() const
+{
+ return !sNumFmtString.isEmpty();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */