[Libreoffice-commits] core.git: Branch 'feature/table-style' - sw/inc sw/source

Alex Ivan alexnivan at yahoo.com
Fri Jun 28 09:12:54 PDT 2013


 sw/inc/swtblfmt.hxx             |   50 ++++++++-
 sw/source/core/doc/swtblfmt.cxx |  215 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 259 insertions(+), 6 deletions(-)

New commits:
commit 61a362510e0632b0b764dc02fb6242874b15418c
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Fri Jun 28 18:56:54 2013 +0300

    Add cell format info into SwTableBoxFmt
    
    Migrated cell format information into SwTableBoxFmt.
    Will remove info from SwTableBoxAutoFmt and try to remove the
    class entirely as progress is made.
    
    Change-Id: I4d5d0bc19aa80dfd1f8157eb0c05d54695cd9c8e

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 7783f7ba..e3f7e9f 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -19,6 +19,8 @@
 #ifndef _SWTBLFMT_HXX
 #define _SWTBLFMT_HXX
 
+#include "hintids.hxx"
+#include <charatr.hxx>
 #include <cmdid.h>
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
@@ -40,9 +42,11 @@
 #include <editeng/shaditem.hxx>
 #include <fmtpdsc.hxx>
 #include <fmtlsplt.hxx>
+#include <fmtornt.hxx>
 #include <fmtrowsplt.hxx>
 #include <frmatr.hxx>
 #include <frmfmt.hxx>
+#include <paratr.hxx>
 
 class SwDoc;
 class SwTableLineFmt;
@@ -150,20 +154,54 @@ class SW_DLLPUBLIC SwTableBoxFmt : public SwFrmFmt
 {
     friend class SwDoc;
 
+    String              sNumFmtString;
+    LanguageType        eSysLanguage, eNumFmtLanguage;
+
 protected:
     SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
-                    SwFrmFmt *pDrvdFrm )
-        : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
-    {}
+                    SwFrmFmt *pDrvdFrm );
     SwTableBoxFmt( SwAttrPool& rPool, const String &rFmtNm,
-                    SwFrmFmt *pDrvdFrm )
-        : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
-    {}
+                    SwFrmFmt *pDrvdFrm );
 
    // For recognition of changes (especially TableBoxAttribute).
    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
 
 public:
+    void SetFont( const SvxFontItem& rNew );
+    void SetHeight( const SvxFontHeightItem& rNew );
+    void SetWeight( const SvxWeightItem& rNew );
+    void SetPosture( const SvxPostureItem& rNew );
+
+    void SetCJKFont( const SvxFontItem& rNew );
+    void SetCJKHeight( const SvxFontHeightItem& rNew );
+    void SetCJKWeight( const SvxWeightItem& rNew );
+    void SetCJKPosture( const SvxPostureItem& rNew );
+
+    void SetCTLFont( const SvxFontItem& rNew );
+    void SetCTLHeight( const SvxFontHeightItem& rNew );
+    void SetCTLWeight( const SvxWeightItem& rNew );
+    void SetCTLPosture( const SvxPostureItem& rNew );
+
+    void SetUnderline( const SvxUnderlineItem& rNew );
+    void SetOverline( const SvxOverlineItem& rNew );
+    void SetCrossedOut( const SvxCrossedOutItem& rNew );
+    void SetContour( const SvxContourItem& rNew );
+    void SetShadowed( const SvxShadowedItem& rNew );
+    void SetColor( const SvxColorItem& rNew );
+    void SetBox( const SvxBoxItem& rNew );
+    void SetBackground( const SvxBrushItem& rNew );
+
+    void SetAdjust( const SvxAdjustItem& rNew );
+    void SetTextOrientation( const SvxFrameDirectionItem& rNew );
+    void SetVerticalAlignment( const SwFmtVertOrient& rNew );
+
+    void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys );
+
+    const SvxFrameDirectionItem& GetTextOrientation() const;
+    const SwFmtVertOrient& GetVerticalAlignment() const;
+
+    void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const;
+
     TYPEINFO();     // Already in base class Content.
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwTableBoxFmt)
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index a14b961..b5d387f 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -168,4 +168,219 @@ SwTableLineFmt::SwTableLineFmt( SwAttrPool& rPool, const String &rFmtNm,
         pEvnBoxFmt = NULL;
     }
 
+SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+                    SwFrmFmt *pDrvdFrm )
+    : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
+    {
+        SetFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) );
+        SetHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE) );
+        SetWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ) );
+        SetPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ) );
+
+        SetCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) );
+        SetCJKHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE) );
+        SetCJKWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ) );
+        SetCJKPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ) );
+
+        SetCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) );
+        SetCTLHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE) );
+        SetCTLWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ) );
+        SetCTLPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ) );
+
+        SetUnderline( SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ) );
+        SetOverline( SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE ) );
+        SetCrossedOut( SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
+        SetContour( SvxContourItem( sal_False, RES_CHRATR_CONTOUR ) );
+        SetShadowed( SvxShadowedItem( sal_False, RES_CHRATR_SHADOWED ) );
+        SetColor( SvxColorItem( RES_CHRATR_COLOR ) );
+        SvxBoxItem rNew = SvxBoxItem( RES_BOX );
+        rNew.SetDistance( 55 );
+        SetBox( rNew );
+        SetBackground( SvxBrushItem( RES_BACKGROUND ) );
+        SetAdjust( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
+        SetTextOrientation( SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) );
+        SetVerticalAlignment( SwFmtVertOrient( 0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME ) );
+
+        eSysLanguage = eNumFmtLanguage = ::GetAppLanguage();
+    }
+
+SwTableBoxFmt::SwTableBoxFmt( SwAttrPool& rPool, const String &rFmtNm,
+                    SwFrmFmt *pDrvdFrm )
+    : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
+    {
+        SetFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) );
+        SetHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE) );
+        SetWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ) );
+        SetPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ) );
+
+        SetCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) );
+        SetCJKHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE) );
+        SetCJKWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ) );
+        SetCJKPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ) );
+
+        SetCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) );
+        SetCTLHeight( SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE) );
+        SetCTLWeight( SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ) );
+        SetCTLPosture( SvxPostureItem( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ) );
+
+        SetUnderline( SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ) );
+        SetOverline( SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE ) );
+        SetCrossedOut( SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
+        SetContour( SvxContourItem( sal_False, RES_CHRATR_CONTOUR ) );
+        SetShadowed( SvxShadowedItem( sal_False, RES_CHRATR_SHADOWED ) );
+        SetColor( SvxColorItem( RES_CHRATR_COLOR ) );
+        SvxBoxItem rNew = SvxBoxItem( RES_BOX );
+        rNew.SetDistance( 55 );
+        SetBox( rNew );
+        SetBackground( SvxBrushItem( RES_BACKGROUND ) );
+        SetAdjust( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
+        SetTextOrientation( SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) );
+        SetVerticalAlignment( SwFmtVertOrient( 0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME ) );
+
+        eSysLanguage = eNumFmtLanguage = ::GetAppLanguage();
+    }
+
+void SwTableBoxFmt::SetFont( const SvxFontItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetHeight( const SvxFontHeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetWeight( const SvxWeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetPosture( const SvxPostureItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCJKFont( const SvxFontItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCJKHeight( const SvxFontHeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCJKWeight( const SvxWeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCJKPosture( const SvxPostureItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCTLFont( const SvxFontItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCTLHeight( const SvxFontHeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCTLWeight( const SvxWeightItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCTLPosture( const SvxPostureItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetUnderline( const SvxUnderlineItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetOverline( const SvxOverlineItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetCrossedOut( const SvxCrossedOutItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetContour( const SvxContourItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetShadowed( const SvxShadowedItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetColor( const SvxColorItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetBox( const SvxBoxItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetBackground( const SvxBrushItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetAdjust( const SvxAdjustItem& rNew )
+{
+    SvxAdjustItem rTmp = SwFmt::GetAdjust();
+    rTmp.SetAdjust( rNew.GetAdjust() );
+    rTmp.SetOneWord( rNew.GetOneWord() );
+    rTmp.SetLastBlock( rNew.GetLastBlock() );
+    SetFmtAttr( rTmp );
+}
+
+void SwTableBoxFmt::SetTextOrientation( const SvxFrameDirectionItem& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetVerticalAlignment( const SwFmtVertOrient& rNew )
+{
+    SetFmtAttr( rNew );
+}
+
+void SwTableBoxFmt::SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
+{
+    sNumFmtString = rFmt;
+    eNumFmtLanguage = eLng;
+    eSysLanguage = eSys;
+}
+
+const SvxFrameDirectionItem& SwTableBoxFmt::GetTextOrientation() const
+{
+    return SwFmt::GetFrmDir();
+}
+
+const SwFmtVertOrient& SwTableBoxFmt::GetVerticalAlignment() const
+{
+    return SwFmt::GetVertOrient();
+}
+
+void SwTableBoxFmt::GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
+{
+    rFmt = sNumFmtString;
+    rLng = eNumFmtLanguage;
+    rSys = eSysLanguage;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list