diff options
author | Oliver Specht <os@openoffice.org> | 2000-09-26 10:55:45 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2000-09-26 10:55:45 +0000 |
commit | ac94e405e5a146ba64690377bd1f29c80534b1ed (patch) | |
tree | c1b928d2815c4a72b148ab5834eed54709862779 | |
parent | da31c71f326b798b3644347a4c94af02b57a28a8 (diff) |
use of configuration service
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 21 | ||||
-rw-r--r-- | sw/source/ui/envelp/labimg.cxx | 589 | ||||
-rw-r--r-- | sw/source/ui/envelp/labimp.hxx | 26 | ||||
-rw-r--r-- | sw/source/ui/inc/labimg.hxx | 150 |
4 files changed, 341 insertions, 445 deletions
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 37e7c776c5c8..74b15649c3b2 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: label1.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2000-09-21 13:52:52 $ + * last change: $Author: os $ $Date: 2000-09-26 11:55:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -180,7 +180,6 @@ using namespace ::rtl; // dont use RTL_CONSTASCII_STRINGPARAM for UNO_NAME ... // #define CL2S(cChar) UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar)) -#define C2U(cChar) OUString::createFromAscii(cChar) #define USER_FIELD_FIRSTNAME "BC_PRIV_FIRSTNAME" #define USER_FIELD_NAME "BC_PRIV_NAME" @@ -365,7 +364,7 @@ void SwLabDlg::_ReplaceGroup( const String &rMake, SwLabItem *pItem ) { pRecs->C40_INSERT( SwLabRec, pRec, pRecs->Count() ); - if ( pRec->aMake == pItem->aMake && pRec->aType == pItem->aType ) + if ( pRec->aMake == String(pItem->aMake) && pRec->aType == String(pItem->aType) ) { pItem->lHDist = pRec->lHDist; pItem->lVDist = pRec->lVDist; @@ -486,7 +485,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, pMake->EraseLeadingChars(); pMake->EraseTrailingChars(); aMakes.Insert( pMake, aMakes.Count() ); - if ( *pMake == aItem.aLstMake ) + if ( *pMake == String(aItem.aLstMake) ) nLstGroup = nGroup; } if ( aMakes.Count() ) @@ -516,7 +515,7 @@ gespeichert. void SwLabDlg::MakeConfigItem( SwLabItem& rItem ) const { - if ( rItem.aType != String(SW_RES(STR_CUSTOM)) ) + if ( String(rItem.aType) != String(SW_RES(STR_CUSTOM)) ) { SwLabRec* pRec = (*pRecs)[0]; rItem.lHDist = pRec->lHDist; @@ -656,7 +655,7 @@ SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) : { String &rStr = *GetParent()->Makes()[i]; aMakeBox.InsertEntry( rStr ); - if ( rStr == aItem.aLstMake ) + if ( rStr == String(aItem.aLstMake) ) nLstGroup = i; } // Reset(rSet); @@ -819,7 +818,7 @@ IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG ) const String aType ( GetParent()->Recs()[i]->aType ); if ( aTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND ) { - if ( !nLstType && aType == aItem.aLstType ) + if ( !nLstType && aType == String(aItem.aLstType) ) nLstType = GetParent()->TypeIds().Count(); aTypeBox.InsertEntry( aType ); GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count()); @@ -1028,7 +1027,7 @@ void SwLabPage::Reset(const SfxItemSet& rSet) aWritingEdit.SetText ( aWriting.ConvertLineEnd() ); aMakeBox .SelectEntry( aItem.aMake ); - if (aTypeBox.GetEntryPos(aItem.aType) != LISTBOX_ENTRY_NOTFOUND) + if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND) { aTypeBox.SelectEntry(aItem.aType); aTypeBox.GetSelectHdl().Call(&aTypeBox); @@ -1171,7 +1170,7 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) sal_Bool bFound = sal_False; for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++) - if(aLabItem.sGlossaryGroup == *(String*)aAutoTextGroupLB.GetEntryData( i )) + if(String(aLabItem.sGlossaryGroup) == *(String*)aAutoTextGroupLB.GetEntryData( i )) { bFound = sal_True; break; @@ -1188,7 +1187,7 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) { SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected(); if( pSelEntry && - *(String*)pSelEntry->GetUserData() != aLabItem.sGlossaryBlockName) + *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName)) { lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName); AutoTextSelectHdl(&aAutoTextLB); diff --git a/sw/source/ui/envelp/labimg.cxx b/sw/source/ui/envelp/labimg.cxx index 06a4e77a3168..a395c401966e 100644 --- a/sw/source/ui/envelp/labimg.cxx +++ b/sw/source/ui/envelp/labimg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: labimg.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:36 $ + * last change: $Author: os $ $Date: 2000-09-26 11:55:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,25 +75,24 @@ #ifndef _SVX_ADRITEM_HXX #include <svx/adritem.hxx> #endif -#ifndef _FINDER_HXX -#include <finder.hxx> -#endif - +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif +#include "labimg.hxx" #include "cmdid.h" #include "swtypes.hxx" -#include "cfgid.h" -#include "labimg.hxx" -#include "cfgstr.hrc" -#define LAB_VERSION 1 -#define LAB_VERSION2 2 -#define LAB_VERSION3 3 -#define LAB_VERSION4 4 -#define LAB_VERSION5 5 -#define LAB_VERSION6 6 +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; -#define CUR_LAB_VERSION LAB_VERSION6 +#define C2U(cChar) OUString::createFromAscii(cChar) + +// ---------------------------------------------------------------------------- SwLabItem::SwLabItem() : SfxPoolItem(FN_LABEL), @@ -113,19 +112,12 @@ SwLabItem::SwLabItem() : } // ---------------------------------------------------------------------------- - - - SwLabItem::SwLabItem(const SwLabItem& rItem) : SfxPoolItem(FN_LABEL) { *this = rItem; } - // ---------------------------------------------------------------------------- - - - SwLabItem& SwLabItem::operator =(const SwLabItem& rItem) { bAddr = rItem.bAddr; @@ -252,343 +244,256 @@ int SwLabItem::operator ==(const SfxPoolItem& rItem) const } // -------------------------------------------------------------------------- - - - SfxPoolItem* SwLabItem::Clone(SfxItemPool*) const { return new SwLabItem(*this); } -// ---------------------------------------------------------------------------- -SwLabCfgItem::SwLabCfgItem() : - SfxConfigItem(CFG_LAB_ITEM) -{ -} +/* -----------------------------25.09.00 16:25-------------------------------- -// ---------------------------------------------------------------------------- - -int SwLabItem::Load (SvStream& rStrm, USHORT nVersion, BOOL bLabel) + ---------------------------------------------------------------------------*/ +Sequence<rtl::OUString> SwLabCfgItem::GetPropertyNames() { - unsigned char b; - USHORT i; - long l; - - rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding(); - rStrm >> b; bAddr = (BOOL) b; - rStrm.ReadByteString(aWriting, eEncoding); - rStrm >> b; bCont = (BOOL) b; - rStrm.ReadByteString(aMake, eEncoding); - rStrm.ReadByteString(aType, eEncoding); - rStrm >> b; bPage = (BOOL) b; - rStrm.ReadByteString(aBin, eEncoding); - rStrm >> i; nCol = i; - rStrm >> i; nRow = i; - rStrm >> l; lHDist = l; - rStrm >> l; lVDist = l; - rStrm >> l; lWidth = l; - rStrm >> l; lHeight = l; - rStrm >> l; lLeft = l; - rStrm >> l; lUpper = l; - rStrm >> i; nCols = i; - rStrm >> i; nRows = i; - - if ( nVersion >= LAB_VERSION2 ) - { - rStrm.ReadByteString(aLstMake, eEncoding); - rStrm.ReadByteString(aLstType, eEncoding); - } - if ( nVersion >= LAB_VERSION3 ) - rStrm.ReadByteString(sDBName, eEncoding); - - if ( nVersion >= LAB_VERSION4 ) + static const char* aLabelPropNames[] = { - rStrm >> b; - bSynchron = (BOOL)b; - } - if(!bLabel) + "Medium/Continous", // 0 + "Medium/Brand", // 1 + "Medium/Type", // 2 + "Format/Column", // 3 + "Format/Row", // 4 + "Format/HorizontalDistance",// 5 + "Format/VerticalDistance", // 6 + "Format/Width", // 7 + "Format/Height", // 8 + "Format/LeftMargin", // 9 + "Format/TopMargin", //10 + "Option/Synchronize", //11 + "Option/Page", //12 + "Option/Column", //13 + "Option/Row", //14 + "Inscription/UseAddress", //15 + "Inscription/Address", //16 + "Inscription/Database" //17 + }; + static const char* aBusinessPropNames[] = { - rStrm.ReadByteString(aPrivFirstName, eEncoding); - rStrm.ReadByteString(aPrivName, eEncoding); - rStrm.ReadByteString(aPrivShortCut, eEncoding); - if ( nVersion >= LAB_VERSION6 ) - { - rStrm.ReadByteString(aPrivFirstName2, eEncoding); - rStrm.ReadByteString(aPrivName2, eEncoding); - rStrm.ReadByteString(aPrivShortCut2, eEncoding); - } - rStrm.ReadByteString(aPrivStreet, eEncoding); - rStrm.ReadByteString(aPrivZip, eEncoding); - rStrm.ReadByteString(aPrivCity, eEncoding); - rStrm.ReadByteString(aPrivCountry, eEncoding); - rStrm.ReadByteString(aPrivState , eEncoding); - rStrm.ReadByteString(aPrivTitle , eEncoding); - rStrm.ReadByteString(aPrivProfession , eEncoding); - rStrm.ReadByteString(aPrivPhone , eEncoding); - rStrm.ReadByteString(aPrivMobile , eEncoding); - rStrm.ReadByteString(aPrivFax , eEncoding); - rStrm.ReadByteString(aPrivWWW , eEncoding); - rStrm.ReadByteString(aPrivMail , eEncoding); - rStrm.ReadByteString(aCompCompany , eEncoding); - rStrm.ReadByteString(aCompCompanyExt , eEncoding); - rStrm.ReadByteString(aCompSlogan , eEncoding); - rStrm.ReadByteString(aCompStreet , eEncoding); - rStrm.ReadByteString(aCompZip , eEncoding); - rStrm.ReadByteString(aCompCity , eEncoding); - rStrm.ReadByteString(aCompCountry , eEncoding); - rStrm.ReadByteString(aCompState , eEncoding); - rStrm.ReadByteString(aCompPosition , eEncoding); - rStrm.ReadByteString(aCompPhone , eEncoding); - rStrm.ReadByteString(aCompMobile , eEncoding); - rStrm.ReadByteString(aCompFax , eEncoding); - rStrm.ReadByteString(aCompWWW , eEncoding); - rStrm.ReadByteString(aCompMail , eEncoding); - - rStrm.ReadByteString(sGlossaryGroup , eEncoding); - rStrm.ReadByteString(sGlossaryBlockName , eEncoding); - } - return SfxConfigItem::ERR_OK; + "PrivateAddress/FirstName", // 0 + "PrivateAddress/Name", // 1 + "PrivateAddress/ShortCut", // 2 + "PrivateAddress/SecondFirstName", // 3 + "PrivateAddress/SecondName", // 4 + "PrivateAddress/SecondShortCut", // 5 + "PrivateAddress/Street", // 6 + "PrivateAddress/Zip", // 7 + "PrivateAddress/City", // 8 + "PrivateAddress/Country", // 9 + "PrivateAddress/State", // 10 + "PrivateAddress/Title", // 11 + "PrivateAddress/Profession", // 12 + "PrivateAddress/Phone", // 13 + "PrivateAddress/Mobile", // 14 + "PrivateAddress/Fax", // 15 + "PrivateAddress/WebAddress", // 16 + "PrivateAddress/Email", // 17 + "BusinessAddress/Company", // 18 + "BusinessAddress/CompanyExt", // 19 + "BusinessAddress/Slogan", // 20 + "BusinessAddress/Street", // 21 + "BusinessAddress/Zip", // 22 + "BusinessAddress/City", // 23 + "BusinessAddress/Country", // 24 + "BusinessAddress/State", // 25 + "BusinessAddress/Position", // 26 + "BusinessAddress/Phone", // 27 + "BusinessAddress/Mobile", // 28 + "BusinessAddress/Fax", // 29 + "BusinessAddress/WebAddress", // 30 + "BusinessAddress/Email", // 31 + "AutoText/Group", // 32 + "AutoText/Block" // 33 + }; + const int nBusinessCount = bIsLabel ? 0 : 34; + const int nLabelCount = bIsLabel ? 18 : 15; + Sequence<OUString> aNames(nBusinessCount + nLabelCount); + OUString* pNames = aNames.getArray(); + int nIndex = 0; + for(int nLabel = 0; nLabel < nLabelCount; nLabel++) + pNames[nIndex++] = OUString::createFromAscii(aLabelPropNames[nLabel]); + for(int nBusiness = 0; nBusiness < nBusinessCount; nBusiness++) + pNames[nIndex++] = OUString::createFromAscii(aBusinessPropNames[nBusiness]); + return aNames; } -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- -BOOL SwLabItem::Store(SvStream& rStrm, BOOL bLabel) + ---------------------------------------------------------------------------*/ +SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) : + ConfigItem(bLabel ? C2U("Office.Writer/Label") : C2U("Office.Writer/BusinessCard")), + bIsLabel(bLabel) { - rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding(); - rStrm << (unsigned char) bAddr; - rStrm.WriteByteString(aWriting, eEncoding); - rStrm << (unsigned char) bCont; - rStrm.WriteByteString(aMake, eEncoding); - rStrm.WriteByteString(aType, eEncoding); - rStrm << (unsigned char) bPage; - rStrm.WriteByteString(aBin, eEncoding); - rStrm << nCol; - rStrm << nRow; - rStrm << lHDist; - rStrm << lVDist; - rStrm << lWidth; - rStrm << lHeight; - rStrm << lLeft; - rStrm << lUpper; - rStrm << nCols; - rStrm << nRows; - rStrm.WriteByteString(aLstMake, eEncoding); - rStrm.WriteByteString(aLstType, eEncoding); - rStrm.WriteByteString(sDBName, eEncoding); - rStrm << bSynchron; - if(!bLabel) + Sequence<OUString> aNames = GetPropertyNames(); + Sequence<Any> aValues = GetProperties(aNames); + EnableNotification(aNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed") + if(aValues.getLength() == aNames.getLength()) { - rStrm.WriteByteString(aPrivFirstName, eEncoding); - rStrm.WriteByteString(aPrivName, eEncoding); - rStrm.WriteByteString(aPrivShortCut, eEncoding); - rStrm.WriteByteString(aPrivFirstName2, eEncoding); - rStrm.WriteByteString(aPrivName2, eEncoding); - rStrm.WriteByteString(aPrivShortCut2, eEncoding); - rStrm.WriteByteString(aPrivStreet, eEncoding); - rStrm.WriteByteString(aPrivZip, eEncoding); - rStrm.WriteByteString(aPrivCity, eEncoding); - rStrm.WriteByteString(aPrivCountry, eEncoding); - rStrm.WriteByteString(aPrivState, eEncoding); - rStrm.WriteByteString(aPrivTitle, eEncoding); - rStrm.WriteByteString(aPrivProfession, eEncoding); - rStrm.WriteByteString(aPrivPhone, eEncoding); - rStrm.WriteByteString(aPrivMobile, eEncoding); - rStrm.WriteByteString(aPrivFax, eEncoding); - rStrm.WriteByteString(aPrivWWW, eEncoding); - rStrm.WriteByteString(aPrivMail, eEncoding); - rStrm.WriteByteString(aCompCompany, eEncoding); - rStrm.WriteByteString(aCompCompanyExt, eEncoding); - rStrm.WriteByteString(aCompSlogan, eEncoding); - rStrm.WriteByteString(aCompStreet, eEncoding); - rStrm.WriteByteString(aCompZip, eEncoding); - rStrm.WriteByteString(aCompCity, eEncoding); - rStrm.WriteByteString(aCompCountry, eEncoding); - rStrm.WriteByteString(aCompState, eEncoding); - rStrm.WriteByteString(aCompPosition, eEncoding); - rStrm.WriteByteString(aCompPhone, eEncoding); - rStrm.WriteByteString(aCompMobile, eEncoding); - rStrm.WriteByteString(aCompFax, eEncoding); - rStrm.WriteByteString(aCompWWW, eEncoding); - rStrm.WriteByteString(aCompMail, eEncoding); - - rStrm.WriteByteString(sGlossaryGroup, eEncoding); - rStrm.WriteByteString(sGlossaryBlockName, eEncoding); + for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++) + { + DBG_ASSERT(pValues[nProp].hasValue(), "property value missing") + if(pValues[nProp].hasValue()) + { + //to have a contiuous switch an offset is added + if(nProp == 15 && !bIsLabel) + nProperty += 3; + switch(nProperty) + { + case 0: aItem.bCont = *(sal_Bool*)pValues[nProp].getValue(); break;// "Medium/Continous", + case 1: pValues[nProp] >>= aItem.aMake; break;// "Medium/Brand", + case 2: pValues[nProp] >>= aItem.aType; break;// "Medium/Type", + case 3: pValues[nProp] >>= aItem.nCols; break;// "Format/Column", + case 4: pValues[nProp] >>= aItem.nRows; break;// "Format/Row", + case 5: + pValues[nProp] >>= aItem.lHDist; + aItem.lHDist = MM100_TO_TWIP(aItem.lHDist); + break;// "Format/HorizontalDistance", + case 6: + pValues[nProp] >>= aItem.lVDist; + aItem.lVDist = MM100_TO_TWIP(aItem.lVDist); + break;// "Format/VerticalDistance", + case 7: + pValues[nProp] >>= aItem.lWidth; + aItem.lWidth = MM100_TO_TWIP(aItem.lWidth); + break;// "Format/Width", + case 8: + pValues[nProp] >>= aItem.lHeight; + aItem.lHeight = MM100_TO_TWIP(aItem.lHeight); + break;// "Format/Height", + case 9: + pValues[nProp] >>= aItem.lLeft; + aItem.lLeft = MM100_TO_TWIP(aItem.lLeft); + break;// "Format/LeftMargin", + case 10: + pValues[nProp] >>= aItem.lUpper; + aItem.lUpper = MM100_TO_TWIP(aItem.lUpper); + break;// "Format/TopMargin", + case 11: aItem.bSynchron = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Synchronize", + case 12: aItem.bPage = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Page", + case 13: pValues[nProp] >>= aItem.nCol; break;// "Option/Column", + case 14: pValues[nProp] >>= aItem.nRow; break;// "Option/Row" + case 15: aItem.bAddr = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseAddress", + case 16: pValues[nProp] >>= aItem.aWriting; break;// "Inscription/Address", + case 17: pValues[nProp] >>= aItem.sDBName; break;// "Inscription/Database" + case 18: pValues[nProp] >>= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName", + case 19: pValues[nProp] >>= aItem.aPrivName; break;// "PrivateAddress/Name", + case 20: pValues[nProp] >>= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut", + case 21: pValues[nProp] >>= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName", + case 22: pValues[nProp] >>= aItem.aPrivName2; break;// "PrivateAddress/SecondName", + case 23: pValues[nProp] >>= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut", + case 24: pValues[nProp] >>= aItem.aPrivStreet; break;// "PrivateAddress/Street", + case 25: pValues[nProp] >>= aItem.aPrivZip; break;// "PrivateAddress/Zip", + case 26: pValues[nProp] >>= aItem.aPrivCity; break;// "PrivateAddress/City", + case 27: pValues[nProp] >>= aItem.aPrivCountry; break;// "PrivateAddress/Country", + case 28: pValues[nProp] >>= aItem.aPrivState; break;// "PrivateAddress/State", + case 29: pValues[nProp] >>= aItem.aPrivTitle; break;// "PrivateAddress/Title", + case 30: pValues[nProp] >>= aItem.aPrivProfession; break;// "PrivateAddress/Profession", + case 31: pValues[nProp] >>= aItem.aPrivPhone; break;// "PrivateAddress/Phone", + case 32: pValues[nProp] >>= aItem.aPrivMobile; break;// "PrivateAddress/Mobile", + case 33: pValues[nProp] >>= aItem.aPrivFax; break;// "PrivateAddress/Fax", + case 34: pValues[nProp] >>= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress", + case 35: pValues[nProp] >>= aItem.aPrivMail; break;// "PrivateAddress/Email", + case 36: pValues[nProp] >>= aItem.aCompCompany; break;// "BusinessAddress/Company", + case 37: pValues[nProp] >>= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt", + case 38: pValues[nProp] >>= aItem.aCompSlogan; break;// "BusinessAddress/Slogan", + case 39: pValues[nProp] >>= aItem.aCompStreet; break;// "BusinessAddress/Street", + case 40: pValues[nProp] >>= aItem.aCompZip; break;// "BusinessAddress/Zip", + case 41: pValues[nProp] >>= aItem.aCompCity; break;// "BusinessAddress/City", + case 42: pValues[nProp] >>= aItem.aCompCountry; break;// "BusinessAddress/Country", + case 43: pValues[nProp] >>= aItem.aCompState; break;// "BusinessAddress/State", + case 44: pValues[nProp] >>= aItem.aCompPosition; break;// "BusinessAddress/Position", + case 45: pValues[nProp] >>= aItem.aCompPhone; break;// "BusinessAddress/Phone", + case 46: pValues[nProp] >>= aItem.aCompMobile; break;// "BusinessAddress/Mobile", + case 47: pValues[nProp] >>= aItem.aCompFax; break;// "BusinessAddress/Fax", + case 48: pValues[nProp] >>= aItem.aCompWWW; break;// "BusinessAddress/WebAddress", + case 49: pValues[nProp] >>= aItem.aCompMail; break;// "BusinessAddress/Email", + case 50: pValues[nProp] >>= aItem.sGlossaryGroup; break;// "AutoText/Group" + case 51: pValues[nProp] >>= aItem.sGlossaryBlockName; break;// "AutoText/Block" + } + } + } } - - return SfxConfigItem::ERR_OK; } -// ---------------------------------------------------------------------------- -int SwLabCfgItem::Load(SvStream& rStrm) +/* -----------------------------25.09.00 16:26-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwLabCfgItem::Commit() { - USHORT nVersion; - rStrm >> nVersion; + Sequence<OUString> aNames = GetPropertyNames(); + OUString* pNames = aNames.getArray(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); - if( nVersion >= LAB_VERSION ) + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++) { - aLabItem.Load(rStrm, nVersion, TRUE); - if(LAB_VERSION5 <= nVersion) - aBusinessItem.Load(rStrm, nVersion, FALSE); - - SetDefault(FALSE); - - return SfxConfigItem::ERR_OK; + //to have a contiuous switch an offset is added + if(nProp == 15 && !bIsLabel) + nProperty += 3; + switch(nProperty) + { + case 0: pValues[nProp].setValue(&aItem.bCont, rType); break;// "Medium/Continous", + case 1: pValues[nProp] <<= aItem.aMake; break;// "Medium/Brand", + case 2: pValues[nProp] <<= aItem.aType; break;// "Medium/Type", + case 3: pValues[nProp] <<= aItem.nCols; break;// "Format/Column", + case 4: pValues[nProp] <<= aItem.nRows; break;// "Format/Row", + case 5: pValues[nProp] <<= TWIP_TO_MM100(aItem.lHDist);break;// "Format/HorizontalDistance", + case 6: pValues[nProp] <<= TWIP_TO_MM100(aItem.lVDist);break;// "Format/VerticalDistance", + case 7: pValues[nProp] <<= TWIP_TO_MM100(aItem.lWidth); break;// "Format/Width", + case 8: pValues[nProp] <<= TWIP_TO_MM100(aItem.lHeight); break;// "Format/Height", + case 9: pValues[nProp] <<= TWIP_TO_MM100(aItem.lLeft); break;// "Format/LeftMargin", + case 10: pValues[nProp] <<= TWIP_TO_MM100(aItem.lUpper); break;// "Format/TopMargin", + case 11: pValues[nProp].setValue(&aItem.bSynchron, rType); break;// "Option/Synchronize", + case 12: pValues[nProp].setValue(&aItem.bPage, rType); break;// "Option/Page", + case 13: pValues[nProp] <<= aItem.nCol; break;// "Option/Column", + case 14: pValues[nProp] <<= aItem.nRow; break;// "Option/Row" + case 15: pValues[nProp].setValue(&aItem.bAddr, rType); break;// "Inscription/UseAddress", + case 16: pValues[nProp] <<= aItem.aWriting; break;// "Inscription/Address", + case 17: pValues[nProp] <<= aItem.sDBName; break;// "Inscription/Database" + case 18: pValues[nProp] <<= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName", + case 19: pValues[nProp] <<= aItem.aPrivName; break;// "PrivateAddress/Name", + case 20: pValues[nProp] <<= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut", + case 21: pValues[nProp] <<= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName", + case 22: pValues[nProp] <<= aItem.aPrivName2; break;// "PrivateAddress/SecondName", + case 23: pValues[nProp] <<= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut", + case 24: pValues[nProp] <<= aItem.aPrivStreet; break;// "PrivateAddress/Street", + case 25: pValues[nProp] <<= aItem.aPrivZip; break;// "PrivateAddress/Zip", + case 26: pValues[nProp] <<= aItem.aPrivCity; break;// "PrivateAddress/City", + case 27: pValues[nProp] <<= aItem.aPrivCountry; break;// "PrivateAddress/Country", + case 28: pValues[nProp] <<= aItem.aPrivState; break;// "PrivateAddress/State", + case 29: pValues[nProp] <<= aItem.aPrivTitle; break;// "PrivateAddress/Title", + case 30: pValues[nProp] <<= aItem.aPrivProfession; break;// "PrivateAddress/Profession", + case 31: pValues[nProp] <<= aItem.aPrivPhone; break;// "PrivateAddress/Phone", + case 32: pValues[nProp] <<= aItem.aPrivMobile; break;// "PrivateAddress/Mobile", + case 33: pValues[nProp] <<= aItem.aPrivFax; break;// "PrivateAddress/Fax", + case 34: pValues[nProp] <<= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress", + case 35: pValues[nProp] <<= aItem.aPrivMail; break;// "PrivateAddress/Email", + case 36: pValues[nProp] <<= aItem.aCompCompany; break;// "BusinessAddress/Company", + case 37: pValues[nProp] <<= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt", + case 38: pValues[nProp] <<= aItem.aCompSlogan; break;// "BusinessAddress/Slogan", + case 39: pValues[nProp] <<= aItem.aCompStreet; break;// "BusinessAddress/Street", + case 40: pValues[nProp] <<= aItem.aCompZip; break;// "BusinessAddress/Zip", + case 41: pValues[nProp] <<= aItem.aCompCity; break;// "BusinessAddress/City", + case 42: pValues[nProp] <<= aItem.aCompCountry; break;// "BusinessAddress/Country", + case 43: pValues[nProp] <<= aItem.aCompState; break;// "BusinessAddress/State", + case 44: pValues[nProp] <<= aItem.aCompPosition; break;// "BusinessAddress/Position", + case 45: pValues[nProp] <<= aItem.aCompPhone; break;// "BusinessAddress/Phone", + case 46: pValues[nProp] <<= aItem.aCompMobile; break;// "BusinessAddress/Mobile", + case 47: pValues[nProp] <<= aItem.aCompFax; break;// "BusinessAddress/Fax", + case 48: pValues[nProp] <<= aItem.aCompWWW; break;// "BusinessAddress/WebAddress", + case 49: pValues[nProp] <<= aItem.aCompMail; break;// "BusinessAddress/Email", + case 50: pValues[nProp] <<= aItem.sGlossaryGroup; break;// "AutoText/Group" + case 51: pValues[nProp] <<= aItem.sGlossaryBlockName; break;// "AutoText/Block" + } } - else - return SfxConfigItem::WARNING_VERSION; -} - -BOOL SwLabCfgItem::Store(SvStream& rStrm) -{ - rStrm << (USHORT)CUR_LAB_VERSION; - aLabItem.Store(rStrm, TRUE); - aBusinessItem.Store(rStrm, FALSE); - return SfxConfigItem::ERR_OK; -} -// ---------------------------------------------------------------------------- -void SwLabCfgItem::UseDefault() -{ - aLabItem = SwLabItem(); - aBusinessItem = SwLabItem(); - //Fill item with user data - SvxAddressItem aAdr( pPathFinder->GetAddress() ); - - aBusinessItem.aPrivFirstName = aAdr.GetFirstName(); - aBusinessItem.aPrivName = aAdr.GetName(); - aBusinessItem.aPrivShortCut = aAdr.GetShortName(); - aBusinessItem.aCompCompany = aAdr.GetToken( ADDRESS_COMPANY ); - aBusinessItem.aCompStreet = aBusinessItem.aPrivStreet = aAdr.GetToken( ADDRESS_STREET); - - aBusinessItem.aCompCountry = aBusinessItem.aPrivCountry = aAdr.GetToken( ADDRESS_COUNTRY); - aBusinessItem.aCompZip = aBusinessItem.aPrivZip= aAdr.GetToken( ADDRESS_PLZ ); - aBusinessItem.aCompCity = aBusinessItem.aPrivCity = aAdr.GetToken( ADDRESS_CITY ); - aBusinessItem.aPrivTitle = aAdr.GetToken( ADDRESS_TITLE ); - aBusinessItem.aCompPosition = aAdr.GetToken( ADDRESS_POSITION ); - aBusinessItem.aPrivPhone = aAdr.GetToken( ADDRESS_TEL_PRIVATE ); - aBusinessItem.aCompPhone = aAdr.GetToken( ADDRESS_TEL_COMPANY ); - aBusinessItem.aCompFax = aBusinessItem.aPrivFax = aAdr.GetToken( ADDRESS_FAX ); - aBusinessItem.aCompMail = aBusinessItem.aPrivMail = aAdr.GetToken( ADDRESS_EMAIL ); - aBusinessItem.aCompState = aBusinessItem.aPrivState = aAdr.GetToken( ADDRESS_STATE ); - aBusinessItem.bSynchron = TRUE; - - SfxConfigItem::UseDefault(); -} -// ---------------------------------------------------------------------------- -String SwLabCfgItem::GetName() const -{ - return SW_RESSTR(STR_CFG_LABIMG); + PutProperties(aNames, aValues); } - - -/* -$Log: not supported by cvs2svn $ -Revision 1.38 2000/09/18 16:05:26 willem.vandorp -OpenOffice header added. - -Revision 1.37 2000/06/26 16:32:15 jp -have to change: enums of AddressToken - -Revision 1.36 2000/05/26 07:21:29 os -old SW Basic API Slots removed - -Revision 1.35 2000/04/18 15:31:35 os -UNICODE - -Revision 1.34 2000/02/11 14:45:49 hr -#70473# changes for unicode ( patched by automated patchtool ) - -Revision 1.33 2000/01/11 13:26:13 os -#71720# business cards synchronized by default - -Revision 1.32 1999/12/07 16:34:13 os -#70355##70559# SHORTCUT->INITIALS; second private name - -Revision 1.31 1999/09/30 07:53:06 os -Label config item and LabItem contain business information - -Revision 1.30 1998/03/14 16:06:50 OM -Gelinkte Etiketten - - - Rev 1.29 14 Mar 1998 17:06:50 OM - Gelinkte Etiketten - - Rev 1.28 24 Nov 1997 11:52:10 MA - includes - - Rev 1.27 03 Nov 1997 13:17:14 MA - precomp entfernt - - Rev 1.26 08 Aug 1997 17:29:34 OM - Headerfile-Umstellung - - Rev 1.25 18 Nov 1996 10:45:48 SWG - includes - - Rev 1.24 14 Nov 1996 15:24:44 TRI - includes - - Rev 1.23 11 Nov 1996 09:44:16 MA - ResMgr - - Rev 1.22 26 Jul 1996 20:36:40 MA - includes - - Rev 1.21 28 Jun 1996 10:10:52 OS - UseDefault: Basisklasse rufen - - Rev 1.20 06 Jun 1996 12:59:42 OM - Datenbankname merken - - Rev 1.19 27 Nov 1995 18:55:40 OS - Umstellung 303a - - Rev 1.18 24 Nov 1995 16:59:40 OM - PCH->PRECOMPILED - - Rev 1.17 16 Nov 1995 18:37:46 OS - neu: Get/SetVariable, nicht impl. - - Rev 1.16 21 Sep 1995 00:40:56 JP - Bug 19511: VersionsNummer im richtigen Format aus dem Stream lesen (int <-> USHORT!!!) - - Rev 1.15 15 Sep 1995 21:14:22 OS - add: cfgstr.hrc - - Rev 1.14 15 Sep 1995 12:41:00 OS - GetName() implementiert - - Rev 1.13 04 Sep 1995 13:53:58 HJS - add: #include <sbx.hxx> - - Rev 1.12 09 Aug 1995 18:59:46 AMA - kein GetPresentation - - Rev 1.11 07 Aug 1995 18:19:46 AMA - Umbau: GetValueText -> GetPresentation - - Rev 1.10 30 Jul 1995 11:25:30 MA - chg: Letze Einstellung merken fuer Label - - Rev 1.9 10 Jul 1995 09:52:36 MA - LabelDlg optimiert und etwas aufgeraeumt. - - Rev 1.8 24 May 1995 18:17:14 ER - Segmentierung - - Rev 1.7 17 Mar 1995 17:10:30 PK - geht immer weiter - - Rev 1.6 15 Mar 1995 13:27:04 PK - geht immer weiter - - Rev 1.5 06 Mar 1995 00:08:28 PK - linkbarer envelp-zustand - - Rev 1.4 20 Feb 1995 19:39:52 PK - erstma eingecheckt - - Rev 1.3 09 Jan 1995 16:57:48 ER - del: envelp hrc - -*/ - diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx index 9f8ae92f7595..a7551b0c7183 100644 --- a/sw/source/ui/envelp/labimp.hxx +++ b/sw/source/ui/envelp/labimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: labimp.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:36 $ + * last change: $Author: os $ $Date: 2000-09-26 11:55:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -238,17 +238,17 @@ public: SwLabRec() {} SwLabRec( String& rStr, MetricField& rField ); - String aMake; - String aType; - long lHDist; - long lVDist; - long lWidth; - long lHeight; - long lLeft; - long lUpper; - sal_uInt16 nCols; - sal_uInt16 nRows; - sal_Bool bCont; + String aMake; + String aType; + long lHDist; + long lVDist; + long lWidth; + long lHeight; + long lLeft; + long lUpper; + sal_Int32 nCols; + sal_Int32 nRows; + sal_Bool bCont; }; /* -------------------------------------------------- diff --git a/sw/source/ui/inc/labimg.hxx b/sw/source/ui/inc/labimg.hxx index 432d5d2e343c..3f013d9e9d71 100644 --- a/sw/source/ui/inc/labimg.hxx +++ b/sw/source/ui/inc/labimg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: labimg.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:40 $ + * last change: $Author: os $ $Date: 2000-09-26 11:55:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,18 +66,16 @@ #include <svtools/poolitem.hxx> #endif -#ifndef _SFXCFGITEM_HXX //autogen -#include <sfx2/cfgitem.hxx> -#endif - -#ifndef _STRING_HXX //autogen -#include <tools/string.hxx> +#ifndef _UTL_CONFIGITEM_HXX_ +#include <unotools/configitem.hxx> #endif // class SwLabItem ---------------------------------------------------------- +class SwLabCfgItem; class SwLabItem : public SfxPoolItem { + public: SwLabItem(); @@ -89,87 +87,81 @@ public: virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; - int Load (SvStream& rStrm, USHORT nVersion, BOOL bLabel); - BOOL Store(SvStream& rStrm, BOOL bLabel); - - String aLstMake; //Letzte Auswahl merken. - String aLstType; - String sDBName; // Verwendete Datenbank - - String aWriting; // Aufschrift - String aMake; // Etikettenmarke - String aType; // Etikettentyp - String aBin; // Druckerschacht - long lHDist; // Horizontaler Abstand (Benutzer) - long lVDist; // Vertikaler Abstand (Benutzer) - long lWidth; // Breite (Benutzer) - long lHeight; // Hoehe (Benutzer) - long lLeft; // Rand links (Benutzer) - long lUpper; // Rand oben (Benutzer) - USHORT nCols; // Anzahl Spalten (Benutzer) - USHORT nRows; // Anzahl Zeilen (Benutzer) - USHORT nCol; // Spalte fuer Einzeldruck - USHORT nRow; // Zeile fuer Einzeldruck - BOOL bAddr :1;// Adresse als Aufschrift? - BOOL bCont :1;// Endlospapier? - BOOL bPage :1;// Ganze Seite oder einzelnes Etikett? - BOOL bSynchron:1;// Alle Etiketten synchronisieren + rtl::OUString aLstMake; //Letzte Auswahl merken. + rtl::OUString aLstType; + rtl::OUString sDBName; // Verwendete Datenbank + + rtl::OUString aWriting; // Aufschrift + rtl::OUString aMake; // Etikettenmarke + rtl::OUString aType; // Etikettentyp + rtl::OUString aBin; // Druckerschacht + sal_Int32 lHDist; // Horizontaler Abstand (Benutzer) + sal_Int32 lVDist; // Vertikaler Abstand (Benutzer) + sal_Int32 lWidth; // Breite (Benutzer) + sal_Int32 lHeight; // Hoehe (Benutzer) + sal_Int32 lLeft; // Rand links (Benutzer) + sal_Int32 lUpper; // Rand oben (Benutzer) + sal_Int32 nCols; // Anzahl Spalten (Benutzer) + sal_Int32 nRows; // Anzahl Zeilen (Benutzer) + sal_Int32 nCol; // Spalte fuer Einzeldruck + sal_Int32 nRow; // Zeile fuer Einzeldruck + sal_Bool bAddr;// Adresse als Aufschrift? + sal_Bool bCont;// Endlospapier? + sal_Bool bPage;// Ganze Seite oder einzelnes Etikett? + sal_Bool bSynchron;// Alle Etiketten synchronisieren //parts of the business card - String aPrivFirstName; - String aPrivName; - String aPrivShortCut; - String aPrivFirstName2; - String aPrivName2; - String aPrivShortCut2; - String aPrivStreet; - String aPrivZip; - String aPrivCity; - String aPrivCountry; - String aPrivState; - String aPrivTitle; - String aPrivProfession; - String aPrivPhone; - String aPrivMobile; - String aPrivFax; - String aPrivWWW; - String aPrivMail; - String aCompCompany; - String aCompCompanyExt; - String aCompSlogan; - String aCompStreet; - String aCompZip; - String aCompCity; - String aCompCountry; - String aCompState; - String aCompPosition; - String aCompPhone; - String aCompMobile; - String aCompFax; - String aCompWWW; - String aCompMail; - - String sGlossaryGroup; - String sGlossaryBlockName; + rtl::OUString aPrivFirstName; + rtl::OUString aPrivName; + rtl::OUString aPrivShortCut; + rtl::OUString aPrivFirstName2; + rtl::OUString aPrivName2; + rtl::OUString aPrivShortCut2; + rtl::OUString aPrivStreet; + rtl::OUString aPrivZip; + rtl::OUString aPrivCity; + rtl::OUString aPrivCountry; + rtl::OUString aPrivState; + rtl::OUString aPrivTitle; + rtl::OUString aPrivProfession; + rtl::OUString aPrivPhone; + rtl::OUString aPrivMobile; + rtl::OUString aPrivFax; + rtl::OUString aPrivWWW; + rtl::OUString aPrivMail; + rtl::OUString aCompCompany; + rtl::OUString aCompCompanyExt; + rtl::OUString aCompSlogan; + rtl::OUString aCompStreet; + rtl::OUString aCompZip; + rtl::OUString aCompCity; + rtl::OUString aCompCountry; + rtl::OUString aCompState; + rtl::OUString aCompPosition; + rtl::OUString aCompPhone; + rtl::OUString aCompMobile; + rtl::OUString aCompFax; + rtl::OUString aCompWWW; + rtl::OUString aCompMail; + + rtl::OUString sGlossaryGroup; + rtl::OUString sGlossaryBlockName; }; // class SwLabCfgItem ------------------------------------------------------- -class SwLabCfgItem : public SfxConfigItem +class SwLabCfgItem : public utl::ConfigItem { - SwLabItem aLabItem; - SwLabItem aBusinessItem; -protected: - virtual int Load (SvStream& rStrm); - virtual BOOL Store(SvStream& rStrm); - virtual void UseDefault(); + SwLabItem aItem; + sal_Bool bIsLabel; + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); public: - SwLabCfgItem(); + SwLabCfgItem(sal_Bool bLabel); + + SwLabItem& GetItem() {return aItem;} - SwLabItem& GetLabItem() {return aLabItem;} - SwLabItem& GetBusinessItem() {return aBusinessItem;} - virtual String GetName() const; + virtual void Commit(); }; #endif |