Index: sc/source/ui/miscdlgs/autofmt.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/miscdlgs/autofmt.cxx,v --- sc/source/ui/miscdlgs/autofmt.cxx 21 Jul 2006 14:02:05 -0000 1.15 +++ sc/source/ui/miscdlgs/autofmt.cxx 28 May 2007 13:27:21 -0000 @@ -41,6 +41,7 @@ //------------------------------------------------------------------ #include "scitems.hxx" +#include #include #include #include @@ -69,6 +70,8 @@ #include "autofmt.hxx" #include "scresid.hxx" #include "document.hxx" +#include "docsh.hxx" +#include "tabvwsh.hxx" #define FRAME_OFFSET 4 @@ -596,7 +599,7 @@ 4, 5, 6, 5, 7, 12, 13, 14, 13, 15 }; - return pnFmtMap[ maArray.GetCellIndex( nCol, nRow ) ]; + return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, bRTL ) ]; } const SvxBoxItem& AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const @@ -626,7 +629,7 @@ ULONG nNum; double nVal; Color* pDummy = NULL; - USHORT nIndex = static_cast< USHORT >( maArray.GetCellIndex( nCol, nRow ) ); + USHORT nIndex = static_cast< USHORT >( maArray.GetCellIndex( nCol, nRow, bRTL ) ); switch( nIndex ) { @@ -688,9 +691,9 @@ //------------- // Ausrichtung: //------------- - eJustification = bJustify ? - (SvxCellHorJustify)(((const SvxHorJustifyItem*)pCurData->GetItem( nFmtIndex, ATTR_HOR_JUSTIFY ))->GetValue()) : - SVX_HOR_JUSTIFY_STANDARD; + eJustification = bRTL ? SVX_HOR_JUSTIFY_RIGHT : bJustify ? + (SvxCellHorJustify)(((const SvxHorJustifyItem*)pCurData->GetItem( nFmtIndex, ATTR_HOR_JUSTIFY ))->GetValue()) : + SVX_HOR_JUSTIFY_STANDARD; if ( pCurData->GetIncludeFont() ) { @@ -856,6 +859,15 @@ maArray.SetUseDiagDoubleClipping( false ); CalcCellArray( FALSE ); CalcLineMap(); + TypeId aType(TYPE(ScDocShell)); + ScDocShell* pDocShell = (ScDocShell*)SfxObjectShell::GetFirst(&aType); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); + SfxViewShell* p = pFrame->GetViewShell(); + ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScViewData* pViewData = pViewSh->GetViewData(); + SCTAB nCurrentTab = pViewData->GetTabNo(); + ScDocument* pDoc = pViewData->GetDocument(); + bRTL = pDoc->IsLayoutRTL( nCurrentTab ); } //------------------------------------------------------------------------ Index: sc/source/ui/inc/autofmt.hxx =================================================================== RCS file: /cvs/sc/sc/source/ui/inc/autofmt.hxx,v --- sc/source/ui/inc/autofmt.hxx 8 Sep 2005 21:13:27 -0000 1.8 +++ sc/source/ui/inc/autofmt.hxx 28 May 2007 13:27:21 -0000 @@ -158,6 +158,7 @@ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter; BOOL bFitWidth; svx::frame::Array maArray; /// Implementation to draw the frame borders. + BOOL bRTL; Size aPrvSize; long mnLabelColWidth; long mnDataColWidth1; Index: svx/inc/framelinkarray.hxx =================================================================== RCS file: /cvs/graphics/svx/inc/Attic/framelinkarray.hxx,v --- svx/inc/framelinkarray.hxx 8 Sep 2005 17:46:05 -0000 1.4 +++ svx/inc/framelinkarray.hxx 28 May 2007 13:27:21 -0000 @@ -120,7 +120,7 @@ size_t GetRowFromIndex( size_t nCellIndex ) const; /** Returns the cell index from the cell address (nCol,nRow). */ - size_t GetCellIndex( size_t nCol, size_t nRow ) const; + size_t GetCellIndex( size_t nCol, size_t nRow, BOOL bRTL ) const; // cell border styles ----------------------------------------------------- Index: svx/source/dialog/framelinkarray.cxx =================================================================== RCS file: /cvs/graphics/svx/source/dialog/framelinkarray.cxx,v --- svx/source/dialog/framelinkarray.cxx 17 Sep 2006 04:20:42 -0000 1.5 +++ svx/source/dialog/framelinkarray.cxx 28 May 2007 13:27:22 -0000 @@ -510,9 +510,11 @@ return mxImpl->mnWidth ? (nCellIndex / mxImpl->mnWidth) : 0; } -size_t Array::GetCellIndex( size_t nCol, size_t nRow ) const +size_t Array::GetCellIndex( size_t nCol, size_t nRow, BOOL bRTL = FALSE) const { DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetCellIndex" ); + if (bRTL) + nCol = mxImpl->GetMirrorCol(nCol); return mxImpl->GetIndex( nCol, nRow ); } Index: sw/source/ui/table/tautofmt.cxx =================================================================== RCS file: /cvs/sw/sw/source/ui/table/tautofmt.cxx,v --- sw/source/ui/table/tautofmt.cxx 16 Sep 2006 23:22:00 -0000 1.19 +++ sw/source/ui/table/tautofmt.cxx 28 May 2007 13:27:22 -0000 @@ -49,6 +49,9 @@ #ifndef _MSGBOX_HXX //autogen #include #endif +#ifndef _SV_SVAPP_HXX +#include +#endif #ifndef _ZFORLIST_HXX //autogen #include #endif @@ -70,6 +73,9 @@ #ifndef SVX_FRAMELINKARRAY_HXX #include #endif +#ifndef _DOCSH_HXX +#include +#endif #ifndef _SWMODULE_HXX #include "swmodule.hxx" @@ -122,6 +128,7 @@ SvtScriptedTextHelper aScriptedText; svx::frame::Array maArray; /// Implementation to draw the frame borders. BOOL bFitWidth; + BOOL bRTL; Size aPrvSize; long nLabelColWidth; long nDataColWidth1; @@ -635,6 +642,12 @@ nRowHeight ( (aPrvSize.Height() - 4) / 5 ), m_xMSF ( comphelper::getProcessServiceFactory() ) { + SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current(); + SwFEShell* pFEShell = pDocShell->GetFEShell(); + if (!pFEShell->GetCurTabColNum()) // We haven't created the table yet + bRTL = Application::GetSettings().GetLayoutRTL(); + else + bRTL = pFEShell->IsTableRightToLeft(); DBG_ASSERT( m_xMSF.is(), "AutoFmtPreview: no MultiServiceFactory"); if ( m_xMSF.is() ) { @@ -709,7 +722,7 @@ 4, 5, 6, 5, 7, 12, 13, 14, 13, 15 }; - return pnFmtMap[ maArray.GetCellIndex( nCol, nRow ) ]; + return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, bRTL ) ]; } const SvxBoxItem& AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const @@ -733,7 +746,7 @@ ULONG nNum; double nVal; String cellString; - BYTE nIndex = static_cast< BYTE >( maArray.GetCellIndex( nCol, nRow ) ); + BYTE nIndex = static_cast< BYTE >( maArray.GetCellIndex( nCol, nRow, bRTL ) ); switch( nIndex ) { @@ -860,7 +873,9 @@ // horizontal //----------- /* if ( eJustification != SC_HOR_JUSTIFY_STANDARD )*/ - if (aCurData.IsJustify()) + if( bRTL ) + aPos.X() += nRightX; + else if (aCurData.IsJustify()) { USHORT nHorPos = (USHORT) ((cellRect.GetWidth()-aStrSize.Width())/2);