diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-14 00:09:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-13 23:38:37 +0100 |
commit | 7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 (patch) | |
tree | e40626d45db8a228defeca6e66aba9055974d0a6 | |
parent | use new method too in existing unit tests in svdraw.cxx (diff) | |
download | core-7b8f630db30ee0066a9f4b6e540368d2fcad7fa8.tar.gz core-7b8f630db30ee0066a9f4b6e540368d2fcad7fa8.zip |
Use o3tl::convert
Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | editeng/source/items/numitem.cxx | 4 | ||||
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 19 | ||||
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 9 | ||||
-rw-r--r-- | filter/source/msfilter/eschesdo.cxx | 11 | ||||
-rw-r--r-- | filter/source/msfilter/eschesdo.hxx | 6 | ||||
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx | 28 | ||||
-rw-r--r-- | libreofficekit/source/gtk/tilebuffer.cxx | 7 | ||||
-rw-r--r-- | libreofficekit/source/gtk/tilebuffer.hxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/number.cxx | 30 | ||||
-rw-r--r-- | vcl/win/dtrans/FmtFilter.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/dmapper/ConversionHelper.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 29 |
14 files changed, 89 insertions, 87 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index b862b866c50f..7d897595b0ef 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -698,11 +698,11 @@ SvxNumRule::SvxNumRule( SvxNumRuleFlags nFeatures, SvxNumberFormat::LABEL_ALIGNMENT ) { // first line indent of general numbering in inch: -0,25 inch - const tools::Long cFirstLineIndent = -1440/4; + constexpr tools::Long cFirstLineIndent = o3tl::toTwips(-0.25, o3tl::Length::in); // indent values of general numbering in inch: // 0,5 0,75 1,0 1,25 1,5 // 1,75 2,0 2,25 2,5 2,75 - const tools::Long cIndentAt = 1440/4; + constexpr tools::Long cIndentAt = o3tl::toTwips(0.25, o3tl::Length::in); aFmts[i]->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); aFmts[i]->SetListtabPos( cIndentAt * (i+2) ); diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index d0b11110e65a..1aec0c704926 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -40,6 +40,7 @@ #include <osl/file.hxx> #include <rtl/ref.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/unit_conversion.hxx> #include <systools/win32/comtools.hxx> #include <vcl/threadex.hxx> @@ -1031,27 +1032,23 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect ) if ( pMF ) { // the object uses 0.01 mm as unit, so the metafile size should be converted to object unit - sal_Int64 nMult = 1; - sal_Int64 nDiv = 1; + o3tl::Length eFrom = o3tl::Length::mm100; switch( pMF->mm ) { case MM_HIENGLISH: - nMult = 254; - nDiv = 100; + eFrom = o3tl::Length::in1000; break; case MM_LOENGLISH: - nMult = 254; - nDiv = 10; + eFrom = o3tl::Length::in100; break; case MM_LOMETRIC: - nMult = 10; + eFrom = o3tl::Length::mm10; break; case MM_TWIPS: - nMult = 254; - nDiv = 144; + eFrom = o3tl::Length::twip; break; case MM_ISOTROPIC: @@ -1061,8 +1058,8 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect ) break; } - sal_Int64 nX = static_cast<sal_Int64>(abs( pMF->xExt )) * nMult / nDiv; - sal_Int64 nY = static_cast<sal_Int64>(abs( pMF->yExt )) * nMult / nDiv; + sal_Int64 nX = o3tl::convert(abs( pMF->xExt ), eFrom, o3tl::Length::mm100); + sal_Int64 nY = o3tl::convert(abs( pMF->yExt ), eFrom, o3tl::Length::mm100); if ( nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 ) { aSize.Width = static_cast<sal_Int32>(nX); diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index e79c26a2a0d5..0c4469d62e80 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -62,6 +62,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <o3tl/any.hxx> +#include <o3tl/unit_conversion.hxx> #include <osl/diagnose.h> #include <rtl/process.h> #include <rtl/ref.hxx> @@ -1073,8 +1074,8 @@ HRESULT DocumentHolder::SetExtent( const SIZEL *pSize ) if ( aMapMode == embed::EmbedMapUnits::TWIP ) { // conversion from ONE_100TH_MM - aNewSize.Width = aNewSize.Width * 144 / 254; - aNewSize.Height = aNewSize.Height * 144 / 254; + aNewSize.Width = o3tl::toTwips(aNewSize.Width, o3tl::Length::mm100); + aNewSize.Height = o3tl::toTwips(aNewSize.Height, o3tl::Length::mm100); } @@ -1107,8 +1108,8 @@ HRESULT DocumentHolder::GetExtent( SIZEL *pSize ) if ( aMapMode == embed::EmbedMapUnits::TWIP ) { // conversion to ONE_100TH_MM - aDocSize.Width = aDocSize.Width * 254 / 144; - aDocSize.Height = aDocSize.Height * 254 / 144; + aDocSize.Width = o3tl::convert(aDocSize.Width, o3tl::Length::twip, o3tl::Length::mm100); + aDocSize.Height = o3tl::convert(aDocSize.Height, o3tl::Length::twip, o3tl::Length::mm100); } pSize->cx = aDocSize.Width; diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index f73ffd2b29da..114e2c9304f9 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -23,7 +23,6 @@ #include <svx/svdobj.hxx> #include <svx/unoapi.hxx> #include <svx/unoshape.hxx> -#include <vcl/outdev.hxx> #include <tools/poly.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -47,13 +46,11 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::task; using namespace ::com::sun::star::style; -#define EES_MAP_FRACTION 1440 // 1440 dpi - ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx ) : mpEscherEx(&rEx) - , maMapModeSrc(MapUnit::Map100thMM) + , meUnitsSrc(o3tl::Length::mm100) // PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi - , maMapModeDest( MapUnit::MapInch, Point(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) ) + , meUnitsDest(o3tl::Length::twip) , mpPicStrm(nullptr) , mpHostAppData(nullptr) , mbIsTitlePossible(false) @@ -65,12 +62,12 @@ ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx ) Point ImplEESdrWriter::ImplMapPoint( const Point& rPoint ) { - return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest ); + return o3tl::convert( rPoint, meUnitsSrc, meUnitsDest ); } Size ImplEESdrWriter::ImplMapSize( const Size& rSize ) { - Size aRetSize( OutputDevice::LogicToLogic( rSize, maMapModeSrc, maMapModeDest ) ); + Size aRetSize( o3tl::convert( rSize, meUnitsSrc, meUnitsDest ) ); if ( !aRetSize.Width() ) aRetSize.AdjustWidth( 1 ); diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx index 114efca4092f..6d5f84f6a760 100644 --- a/filter/source/msfilter/eschesdo.hxx +++ b/filter/source/msfilter/eschesdo.hxx @@ -19,7 +19,7 @@ #pragma once #include <filter/msfilter/escherex.hxx> #include <o3tl/any.hxx> -#include <vcl/mapmod.hxx> +#include <o3tl/unit_conversion.hxx> // fractions of Draw PPTWriter etc. @@ -100,8 +100,8 @@ class EscherExHostAppData; class ImplEESdrWriter { EscherEx* mpEscherEx; - MapMode maMapModeSrc; - MapMode maMapModeDest; + o3tl::Length meUnitsSrc; + o3tl::Length meUnitsDest; css::uno::Reference< css::drawing::XDrawPage > mXDrawPage; css::uno::Reference< css::drawing::XShapes > mXShapes; SvStream* mpPicStrm; diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx index a67d3427eae5..4d889645b2fc 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx @@ -20,6 +20,8 @@ #include "gtv-lok-dialog.hxx" #include <com/sun/star/awt/Key.hpp> + +#include <o3tl/unit_conversion.hxx> #include <vcl/event.hxx> namespace { @@ -83,20 +85,6 @@ getPrivate(GtvLokDialog* dialog) return static_cast<GtvLokDialogPrivate*>(gtv_lok_dialog_get_instance_private(dialog)); } -static float -pixelToTwip(float fInput) -{ - return (fInput / 96 / 1.0 /* zoom */) * 1440.0f; -} - -#if 0 -static float -twipToPixel(float fInput) -{ - return fInput / 1440.0f * 96 * 1.0 /* zoom */; -} -#endif - static void gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer) { @@ -235,8 +223,8 @@ gtv_lok_dialog_signal_motion(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve g_info("lok_dialog_signal_motion: %d, %d (in twips: %d, %d)", static_cast<int>(pEvent->x), static_cast<int>(pEvent->y), - static_cast<int>(pixelToTwip(pEvent->x)), - static_cast<int>(pixelToTwip(pEvent->y))); + static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)), + static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px))); pDocument->pClass->postWindowMouseEvent(pDocument, priv->dialogid, @@ -531,8 +519,8 @@ gtv_lok_dialog_floating_win_signal_button(GtkWidget* /*pDialogChildDrawingArea*/ g_info("lok_dialog_floating_win_signal_button (type: %s): %d, %d (in twips: %d, %d)", aEventType.c_str(), static_cast<int>(pEvent->x), static_cast<int>(pEvent->y), - static_cast<int>(pixelToTwip(pEvent->x)), - static_cast<int>(pixelToTwip(pEvent->y))); + static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)), + static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px))); switch (pEvent->type) { @@ -614,8 +602,8 @@ gtv_lok_dialog_floating_win_signal_motion(GtkWidget* /*pDialogDrawingArea*/, Gdk g_info("lok_dialog_floating_win_signal_motion: %d, %d (in twips: %d, %d)", static_cast<int>(pEvent->x), static_cast<int>(pEvent->y), - static_cast<int>(pixelToTwip(pEvent->x)), - static_cast<int>(pixelToTwip(pEvent->y))); + static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)), + static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px))); pDocument->pClass->postWindowMouseEvent(pDocument, priv->m_nChildId, diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx index 6836031661bc..3c73c9dddf83 100644 --- a/libreofficekit/source/gtk/tilebuffer.cxx +++ b/libreofficekit/source/gtk/tilebuffer.cxx @@ -9,19 +9,22 @@ #include "tilebuffer.hxx" +#include <o3tl/unit_conversion.hxx> + /* ------------------ Utility functions ------------------ */ +// We know that VirtualDevices use a DPI of 96. float pixelToTwip(float fInput, float zoom) { - return (fInput / DPI / zoom) * 1440.0f; + return o3tl::toTwips(fInput / zoom, o3tl::Length::px); } float twipToPixel(float fInput, float zoom) { - return fInput / 1440.0f * DPI * zoom; + return o3tl::convert(fInput * zoom, o3tl::Length::twip, o3tl::Length::px); } /* ---------------------------- diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx index 79fa48c555db..239482e34625 100644 --- a/libreofficekit/source/gtk/tilebuffer.hxx +++ b/libreofficekit/source/gtk/tilebuffer.hxx @@ -18,8 +18,6 @@ #define LOK_TILEBUFFER_ERROR (LOKTileBufferErrorQuark()) -// We know that VirtualDevices use a DPI of 96. -const int DPI = 96; // Lets use a square of side 256 pixels for each tile. const int nTileSizePixels = 256; diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 4f8740cf9101..856281ea42e0 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -106,6 +106,7 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> #include <o3tl/cppunittraitshelper.hxx> +#include <o3tl/unit_conversion.hxx> #include <osl/file.hxx> #include <osl/thread.hxx> #include <paratr.hxx> @@ -1475,7 +1476,8 @@ void SwUiWriterTest4::testTdf104425() = getXPath(pXmlDoc, "//page[2]/body/tab/row/infos/bounds", "height").toInt32(); sal_Int32 nHeight3 = getXPath(pXmlDoc, "//page[3]/body/tab/row/infos/bounds", "height").toInt32(); - double fSumHeight_mm = (nHeight1 + nHeight2 + nHeight3) * 25.4 / 1440.0; + double fSumHeight_mm = o3tl::convert<double>(nHeight1 + nHeight2 + nHeight3, o3tl::Length::twip, + o3tl::Length::mm); CPPUNIT_ASSERT_DOUBLES_EQUAL(700.0, fSumHeight_mm, 0.05); } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 31058b4caf62..d22fee74ca79 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -90,17 +90,17 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId, sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight; if( RES_POOLPAGE_HTML == nPoolFormatId ) { - nMinRight = nMinTop = nMinBottom = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip); - nMinLeft = o3tl::convert(2, o3tl::Length::cm, o3tl::Length::twip); + nMinRight = nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::cm); + nMinLeft = o3tl::toTwips(2, o3tl::Length::cm); } else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ) { - nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimeters + nMinTop = nMinBottom = nMinLeft = nMinRight = o3tl::toTwips(2, o3tl::Length::cm); } else { - nMinTop = nMinBottom = 1440; // as in MS Word: 1 Inch - nMinLeft = nMinRight = 1800; // 1,25 Inch + nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::in); // as in MS Word + nMinLeft = nMinRight = o3tl::toTwips(1.25, o3tl::Length::in); } // set margins diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 2f4cdf32b304..acb142b09988 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -66,9 +66,16 @@ SwNumFormat* SwNumRule::saLabelAlignmentBaseFormats[ RULE_END ][ MAXLEVEL ] = { {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } }; const sal_uInt16 SwNumRule::saDefNumIndents[ MAXLEVEL ] = { -//inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 - 1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2, - 1440*9/4, 1440*5/2 + o3tl::toTwips(25, o3tl::Length::in100), + o3tl::toTwips(50, o3tl::Length::in100), + o3tl::toTwips(75, o3tl::Length::in100), + o3tl::toTwips(100, o3tl::Length::in100), + o3tl::toTwips(125, o3tl::Length::in100), + o3tl::toTwips(150, o3tl::Length::in100), + o3tl::toTwips(175, o3tl::Length::in100), + o3tl::toTwips(200, o3tl::Length::in100), + o3tl::toTwips(225, o3tl::Length::in100), + o3tl::toTwips(250, o3tl::Length::in100), }; OUString SwNumRule::GetOutlineRuleName() @@ -391,13 +398,20 @@ SwNumRule::SwNumRule( const OUString& rNm, } // position-and-space mode LABEL_ALIGNMENT // first line indent of general numbering in inch: -0,25 inch - const tools::Long cFirstLineIndent = -1440/4; + const tools::Long cFirstLineIndent = o3tl::toTwips(-0.25, o3tl::Length::in); // indent values of general numbering in inch: - // 0,5 0,75 1,0 1,25 1,5 - // 1,75 2,0 2,25 2,5 2,75 const tools::Long cIndentAt[ MAXLEVEL ] = { - 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, - 1440*7/4, 1440*2, 1440*9/4, 1440*5/2, 1440*11/4 }; + o3tl::toTwips(50, o3tl::Length::in100), + o3tl::toTwips(75, o3tl::Length::in100), + o3tl::toTwips(100, o3tl::Length::in100), + o3tl::toTwips(125, o3tl::Length::in100), + o3tl::toTwips(150, o3tl::Length::in100), + o3tl::toTwips(175, o3tl::Length::in100), + o3tl::toTwips(200, o3tl::Length::in100), + o3tl::toTwips(225, o3tl::Length::in100), + o3tl::toTwips(250, o3tl::Length::in100), + o3tl::toTwips(275, o3tl::Length::in100), + }; for( n = 0; n < MAXLEVEL; ++n ) { pFormat = new SwNumFormat; diff --git a/vcl/win/dtrans/FmtFilter.cxx b/vcl/win/dtrans/FmtFilter.cxx index 535f6c122712..27d051f7e8a7 100644 --- a/vcl/win/dtrans/FmtFilter.cxx +++ b/vcl/win/dtrans/FmtFilter.cxx @@ -22,6 +22,7 @@ #include "FmtFilter.hxx" #include <o3tl/safeint.hxx> +#include <o3tl/unit_conversion.hxx> #include <osl/diagnose.h> #include <shobjidl.h> @@ -79,33 +80,33 @@ Sequence< sal_Int8 > WinMFPictToOOMFPict( Sequence< sal_Int8 >& aMetaFilePict ) switch( pMFPict->mm ) { case MM_TEXT: - nInch = 72; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::pt); break; case MM_LOMETRIC: - nInch = 100; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm10); break; case MM_HIMETRIC: - nInch = 1000; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100); break; case MM_LOENGLISH: - nInch = 254; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::in100); break; case MM_HIENGLISH: case MM_ISOTROPIC: case MM_ANISOTROPIC: - nInch = 2540; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::in1000); break; case MM_TWIPS: - nInch = 1440; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::twip); break; default: - nInch = 576; + nInch = o3tl::convert(1, o3tl::Length::in, o3tl::Length::master); } pMFHeader->key = 0x9AC6CDD7L; diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 307da49db4e9..59e2e48d68be 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -434,7 +434,7 @@ double convertTwipToMM100Double(sal_Int32 _t) // anything that's bigger than 32767 appears to be simply ignored. if( _t >= 0x8000 ) return 0.0; - return _t * 254.0 / 144.0; + return o3tl::convert<double>(_t, o3tl::Length::twip, o3tl::Length::mm100); } sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index dc833c363571..8634d66e1ae5 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -63,6 +63,7 @@ #include <tools/diagnose_ex.h> #include "PropertyMapHelper.hxx" #include <o3tl/sorted_vector.hxx> +#include <o3tl/unit_conversion.hxx> using namespace com::sun::star; @@ -411,13 +412,13 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection ) , m_nPageNumber( -1 ) , m_nPageNumberType( -1 ) , m_nBreakType( -1 ) - , m_nLeftMargin( 2540 ) // page left margin, default 1 inch = 1440 twip -> 2540 1/100 mm - , m_nRightMargin( 2540 ) // page right margin, default 1 inch = 1440 twip -> 2540 1/100 mm + , m_nLeftMargin( o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100) ) + , m_nRightMargin( o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100) ) , m_nGutterMargin(0) - , m_nTopMargin( 2540 ) - , m_nBottomMargin( 2540 ) - , m_nHeaderTop( 1270 ) // 720 twip - , m_nHeaderBottom( 1270 ) // 720 twip + , m_nTopMargin( o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100) ) + , m_nBottomMargin( o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100) ) + , m_nHeaderTop( o3tl::convert(0.5, o3tl::Length::in, o3tl::Length::mm100) ) + , m_nHeaderBottom( o3tl::convert(0.5, o3tl::Length::in, o3tl::Length::mm100) ) , m_nGridType( 0 ) , m_nGridLinePitch( 1 ) , m_nDxtCharSpace( 0 ) @@ -452,14 +453,14 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection ) Insert( PROP_HEIGHT, uno::makeAny( static_cast<sal_Int32>(aLetter.getHeight()) ) ); // page width, 1/100mm Insert( PROP_WIDTH, uno::makeAny( static_cast<sal_Int32>(aLetter.getWidth()) ) ); - // page left margin, default 0x5a0 (1440) twip -> 2540 1/100 mm - Insert( PROP_LEFT_MARGIN, uno::makeAny( sal_Int32(2540) ) ); - // page right margin, default 0x5a0 (1440) twip -> 2540 1/100 mm - Insert( PROP_RIGHT_MARGIN, uno::makeAny( sal_Int32(2540) ) ); - // page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm - Insert( PROP_TOP_MARGIN, uno::makeAny( sal_Int32(2540) ) ); - // page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm - Insert( PROP_BOTTOM_MARGIN, uno::makeAny( sal_Int32(2540) ) ); + // page left margin, 1/100 mm + Insert( PROP_LEFT_MARGIN, uno::makeAny( sal_Int32(o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100)) ) ); + // page right margin, 1/100 mm + Insert( PROP_RIGHT_MARGIN, uno::makeAny( sal_Int32(o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100)) ) ); + // page top margin, 1/100 mm + Insert( PROP_TOP_MARGIN, uno::makeAny( sal_Int32(o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100)) ) ); + // page bottom margin, 1/100 mm + Insert( PROP_BOTTOM_MARGIN, uno::makeAny( sal_Int32(o3tl::convert(1, o3tl::Length::in, o3tl::Length::mm100)) ) ); // page style layout Insert( PROP_PAGE_STYLE_LAYOUT, uno::makeAny( style::PageStyleLayout_ALL ) ); uno::Any aFalse( uno::makeAny( false ) ); |