compilerplugins/clang/unusedenumconstants.py | 3 + sc/inc/viewutil.hxx | 2 sc/source/filter/excel/excform.cxx | 35 +++++------- sc/source/filter/excel/excform8.cxx | 28 ++++----- sc/source/filter/excel/frmbase.cxx | 4 - sc/source/filter/excel/xiname.cxx | 4 - sc/source/filter/inc/drawingbase.hxx | 7 +- sc/source/filter/inc/externallinkbuffer.hxx | 23 +++---- sc/source/filter/inc/flttypes.hxx | 10 +-- sc/source/filter/inc/formel.hxx | 11 +-- sc/source/filter/inc/formulabase.hxx | 24 +++----- sc/source/filter/inc/worksheethelper.hxx | 13 ++-- sc/source/filter/lotus/lotimpop.cxx | 8 +- sc/source/filter/lotus/lotread.cxx | 6 -- sc/source/filter/lotus/lotus.cxx | 2 sc/source/filter/oox/condformatbuffer.cxx | 6 +- sc/source/filter/oox/drawingbase.cxx | 21 +------ sc/source/filter/oox/drawingfragment.cxx | 2 sc/source/filter/oox/externallinkbuffer.cxx | 66 +++++++++++----------- sc/source/filter/oox/externallinkfragment.cxx | 4 - sc/source/filter/oox/formulabase.cxx | 30 +++++----- sc/source/filter/oox/formulaparser.cxx | 40 ++++--------- sc/source/filter/oox/pagesettings.cxx | 2 sc/source/filter/oox/pivotcachefragment.cxx | 2 sc/source/filter/oox/sheetdatacontext.cxx | 6 +- sc/source/filter/oox/viewsettings.cxx | 2 sc/source/filter/oox/workbookfragment.cxx | 25 ++++---- sc/source/filter/oox/worksheetfragment.cxx | 15 ++--- sc/source/filter/oox/worksheethelper.cxx | 2 sc/source/filter/qpro/qpro.cxx | 2 sc/source/filter/qpro/qproform.cxx | 12 ++-- sc/source/filter/xcl97/XclImpChangeTrack.cxx | 2 sc/source/ui/docshell/impex.cxx | 62 +++++++-------------- sc/source/ui/inc/gridwin.hxx | 4 - sc/source/ui/inc/tabview.hxx | 2 sc/source/ui/view/gridwin.cxx | 26 ++------- sc/source/ui/view/gridwin3.cxx | 11 --- sc/source/ui/view/gridwin4.cxx | 35 ++---------- sc/source/ui/view/select.cxx | 2 sc/source/ui/view/tabview2.cxx | 2 sc/source/ui/view/tabview3.cxx | 75 ++++++++++++-------------- sc/source/ui/view/tabview4.cxx | 8 +- sc/source/ui/view/tabvwsh5.cxx | 2 43 files changed, 277 insertions(+), 371 deletions(-)
New commits: commit e5a71788c7740c70cf610bcb6d67f7bc8b806761 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 12:14:10 2017 +0200 convert ScUpdateMode to scoped enum and drop unused SC_UPDATE_CHANGED. I can't find anything in our git history to even indicate when it was last in use. Change-Id: Iec6192a3d02132d15b3f392264e81f36b1fd4fad diff --git a/sc/inc/viewutil.hxx b/sc/inc/viewutil.hxx index bbccd75..2819ace 100644 --- a/sc/inc/viewutil.hxx +++ b/sc/inc/viewutil.hxx @@ -35,7 +35,7 @@ class ScAddress; class ScRange; class ScMarkData; enum class SvtScriptType; -enum ScUpdateMode { SC_UPDATE_ALL, SC_UPDATE_CHANGED, SC_UPDATE_MARKS }; +enum class ScUpdateMode { All, Marks }; class SC_DLLPUBLIC ScViewUtil { diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index dff2da7..d8217c5 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -253,7 +253,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou SdrObject* GetEditObject(); bool IsMyModel(SdrEditView* pSdrView); - void DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer ); + void DrawRedraw( ScOutputData& rOutputData, sal_uLong nLayer ); void DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev ); void DrawAfterScroll(); Rectangle GetListValButtonRect( const ScAddress& rButtonPos ); @@ -374,7 +374,7 @@ public: ScUpdateMode eMode ); /// Draw content of the gridwindow; shared between the desktop and the tiled rendering. - void DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText, ScUpdateMode eMode); + void DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText); void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index d7c659e..3d7d54a 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -451,7 +451,7 @@ public: // Zeichnen void PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, - ScUpdateMode eMode = SC_UPDATE_ALL ); + ScUpdateMode eMode = ScUpdateMode::All ); void PaintGrid(); diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 80111d1..8bfc22f 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -185,7 +185,7 @@ bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) return false; } -void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer ) +void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, sal_uLong nLayer ) { const ScViewOptions& rOpts = pViewData->GetOptions(); @@ -206,14 +206,7 @@ void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sa pDrView->setHideFormControl(!bDrawDraw); } - if(SC_UPDATE_CHANGED == eMode) - { - rOutputData.DrawingSingle((sal_uInt16)nLayer); - } - else - { - rOutputData.DrawSelectiveObjects((sal_uInt16)nLayer); - } + rOutputData.DrawSelectiveObjects((sal_uInt16)nLayer); } } diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b26ac76..5f0bbb3 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -371,7 +371,7 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangl ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab); } - Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // don't continue with painting + Draw( nX1,nY1,nX2,nY2, ScUpdateMode::Marks ); // don't continue with painting bIsInPaint = false; } @@ -417,7 +417,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod if (nY2 > maVisibleRange.mnRow2) nY2 = maVisibleRange.mnRow2; - if ( eMode != SC_UPDATE_MARKS && nX2 < maVisibleRange.mnCol2) + if ( eMode != ScUpdateMode::Marks && nX2 < maVisibleRange.mnCol2) nX2 = maVisibleRange.mnCol2; // to continue painting // point of no return @@ -504,7 +504,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod bLogicText = true; // use logic MapMode } - DrawContent(*this, aTabInfo, aOutputData, bLogicText, eMode); + DrawContent(*this, aTabInfo, aOutputData, bLogicText); // If something was inverted during the Paint (selection changed from Basic Macro) // then this is now mixed up and has to be repainted @@ -519,7 +519,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod } void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, - bool bLogicText, ScUpdateMode eMode) + bool bLogicText) { ScModule* pScMod = SC_MOD(); ScDocShell* pDocSh = pViewData->GetDocShell(); @@ -560,12 +560,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ); - if ( eMode == SC_UPDATE_CHANGED ) - { - aOutputData.FindChanged(); - aOutputData.SetSingleGrid(true); - } - bool bPageMode = pViewData->IsPagebreakMode(); if (bPageMode) // after FindChanged { @@ -713,7 +707,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // drawing background pContentDev->SetMapMode(aDrawMode); - DrawRedraw( aOutputData, eMode, SC_LAYER_BACK ); + DrawRedraw( aOutputData, SC_LAYER_BACK ); } else aOutputData.SetSolidBackground(true); @@ -793,8 +787,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI //! Merge SetChangedClip() with DrawMarks() ?? (different MapMode!) bool bAny = true; - if (eMode == SC_UPDATE_CHANGED) - bAny = aOutputData.SetChangedClip(); if (bAny) { if ( bHasChange ) @@ -804,9 +796,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 ); lcl_DrawHighlight( aOutputData, pViewData, rHigh ); - - if (eMode == SC_UPDATE_CHANGED) - pContentDev->SetClipRegion(); } } @@ -830,8 +819,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI comphelper::LibreOfficeKit::setLocalRendering(); } - DrawRedraw( aOutputData, eMode, SC_LAYER_FRONT ); - DrawRedraw( aOutputData, eMode, SC_LAYER_INTERN ); + DrawRedraw( aOutputData, SC_LAYER_FRONT ); + DrawRedraw( aOutputData, SC_LAYER_INTERN ); DrawSdrGrid( aDrawingRectLogic, pContentDev ); if (bIsTiledRendering) @@ -839,14 +828,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI pContentDev->SetMapMode(aOrig); } - if (!bIsInScroll) // Drawing marks - { - if(eMode == SC_UPDATE_CHANGED && aOutputData.SetChangedClip()) - { - pContentDev->SetClipRegion(); - } - } - pContentDev->SetMapMode(MapUnit::MapPixel); if ( pViewData->IsRefMode() && nTab >= pViewData->GetRefStartZ() && nTab <= pViewData->GetRefEndZ() ) @@ -1224,7 +1205,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, } // draw the content - DrawContent(rDevice, aTabInfo, aOutputData, true, SC_UPDATE_ALL); + DrawContent(rDevice, aTabInfo, aOutputData, true); rDevice.SetMapMode(aOriginalMode); } diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 714b991..b4c99e6 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -517,7 +517,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol pViewData->GetView()->UpdateShrinkOverlay(); pViewData->GetView()-> - PaintArea( nStartX,nDelStartY, nEndX,nEndY, SC_UPDATE_MARKS ); + PaintArea( nStartX,nDelStartY, nEndX,nEndY, ScUpdateMode::Marks ); nPosX = nEndX; // keep red border around range nPosY = nEndY; diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 16ad080..6cc704d 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -323,7 +323,7 @@ void ScTabView::PaintMarks(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO aViewData.GetDocument()->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, aViewData.GetTabNo() ); - PaintArea( nStartCol, nStartRow, nEndCol, nEndRow, SC_UPDATE_MARKS ); + PaintArea( nStartCol, nStartRow, nEndCol, nEndRow, ScUpdateMode::Marks ); } bool ScTabView::IsMarking( SCCOL nCol, SCROW nRow, SCTAB nTab ) const diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 7690d4b..343ec37 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2136,7 +2136,7 @@ void ScTabView::KillEditView( bool bNoPaint ) // #i73567# the cell still has to be repainted else if (bExtended || ( bAtCursor && !bNoPaint )) { - pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, SC_UPDATE_ALL ); + pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, ScUpdateMode::All ); pGridWin[i]->UpdateSelectionOverlay(); } } @@ -2250,7 +2250,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO nCol1 = nScrX; if (nCol2 < nScrX) { - if ( eMode == SC_UPDATE_ALL ) // for UPDATE_ALL, paint anyway + if ( eMode == ScUpdateMode::All ) // for UPDATE_ALL, paint anyway nCol2 = nScrX; // (because of extending strings to the right) else bOut = true; // completely outside the window @@ -2276,43 +2276,38 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO if (bOut) continue; - if ( eMode == SC_UPDATE_CHANGED ) - pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, eMode ); - else // ALL or MARKS - { - bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); - long nLayoutSign = bLayoutRTL ? -1 : 1; + bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); + long nLayoutSign = bLayoutRTL ? -1 : 1; - Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i ); - Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i ); - if ( eMode == SC_UPDATE_ALL ) - aEnd.X() = bLayoutRTL ? 0 : (pGridWin[i]->GetOutputSizePixel().Width()); - aEnd.X() -= nLayoutSign; - aEnd.Y() -= 1; + Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i ); + Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i ); + if ( eMode == ScUpdateMode::All ) + aEnd.X() = bLayoutRTL ? 0 : (pGridWin[i]->GetOutputSizePixel().Width()); + aEnd.X() -= nLayoutSign; + aEnd.Y() -= 1; - // #i85232# include area below cells (could be done in GetScrPos?) - if ( eMode == SC_UPDATE_ALL && nRow2 >= MAXROW ) - aEnd.Y() = pGridWin[i]->GetOutputSizePixel().Height(); + // #i85232# include area below cells (could be done in GetScrPos?) + if ( eMode == ScUpdateMode::All && nRow2 >= MAXROW ) + aEnd.Y() = pGridWin[i]->GetOutputSizePixel().Height(); - aStart.X() -= nLayoutSign; // include change marks - aStart.Y() -= 1; + aStart.X() -= nLayoutSign; // include change marks + aStart.Y() -= 1; - bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS ); - if (bMarkClipped) + bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS ); + if (bMarkClipped) + { + // ScColumn::IsEmptyBlock has to be optimized for this + // (switch to Search() ) + //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty( + //! aViewData.GetTabNo(), + //! 0, nRow1, nCol1-1, nRow2 ) ) { - // ScColumn::IsEmptyBlock has to be optimized for this - // (switch to Search() ) - //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty( - //! aViewData.GetTabNo(), - //! 0, nRow1, nCol1-1, nRow2 ) ) - { - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() ); - aStart.X() -= nMarkPixel * nLayoutSign; - } + long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() ); + aStart.X() -= nMarkPixel * nLayoutSign; } - - pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( Rectangle( aStart,aEnd ) ) ); } + + pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( Rectangle( aStart,aEnd ) ) ); } // #i79909# Calling UpdateAllOverlays here isn't necessary and would lead to overlay calls from a timer, @@ -2340,7 +2335,7 @@ void ScTabView::PaintRangeFinderEntry (ScRangeFindData* pData, const SCTAB nTab) SCROW nRow2 = aRef.aEnd.Row(); // remove -> repaint - // SC_UPDATE_MARKS: Invalidate, nothing until end of row + // ScUpdateMode::Marks: Invalidate, nothing until end of row bool bHiddenEdge = false; SCROW nTmp; @@ -2375,13 +2370,13 @@ void ScTabView::PaintRangeFinderEntry (ScRangeFindData* pData, const SCTAB nTab) if ( nCol2 - nCol1 > 1 && nRow2 - nRow1 > 1 && !bHiddenEdge ) { // only along the edges - PaintArea( nCol1, nRow1, nCol2, nRow1, SC_UPDATE_MARKS ); - PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, SC_UPDATE_MARKS ); - PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, SC_UPDATE_MARKS ); - PaintArea( nCol1, nRow2, nCol2, nRow2, SC_UPDATE_MARKS ); + PaintArea( nCol1, nRow1, nCol2, nRow1, ScUpdateMode::Marks ); + PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, ScUpdateMode::Marks ); + PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, ScUpdateMode::Marks ); + PaintArea( nCol1, nRow2, nCol2, nRow2, ScUpdateMode::Marks ); } else // all in one - PaintArea( nCol1, nRow1, nCol2, nRow2, SC_UPDATE_MARKS ); + PaintArea( nCol1, nRow1, nCol2, nRow2, ScUpdateMode::Marks ); } } @@ -2420,7 +2415,7 @@ void ScTabView::AddHighlightRange( const ScRange& rRange, const Color& rColor ) SCTAB nTab = aViewData.GetTabNo(); if ( nTab >= rRange.aStart.Tab() && nTab <= rRange.aEnd.Tab() ) PaintArea( rRange.aStart.Col(), rRange.aStart.Row(), - rRange.aEnd.Col(), rRange.aEnd.Row(), SC_UPDATE_MARKS ); + rRange.aEnd.Col(), rRange.aEnd.Row(), ScUpdateMode::Marks ); } void ScTabView::ClearHighlightRanges() @@ -2432,7 +2427,7 @@ void ScTabView::ClearHighlightRanges() ScRange aRange = pIter->aRef; if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() ) PaintArea( aRange.aStart.Col(), aRange.aStart.Row(), - aRange.aEnd.Col(), aRange.aEnd.Row(), SC_UPDATE_MARKS ); + aRange.aEnd.Col(), aRange.aEnd.Row(), ScUpdateMode::Marks ); } maHighlightRanges.clear(); diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 3196b29..3aaa0d1 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -120,7 +120,7 @@ void ScTabView::StopRefMode() if ( nStartX == nEndX && nStartY == nEndY ) pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); - PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); + PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks ); } pSelEngine->Reset(); @@ -169,7 +169,7 @@ void ScTabView::DoneRefMode( bool bContinue ) if ( nStartX == nEndX && nStartY == nEndY ) pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); - PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); + PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks ); } } @@ -237,7 +237,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) SCCOL nPaintEndX; SCROW nPaintEndY; if (aRect.GetDiff( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY )) - PaintArea( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY, SC_UPDATE_MARKS ); + PaintArea( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY, ScUpdateMode::Marks ); } // Tip-Hilfe fuer Auto-Fill @@ -302,7 +302,7 @@ void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eT pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); //! nur Markierung ueber Inhalte zeichnen! - PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); + PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks ); // SetReference ohne Merge-Anpassung ScRange aRef( nCurX,nCurY,nCurZ, nCurX,nCurY,nCurZ ); diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 4e635ad..456fe7f 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -64,7 +64,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) pPaintHint->GetEndCol(), pPaintHint->GetEndRow() ); if (nParts & PaintPartFlags::Marks) PaintArea( pPaintHint->GetStartCol(), pPaintHint->GetStartRow(), - pPaintHint->GetEndCol(), pPaintHint->GetEndRow(), SC_UPDATE_MARKS ); + pPaintHint->GetEndCol(), pPaintHint->GetEndRow(), ScUpdateMode::Marks ); if (nParts & PaintPartFlags::Left) PaintLeftArea( pPaintHint->GetStartRow(), pPaintHint->GetEndRow() ); if (nParts & PaintPartFlags::Top) commit 917d34657ae195edaef411b5446f70346cabf9e2 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:56:29 2017 +0200 convert CellAnchorType to scoped enum and drop unused COLROW enumerator Change-Id: Idf9c978252a1bd5801e0d18ea339f7c27508734b diff --git a/sc/source/filter/inc/drawingbase.hxx b/sc/source/filter/inc/drawingbase.hxx index c0682da..ff2ca06 100644 --- a/sc/source/filter/inc/drawingbase.hxx +++ b/sc/source/filter/inc/drawingbase.hxx @@ -110,11 +110,10 @@ private: private: /** Specifies how cell positions from CellAnchorModel have to be processed. */ - enum CellAnchorType + enum class CellAnchorType { - CELLANCHOR_EMU, /// Offsets are given in EMUs. - CELLANCHOR_PIXEL, /// Offsets are given in screen pixels. - CELLANCHOR_COLROW /// Offsets are given in fractions of column width or row height. + Emu, /// Offsets are given in EMUs. + Pixel, /// Offsets are given in screen pixels. }; AnchorType meAnchorType; /// Type of this shape anchor. diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx index 7835942..4e1283b 100644 --- a/sc/source/filter/oox/drawingbase.cxx +++ b/sc/source/filter/oox/drawingbase.cxx @@ -67,7 +67,7 @@ AnchorClientDataModel::AnchorClientDataModel() : ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) : WorksheetHelper( rHelper ), meAnchorType( ANCHOR_INVALID ), - meCellAnchorType( CELLANCHOR_EMU ), + meCellAnchorType( CellAnchorType::Emu ), meEditAs( ANCHOR_TWOCELL ) { } @@ -98,7 +98,7 @@ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttrib default: OSL_ENSURE( false, "ShapeAnchor::importAnchor - unexpected element" ); } - meCellAnchorType = CELLANCHOR_EMU; + meCellAnchorType = CellAnchorType::Emu; } void ShapeAnchor::importPos( const AttributeList& rAttribs ) @@ -150,7 +150,7 @@ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, cons void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) { meAnchorType = ANCHOR_VML; - meCellAnchorType = CELLANCHOR_PIXEL; + meCellAnchorType = CellAnchorType::Pixel; ::std::vector< OUString > aTokens; sal_Int32 nIndex = 0; @@ -271,29 +271,18 @@ EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const // add the offset inside the cell switch( meCellAnchorType ) { - case CELLANCHOR_EMU: + case CellAnchorType::Emu: aEmuPoint.X += rModel.mnColOffset; aEmuPoint.Y += rModel.mnRowOffset; break; - case CELLANCHOR_PIXEL: + case CellAnchorType::Pixel: { const UnitConverter& rUnitConv = getUnitConverter(); aEmuPoint.X += static_cast< sal_Int64 >( rUnitConv.scaleValue( static_cast< double >( rModel.mnColOffset ), UNIT_SCREENX, UNIT_EMU ) ); aEmuPoint.Y += static_cast< sal_Int64 >( rUnitConv.scaleValue( static_cast< double >( rModel.mnRowOffset ), UNIT_SCREENY, UNIT_EMU ) ); } break; - - case CELLANCHOR_COLROW: - { - css::awt::Size aCellSize = getCellSize( rModel.mnCol, rModel.mnRow ); - EmuSize aEmuSize( lclHmmToEmu( aCellSize.Width ), lclHmmToEmu( aCellSize.Height ) ); - // X offset is given in 1/1024 of column width - aEmuPoint.X += static_cast< sal_Int64 >( aEmuSize.Width * getLimitedValue< double >( static_cast< double >( rModel.mnColOffset ) / 1024.0, 0.0, 1.0 ) + 0.5 ); - // Y offset is given in 1/256 of row height - aEmuPoint.Y += static_cast< sal_Int64 >( aEmuSize.Height * getLimitedValue< double >( static_cast< double >( rModel.mnRowOffset ) / 256.0, 0.0, 1.0 ) + 0.5 ); - } - break; } return aEmuPoint; commit e5c38f639014b53f454e51b1087b1dcc0d8508f5 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:54:31 2017 +0200 convert ExternalLinkType to scoped enum and drop unused enumerators: LINKTYPE_INTERNAL LINKTYPE_ANALYSIS LINKTYPE_MAYBE_DDE_OLE Change-Id: I2274997227b0fb62fb8fa44f2be19943514ccb4d diff --git a/sc/source/filter/inc/externallinkbuffer.hxx b/sc/source/filter/inc/externallinkbuffer.hxx index 09e7c53..db47ce2 100644 --- a/sc/source/filter/inc/externallinkbuffer.hxx +++ b/sc/source/filter/inc/externallinkbuffer.hxx @@ -155,18 +155,15 @@ private: sal_Int32 mnLast; /// Index of the last sheet or index of last external sheet cache. }; -enum ExternalLinkType +enum class ExternalLinkType { - LINKTYPE_SELF, /// Link refers to the current workbook. - LINKTYPE_SAME, /// Link refers to the current sheet. - LINKTYPE_INTERNAL, /// Link refers to a sheet in the own workbook. - LINKTYPE_EXTERNAL, /// Link refers to an external spreadsheet document. - LINKTYPE_ANALYSIS, /// Link refers to the Analysis add-in. - LINKTYPE_LIBRARY, /// Link refers to an external add-in. - LINKTYPE_DDE, /// DDE link. - LINKTYPE_OLE, /// OLE link. - LINKTYPE_MAYBE_DDE_OLE, /// Could be DDE or OLE link (BIFF only). - LINKTYPE_UNKNOWN /// Unknown or unsupported link type. + Self, /// Link refers to the current workbook. + Same, /// Link refers to the current sheet. + External, /// Link refers to an external spreadsheet document. + Library, /// Link refers to an external add-in. + DDE, /// DDE link. + OLE, /// OLE link. + Unknown /// Unknown or unsupported link type. }; class ExternalLink : public WorkbookHelper @@ -207,7 +204,7 @@ public: void importExternalAddin( SequenceInputStream& rStrm ); /** Sets the link type to 'self reference'. */ - inline void setSelfLinkType() { meLinkType = LINKTYPE_SELF; } + inline void setSelfLinkType() { meLinkType = ExternalLinkType::Self; } /** Returns the type of this external link. */ inline ExternalLinkType getLinkType() const { return meLinkType; } @@ -254,7 +251,7 @@ private: typedef RefVector< ExternalName > ExternalNameVector; ExternalLinkType meLinkType; /// Type of this link object. - FunctionLibraryType meFuncLibType; /// Type of the function library, if link type is LINKTYPE_LIBRARY. + FunctionLibraryType meFuncLibType; /// Type of the function library, if link type is ExternalLinkType::Library. OUString maRelId; /// Relation identifier for the external link fragment. OUString maClassName; /// DDE service, OLE class name. OUString maTargetUrl; /// Target link, DDE topic, OLE target. diff --git a/sc/source/filter/oox/externallinkbuffer.cxx b/sc/source/filter/oox/externallinkbuffer.cxx index 878d8d7..73e6508 100644 --- a/sc/source/filter/oox/externallinkbuffer.cxx +++ b/sc/source/filter/oox/externallinkbuffer.cxx @@ -129,7 +129,7 @@ void ExternalName::importExternalNameFlags( SequenceInputStream& rStrm ) maExtNameModel.mbStdDocName = getFlag( nFlags, BIFF12_EXTNAME_STDDOCNAME ); maExtNameModel.mbOleObj = getFlag( nFlags, BIFF12_EXTNAME_OLEOBJECT ); maExtNameModel.mbIconified = getFlag( nFlags, BIFF12_EXTNAME_ICONIFIED ); - OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_OLE) == maExtNameModel.mbOleObj, + OSL_ENSURE( (mrParentLink.getLinkType() == ExternalLinkType::OLE) == maExtNameModel.mbOleObj, "ExternalName::importExternalNameFlags - wrong OLE flag in external name" ); } @@ -163,7 +163,7 @@ void ExternalName::importDdeItemString( SequenceInputStream& rStrm ) bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const { - if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && !maModel.maName.isEmpty() ) + if( (mrParentLink.getLinkType() == ExternalLinkType::DDE) && !maModel.maName.isEmpty() ) { orItemInfo.Item = maModel.maName; orItemInfo.Results = ContainerHelper::matrixToSequenceSequence( maResults ); @@ -174,7 +174,7 @@ bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic, OUString& orDdeItem ) { - if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && !maModel.maName.isEmpty() ) + if( (mrParentLink.getLinkType() == ExternalLinkType::DDE) && !maModel.maName.isEmpty() ) { // try to create a DDE link and to set the imported link results if( !mbDdeLinkCreated ) try @@ -209,8 +209,8 @@ bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic, void ExternalName::setResultSize( sal_Int32 nColumns, sal_Int32 nRows ) { - OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_DDE) || (mrParentLink.getLinkType() == LINKTYPE_OLE) || - (mrParentLink.getLinkType() == LINKTYPE_MAYBE_DDE_OLE), "ExternalName::setResultSize - wrong link type" ); + OSL_ENSURE( (mrParentLink.getLinkType() == ExternalLinkType::DDE) || (mrParentLink.getLinkType() == ExternalLinkType::OLE), + "ExternalName::setResultSize - wrong link type" ); OSL_ENSURE( (nRows > 0) && (nColumns > 0), "ExternalName::setResultSize - invalid matrix size" ); const ScAddress& rMaxPos = getAddressConverter().getMaxApiAddress(); if( (0 < nRows) && (nRows <= rMaxPos.Row() + 1) && (0 < nColumns) && (nColumns <= rMaxPos.Col() + 1) ) @@ -258,7 +258,7 @@ void LinkSheetRange::setExternalRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal ExternalLink::ExternalLink( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ), - meLinkType( LINKTYPE_UNKNOWN ), + meLinkType( ExternalLinkType::Unknown ), meFuncLibType( FUNCLIB_UNKNOWN ) { } @@ -287,7 +287,7 @@ void ExternalLink::importDdeLink( const AttributeList& rAttribs ) { OUString aDdeService = rAttribs.getXString( XML_ddeService, OUString() ); OUString aDdeTopic = rAttribs.getXString( XML_ddeTopic, OUString() ); - setDdeOleTargetUrl( aDdeService, aDdeTopic, LINKTYPE_DDE ); + setDdeOleTargetUrl( aDdeService, aDdeTopic, ExternalLinkType::DDE ); } ExternalNameRef ExternalLink::importDdeItem( const AttributeList& rAttribs ) @@ -301,7 +301,7 @@ void ExternalLink::importOleLink( const Relations& rRelations, const AttributeLi { OUString aProgId = rAttribs.getXString( XML_progId, OUString() ); OUString aTargetUrl = rRelations.getExternalTargetFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); - setDdeOleTargetUrl( aProgId, aTargetUrl, LINKTYPE_OLE ); + setDdeOleTargetUrl( aProgId, aTargetUrl, ExternalLinkType::OLE ); } ExternalNameRef ExternalLink::importOleItem( const AttributeList& rAttribs ) @@ -318,17 +318,17 @@ void ExternalLink::importExternalRef( SequenceInputStream& rStrm ) void ExternalLink::importExternalSelf( SequenceInputStream& ) { - meLinkType = LINKTYPE_SELF; + meLinkType = ExternalLinkType::Self; } void ExternalLink::importExternalSame( SequenceInputStream& ) { - meLinkType = LINKTYPE_SAME; + meLinkType = ExternalLinkType::Same; } void ExternalLink::importExternalAddin( SequenceInputStream& ) { - meLinkType = LINKTYPE_UNKNOWN; + meLinkType = ExternalLinkType::Unknown; } void ExternalLink::importExternalBook( const Relations& rRelations, SequenceInputStream& rStrm ) @@ -342,14 +342,14 @@ void ExternalLink::importExternalBook( const Relations& rRelations, SequenceInpu { OUString aDdeService, aDdeTopic; rStrm >> aDdeService >> aDdeTopic; - setDdeOleTargetUrl( aDdeService, aDdeTopic, LINKTYPE_DDE ); + setDdeOleTargetUrl( aDdeService, aDdeTopic, ExternalLinkType::DDE ); } break; case BIFF12_EXTERNALBOOK_OLE: { OUString aTargetUrl = rRelations.getExternalTargetFromRelId( BiffHelper::readString( rStrm ) ); OUString aProgId = BiffHelper::readString( rStrm ); - setDdeOleTargetUrl( aProgId, aTargetUrl, LINKTYPE_OLE ); + setDdeOleTargetUrl( aProgId, aTargetUrl, ExternalLinkType::OLE ); } break; default: @@ -360,9 +360,9 @@ void ExternalLink::importExternalBook( const Relations& rRelations, SequenceInpu void ExternalLink::importExtSheetNames( SequenceInputStream& rStrm ) { // load external sheet names and create the sheet caches in the Calc document - OSL_ENSURE( (meLinkType == LINKTYPE_EXTERNAL) || (meLinkType == LINKTYPE_LIBRARY), + OSL_ENSURE( (meLinkType == ExternalLinkType::External) || (meLinkType == ExternalLinkType::Library), "ExternalLink::importExtSheetNames - invalid link type" ); - if( meLinkType == LINKTYPE_EXTERNAL ) // ignore sheets of external libraries + if( meLinkType == ExternalLinkType::External ) // ignore sheets of external libraries for( sal_Int32 nSheet = 0, nCount = rStrm.readInt32(); !rStrm.isEof() && (nSheet < nCount); ++nSheet ) insertExternalSheet( BiffHelper::readString( rStrm ) ); } @@ -379,20 +379,19 @@ ExternalLinkInfo ExternalLink::getLinkInfo() const ExternalLinkInfo aLinkInfo; switch( meLinkType ) { - case LINKTYPE_SELF: - case LINKTYPE_SAME: - case LINKTYPE_INTERNAL: + case ExternalLinkType::Self: + case ExternalLinkType::Same: aLinkInfo.Type = css::sheet::ExternalLinkType::SELF; break; - case LINKTYPE_EXTERNAL: + case ExternalLinkType::External: aLinkInfo.Type = css::sheet::ExternalLinkType::DOCUMENT; aLinkInfo.Data <<= maTargetUrl; break; - case LINKTYPE_LIBRARY: + case ExternalLinkType::Library: // parser will return library function names in OPCODE_BAD string tokens aLinkInfo.Type = css::sheet::ExternalLinkType::SPECIAL; break; - case LINKTYPE_DDE: + case ExternalLinkType::DDE: { aLinkInfo.Type = css::sheet::ExternalLinkType::DDE; DDELinkInfo aDdeLinkInfo; @@ -415,18 +414,18 @@ ExternalLinkInfo ExternalLink::getLinkInfo() const FunctionLibraryType ExternalLink::getFuncLibraryType() const { - return (meLinkType == LINKTYPE_LIBRARY) ? meFuncLibType : FUNCLIB_UNKNOWN; + return (meLinkType == ExternalLinkType::Library) ? meFuncLibType : FUNCLIB_UNKNOWN; } sal_Int32 ExternalLink::getDocumentLinkIndex() const { - OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::getDocumentLinkIndex - invalid link type" ); + OSL_ENSURE( meLinkType == ExternalLinkType::External, "ExternalLink::getDocumentLinkIndex - invalid link type" ); return mxDocLink.is() ? mxDocLink->getTokenIndex() : -1; } sal_Int32 ExternalLink::getSheetCacheIndex( sal_Int32 nTabId ) const { - OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::getSheetCacheIndex - invalid link type" ); + OSL_ENSURE( meLinkType == ExternalLinkType::External, "ExternalLink::getSheetCacheIndex - invalid link type" ); return ContainerHelper::getVectorElement( maSheetCaches, nTabId, -1 ); } @@ -449,16 +448,15 @@ void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId { switch( meLinkType ) { - case LINKTYPE_SAME: + case ExternalLinkType::Same: orSheetRange.setSameSheet(); break; - case LINKTYPE_SELF: - case LINKTYPE_INTERNAL: + case ExternalLinkType::Self: orSheetRange.setRange( nTabId1, nTabId2 ); break; - case LINKTYPE_EXTERNAL: + case ExternalLinkType::External: { sal_Int32 nDocLinkIdx = getDocumentLinkIndex(); // BIFF12: passed indexes point into sheet list of EXTSHEETLIST @@ -481,23 +479,23 @@ ExternalNameRef ExternalLink::getNameByIndex( sal_Int32 nIndex ) const void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUString& rTargetType ) { - meLinkType = LINKTYPE_UNKNOWN; + meLinkType = ExternalLinkType::Unknown; if( rTargetType == CREATE_OFFICEDOC_RELATION_TYPE( "externalLinkPath" ) || rTargetType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "externalLinkPath" ) ) { maTargetUrl = getBaseFilter().getAbsoluteUrl( rTargetUrl ); if( !maTargetUrl.isEmpty() ) - meLinkType = LINKTYPE_EXTERNAL; + meLinkType = ExternalLinkType::External; } else if( rTargetType == CREATE_MSOFFICE_RELATION_TYPE( "xlExternalLinkPath/xlLibrary" ) ) { - meLinkType = LINKTYPE_LIBRARY; + meLinkType = ExternalLinkType::Library; meFuncLibType = FunctionProvider::getFuncLibTypeFromLibraryName( rTargetUrl ); } - OSL_ENSURE( meLinkType != LINKTYPE_UNKNOWN, "ExternalLink::setExternalTargetUrl - empty target URL or unknown target type" ); + OSL_ENSURE( meLinkType != ExternalLinkType::Unknown, "ExternalLink::setExternalTargetUrl - empty target URL or unknown target type" ); // create the external document link API object that will contain the sheet caches - if( meLinkType == LINKTYPE_EXTERNAL ) try + if( meLinkType == ExternalLinkType::External ) try { PropertySet aDocProps( getDocument() ); Reference< XExternalDocLinks > xDocLinks( aDocProps.getAnyProperty( PROP_ExternalDocLinks ), UNO_QUERY_THROW ); @@ -512,7 +510,7 @@ void ExternalLink::setDdeOleTargetUrl( const OUString& rClassName, const OUStrin { maClassName = rClassName; maTargetUrl = rTargetUrl; - meLinkType = (maClassName.isEmpty() || maTargetUrl.isEmpty()) ? LINKTYPE_UNKNOWN : eLinkType; + meLinkType = (maClassName.isEmpty() || maTargetUrl.isEmpty()) ? ExternalLinkType::Unknown : eLinkType; OSL_ENSURE( meLinkType == eLinkType, "ExternalLink::setDdeOleTargetUrl - missing classname or target" ); } diff --git a/sc/source/filter/oox/externallinkfragment.cxx b/sc/source/filter/oox/externallinkfragment.cxx index c91360a..d0d6581 100644 --- a/sc/source/filter/oox/externallinkfragment.cxx +++ b/sc/source/filter/oox/externallinkfragment.cxx @@ -195,7 +195,7 @@ ContextHandlerRef ExternalLinkFragment::onCreateContext( sal_Int32 nElement, con if( nElement == XLS_TOKEN( definedName ) ) mrExtLink.importDefinedName( rAttribs ); break; case XLS_TOKEN( sheetDataSet ): - if( (nElement == XLS_TOKEN( sheetData )) && (mrExtLink.getLinkType() == LINKTYPE_EXTERNAL) ) + if( (nElement == XLS_TOKEN( sheetData )) && (mrExtLink.getLinkType() == ExternalLinkType::External) ) return createSheetDataContext( rAttribs.getInteger( XML_sheetId, -1 ) ); break; @@ -280,7 +280,7 @@ ContextHandlerRef ExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, switch( nRecId ) { case BIFF12_ID_EXTSHEETDATA: - if( mrExtLink.getLinkType() == LINKTYPE_EXTERNAL ) + if( mrExtLink.getLinkType() == ExternalLinkType::External ) return createSheetDataContext( rStrm.readInt32() ); break; diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index f34d96a..82d9aa9 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -582,8 +582,8 @@ ApiTokenSequence FormulaParserImpl::importBiff12Formula( const ScAddress&, Formu OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const { const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId, bUseRefSheets ).get(); - OSL_ENSURE( pExtLink && (pExtLink->getLinkType() == LINKTYPE_OLE), "FormulaParserImpl::resolveOleTarget - missing or wrong link" ); - if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_OLE) ) + OSL_ENSURE( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::OLE), "FormulaParserImpl::resolveOleTarget - missing or wrong link" ); + if( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::OLE) ) return getBaseFilter().getAbsoluteUrl( pExtLink->getTargetUrl() ); return OUString(); } @@ -982,23 +982,16 @@ bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtNam { if( rxExtName.get() ) switch( rExtLink.getLinkType() ) { - case LINKTYPE_INTERNAL: - case LINKTYPE_EXTERNAL: + case ExternalLinkType::External: return pushEmbeddedRefOperand( *rxExtName, false ); - case LINKTYPE_ANALYSIS: - // TODO: need support for localized addin function names - if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseModelName() ) ) - return pushExternalFuncOperand( *pFuncInfo ); - break; - - case LINKTYPE_LIBRARY: + case ExternalLinkType::Library: if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseModelName() ) ) if( (pFuncInfo->meFuncLibType != FUNCLIB_UNKNOWN) && (pFuncInfo->meFuncLibType == rExtLink.getFuncLibraryType()) ) return pushExternalFuncOperand( *pFuncInfo ); break; - case LINKTYPE_DDE: + case ExternalLinkType::DDE: { OUString aDdeServer, aDdeTopic, aDdeItem; if( rxExtName->getDdeLinkData( aDdeServer, aDdeTopic, aDdeItem ) ) @@ -1007,7 +1000,7 @@ bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtNam break; default: - OSL_ENSURE( rExtLink.getLinkType() != LINKTYPE_SELF, "FormulaParserImpl::pushExternalNameOperand - invalid call" ); + OSL_ENSURE( rExtLink.getLinkType() != ExternalLinkType::Self, "FormulaParserImpl::pushExternalNameOperand - invalid call" ); } return pushBiffErrorOperand( BIFF_ERR_NAME ); } @@ -1170,7 +1163,7 @@ const FunctionInfo* FormulaParserImpl::resolveBadFuncName( const OUString& rToke { sal_Int32 nRefId = rTokenData.copy( nBracketOpen + 1, nBracketClose - nBracketOpen - 1 ).toInt32(); const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get(); - if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_LIBRARY) ) + if( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::Library) ) { OUString aFuncName = rTokenData.copy( nExclamation + 1 ).toAsciiUpperCase(); if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( aFuncName ) ) @@ -1722,7 +1715,7 @@ bool OoxFormulaParserImpl::pushBiff12ExtName( sal_Int32 nRefId, sal_Int32 nNameI { if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get() ) { - if( pExtLink->getLinkType() == LINKTYPE_SELF ) + if( pExtLink->getLinkType() == ExternalLinkType::Self ) return pushBiff12Name( nNameId ); // external name indexes are one-based in BIFF12 ExternalNameRef xExtName = pExtLink->getNameByIndex( nNameId - 1 ); @@ -1857,7 +1850,7 @@ OUString FormulaParser::importMacroName( const OUString& rFormulaString ) const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId, false ).get(); OSL_ENSURE( pExtLink, "FormulaParser::importMacroName - missing link" ); // do not accept macros in external documents (not supported) - if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_SELF) ) + if( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::Self) ) { // ignore sheet macros (defined name for VBA macros may not exist, see above) OUString aMacroName = aRemainder.copy( 1 ); commit 2312e530ded785c4d3955101b1857620f76b8ad5 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:48:09 2017 +0200 convert Lotus123Typ to scoped enum and drop unused enumerators Change-Id: I1658d05d3e79c0bbb1020a440b981723ba29bd4d diff --git a/sc/source/filter/inc/flttypes.hxx b/sc/source/filter/inc/flttypes.hxx index d939cac..5f137e3 100644 --- a/sc/source/filter/inc/flttypes.hxx +++ b/sc/source/filter/inc/flttypes.hxx @@ -30,13 +30,11 @@ enum BiffTyp Biff8 = 0x8000, Biff8W = 0x8001, Biff8V = 0x8002, Biff8C = 0x8004, Biff8M4 = 0x8008 }; -enum Lotus123Typ +enum class Lotus123Typ { - Lotus_X, - Lotus_WK1, - Lotus_WK3, - Lotus_WK4, - Lotus_FM3 + X, + WK3, + WK4, }; #endif diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index 1d27861..9babc93 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -45,8 +45,8 @@ LOTUS_ROOT::LOTUS_ROOT( ScDocument* pDocP, rtl_TextEncoding eQ ) pRangeNames( new LotusRangeList(this)), pScRangeName( pDocP->GetRangeName()), eCharsetQ( eQ), - eFirstType( Lotus_X), - eActType( Lotus_X), + eFirstType( Lotus123Typ::X), + eActType( Lotus123Typ::X), pRngNmBffWK3( new RangeNameBufferWK3(this)), pFontBuff( new LotusFontBuffer), pAttrTable( new LotAttrTable(this)) @@ -105,11 +105,11 @@ void ImportLotus::Bof() { if( nFileCode == 0x1000 ) {// <= WK3 - rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus_WK3; + rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus123Typ::WK3; } else if( nFileCode == 0x1002 ) {// WK4 - rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus_WK4; + rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus123Typ::WK4; } } } diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx index 5e30fb5..1a37631 100644 --- a/sc/source/filter/lotus/lotread.cxx +++ b/sc/source/filter/lotus/lotread.cxx @@ -82,10 +82,8 @@ FltError ImportLotus::Read() Bof(); switch (rContext.pLotusRoot->eFirstType) { - case Lotus_WK1: eAkt = S_WK1; break; - case Lotus_WK3: eAkt = S_WK3; break; - case Lotus_WK4: eAkt = S_WK4; break; - case Lotus_FM3: eAkt = S_FM3; break; + case Lotus123Typ::WK3: eAkt = S_WK3; break; + case Lotus123Typ::WK4: eAkt = S_WK4; break; default: eRet = SCERR_IMPORT_UNKNOWN_WK; eAkt = S_END; diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx index 24524ba..6afba99 100644 --- a/sc/source/filter/lotus/lotus.cxx +++ b/sc/source/filter/lotus/lotus.cxx @@ -70,7 +70,7 @@ FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocum if( eRet != eERR_OK ) return eRet; - if (aContext.pLotusRoot->eFirstType == Lotus_WK3) + if (aContext.pLotusRoot->eFirstType == Lotus123Typ::WK3) { // try to load *.FM3 file INetURLObject aURL( rMedium.GetURLObject() ); commit 7f3952acdbf1655d6344077d4e0dd07704f014f8 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:44:18 2017 +0200 convert ConvErr to scoped enum and drop unused enumerators Change-Id: I78d4955d2ae92e0c4f3eeb58d783767c82ca9843 diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index fe09f4a..eaaac14 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -171,7 +171,7 @@ void ImportExcel::Formula( if (pCell) { pCell->SetNeedNumberFormat(false); - if( eErr != ConvOK ) + if( eErr != ConvErr::OK ) ExcelToSc::SetError( *pCell, eErr ); if (rtl::math::isFinite(fCurVal)) @@ -219,7 +219,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s ScComplexRefData aCRD; ExtensionTypeVec aExtensions; - if( eStatus != ConvOK ) + if( eStatus != ConvErr::OK ) { aIn.Ignore( nFormulaLen ); return eStatus; @@ -230,7 +230,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aPool.Store( OUString("-/-") ); aPool >> aStack; pErgebnis = aPool[ aStack.Get() ]; - return ConvOK; + return ConvErr::OK; } std::size_t nEndPos = aIn.GetRecPos() + nFormulaLen; @@ -868,29 +868,29 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aPool << ocBad; aPool >> aStack; pErgebnis = aPool[ aStack.Get() ]; - eRet = ConvErrNi; + eRet = ConvErr::Ni; } else if( aIn.GetRecPos() != nEndPos ) { aPool << ocBad; aPool >> aStack; pErgebnis = aPool[ aStack.Get() ]; - eRet = ConvErrCount; + eRet = ConvErr::Count; } else if( bArrayFormula ) { pErgebnis = nullptr; - eRet = ConvOK; + eRet = ConvErr::OK; } else { pErgebnis = aPool[ aStack.Get() ]; - eRet = ConvOK; + eRet = ConvErr::OK; } aIn.Seek( nEndPos ); - if( eRet == ConvOK ) + if( eRet == ConvErr::OK ) ReadExtensions( aExtensions, aIn ); return eRet; @@ -913,14 +913,14 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std: aCRD.Ref1.SetAbsTab(aEingPos.Tab()); aCRD.Ref2.SetAbsTab(aEingPos.Tab()); - if( eStatus != ConvOK ) + if( eStatus != ConvErr::OK ) { aIn.Ignore( nFormulaLen ); return eStatus; } if( nFormulaLen == 0 ) - return ConvOK; + return ConvErr::OK; std::size_t nEndPos = aIn.GetRecPos() + nFormulaLen; @@ -1314,11 +1314,11 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std: ConvErr eRet; if( bError ) - eRet = ConvErrNi; + eRet = ConvErr::Ni; else if( aIn.GetRecPos() != nEndPos ) - eRet = ConvErrCount; + eRet = ConvErr::Count; else - eRet = ConvOK; + eRet = ConvErr::OK; aIn.Seek( nEndPos ); return eRet; @@ -1749,11 +1749,10 @@ void ExcelToSc::SetError( ScFormulaCell &rCell, const ConvErr eErr ) switch( eErr ) { - case ConvErrNi: nInd = FormulaError::UnknownToken; break; - case ConvErrNoMem: nInd = FormulaError::CodeOverflow; break; - case ConvErrExternal: nInd = FormulaError::NoName; break; - case ConvErrCount: nInd = FormulaError::CodeOverflow; break; - default: nInd = FormulaError::NoCode; // I had no better idea + case ConvErr::Ni: nInd = FormulaError::UnknownToken; break; + case ConvErr::External: nInd = FormulaError::NoName; break; + case ConvErr::Count: nInd = FormulaError::CodeOverflow; break; + default: nInd = FormulaError::NoCode; // I had no better idea } rCell.SetErrCode( nInd ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index ef3d09a..cc26894 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -147,10 +147,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, const bool bRNorSF = bRangeNameOrCond || bSharedFormula; ScSingleRefData aSRD; - ScComplexRefData aCRD; + ScComplexRefData aCRD; ExtensionTypeVec aExtensions; - if( eStatus != ConvOK ) + if( eStatus != ConvErr::OK ) { aIn.Ignore( nFormulaLen ); return eStatus; @@ -161,7 +161,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aPool.Store( OUString( "-/-" ) ); aPool >> aStack; rpTokArray = aPool[ aStack.Get() ]; - return ConvOK; + return ConvErr::OK; } std::size_t nEndPos = aIn.GetRecPos() + nFormulaLen; @@ -924,29 +924,29 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aPool << ocBad; aPool >> aStack; rpTokArray = aPool[ aStack.Get() ]; - eRet = ConvErrNi; + eRet = ConvErr::Ni; } else if( aIn.GetRecPos() != nEndPos ) { aPool << ocBad; aPool >> aStack; rpTokArray = aPool[ aStack.Get() ]; - eRet = ConvErrCount; + eRet = ConvErr::Count; } else if( bArrayFormula ) { rpTokArray = nullptr; - eRet = ConvOK; + eRet = ConvErr::OK; } else { rpTokArray = aPool[ aStack.Get() ]; - eRet = ConvOK; + eRet = ConvErr::OK; } aIn.Seek( nEndPos ); - if( eRet == ConvOK) + if( eRet == ConvErr::OK) ReadExtensions( aExtensions, aIn ); return eRet; @@ -966,14 +966,14 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std ScSingleRefData aSRD; ScComplexRefData aCRD; - if( eStatus != ConvOK ) + if( eStatus != ConvErr::OK ) { aIn.Ignore( nFormulaLen ); return eStatus; } if( nFormulaLen == 0 ) - return ConvOK; + return ConvErr::OK; std::size_t nEndPos = aIn.GetRecPos() + nFormulaLen; @@ -1286,11 +1286,11 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std ConvErr eRet; if( bError ) - eRet = ConvErrNi; + eRet = ConvErr::Ni; else if( aIn.GetRecPos() != nEndPos ) - eRet = ConvErrCount; + eRet = ConvErr::Count; else - eRet = ConvOK; + eRet = ConvErr::OK; aIn.Seek( nEndPos ); return eRet; @@ -1310,7 +1310,7 @@ void ExcelToSc8::ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& ScSingleRefData aSRD; ScComplexRefData aCRD; - if (eStatus != ConvOK) + if (eStatus != ConvErr::OK) { rStrm.Ignore(nFormulaLen); return; diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index 7a9df82..7f82a79 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -151,7 +151,7 @@ const ScRange* ScRangeListTabs::Next () ConverterBase::ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer ) : aPool(rSPool), aEingPos( 0, 0, 0 ), - eStatus( ConvOK ) + eStatus( ConvErr::OK ) { OSL_ENSURE( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" ); pBuffer.reset( new sal_Char[ nNewBuffer ] ); @@ -163,7 +163,7 @@ ConverterBase::~ConverterBase() void ConverterBase::Reset() { - eStatus = ConvOK; + eStatus = ConvErr::OK; aPool.Reset(); aStack.Reset(); } diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index 7189c2a..8b599b1 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -160,11 +160,11 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) : switch( mcBuiltIn ) { case EXC_BUILTIN_PRINTAREA: - if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK ) + if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvErr::OK ) meNameType |= ScRangeData::Type::PrintArea; break; case EXC_BUILTIN_PRINTTITLES: - if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK ) + if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvErr::OK ) meNameType |= ScRangeData::Type::ColHeader | ScRangeData::Type::RowHeader; break; } diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx index 1fd5c5a4..947a096 100644 --- a/sc/source/filter/inc/formel.hxx +++ b/sc/source/filter/inc/formel.hxx @@ -41,13 +41,12 @@ class ScTokenArray; struct ScSingleRefData; struct ScComplexRefData; -enum ConvErr +enum class ConvErr { - ConvOK = 0, - ConvErrNi, // unimplemented/unknown opcode occurred - ConvErrNoMem, // alloc error - ConvErrExternal,// excel add-ins are not converted - ConvErrCount // did not get all bytes of formula + OK = 0, + Ni, // unimplemented/unknown opcode occurred + External,// excel add-ins are not converted + Count // did not get all bytes of formula }; enum FORMULA_TYPE diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index 96c9acf..f6cc471 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -105,7 +105,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt const ScTokenArray *pArray; QProToSc aConv(*mpStream, pDoc->GetSharedStringPool(), aAddr); - if (ConvOK != aConv.Convert( pArray )) + if (ConvErr::OK != aConv.Convert( pArray )) eRet = eERR_FORMAT; else { diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 6a567dec..380d63f 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -205,7 +205,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray ) { maIn.ReadUInt16( nInt ); nIntArray[ nIntCount ] = nInt; - SAFEDEC_OR_RET(nRef, 2, ConvErrCount); + SAFEDEC_OR_RET(nRef, 2, ConvErr::Count); nIntCount++; } @@ -214,7 +214,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray ) double nFloat; maIn.ReadDouble( nFloat ); nFloatArray[ nFloatCount ] = nFloat; - SAFEDEC_OR_RET(nRef, 8, ConvErrCount); + SAFEDEC_OR_RET(nRef, 8, ConvErr::Count); nFloatCount++; } @@ -223,7 +223,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray ) maIn.ReadUChar( nArg ).ReadUInt16( nDummy ).ReadUInt16( nDLLId ); nArgArray[ nArgCount ] = nArg; nDLLArray[ nDLLCount ] = nDLLId; - SAFEDEC_OR_RET(nRef, 5, ConvErrCount); + SAFEDEC_OR_RET(nRef, 5, ConvErr::Count); nDLLCount++; nArgCount++; } @@ -232,12 +232,12 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray ) OUString aTmp(::read_zeroTerminated_uInt8s_ToOUString(maIn, maIn.GetStreamCharSet())); sStringArray[ nStringCount ] = aTmp; nStringCount++; - SAFEDEC_OR_RET(nRef, aTmp.getLength() + 1, ConvErrCount); + SAFEDEC_OR_RET(nRef, aTmp.getLength() + 1, ConvErr::Count); } } } else - return ConvErrCount; + return ConvErr::Count; i = 0; nIntCount = 0; @@ -368,7 +368,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray ) i++; } pArray = aPool[ aStack.Get() ]; - return ConvOK; + return ConvErr::OK; } static const struct diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 986ffff..d5b2f44 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -211,7 +211,7 @@ void XclImpChangeTrack::ReadFormula( ScTokenArray*& rpTokenArray, const ScAddres // read the formula, 3D tab refs from extended data const ScTokenArray* pArray = nullptr; aFmlConv.Reset( rPosition ); - bool bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false ) == ConvOK); // JEG : Check This + bool bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false ) == ConvErr::OK); // JEG : Check This rpTokenArray = (bOK && pArray) ? new ScTokenArray( *pArray ) : nullptr; pStrm->Ignore( 1 ); } commit b116ca617e120d3aaff739ebd5ac0b9c65fd699b Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:33:22 2017 +0200 convert FormulaType to scoped enum and drop unused FORMULATYPE_DEFINEDNAME enumerator Change-Id: Iaa2094346a52b9f34e71708ba4b6efe5a1809ad4 diff --git a/sc/source/filter/inc/formulabase.hxx b/sc/source/filter/inc/formulabase.hxx index a192422..2171661 100644 --- a/sc/source/filter/inc/formulabase.hxx +++ b/sc/source/filter/inc/formulabase.hxx @@ -210,14 +210,13 @@ const sal_uInt16 BIFF_FUNC_WEEKNUM = 465; /// Function identif // Formula type =============================================================== /** Enumerates all possible types of a formula. */ -enum FormulaType +enum class FormulaType { - FORMULATYPE_CELL, /// Simple cell formula, or reference to a shared formula name. - FORMULATYPE_ARRAY, /// Array (matrix) formula. - FORMULATYPE_SHAREDFORMULA, /// Shared formula definition. - FORMULATYPE_CONDFORMAT, /// Condition of a conditional format rule. - FORMULATYPE_VALIDATION, /// Condition of a data validation. - FORMULATYPE_DEFINEDNAME /// Definition of a defined name. + Cell, /// Simple cell formula, or reference to a shared formula name. + Array, /// Array (matrix) formula. + SharedFormula, /// Shared formula definition. + CondFormat, /// Condition of a conditional format rule. + Validation /// Condition of a data validation. }; // Reference helpers ========================================================== diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 3dcb0b2..3af2b95 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -501,7 +501,7 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) if( rStrm.getRemaining() >= 8 ) { ScAddress aBaseAddr = mrCondFormat.getRanges().GetTopLeftCorner(); - ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FormulaType::CondFormat, rStrm ); maModel.maFormulas.push_back( aTokens ); // second formula @@ -509,14 +509,14 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) OSL_ENSURE( (nFmla2Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" ); if( rStrm.getRemaining() >= 8 ) { - aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + aTokens = getFormulaParser().importFormula( aBaseAddr, FormulaType::CondFormat, rStrm ); maModel.maFormulas.push_back( aTokens ); // third formula OSL_ENSURE( (nFmla3Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" ); if( rStrm.getRemaining() >= 8 ) { - aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + aTokens = getFormulaParser().importFormula( aBaseAddr, FormulaType::CondFormat, rStrm ); maModel.maFormulas.push_back( aTokens ); } } diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index d7f7cc9..f34d96a 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -594,25 +594,20 @@ void FormulaParserImpl::initializeImport( const ScAddress& rBaseAddr, FormulaTyp mbRelativeAsOffset = mb2dRefsAs3dRefs = mbSpecialTokens = false; switch( eType ) { - case FORMULATYPE_CELL: + case FormulaType::Cell: mbSpecialTokens = true; break; - case FORMULATYPE_ARRAY: + case FormulaType::Array: break; - case FORMULATYPE_SHAREDFORMULA: + case FormulaType::SharedFormula: mbRelativeAsOffset = true; break; - case FORMULATYPE_CONDFORMAT: + case FormulaType::CondFormat: mbRelativeAsOffset = true; break; - case FORMULATYPE_VALIDATION: + case FormulaType::Validation: mbRelativeAsOffset = true; break; - case FORMULATYPE_DEFINEDNAME: - mbRelativeAsOffset = true; - // BIFF2-BIFF4: convert 2D references to absolute 3D references - mb2dRefsAs3dRefs = false; - break; } maTokenStorage.clear(); diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 95f8be4..189cd23 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -425,7 +425,7 @@ bool SheetDataContext::readCellHeader( SequenceInputStream& rStrm, CellType eCel ApiTokenSequence SheetDataContext::readCellFormula( SequenceInputStream& rStrm ) { rStrm.skip( 2 ); - return mxFormulaParser->importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); + return mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Cell, rStrm ); } bool SheetDataContext::readFormulaRef( SequenceInputStream& rStrm ) @@ -535,7 +535,7 @@ void SheetDataContext::importArray( SequenceInputStream& rStrm ) if( readFormulaRef( rStrm ) && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) { rStrm.skip( 1 ); - ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); + ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Array, rStrm ); mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, aTokens ); } } @@ -562,7 +562,7 @@ void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm ) { if( readFormulaRef( rStrm ) && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) { - ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); + ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::SharedFormula, rStrm ); mrSheetData.createSharedFormula( maCellData.maCellAddr, aTokens ); } } diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index 24f6443..a91b17a 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -138,8 +138,8 @@ void DataValidationsContextBase::importDataValidation( SequenceInputStream& rStr // condition formula(s) FormulaParser& rParser = rTarget.getFormulaParser(); ScAddress aBaseAddr = aModel.maRanges.GetTopLeftCorner(); - aModel.maTokens1 = rParser.importFormula(aBaseAddr, FORMULATYPE_VALIDATION, rStrm); - aModel.maTokens2 = rParser.importFormula(aBaseAddr, FORMULATYPE_VALIDATION, rStrm); + aModel.maTokens1 = rParser.importFormula(aBaseAddr, FormulaType::Validation, rStrm); + aModel.maTokens2 = rParser.importFormula(aBaseAddr, FormulaType::Validation, rStrm); // process string list of a list validation (convert to list of string tokens) if ((aModel.mnType == XML_list) && getFlag(nFlags, BIFF_DATAVAL_STRINGLIST)) rParser.convertStringToStringList(aModel.maTokens1, ',', true); commit 04004cc25905de47bb8406cb99be8fb34dd6f633 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:27:08 2017 +0200 convert FuncParamValidity to scoped enum and drop unused NONE enumerator Change-Id: Ibc77390efb195a9158ba809ad96aab4dcdbc09cb diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index 975e23c..5a71bf4 100755 --- a/compilerplugins/clang/unusedenumconstants.py +++ b/compilerplugins/clang/unusedenumconstants.py @@ -112,6 +112,7 @@ for d in definitionSet: "include/svtools/rtftoken.h", # RTF_TOKEN_IDS "starmath/source/mathtype.hxx", # MathType::MTOKENS "sd/source/filter/eppt/epptbase.hxx", # PPTExTextAttr + "sc/source/filter/inc/tokstack.hxx", # E_TYPE # unit test code "cppu/source/uno/check.cxx", # general weird nonsense going on diff --git a/sc/source/filter/inc/formulabase.hxx b/sc/source/filter/inc/formulabase.hxx index e217165..a192422 100644 --- a/sc/source/filter/inc/formulabase.hxx +++ b/sc/source/filter/inc/formulabase.hxx @@ -367,12 +367,11 @@ struct ApiOpCodes // Function parameter info ==================================================== /** Enumerates validity modes for a function parameter. */ -enum FuncParamValidity +enum class FuncParamValidity { - FUNC_PARAM_NONE = 0, /// Default for an unspecified entry in a C-array. - FUNC_PARAM_REGULAR, /// Parameter supported by Calc and Excel. - FUNC_PARAM_CALCONLY, /// Parameter supported by Calc only. - FUNC_PARAM_EXCELONLY /// Parameter supported by Excel only. + Regular, /// Parameter supported by Calc and Excel. + CalcOnly, /// Parameter supported by Calc only. + ExcelOnly /// Parameter supported by Excel only. }; /** Structure that contains all needed information for a parameter in a @@ -474,7 +473,7 @@ enum FunctionLibraryType The member mpParamInfos points to a C-array of type information structures for all parameters of the function. The last initialized structure - describing a regular parameter (member meValid == FUNC_PARAM_REGULAR) in + describing a regular parameter (member meValid == FuncParamValidity::Regular) in this array is used repeatedly for all following parameters supported by a function. */ diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 01de05a..d0e73d5 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -203,18 +203,18 @@ const sal_uInt8 V = BIFF_TOKCLASS_VAL; const sal_uInt8 A = BIFF_TOKCLASS_ARR; // abbreviations for parameter infos -#define RO { FUNC_PARAM_REGULAR } -#define RA { FUNC_PARAM_REGULAR } -#define RR { FUNC_PARAM_REGULAR } -#define RX { FUNC_PARAM_REGULAR } -#define VO { FUNC_PARAM_REGULAR } -#define VV { FUNC_PARAM_REGULAR } -#define VA { FUNC_PARAM_REGULAR } -#define VR { FUNC_PARAM_REGULAR } -#define VX { FUNC_PARAM_REGULAR } -#define RO_E { FUNC_PARAM_EXCELONLY } -#define VR_E { FUNC_PARAM_EXCELONLY } -#define C { FUNC_PARAM_CALCONLY } +#define RO { FuncParamValidity::Regular } +#define RA { FuncParamValidity::Regular } +#define RR { FuncParamValidity::Regular } +#define RX { FuncParamValidity::Regular } +#define VO { FuncParamValidity::Regular } +#define VV { FuncParamValidity::Regular } +#define VA { FuncParamValidity::Regular } +#define VR { FuncParamValidity::Regular } +#define VX { FuncParamValidity::Regular } +#define RO_E { FuncParamValidity::ExcelOnly } +#define VR_E { FuncParamValidity::ExcelOnly } +#define C { FuncParamValidity::CalcOnly } // Note: parameter types of all macro sheet functions (FUNCFLAG_MACROFUNC/FUNCFLAG_MACROCMD) untested! @@ -928,12 +928,12 @@ FunctionParamInfoIterator::FunctionParamInfoIterator( const FunctionInfo& rFuncI bool FunctionParamInfoIterator::isCalcOnlyParam() const { - return mpParamInfo && (mpParamInfo->meValid == FUNC_PARAM_CALCONLY); + return mpParamInfo && (mpParamInfo->meValid == FuncParamValidity::CalcOnly); } bool FunctionParamInfoIterator::isExcelOnlyParam() const { - return mpParamInfo && (mpParamInfo->meValid == FUNC_PARAM_EXCELONLY); + return mpParamInfo && (mpParamInfo->meValid == FuncParamValidity::ExcelOnly); } FunctionParamInfoIterator& FunctionParamInfoIterator::operator++() @@ -941,7 +941,7 @@ FunctionParamInfoIterator& FunctionParamInfoIterator::operator++() if( mpParamInfo ) { // move pointer to next entry, if something explicit follows - if( (mpParamInfo + 1 < mpParamInfoEnd) && (mpParamInfo[ 1 ].meValid != FUNC_PARAM_NONE) ) + if( mpParamInfo + 1 < mpParamInfoEnd ) ++mpParamInfo; // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it else if( isExcelOnlyParam() || isCalcOnlyParam() ) commit f4ae7da07703de3a7636f00213fd01cb548682a0 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:13:34 2017 +0200 convert WorksheetType to scoped enum and drop unused MODULE enumerator Change-Id: I905c6366bbd84172675e51a3f441d9ea419e8150 diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index 3c2276e..a63e048 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -58,14 +58,13 @@ class WorksheetSettings; typedef ::std::map< OUString, ScDataBarFormatData* > ExtLst; /** An enumeration for all types of sheets in a workbook. */ -enum WorksheetType +enum class WorksheetType { - SHEETTYPE_WORKSHEET, /// Worksheet. - SHEETTYPE_CHARTSHEET, /// Chart sheet. - SHEETTYPE_MACROSHEET, /// Macro sheet. - SHEETTYPE_DIALOGSHEET, /// Dialog sheet (BIFF5+). - SHEETTYPE_MODULESHEET, /// VB module sheet (BIFF5 only). - SHEETTYPE_EMPTYSHEET /// Other (unsupported) sheet type. + Work, /// Worksheet. + Chart, /// Chart sheet. + Macro, /// Macro sheet. + Dialog, /// Dialog sheet (BIFF5+). + Empty /// Other (unsupported) sheet type. }; /** Stores settings and formatting data about a range of sheet columns. */ diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 91a2e50..c3626c4 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -156,7 +156,7 @@ GroupShapeContext::GroupShapeContext( ContextHandler2Helper& rParent, { ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.GraphicObjectShape" ) ); if( pxShape ) *pxShape = xShape; - return new GraphicalObjectFrameContext( rParent, rxParentShape, xShape, rHelper.getSheetType() != SHEETTYPE_CHARTSHEET ); + return new GraphicalObjectFrameContext( rParent, rxParentShape, xShape, rHelper.getSheetType() != WorksheetType::Chart ); } case XDR_TOKEN( grpSp ): { diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index f8b1277..b0397f4 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -894,7 +894,7 @@ void PageSettingsConverter::writePageSettingsProperties( PropertySet& rPropSet, const PageSettingsModel& rModel, WorksheetType eSheetType ) { // special handling for chart sheets - bool bChartSheet = eSheetType == SHEETTYPE_CHARTSHEET; + bool bChartSheet = eSheetType == WorksheetType::Chart; // printout scaling if( bChartSheet ) diff --git a/sc/source/filter/oox/pivotcachefragment.cxx b/sc/source/filter/oox/pivotcachefragment.cxx index f324b12..caa7021 100644 --- a/sc/source/filter/oox/pivotcachefragment.cxx +++ b/sc/source/filter/oox/pivotcachefragment.cxx @@ -198,7 +198,7 @@ void PivotCacheDefinitionFragment::finalizeImport() if( !aRecFragmentPath.isEmpty() ) { SCTAB nSheet = mrPivotCache.getSourceRange().aStart.Tab(); - WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet ); + WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), WorksheetType::Work, nSheet ); if( xSheetGlob.get() ) importOoxFragment( new PivotCacheRecordsFragment( *xSheetGlob, aRecFragmentPath, mrPivotCache ) ); } diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index 6ac2ace..ffc9e75 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -327,7 +327,7 @@ void SheetViewSettings::finalizeImport() SheetViewModelRef xModel = maSheetViews.empty() ? createSheetView() : maSheetViews.front(); // #i59590# #158194# special handling for chart sheets (Excel ignores some settings in chart sheets) - if( getSheetType() == SHEETTYPE_CHARTSHEET ) + if( getSheetType() == WorksheetType::Chart ) { xModel->maPaneSelMap.clear(); xModel->maFirstPos = xModel->maSecondPos = ScAddress( SCCOL ( 0 ), SCROW ( 0 ), SCTAB (getSheetIndex() ) ); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 300b567..0416214 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -401,21 +401,21 @@ void WorkbookFragment::finalizeImport() ISegmentProgressBarRef xSheetSegment = getProgressBar().createSegment( fSegmentLength ); // get the sheet type according to the relations type - WorksheetType eSheetType = SHEETTYPE_EMPTYSHEET; + WorksheetType eSheetType = WorksheetType::Empty; if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "worksheet" ) || pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "worksheet" )) - eSheetType = SHEETTYPE_WORKSHEET; + eSheetType = WorksheetType::Work; else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "chartsheet" ) || pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "chartsheet" )) - eSheetType = SHEETTYPE_CHARTSHEET; + eSheetType = WorksheetType::Chart; else if( (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlMacrosheet" )) || (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlIntlMacrosheet" )) ) - eSheetType = SHEETTYPE_MACROSHEET; + eSheetType = WorksheetType::Macro; else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "dialogsheet" ) || pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT(" dialogsheet" )) - eSheetType = SHEETTYPE_DIALOGSHEET; - OSL_ENSURE( eSheetType != SHEETTYPE_EMPTYSHEET, "WorkbookFragment::finalizeImport - unknown sheet type" ); - if( eSheetType != SHEETTYPE_EMPTYSHEET ) + eSheetType = WorksheetType::Dialog; + OSL_ENSURE( eSheetType != WorksheetType::Empty, "WorkbookFragment::finalizeImport - unknown sheet type" ); + if( eSheetType != WorksheetType::Empty ) { // create the WorksheetGlobals object WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetSegment, eSheetType, nCalcSheet ); @@ -426,17 +426,16 @@ void WorkbookFragment::finalizeImport() ::rtl::Reference< WorksheetFragmentBase > xFragment; switch( eSheetType ) { - case SHEETTYPE_WORKSHEET: - case SHEETTYPE_MACROSHEET: - case SHEETTYPE_DIALOGSHEET: + case WorksheetType::Work: + case WorksheetType::Macro: + case WorksheetType::Dialog: xFragment.set( new WorksheetFragment( *xSheetGlob, aFragmentPath ) ); break; - case SHEETTYPE_CHARTSHEET: + case WorksheetType::Chart: xFragment.set( new ChartsheetFragment( *xSheetGlob, aFragmentPath ) ); break; // coverity[dead_error_begin] - following conditions exist to avoid compiler warning - case SHEETTYPE_EMPTYSHEET: - case SHEETTYPE_MODULESHEET: + case WorksheetType::Empty: break; } diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index c4882f8..24f6443 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -356,12 +356,11 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const { case XML_ROOT_CONTEXT: switch( getSheetType() ) { - case SHEETTYPE_WORKSHEET: return (nElement == XLS_TOKEN( worksheet )) ? this : nullptr; - case SHEETTYPE_CHARTSHEET: return nullptr; - case SHEETTYPE_MACROSHEET: return (nElement == XM_TOKEN( macrosheet )) ? this : nullptr; - case SHEETTYPE_DIALOGSHEET: return (nElement == XLS_TOKEN( dialogsheet )) ? this : nullptr; - case SHEETTYPE_MODULESHEET: return nullptr; - case SHEETTYPE_EMPTYSHEET: return nullptr; + case WorksheetType::Work: return (nElement == XLS_TOKEN( worksheet )) ? this : nullptr; + case WorksheetType::Chart: return nullptr; + case WorksheetType::Macro: return (nElement == XM_TOKEN( macrosheet )) ? this : nullptr; + case WorksheetType::Dialog: return (nElement == XLS_TOKEN( dialogsheet )) ? this : nullptr; + case WorksheetType::Empty: return nullptr; } break; diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 2fcc4d5..728a45a 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1164,7 +1164,7 @@ void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels, sal_Int32 nWidth = getUnitConverter().scaleToMm100( rModel.mfWidth, UNIT_DIGIT ); // macro sheets have double width - if( meSheetType == SHEETTYPE_MACROSHEET ) + if( meSheetType == WorksheetType::Macro ) nWidth *= 2; SCTAB nTab = getSheetIndex(); commit 3c96c22417a137fb7ac8dfc2ddb9b2c8f8923812 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:05:37 2017 +0200 convert SylkVersion to scoped enum Change-Id: Ib7e02fee748bd55be6d74d60bff3d8ed765ea225 diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index 5219c2c..975e23c 100755 --- a/compilerplugins/clang/unusedenumconstants.py +++ b/compilerplugins/clang/unusedenumconstants.py @@ -128,6 +128,7 @@ for d in definitionSet: "svtools/source/config/helpopt.cxx", # HelpProperty "include/svtools/htmltokn.h", "include/sfx2/sidebar/Theme.hxx", # ThemeItem + "sc/source/ui/docshell/impex.cxx", # SylkVersion # Windows or OSX only "include/canvas/rendering/icolorbuffer.hxx", "include/vcl/commandevent.hxx", diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index cf0fd2a..75ad60f 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -79,12 +79,12 @@ namespace } } -enum SylkVersion +enum class SylkVersion { - SYLK_SCALC3, // Wrote wrongly quoted strings and unescaped semicolons. - SYLK_OOO32, // Correct strings, plus multiline content. - SYLK_OWN, // Place our new versions, if any, before this value. - SYLK_OTHER // Assume that aliens wrote correct strings. + SCALC3, // Wrote wrongly quoted strings and unescaped semicolons. + OOO32, // Correct strings, plus multiline content. + OWN, // Place our new versions, if any, before this value. + OTHER // Assume that aliens wrote correct strings. }; // Whole document without Undo @@ -696,7 +696,7 @@ static void lcl_UnescapeSylk( OUString & rString, SylkVersion eVersion ) // Older versions didn't escape the semicolon. // Older versions quoted the string and doubled embedded quotes, but not // the semicolons, which was plain wrong. - if (eVersion >= SYLK_OOO32) + if (eVersion >= SylkVersion::OOO32) rString = rString.replaceAll(";;", ";"); else rString = rString.replaceAll("\"\"", "\""); @@ -714,7 +714,7 @@ static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p, if( *p == '"' ) { pEndQuote = p; - if (eVersion >= SYLK_OOO32) + if (eVersion >= SylkVersion::OOO32) { if (*(p+1) == ';') { @@ -750,7 +750,7 @@ static const sal_Unicode* lcl_ScanSylkFormula( const sal_Unicode* p, OUString& rString, SylkVersion eVersion ) { const sal_Unicode* pStart = p; - if (eVersion >= SYLK_OOO32) + if (eVersion >= SylkVersion::OOO32) { while (*p) { @@ -1712,7 +1712,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { bool bOk = true; bool bMyDoc = false; - SylkVersion eVersion = SYLK_OTHER; + SylkVersion eVersion = SylkVersion::OTHER; // US-English separators for StringToDouble sal_Unicode cDecSep = '.'; @@ -1941,10 +1941,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { aLine = aLine.copy(4); if (aLine == "CALCOOO32") - eVersion = SYLK_OOO32; + eVersion = SylkVersion::OOO32; else if (aLine == "SCALC3") - eVersion = SYLK_SCALC3; - bMyDoc = (eVersion <= SYLK_OWN); + eVersion = SylkVersion::SCALC3; + bMyDoc = (eVersion <= SylkVersion::OWN); } else if( cTag == 'E' ) // Ende break; commit d2871068d71aa35f4530081a2fe5ba9361c6eb20 Author: Noel Grandin <[email protected]> Date: Wed Feb 15 11:02:09 2017 +0200 convert DoubledQuoteMode to scoped enum and drop unused enumerators Change-Id: I0dc45e2bec1a25357405ca0c0197632ee4806cb0 diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index 4d45a42..5219c2c 100755 --- a/compilerplugins/clang/unusedenumconstants.py +++ b/compilerplugins/clang/unusedenumconstants.py @@ -154,6 +154,7 @@ for d in definitionSet: "sd/source/ui/inc/animobjs.hxx", # BitmapAdjustment (from UI) "sd/source/ui/dlg/PhotoAlbumDialog.hxx", # SlideImageLayout (from UI) "sd/inc/pres.hxx", # AutoLayout (from UI) + "sc/source/ui/inc/scuitphfedit.hxx", # ScHFEntryId (from UI) # represents constants from an external API "opencl/inc/opencl_device_selection.h", "vcl/inc/sft.hxx", diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 44694a5..cf0fd2a 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -630,19 +630,16 @@ static bool lcl_appendLineData( OUString& rField, const sal_Unicode* p1, const s } } -enum DoubledQuoteMode +enum class DoubledQuoteMode { - DQM_KEEP_ALL, // both are taken, additionally start and end quote are included in string - DQM_KEEP, // both are taken - DQM_ESCAPE, // escaped quote, one is taken, one ignored - DQM_CONCAT, // first is end, next is start, both ignored => strings combined - DQM_SEPARATE // end one string and begin next + KEEP_ALL, // both are taken, additionally start and end quote are included in string + ESCAPE, // escaped quote, one is taken, one ignored }; static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rString, const sal_Unicode* pSeps, sal_Unicode cStr, DoubledQuoteMode eMode, bool& rbOverflowCell ) { - if (eMode != DQM_KEEP_ALL) + if (eMode != DoubledQuoteMode::KEEP_ALL) p++; //! jump over opening quote bool bCont; do @@ -658,7 +655,7 @@ static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rStrin if ( *++p != cStr ) { // break or continue for loop - if (eMode == DQM_ESCAPE) + if (eMode == DoubledQuoteMode::ESCAPE) { if (lcl_isFieldEndQuote( p-1, pSeps) == FIELDEND_QUOTE) break; @@ -671,28 +668,15 @@ static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rStrin // doubled quote char switch ( eMode ) { - case DQM_KEEP_ALL : - case DQM_KEEP : + case DoubledQuoteMode::KEEP_ALL : p++; // both for us (not breaking for-loop) break; - case DQM_ESCAPE : + case DoubledQuoteMode::ESCAPE : p++; // one for us (breaking for-loop) bCont = true; // and more break; - case DQM_CONCAT : - if ( p0+1 < p ) - { - // first part - if (!lcl_appendLineData( rString, p0, p-1)) - rbOverflowCell = true; - } - p0 = ++p; // text of next part starts here - break; - case DQM_SEPARATE : - // positioned on next opening quote - break; } - if ( eMode == DQM_ESCAPE || eMode == DQM_SEPARATE ) + if ( eMode == DoubledQuoteMode::ESCAPE ) break; } else @@ -700,7 +684,7 @@ static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rStrin } if ( p0 < p ) { - if (!lcl_appendLineData( rString, p0, ((eMode != DQM_KEEP_ALL && (*p || *(p-1) == cStr)) ? p-1 : p))) + if (!lcl_appendLineData( rString, p0, ((eMode != DoubledQuoteMode::KEEP_ALL && (*p || *(p-1) == cStr)) ? p-1 : p))) rbOverflowCell = true; } } while ( bCont ); @@ -893,7 +877,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) { // Always look for a pairing quote and ignore separator in between. while (*p && *p == cStr) - q = p = lcl_ScanString( p, aCell, pSeps, cStr, DQM_KEEP_ALL, bOverflowCell ); + q = p = lcl_ScanString( p, aCell, pSeps, cStr, DoubledQuoteMode::KEEP_ALL, bOverflowCell ); // All until next separator or quote. while (*p && *p != cSep && *p != cStr) ++p; @@ -1548,7 +1532,7 @@ const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p { rbIsQuoted = true; const sal_Unicode* p1; - p1 = p = lcl_ScanString( p, rField, pSeps, cStr, DQM_ESCAPE, rbOverflowCell ); + p1 = p = lcl_ScanString( p, rField, pSeps, cStr, DoubledQuoteMode::ESCAPE, rbOverflowCell ); while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) ) p++; // Append remaining unquoted and undelimited data (dirty, dirty) to commit 48565c4bf1b9dc36666199e74e49ac3527b99cfb Author: Noel Grandin <[email protected]> Date: Wed Feb 15 10:45:43 2017 +0200 convert ScFilterBoxMode to scoped enum and drop unused enumerators Change-Id: I3f59622e17355ccc39597c0f79d4e254e6cc92c6 diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 8b02579..e4c3b6b 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -153,12 +153,10 @@ using namespace css::uno; #define SC_AUTOFILTER_EMPTY 3 #define SC_AUTOFILTER_NOTEMPTY 4 -enum ScFilterBoxMode +enum class ScFilterBoxMode { - SC_FILTERBOX_FILTER, - SC_FILTERBOX_DATASELECT, - SC_FILTERBOX_SCENARIO, - SC_FILTERBOX_PAGEFIELD + DataSelect, + Scenario }; struct ScGridWindow::MouseEventState @@ -206,7 +204,7 @@ private: bool bInit; bool bCancelled; bool bInSelect; - sal_uLong nSel; + sal_uLong nSel; ScFilterBoxMode eMode; protected: @@ -961,7 +959,7 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER))); mpFilterFloat->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) ); - mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, SC_FILTERBOX_SCENARIO)); + mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, ScFilterBoxMode::Scenario)); if (bLayoutRTL) mpFilterBox->EnableMirroring(); @@ -1085,8 +1083,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER))); mpFilterFloat->SetPopupModeEndHdl(LINK( this, ScGridWindow, PopupModeEndHdl)); - ScFilterBoxMode eFilterMode = SC_FILTERBOX_DATASELECT; - mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, eFilterMode)); + mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, ScFilterBoxMode::DataSelect)); // Fix for bug fdo#44925 if (AllSettings::GetLayoutRTL() != bLayoutRTL) mpFilterBox->EnableMirroring(); @@ -1225,19 +1222,12 @@ void ScGridWindow::FilterSelect( sal_uLong nSel ) SCROW nRow = mpFilterBox->GetRow(); switch (mpFilterBox->GetMode()) { - case SC_FILTERBOX_DATASELECT: + case ScFilterBoxMode::DataSelect: ExecDataSelect(nCol, nRow, aString); break; - case SC_FILTERBOX_FILTER: - ExecFilter(nSel, nCol, nRow, aString); - break; - case SC_FILTERBOX_SCENARIO: + case ScFilterBoxMode::Scenario: pViewData->GetView()->UseScenario(aString); break; - case SC_FILTERBOX_PAGEFIELD: - // first entry is "all" - ExecPageFieldSelect( nCol, nRow, (nSel != 0), aString ); - break; } if (mpFilterFloat) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
