diff options
author | Oliver Specht <os@openoffice.org> | 2002-11-15 10:17:38 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2002-11-15 10:17:38 +0000 |
commit | 2642352cae8e2adca845825cf65c2a98f5be24ba (patch) | |
tree | 1fcf439e224dc89d1aad764d1cdeb503ec718f5a /sw/source/ui | |
parent | ef6790486f1e73a0ae2c33ebd6617813c8115b75 (diff) |
#103096# optionally apply fixed (no language dependence) number format to text fields
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/fldui/flddinf.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/fldui/flddok.cxx | 31 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldmgr.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldtdlg.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/inc/fldmgr.hxx | 13 | ||||
-rw-r--r-- | sw/source/ui/inc/numfmtlb.hxx | 14 | ||||
-rw-r--r-- | sw/source/ui/utlui/numfmtlb.cxx | 29 |
9 files changed, 126 insertions, 38 deletions
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index ddcf2f9146ce..7f96f6d55d35 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -2,9 +2,9 @@ * * $RCSfile: flddinf.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: gt $ $Date: 2002-07-19 14:52:21 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,9 @@ #ifndef _VIEW_HXX #include <view.hxx> #endif +#ifndef _ZFORMAT_HXX +#include <svtools/zformat.hxx> +#endif #define USER_DATA_VERSION_1 "1" #define USER_DATA_VERSION USER_DATA_VERSION_1 @@ -135,6 +138,8 @@ SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) : aTypeTLB.SetSpaceBetweenEntries(0); aTypeTLB.SetNodeDefaultImages(); + //enable 'active' language selection + aFormatLB.SetShowLanguageControl(TRUE); } /*-------------------------------------------------------------------- @@ -167,7 +172,15 @@ void __EXPORT SwFldDokInfPage::Reset(const SfxItemSet& rSet) USHORT nSubType = USHRT_MAX; if (IsFldEdit()) - nSubType = ((SwDocInfoField*)GetCurField())->GetSubType() & 0xff; + { + const SwField* pCurField = GetCurField(); + nSubType = ((SwDocInfoField*)pCurField)->GetSubType() & 0xff; + aFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage()); + SwWrtShell &rSh = ::GetActiveView()->GetWrtShell(); + const SvNumberformat* pFormat = rSh.GetNumberFormatter()->GetEntry(pCurField->GetFormat()); + if(pFormat) + aFormatLB.SetLanguage(pFormat->GetLanguage()); + } USHORT nSelEntryData = USHRT_MAX; String sUserData = GetUserData(); @@ -456,7 +469,8 @@ BOOL __EXPORT SwFldDokInfPage::FillItemSet(SfxItemSet& rSet) if (!IsFldEdit() || nOldSel != aSelectionLB.GetSelectEntryPos() || nOldFormat != nFormat || aFixedCB.GetState() != aFixedCB.GetSavedValue()) { - InsertFld(nTypeId, nSubType, aEmptyStr, aEmptyStr, nFormat); + InsertFld(nTypeId, nSubType, aEmptyStr, aEmptyStr, nFormat, + ' ', aFormatLB.IsAutomaticLanguage()); } return FALSE; @@ -497,6 +511,9 @@ void SwFldDokInfPage::FillUserData() /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.2 2002/07/19 14:52:21 gt + #101523# node default images for SwFldDokInfPage + Revision 1.1.1.1 2000/09/18 17:14:36 hr initial import diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index dea06a23823e..e6230b7ab06b 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -2,9 +2,9 @@ * * $RCSfile: flddok.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: os $ $Date: 2001-04-23 13:13:57 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,18 @@ #ifndef _FLDDOK_HXX #include <flddok.hxx> #endif +#ifndef _SWMODULE_HXX +#include <swmodule.hxx> +#endif +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#ifndef _WRTSH_HXX +#include <wrtsh.hxx> +#endif +#ifndef _ZFORMAT_HXX +#include <svtools/zformat.hxx> +#endif #define USER_DATA_VERSION_1 "1" #define USER_DATA_VERSION USER_DATA_VERSION_1 @@ -136,6 +148,8 @@ SwFldDokPage::SwFldDokPage(Window* pWindow, const SfxItemSet& rCoreSet ) : aLevelED.SetMax(MAXLEVEL); aDateOffsetED.SetMin(LONG_MIN); aDateOffsetED.SetMax(LONG_MAX); + //enable 'active' language selection + aNumFormatLB.SetShowLanguageControl(TRUE); } /*-------------------------------------------------------------------- @@ -193,13 +207,19 @@ void __EXPORT SwFldDokPage::Reset(const SfxItemSet& rSet) } else { - nTypeId = GetCurField()->GetTypeId(); + const SwField* pCurField = GetCurField(); + nTypeId = pCurField->GetTypeId(); if (nTypeId == TYP_FIXDATEFLD) nTypeId = TYP_DATEFLD; if (nTypeId == TYP_FIXTIMEFLD) nTypeId = TYP_TIMEFLD; nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId))); aTypeLB.SetEntryData(nPos, (void*)nTypeId); + aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage()); + SwWrtShell &rSh = ::GetActiveView()->GetWrtShell(); + const SvNumberformat* pFormat = rSh.GetNumberFormatter()->GetEntry(pCurField->GetFormat()); + if(pFormat) + aNumFormatLB.SetLanguage(pFormat->GetLanguage()); } // alte Pos selektieren @@ -711,7 +731,7 @@ BOOL __EXPORT SwFldDokPage::FillItemSet(SfxItemSet& rSet) aLevelED.GetText() != aLevelED.GetSavedValue() || aDateOffsetED.GetText() != aDateOffsetED.GetSavedValue()) { - InsertFld( nTypeId, nSubType, aEmptyStr, aVal, nFormat ); + InsertFld( nTypeId, nSubType, aEmptyStr, aVal, nFormat, ' ', aNumFormatLB.IsAutomaticLanguage() ); } return FALSE; @@ -756,6 +776,9 @@ void SwFldDokPage::FillUserData() /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.3 2001/04/23 13:13:57 os + #86144# PageNumberField: selection of format corrected + Revision 1.2 2001/02/09 07:44:09 os TabPage size changed diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 71b99113359e..cebd37585758 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fldmgr.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: os $ $Date: 2002-10-18 13:43:44 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1568,9 +1568,11 @@ BOOL SwFldMgr::InsertFld( const SwInsertFld_Data& rData ) } ASSERT(pFld, "Feld nicht vorhanden"); - USHORT nLang = GetCurrLanguage(); // Language + //the auto language flag has to be set prior to the language! + pFld->SetAutomaticLanguage(rData.bIsAutomaticLanguage); + USHORT nLang = GetCurrLanguage(); pFld->SetLanguage(nLang); // Einfuegen diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 57bf04a6539f..b7fdebbaf3fc 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fldpage.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: os $ $Date: 2002-08-07 09:29:47 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -220,7 +220,8 @@ void SwFldPage::EditNewField( BOOL bOnlyActivate ) --------------------------------------------------------------------*/ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1, - const String& rPar2, ULONG nFormatId, sal_Unicode cSeparator) + const String& rPar2, ULONG nFormatId, + sal_Unicode cSeparator, BOOL bIsAutomaticLanguage) { BOOL bRet = FALSE; SwView* pView = GetActiveView(); @@ -228,7 +229,7 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1, if (!IsFldEdit()) // Neues Feld einfuegen { - SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator ); + SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator, bIsAutomaticLanguage ); bRet = aMgr.InsertFld( aData ); com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder = @@ -365,6 +366,7 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1, pSh->StartAllAction(); pCurFld->SetSubType(nSubType); + pCurFld->SetAutomaticLanguage(bIsAutomaticLanguage); aMgr.UpdateCurFld( nFormatId, sPar1, sPar2 ); diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index c171b6bb51cd..d5aa6111173c 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fldtdlg.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jp $ $Date: 2001-09-20 12:49:58 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -388,7 +388,10 @@ void SwFldDlg::ReInitDlg() Close(); } - const SwWrtShell& rSh = ::GetActiveView()->GetWrtShell(); + SwView* pActiveView = ::GetActiveView(); + if(!pActiveView) + return; + const SwWrtShell& rSh = pActiveView->GetWrtShell(); GetOKButton().Enable( !rSh.IsReadOnlyAvailable() || !rSh.HasReadonlySel() ); diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 8375912edd94..8bf0980d1511 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fldvar.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jp $ $Date: 2001-09-20 12:49:58 $ + * last change: $Author: os $ $Date: 2002-11-15 11:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -110,6 +110,9 @@ #include <calc.hxx> #endif +#ifndef _ZFORMAT_HXX +#include <svtools/zformat.hxx> +#endif #ifndef _GLOBALS_HRC #include <globals.hrc> #endif @@ -165,6 +168,8 @@ SwFldVarPage::SwFldVarPage(Window* pParent, const SfxItemSet& rCoreSet ) : aChapterLevelLB.InsertEntry(String::CreateFromInt32(i)); aChapterLevelLB.SelectEntryPos(0); + //enable 'active' language selection + aNumFormatLB.SetShowLanguageControl(TRUE); } /*-------------------------------------------------------------------- @@ -210,11 +215,17 @@ void SwFldVarPage::Reset(const SfxItemSet& rSet) } else { - nTypeId = GetCurField()->GetTypeId(); + SwField* pCurField = GetCurField(); + nTypeId = pCurField->GetTypeId(); if (nTypeId == TYP_SETINPFLD) nTypeId = TYP_INPUTFLD; nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId))); aTypeLB.SetEntryData(nPos, (void*)nTypeId); + aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage()); + SwWrtShell &rSh = ::GetActiveView()->GetWrtShell(); + const SvNumberformat* pFormat = rSh.GetNumberFormatter()->GetEntry(pCurField->GetFormat()); + if(pFormat) + aNumFormatLB.SetLanguage(pFormat->GetLanguage()); } // alte Pos selektieren @@ -1218,7 +1229,7 @@ BOOL SwFldVarPage::FillItemSet(SfxItemSet& rSet) { nFormat = aNumFormatLB.GetFormat(); - if (nFormat && nFormat != ULONG_MAX) + if (nFormat && nFormat != ULONG_MAX && aNumFormatLB.IsAutomaticLanguage()) { // Sprache auf Office-Sprache umstellen, da String im Office- // Format vom Kalkulator erwartet wird und so in den Dlg @@ -1309,7 +1320,8 @@ BOOL SwFldVarPage::FillItemSet(SfxItemSet& rSet) aChapterLevelLB.GetSavedValue() != aChapterLevelLB.GetSelectEntryPos() || aSeparatorED.GetSavedValue() != aSeparatorED.GetText()) { - InsertFld( nTypeId, nSubType, aName, aVal, nFormat, cSeparator ); + InsertFld( nTypeId, nSubType, aName, aVal, nFormat, + cSeparator, aNumFormatLB.IsAutomaticLanguage() ); } UpdateSubType(); @@ -1397,6 +1409,9 @@ void SwFldVarPage::FillUserData() /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.7 2001/09/20 12:49:58 jp + Bug #89582#: handle field dialog activation correct + Revision 1.6 2001/08/03 14:37:05 os #90496# zero is a valid number format diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx index 4901a9693973..71e512d0a551 100644 --- a/sw/source/ui/inc/fldmgr.hxx +++ b/sw/source/ui/inc/fldmgr.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fldmgr.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: os $ $Date: 2001-06-08 13:47:32 $ + * last change: $Author: os $ $Date: 2002-11-15 11:13:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,23 +135,26 @@ struct SwInsertFld_Data ULONG nFormatId; SwWrtShell* pSh; sal_Unicode cSeparator; + BOOL bIsAutomaticLanguage; ::com::sun::star::uno::Any aDBDataSource; ::com::sun::star::uno::Any aDBConnection; ::com::sun::star::uno::Any aDBColumn; SwInsertFld_Data(USHORT nType, USHORT nSub, const String& rPar1, const String& rPar2, - ULONG nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ') : + ULONG nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ', BOOL bIsAutoLanguage = TRUE) : nTypeId(nType), nSubType(nSub), sPar1(rPar1), sPar2(rPar2), nFormatId(nFmtId), pSh(pShell), - cSeparator(cSep) {} + cSeparator(cSep), + bIsAutomaticLanguage(bIsAutoLanguage) {} SwInsertFld_Data() : pSh(0), - cSeparator(' '){} + cSeparator(' '), + bIsAutomaticLanguage(TRUE){} }; class SwFldMgr diff --git a/sw/source/ui/inc/numfmtlb.hxx b/sw/source/ui/inc/numfmtlb.hxx index 2a050a9e1957..ce6a72b9d302 100644 --- a/sw/source/ui/inc/numfmtlb.hxx +++ b/sw/source/ui/inc/numfmtlb.hxx @@ -2,9 +2,9 @@ * * $RCSfile: numfmtlb.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:41 $ + * last change: $Author: os $ $Date: 2002-11-15 11:13:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ class NumFormatListBox : public ListBox SwView* pVw; SvNumberFormatter* pOwnFormatter; LanguageType eCurLanguage; + BOOL bShowLanguageControl; //determine whether the language control has + //to be shown in the number format dialog + BOOL bUseAutomaticLanguage;//determine whether language is automatically assigned DECL_LINK( SelectHdl, ListBox * ); @@ -109,6 +112,13 @@ public: const String& GetFormatStr() const; inline LanguageType GetCurLanguage() const { return eCurLanguage;} + void SetLanguage(LanguageType eSet) { eCurLanguage = eSet;} + + void SetAutomaticLanguage(BOOL bSet){bUseAutomaticLanguage = bSet;} + BOOL IsAutomaticLanguage()const {return bUseAutomaticLanguage;} + + void SetShowLanguageControl(BOOL bSet){bShowLanguageControl = bSet;} + }; diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index dbf682605483..f78b49684bda 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -2,9 +2,9 @@ * * $RCSfile: numfmtlb.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jp $ $Date: 2001-09-27 17:23:38 $ + * last change: $Author: os $ $Date: 2002-11-15 11:13:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,7 +154,9 @@ NumFormatListBox::NumFormatListBox( Window* pWin, const ResId& rResId, bOneArea (FALSE), nDefFormat (nDefFmt), pVw (0), - pOwnFormatter (0) + pOwnFormatter (0), + bUseAutomaticLanguage(TRUE), + bShowLanguageControl(FALSE) { Init(nFormatType, bUsrFmts); } @@ -172,7 +174,9 @@ NumFormatListBox::NumFormatListBox( Window* pWin, SwView* pView, bOneArea (FALSE), nDefFormat (nDefFmt), pVw (pView), - pOwnFormatter (0) + pOwnFormatter (0), + bUseAutomaticLanguage(TRUE), + bShowLanguageControl(FALSE) { Init(nFormatType, bUsrFmts); } @@ -488,6 +492,7 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, + SID_ATTR_NUMBERFORMAT_ADD_AUTO, SID_ATTR_NUMBERFORMAT_ADD_AUTO, 0 ); double fValue = GetDefValue( pFormatter, nCurrFormatType); @@ -501,8 +506,8 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) if( (NUMBERFORMAT_DATE | NUMBERFORMAT_TIME) & nCurrFormatType ) aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea)); - // Keine Sprachauswahl im Dialog, da Sprache im Textattribut enthalten ist - aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, TRUE)); + aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl)); + aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage)); SwNumFmtDlg* pDlg = new SwNumFmtDlg(this, aCoreSet); @@ -519,10 +524,18 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) pFormatter->DeleteEntry( pDelArr[i] ); } - if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, FALSE, &pItem )) { - SetDefFormat(((SfxUInt32Item*)pItem)->GetValue()); + UINT32 nFormat = ((SfxUInt32Item*)pItem)->GetValue(); + SetDefFormat(nFormat); + eCurLanguage = pFormatter->GetEntry(nFormat)->GetLanguage(); + } + if( bShowLanguageControl && SFX_ITEM_SET == pOutSet->GetItemState( + SID_ATTR_NUMBERFORMAT_ADD_AUTO, FALSE, &pItem )) + { + bUseAutomaticLanguage = ((const SfxBoolItem*)pItem)->GetValue(); } } else |