summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-06-05 16:15:53 +0100
committerNoel Power <noel.power@suse.com>2013-06-06 14:59:23 +0100
commit7ef1a64bdb8f9afaeb93e7a88219650381e0d323 (patch)
tree5c64e8cac85ea893c870f9bda9adc65bc5bd0c59
parente8321a374366cf348b6e3731bccf4a716b5ae390 (diff)
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
-rw-r--r--sc/source/filter/inc/stylesbuffer.hxx2
-rw-r--r--sc/source/filter/oox/stylesbuffer.cxx23
2 files changed, 21 insertions, 4 deletions
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 16d577999d3f..cbedfb3a2464 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 6413a168c2df..e06f075742ca 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 );