summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-09-20 16:41:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-05 06:51:20 +0000
commit954f752cf10fc6a8777af2a6a93e496688464687 (patch)
tree0fc776cdcb6ad9b1d2b9673ac044bb5b4f496972 /starmath
parentc1e18e05a53c1d55afe36a887ca25f74f3f1d32d (diff)
convert MapUnit to scoped enum
I left a prefix on the names "Map" so that I would not have to re-arrange each name too much, since I can't start identifiers with digits like "100thMM" And remove RSC_EXTRAMAPUNIT, which doesn't seem to be doing anything anymore. Change-Id: I5187824aa87e30caf5357b51b5384b5ab919d224 Reviewed-on: https://gerrit.libreoffice.org/29096 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/ElementsDockingWindow.cxx6
-rw-r--r--starmath/source/accessibility.cxx2
-rw-r--r--starmath/source/dialog.cxx6
-rw-r--r--starmath/source/document.cxx28
-rw-r--r--starmath/source/edit.cxx2
-rw-r--r--starmath/source/tmpdevice.cxx4
-rw-r--r--starmath/source/unomodel.cxx2
-rw-r--r--starmath/source/view.cxx30
8 files changed, 40 insertions, 40 deletions
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 1f4ef1f39c08..fe517fbc5e11 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -229,7 +229,7 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
, mxScroll(VclPtr<ScrollBar>::Create(this, WB_VERT))
{
set_id("element_selector");
- SetMapMode( MapMode(MAP_100TH_MM) );
+ SetMapMode( MapMode(MapUnit::Map100thMM) );
SetDrawMode( DrawModeFlags::Default );
SetLayoutMode( ComplexTextLayoutFlags::Default );
SetDigitLanguage( LANGUAGE_ENGLISH );
@@ -515,7 +515,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin
pNode->SetSize(Fraction(10,8));
pNode->Arrange(*this, maFormat);
- Size aSizePixel = LogicToPixel(Size(pNode->GetWidth(), pNode->GetHeight()), MAP_100TH_MM);
+ Size aSizePixel = LogicToPixel(Size(pNode->GetWidth(), pNode->GetHeight()), MapUnit::Map100thMM);
if (aSizePixel.Width() > maMaxElementDimensions.Width()) {
maMaxElementDimensions.Width() = aSizePixel.Width();
}
@@ -682,7 +682,7 @@ void SmElementsControl::build()
Size SmElementsControl::GetOptimalSize() const
{
- return LogicToPixel(Size(100, 100), MapMode(MAP_APPFONT));
+ return LogicToPixel(Size(100, 100), MapMode(MapUnit::MapAppFont));
}
FactoryFunction SmElementsControl::GetUITestFactory() const
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 5883f3c594df..fece32e4c63c 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -1268,7 +1268,7 @@ Rectangle SmTextForwarder::GetParaBounds( sal_Int32 nPara ) const
MapMode SmTextForwarder::GetMapMode() const
{
EditEngine *pEditEngine = rEditAcc.GetEditEngine();
- return pEditEngine ? pEditEngine->GetRefMapMode() : MapMode( MAP_100TH_MM );
+ return pEditEngine ? pEditEngine->GetRefMapMode() : MapMode( MapUnit::Map100thMM );
}
OutputDevice* SmTextForwarder::GetRefDevice() const
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 73bc61fb074f..a1a15aefa285 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -290,7 +290,7 @@ VCL_BUILDER_DECL_FACTORY(SmShowFont)
Size SmShowFont::GetOptimalSize() const
{
- return LogicToPixel(Size(111 , 31), MapMode(MAP_APPFONT));
+ return LogicToPixel(Size(111 , 31), MapMode(MapUnit::MapAppFont));
}
void SmShowFont::SetFont(const vcl::Font& rFont)
@@ -1132,7 +1132,7 @@ void SmShowSymbolSetWindow::Paint(vcl::RenderContext& rRenderContext, const Rect
rRenderContext.Push(PushFlags::MAPMODE);
// set MapUnit for which 'nLen' has been calculated
- rRenderContext.SetMapMode(MapMode(MAP_PIXEL));
+ rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel));
sal_uInt16 v = sal::static_int_cast< sal_uInt16 >((m_pVScrollBar->GetThumbPos() * nColumns));
size_t nSymbols = aSymbolSet.size();
@@ -1278,7 +1278,7 @@ VCL_BUILDER_FACTORY(SmShowSymbolSet)
void SmShowSymbolSetWindow::calccols()
{
// Height of 16pt in pixels (matching 'aOutputSize')
- nLen = LogicToPixel(Size(0, 16), MapMode(MAP_POINT)).Height();
+ nLen = LogicToPixel(Size(0, 16), MapMode(MapUnit::MapPoint)).Height();
Size aOutputSize = GetOutputSizePixel();
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 1af687b4ce21..deb7d1514003 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -262,10 +262,10 @@ void SmDocShell::ArrangeFormula()
else
{
pOutDev = &SM_MOD()->GetDefaultVirtualDev();
- pOutDev->SetMapMode( MapMode(MAP_100TH_MM) );
+ pOutDev->SetMapMode( MapMode(MapUnit::Map100thMM) );
}
}
- OSL_ENSURE(pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM,
+ OSL_ENSURE(pOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM,
"Sm : falscher MapMode");
const SmFormat &rFormat = GetFormat();
@@ -334,7 +334,7 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool)
// set font heights
SvxFontHeightItem aFontHeigt(
Application::GetDefaultDevice()->LogicToPixel(
- Size( 0, 11 ), MapMode( MAP_POINT ) ).Height(), 100,
+ Size( 0, 11 ), MapMode( MapUnit::MapPoint ) ).Height(), 100,
EE_CHAR_FONTHEIGHT );
rEditEngineItemPool.SetPoolDefaultItem( aFontHeigt );
aFontHeigt.SetWhich( EE_CHAR_FONTHEIGHT_CJK );
@@ -368,7 +368,7 @@ EditEngine& SmDocShell::GetEditEngine()
EEControlBits(~EEControlBits::PASTESPECIAL) );
mpEditEngine->SetWordDelimiters(" .=+-*/(){}[];\"");
- mpEditEngine->SetRefMapMode( MAP_PIXEL );
+ mpEditEngine->SetRefMapMode( MapUnit::MapPixel );
mpEditEngine->SetPaperSize( Size( 800, 0 ) );
@@ -507,13 +507,13 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
//!this class.
const MapUnit eOld = pPrinter->GetMapMode().GetMapUnit();
- if ( MAP_100TH_MM != eOld )
+ if ( MapUnit::Map100thMM != eOld )
{
MapMode aMap( pPrinter->GetMapMode() );
- aMap.SetMapUnit( MAP_100TH_MM );
+ aMap.SetMapUnit( MapUnit::Map100thMM );
Point aTmp( aMap.GetOrigin() );
- aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MAP_100TH_MM );
- aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MAP_100TH_MM );
+ aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MapUnit::Map100thMM );
+ aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MapUnit::Map100thMM );
aMap.SetOrigin( aTmp );
pPrinter->SetMapMode( aMap );
}
@@ -532,13 +532,13 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
//!this class.
const MapUnit eOld = pRefDev->GetMapMode().GetMapUnit();
- if ( MAP_100TH_MM != eOld )
+ if ( MapUnit::Map100thMM != eOld )
{
MapMode aMap( pRefDev->GetMapMode() );
- aMap.SetMapUnit( MAP_100TH_MM );
+ aMap.SetMapUnit( MapUnit::Map100thMM );
Point aTmp( aMap.GetOrigin() );
- aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MAP_100TH_MM );
- aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MAP_100TH_MM );
+ aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MapUnit::Map100thMM );
+ aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MapUnit::Map100thMM );
aMap.SetOrigin( aTmp );
pRefDev->SetMapMode( aMap );
}
@@ -581,7 +581,7 @@ Printer* SmDocShell::GetPrt()
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pOptions);
mpPrinter = VclPtr<SfxPrinter>::Create(pOptions);
- mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
+ mpPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
}
return mpPrinter;
}
@@ -602,7 +602,7 @@ void SmDocShell::SetPrinter( SfxPrinter *pNew )
{
mpPrinter.disposeAndClear();
mpPrinter = pNew; //Transfer ownership
- mpPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
+ mpPrinter->SetMapMode( MapMode(MapUnit::Map100thMM) );
SetFormulaArranged(false);
Repaint();
}
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 109ad5ed819a..f13aaf8c6246 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -90,7 +90,7 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
{
set_id("math_edit");
SetHelpId(HID_SMA_COMMAND_WIN_EDIT);
- SetMapMode(MAP_PIXEL);
+ SetMapMode(MapUnit::MapPixel);
// Even RTL languages don't use RTL for math
EnableRTL( false );
diff --git a/starmath/source/tmpdevice.cxx b/starmath/source/tmpdevice.cxx
index b6232bd3a013..ca0ee8f8b356 100644
--- a/starmath/source/tmpdevice.cxx
+++ b/starmath/source/tmpdevice.cxx
@@ -35,10 +35,10 @@ SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev, bool bUseMap100th_mm) :
{
rOutDev.Push( PushFlags::FONT | PushFlags::MAPMODE |
PushFlags::LINECOLOR | PushFlags::FILLCOLOR | PushFlags::TEXTCOLOR );
- if (bUseMap100th_mm && MAP_100TH_MM != rOutDev.GetMapMode().GetMapUnit())
+ if (bUseMap100th_mm && MapUnit::Map100thMM != rOutDev.GetMapMode().GetMapUnit())
{
SAL_WARN("starmath", "incorrect MapMode?");
- rOutDev.SetMapMode( MAP_100TH_MM ); //format for 100% always
+ rOutDev.SetMapMode( MapUnit::Map100thMM ); //format for 100% always
}
}
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index efe052e24983..fdc6f51328f7 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -1003,7 +1003,7 @@ void SAL_CALL SmModel::render(
if (!pOut)
throw RuntimeException();
- pOut->SetMapMode( MAP_100TH_MM );
+ pOut->SetMapMode( MapUnit::Map100thMM );
uno::Reference< frame::XModel > xModel;
rSelection >>= xModel;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index a2f7fa8b2814..3bd645a314bf 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -104,7 +104,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell)
Hide();
const Fraction aFraction(1, 1);
- SetMapMode(MapMode(MAP_100TH_MM, Point(), aFraction, aFraction));
+ SetMapMode(MapMode(MapUnit::Map100thMM, Point(), aFraction, aFraction));
SetTotalSize();
@@ -584,7 +584,7 @@ void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
{
nZoom = std::min(std::max(Factor, MINZOOM), MAXZOOM);
Fraction aFraction (nZoom, 100);
- SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction) );
+ SetMapMode( MapMode(MapUnit::Map100thMM, Point(), aFraction, aFraction) );
SetTotalSize();
SmViewShell *pViewSh = GetView();
if (pViewSh)
@@ -601,7 +601,7 @@ void SmGraphicWindow::ZoomToFitInWindow()
SmDocShell &rDoc = *pViewShell->GetDoc();
// set defined mapmode before calling 'LogicToPixel' below
- SetMapMode(MapMode(MAP_100TH_MM));
+ SetMapMode(MapMode(MapUnit::Map100thMM));
Size aSize (LogicToPixel(rDoc.GetSize()));
Size aWindowSize (GetSizePixel());
@@ -675,7 +675,7 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi
bExiting (false)
{
SetHelpId( HID_SMA_COMMAND_WIN );
- SetSizePixel(LogicToPixel(Size(292 , 94), MapMode(MAP_APPFONT)));
+ SetSizePixel(LogicToPixel(Size(292 , 94), MapMode(MapUnit::MapAppFont)));
SetText(SM_RESSTR(STR_CMDBOXWINDOW));
Hide();
@@ -896,7 +896,7 @@ void SmViewShell::InnerResizePixel(const Point &rOfs, const Size &rSize)
Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
{
- Size aProvidedSize = GetWindow()->PixelToLogic( rSize, MAP_100TH_MM );
+ Size aProvidedSize = GetWindow()->PixelToLogic( rSize, MapUnit::Map100thMM );
SfxViewShell::SetZoomFactor( Fraction( aProvidedSize.Width(), aObjSize.Width() ),
Fraction( aProvidedSize.Height(), aObjSize.Height() ) );
}
@@ -1198,44 +1198,44 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
switch (ePrintSize)
{
case PRINT_SIZE_NORMAL:
- OutputMapMode = MapMode(MAP_100TH_MM);
+ OutputMapMode = MapMode(MapUnit::Map100thMM);
break;
case PRINT_SIZE_SCALED:
if ((aSize.Width() > 0) && (aSize.Height() > 0))
{
Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
- aOutRect.GetHeight()), MapMode(MAP_100TH_MM)));
- Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MAP_100TH_MM)));
+ aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM)));
+ Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM)));
sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width() * 100L, GraphicSize.Width())),
long(Fraction(OutputSize.Height() * 100L, GraphicSize.Height()))));
nZ -= 10;
Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100);
- OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
+ OutputMapMode = MapMode(MapUnit::Map100thMM, aZeroPoint, aFraction, aFraction);
}
else
- OutputMapMode = MapMode(MAP_100TH_MM);
+ OutputMapMode = MapMode(MapUnit::Map100thMM);
break;
case PRINT_SIZE_ZOOMED:
{
Fraction aFraction( nZoomFactor, 100 );
- OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
+ OutputMapMode = MapMode(MapUnit::Map100thMM, aZeroPoint, aFraction, aFraction);
break;
}
}
aSize = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aSize, OutputMapMode),
- MapMode(MAP_100TH_MM));
+ MapMode(MapUnit::Map100thMM));
Point aPos (aOutRect.Left() + (aOutRect.GetWidth() - aSize.Width()) / 2,
aOutRect.Top() + (aOutRect.GetHeight() - aSize.Height()) / 2);
- aPos = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aPos, MapMode(MAP_100TH_MM)),
+ aPos = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aPos, MapMode(MapUnit::Map100thMM)),
OutputMapMode);
- aOutRect = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aOutRect, MapMode(MAP_100TH_MM)),
+ aOutRect = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aOutRect, MapMode(MapUnit::Map100thMM)),
OutputMapMode);
rOutDev.SetMapMode(OutputMapMode);
@@ -1760,7 +1760,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SvxZoomType::PAGEWIDTH:
case SvxZoomType::WHOLEPAGE:
{
- const MapMode aMap( MAP_100TH_MM );
+ const MapMode aMap( MapUnit::Map100thMM );
SfxPrinter *pPrinter = GetPrinter( true );
Point aPoint;
Rectangle OutputRect(aPoint, pPrinter->GetOutputSize());