[Libreoffice-commits] core.git: 12 commits - include/svtools officecfg/registry sc/source svtools/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Mar 9 22:35:24 PDT 2015
include/svtools/tabbar.hxx | 31
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 12
sc/source/ui/inc/gridwin.hxx | 29
sc/source/ui/view/gridwin.cxx | 265 ++---
sc/source/ui/view/gridwin2.cxx | 39
sc/source/ui/view/gridwin3.cxx | 29
sc/source/ui/view/gridwin4.cxx | 36
sc/source/ui/view/overlayobject.cxx | 3
sc/source/ui/view/tabview.cxx | 8
svtools/source/control/tabbar.cxx | 607 ++++---------
10 files changed, 464 insertions(+), 595 deletions(-)
New commits:
commit 8332bc98fac35ada2337de032bebfdae82139882
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 19:36:48 2015 +0900
GridWindow: unique_ptr for overlays
Change-Id: I84d997997100af4e21eafc5b458ff98d99c7dbbd
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index fa0d2c0..a30afe2 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -96,13 +96,13 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
};
// #114409#
- ::sdr::overlay::OverlayObjectList* mpOOCursors;
- ::sdr::overlay::OverlayObjectList* mpOOSelection;
- ::sdr::overlay::OverlayObjectList* mpOOSelectionBorder;
- ::sdr::overlay::OverlayObjectList* mpOOAutoFill;
- ::sdr::overlay::OverlayObjectList* mpOODragRect;
- ::sdr::overlay::OverlayObjectList* mpOOHeader;
- ::sdr::overlay::OverlayObjectList* mpOOShrink;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOCursors;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOSelection;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOSelectionBorder;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOAutoFill;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOODragRect;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOHeader;
+ std::unique_ptr<sdr::overlay::OverlayObjectList> mpOOShrink;
std::unique_ptr<Rectangle> mpAutoFillRect;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a88333b..4e87cd1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -429,13 +429,13 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
: Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ),
DropTargetHelper( this ),
DragSourceHelper( this ),
- mpOOCursors( NULL ),
- mpOOSelection( NULL ),
- mpOOSelectionBorder( NULL ),
- mpOOAutoFill( NULL ),
- mpOODragRect( NULL ),
- mpOOHeader( NULL ),
- mpOOShrink( NULL ),
+ mpOOCursors(),
+ mpOOSelection(),
+ mpOOSelectionBorder(),
+ mpOOAutoFill(),
+ mpOODragRect(),
+ mpOOHeader(),
+ mpOOShrink(),
mpAutoFillRect(static_cast<Rectangle*>(NULL)),
pViewData( pData ),
eWhich( eWhichPos ),
@@ -5679,12 +5679,12 @@ void ScGridWindow::UpdateAllOverlays()
void ScGridWindow::DeleteCursorOverlay()
{
- DELETEZ( mpOOCursors );
+ mpOOCursors.reset();
}
void ScGridWindow::DeleteCopySourceOverlay()
{
- DELETEZ( mpOOSelectionBorder );
+ mpOOSelectionBorder.reset();
}
void ScGridWindow::UpdateCopySourceOverlay()
@@ -5711,7 +5711,7 @@ void ScGridWindow::UpdateCopySourceOverlay()
SCTAB nCurTab = pViewData->GetCurPos().Tab();
ScClipParam& rClipParam = pClipDoc->GetClipParam();
- mpOOSelectionBorder = new ::sdr::overlay::OverlayObjectList;
+ mpOOSelectionBorder.reset(new sdr::overlay::OverlayObjectList);
for ( size_t i = 0; i < rClipParam.maRanges.size(); ++i )
{
ScRange* p = rClipParam.maRanges[i];
@@ -5891,7 +5891,7 @@ void ScGridWindow::UpdateCursorOverlay()
false);
xOverlayManager->add(*pOverlay);
- mpOOCursors = new ::sdr::overlay::OverlayObjectList;
+ mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
mpOOCursors->append(*pOverlay);
}
}
@@ -5902,7 +5902,7 @@ void ScGridWindow::UpdateCursorOverlay()
void ScGridWindow::DeleteSelectionOverlay()
{
- DELETEZ( mpOOSelection );
+ mpOOSelection.reset();
}
void ScGridWindow::UpdateSelectionOverlay()
@@ -5957,7 +5957,7 @@ void ScGridWindow::UpdateSelectionOverlay()
true);
xOverlayManager->add(*pOverlay);
- mpOOSelection = new ::sdr::overlay::OverlayObjectList;
+ mpOOSelection.reset(new sdr::overlay::OverlayObjectList);
mpOOSelection->append(*pOverlay);
}
}
@@ -5968,7 +5968,7 @@ void ScGridWindow::UpdateSelectionOverlay()
void ScGridWindow::DeleteAutoFillOverlay()
{
- DELETEZ( mpOOAutoFill );
+ mpOOAutoFill.reset();
mpAutoFillRect.reset();
}
@@ -6045,7 +6045,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
false);
xOverlayManager->add(*pOverlay);
- mpOOAutoFill = new ::sdr::overlay::OverlayObjectList;
+ mpOOAutoFill.reset(new sdr::overlay::OverlayObjectList);
mpOOAutoFill->append(*pOverlay);
}
@@ -6056,7 +6056,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
void ScGridWindow::DeleteDragRectOverlay()
{
- DELETEZ( mpOODragRect );
+ mpOODragRect.reset();
}
void ScGridWindow::UpdateDragRectOverlay()
@@ -6173,7 +6173,7 @@ void ScGridWindow::UpdateDragRectOverlay()
false);
xOverlayManager->add(*pOverlay);
- mpOODragRect = new ::sdr::overlay::OverlayObjectList;
+ mpOODragRect.reset(new sdr::overlay::OverlayObjectList);
mpOODragRect->append(*pOverlay);
}
}
@@ -6184,7 +6184,7 @@ void ScGridWindow::UpdateDragRectOverlay()
void ScGridWindow::DeleteHeaderOverlay()
{
- DELETEZ( mpOOHeader );
+ mpOOHeader.reset();
}
void ScGridWindow::UpdateHeaderOverlay()
@@ -6219,7 +6219,7 @@ void ScGridWindow::UpdateHeaderOverlay()
false);
xOverlayManager->add(*pOverlay);
- mpOOHeader = new ::sdr::overlay::OverlayObjectList;
+ mpOOHeader.reset(new sdr::overlay::OverlayObjectList);
mpOOHeader->append(*pOverlay);
}
}
@@ -6230,7 +6230,7 @@ void ScGridWindow::UpdateHeaderOverlay()
void ScGridWindow::DeleteShrinkOverlay()
{
- DELETEZ( mpOOShrink );
+ mpOOShrink.reset();
}
void ScGridWindow::UpdateShrinkOverlay()
@@ -6286,7 +6286,7 @@ void ScGridWindow::UpdateShrinkOverlay()
false);
xOverlayManager->add(*pOverlay);
- mpOOShrink = new ::sdr::overlay::OverlayObjectList;
+ mpOOShrink.reset(new sdr::overlay::OverlayObjectList);
mpOOShrink->append(*pOverlay);
}
}
commit 7ba4405fca7ce0fa8f0d807375a162a344428294
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 18:13:36 2015 +0900
ScGridWindow: scoped_ptr -> unique_ptr
Change-Id: I6a888b58668ccb64c5a9c3270d06c3b9bcf8ce64
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 395c204..fa0d2c0 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -28,7 +28,6 @@
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <boost/scoped_ptr.hpp>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
@@ -105,7 +104,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
::sdr::overlay::OverlayObjectList* mpOOHeader;
::sdr::overlay::OverlayObjectList* mpOOShrink;
- boost::scoped_ptr<Rectangle> mpAutoFillRect;
+ std::unique_ptr<Rectangle> mpAutoFillRect;
struct MouseEventState;
@@ -128,7 +127,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
VisibleRange maVisibleRange;
- boost::scoped_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
+ std::unique_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
ScViewData* pViewData;
ScSplitPos eWhich;
@@ -139,9 +138,9 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
std::unique_ptr<ScFilterListBox> mpFilterBox;
std::unique_ptr<FloatingWindow> mpFilterFloat;
- boost::scoped_ptr<ScCheckListMenuWindow> mpAutoFilterPopup;
- boost::scoped_ptr<ScCheckListMenuWindow> mpDPFieldPopup;
- boost::scoped_ptr<ScDPFieldButton> mpFilterButton;
+ std::unique_ptr<ScCheckListMenuWindow> mpAutoFilterPopup;
+ std::unique_ptr<ScCheckListMenuWindow> mpDPFieldPopup;
+ std::unique_ptr<ScDPFieldButton> mpFilterButton;
sal_uInt16 nCursorHideCount;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2e75e69..a88333b 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -135,7 +135,6 @@
#include <svx/sdr/overlay/overlayselection.hxx>
#include <vector>
-#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
using namespace css;
@@ -443,9 +442,9 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
pNoteMarker( NULL ),
mpFilterBox(),
mpFilterFloat(),
- mpAutoFilterPopup(NULL),
- mpDPFieldPopup(NULL),
- mpFilterButton(NULL),
+ mpAutoFilterPopup(),
+ mpDPFieldPopup(),
+ mpFilterButton(),
nCursorHideCount( 0 ),
nButtonDown( 0 ),
nMouseStatus( SC_GM_NONE ),
@@ -1264,7 +1263,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
const ScValidationData* pData = pDoc->GetValidationEntry( nIndex );
if (pData)
{
- boost::scoped_ptr<ScTypedStrData> pNew;
+ std::unique_ptr<ScTypedStrData> pNew;
OUString aDocStr = pDoc->GetString(nCol, nRow, nTab);
if ( pDoc->HasValueData( nCol, nRow, nTab ) )
{
@@ -5264,7 +5263,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
aPaperSize.Width() = nThisColLogic;
pEngine->SetPaperSize( aPaperSize );
- boost::scoped_ptr<EditTextObject> pTextObj;
+ std::unique_ptr<EditTextObject> pTextObj;
if (aCell.meType == CELLTYPE_EDIT)
{
if (aCell.mpEditText)
@@ -5507,7 +5506,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
while (pCell && nCol < mpSpellCheckCxt->maPos.mnCol)
pCell = aIter.GetNext(nCol, nRow);
- boost::scoped_ptr<ScTabEditEngine> pEngine;
+ std::unique_ptr<ScTabEditEngine> pEngine;
// Check only up to 256 cells at a time.
size_t nTotalCellCount = 0;
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index b98dadb..4a66bbf 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -48,7 +48,6 @@
#include <unordered_map>
#include <vector>
-#include <boost/scoped_ptr.hpp>
using namespace css;
using namespace css::sheet;
@@ -209,8 +208,9 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent&
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- boost::scoped_ptr<AbstractScPivotFilterDlg> pDlg(pFact->CreateScPivotFilterDlg(
- pViewData->GetViewShell()->GetDialogParent(), aArgSet, nSrcTab));
+ const std::unique_ptr<AbstractScPivotFilterDlg> pDlg(
+ pFact->CreateScPivotFilterDlg(
+ pViewData->GetViewShell()->GetDialogParent(), aArgSet, nSrcTab));
OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK )
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index c291370..dc747e6 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -66,8 +66,6 @@
#include <vcl/virdev.hxx>
#include <svx/sdrpaintwindow.hxx>
-#include <boost/scoped_ptr.hpp>
-
static void lcl_LimitRect( Rectangle& rRect, const Rectangle& rVisible )
{
if ( rRect.Top() < rVisible.Top()-1 ) rRect.Top() = rVisible.Top()-1;
@@ -484,7 +482,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL
aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
- boost::scoped_ptr< VirtualDevice > xFmtVirtDev;
+ std::unique_ptr<VirtualDevice> xFmtVirtDev;
bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode?
if ( bTextWysiwyg )
@@ -1011,7 +1009,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
}
vcl::Font aFont;
- boost::scoped_ptr<ScEditEngineDefaulter> pEditEng;
+ std::unique_ptr<ScEditEngineDefaulter> pEditEng;
const ScPatternAttr& rDefPattern = static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN));
if ( nPageScript == SCRIPTTYPE_LATIN )
{
@@ -1203,7 +1201,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
SCSIZE nQuery;
SCTAB nTab = pViewData->GetTabNo();
ScDBData* pDBData = NULL;
- boost::scoped_ptr<ScQueryParam> pQueryParam;
+ std::unique_ptr<ScQueryParam> pQueryParam;
RowInfo* pRowInfo = rTabInfo.mpRowInfo;
sal_uInt16 nArrCount = rTabInfo.mnArrCount;
commit e5f93bc97e39e7ff33dcf573186c8c6b4a4d587b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 15:51:21 2015 +0900
put local functions into anonymous namespace
Change-Id: Ia076670e7356c378c6e8feb5970033638d2ba0b7
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 7905ff4..5f30db4 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -162,8 +162,10 @@ void ScCornerButton::MouseButtonDown( const MouseEvent& rMEvt )
pViewSh->SelectAll( bControl );
}
}
+namespace
+{
-static bool lcl_HasColOutline( const ScViewData& rViewData )
+bool lcl_HasColOutline( const ScViewData& rViewData )
{
const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
if (pTable)
@@ -175,7 +177,7 @@ static bool lcl_HasColOutline( const ScViewData& rViewData )
return false;
}
-static bool lcl_HasRowOutline( const ScViewData& rViewData )
+bool lcl_HasRowOutline( const ScViewData& rViewData )
{
const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
if (pTable)
@@ -187,6 +189,8 @@ static bool lcl_HasRowOutline( const ScViewData& rViewData )
return false;
}
+} // anonymous namespace
+
ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
pFrameWin( pParent ),
aViewData( &rDocSh, pViewShell ),
commit 21087baf1c9dae5e7e970f22d351d771210175b0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 15:49:37 2015 +0900
GridWindow: use unique_ptr for filter box and float
Change-Id: Iaf203682e6d3b18d8b25c6ee2755710615fe5f08
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 56498ab..395c204 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -137,8 +137,8 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
ScNoteMarker* pNoteMarker;
- ScFilterListBox* pFilterBox;
- FloatingWindow* pFilterFloat;
+ std::unique_ptr<ScFilterListBox> mpFilterBox;
+ std::unique_ptr<FloatingWindow> mpFilterFloat;
boost::scoped_ptr<ScCheckListMenuWindow> mpAutoFilterPopup;
boost::scoped_ptr<ScCheckListMenuWindow> mpDPFieldPopup;
boost::scoped_ptr<ScDPFieldButton> mpFilterButton;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4f36aac..2e75e69 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -441,8 +441,8 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
pViewData( pData ),
eWhich( eWhichPos ),
pNoteMarker( NULL ),
- pFilterBox( NULL ),
- pFilterFloat( NULL ),
+ mpFilterBox(),
+ mpFilterFloat(),
mpAutoFilterPopup(NULL),
mpDPFieldPopup(NULL),
mpFilterButton(NULL),
@@ -523,8 +523,6 @@ ScGridWindow::~ScGridWindow()
// #114409#
ImpDestroyOverlayObjects();
- delete pFilterBox;
- delete pFilterFloat;
delete pNoteMarker;
}
@@ -535,13 +533,12 @@ void ScGridWindow::ClickExtern()
// #i81298# don't delete the filter box when called from its select handler
// (possible through row header size update)
// #i84277# when initializing the filter box, a Basic error can deactivate the view
- if ( pFilterBox && ( pFilterBox->IsInSelect() || pFilterBox->IsInInit() ) )
+ if (mpFilterBox && (mpFilterBox->IsInSelect() || mpFilterBox->IsInInit()))
{
break;
}
-
- DELETEZ(pFilterBox);
- DELETEZ(pFilterFloat);
+ mpFilterBox.reset();
+ mpFilterFloat.reset();
}
while (false);
@@ -554,8 +551,8 @@ void ScGridWindow::ClickExtern()
IMPL_LINK_NOARG(ScGridWindow, PopupModeEndHdl)
{
- if (pFilterBox)
- pFilterBox->SetCancelled(); // nicht mehr auswaehlen
+ if (mpFilterBox)
+ mpFilterBox->SetCancelled(); // nicht mehr auswaehlen
GrabFocus();
return 0;
}
@@ -938,8 +935,8 @@ void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow )
void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
{
- delete pFilterBox;
- delete pFilterFloat;
+ mpFilterBox.reset();
+ mpFilterFloat.reset();
SCCOL nCol = rScenRange.aEnd.Col(); // Zelle unterhalb des Buttons
SCROW nRow = rScenRange.aStart.Row();
@@ -969,17 +966,19 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
// Die ListBox direkt unter der schwarzen Linie auf dem Zellgitter
// (wenn die Linie verdeckt wird, sieht es komisch aus...)
- pFilterFloat = new ScFilterFloatingWindow( this, WinBits(WB_BORDER) ); // nicht resizable etc.
- pFilterFloat->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) );
- pFilterBox = new ScFilterListBox( pFilterFloat, this, nCol, nRow, SC_FILTERBOX_SCENARIO );
- if ( bLayoutRTL )
- pFilterBox->EnableMirroring();
+ mpFilterFloat.reset(new ScFilterFloatingWindow(this, WinBits(WB_BORDER)));
+ mpFilterFloat->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) );
+ mpFilterBox.reset(new ScFilterListBox(mpFilterFloat.get(), this, nCol, nRow, SC_FILTERBOX_SCENARIO));
+ if (bLayoutRTL)
+ mpFilterBox->EnableMirroring();
nSizeX += 1;
{
- vcl::Font aOldFont = GetFont(); SetFont( pFilterBox->GetFont() );
- MapMode aOldMode = GetMapMode(); SetMapMode( MAP_PIXEL );
+ vcl::Font aOldFont = GetFont();
+ SetFont(mpFilterBox->GetFont());
+ MapMode aOldMode = GetMapMode();
+ SetMapMode( MAP_PIXEL );
nHeight = GetTextHeight();
nHeight *= SC_FILTERLISTBOX_LINES;
@@ -992,9 +991,9 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
// ParentSize Abfrage fehlt
Size aSize( nSizeX, nHeight );
- pFilterBox->SetSizePixel( aSize );
- pFilterBox->Show(); // Show muss vor SetUpdateMode kommen !!!
- pFilterBox->SetUpdateMode(false);
+ mpFilterBox->SetSizePixel( aSize );
+ mpFilterBox->Show(); // Show muss vor SetUpdateMode kommen !!!
+ mpFilterBox->SetUpdateMode(false);
// SetOutputSizePixel/StartPopupMode erst unten, wenn die Groesse feststeht
@@ -1010,10 +1009,10 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
if (pDoc->HasScenarioRange( i, rScenRange ))
if (pDoc->GetName( i, aTabName ))
{
- pFilterBox->InsertEntry( aTabName );
+ mpFilterBox->InsertEntry(aTabName);
if (pDoc->IsActiveScenario(i))
aCurrent = aTabName;
- long nTextWidth = pFilterBox->GetTextWidth( aTabName );
+ long nTextWidth = mpFilterBox->GetTextWidth(aTabName);
if ( nTextWidth > nMaxText )
nMaxText = nTextWidth;
++nEntryCount;
@@ -1029,8 +1028,8 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
{
long nDiff = nMaxText - nSizeX;
aSize = Size( nMaxText, nHeight );
- pFilterBox->SetSizePixel( aSize );
- pFilterFloat->SetOutputSizePixel( aSize );
+ mpFilterBox->SetSizePixel(aSize);
+ mpFilterFloat->SetOutputSizePixel(aSize);
if ( !bLayoutRTL )
{
@@ -1042,23 +1041,26 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
}
}
- pFilterFloat->SetOutputSizePixel( aSize );
- pFilterFloat->StartPopupMode( aCellRect, FLOATWIN_POPUPMODE_DOWN|FLOATWIN_POPUPMODE_GRABFOCUS );
+ mpFilterFloat->SetOutputSizePixel( aSize );
+ mpFilterFloat->StartPopupMode( aCellRect, FLOATWIN_POPUPMODE_DOWN|FLOATWIN_POPUPMODE_GRABFOCUS );
- pFilterBox->SetUpdateMode(true);
- pFilterBox->GrabFocus();
+ mpFilterBox->SetUpdateMode(true);
+ mpFilterBox->GrabFocus();
sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND;
if (!aCurrent.isEmpty())
{
- nPos = pFilterBox->GetEntryPos(aCurrent);
+ nPos = mpFilterBox->GetEntryPos(aCurrent);
}
- if (LISTBOX_ENTRY_NOTFOUND == nPos && pFilterBox->GetEntryCount() > 0 )
+ if (LISTBOX_ENTRY_NOTFOUND == nPos && mpFilterBox->GetEntryCount() > 0 )
+ {
nPos = 0;
+ }
if (LISTBOX_ENTRY_NOTFOUND != nPos )
- pFilterBox->SelectEntryPos(nPos);
-
- pFilterBox->EndInit();
+ {
+ mpFilterBox->SelectEntryPos(nPos);
+ }
+ mpFilterBox->EndInit();
// Szenario-Auswahl kommt aus MouseButtonDown:
// der naechste MouseMove auf die Filterbox ist wie ein ButtonDown
@@ -1069,8 +1071,8 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelect )
{
- delete pFilterBox;
- delete pFilterFloat;
+ mpFilterBox.reset();
+ mpFilterFloat.reset();
sal_uInt16 i;
ScDocument* pDoc = pViewData->GetDocument();
@@ -1090,19 +1092,21 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
aPos.X() -= 1;
aPos.Y() += nSizeY - 1;
- pFilterFloat = new ScFilterFloatingWindow( this, WinBits(WB_BORDER) ); // nicht resizable etc.
- pFilterFloat->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) );
- pFilterBox = new ScFilterListBox(
- pFilterFloat, this, nCol, nRow, bDataSelect ? SC_FILTERBOX_DATASELECT : SC_FILTERBOX_FILTER );
+ mpFilterFloat.reset(new ScFilterFloatingWindow(this, WinBits(WB_BORDER)));
+ mpFilterFloat->SetPopupModeEndHdl(LINK( this, ScGridWindow, PopupModeEndHdl));
+ ScFilterBoxMode eFilterMode = bDataSelect ? SC_FILTERBOX_DATASELECT : SC_FILTERBOX_FILTER;
+ mpFilterBox.reset(new ScFilterListBox(mpFilterFloat.get(), this, nCol, nRow, eFilterMode));
// Fix for bug fdo#44925
if (Application::GetSettings().GetLayoutRTL() != bLayoutRTL)
- pFilterBox->EnableMirroring();
+ mpFilterBox->EnableMirroring();
nSizeX += 1;
{
- vcl::Font aOldFont = GetFont(); SetFont( pFilterBox->GetFont() );
- MapMode aOldMode = GetMapMode(); SetMapMode( MAP_PIXEL );
+ vcl::Font aOldFont = GetFont();
+ SetFont(mpFilterBox->GetFont());
+ MapMode aOldMode = GetMapMode();
+ SetMapMode(MAP_PIXEL);
nHeight = GetTextHeight();
nHeight *= SC_FILTERLISTBOX_LINES;
@@ -1126,7 +1130,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
{
//! wird der Titel ueberhaupt ausgewertet ???
OUString aString = pDoc->GetString(nCol, nRow, nTab);
- pFilterBox->SetText( aString );
+ mpFilterBox->SetText(aString);
long nMaxText = 0;
@@ -1136,17 +1140,17 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
for (i=0; i<nDefCount; i++)
{
OUString aEntry( static_cast<ScResId>(nDefIDs[i]) );
- pFilterBox->InsertEntry( aEntry );
- long nTextWidth = pFilterBox->GetTextWidth( aEntry );
+ mpFilterBox->InsertEntry(aEntry);
+ long nTextWidth = mpFilterBox->GetTextWidth(aEntry);
if ( nTextWidth > nMaxText )
nMaxText = nTextWidth;
}
- pFilterBox->SetSeparatorPos( nDefCount - 1 );
+ mpFilterBox->SetSeparatorPos(nDefCount - 1);
// get list entries
bool bHasDates = false;
pDoc->GetFilterEntries( nCol, nRow, nTab, true, aStrings, bHasDates);
- pFilterBox->SetListHasDates(bHasDates);
+ mpFilterBox->SetListHasDates(bHasDates);
// check widths of numerical entries (string entries are not included)
// so all numbers are completely visible
@@ -1155,7 +1159,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
{
if (!it->IsStrData()) // only numerical entries
{
- long nTextWidth = pFilterBox->GetTextWidth(it->GetString());
+ long nTextWidth = mpFilterBox->GetTextWidth(it->GetString());
if ( nTextWidth > nMaxText )
nMaxText = nTextWidth;
}
@@ -1185,12 +1189,12 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
if ( aPos.Y() + aSize.Height() > aParentSize.Height() )
aPos.Y() = aParentSize.Height() - aSize.Height();
- pFilterBox->SetSizePixel( aSize );
- pFilterBox->Show(); // Show muss vor SetUpdateMode kommen !!!
- pFilterBox->SetUpdateMode(false);
+ mpFilterBox->SetSizePixel(aSize);
+ mpFilterBox->Show(); // Show muss vor SetUpdateMode kommen !!!
+ mpFilterBox->SetUpdateMode(false);
- pFilterFloat->SetOutputSizePixel( aSize );
- pFilterFloat->StartPopupMode( aCellRect, FLOATWIN_POPUPMODE_DOWN|FLOATWIN_POPUPMODE_GRABFOCUS);
+ mpFilterFloat->SetOutputSizePixel(aSize);
+ mpFilterFloat->StartPopupMode(aCellRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS);
// Listbox fuellen
bool bWait = aStrings.size() > 100;
@@ -1200,12 +1204,12 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
std::vector<ScTypedStrData>::const_iterator it = aStrings.begin(), itEnd = aStrings.end();
for (; it != itEnd; ++it)
- pFilterBox->InsertEntry(it->GetString());
+ mpFilterBox->InsertEntry(it->GetString());
if (bWait)
LeaveWait();
- pFilterBox->SetUpdateMode(true);
+ mpFilterBox->SetUpdateMode(true);
}
sal_Int32 nSelPos = LISTBOX_ENTRY_NOTFOUND;
@@ -1236,7 +1240,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
{
if (!aQueryStr.isEmpty())
{
- nSelPos = pFilterBox->GetEntryPos(aQueryStr);
+ nSelPos = mpFilterBox->GetEntryPos(aQueryStr);
}
}
else if ( rEntry.eOp == SC_TOPVAL && aQueryStr == "10" )
@@ -1296,30 +1300,30 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
}
// neu (309): irgendwas muss immer selektiert sein:
- if ( LISTBOX_ENTRY_NOTFOUND == nSelPos && pFilterBox->GetEntryCount() > 0 && !bDataSelect)
+ if (LISTBOX_ENTRY_NOTFOUND == nSelPos && mpFilterBox->GetEntryCount() > 0 && !bDataSelect)
nSelPos = 0;
// keine leere Auswahl-Liste anzeigen:
if ( bEmpty )
{
- DELETEZ(pFilterBox); // war nix
- DELETEZ(pFilterFloat);
+ mpFilterBox.reset();
+ mpFilterFloat.reset();
}
else
{
- pFilterBox->GrabFocus();
+ mpFilterBox->GrabFocus();
// Select erst nach GrabFocus, damit das Focus-Rechteck richtig landet
if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
- pFilterBox->SelectEntryPos( nSelPos );
+ mpFilterBox->SelectEntryPos(nSelPos);
else
{
if (bDataSelect)
- pFilterBox->SetNoSelection();
+ mpFilterBox->SetNoSelection();
}
- pFilterBox->EndInit();
+ mpFilterBox->EndInit();
if (!bDataSelect)
{
@@ -1334,20 +1338,20 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
void ScGridWindow::FilterSelect( sal_uLong nSel )
{
- OUString aString = pFilterBox->GetEntry( static_cast< sal_Int32 >( nSel ) );
+ OUString aString = mpFilterBox->GetEntry(static_cast<sal_Int32>(nSel));
- SCCOL nCol = pFilterBox->GetCol();
- SCROW nRow = pFilterBox->GetRow();
- switch ( pFilterBox->GetMode() )
+ SCCOL nCol = mpFilterBox->GetCol();
+ SCROW nRow = mpFilterBox->GetRow();
+ switch (mpFilterBox->GetMode())
{
case SC_FILTERBOX_DATASELECT:
- ExecDataSelect( nCol, nRow, aString );
+ ExecDataSelect(nCol, nRow, aString);
break;
case SC_FILTERBOX_FILTER:
- ExecFilter( nSel, nCol, nRow, aString, pFilterBox->HasDates() );
+ ExecFilter(nSel, nCol, nRow, aString, mpFilterBox->HasDates());
break;
case SC_FILTERBOX_SCENARIO:
- pViewData->GetView()->UseScenario( aString );
+ pViewData->GetView()->UseScenario(aString);
break;
case SC_FILTERBOX_PAGEFIELD:
// first entry is "all"
@@ -1355,8 +1359,8 @@ void ScGridWindow::FilterSelect( sal_uLong nSel )
break;
}
- if (pFilterFloat)
- pFilterFloat->EndPopupMode();
+ if (mpFilterFloat)
+ mpFilterFloat->EndPopupMode();
GrabFocus(); // unter OS/2 stimmt der Focus sonst nicht
}
@@ -2485,15 +2489,15 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
return;
}
- if (nMouseStatus == SC_GM_FILTER && pFilterBox)
+ if (nMouseStatus == SC_GM_FILTER && mpFilterBox)
{
- Point aRelPos = pFilterBox->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) );
- if ( Rectangle(Point(),pFilterBox->GetOutputSizePixel()).IsInside(aRelPos) )
+ Point aRelPos = mpFilterBox->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) );
+ if ( Rectangle(Point(), mpFilterBox->GetOutputSizePixel()).IsInside(aRelPos) )
{
nButtonDown = 0;
nMouseStatus = SC_GM_NONE;
ReleaseMouse();
- pFilterBox->MouseButtonDown( MouseEvent( aRelPos, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT ) );
+ mpFilterBox->MouseButtonDown( MouseEvent( aRelPos, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT ) );
return;
}
}
@@ -2780,7 +2784,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt )
void ScGridWindow::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel )
{
- if ( pFilterBox || nPagebreakMouse )
+ if (mpFilterBox || nPagebreakMouse)
return;
HideNoteMarker();
commit 6a2f0cecd249f672e74c3b08653ff56891c24071
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 15:35:25 2015 +0900
clean-up ScGridWindow
Change-Id: I006b17efd78334c71c0dddbeb6f906cb955a3f39
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 298162f..4f36aac 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -138,9 +138,8 @@
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
-using namespace com::sun::star;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Any;
+using namespace css;
+using namespace css::uno;
const sal_uInt8 SC_NESTEDBUTTON_NONE = 0;
const sal_uInt8 SC_NESTEDBUTTON_DOWN = 1;
@@ -149,8 +148,8 @@ const sal_uInt8 SC_NESTEDBUTTON_UP = 2;
#define SC_AUTOFILTER_ALL 0
#define SC_AUTOFILTER_TOP10 1
#define SC_AUTOFILTER_CUSTOM 2
-#define SC_AUTOFILTER_EMPTY 3
-#define SC_AUTOFILTER_NOTEMPTY 4
+#define SC_AUTOFILTER_EMPTY 3
+#define SC_AUTOFILTER_NOTEMPTY 4
// Modi fuer die FilterListBox
enum ScFilterBoxMode
@@ -169,13 +168,18 @@ struct ScGridWindow::MouseEventState
{
bool mbActivatePart;
- MouseEventState() : mbActivatePart(false) {}
+ MouseEventState() :
+ mbActivatePart(false)
+ {}
};
#define SC_FILTERLISTBOX_LINES 12
-ScGridWindow::VisibleRange::VisibleRange() :
- mnCol1(0), mnCol2(MAXCOL), mnRow1(0), mnRow2(MAXROW)
+ScGridWindow::VisibleRange::VisibleRange()
+ : mnCol1(0)
+ , mnCol2(MAXCOL)
+ , mnRow1(0)
+ , mnRow2(MAXROW)
{
}
@@ -2641,25 +2645,25 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
return;
}
-static void lcl_InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent, const MouseEvent& rEvt )
+static void lcl_InitMouseEvent(css::awt::MouseEvent& rEvent, const MouseEvent& rEvt)
{
rEvent.Modifiers = 0;
if ( rEvt.IsShift() )
- rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ rEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
if ( rEvt.IsMod1() )
- rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ rEvent.Modifiers |= css::awt::KeyModifier::MOD1;
if ( rEvt.IsMod2() )
- rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+ rEvent.Modifiers |= css::awt::KeyModifier::MOD2;
if ( rEvt.IsMod3() )
- rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD3;
+ rEvent.Modifiers |= css::awt::KeyModifier::MOD3;
rEvent.Buttons = 0;
if ( rEvt.IsLeft() )
- rEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
+ rEvent.Buttons |= css::awt::MouseButton::LEFT;
if ( rEvt.IsRight() )
- rEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
+ rEvent.Buttons |= css::awt::MouseButton::RIGHT;
if ( rEvt.IsMiddle() )
- rEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
+ rEvent.Buttons |= css::awt::MouseButton::MIDDLE;
rEvent.X = rEvt.GetPosPixel().X();
rEvent.Y = rEvt.GetPosPixel().Y();
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 5b43442..b98dadb 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -50,17 +50,16 @@
#include <vector>
#include <boost/scoped_ptr.hpp>
-using namespace com::sun::star;
-using ::com::sun::star::sheet::DataPilotFieldOrientation;
-using ::std::vector;
-using ::std::unique_ptr;
+using namespace css;
+using namespace css::sheet;
+using css::sheet::DataPilotFieldOrientation;
+using std::vector;
+using std::unique_ptr;
// STATIC DATA -----------------------------------------------------------
DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const
{
- using namespace ::com::sun::star::sheet;
-
ScDocument* pDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab);
@@ -83,7 +82,7 @@ DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW
}
}
- nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
+ nOrient = DataPilotFieldOrientation_HIDDEN;
// Now, check for row/column field.
long nField = pDPObj->GetHeaderDim(ScAddress(nCol, nRow, nTab), nOrient);
@@ -101,7 +100,7 @@ DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW
// private method for mouse button handling
bool ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow )
{
- if (GetDPFieldOrientation( nCol, nRow ) == sheet::DataPilotFieldOrientation_PAGE)
+ if (GetDPFieldOrientation( nCol, nRow ) == DataPilotFieldOrientation_PAGE)
{
LaunchPageFieldMenu( nCol, nRow );
return true;
@@ -162,7 +161,7 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent&
if (pDPObj)
{
- sal_uInt16 nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
+ sal_uInt16 nOrient = DataPilotFieldOrientation_HIDDEN;
ScAddress aPos( nCol, nRow, nTab );
ScAddress aDimPos = aPos;
if (!bButton && bPopup && aDimPos.Col() > 0)
@@ -300,20 +299,20 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove )
else if ( bHasRange )
switch (nOrient)
{
- case sheet::DataPilotFieldOrientation_COLUMN: ePointer = POINTER_PIVOT_COL; break;
- case sheet::DataPilotFieldOrientation_ROW: ePointer = POINTER_PIVOT_ROW; break;
- case sheet::DataPilotFieldOrientation_PAGE:
- case sheet::DataPilotFieldOrientation_DATA: ePointer = POINTER_PIVOT_FIELD; break;
+ case DataPilotFieldOrientation_COLUMN: ePointer = POINTER_PIVOT_COL; break;
+ case DataPilotFieldOrientation_ROW: ePointer = POINTER_PIVOT_ROW; break;
+ case DataPilotFieldOrientation_PAGE:
+ case DataPilotFieldOrientation_DATA: ePointer = POINTER_PIVOT_FIELD; break;
}
SetPointer( ePointer );
}
else // execute change
{
if (!bHasRange)
- nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
+ nOrient = DataPilotFieldOrientation_HIDDEN;
- if ( bIsDataLayout && ( nOrient != sheet::DataPilotFieldOrientation_COLUMN &&
- nOrient != sheet::DataPilotFieldOrientation_ROW ) )
+ if ( bIsDataLayout && ( nOrient != DataPilotFieldOrientation_COLUMN &&
+ nOrient != DataPilotFieldOrientation_ROW ) )
{
// removing data layout is not allowed
pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED);
@@ -477,7 +476,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(
mpDPFieldPopup->initMembers();
}
- if (pDim->GetOrientation() != sheet::DataPilotFieldOrientation_PAGE)
+ if (pDim->GetOrientation() != DataPilotFieldOrientation_PAGE)
{
vector<OUString> aUserSortNames;
ScUserList* pUserList = ScGlobal::GetUserList();
commit 9364aee03b195422367026979940135429b40ffa
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 15:12:37 2015 +0900
translate some comments
Change-Id: Ia050a9a0fe5219964ba4d1460260e07fc4ab4fbb
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 47a4825..298162f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -161,9 +161,9 @@ enum ScFilterBoxMode
SC_FILTERBOX_PAGEFIELD
};
-extern SfxViewShell* pScActiveViewShell; // global.cxx
-extern sal_uInt16 nScClickMouseModifier; // global.cxx
-extern sal_uInt16 nScFillModeMouseModifier; // global.cxx
+extern SfxViewShell* pScActiveViewShell; // global.cxx
+extern sal_uInt16 nScClickMouseModifier; // global.cxx
+extern sal_uInt16 nScFillModeMouseModifier; // global.cxx
struct ScGridWindow::MouseEventState
{
@@ -281,17 +281,17 @@ bool ScFilterListBox::PreNotify( NotifyEvent& rNEvt )
{
KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
vcl::KeyCode aCode = aKeyEvt.GetKeyCode();
- if ( !aCode.GetModifier() ) // ohne alle Modifiers
+ if ( !aCode.GetModifier() ) // no modifiers
{
sal_uInt16 nKey = aCode.GetCode();
if ( nKey == KEY_RETURN )
{
- SelectHdl(); // auswaehlen
+ SelectHdl(); // select
nDone = true;
}
else if ( nKey == KEY_ESCAPE )
{
- pGridWin->ClickExtern(); // loescht die List-Box !!!
+ pGridWin->ClickExtern(); // clears the listbox
nDone = true;
}
}
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index e9ac6ca..9b87a7b 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -64,8 +64,7 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt)
}
}
- // bei rechter Taste Draw-Aktion abbrechen
-
+ // cancel draw with right key
ScDrawView* pDrView = pViewData->GetScDrawView();
if ( pDrView && !rMEvt.IsLeft() && !bRet )
{
@@ -97,7 +96,7 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt)
}
if ( !pView->IsPaintBrushLocked() )
- pView->ResetBrushDocument(); // end paint brush mode if not locked
+ pView->ResetBrushDocument(); // end paint brush mode if not locked
}
}
@@ -144,7 +143,7 @@ bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt)
pDraw->SetWindow( this );
sal_uInt8 nUsed = pDraw->Command( rCEvt );
if( nUsed == SC_CMD_USED )
- nButtonDown = 0; // MouseButtonUp wird verschluckt...
+ nButtonDown = 0; // MouseButtonUp wird verschluckt...
if( nUsed || pDrView->IsAction() )
return true;
}
@@ -172,12 +171,12 @@ bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt)
bLeaveDraw = true;
if ( !bOldMarked &&
rKEvt.GetKeyCode().GetCode() == KEY_DELETE )
- bUsed = false; // nichts geloescht
+ bUsed = false; // nothing deleted
if(bOldMarked)
GetFocus();
}
if (!bLeaveDraw)
- UpdateStatusPosSize(); // for moving/resizing etc. by keyboard
+ UpdateStatusPosSize(); // for moving/resizing etc. by keyboard
return bUsed;
}
}
@@ -220,13 +219,13 @@ void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sa
void ScGridWindow::DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev )
{
- // Draw-Gitterlinien
+ // Draw grid lines
ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
if ( pDrView && pDrView->IsGridVisible() )
{
SdrPageView* pPV = pDrView->GetSdrPageView();
- OSL_ENSURE(pPV, "keine PageView");
+ OSL_ENSURE(pPV, "PageView not available");
if (pPV)
{
pContentDev->SetLineColor(COL_GRAY);
@@ -280,14 +279,14 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
void ScGridWindow::DrawAfterScroll()
{
- Update(); // immer, damit das Verhalten mit/ohne DrawingLayer gleich ist
+ Update(); // always, so the the behaviour with and without DrawingLayer is the same
ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
if (pDrView)
{
OutlinerView* pOlView = pDrView->GetTextEditOutlinerView();
if (pOlView && pOlView->GetWindow() == this)
- pOlView->ShowCursor(false); // ist beim Scrollen weggekommen
+ pOlView->ShowCursor(false); // was removed at scrolling
}
}
@@ -324,11 +323,11 @@ void ScGridWindow::UpdateStatusPosSize()
{
ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
if (!pDrView)
- return; // shouldn't be called in that case
+ return; // shouldn't be called in that case
SdrPageView* pPV = pDrView->GetSdrPageView();
if (!pPV)
- return; // shouldn't be called in that case either
+ return; // shouldn't be called in that case either
SfxItemSet aSet(pViewData->GetViewShell()->GetPool(), SID_ATTR_POSITION, SID_ATTR_SIZE);
@@ -338,7 +337,7 @@ void ScGridWindow::UpdateStatusPosSize()
// mouse position otherwise
bool bActionItem = false;
- if ( pDrView->IsAction() ) // action rectangle
+ if ( pDrView->IsAction() ) // action rectangle
{
Rectangle aRect;
pDrView->TakeActionRect( aRect );
@@ -357,7 +356,7 @@ void ScGridWindow::UpdateStatusPosSize()
}
if ( !bActionItem )
{
- if ( pDrView->AreObjectsMarked() ) // selected objects
+ if ( pDrView->AreObjectsMarked() ) // selected objects
{
Rectangle aRect = pDrView->GetAllMarkedRect();
// mouse position will have been adjusted for offset
@@ -369,7 +368,7 @@ void ScGridWindow::UpdateStatusPosSize()
aSet.Put( SvxSizeItem( SID_ATTR_SIZE,
Size( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ) ) );
}
- else // mouse position
+ else // mouse position
{
Point aPos = PixelToLogic(aCurMousePos);
pPV->LogicToPagePos(aPos);
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 22d4171..c291370 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -373,13 +373,11 @@ void ScGridWindow::Paint( const Rectangle& rRect )
ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
}
- Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen
+ Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // don't continue with painting
bIsInPaint = false;
}
-// Draw ----------------------------------------------------------------
-
void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode )
{
ScDocShell* pDocSh = pViewData->GetDocShell();
@@ -401,13 +399,13 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
PutInOrder( nX1, nX2 );
PutInOrder( nY1, nY2 );
- OSL_ENSURE( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw Bereich zu gross" );
+ OSL_ENSURE( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw area too big" );
UpdateVisibleRange();
if (nX2 < maVisibleRange.mnCol1 || nY2 < maVisibleRange.mnRow1)
return;
- // unsichtbar
+ // invisible
if (nX1 < maVisibleRange.mnCol1)
nX1 = maVisibleRange.mnCol1;
if (nY1 < maVisibleRange.mnRow1)
@@ -422,11 +420,11 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
nY2 = maVisibleRange.mnRow2;
if ( eMode != SC_UPDATE_MARKS && nX2 < maVisibleRange.mnCol2)
- nX2 = maVisibleRange.mnCol2; // zum Weiterzeichnen
+ nX2 = maVisibleRange.mnCol2; // zum Weiterzeichnen
- // ab hier kein return mehr
+ // point of no return
- ++nPaintCount; // merken, dass gemalt wird (wichtig beim Invertieren)
+ ++nPaintCount; // mark that painting is in progress
SCTAB nTab = pViewData->GetTabNo();
rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab );
@@ -460,7 +458,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
SCROW nHdlY = aAutoMarkPos.Row();
rDoc.ExtendMerge( nHdlX, nHdlY, nHdlX, nHdlY, nTab );
bCurVis = ( nHdlX+1 >= nX1 && nHdlX <= nX2 && nHdlY+1 >= nY1 && nHdlY <= nY2 );
- // links und oben ist nicht betroffen
+ // left and top is unaffected
//! AutoFill-Anfasser alleine (ohne Cursor) zeichnen ???
}
@@ -470,7 +468,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
const ScViewOptions& rOpts = pViewData->GetOptions();
- // Datenblock
+ // data block
ScTableInfo aTabInfo;
rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
@@ -480,14 +478,14 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
Fraction aZoomX = pViewData->GetZoomX();
Fraction aZoomY = pViewData->GetZoomY();
ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
- nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
- &aZoomX, &aZoomY );
+ nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
+ &aZoomX, &aZoomY );
- aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL
+ aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL
aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
boost::scoped_ptr< VirtualDevice > xFmtVirtDev;
- bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode?
+ bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode?
if ( bTextWysiwyg )
{
@@ -506,7 +504,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
xFmtVirtDev->SetMapMode( MAP_100TH_MM );
aOutputData.SetFmtDevice( xFmtVirtDev.get() );
- bLogicText = true; // use logic MapMode
+ bLogicText = true; // use logic MapMode
}
DrawContent(*this, aTabInfo, aOutputData, bLogicText, eMode);
commit 2e293978d80c5113ea37f4c7f4b18ee01f2022e1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 15:54:16 2015 +0900
add option to disable animations, use in dashed border overlay
There are use cases when it is useful to disable animations (using
LO in remote display when the bandwidth is limited). This adds an
option that will allow to disable all animations. Currently only
animation when copying cells in Calc (dashed border overlay) uses
this option.
Change-Id: Ia8cd3783140428e921c3151c2f462d3862440edd
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d496c85..6b010d7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -866,6 +866,18 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="AnimationsEnabled" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Defines if the user interface animations (like "walking ant"
+ animation when copying a cell in Calc) is enabled or disabled.
+ Disabling animations makes a lot of sense on remote connections
+ (VNC), where animations increase the (always limited) amount of
+ bandwidth needed.
+ </desc>
+ <label>Defines if the user interface animations are disabled.</label>
+ </info>
+ <value>true</value>
+ </prop>
</group>
<group oor:name="InternalMSExport">
<info>
diff --git a/sc/source/ui/view/overlayobject.cxx b/sc/source/ui/view/overlayobject.cxx
index 778e44f..c494d59 100644
--- a/sc/source/ui/view/overlayobject.cxx
+++ b/sc/source/ui/view/overlayobject.cxx
@@ -27,6 +27,7 @@
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <officecfg/Office/Common.hxx>
using ::sdr::overlay::OverlayObject;
using ::sdr::overlay::OverlayManager;
@@ -38,7 +39,7 @@ ScOverlayDashedBorder::ScOverlayDashedBorder(const ::basegfx::B2DRange& rRange,
OverlayObject(rColor),
mbToggle(true)
{
- mbAllowsAnimation = true;
+ mbAllowsAnimation = officecfg::Office::Common::VCL::AnimationsEnabled::get();
maRange = rRange;
}
commit 422fdeccd88a89461271bd6d87774a4c5015ba60
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Mar 8 18:23:40 2015 +0900
tabbar: remove useless whitespace, rearrange constructor
Change-Id: Iee31413c1ded4fbda8227e88d09a1f917f18ca5d
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index e69f05e..2e071de 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -86,12 +86,6 @@ struct ImplTabBarItem
}
};
-
-
-
-// - ImplTabButton -
-
-
class ImplTabButton : public PushButton
{
bool mbModKey : 1;
@@ -228,14 +222,7 @@ void ImplTabSizer::Paint( const Rectangle& )
aDecoView.DrawHandle(aOutputRect, true);
}
-
-
// Is not named Impl. as it may be both instantiated and derived from
-
-
-// - TabBarEdit -
-
-
class TabBarEdit : public Edit
{
private:
@@ -257,16 +244,12 @@ public:
virtual void LoseFocus() SAL_OVERRIDE;
};
-
-
TabBarEdit::TabBarEdit( TabBar* pParent, WinBits nWinStyle ) :
Edit( pParent, nWinStyle )
{
mbPostEvt = false;
}
-
-
bool TabBarEdit::PreNotify( NotifyEvent& rNEvt )
{
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
@@ -298,8 +281,6 @@ bool TabBarEdit::PreNotify( NotifyEvent& rNEvt )
return Edit::PreNotify( rNEvt );
}
-
-
void TabBarEdit::LoseFocus()
{
if ( !mbPostEvt )
@@ -311,8 +292,6 @@ void TabBarEdit::LoseFocus()
Edit::LoseFocus();
}
-
-
IMPL_LINK( TabBarEdit, ImplEndEditHdl, void*, pCancel )
{
ResetPostEvent();
@@ -332,8 +311,6 @@ IMPL_LINK( TabBarEdit, ImplEndEditHdl, void*, pCancel )
return 0;
}
-
-
IMPL_LINK_NOARG(TabBarEdit, ImplEndTimerHdl)
{
if ( HasFocus() )
@@ -349,7 +326,6 @@ IMPL_LINK_NOARG(TabBarEdit, ImplEndTimerHdl)
return 0;
}
-
struct TabBar_Impl
{
std::unique_ptr<ImplTabSizer> mpSizer;
@@ -387,7 +363,17 @@ struct TabBar_Impl
}
};
+TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, (nWinStyle & WB_3DLOOK) | WB_CLIPCHILDREN )
+{
+ ImplInit( nWinStyle );
+ maCurrentItemList = 0;
+}
+TabBar::~TabBar()
+{
+ EndEditMode( true );
+}
const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max();
const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits<sal_uInt16>::max();
@@ -442,23 +428,6 @@ void TabBar::ImplInit( WinBits nWinStyle )
ImplInitSettings( true, true );
}
-
-
-TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
- Window( pParent, (nWinStyle & WB_3DLOOK) | WB_CLIPCHILDREN )
-{
- ImplInit( nWinStyle );
- maCurrentItemList = 0;
-}
-
-
-
-TabBar::~TabBar()
-{
- EndEditMode( true );
-}
-
-
ImplTabBarItem* TabBar::seek( size_t i )
{
if ( i < mpImpl->mpItemList.size() )
@@ -487,8 +456,6 @@ ImplTabBarItem* TabBar::next()
return NULL;
}
-
-
void TabBar::ImplInitSettings( bool bFont, bool bBackground )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
@@ -524,8 +491,6 @@ void TabBar::ImplInitSettings( bool bFont, bool bBackground )
}
}
-
-
void TabBar::ImplGetColors( Color& rFaceColor, Color& rFaceTextColor,
Color& rSelectColor, Color& rSelectTextColor )
{
@@ -558,8 +523,6 @@ void TabBar::ImplGetColors( Color& rFaceColor, Color& rFaceTextColor,
}
}
-
-
bool TabBar::ImplCalcWidth()
{
// Sizes should only be retrieved if the text or the font was changed
@@ -616,8 +579,6 @@ bool TabBar::ImplCalcWidth()
return bChanged;
}
-
-
void TabBar::ImplFormat()
{
ImplCalcWidth();
@@ -664,8 +625,6 @@ void TabBar::ImplFormat()
ImplEnableControls();
}
-
-
sal_uInt16 TabBar::ImplGetLastFirstPos()
{
sal_uInt16 nCount = mpImpl->getItemSize();
@@ -685,8 +644,6 @@ sal_uInt16 TabBar::ImplGetLastFirstPos()
return nLastFirstPos;
}
-
-
void TabBar::ImplInitControls()
{
if ( mnWinStyle & WB_SIZEABLE )
@@ -755,8 +712,6 @@ void TabBar::ImplInitControls()
mbHasInsertTab = (mnWinStyle & WB_INSERTTAB);
}
-
-
void TabBar::ImplEnableControls()
{
if ( mbSizeFormat || mbFormat )
@@ -844,8 +799,6 @@ IMPL_LINK( TabBar, ImplClickHdl, ImplTabButton*, pBtn )
return 0;
}
-
-
void TabBar::MouseMove( const MouseEvent& rMEvt )
{
if ( rMEvt.IsLeaveWindow() )
@@ -854,8 +807,6 @@ void TabBar::MouseMove( const MouseEvent& rMEvt )
Window::MouseMove( rMEvt );
}
-
-
void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
{
// Only terminate EditModus and do not execute click
@@ -1059,8 +1010,6 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
Window::MouseButtonDown( rMEvt );
}
-
-
void TabBar::MouseButtonUp( const MouseEvent& rMEvt )
{
mbInSelect = false;
@@ -1391,7 +1340,6 @@ void TabBar::Paint( const Rectangle& rect )
}
}
-
void TabBar::Resize()
{
Size aNewSize = GetOutputSizePixel();
@@ -1581,8 +1529,6 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
Window::RequestHelp( rHEvt );
}
-
-
void TabBar::StateChanged( StateChangedType nType )
{
Window::StateChanged( nType );
@@ -1623,8 +1569,6 @@ void TabBar::StateChanged( StateChangedType nType )
}
}
-
-
void TabBar::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
@@ -1639,8 +1583,6 @@ void TabBar::DataChanged( const DataChangedEvent& rDCEvt )
}
}
-
-
void TabBar::ImplSelect()
{
Select();
@@ -1648,28 +1590,20 @@ void TabBar::ImplSelect()
CallEventListeners( VCLEVENT_TABBAR_PAGESELECTED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(mnCurPageId)) );
}
-
-
void TabBar::Select()
{
maSelectHdl.Call( this );
}
-
-
void TabBar::DoubleClick()
{
}
-
-
void TabBar::Split()
{
maSplitHdl.Call( this );
}
-
-
void TabBar::ImplActivatePage()
{
ActivatePage();
@@ -1677,13 +1611,8 @@ void TabBar::ImplActivatePage()
CallEventListeners( VCLEVENT_TABBAR_PAGEACTIVATED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(mnCurPageId)) );
}
-
-
void TabBar::ActivatePage()
-{
-}
-
-
+{}
bool TabBar::ImplDeactivatePage()
{
@@ -1769,42 +1698,30 @@ Rectangle TabBar::ImplGetInsertTabRect(ImplTabBarItem* pItem) const
return Rectangle();
}
-
-
bool TabBar::DeactivatePage()
{
return true;
}
-
-
bool TabBar::StartRenaming()
{
return true;
}
-
-
TabBarAllowRenamingReturnCode TabBar::AllowRenaming()
{
return TABBAR_RENAMING_YES;
}
-
-
void TabBar::EndRenaming()
{
}
-
-
void TabBar::Mirror()
{
}
-
-
void TabBar::InsertPage( sal_uInt16 nPageId, const OUString& rText,
TabBarPageBits nBits, sal_uInt16 nPos )
{
@@ -1838,8 +1755,6 @@ void TabBar::InsertPage( sal_uInt16 nPageId, const OUString& rText,
CallEventListeners( VCLEVENT_TABBAR_PAGEINSERTED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(nPageId)) );
}
-
-
Color TabBar::GetTabBgColor( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -1872,8 +1787,6 @@ void TabBar::SetTabBgColor( sal_uInt16 nPageId, const Color& aTabBgColor )
}
}
-
-
void TabBar::RemovePage( sal_uInt16 nPageId )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -1902,8 +1815,6 @@ void TabBar::RemovePage( sal_uInt16 nPageId )
}
}
-
-
void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -1940,8 +1851,6 @@ void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos )
}
}
-
-
void TabBar::Clear()
{
// delete all items
@@ -1964,8 +1873,6 @@ void TabBar::Clear()
CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(PAGE_NOT_FOUND)) );
}
-
-
bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -1976,8 +1883,6 @@ bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const
return false;
}
-
-
void TabBar::SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -1997,8 +1902,6 @@ void TabBar::SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits )
}
}
-
-
TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2009,22 +1912,16 @@ TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const
return sal_False;
}
-
-
sal_uInt16 TabBar::GetPageCount() const
{
return mpImpl->getItemSize();
}
-
-
sal_uInt16 TabBar::GetPageId( sal_uInt16 nPos ) const
{
return nPos < mpImpl->mpItemList.size() ? mpImpl->mpItemList[nPos]->mnId : 0;
}
-
-
sal_uInt16 TabBar::GetPagePos( sal_uInt16 nPageId ) const
{
for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
@@ -2036,8 +1933,6 @@ sal_uInt16 TabBar::GetPagePos( sal_uInt16 nPageId ) const
return PAGE_NOT_FOUND;
}
-
-
sal_uInt16 TabBar::GetPageId( const Point& rPos, bool bCheckInsTab ) const
{
for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
@@ -2057,8 +1952,6 @@ sal_uInt16 TabBar::GetPageId( const Point& rPos, bool bCheckInsTab ) const
return 0;
}
-
-
Rectangle TabBar::GetPageRect( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2069,8 +1962,6 @@ Rectangle TabBar::GetPageRect( sal_uInt16 nPageId ) const
return Rectangle();
}
-
-
void TabBar::SetCurPageId( sal_uInt16 nPageId )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2153,8 +2044,6 @@ void TabBar::SetCurPageId( sal_uInt16 nPageId )
}
}
-
-
void TabBar::MakeVisible( sal_uInt16 nPageId )
{
if ( !IsReallyVisible() )
@@ -2201,8 +2090,6 @@ void TabBar::MakeVisible( sal_uInt16 nPageId )
}
}
-
-
void TabBar::SetFirstPageId( sal_uInt16 nPageId )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2235,8 +2122,6 @@ void TabBar::SetFirstPageId( sal_uInt16 nPageId )
}
}
-
-
void TabBar::SelectPage( sal_uInt16 nPageId, bool bSelect )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2256,8 +2141,6 @@ void TabBar::SelectPage( sal_uInt16 nPageId, bool bSelect )
}
}
-
-
sal_uInt16 TabBar::GetSelectPageCount() const
{
sal_uInt16 nSelected = 0;
@@ -2271,8 +2154,6 @@ sal_uInt16 TabBar::GetSelectPageCount() const
return nSelected;
}
-
-
bool TabBar::IsPageSelected( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2282,8 +2163,6 @@ bool TabBar::IsPageSelected( sal_uInt16 nPageId ) const
return false;
}
-
-
bool TabBar::StartEditMode( sal_uInt16 nPageId )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2394,8 +2273,6 @@ void TabBar::EndEditMode( bool bCancel )
}
}
-
-
void TabBar::SetMirrored(bool bMirrored)
{
if( mbMirrored != bMirrored )
@@ -2418,8 +2295,6 @@ bool TabBar::IsEffectiveRTL() const
return IsMirrored() != Application::GetSettings().GetLayoutRTL();
}
-
-
void TabBar::SetMaxPageWidth( long nMaxWidth )
{
if ( mnMaxPageWidth != nMaxWidth )
@@ -2433,8 +2308,6 @@ void TabBar::SetMaxPageWidth( long nMaxWidth )
}
}
-
-
void TabBar::SetPageText( sal_uInt16 nPageId, const OUString& rText )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2451,8 +2324,6 @@ void TabBar::SetPageText( sal_uInt16 nPageId, const OUString& rText )
}
}
-
-
OUString TabBar::GetPageText( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2461,8 +2332,6 @@ OUString TabBar::GetPageText( sal_uInt16 nPageId ) const
return OUString();
}
-
-
OUString TabBar::GetHelpText( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2481,8 +2350,6 @@ OUString TabBar::GetHelpText( sal_uInt16 nPageId ) const
return OUString();
}
-
-
OString TabBar::GetHelpId( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2492,8 +2359,6 @@ OString TabBar::GetHelpId( sal_uInt16 nPageId ) const
return aRet;
}
-
-
bool TabBar::StartDrag( const CommandEvent& rCEvt, vcl::Region& rRegion )
{
if ( !(mnWinStyle & WB_DRAG) || (rCEvt.GetCommand() != COMMAND_STARTDRAG) )
@@ -2537,8 +2402,6 @@ bool TabBar::StartDrag( const CommandEvent& rCEvt, vcl::Region& rRegion )
return true;
}
-
-
sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
{
ImplTabBarItem* pItem;
@@ -2660,8 +2523,6 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
return mnDropPos;
}
-
-
void TabBar::HideDropPos()
{
if ( mbDropPos )
@@ -2700,8 +2561,6 @@ void TabBar::HideDropPos()
}
}
-
-
bool TabBar::SwitchPage( const Point& rPos )
{
bool bSwitch = false;
@@ -2740,16 +2599,12 @@ bool TabBar::SwitchPage( const Point& rPos )
return bSwitch;
}
-
-
void TabBar::EndSwitchPage()
{
mnSwitchTime = 0;
mnSwitchId = 0;
}
-
-
void TabBar::SetStyle( WinBits nStyle )
{
mnWinStyle = nStyle;
@@ -2759,8 +2614,6 @@ void TabBar::SetStyle( WinBits nStyle )
Resize();
}
-
-
Size TabBar::CalcWindowSizePixel() const
{
long nWidth = 0;
@@ -2778,19 +2631,14 @@ Size TabBar::CalcWindowSizePixel() const
return Size( nWidth, GetSettings().GetStyleSettings().GetScrollBarSize() );
}
-
Rectangle TabBar::GetPageArea() const
{
return Rectangle( Point( mnOffX, mnOffY ), Size( mnLastOffX-mnOffX+1, GetSizePixel().Height()-mnOffY ) );
}
-
-
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > TabBar::CreateAccessible()
+css::uno::Reference<css::accessibility::XAccessible> TabBar::CreateAccessible()
{
return mpImpl->maAccessibleFactory.getFactory().createAccessibleTabBar( *this );
}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e8c2bb2e7cbb476b4b73758fb9a053b5380b29f6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Mar 8 18:14:06 2015 +0900
tabbar: convert ItemList* to ItemList and clean-up
Change-Id: Ibd4364f7d30f098df49537c6a6a01915bfa31b8d
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 4a403c4..d9a8589 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -25,16 +25,6 @@
#include <vcl/window.hxx>
#include <vector>
-class MouseEvent;
-class TrackingEvent;
-class DataChangedEvent;
-class ImplTabButton;
-class ImplTabSizer;
-class TabBarEdit;
-
-struct ImplTabBarItem;
-typedef std::vector<ImplTabBarItem*> ImplTabBarList;
-
/*
Allowed StylbeBits
@@ -306,6 +296,14 @@ enum TabBarAllowRenamingReturnCode {
// - TabBar -
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+class ImplTabButton;
+class ImplTabSizer;
+class TabBarEdit;
+
+struct ImplTabBarItem;
struct TabBar_Impl;
typedef std::vector<ImplTabBarItem*> ImplTabBarList;
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 83c9ab0..e69f05e 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -358,7 +358,7 @@ struct TabBar_Impl
std::unique_ptr<ImplTabButton> mpNextButton;
std::unique_ptr<ImplTabButton> mpLastButton;
std::unique_ptr<TabBarEdit> mpEdit;
- ImplTabBarList* mpItemList;
+ ImplTabBarList mpItemList;
svt::AccessibleFactoryAccess maAccessibleFactory;
@@ -369,15 +369,21 @@ struct TabBar_Impl
, mpNextButton()
, mpLastButton()
, mpEdit()
- , mpItemList(new ImplTabBarList)
+ , mpItemList()
{}
~TabBar_Impl()
{
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
+ for (size_t i = 0; i < mpItemList.size(); ++i)
+ {
+ delete mpItemList[i];
}
- delete mpItemList;
+ mpItemList.clear();
+ }
+
+ sal_uInt16 getItemSize()
+ {
+ return static_cast<sal_uInt16>(mpItemList.size());
}
};
@@ -455,26 +461,28 @@ TabBar::~TabBar()
ImplTabBarItem* TabBar::seek( size_t i )
{
- if ( i < mpImpl->mpItemList->size() )
+ if ( i < mpImpl->mpItemList.size() )
{
maCurrentItemList = i;
- return (*mpImpl->mpItemList)[ maCurrentItemList ];
+ return mpImpl->mpItemList[maCurrentItemList];
}
return NULL;
}
ImplTabBarItem* TabBar::prev()
{
- if ( maCurrentItemList > 0 ) {
- return (*mpImpl->mpItemList)[ --maCurrentItemList ];
+ if ( maCurrentItemList > 0 )
+ {
+ return mpImpl->mpItemList[--maCurrentItemList];
}
return NULL;
}
ImplTabBarItem* TabBar::next()
{
- if ( maCurrentItemList + 1 < mpImpl->mpItemList->size() ) {
- return (*mpImpl->mpItemList)[ ++maCurrentItemList ];
+ if ( maCurrentItemList + 1 < mpImpl->mpItemList.size() )
+ {
+ return mpImpl->mpItemList[++maCurrentItemList];
}
return NULL;
}
@@ -578,9 +586,9 @@ bool TabBar::ImplCalcWidth()
mnCurMaxWidth = 0;
bool bChanged = false;
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[i];
long nNewWidth = GetTextWidth( pItem->maText );
if ( mnCurMaxWidth && (nNewWidth > mnCurMaxWidth) )
{
@@ -619,9 +627,9 @@ void TabBar::ImplFormat()
sal_uInt16 n = 0;
long x = mnOffX;
- for ( size_t i = 0, nL = mpImpl->mpItemList->size(); i < nL; ++i )
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[i];
// At all non-visible tabs an empty rectangle is set
if ( (n+1 < mnFirstPos) || (x > mnLastOffX) )
pItem->maRect.SetEmpty();
@@ -660,20 +668,19 @@ void TabBar::ImplFormat()
sal_uInt16 TabBar::ImplGetLastFirstPos()
{
- sal_uInt16 nCount = (sal_uInt16)(mpImpl->mpItemList->size());
+ sal_uInt16 nCount = mpImpl->getItemSize();
if ( !nCount || mbSizeFormat || mbFormat )
return 0;
sal_uInt16 nLastFirstPos = nCount-1;
long nWinWidth = mnLastOffX - mnOffX - ADDNEWPAGE_AREAWIDTH;
- long nWidth = (*mpImpl->mpItemList)[ nLastFirstPos ]->mnWidth;
+ long nWidth = mpImpl->mpItemList[nLastFirstPos]->mnWidth;
while ( nLastFirstPos && (nWidth < nWinWidth) )
{
nLastFirstPos--;
- nWidth += (*mpImpl->mpItemList)[ nLastFirstPos ]->mnWidth;
+ nWidth += mpImpl->mpItemList[nLastFirstPos]->mnWidth;
}
- if ( (nLastFirstPos != (sal_uInt16)(mpImpl->mpItemList->size()-1)) &&
- (nWidth > nWinWidth) )
+ if ( (nLastFirstPos != static_cast<sal_uInt16>(mpImpl->mpItemList.size() - 1)) && (nWidth > nWinWidth) )
nLastFirstPos++;
return nLastFirstPos;
}
@@ -777,13 +784,13 @@ void TabBar::SetScrollAlwaysEnabled(bool bScrollAlwaysEnabled)
void TabBar::ImplShowPage( sal_uInt16 nPos )
{
- if (nPos >= mpImpl->mpItemList->size())
+ if (nPos >= mpImpl->getItemSize())
return;
// calculate width
long nWidth = GetOutputSizePixel().Width();
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if ( nPos < mnFirstPos )
SetFirstPageId( pItem->mnId );
else if ( pItem->maRect.Right() > nWidth )
@@ -868,7 +875,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( (nSelId > 0) && (nSelId != mnCurPageId) )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpImpl->mpItemList)[ nPos ];
+ pItem = mpImpl->mpItemList[nPos];
if ( pItem->mbEnable )
{
@@ -896,7 +903,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( nSelId )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpImpl->mpItemList)[ nPos ];
+ pItem = mpImpl->mpItemList[nPos];
if ( pItem->mbEnable )
{
@@ -924,7 +931,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
n = 0;
while ( n < nCurPos )
{
- pItem = (*mpImpl->mpItemList)[ n ];
+ pItem = mpImpl->mpItemList[n];
if ( n < nPos )
bSelect = false;
else
@@ -946,11 +953,11 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
// Select all tabs from the actual position till the clicked tab
// and deselect all tabs from the actual position
// till the last tab
- sal_uInt16 nCount = (sal_uInt16) mpImpl->mpItemList->size();
+ sal_uInt16 nCount = mpImpl->getItemSize();
n = nCurPos;
while ( n < nCount )
{
- pItem = (*mpImpl->mpItemList)[ n ];
+ pItem = mpImpl->mpItemList[n];
if ( n <= nPos )
bSelect = true;
@@ -1008,7 +1015,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( nSelId != mnCurPageId )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpImpl->mpItemList)[ nPos ];
+ pItem = mpImpl->mpItemList[nPos];
if ( pItem->mbEnable )
{
@@ -1020,9 +1027,9 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
bUpdate = true;
// deselect all selected items
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- pItem = (*mpImpl->mpItemList)[ i ];
+ pItem = mpImpl->mpItemList[i];
if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) )
{
pItem->mbSelect = false;
@@ -1271,7 +1278,7 @@ void TabBar::Paint( const Rectangle& rect )
ControlState::ENABLED,ImplControlValue(0),OUString());
// calculate items and emit
- sal_uInt16 nItemCount = (sal_uInt16)mpImpl->mpItemList->size();
+ sal_uInt16 nItemCount = mpImpl->getItemSize();
if (!nItemCount)
return;
@@ -1548,7 +1555,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
if ( rHEvt.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON) )
{
sal_uInt16 nPos = GetPagePos( nItemId );
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if ( pItem->mbShort || (pItem->maRect.Right() - 5 > mnLastOffX) )
{
Rectangle aItemRect = GetPageRect( nItemId );
@@ -1558,7 +1565,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
aPt = OutputToScreenPixel( aItemRect.BottomRight() );
aItemRect.Right() = aPt.X();
aItemRect.Bottom() = aPt.Y();
- OUString aStr = (*mpImpl->mpItemList)[ nPos ]->maText;
+ OUString aStr = mpImpl->mpItemList[nPos]->maText;
if (!aStr.isEmpty())
{
if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
@@ -1582,7 +1589,7 @@ void TabBar::StateChanged( StateChangedType nType )
if ( nType == StateChangedType::INITSHOW )
{
- if ( (mbSizeFormat || mbFormat) && !mpImpl->mpItemList->empty() )
+ if ( (mbSizeFormat || mbFormat) && !mpImpl->mpItemList.empty() )
ImplFormat();
}
else if ( (nType == StateChangedType::ZOOM) ||
@@ -1689,7 +1696,7 @@ bool TabBar::ImplDeactivatePage()
void TabBar::ImplPrePaint()
{
- sal_uInt16 nItemCount = (sal_uInt16) mpImpl->mpItemList->size();
+ sal_uInt16 nItemCount = mpImpl->getItemSize();
if (!nItemCount)
return;
@@ -1704,7 +1711,7 @@ void TabBar::ImplPrePaint()
if ( mnCurPageId && (mnFirstPos == 0) && !mbDropPos )
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ GetPagePos( mnCurPageId ) ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[GetPagePos(mnCurPageId)];
if ( pItem->maRect.IsEmpty() )
{
// set mbDropPos (or misuse) to prevent Invalidate()
@@ -1808,12 +1815,15 @@ void TabBar::InsertPage( sal_uInt16 nPageId, const OUString& rText,
// create PageItem and insert in the item list
ImplTabBarItem* pItem = new ImplTabBarItem( nPageId, rText, nBits );
- if ( nPos < mpImpl->mpItemList->size() ) {
- ImplTabBarList::iterator it = mpImpl->mpItemList->begin();
- std::advance( it, nPos );
- mpImpl->mpItemList->insert( it, pItem );
- } else {
- mpImpl->mpItemList->push_back( pItem );
+ if (nPos < mpImpl->mpItemList.size())
+ {
+ ImplTabBarList::iterator it = mpImpl->mpItemList.begin();
+ std::advance(it, nPos);
+ mpImpl->mpItemList.insert(it, pItem);
+ }
+ else
+ {
+ mpImpl->mpItemList.push_back(pItem);
}
mbSizeFormat = true;
@@ -1835,7 +1845,7 @@ Color TabBar::GetTabBgColor( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->maTabBgColor;
+ return mpImpl->mpItemList[nPos]->maTabBgColor;
else
return Color( COL_AUTO );
}
@@ -1845,7 +1855,7 @@ void TabBar::SetTabBgColor( sal_uInt16 nPageId, const Color& aTabBgColor )
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if ( aTabBgColor != Color( COL_AUTO ) )
{
pItem->maTabBgColor = aTabBgColor;
@@ -1879,10 +1889,10 @@ void TabBar::RemovePage( sal_uInt16 nPageId )
mnFirstPos--;
// delete item data
- ImplTabBarList::iterator it = mpImpl->mpItemList->begin();
- std::advance( it, nPos );
+ ImplTabBarList::iterator it = mpImpl->mpItemList.begin();
+ std::advance(it, nPos);
delete *it;
- mpImpl->mpItemList->erase( it );
+ mpImpl->mpItemList.erase(it);
// redraw bar
if ( IsReallyVisible() && IsUpdateMode() )
@@ -1909,16 +1919,17 @@ void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos )
if ( nPos != PAGE_NOT_FOUND )
{
// move tabbar item in the list
- ImplTabBarList::iterator it = mpImpl->mpItemList->begin();
- std::advance( it, nPos );
+ ImplTabBarList::iterator it = mpImpl->mpItemList.begin();
+ std::advance(it, nPos);
ImplTabBarItem* pItem = *it;
- mpImpl->mpItemList->erase( it );
- if ( nNewPos < mpImpl->mpItemList->size() ) {
- it = mpImpl->mpItemList->begin();
- std::advance( it, nNewPos );
- mpImpl->mpItemList->insert( it, pItem );
+ mpImpl->mpItemList.erase(it);
+ if (nNewPos < mpImpl->mpItemList.size())
+ {
+ it = mpImpl->mpItemList.begin();
+ std::advance(it, nNewPos);
+ mpImpl->mpItemList.insert(it, pItem);
} else {
- mpImpl->mpItemList->push_back( pItem );
+ mpImpl->mpItemList.push_back(pItem);
}
// redraw bar
@@ -1934,10 +1945,11 @@ void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos )
void TabBar::Clear()
{
// delete all items
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i ) {
- delete (*mpImpl->mpItemList)[ i ];
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+ {
+ delete mpImpl->mpItemList[i];
}
- mpImpl->mpItemList->clear();
+ mpImpl->mpItemList.clear();
// remove items from the list
mbSizeFormat = true;
@@ -1959,7 +1971,7 @@ bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->mbEnable;
+ return mpImpl->mpItemList[nPos]->mbEnable;
else
return false;
}
@@ -1972,7 +1984,7 @@ void TabBar::SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits )
if ( nPos != PAGE_NOT_FOUND )
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if ( pItem->mnBits != nBits )
{
@@ -1992,7 +2004,7 @@ TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->mnBits;
+ return mpImpl->mpItemList[nPos]->mnBits;
else
return sal_False;
}
@@ -2001,23 +2013,24 @@ TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const
sal_uInt16 TabBar::GetPageCount() const
{
- return (sal_uInt16) mpImpl->mpItemList->size();
+ return mpImpl->getItemSize();
}
sal_uInt16 TabBar::GetPageId( sal_uInt16 nPos ) const
{
- return ( nPos < mpImpl->mpItemList->size() ) ? (*mpImpl->mpItemList)[ nPos ]->mnId : 0;
+ return nPos < mpImpl->mpItemList.size() ? mpImpl->mpItemList[nPos]->mnId : 0;
}
sal_uInt16 TabBar::GetPagePos( sal_uInt16 nPageId ) const
{
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i ) {
- if ( (*mpImpl->mpItemList)[ i ]->mnId == nPageId ) {
- return sal_uInt16( i );
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+ {
+ if (mpImpl->mpItemList[i]->mnId == nPageId) {
+ return static_cast<sal_uInt16>(i);
}
}
return PAGE_NOT_FOUND;
@@ -2027,16 +2040,16 @@ sal_uInt16 TabBar::GetPagePos( sal_uInt16 nPageId ) const
sal_uInt16 TabBar::GetPageId( const Point& rPos, bool bCheckInsTab ) const
{
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
- if ( pItem->maRect.IsInside( rPos ) )
+ ImplTabBarItem* pItem = mpImpl->mpItemList[i];
+ if (pItem->maRect.IsInside(rPos))
return pItem->mnId;
}
- if (bCheckInsTab && mbHasInsertTab && !mpImpl->mpItemList->empty())
+ if (bCheckInsTab && mbHasInsertTab && !mpImpl->mpItemList.empty())
{
- ImplTabBarItem* pItem = mpImpl->mpItemList->back();
+ ImplTabBarItem* pItem = mpImpl->mpItemList.back();
if (ImplGetInsertTabRect(pItem).IsInside(rPos))
return INSERT_TAB_POS;
}
@@ -2051,7 +2064,7 @@ Rectangle TabBar::GetPageRect( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->maRect;
+ return mpImpl->mpItemList[nPos]->maRect;
else
return Rectangle();
}
@@ -2074,11 +2087,11 @@ void TabBar::SetCurPageId( sal_uInt16 nPageId )
if ( IsReallyVisible() && IsUpdateMode() )
bUpdate = true;
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
ImplTabBarItem* pOldItem;
if ( mnCurPageId )
- pOldItem = (*mpImpl->mpItemList)[ GetPagePos( mnCurPageId ) ];
+ pOldItem = mpImpl->mpItemList[GetPagePos(mnCurPageId)];
else
pOldItem = NULL;
@@ -2156,7 +2169,7 @@ void TabBar::MakeVisible( sal_uInt16 nPageId )
SetFirstPageId( nPageId );
else
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
// calculate visible area
long nWidth = mnLastOffX;
@@ -2230,7 +2243,7 @@ void TabBar::SelectPage( sal_uInt16 nPageId, bool bSelect )
if ( nPos != PAGE_NOT_FOUND )
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if ( pItem->mbSelect != bSelect )
{
@@ -2247,11 +2260,11 @@ void TabBar::SelectPage( sal_uInt16 nPageId, bool bSelect )
sal_uInt16 TabBar::GetSelectPageCount() const
{
- sal_uInt16 nSelected = 0;
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
+ sal_uInt16 nSelected = 0;
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
- if ( pItem->mbSelect )
+ ImplTabBarItem* pItem = mpImpl->mpItemList[i];
+ if (pItem->mbSelect)
nSelected++;
}
@@ -2264,7 +2277,7 @@ bool TabBar::IsPageSelected( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->mbSelect;
+ return mpImpl->mpItemList[nPos]->mbSelect;
else
return false;
}
@@ -2427,7 +2440,7 @@ void TabBar::SetPageText( sal_uInt16 nPageId, const OUString& rText )
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
{
- (*mpImpl->mpItemList)[ nPos ]->maText = rText;
+ mpImpl->mpItemList[nPos]->maText = rText;
mbSizeFormat = true;
// redraw bar
@@ -2444,7 +2457,7 @@ OUString TabBar::GetPageText( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->maText;
+ return mpImpl->mpItemList[nPos]->maText;
return OUString();
}
@@ -2455,7 +2468,7 @@ OUString TabBar::GetHelpText( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
if ( nPos != PAGE_NOT_FOUND )
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[nPos];
if (pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty())
{
Help* pHelp = Application::GetHelp();
@@ -2475,7 +2488,7 @@ OString TabBar::GetHelpId( sal_uInt16 nPageId ) const
sal_uInt16 nPos = GetPagePos( nPageId );
OString aRet;
if ( nPos != PAGE_NOT_FOUND )
- return (*mpImpl->mpItemList)[ nPos ]->maHelpId;
+ return mpImpl->mpItemList[nPos]->maHelpId;
return aRet;
}
@@ -2531,14 +2544,14 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
ImplTabBarItem* pItem;
sal_uInt16 nDropId;
sal_uInt16 nNewDropPos;
- sal_uInt16 nItemCount = (sal_uInt16) mpImpl->mpItemList->size();
+ sal_uInt16 nItemCount = mpImpl->getItemSize();
short nScroll = 0;
if ( rPos.X() > mnLastOffX-TABBAR_DRAG_SCROLLOFF )
{
- pItem = (*mpImpl->mpItemList)[ mpImpl->mpItemList->size()-1 ];
+ pItem = mpImpl->mpItemList[mpImpl->mpItemList.size() - 1];
if ( !pItem->maRect.IsEmpty() && (rPos.X() > pItem->maRect.Right()) )
- nNewDropPos = (sal_uInt16) mpImpl->mpItemList->size();
+ nNewDropPos = mpImpl->getItemSize();
else
{
nNewDropPos = mnFirstPos+1;
@@ -2605,7 +2618,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
SetLineColor(aBlackColor);
SetFillColor(aBlackColor);
- pItem = (*mpImpl->mpItemList)[ mnDropPos ];
+ pItem = mpImpl->mpItemList[mnDropPos];
nX = pItem->maRect.Left();
if ( mnDropPos == nCurPos )
nX--;
@@ -2628,7 +2641,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
SetLineColor(aBlackColor);
SetFillColor(aBlackColor);
- pItem = (*mpImpl->mpItemList)[ mnDropPos-1 ];
+ pItem = mpImpl->mpItemList[mnDropPos - 1];
nX = pItem->maRect.Right();
if ( mnDropPos == nCurPos )
nX++;
@@ -2657,11 +2670,11 @@ void TabBar::HideDropPos()
long nX;
long nY1 = (maWinSize.Height()/2)-3;
long nY2 = nY1 + 5;
- sal_uInt16 nItemCount = (sal_uInt16) mpImpl->mpItemList->size();
+ sal_uInt16 nItemCount = mpImpl->getItemSize();
if ( mnDropPos < nItemCount )
{
- pItem = (*mpImpl->mpItemList)[ mnDropPos ];
+ pItem = mpImpl->mpItemList[mnDropPos];
nX = pItem->maRect.Left();
// immediately call Paint, as it is not possible during drag and drop
Rectangle aRect( nX-1, nY1, nX+3, nY2 );
@@ -2672,7 +2685,7 @@ void TabBar::HideDropPos()
}
if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
{
- pItem = (*mpImpl->mpItemList)[ mnDropPos-1 ];
+ pItem = mpImpl->mpItemList[mnDropPos - 1];
nX = pItem->maRect.Right();
// immediately call Paint, as it is not possible during drag and drop
Rectangle aRect( nX-2, nY1, nX+1, nY2 );
@@ -2752,12 +2765,12 @@ Size TabBar::CalcWindowSizePixel() const
{
long nWidth = 0;
- if ( mpImpl->mpItemList->size() )
+ if (mpImpl->mpItemList.size() > 0)
{
((TabBar*)this)->ImplCalcWidth();
- for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
+ for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
{
- ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
+ ImplTabBarItem* pItem = mpImpl->mpItemList[i];
nWidth += pItem->mnWidth;
}
}
commit 36f1dec26699ed44dfc99858a201f8eac42dcf97
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Mar 8 17:27:43 2015 +0900
tabbar: move TabBarList to impl
Change-Id: I71632990601bfc21ae2e6ba5c640f1dd3e6c1ee5
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index ba2ecfd..4a403c4 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -307,7 +307,7 @@ enum TabBarAllowRenamingReturnCode {
// - TabBar -
struct TabBar_Impl;
-struct ImplTabBarItem;
+typedef std::vector<ImplTabBarItem*> ImplTabBarList;
class SVT_DLLPUBLIC TabBar : public vcl::Window
{
@@ -317,7 +317,6 @@ class SVT_DLLPUBLIC TabBar : public vcl::Window
private:
std::unique_ptr<TabBar_Impl> mpImpl;
- ImplTabBarList* mpItemList;
OUString maEditText;
Color maSelColor;
Color maSelTextColor;
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index b38fe90..83c9ab0 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -358,6 +358,7 @@ struct TabBar_Impl
std::unique_ptr<ImplTabButton> mpNextButton;
std::unique_ptr<ImplTabButton> mpLastButton;
std::unique_ptr<TabBarEdit> mpEdit;
+ ImplTabBarList* mpItemList;
svt::AccessibleFactoryAccess maAccessibleFactory;
@@ -368,7 +369,16 @@ struct TabBar_Impl
, mpNextButton()
, mpLastButton()
, mpEdit()
+ , mpItemList(new ImplTabBarList)
{}
+
+ ~TabBar_Impl()
+ {
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ delete (*mpItemList)[ i ];
+ }
+ delete mpItemList;
+ }
};
@@ -381,7 +391,6 @@ void TabBar::ImplInit( WinBits nWinStyle )
{
mpImpl.reset(new TabBar_Impl);
- mpItemList = new ImplTabBarList;
mnMaxPageWidth = 0;
mnCurMaxWidth = 0;
mnOffX = 0;
@@ -441,20 +450,15 @@ TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
TabBar::~TabBar()
{
EndEditMode( true );
-
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
- }
- delete mpItemList;
}
ImplTabBarItem* TabBar::seek( size_t i )
{
- if ( i < mpItemList->size() )
+ if ( i < mpImpl->mpItemList->size() )
{
maCurrentItemList = i;
- return (*mpItemList)[ maCurrentItemList ];
+ return (*mpImpl->mpItemList)[ maCurrentItemList ];
}
return NULL;
}
@@ -462,15 +466,15 @@ ImplTabBarItem* TabBar::seek( size_t i )
ImplTabBarItem* TabBar::prev()
{
if ( maCurrentItemList > 0 ) {
- return (*mpItemList)[ --maCurrentItemList ];
+ return (*mpImpl->mpItemList)[ --maCurrentItemList ];
}
return NULL;
}
ImplTabBarItem* TabBar::next()
{
- if ( maCurrentItemList+1 < mpItemList->size() ) {
- return (*mpItemList)[ ++maCurrentItemList ];
+ if ( maCurrentItemList + 1 < mpImpl->mpItemList->size() ) {
+ return (*mpImpl->mpItemList)[ ++maCurrentItemList ];
}
return NULL;
}
@@ -574,9 +578,9 @@ bool TabBar::ImplCalcWidth()
mnCurMaxWidth = 0;
bool bChanged = false;
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+ for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
{
- ImplTabBarItem* pItem = (*mpItemList)[ i ];
+ ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
long nNewWidth = GetTextWidth( pItem->maText );
if ( mnCurMaxWidth && (nNewWidth > mnCurMaxWidth) )
{
@@ -615,9 +619,9 @@ void TabBar::ImplFormat()
sal_uInt16 n = 0;
long x = mnOffX;
- for ( size_t i = 0, nL = mpItemList->size(); i < nL; ++i )
+ for ( size_t i = 0, nL = mpImpl->mpItemList->size(); i < nL; ++i )
{
- ImplTabBarItem* pItem = (*mpItemList)[ i ];
+ ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ i ];
// At all non-visible tabs an empty rectangle is set
if ( (n+1 < mnFirstPos) || (x > mnLastOffX) )
pItem->maRect.SetEmpty();
@@ -656,19 +660,19 @@ void TabBar::ImplFormat()
sal_uInt16 TabBar::ImplGetLastFirstPos()
{
- sal_uInt16 nCount = (sal_uInt16)(mpItemList->size());
+ sal_uInt16 nCount = (sal_uInt16)(mpImpl->mpItemList->size());
if ( !nCount || mbSizeFormat || mbFormat )
return 0;
sal_uInt16 nLastFirstPos = nCount-1;
long nWinWidth = mnLastOffX - mnOffX - ADDNEWPAGE_AREAWIDTH;
- long nWidth = (*mpItemList)[ nLastFirstPos ]->mnWidth;
+ long nWidth = (*mpImpl->mpItemList)[ nLastFirstPos ]->mnWidth;
while ( nLastFirstPos && (nWidth < nWinWidth) )
{
nLastFirstPos--;
- nWidth += (*mpItemList)[ nLastFirstPos ]->mnWidth;
+ nWidth += (*mpImpl->mpItemList)[ nLastFirstPos ]->mnWidth;
}
- if ( (nLastFirstPos != (sal_uInt16)(mpItemList->size()-1)) &&
+ if ( (nLastFirstPos != (sal_uInt16)(mpImpl->mpItemList->size()-1)) &&
(nWidth > nWinWidth) )
nLastFirstPos++;
return nLastFirstPos;
@@ -773,13 +777,13 @@ void TabBar::SetScrollAlwaysEnabled(bool bScrollAlwaysEnabled)
void TabBar::ImplShowPage( sal_uInt16 nPos )
{
- if (nPos >= mpItemList->size())
+ if (nPos >= mpImpl->mpItemList->size())
return;
// calculate width
long nWidth = GetOutputSizePixel().Width();
- ImplTabBarItem* pItem = (*mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
if ( nPos < mnFirstPos )
SetFirstPageId( pItem->mnId );
else if ( pItem->maRect.Right() > nWidth )
@@ -864,7 +868,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( (nSelId > 0) && (nSelId != mnCurPageId) )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpItemList)[ nPos ];
+ pItem = (*mpImpl->mpItemList)[ nPos ];
if ( pItem->mbEnable )
{
@@ -892,7 +896,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( nSelId )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpItemList)[ nPos ];
+ pItem = (*mpImpl->mpItemList)[ nPos ];
if ( pItem->mbEnable )
{
@@ -920,7 +924,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
n = 0;
while ( n < nCurPos )
{
- pItem = (*mpItemList)[ n ];
+ pItem = (*mpImpl->mpItemList)[ n ];
if ( n < nPos )
bSelect = false;
else
@@ -942,11 +946,11 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
// Select all tabs from the actual position till the clicked tab
// and deselect all tabs from the actual position
// till the last tab
- sal_uInt16 nCount = (sal_uInt16)mpItemList->size();
+ sal_uInt16 nCount = (sal_uInt16) mpImpl->mpItemList->size();
n = nCurPos;
while ( n < nCount )
{
- pItem = (*mpItemList)[ n ];
+ pItem = (*mpImpl->mpItemList)[ n ];
if ( n <= nPos )
bSelect = true;
@@ -1004,7 +1008,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( nSelId != mnCurPageId )
{
sal_uInt16 nPos = GetPagePos( nSelId );
- pItem = (*mpItemList)[ nPos ];
+ pItem = (*mpImpl->mpItemList)[ nPos ];
if ( pItem->mbEnable )
{
@@ -1016,9 +1020,9 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
bUpdate = true;
// deselect all selected items
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+ for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i )
{
- pItem = (*mpItemList)[ i ];
+ pItem = (*mpImpl->mpItemList)[ i ];
if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) )
{
pItem->mbSelect = false;
@@ -1267,7 +1271,7 @@ void TabBar::Paint( const Rectangle& rect )
ControlState::ENABLED,ImplControlValue(0),OUString());
// calculate items and emit
- sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size();
+ sal_uInt16 nItemCount = (sal_uInt16)mpImpl->mpItemList->size();
if (!nItemCount)
return;
@@ -1544,7 +1548,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
if ( rHEvt.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON) )
{
sal_uInt16 nPos = GetPagePos( nItemId );
- ImplTabBarItem* pItem = (*mpItemList)[ nPos ];
+ ImplTabBarItem* pItem = (*mpImpl->mpItemList)[ nPos ];
if ( pItem->mbShort || (pItem->maRect.Right() - 5 > mnLastOffX) )
{
Rectangle aItemRect = GetPageRect( nItemId );
@@ -1554,7 +1558,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
aPt = OutputToScreenPixel( aItemRect.BottomRight() );
aItemRect.Right() = aPt.X();
aItemRect.Bottom() = aPt.Y();
- OUString aStr = (*mpItemList)[ nPos ]->maText;
+ OUString aStr = (*mpImpl->mpItemList)[ nPos ]->maText;
if (!aStr.isEmpty())
{
if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
@@ -1578,7 +1582,7 @@ void TabBar::StateChanged( StateChangedType nType )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list