[Libreoffice-commits] core.git: 2 commits - sc/source

Noel Power noel.power at suse.com
Thu Jun 6 06:59:46 PDT 2013


 sc/source/filter/inc/stylesbuffer.hxx |    2 --
 sc/source/filter/oox/stylesbuffer.cxx |   26 ++++++--------------------
 2 files changed, 6 insertions(+), 22 deletions(-)

New commits:
commit 7ef1a64bdb8f9afaeb93e7a88219650381e0d323
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jun 5 16:15:53 2013 +0100

    another attempt at followon patch for fdo#38385 attempt to detect rtl
    
    First attempt confused things ( and was error prone ) by introducing
    maStart and maEnd BorderLine members to BorderLine model. Better to
    just leave maLeft & maRight and attempt to swap if RTL.
    Of course tbh this is somewhat of an optimistic attempt to swap start and end borders
    if needed. I am not at all sure though that I am dectecting the RTL-ness
    of a cell in the correct way. There are some comments in the code in any case
    that reflect my uncertainty ( hopefully they will be of use if/when some tweak
    is needed )
    
    Change-Id: Ie953d73067630f0041fa037c6120cdbda683e796

diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 16d5779..cbedfb3 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -513,7 +513,7 @@ public:
     void                importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
 
     /** Final processing after import of all style settings. */
-    void                finalizeImport();
+    void                finalizeImport( bool bRTL );
 
     /** Returns the border model structure. */
     inline const BorderModel& getModel() const { return maModel; }
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 6413a16..e06f075 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1701,8 +1701,14 @@ void Border::importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm )
     }
 }
 
-void Border::finalizeImport()
+void Border::finalizeImport( bool bRTL )
 {
+    if ( bRTL )
+    {
+        BorderLineModel aTmp = maModel.maLeft;
+        maModel.maLeft = maModel.maRight;
+        maModel.maRight = aTmp;
+    }
     maApiData.mbBorderUsed = maModel.maLeft.mbUsed || maModel.maRight.mbUsed || maModel.maTop.mbUsed || maModel.maBottom.mbUsed;
     maApiData.mbDiagUsed   = maModel.maDiagonal.mbUsed;
 
@@ -2579,13 +2585,22 @@ void Dxf::finalizeImport()
 {
     if( mxFont.get() )
         mxFont->finalizeImport();
+    bool bRTL = false;
     // number format already finalized by the number formats buffer
     if( mxAlignment.get() )
+    {
         mxAlignment->finalizeImport();
+        // how do we detect RTL when text dir is OOX_XF_CONTEXT? ( seems you
+        // would need access to the cell content, which we don't here )
+        if ( mxAlignment->getModel().mnTextDir == OOX_XF_TEXTDIR_RTL )
+            bRTL = true;
+    }
     if( mxProtection.get() )
         mxProtection->finalizeImport();
     if( mxBorder.get() )
-        mxBorder->finalizeImport();
+    {
+        mxBorder->finalizeImport( bRTL );
+    }
     if( mxFill.get() )
         mxFill->finalizeImport();
 }
@@ -3110,7 +3125,9 @@ void StylesBuffer::finalizeImport()
     // number formats
     maNumFmts.finalizeImport();
     // borders and fills
-    maBorders.forEachMem( &Border::finalizeImport );
+    // is there a document wide RTL setting that we
+    // would/could need to pass to finalizeImport here ?
+    maBorders.forEachMem( &Border::finalizeImport, false );
     maFills.forEachMem( &Fill::finalizeImport );
     // style XFs and cell XFs
     maStyleXfs.forEachMem( &Xf::finalizeImport );
commit e8321a374366cf348b6e3731bccf4a716b5ae390
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jun 5 16:08:36 2013 +0100

    Revert "follow patch for fdo#38385 attempt to detect rtl"
    
    This reverts commit d2cccde341af33b72378f3e7b0e8dd9ff1cd5e65.

diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 7108a49..16d5779 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -458,9 +458,7 @@ struct BorderLineModel
 /** Contains XML attributes of a complete cell border. */
 struct BorderModel
 {
-    BorderLineModel     maStart;            /// Start line format.
     BorderLineModel     maLeft;             /// Left line format.
-    BorderLineModel     maEnd;              /// End line format.
     BorderLineModel     maRight;            /// Right line format.
     BorderLineModel     maTop;              /// Top line format.
     BorderLineModel     maBottom;           /// Bottom line format.
@@ -515,7 +513,7 @@ public:
     void                importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
 
     /** Final processing after import of all style settings. */
-    void                finalizeImport( bool bRTL );
+    void                finalizeImport();
 
     /** Returns the border model structure. */
     inline const BorderModel& getModel() const { return maModel; }
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 62f4bc8..6413a16 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1575,9 +1575,7 @@ void BorderLineModel::setBiffStyle( sal_Int32 nLineStyle )
 // ----------------------------------------------------------------------------
 
 BorderModel::BorderModel( bool bDxf ) :
-    maStart( bDxf ),
     maLeft( bDxf ),
-    maEnd( bDxf ),
     maRight( bDxf ),
     maTop( bDxf ),
     maBottom( bDxf ),
@@ -1703,26 +1701,8 @@ void Border::importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm )
     }
 }
 
-void Border::finalizeImport( bool bRTL )
+void Border::finalizeImport()
 {
-    // Swap left/right <-> start/end borders based on RTL
-    if ( maModel.maStart.mbUsed || maModel.maEnd.mbUsed )
-    {
-        if ( bRTL )
-        {
-            if ( maModel.maStart.mbUsed )
-                maModel.maRight = maModel.maStart;
-            if ( maModel.maEnd.mbUsed )
-                maModel.maLeft = maModel.maEnd;
-        }
-        else
-        {
-            if ( maModel.maStart.mbUsed )
-                maModel.maLeft = maModel.maStart;
-            if ( maModel.maEnd.mbUsed )
-                maModel.maRight = maModel.maEnd;
-        }
-    }
     maApiData.mbBorderUsed = maModel.maLeft.mbUsed || maModel.maRight.mbUsed || maModel.maTop.mbUsed || maModel.maBottom.mbUsed;
     maApiData.mbDiagUsed   = maModel.maDiagonal.mbUsed;
 
@@ -1818,9 +1798,9 @@ BorderLineModel* Border::getBorderLine( sal_Int32 nElement )
     switch( nElement )
     {
         case XLS_TOKEN( left ):     return &maModel.maLeft;
-        case XLS_TOKEN( start ):     return &maModel.maStart;
+        case XLS_TOKEN( start ):     return &maModel.maLeft;
         case XLS_TOKEN( right ):    return &maModel.maRight;
-        case XLS_TOKEN( end ):    return &maModel.maEnd;
+        case XLS_TOKEN( end ):    return &maModel.maRight;
         case XLS_TOKEN( top ):      return &maModel.maTop;
         case XLS_TOKEN( bottom ):   return &maModel.maBottom;
         case XLS_TOKEN( diagonal ): return &maModel.maDiagonal;
@@ -2599,22 +2579,13 @@ void Dxf::finalizeImport()
 {
     if( mxFont.get() )
         mxFont->finalizeImport();
-    bool bRTL = false;
     // number format already finalized by the number formats buffer
     if( mxAlignment.get() )
-    {
         mxAlignment->finalizeImport();
-        // how do we detect RTL when text dir is OOX_XF_CONTEXT? ( seems you
-        // would need access to the cell content, which we don't here )
-        if ( mxAlignment->getModel().mnTextDir == OOX_XF_TEXTDIR_RTL )
-            bRTL = true;
-    }
     if( mxProtection.get() )
         mxProtection->finalizeImport();
     if( mxBorder.get() )
-    {
-        mxBorder->finalizeImport( bRTL );
-    }
+        mxBorder->finalizeImport();
     if( mxFill.get() )
         mxFill->finalizeImport();
 }
@@ -3139,9 +3110,7 @@ void StylesBuffer::finalizeImport()
     // number formats
     maNumFmts.finalizeImport();
     // borders and fills
-    // is there a document wide RTL setting that we
-    // would/could need to pass to finalizeImport here ?
-    maBorders.forEachMem( &Border::finalizeImport, false );
+    maBorders.forEachMem( &Border::finalizeImport );
     maFills.forEachMem( &Fill::finalizeImport );
     // style XFs and cell XFs
     maStyleXfs.forEachMem( &Xf::finalizeImport );


More information about the Libreoffice-commits mailing list