summaryrefslogtreecommitdiffstats
path: root/svx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-12-10 18:44:22 +0100
committerMathias Bauer <mba@openoffice.org>2009-12-10 18:44:22 +0100
commit6fc01200941161b365c953a182ccc8b9e5365104 (patch)
treef97f37818168c23d0b9cf6bde53170d03a5b2599 /svx
parent#i107450#: move GetLanguageString to class SvtLanguageTable (diff)
downloadcore-6fc01200941161b365c953a182ccc8b9e5365104.tar.gz
core-6fc01200941161b365c953a182ccc8b9e5365104.zip
#i107450#: split up the two different ways to detect a module field unit
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/dlgutil.hxx2
-rw-r--r--svx/inc/pszctrl.hxx1
-rw-r--r--svx/source/dialog/_contdlg.cxx4
-rw-r--r--svx/source/dialog/dlgutil.cxx28
-rw-r--r--svx/source/dialog/fontwork.cxx6
-rw-r--r--svx/source/dialog/hdft.cxx2
-rw-r--r--svx/source/dialog/imapdlg.cxx4
-rw-r--r--svx/source/dialog/srchdlg.cxx3
-rw-r--r--svx/source/engine3d/float3d.cxx7
-rw-r--r--svx/source/options/optgrid.cxx2
-rw-r--r--svx/source/stbctrls/pszctrl.cxx5
-rw-r--r--svx/source/tbxctrls/itemwin.cxx5
12 files changed, 23 insertions, 46 deletions
diff --git a/svx/inc/dlgutil.hxx b/svx/inc/dlgutil.hxx
index cda0bf320cfe..2df180b4de6c 100644
--- a/svx/inc/dlgutil.hxx
+++ b/svx/inc/dlgutil.hxx
@@ -56,7 +56,7 @@ SVX_DLLPUBLIC void SetFieldUnit( MetricField& rCtrl,
SVX_DLLPUBLIC void SetFieldUnit( MetricBox& rCtrl,
FieldUnit eUnit, BOOL bAll = FALSE );
-SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet* pSet = NULL );
+SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& );
// Metriken umrechnen
SVX_DLLPUBLIC long CalcToUnit( float nIn, SfxMapUnit eUnit );
diff --git a/svx/inc/pszctrl.hxx b/svx/inc/pszctrl.hxx
index c4ebbb3c239a..80cddcc3ae9b 100644
--- a/svx/inc/pszctrl.hxx
+++ b/svx/inc/pszctrl.hxx
@@ -46,6 +46,7 @@ class SVX_DLLPUBLIC SvxPosSizeStatusBarControl : public SfxStatusBarControl
{
private:
SvxPosSizeStatusBarControl_Impl* pImp;
+ SVX_DLLPRIVATE String GetMetricStr_Impl( long nVal );
public:
SFX_DECL_STATUSBAR_CONTROL();
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 0c87beb39a74..df2486aaf98a 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -874,7 +874,7 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
{
String aStr;
- const FieldUnit eFieldUnit = GetModuleFieldUnit();
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetModuleFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
@@ -897,7 +897,7 @@ IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
{
String aStr;
- const FieldUnit eFieldUnit = GetModuleFieldUnit();
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetModuleFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx
index d2a66db4c6a7..736c5fc13a49 100644
--- a/svx/source/dialog/dlgutil.cxx
+++ b/svx/source/dialog/dlgutil.cxx
@@ -40,9 +40,6 @@
#include <svtools/langtab.hxx>
#include <svl/itemset.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/objsh.hxx>
-
#include <svx/dialogs.hrc>
#include "dlgutil.hxx"
@@ -172,33 +169,12 @@ void SetFieldUnit( MetricBox& rBox, FieldUnit eUnit, BOOL bAll )
// -----------------------------------------------------------------------
-FieldUnit GetModuleFieldUnit( const SfxItemSet* pSet )
+FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
{
FieldUnit eUnit = FUNIT_INCH;
const SfxPoolItem* pItem = NULL;
- if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, FALSE, &pItem ) )
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC, FALSE, &pItem ) )
eUnit = (FieldUnit)( (const SfxUInt16Item*)pItem )->GetValue();
- else
- {
- SfxViewFrame* pFrame = SfxViewFrame::Current();
- SfxObjectShell* pSh = NULL;
- if ( pFrame )
- pSh = pFrame->GetObjectShell();
- if ( pSh ) // #93209# the object shell is not always available during reload
- {
- SfxModule* pModule = pSh->GetModule();
- if ( pModule )
- {
- const SfxPoolItem* _pItem = pModule->GetItem( SID_ATTR_METRIC );
- if ( _pItem )
- eUnit = (FieldUnit)( (SfxUInt16Item*)_pItem )->GetValue();
- }
- else
- {
- DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
- }
- }
- }
return eUnit;
}
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx
index ffcf8f21b49d..b5f2066ee890 100644
--- a/svx/source/dialog/fontwork.cxx
+++ b/svx/source/dialog/fontwork.cxx
@@ -295,7 +295,7 @@ SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
aMtrFldShadowY.SetModifyHdl( aLink );
// System-Metrik setzen
- const FieldUnit eDlgUnit = GetModuleFieldUnit();
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetModuleFieldUnit();
SetFieldUnit( aMtrFldDistance, eDlgUnit, TRUE );
SetFieldUnit( aMtrFldTextStart, eDlgUnit, TRUE );
SetFieldUnit( aMtrFldShadowX, eDlgUnit, TRUE );
@@ -605,7 +605,7 @@ void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
if ( pItem->GetValue() == XFTSHADOW_NORMAL )
{
nId = TBI_SHADOW_NORMAL;
- const FieldUnit eDlgUnit = GetModuleFieldUnit();
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetModuleFieldUnit();
// aFbShadowX.SetBitmap( Bitmap( ResId(RID_SVXBMP_SHADOW_XDIST, _pMgr ) ) );
//aMtrFldShadowX.SetUnit(FUNIT_MM);
@@ -888,7 +888,7 @@ IMPL_LINK( SvxFontWorkDialog, InputTimoutHdl_Impl, void *, EMPTYARG )
// System-Metrik evtl. neu setzen
// Dieses sollte mal als Listener passieren, ist aber aus
// inkompatibilitaetsgruenden z.Z. nicht moeglich
- const FieldUnit eDlgUnit = GetModuleFieldUnit();
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetModuleFieldUnit();
if( eDlgUnit != aMtrFldDistance.GetUnit() )
{
SetFieldUnit( aMtrFldDistance, eDlgUnit, TRUE );
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 741df55c960a..df30e2be0213 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -188,7 +188,7 @@ SvxHFPage::SvxHFPage( Window* pParent, USHORT nResId, const SfxItemSet& rAttr, U
FreeResource();
// Metrik einstellen
- FieldUnit eFUnit = GetModuleFieldUnit( &rAttr );
+ FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
SetFieldUnit( aDistEdit, eFUnit );
SetFieldUnit( aHeightEdit, eFUnit );
SetFieldUnit( aLMEdit, eFUnit );
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 2157fecc7cce..f650885b5e70 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -835,7 +835,7 @@ IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow*, pWnd )
IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
{
String aStr;
- const FieldUnit eFieldUnit = GetModuleFieldUnit();
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetModuleFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
@@ -858,7 +858,7 @@ IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
{
String aStr;
- const FieldUnit eFieldUnit = GetModuleFieldUnit();
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetModuleFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 9a121a578448..106ac49706ef 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2320,8 +2320,7 @@ String& SvxSearchDialog::BuildAttrText_Impl( String& rStr,
// Metrik abfragen
SfxMapUnit eMapUnit = SFX_MAPUNIT_CM;
- FieldUnit eFieldUnit = GetModuleFieldUnit();
-
+ FieldUnit eFieldUnit = pSh->GetModule()->GetModuleFieldUnit();
switch ( eFieldUnit )
{
case FUNIT_MM: eMapUnit = SFX_MAPUNIT_MM; break;
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index 71a5ba2065f8..b57285709f75 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -307,7 +307,8 @@ __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
FreeResource();
// Metrik einstellen
- eFUnit = GetModuleFieldUnit( NULL );
+ eFUnit = pInBindings->GetDispatcher()->GetModule()->GetModuleFieldUnit();
+
aMtrDepth.SetUnit( eFUnit );
aMtrDistance.SetUnit( eFUnit );
aMtrFocalLength.SetUnit( eFUnit );
@@ -509,7 +510,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
}
- eFUnit = GetModuleFieldUnit( &rAttrs );
+ eFUnit = GetModuleFieldUnit( rAttrs );
// Segmentanzahl aenderbar ? und andere Stati
@@ -1754,7 +1755,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
- eFUnit = GetModuleFieldUnit( &rAttrs );
+ eFUnit = GetModuleFieldUnit( rAttrs );
}
// Anzahl Segmente (horizontal)
diff --git a/svx/source/options/optgrid.cxx b/svx/source/options/optgrid.cxx
index bebb114d6adf..a100a1e3741d 100644
--- a/svx/source/options/optgrid.cxx
+++ b/svx/source/options/optgrid.cxx
@@ -225,7 +225,7 @@ SvxGridTabPage::SvxGridTabPage( Window* pParent, const SfxItemSet& rCoreSet) :
aDivisionPointY.SetText(aDivisionPointX.GetText());
// Metrik einstellen
- FieldUnit eFUnit = GetModuleFieldUnit( &rCoreSet );
+ FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet );
long nFirst, nLast, nMin, nMax;
lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 92953295b88f..559e905b45be 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -60,6 +60,7 @@
#include <svx/dialmgr.hxx>
#include "dlgutil.hxx"
#include "stbctrls.h"
+#include "sfx2/module.hxx"
#include <svx/dialogs.hrc>
#include <unotools/localedatawrapper.hxx>
@@ -81,10 +82,10 @@
<SvxPosSizeStatusBarControl::Paint(const UserDrawEvent&)>
*/
-String GetMetricStr_Impl( long nVal )
+String SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal )
{
// Applikations-Metrik besorgen und setzen
- FieldUnit eOutUnit = GetModuleFieldUnit( NULL );
+ FieldUnit eOutUnit = SfxModule::GetActiveModule()->GetModuleFieldUnit();
FieldUnit eInUnit = FUNIT_100TH_MM;
String sMetric;
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 518621a4cc38..60b273ea3fae 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -494,7 +494,7 @@ SvxMetricField::SvxMetricField(
SetLast( 5000 );
SetFirst( 0 );
- eDlgUnit = GetModuleFieldUnit( NULL );
+ eDlgUnit = SfxModule::GetActiveModule()->GetModuleFieldUnit();
SetFieldUnit( *this, eDlgUnit, FALSE );
Show();
}
@@ -579,8 +579,7 @@ void SvxMetricField::SetCoreUnit( SfxMapUnit eUnit )
void SvxMetricField::RefreshDlgUnit()
{
- FieldUnit eTmpUnit = GetModuleFieldUnit( NULL );
-
+ FieldUnit eTmpUnit = SfxModule::GetActiveModule()->GetModuleFieldUnit();
if ( eDlgUnit != eTmpUnit )
{
eDlgUnit = eTmpUnit;