summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2002-08-23 08:39:57 +0000
committerOliver Specht <os@openoffice.org>2002-08-23 08:39:57 +0000
commit46c941c5bef66187f02894292498426b0a04c292 (patch)
tree0b9447453b04b6900e546dc5e15497e0030399bf /sw
parent6d6d8c8ab0987f931ad9a35e8538867ca52d6d67 (diff)
#98399# Ruler capable of right-to-left text
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/fesh.hxx5
-rw-r--r--sw/sdi/_viewsh.sdi9
-rw-r--r--sw/source/core/frmedt/fetab.cxx14
-rw-r--r--sw/source/ui/uiview/viewport.cxx7
-rw-r--r--sw/source/ui/uiview/viewtab.cxx98
5 files changed, 102 insertions, 31 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index b6cb93a8d6ea..6c22f9d104a1 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fesh.hxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: os $ $Date: 2002-08-22 10:37:57 $
+ * last change: $Author: os $ $Date: 2002-08-23 09:34:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -670,6 +670,7 @@ public:
USHORT GetCurMouseTabColNum( const Point &rPt ) const;
USHORT GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const; // aktuelle aeussere Spalte
BOOL IsTableRightToLeft()const;
+ BOOL IsMouseTableRightToLeft(const Point &rPt) const;
// Die Breite des aktuellen Bereichs fuer Spaltendialog
long GetSectionWidth( SwFmt& rFmt ) const;
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index fb9137a699c7..f607b3febeb5 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -2,9 +2,9 @@
*
* $RCSfile: _viewsh.sdi,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: os $ $Date: 2002-04-25 14:47:30 $
+ * last change: $Author: os $ $Date: 2002-08-23 09:33:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -250,6 +250,11 @@ interface BaseTextEditView : View
StateMethod = StateTabWin ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+ SID_RULER_TEXT_RIGHT_TO_LEFT
+ [
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
SID_RULER_LR_MIN_MAX // status()
[
StateMethod = StateTabWin ;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 6654367d2a91..f3d53d1f6bd1 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fetab.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: os $ $Date: 2002-08-22 10:40:29 $
+ * last change: $Author: os $ $Date: 2002-08-23 09:38:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1773,3 +1773,13 @@ BOOL SwFEShell::IsTableRightToLeft() const
return pFrm->ImplFindTabFrm()->IsRightToLeft();
}
+/* -----------------------------22.08.2002 12:50------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const
+{
+ SwFrm *pFrm = (SwFrm *)GetBox( rPt );
+ const SwTabFrm* pTabFrm = pFrm ? pFrm->ImplFindTabFrm() : 0;
+ ASSERT( pTabFrm, "Table not found" );
+ return pTabFrm ? pTabFrm->IsRightToLeft() : FALSE;
+}
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index d63790607173..9154983bfb49 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewport.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: os $ $Date: 2002-07-05 12:45:41 $
+ * last change: $Author: os $ $Date: 2002-08-23 09:39:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -205,7 +205,8 @@ void SwView::InvalidateRulerPos()
{
SID_ATTR_PARA_LRSPACE, SID_RULER_BORDERS, SID_RULER_PAGE_POS,
SID_RULER_LR_MIN_MAX, SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
- SID_ATTR_PARA_LRSPACE_VERTICAL, SID_RULER_BORDERS_VERTICAL, FN_STAT_PAGE, 0
+ SID_ATTR_PARA_LRSPACE_VERTICAL, SID_RULER_BORDERS_VERTICAL,
+ SID_RULER_TEXT_RIGHT_TO_LEFT, FN_STAT_PAGE, 0
};
GetViewFrame()->GetBindings().Invalidate(aInval);
diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx
index 8dce3ce12c75..179300ce0e64 100644
--- a/sw/source/ui/uiview/viewtab.cxx
+++ b/sw/source/ui/uiview/viewtab.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewtab.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: mba $ $Date: 2002-06-27 09:01:46 $
+ * last change: $Author: os $ $Date: 2002-08-23 09:39:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -375,7 +375,7 @@ void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
if ( rDesc.GetUseOn() == PD_MIRROR && (nPhyPage % 2) == 0 )
{
- USHORT nTmp = rLRSpace.GetRight();
+ long nTmp = rLRSpace.GetRight();
rLRSpace.SetRight( rLRSpace.GetLeft() );
rLRSpace.SetLeft( nTmp );
}
@@ -469,7 +469,6 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rPrtRect.Height() :
rFrmSize.GetHeight();
const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
BOOL bUnlockView = FALSE;
rSh.StartAllAction();
@@ -649,10 +648,10 @@ void SwView::ExecTabWin( SfxRequest& rReq )
long nDiff = nNewColPos - nOldColPos;
SwColumn* pCol = aCols[bLeftChanged ? nCurFrameCol : nCurFrameCol + 1];
- pCol->SetWishWidth(long(pCol->GetWishWidth()) - nDiff );
+ pCol->SetWishWidth(USHORT(pCol->GetWishWidth()) - (USHORT)nDiff );
//den Nachbarn in umgekehrter Weise veraendern
pCol = aCols[bLeftChanged ? nCurFrameCol - 1 : nCurFrameCol ];
- pCol->SetWishWidth(long(pCol->GetWishWidth()) + nDiff );
+ pCol->SetWishWidth(USHORT(pCol->GetWishWidth()) + (USHORT)nDiff );
}
aSet.Put( aCol );
rSh.StartAction();
@@ -736,10 +735,10 @@ void SwView::ExecTabWin( SfxRequest& rReq )
long nDiff = nNewColPos - nOldColPos;
SwColumn* pCol = aCols[bLeftChanged ? nCurCol : nCurCol + 1];
- pCol->SetWishWidth(long(pCol->GetWishWidth()) - nDiff );
+ pCol->SetWishWidth(USHORT(pCol->GetWishWidth()) - (USHORT)nDiff );
//den Nachbarn in umgekehrter Weise veraendern
pCol = aCols[bLeftChanged ? nCurCol - 1 : nCurCol ];
- pCol->SetWishWidth(long(pCol->GetWishWidth()) + nDiff );
+ pCol->SetWishWidth(USHORT(pCol->GetWishWidth()) + (USHORT)nDiff );
}
SwPageDesc aDesc( rDesc );
aDesc.GetMaster().SetAttr( aCol );
@@ -806,8 +805,8 @@ void SwView::ExecTabWin( SfxRequest& rReq )
else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
{
// Seitenraender rausrechnen
- USHORT nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
- aLongLR.SetLeft( nOld > (USHORT)aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
+ long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
+ aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
nOld = rDesc.GetMaster().GetLRSpace().GetRight();
aLongLR.SetRight( nOld > (USHORT)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
@@ -1122,11 +1121,29 @@ void SwView::ExecTabWin( SfxRequest& rReq )
// Tabcols der Reihe nach
// Die letzte Col wird durch den Rand definiert
- for ( USHORT i = 0; i < aColItem.Count()-1; ++i )
+ //columns in right-to-left tables need to be mirrored
+ BOOL bIsTableRTL =
+ IsTabColFromDoc() ?
+ rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+ : rSh.IsTableRightToLeft();
+ if(bIsTableRTL)
{
- const SvxColumnDescription& rCol = aColItem[i];
- aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
- aTabCols.SetHidden( i, !rCol.bVisible );
+ USHORT nColCount = aColItem.Count() - 1;
+ for ( USHORT i = 0; i < nColCount; ++i )
+ {
+ const SvxColumnDescription& rCol = aColItem[nColCount - i];
+ aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
+ aTabCols.SetHidden( i, !rCol.bVisible );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < aColItem.Count()-1; ++i )
+ {
+ const SvxColumnDescription& rCol = aColItem[i];
+ aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
+ aTabCols.SetHidden( i, !rCol.bVisible );
+ }
}
DEBUGTABCOLS(aTabCols);
@@ -1491,6 +1508,20 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
}
break;
+ case SID_RULER_TEXT_RIGHT_TO_LEFT:
+ {
+ if ( nSelectionType & SwWrtShell::SEL_GRF ||
+ nSelectionType & SwWrtShell::SEL_FRM ||
+ nSelectionType & SwWrtShell::SEL_OLE ||
+ nFrmType == FRMTYPE_DRAWOBJ)
+ rSet.DisableItem(nWhich);
+ else
+ {
+ BOOL bFlag = rSh.IsInRightToLeftText();
+ rSet.Put(SfxBoolItem(nWhich, bFlag));
+ }
+ }
+ break;
case SID_RULER_BORDERS_VERTICAL:
case SID_RULER_BORDERS:
{
@@ -1532,17 +1563,40 @@ void SwView::StateTabWin(SfxItemSet& rSet)
USHORT nStart = 0,
nEnd;
- for ( USHORT i = 0; i < aTabCols.Count(); ++i )
+ //columns in right-to-left tables need to be mirrored
+ BOOL bIsTableRTL =
+ IsTabColFromDoc() ?
+ rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+ : rSh.IsTableRightToLeft();
+ if(bIsTableRTL)
+ {
+ for ( USHORT i = aTabCols.Count(); i ; --i )
+ {
+ nEnd = aTabCols.GetRight();
+ nEnd -= aTabCols[i-1];
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ !aTabCols.IsHidden(i - 1) );
+ aColItem.Append(aColDesc);
+ nStart = nEnd;
+ }
+ SvxColumnDescription aColDesc(nStart,
+ aTabCols.GetRight() - aTabCols.GetLeft(), TRUE);
+ aColItem.Append(aColDesc);
+ }
+ else
{
- nEnd = aTabCols[i] - aTabCols.GetLeft();
- SvxColumnDescription aColDesc( nStart, nEnd,
- !aTabCols.IsHidden(i) );
+ for ( USHORT i = 0; i < aTabCols.Count(); ++i )
+ {
+ nEnd = aTabCols[i] - aTabCols.GetLeft();
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ !aTabCols.IsHidden(i) );
+ aColItem.Append(aColDesc);
+ nStart = nEnd;
+ }
+ SvxColumnDescription aColDesc(nStart,
+ aTabCols.GetRight() - aTabCols.GetLeft(), TRUE);
aColItem.Append(aColDesc);
- nStart = nEnd;
}
- SvxColumnDescription aColDesc(nStart,
- aTabCols.GetRight() - aTabCols.GetLeft(), TRUE);
- aColItem.Append(aColDesc);
rSet.Put(aColItem, nWhich);
DEBUGCOLITEMS(aColItem);
}