sw/source/uibase/app/appopt.cxx | 4 ++-- sw/source/uibase/app/docshini.cxx | 2 +- sw/source/uibase/config/usrpref.cxx | 6 +++--- sw/source/uibase/inc/usrpref.hxx | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit f7011dc1c740dcb4b5e142aa6ddbafd212c2a7d8 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Feb 7 22:15:28 2018 +0100 Store SwMasterUsrPref::m_nDefTab in 1/100 mm instead of twips ...to match its source (/org.openoffice.Office.Writer/Layout/Other/TabStop) and avoid rounding errors in case the value read from the configuration is ever written back to the configuration (which is pointless, but e.g. currently happens when the SwMasterUsrPref ctor calls SwLayoutViewConfig::Load, which calls SwMasterUsrPref::SetAlignMathObjectsToBaseline, which unconditionally calls SetModified, so that a later utl::ConfigManager::storeConfigItems will write them all back) Change-Id: I7a1ddfbc4771fac101b7ea3a8258bb51f09d9bc1 Reviewed-on: https://gerrit.libreoffice.org/49407 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 55f6643174bf..50ee0cc1997d 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -197,7 +197,7 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId ) pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, static_cast<sal_uInt16>(::GetTabDist(rDefTabs)))); } else - pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, static_cast<sal_uInt16>(pPref->GetDefTab()))); + pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, static_cast<sal_uInt16>(convertMm100ToTwip(pPref->GetDefTabInMm100())))); } // Options for GridTabPage @@ -329,7 +329,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem ) ) { sal_uInt16 nTabDist = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); - pPref->SetDefTab(nTabDist); + pPref->SetDefTabInMm100(convertTwipToMm100(nTabDist)); if(pAppView) { SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 42dcb2933bef..e9bbeb63a2b6 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -678,7 +678,7 @@ void SwDocShell::SubInitNew() aDfltSet.Put( aHyp ); - sal_uInt16 nNewPos = static_cast< sal_uInt16 >(SW_MOD()->GetUsrPref(false)->GetDefTab()); + sal_uInt16 nNewPos = static_cast< sal_uInt16 >(convertMm100ToTwip(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100())); if( nNewPos ) aDfltSet.Put( SvxTabStopItem( 1, nNewPos, SvxTabAdjust::Default, RES_PARATR_TABSTOP ) ); diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index b2c5db331231..f98e575c4bb7 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -50,7 +50,7 @@ SwMasterUsrPref::SwMasterUsrPref(bool bWeb) : m_nLinkUpdateMode(0), m_bIsHScrollMetricSet(false), m_bIsVScrollMetricSet(false), - m_nDefTab( MM50 * 4 ), + m_nDefTabInMm100( 2000 ), // 2 cm m_bIsSquaredPageMode(false), m_bIsAlignMathObjectsToBaseline(false), m_aContentConfig(bWeb, *this), @@ -299,7 +299,7 @@ void SwLayoutViewConfig::ImplCommit() case 10: rVal <<= static_cast<sal_Int32>(rParent.GetZoomType()); break; // "Zoom/Type", case 11: rVal <<= rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" case 12: rVal <<= static_cast<sal_Int32>(rParent.GetMetric()); break; // "Other/MeasureUnit", - case 13: rVal <<= static_cast<sal_Int32>(convertTwipToMm100(rParent.GetDefTab())); break;// "Other/TabStop", + case 13: rVal <<= rParent.GetDefTabInMm100(); break;// "Other/TabStop", case 14: rVal <<= rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight", case 15: rVal <<= static_cast<sal_Int32>(rParent.GetViewLayoutColumns()); break; // "ViewLayout/Columns", case 16: rVal <<= rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode", @@ -353,7 +353,7 @@ void SwLayoutViewConfig::Load() case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", case 11: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" case 12: rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit", - case 13: rParent.SetDefTab(convertMm100ToTwip(nInt32Val), true); break;// "Other/TabStop", + case 13: rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop", case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", case 15: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns", case 16: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", diff --git a/sw/source/uibase/inc/usrpref.hxx b/sw/source/uibase/inc/usrpref.hxx index 021dded82d98..42d29861dc82 100644 --- a/sw/source/uibase/inc/usrpref.hxx +++ b/sw/source/uibase/inc/usrpref.hxx @@ -136,7 +136,7 @@ class SwMasterUsrPref : public SwViewOption FieldUnit m_eVScrollMetric; bool m_bIsVScrollMetricSet; - sal_Int32 m_nDefTab; //default tab stop distance + sal_Int32 m_nDefTabInMm100; //default tab stop distance, in 1/100 mm bool m_bIsSquaredPageMode; //default page mode for text grid bool m_bIsAlignMathObjectsToBaseline; @@ -239,10 +239,10 @@ public: m_aLayoutConfig.SetModified(); } - sal_Int32 GetDefTab() const { return m_nDefTab;} - void SetDefTab( sal_Int32 nSet, bool bNoModify = false ) + sal_Int32 GetDefTabInMm100() const { return m_nDefTabInMm100;} + void SetDefTabInMm100( sal_Int32 nSet, bool bNoModify = false ) { - m_nDefTab = nSet; + m_nDefTabInMm100 = nSet; if(!bNoModify) m_aLayoutConfig.SetModified(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits