[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Sun Oct 9 20:56:57 UTC 2016
sc/source/ui/app/inputhdl.cxx | 10 +++++-----
sc/source/ui/inc/viewdata.hxx | 5 +++++
sc/source/ui/view/viewdata.cxx | 13 +++++++------
3 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 3ee94eab7ce4c856bfe7c3c1f604858a7d9f4178
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Sun Oct 9 22:08:51 2016 +0200
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 at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 9978071..1d6ce11 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -90,8 +90,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
@@ -1795,8 +1793,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 );
}
@@ -2140,7 +2140,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 14b26a9..3ed3e7c 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -207,12 +207,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;
@@ -355,6 +357,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;
bool GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index f61b5d7..e45a1d5 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -75,9 +75,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)
@@ -348,11 +345,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
@@ -437,11 +436,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 )
{
@@ -1006,7 +1007,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() );
@@ -1082,12 +1083,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
More information about the Libreoffice-commits
mailing list