sc/source/ui/inc/colrowba.hxx | 32 ++++++--------- sc/source/ui/inc/hdrcont.hxx | 24 +++++------ sc/source/ui/view/colrowba.cxx | 33 +++++++-------- sc/source/ui/view/hdrcont.cxx | 85 +++++++++++++++-------------------------- 4 files changed, 73 insertions(+), 101 deletions(-)
New commits: commit b64d19a6520871eaee908c79e9aaf76ee477e143 Author: Rodolfo Ribeiro Gomes <rodolf...@gmail.com> Date: Sat Nov 2 23:37:34 2013 -0200 German translations and minor clean-up in ScHeaderControls Some methods properly defined as const methods Change-Id: I59bc371bbb3adc6df2b96b82a0968a8693622ff8 Signed-off-by: Rodolfo Ribeiro Gomes <rodolf...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/6537 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/source/ui/inc/colrowba.hxx b/sc/source/ui/inc/colrowba.hxx index 2a0e976..2bb2c68 100644 --- a/sc/source/ui/inc/colrowba.hxx +++ b/sc/source/ui/inc/colrowba.hxx @@ -26,9 +26,6 @@ class ScHeaderFunctionSet; class ScHeaderSelectionEngine; -// --------------------------------------------------------------------------- - - class ScColBar : public ScHeaderControl { ScViewData* pViewData; @@ -40,19 +37,19 @@ public: ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng ); ~ScColBar(); - virtual SCCOLROW GetPos(); - virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ); - virtual OUString GetEntryText( SCCOLROW nEntryNo ); + virtual SCCOLROW GetPos() const; + virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const; + virtual OUString GetEntryText( SCCOLROW nEntryNo ) const; - virtual bool IsLayoutRTL(); // only for columns + virtual bool IsLayoutRTL() const; virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ); virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ); virtual void SetMarking( bool bSet ); virtual void SelectWindow(); - virtual bool IsDisabled(); - virtual bool ResizeAllowed(); + virtual bool IsDisabled() const; + virtual bool ResizeAllowed() const; virtual void DrawInvert( long nDragPos ); @@ -73,29 +70,26 @@ public: ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng ); ~ScRowBar(); - virtual SCCOLROW GetPos(); - virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ); - virtual OUString GetEntryText( SCCOLROW nEntryNo ); + virtual SCCOLROW GetPos() const; + virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const; + virtual OUString GetEntryText( SCCOLROW nEntryNo ) const; - virtual bool IsMirrored(); // only for columns - virtual SCROW GetHiddenCount( SCROW nEntryNo ); // only for columns + virtual bool IsMirrored() const; + virtual SCROW GetHiddenCount( SCROW nEntryNo ) const; virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ); virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ); virtual void SetMarking( bool bSet ); virtual void SelectWindow(); - virtual bool IsDisabled(); - virtual bool ResizeAllowed(); + virtual bool IsDisabled() const; + virtual bool ResizeAllowed() const; virtual void DrawInvert( long nDragPos ); virtual OUString GetDragHelp( long nVal ); }; - - #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx index 3846cf8..9979af6 100644 --- a/sc/source/ui/inc/hdrcont.hxx +++ b/sc/source/ui/inc/hdrcont.hxx @@ -49,7 +49,7 @@ private: SCCOLROW nMarkEnd; bool bMarkRange; - bool bDragging; // Change size + bool bDragging; // Resizing SCCOLROW nDragNo; long nDragStart; long nDragPos; @@ -57,8 +57,8 @@ private: bool bIgnoreMove; - long GetScrPos( SCCOLROW nEntryNo ); - SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ); + long GetScrPos( SCCOLROW nEntryNo ) const; + SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const; bool IsSelectionAllowed(SCCOLROW nPos) const; void ShowDragHelp(); @@ -80,21 +80,21 @@ protected: // new methods - virtual SCCOLROW GetPos() = 0; // current position (Scrolling) - virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) = 0; // width / height (Pixel) - virtual OUString GetEntryText( SCCOLROW nEntryNo ) = 0; + virtual SCCOLROW GetPos() const = 0; // current position (Scrolling) + virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const = 0; // width / height (Pixel) + virtual OUString GetEntryText( SCCOLROW nEntryNo ) const = 0; - virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo ); - virtual bool IsLayoutRTL(); - virtual bool IsMirrored(); + virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo ) const; + virtual bool IsLayoutRTL() const; + virtual bool IsMirrored() const; virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0; virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0; virtual void SetMarking( bool bSet ); virtual void SelectWindow(); - virtual bool IsDisabled(); - virtual bool ResizeAllowed(); + virtual bool IsDisabled() const; + virtual bool ResizeAllowed() const; virtual OUString GetDragHelp( long nVal ); virtual void DrawInvert( long nDragPos ); @@ -117,8 +117,6 @@ public: void SetWidth( long nNew ); }; - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index 731c79b..e207d6f 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -74,12 +74,12 @@ inline bool ScColBar::UseNumericHeader() const return pViewData->GetDocument()->GetAddressConvention() == formula::FormulaGrammar::CONV_XL_R1C1; } -SCCOLROW ScColBar::GetPos() +SCCOLROW ScColBar::GetPos() const { return pViewData->GetPosX(eWhich); } -sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) +sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); @@ -89,10 +89,10 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), pViewData->GetPPTX() ); } -OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) +OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const { return UseNumericHeader() - ? OUString::number(nEntryNo + 1) //FIXME remove String again + ? OUString::number(nEntryNo + 1) : ScColToAlpha( static_cast<SCCOL>(nEntryNo) ); } @@ -100,7 +100,7 @@ void ScColBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ) { sal_uInt16 nSizeTwips; ScSizeMode eMode = SC_SIZE_DIRECT; - if (nNewSize>0 && nNewSize<10) nNewSize=10; // (Pixel) + if (nNewSize < 10) nNewSize = 10; // pixels if ( nNewSize == HDR_SIZE_OPTIMUM ) { @@ -191,13 +191,13 @@ void ScColBar::SelectWindow() pViewSh->ActiveGrabFocus(); } -bool ScColBar::IsDisabled() +bool ScColBar::IsDisabled() const { ScModule* pScMod = SC_MOD(); return pScMod->IsFormulaMode() || pScMod->IsModalMode(); } -bool ScColBar::ResizeAllowed() +bool ScColBar::ResizeAllowed() const { return !pViewData->HasEditView( pViewData->GetActivePart() ); } @@ -217,7 +217,7 @@ OUString ScColBar::GetDragHelp( long nVal ) return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_WIDTH) ); } -bool ScColBar::IsLayoutRTL() // overloaded only for columns +bool ScColBar::IsLayoutRTL() const // overloaded only for columns { return pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() ); } @@ -238,12 +238,12 @@ ScRowBar::~ScRowBar() { } -SCCOLROW ScRowBar::GetPos() +SCCOLROW ScRowBar::GetPos() const { return pViewData->GetPosY(eWhich); } -sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) +sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); @@ -255,7 +255,7 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) nTab ), pViewData->GetPPTY() ); } -OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) +OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const { return OUString::number( nEntryNo + 1 ); } @@ -264,7 +264,7 @@ void ScRowBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ) { sal_uInt16 nSizeTwips; ScSizeMode eMode = SC_SIZE_DIRECT; - if (nNewSize>0 && nNewSize<10) nNewSize=10; // (Pixel) + if (nNewSize < 10) nNewSize = 10; // pixels if ( nNewSize == HDR_SIZE_OPTIMUM ) { @@ -355,13 +355,13 @@ void ScRowBar::SelectWindow() pViewSh->ActiveGrabFocus(); } -bool ScRowBar::IsDisabled() +bool ScRowBar::IsDisabled() const { ScModule* pScMod = SC_MOD(); return pScMod->IsFormulaMode() || pScMod->IsModalMode(); } -bool ScRowBar::ResizeAllowed() +bool ScRowBar::ResizeAllowed() const { return !pViewData->HasEditView( pViewData->GetActivePart() ); } @@ -381,17 +381,16 @@ OUString ScRowBar::GetDragHelp( long nVal ) return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_HEIGHT) ); } -SCROW ScRowBar::GetHiddenCount( SCROW nEntryNo ) // overloaded only for rows +SCROW ScRowBar::GetHiddenCount( SCROW nEntryNo ) const // overloaded only for rows { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); return pDoc->GetHiddenRowCount( nEntryNo, nTab ); } -bool ScRowBar::IsMirrored() // overloaded only for rows +bool ScRowBar::IsMirrored() const // overloaded only for rows { return pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() ); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index e05d2bd..93b5794 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -32,8 +32,6 @@ #include "document.hxx" #include "markdata.hxx" -// ----------------------------------------------------------------------- - #define SC_DRAG_MIN 2 // passes in paint @@ -45,8 +43,6 @@ #define SC_HDRPAINT_TEXT 6 #define SC_HDRPAINT_COUNT 7 -//================================================================== - ScHeaderControl::ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEngine, SCCOLROW nNewSize, bool bNewVertical ) : Window ( pParent ), @@ -77,7 +73,7 @@ ScHeaderControl::ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEn Size aSize = LogicToPixel( Size( GetTextWidth(OUString("8888")), GetTextHeight() ) ); - aSize.Width() += 4; // Platz fuer hervorgehobene Umrandung + aSize.Width() += 4; // place for highlight border aSize.Height() += 3; SetSizePixel( aSize ); @@ -89,15 +85,15 @@ ScHeaderControl::ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEn void ScHeaderControl::SetWidth( long nNew ) { - OSL_ENSURE( bVertical, "SetDigits nur fuer Zeilenkoepfe erlaubt" ); + OSL_ENSURE( bVertical, "SetWidth works only on row headers" ); if ( nNew != nWidth ) { - Size aSize( nNew, GetSizePixel().Height() ); // Hoehe nicht aendern + Size aSize( nNew, GetSizePixel().Height() ); SetSizePixel( aSize ); nWidth = nNew; - Invalidate(); // neu zentrieren + Invalidate(); } } @@ -130,8 +126,6 @@ void ScHeaderControl::SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEn if (!bEnabled) bNewSet = false; - // Variablen setzen - bool bOldSet = bMarkRange; SCCOLROW nOldStart = nMarkStart; SCCOLROW nOldEnd = nMarkEnd; @@ -150,29 +144,26 @@ void ScHeaderControl::SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEn { if ( nNewEnd != nOldEnd ) DoPaint( std::min( nNewEnd, nOldEnd ) + 1, std::max( nNewEnd, nOldEnd ) ); - // sonst nix } else if ( nNewEnd == nOldEnd ) DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewStart, nOldStart ) - 1 ); else if ( nNewStart > nOldEnd || nNewEnd < nOldStart ) { - // zwei Bereiche... + // two areas DoPaint( nOldStart, nOldEnd ); DoPaint( nNewStart, nNewEnd ); } - else // irgendwie ueberlappend... (kommt eh nicht oft vor) + else // somehow overlapping... (it is not often) DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewEnd, nOldEnd ) ); } else - DoPaint( nNewStart, nNewEnd ); // komplett neu + DoPaint( nNewStart, nNewEnd ); // completely new selection } else if ( bOldSet ) - DoPaint( nOldStart, nOldEnd ); // komplett aufheben - - // sonst war nix, is nix + DoPaint( nOldStart, nOldEnd ); // cancel selection } -long ScHeaderControl::GetScrPos( SCCOLROW nEntryNo ) +long ScHeaderControl::GetScrPos( SCCOLROW nEntryNo ) const { long nScrPos; @@ -239,10 +230,6 @@ void ScHeaderControl::DrawShadedRect( long nStart, long nEnd, const Color& rBase DrawRect( Rectangle( nStart, nCenterPos+1, nEnd, nBarSize-1 ) ); } -// -// Paint -// - void ScHeaderControl::Paint( const Rectangle& rRect ) { // fuer VCL ist es wichtig, wenig Aufrufe zu haben, darum werden die aeusseren @@ -573,11 +560,7 @@ void ScHeaderControl::Paint( const Rectangle& rRect ) } } -// -// Maus - Handling -// - -SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) +SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const { bool bFound = false; SCCOLROW nCount = 1; @@ -666,12 +649,13 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) bIgnoreMove = false; SelectWindow(); - bool bFound; - SCCOLROW nHitNo = GetMousePos( rMEvt, bFound ); + bool bIsBorder; + SCCOLROW nHitNo = GetMousePos( rMEvt, bIsBorder ); if (!IsSelectionAllowed(nHitNo)) return; - - if ( bFound && rMEvt.IsLeft() && ResizeAllowed() ) + if ( ! rMEvt.IsLeft() ) + return; + if ( bIsBorder && ResizeAllowed() ) { nDragNo = nHitNo; sal_uInt16 nClicks = rMEvt.GetClicks(); @@ -695,7 +679,7 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) bDragMoved = false; } } - else if (rMEvt.IsLeft()) + else { pSelEngine->SetWindow( this ); Point aPoint; @@ -706,7 +690,7 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) aVis.Top() = LONG_MIN, aVis.Bottom() = LONG_MAX; pSelEngine->SetVisibleArea( aVis ); - SetMarking( true ); // muss vor SelMouseButtonDown sein + SetMarking( true ); // must precede SelMouseButtonDown pSelEngine->SelMouseButtonDown( rMEvt ); // In column/row headers a simple click already is a selection. @@ -782,9 +766,6 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt ) return; } - bool bFound; - (void)GetMousePos( rMEvt, bFound ); - if ( bDragging ) { long nNewPos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X(); @@ -801,7 +782,10 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt ) } else { - if ( bFound && rMEvt.GetButtons()==0 && ResizeAllowed() ) + bool bIsBorder; + (void)GetMousePos( rMEvt, bIsBorder ); + + if ( bIsBorder && rMEvt.GetButtons()==0 && ResizeAllowed() ) SetPointer( Pointer( bVertical ? POINTER_VSIZEBAR : POINTER_HSIZEBAR ) ); else SetPointer( Pointer( POINTER_ARROW ) ); @@ -813,8 +797,8 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt ) void ScHeaderControl::Tracking( const TrackingEvent& rTEvt ) { - // Weil die SelectionEngine kein Tracking kennt, die Events nur auf - // die verschiedenen MouseHandler verteilen... + // Distribute the tracking events to the various MouseEvents, because + // SelectionEngine does not know anything about Tracking if ( rTEvt.IsTrackingCanceled() ) StopMarking(); @@ -829,9 +813,9 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) sal_uInt16 nCmd = rCEvt.GetCommand(); if ( nCmd == COMMAND_CONTEXTMENU ) { - StopMarking(); // Selektion / Dragging beenden + StopMarking(); // finish selection / dragging - // Popup ausfuehren + // execute popup menu ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); @@ -918,14 +902,14 @@ void ScHeaderControl::ShowDragHelp() sal_uInt16 nAlign; if (!bVertical) { - // oberhalb + // above aRect.Left() = aMousePos.X(); aRect.Top() = aPos.Y() - 4; nAlign = QUICKHELP_BOTTOM|QUICKHELP_CENTER; } else { - // rechts oben + // top right aRect.Left() = aPos.X() + aSize.Width() + 8; aRect.Top() = aMousePos.Y() - 2; nAlign = QUICKHELP_LEFT|QUICKHELP_BOTTOM; @@ -940,8 +924,7 @@ void ScHeaderControl::ShowDragHelp() void ScHeaderControl::RequestHelp( const HelpEvent& rHEvt ) { - // Wenn eigene QuickHelp angezeigt wird, nicht durch RequestHelp - // wieder wegnehmen lassen + // If the own QuickHelp is displayed, don't let RequestHelp remove it bool bOwn = bDragging && Help::IsQuickHelpEnabled(); if (!bOwn) @@ -952,7 +935,7 @@ void ScHeaderControl::RequestHelp( const HelpEvent& rHEvt ) // Dummys fuer virtuelle Methoden // ----------------------------------------------------------------------- -SCCOLROW ScHeaderControl::GetHiddenCount( SCCOLROW nEntryNo ) +SCCOLROW ScHeaderControl::GetHiddenCount( SCCOLROW nEntryNo ) const { SCCOLROW nHidden = 0; while ( nEntryNo < nSize && GetEntrySize( nEntryNo ) == 0 ) @@ -963,22 +946,22 @@ SCCOLROW ScHeaderControl::GetHiddenCount( SCCOLROW nEntryNo ) return nHidden; } -bool ScHeaderControl::IsLayoutRTL() +bool ScHeaderControl::IsLayoutRTL() const { return false; } -bool ScHeaderControl::IsMirrored() +bool ScHeaderControl::IsMirrored() const { return false; } -bool ScHeaderControl::IsDisabled() +bool ScHeaderControl::IsDisabled() const { return false; } -bool ScHeaderControl::ResizeAllowed() +bool ScHeaderControl::ResizeAllowed() const { return true; } @@ -1000,6 +983,4 @@ void ScHeaderControl::SetMarking( bool /* bSet */ ) { } - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits