Kaydet (Commit) 6f2a379f authored tarafından Oliver Specht's avatar Oliver Specht

#98399# Ruler capable of right-to-left text

üst e178afdb
...@@ -11508,3 +11508,29 @@ SfxBoolItem ParaRightToLeft SID_ATTR_PARA_RIGHT_TO_LEFT ...@@ -11508,3 +11508,29 @@ SfxBoolItem ParaRightToLeft SID_ATTR_PARA_RIGHT_TO_LEFT
ToolBoxConfig = TRUE, ToolBoxConfig = TRUE,
GroupId = GID_FORMAT; GroupId = GID_FORMAT;
] ]
//--------------------------------------------------------------------------
SfxBoolItem TextRTL SID_RULER_TEXT_RIGHT_TO_LEFT
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Asynchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_CONTROLS;
]
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: rlrcitem.cxx,v $ * $RCSfile: rlrcitem.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: os $ $Date: 2002-02-27 08:49:32 $ * last change: $Author: os $ $Date: 2002-08-23 09:32:04 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -80,6 +80,9 @@ ...@@ -80,6 +80,9 @@
#include "protitem.hxx" #include "protitem.hxx"
#include "rlrcitem.hxx" #include "rlrcitem.hxx"
#include "rulritem.hxx" #include "rulritem.hxx"
#ifndef _SFXENUMITEM_HXX
#include <svtools/eitem.hxx>
#endif
// class SvxRulerItem ---------------------------------------------------- // class SvxRulerItem ----------------------------------------------------
...@@ -185,6 +188,13 @@ void SvxRulerItem::StateChanged( USHORT nSID, SfxItemState eState, ...@@ -185,6 +188,13 @@ void SvxRulerItem::StateChanged( USHORT nSID, SfxItemState eState,
rRuler.UpdateParaBorder(pItem); rRuler.UpdateParaBorder(pItem);
} }
break; break;
case SID_RULER_TEXT_RIGHT_TO_LEFT :
{
const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
DBG_ASSERT(pState? 0 != pItem: TRUE, "SfxBoolItem erwartet");
rRuler.UpdateTextRTL(pItem);
}
break;
} }
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: svxruler.cxx,v $ * $RCSfile: svxruler.cxx,v $
* *
* $Revision: 1.14 $ * $Revision: 1.15 $
* *
* last change: $Author: os $ $Date: 2002-03-12 16:46:11 $ * last change: $Author: os $ $Date: 2002-08-23 09:33:12 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
// STATIC DATA ----------------------------------------------------------- // STATIC DATA -----------------------------------------------------------
#define CTRL_ITEM_COUNT 11 #define CTRL_ITEM_COUNT 12
#define GAP 10 #define GAP 10
#define OBJECT_BORDER_COUNT 4 #define OBJECT_BORDER_COUNT 4
#define TAB_GAP 1 #define TAB_GAP 1
...@@ -179,7 +179,7 @@ void DebugParaMargin_Impl(const SvxLRSpaceItem& rLRSpace) ...@@ -179,7 +179,7 @@ void DebugParaMargin_Impl(const SvxLRSpaceItem& rLRSpace)
} }
#endif // DEBUGLIN #endif // DEBUGLIN
#ifdef DEBUG #ifdef DEBUG_RULER
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
class RulerDebugWindow : public Window class RulerDebugWindow : public Window
...@@ -250,6 +250,7 @@ struct SvxRuler_Impl { ...@@ -250,6 +250,7 @@ struct SvxRuler_Impl {
long lMaxRightLogic; long lMaxRightLogic;
long lLastLMargin; long lLastLMargin;
SvxProtectItem aProtectItem; SvxProtectItem aProtectItem;
SfxBoolItem* pTextRTLItem;
USHORT nControlerItems; USHORT nControlerItems;
USHORT nIdx; USHORT nIdx;
USHORT nColLeftPix, nColRightPix; // Pixelwerte fuer linken / rechten Rand USHORT nColLeftPix, nColRightPix; // Pixelwerte fuer linken / rechten Rand
...@@ -259,13 +260,14 @@ struct SvxRuler_Impl { ...@@ -259,13 +260,14 @@ struct SvxRuler_Impl {
// aufgebohrt werden // aufgebohrt werden
SvxRuler_Impl() : SvxRuler_Impl() :
pPercBuf(0), pBlockBuf(0), nPercSize(0), nTotalDist(0), nIdx(0), pPercBuf(0), pBlockBuf(0), nPercSize(0), nTotalDist(0), nIdx(0),
nColLeftPix(0), nColRightPix(0), lOldWinPos(0) nColLeftPix(0), nColRightPix(0), lOldWinPos(0), pTextRTLItem(0)
{ {
} }
~SvxRuler_Impl() ~SvxRuler_Impl()
{ {
nPercSize = 0; nTotalDist = 0; nPercSize = 0; nTotalDist = 0;
delete pPercBuf; delete pBlockBuf; pPercBuf = 0; delete pPercBuf; delete pBlockBuf; pPercBuf = 0;
delete pTextRTLItem;
} }
void SetPercSize(USHORT nSize); void SetPercSize(USHORT nSize);
...@@ -419,7 +421,10 @@ SvxRuler::SvxRuler ...@@ -419,7 +421,10 @@ SvxRuler::SvxRuler
} }
if((nFlags & SVXRULER_SUPPORT_BORDERS) == SVXRULER_SUPPORT_BORDERS) if((nFlags & SVXRULER_SUPPORT_BORDERS) == SVXRULER_SUPPORT_BORDERS)
{
pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL, *this, rBindings); pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL, *this, rBindings);
pCtrlItem[i++] = new SvxRulerItem(SID_RULER_TEXT_RIGHT_TO_LEFT, *this, rBindings);
}
if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT) if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT)
{ {
...@@ -763,6 +768,19 @@ void SvxRuler::Update( const SvxProtectItem* pItem ) ...@@ -763,6 +768,19 @@ void SvxRuler::Update( const SvxProtectItem* pItem )
{ {
if( pItem ) pRuler_Imp->aProtectItem = *pItem; if( pItem ) pRuler_Imp->aProtectItem = *pItem;
} }
/* -----------------------------22.08.2002 13:10------------------------------
---------------------------------------------------------------------------*/
void SvxRuler::UpdateTextRTL(const SfxBoolItem* pItem)
{
if(bActive)
{
delete pRuler_Imp->pTextRTLItem; pRuler_Imp->pTextRTLItem = 0;
if(pItem)
pRuler_Imp->pTextRTLItem = new SfxBoolItem(*pItem);
StartListening_Impl();
}
}
void SvxRuler::Update void SvxRuler::Update
( (
...@@ -903,12 +921,18 @@ void SvxRuler::UpdatePara() ...@@ -903,12 +921,18 @@ void SvxRuler::UpdatePara()
// Erstzeileneinzug, ist negativ zum linken Absatzrand // Erstzeileneinzug, ist negativ zum linken Absatzrand
long nLeftFrameMargin = GetLeftFrameMargin(); long nLeftFrameMargin = GetLeftFrameMargin();
long nRightFrameMargin = GetRightFrameMargin(); long nRightFrameMargin = GetRightFrameMargin();
pIndents[INDENT_FIRST_LINE].nPos = if(pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue())
ConvertHPosPixel( pIndents[INDENT_FIRST_LINE].nPos =
nLeftFrameMargin + ConvertHPosPixel(
pParaItem->GetTxtLeft() + nRightFrameMargin -
pParaItem->GetTxtFirstLineOfst() + pParaItem->GetTxtFirstLineOfst() + lAppNullOffset );
lAppNullOffset); else
pIndents[INDENT_FIRST_LINE].nPos =
ConvertHPosPixel(
nLeftFrameMargin +
pParaItem->GetTxtLeft() +
pParaItem->GetTxtFirstLineOfst() +
lAppNullOffset);
if( pParaItem->IsAutoFirst() ) if( pParaItem->IsAutoFirst() )
pIndents[INDENT_FIRST_LINE].nStyle |= RULER_STYLE_INVISIBLE; pIndents[INDENT_FIRST_LINE].nStyle |= RULER_STYLE_INVISIBLE;
else else
...@@ -1681,7 +1705,9 @@ void SvxRuler::DragIndents() ...@@ -1681,7 +1705,9 @@ void SvxRuler::DragIndents()
const USHORT nIdx = GetDragAryPos()+INDENT_GAP; const USHORT nIdx = GetDragAryPos()+INDENT_GAP;
const long lDiff = pIndents[nIdx].nPos - lDragPos; const long lDiff = pIndents[nIdx].nPos - lDragPos;
if(nIdx >= INDENT_FIRST_LINE && nIdx < INDENT_RIGHT_MARGIN && BOOL bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
if((nIdx == INDENT_FIRST_LINE ||
(!bRTL && nIdx == INDENT_LEFT_MARGIN ) ||(bRTL && nIdx == INDENT_RIGHT_MARGIN ))&&
(nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) != (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
DRAG_OBJECT_LEFT_INDENT_ONLY) DRAG_OBJECT_LEFT_INDENT_ONLY)
pIndents[INDENT_FIRST_LINE].nPos -= lDiff; pIndents[INDENT_FIRST_LINE].nPos -= lDiff;
...@@ -2146,12 +2172,24 @@ void SvxRuler::ApplyIndents() ...@@ -2146,12 +2172,24 @@ void SvxRuler::ApplyIndents()
ConvertHPosLogic(pIndents[INDENT_LEFT_MARGIN].nPos), ConvertHPosLogic(pIndents[INDENT_LEFT_MARGIN].nPos),
pParaItem->GetTxtLeft()); pParaItem->GetTxtLeft());
long nNewFirstLineOffset = BOOL bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
PixelHAdjust(
ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos - long nNewFirstLineOffset;
if(bRTL)
{
long nRightFrameMargin = GetRightFrameMargin();
nNewFirstLineOffset = PixelHAdjust(nRightFrameMargin -
ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos ) -
lAppNullOffset,
pParaItem->GetTxtFirstLineOfst());
}
else
nNewFirstLineOffset=
PixelHAdjust(
ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos -
pIndents[INDENT_LEFT_MARGIN].nPos) - pIndents[INDENT_LEFT_MARGIN].nPos) -
lAppNullOffset, lAppNullOffset,
pParaItem->GetTxtFirstLineOfst()); pParaItem->GetTxtFirstLineOfst());
// #62986# : Ist der neue TxtLeft kleiner als der alte FirstLineIndent, // #62986# : Ist der neue TxtLeft kleiner als der alte FirstLineIndent,
// dann geht die Differenz verloren und der Absatz wird insgesamt // dann geht die Differenz verloren und der Absatz wird insgesamt
...@@ -3001,7 +3039,9 @@ long __EXPORT SvxRuler::StartDrag() ...@@ -3001,7 +3039,9 @@ long __EXPORT SvxRuler::StartDrag()
case RULER_TYPE_INDENT: { // Absatzeinzuege (Modifier) case RULER_TYPE_INDENT: { // Absatzeinzuege (Modifier)
if( bContentProtected ) if( bContentProtected )
return FALSE; return FALSE;
if((INDENT_LEFT_MARGIN) == GetDragAryPos() + INDENT_GAP) { // Linker Absatzeinzug BOOL bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
USHORT nIndent = bRTL ? INDENT_RIGHT_MARGIN : INDENT_LEFT_MARGIN;
if((nIndent) == GetDragAryPos() + INDENT_GAP) { // Linker Absatzeinzug
pIndents[0] = pIndents[INDENT_FIRST_LINE]; pIndents[0] = pIndents[INDENT_FIRST_LINE];
pIndents[0].nStyle |= RULER_STYLE_DONTKNOW; pIndents[0].nStyle |= RULER_STYLE_DONTKNOW;
EvalModifier(); EvalModifier();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment