summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-10-09 22:08:51 +0200
committerEike Rathke <erack@redhat.com>2016-10-13 17:48:09 +0000
commit8974b0fafb18f9dd3f2c0e175a3255b80e4c249e (patch)
tree95a18cdbf510bdf8bea701a51c1a4c8b025a0001 /sc
parent5a5b83b102ac84eb6013cd5383075493c5bcd8ba (diff)
LOK: Calc: in the numeric content case, the used alignment can be wrong
-description: in the numeric content case, the used horizontal alignment can be wrong when input content goes further than the cell border; - reason: (very odd) bMoveArea and nEditAdjust are global variables in viewdata.cxx instead of being data members of ScViewdata; - solution: now bMoveArea and nEditAdjust are data members of ScViewdata. Change-Id: I58a4ec26ca290fd328ef28a92c3c590462c7231a Reviewed-on: https://gerrit.libreoffice.org/29628 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/29661 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputhdl.cxx10
-rw-r--r--sc/source/ui/inc/viewdata.hxx5
-rw-r--r--sc/source/ui/view/viewdata.cxx13
3 files changed, 17 insertions, 11 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 834d4c4663ad..e0712c4671f8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -91,8 +91,6 @@ using namespace formula;
bool ScInputHandler::bOptLoaded = false; // Evaluate App options
bool ScInputHandler::bAutoComplete = false; // Is set in KeyInput
-extern sal_uInt16 nEditAdjust; //! Member of ViewData
-
namespace {
// Formula data replacement character for a pair of parentheses at end of
@@ -1972,8 +1970,10 @@ void ScInputHandler::UpdateAdjust( sal_Unicode cTyped )
pEditDefaults->Put( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) );
pEngine->SetDefaults( *pEditDefaults );
- nEditAdjust = sal::static_int_cast<sal_uInt16>(eSvxAdjust); //! set at ViewData or with PostEditView
-
+ if ( pActiveViewSh )
+ {
+ pActiveViewSh->GetViewData().SetEditAdjust( eSvxAdjust );
+ }
pEngine->SetVertical( bAsianVertical );
}
@@ -2317,7 +2317,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified )
{
ScViewData& rViewData = pActiveViewSh->GetViewData();
- bool bNeedGrow = ( nEditAdjust != SVX_ADJUST_LEFT ); // Always right-aligned
+ bool bNeedGrow = ( rViewData.GetEditAdjust() != SVX_ADJUST_LEFT ); // Always right-aligned
if (!bNeedGrow)
{
// Cursor before the end?
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index b0cd0a3f5078..d4b5a0499231 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -218,12 +218,14 @@ private:
ScSplitPos eEditActivePart; // the part that was active when edit mode was started
ScFillMode nFillMode;
+ SvxAdjust eEditAdjust;
bool bEditActive[4]; // Active?
bool bActive:1; // Active Window ?
bool bIsRefMode:1; // Reference input
bool bDelMarkValid:1; // Only valid at SC_REFTYPE_FILL
bool bPagebreak:1; // Page break preview mode
bool bSelCtrlMouseClick:1; // special selection handling for ctrl-mouse-click
+ bool bMoveArea:1;
long m_nLOKPageUpDownOffset;
@@ -375,6 +377,9 @@ public:
bool IsFillMode() { return nFillMode == ScFillMode::FILL; }
ScFillMode GetFillMode() { return nFillMode; }
+ SvxAdjust GetEditAdjust() const {return eEditAdjust; }
+ void SetEditAdjust( SvxAdjust eNewEditAdjust ) { eEditAdjust = eNewEditAdjust; }
+
// TRUE: Cell is merged
bool GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const;
void GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 3cb30c71f392..7763af3e3820 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -74,9 +74,6 @@ using namespace com::sun::star;
#define TAG_TABBARWIDTH "tw:"
-static bool bMoveArea = false; // Member?
-sal_uInt16 nEditAdjust = SVX_ADJUST_LEFT; // Member!
-
namespace {
void lcl_LOKRemoveEditView(ScTabViewShell* pTabViewShell, ScSplitPos eWhich)
@@ -352,11 +349,13 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
nPasteFlags ( SC_PASTE_NONE ),
eEditActivePart( SC_SPLIT_BOTTOMLEFT ),
nFillMode ( ScFillMode::NONE ),
+ eEditAdjust ( SVX_ADJUST_LEFT ),
bActive ( true ), // how to initialize?
bIsRefMode ( false ),
bDelMarkValid( false ),
bPagebreak ( false ),
bSelCtrlMouseClick( false ),
+ bMoveArea ( false ),
m_nLOKPageUpDownOffset( 0 )
{
mpMarkData->SelectOneTable(0); // Sync with nTabNo
@@ -441,11 +440,13 @@ ScViewData::ScViewData( const ScViewData& rViewData ) :
nPasteFlags ( SC_PASTE_NONE ),
eEditActivePart( rViewData.eEditActivePart ),
nFillMode ( ScFillMode::NONE ),
+ eEditAdjust ( rViewData.eEditAdjust ),
bActive ( true ), // how to initialize?
bIsRefMode ( false ),
bDelMarkValid( false ),
bPagebreak ( rViewData.bPagebreak ),
bSelCtrlMouseClick( rViewData.bSelCtrlMouseClick ),
+ bMoveArea ( rViewData.bMoveArea ),
m_nLOKPageUpDownOffset( rViewData.m_nLOKPageUpDownOffset )
{
@@ -1028,7 +1029,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
// when right-aligned, leave space for the cursor
// in vertical mode, editing is always right-aligned
- if ( nEditAdjust == SVX_ADJUST_RIGHT || bAsianVertical )
+ if ( GetEditAdjust() == SVX_ADJUST_RIGHT || bAsianVertical )
aPixRect.Right() += 1;
Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, GetLogicMode() );
@@ -1104,12 +1105,12 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
Size aPaper = pNewEngine->GetPaperSize();
Rectangle aVis = pEditView[eWhich]->GetVisArea();
long nDiff = aVis.Right() - aVis.Left();
- if ( nEditAdjust == SVX_ADJUST_RIGHT )
+ if ( GetEditAdjust() == SVX_ADJUST_RIGHT )
{
aVis.Right() = aPaper.Width() - 1;
bMoveArea = !bLayoutRTL;
}
- else if ( nEditAdjust == SVX_ADJUST_CENTER )
+ else if ( GetEditAdjust() == SVX_ADJUST_CENTER )
{
aVis.Right() = ( aPaper.Width() - 1 + nDiff ) / 2;
bMoveArea = true; // always