diff options
Diffstat (limited to 'sw/source/ui/envelp')
34 files changed, 10075 insertions, 0 deletions
diff --git a/sw/source/ui/envelp/envelp.src b/sw/source/ui/envelp/envelp.src new file mode 100644 index 000000000000..9b308240c0dc --- /dev/null +++ b/sw/source/ui/envelp/envelp.src @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envelp.src,v $ + * $Revision: 1.35 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "envelp.hrc" +#include "globals.hrc" + // Strings ****************************************************************** +String STR_DATABASE_NOT_OPENED +{ + Text [ en-US ] = "Database could not be opened." ; +}; +String STR_NO_DRIVERS +{ + Text [ en-US ] = "No database drivers installed." ; +}; +String STR_BTN_NEW_DOC +{ + Text [ en-US ] = "~New Document" ; +}; + +String STR_BTN_NEWDOC +{ + Text [ en-US ] = "~New Doc."; +}; + +String STR_SENDER_TOKENS +{ + Text [ en-US ] = "COMPANY;CR;FIRSTNAME; ;LASTNAME;CR;ADDRESS;CR;CITY; ;STATEPROV; ;POSTALCODE;CR;COUNTRY;CR;"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx new file mode 100644 index 000000000000..f6fb3f596a35 --- /dev/null +++ b/sw/source/ui/envelp/envfmt.cxx @@ -0,0 +1,638 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envfmt.cxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + + +#include <hintids.hxx> + +#include <tools/pstm.hxx> + +#define _SVSTDARR_LONGSSORT +#define _SVSTDARR_LONGS +#include <svtools/svstdarr.hxx> +#include <svx/paperinf.hxx> +#ifndef _SVX_TSTPITEM_HXX //autogen +#include <svx/tstpitem.hxx> +#endif +#include <svx/lrspitem.hxx> +#include <svx/brshitem.hxx> +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _MENU_HXX //autogen +#include <vcl/menu.hxx> +#endif + +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#include <frmatr.hxx> +#include <swtypes.hxx> +#include <wrtsh.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#ifndef _BASESH_HXX +#include <basesh.hxx> +#endif +#include <drpcps.hxx> +#include <envfmt.hxx> +#include <fmtcol.hxx> +#ifndef _PARDLG_HXX +#include "swuipardlg.hxx" +#endif +#include <pattern.hxx> +#include <poolfmt.hxx> +#include <uiborder.hxx> +#include <uitool.hxx> + +#ifndef _ENVFMT_HRC +#include <envfmt.hrc> +#endif + +#include "swabstdlg.hxx" +#include "chrdlg.hrc" + +namespace swui +{ + SwAbstractDialogFactory * GetFactory(); +} + +static PopupMenu *pMenu; +static long lUserW = 5669; // 10 cm +static long lUserH = 5669; // 10 cm + +// -------------------------------------------------------------------------- + + +SwEnvFmtPage::SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet) : + + SfxTabPage(pParent, SW_RES(TP_ENV_FMT), rSet), + + aAddrFL (this, SW_RES( FL_ADDRESSEE )), + aAddrPosInfo (this, SW_RES( TXT_ADDR_POS )), + aAddrLeftText (this, SW_RES( TXT_ADDR_LEFT )), + aAddrLeftField (this, SW_RES( FLD_ADDR_LEFT )), + aAddrTopText (this, SW_RES( TXT_ADDR_TOP )), + aAddrTopField (this, SW_RES( FLD_ADDR_TOP )), + aAddrFormatInfo (this, SW_RES( TXT_ADDR_FORMAT )), + aAddrEditButton (this, SW_RES( BTN_ADDR_EDIT )), + aSendFL (this, SW_RES( FL_SENDER )), + aSendPosInfo (this, SW_RES( TXT_SEND_POS )), + aSendLeftText (this, SW_RES( TXT_SEND_LEFT )), + aSendLeftField (this, SW_RES( FLD_SEND_LEFT )), + aSendTopText (this, SW_RES( TXT_SEND_TOP )), + aSendTopField (this, SW_RES( FLD_SEND_TOP )), + aSendFormatInfo (this, SW_RES( TXT_SEND_FORMAT )), + aSendEditButton (this, SW_RES( BTN_SEND_EDIT )), + aSizeFL (this, SW_RES( FL_SIZE )), + aSizeFormatText (this, SW_RES( TXT_SIZE_FORMAT )), + aSizeFormatBox (this, SW_RES( BOX_SIZE_FORMAT )), + aSizeWidthText (this, SW_RES( TXT_SIZE_WIDTH )), + aSizeWidthField (this, SW_RES( FLD_SIZE_WIDTH )), + aSizeHeightText (this, SW_RES( TXT_SIZE_HEIGHT )), + aSizeHeightField (this, SW_RES( FLD_SIZE_HEIGHT )), + aPreview (this, SW_RES( WIN_PREVIEW )) + +{ + FreeResource(); + SetExchangeSupport(); + + // Metriken + FieldUnit aMetric = ::GetDfltMetric(FALSE); + SetMetric(aAddrLeftField, aMetric); + SetMetric(aAddrTopField, aMetric); + SetMetric(aSendLeftField, aMetric); + SetMetric(aSendTopField, aMetric); + SetMetric(aSizeWidthField, aMetric); + SetMetric(aSizeHeightField, aMetric); + + // Menues einhaengen + ::pMenu = new PopupMenu(SW_RES(MNU_EDIT)); + aAddrEditButton.SetPopupMenu(::pMenu); + aSendEditButton.SetPopupMenu(::pMenu); + + // Handler installieren + Link aLk = LINK(this, SwEnvFmtPage, ModifyHdl); + aAddrLeftField .SetUpHdl( aLk ); + aAddrTopField .SetUpHdl( aLk ); + aSendLeftField .SetUpHdl( aLk ); + aSendTopField .SetUpHdl( aLk ); + aSizeWidthField .SetUpHdl( aLk ); + aSizeHeightField.SetUpHdl( aLk ); + + aAddrLeftField .SetDownHdl( aLk ); + aAddrTopField .SetDownHdl( aLk ); + aSendLeftField .SetDownHdl( aLk ); + aSendTopField .SetDownHdl( aLk ); + aSizeWidthField .SetDownHdl( aLk ); + aSizeHeightField.SetDownHdl( aLk ); + + aAddrLeftField .SetLoseFocusHdl( aLk ); + aAddrTopField .SetLoseFocusHdl( aLk ); + aSendLeftField .SetLoseFocusHdl( aLk ); + aSendTopField .SetLoseFocusHdl( aLk ); + aSizeWidthField .SetLoseFocusHdl( aLk ); + aSizeHeightField.SetLoseFocusHdl( aLk ); + + aLk = LINK(this, SwEnvFmtPage, EditHdl ); + aAddrEditButton.SetSelectHdl( aLk ); + aSendEditButton.SetSelectHdl( aLk ); + + aPreview.SetBorderStyle( WINDOW_BORDER_MONO ); + + aSizeFormatBox .SetSelectHdl(LINK(this, SwEnvFmtPage, FormatHdl)); + + // aSizeFormatBox + for (USHORT i = PAPER_A3; i <= PAPER_KAI32BIG; i++) + { + if (i != PAPER_USER) + { + String aPaperName = SvxPaperInfo::GetName((Paper) i), + aEntryName; + + USHORT nPos = 0; + BOOL bFound = FALSE; + while (nPos < aSizeFormatBox.GetEntryCount() && !bFound) + { + aEntryName = aSizeFormatBox.GetEntry(i); + if (aEntryName < aPaperName) + nPos++; + else + bFound = TRUE; + } + aSizeFormatBox.InsertEntry(aPaperName, nPos); + aIDs.Insert((USHORT) i, nPos); + } + } + aSizeFormatBox.InsertEntry(SvxPaperInfo::GetName(PAPER_USER)); + aIDs.Insert((USHORT) PAPER_USER, aIDs.Count()); + +} + +// -------------------------------------------------------------------------- + + +__EXPORT SwEnvFmtPage::~SwEnvFmtPage() +{ + aAddrEditButton.SetPopupMenu(0); + aSendEditButton.SetPopupMenu(0); + delete ::pMenu; +} + +// -------------------------------------------------------------------------- + + +IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit ) +{ + long lWVal = static_cast< long >(GetFldVal(aSizeWidthField )); + long lHVal = static_cast< long >(GetFldVal(aSizeHeightField)); + + long lWidth = Max(lWVal, lHVal); + long lHeight = Min(lWVal, lHVal); + + if (pEdit == &aSizeWidthField || pEdit == &aSizeHeightField) + { + Paper ePaper = SvxPaperInfo::GetSvxPaper( + Size(lHeight, lWidth), MAP_TWIP, TRUE); + for (USHORT i = 0; i < aIDs.Count(); i++) + if (aIDs[i] == (USHORT)ePaper) + aSizeFormatBox.SelectEntryPos(i); + + // Benutzergroesse merken + if (aIDs[aSizeFormatBox.GetSelectEntryPos()] == (USHORT)PAPER_USER) + { + lUserW = lWidth ; + lUserH = lHeight; + } + + aSizeFormatBox.GetSelectHdl().Call(&aSizeFormatBox); + } + else + { + FillItem(GetParent()->aEnvItem); + SetMinMax(); + aPreview.Invalidate(); + } + return 0; +} +IMPL_LINK_INLINE_END( SwEnvFmtPage, ModifyHdl, Edit *, pEdit ) + +// -------------------------------------------------------------------------- + + +IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton ) +{ + SwWrtShell* pSh = GetParent()->pSh; + ASSERT(pSh, "Shell fehlt"); + + // Collection-Ptr ermitteln + BOOL bSender = pButton != &aAddrEditButton; + + SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool( static_cast< USHORT >( + bSender ? RES_POOLCOLL_SENDADRESS : RES_POOLCOLL_JAKETADRESS)); + ASSERT(pColl, "Text-Collection fehlt"); + + switch (pButton->GetCurItemId()) + { + case MID_CHAR: + { + SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender); + + // Damit die Hintergrundfarbe nicht uebergebuegelt wird: + SfxAllItemSet aTmpSet(*pCollSet); + + // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in + // ein RES_BACKGROUND verwandelt und wieder zurueck ... + const SfxPoolItem *pTmpBrush; + + if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_CHRATR_BACKGROUND, + TRUE, &pTmpBrush ) ) + { + SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) ); + aTmpBrush.SetWhich( RES_BACKGROUND ); + aTmpSet.Put( aTmpBrush ); + } + else + aTmpSet.ClearItem( RES_BACKGROUND ); + + SwAbstractDialogFactory* pFact = swui::GetFactory(); + DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); + + SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( GetParent(), pSh->GetView(), aTmpSet, DLG_CHAR ,&pColl->GetName() ); + DBG_ASSERT(pDlg, "Dialogdiet fail!"); + if (pDlg->Execute() == RET_OK) + { + SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() ); + if( SFX_ITEM_SET == aOutputSet.GetItemState( RES_BACKGROUND, + FALSE, &pTmpBrush ) ) + { + SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) ); + aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND ); + pCollSet->Put( aTmpBrush ); + } + aOutputSet.ClearItem( RES_BACKGROUND ); + //pColl->SetAttr( aTmpSet ); + pCollSet->Put(aOutputSet); + } + delete pDlg; + } + break; + + case MID_PARA: + { + SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender); + + // Damit die Tabulatoren nicht uebergebuegelt werden: + SfxAllItemSet aTmpSet(*pCollSet); + + // Tabulatoren, DefaultTabs ins ItemSet Stecken + const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) + pSh->GetView().GetCurShell()->GetPool().GetDefaultItem(RES_PARATR_TABSTOP); + + USHORT nDefDist = ::GetTabDist( rDefTabs ); + SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist ); + aTmpSet.Put( aDefDistItem ); + + // Aktueller Tab + SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 ); + aTmpSet.Put( aTabPos ); + + // linker Rand als Offset + const long nOff = ((SvxLRSpaceItem&)aTmpSet.Get( RES_LR_SPACE )). + GetTxtLeft(); + SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); + aTmpSet.Put( aOff ); + + // BoxInfo setzen + ::PrepareBoxInfo( aTmpSet, *pSh ); + + SwParaDlg *pDlg = new SwParaDlg(GetParent(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &pColl->GetName()); + + if ( pDlg->Execute() == RET_OK ) + { + // Defaults evtl umsetzen + const SfxPoolItem* pItem = 0; + SfxItemSet* pOutputSet = (SfxItemSet*)pDlg->GetOutputItemSet(); + USHORT nNewDist; + if( SFX_ITEM_SET == pOutputSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, + FALSE, &pItem ) && + nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) ) + { + SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); + MakeDefTabs( nNewDist, aDefTabs ); + pSh->SetDefault( aDefTabs ); + pOutputSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS ); + } + if( pOutputSet->Count() ) + { + //pColl->SetAttr( *pOutputSet ); + pCollSet->Put(*pOutputSet); + } + } + delete pDlg; + } + break; + } + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: Ein temporaeres Itemset, das bei Abbruch verworfen wird +------------------------------------------------------------------------*/ + +SfxItemSet *SwEnvFmtPage::GetCollItemSet(SwTxtFmtColl* pColl, BOOL bSender) +{ + SfxItemSet *&pAddrSet = bSender ? GetParent()->pSenderSet : GetParent()->pAddresseeSet; + + if (!pAddrSet) + { + // Range ermitteln (Ranges beider Itemsets mergen) + const USHORT *pRanges = pColl->GetAttrSet().GetRanges(); + + static USHORT __READONLY_DATA aRanges[] = + { + RES_PARATR_BEGIN, RES_PARATR_ADJUST, + RES_PARATR_TABSTOP, RES_PARATR_END-1, + RES_LR_SPACE, RES_UL_SPACE, + RES_BACKGROUND, RES_SHADOW, + SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS, + SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS, + SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET, + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, + 0, 0 + }; + + // BruteForce-Merge, weil MergeRange in SvTools buggy ist: + USHORT i = 0; + SvLongsSort aMergedRanges( 0, 10 ); + + while (pRanges[i]) + { + for (USHORT nPos = pRanges[i]; nPos <= pRanges[i+1]; nPos++) + aMergedRanges.Insert(nPos); + i += 2; + } + + i = 0; + + while (aRanges[i]) + { + for (USHORT nPos = aRanges[i]; nPos <= aRanges[i+1]; nPos++) + aMergedRanges.Insert(nPos); + i += 2; + } + + // Ranges kompaktieren + SvLongs aCompactedRanges( 0, 10 ); + + aCompactedRanges.Insert(aMergedRanges[0], aCompactedRanges.Count()); + + for (i = 0; i < aMergedRanges.Count(); i++) + { + while (i + 1 < aMergedRanges.Count() && + aMergedRanges[i+1] - aMergedRanges[i] == 1) + { + i++; + } + long nEnd = aMergedRanges[i]; + aCompactedRanges.Insert(nEnd, aCompactedRanges.Count()); + + if (i + 1 < aMergedRanges.Count()) + { + long nStart = aMergedRanges[i+1]; + aCompactedRanges.Insert(nStart, aCompactedRanges.Count()); + } + } + + // Neue Ranges erzeugen + USHORT *pNewRanges = new USHORT[aCompactedRanges.Count() + 1]; + for (i = 0; i < aCompactedRanges.Count(); i++) + pNewRanges[i] = (USHORT)aCompactedRanges[i]; + + pNewRanges[i] = 0; + + pAddrSet = new SfxItemSet(GetParent()->pSh->GetView().GetCurShell()->GetPool(), + pNewRanges); + + pAddrSet->Put(pColl->GetAttrSet()); + delete[] pNewRanges; + } + + return pAddrSet; +} + +// -------------------------------------------------------------------------- + + +IMPL_LINK( SwEnvFmtPage, FormatHdl, ListBox *, EMPTYARG ) +{ + long lWidth; + long lHeight; + long lSendFromLeft; + long lSendFromTop; + long lAddrFromLeft; + long lAddrFromTop; + + USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()]; + if (nPaper != (USHORT)PAPER_USER) + { + Size aSz = SvxPaperInfo::GetPaperSize((Paper)nPaper); + lWidth = Max(aSz.Width(), aSz.Height()); + lHeight = Min(aSz.Width(), aSz.Height()); + } + else + { + lWidth = lUserW; + lHeight = lUserH; + } + + lSendFromLeft = 566; // 1cm + lSendFromTop = 566; // 1cm + lAddrFromLeft = lWidth / 2; + lAddrFromTop = lHeight / 2; + + SetFldVal(aAddrLeftField, lAddrFromLeft); + SetFldVal(aAddrTopField , lAddrFromTop ); + SetFldVal(aSendLeftField, lSendFromLeft); + SetFldVal(aSendTopField , lSendFromTop ); + + SetFldVal(aSizeWidthField , lWidth ); + SetFldVal(aSizeHeightField, lHeight); + + SetMinMax(); + + FillItem(GetParent()->aEnvItem); + aPreview.Invalidate(); + return 0; +} + +// -------------------------------------------------------------------------- + + +void SwEnvFmtPage::SetMinMax() +{ + long lWVal = static_cast< long >(GetFldVal(aSizeWidthField )); + long lHVal = static_cast< long >(GetFldVal(aSizeHeightField)); + + long lWidth = Max(lWVal, lHVal), + lHeight = Min(lWVal, lHVal); + + // Min und Max + aAddrLeftField.SetMin((long) 100 * (GetFldVal(aSendLeftField) + 566), FUNIT_TWIP); + aAddrLeftField.SetMax((long) 100 * (lWidth - 2 * 566), FUNIT_TWIP); + aAddrTopField .SetMin((long) 100 * (GetFldVal(aSendTopField ) + 2 * 566), FUNIT_TWIP); + aAddrTopField .SetMax((long) 100 * (lHeight - 2 * 566), FUNIT_TWIP); + aSendLeftField.SetMin((long) 100 * (566), FUNIT_TWIP); + aSendLeftField.SetMax((long) 100 * (GetFldVal(aAddrLeftField) - 566), FUNIT_TWIP); + aSendTopField .SetMin((long) 100 * (566), FUNIT_TWIP); + aSendTopField .SetMax((long) 100 * (GetFldVal(aAddrTopField ) - 2 * 566), FUNIT_TWIP); + + // First und Last + aAddrLeftField.SetFirst(aAddrLeftField.GetMin()); + aAddrLeftField.SetLast (aAddrLeftField.GetMax()); + aAddrTopField .SetFirst(aAddrTopField .GetMin()); + aAddrTopField .SetLast (aAddrTopField .GetMax()); + aSendLeftField.SetFirst(aSendLeftField.GetMin()); + aSendLeftField.SetLast (aSendLeftField.GetMax()); + aSendTopField .SetFirst(aSendTopField .GetMin()); + aSendTopField .SetLast (aSendTopField .GetMax()); + + // Fields neu formatieren + aAddrLeftField .Reformat(); + aAddrTopField .Reformat(); + aSendLeftField .Reformat(); + aSendTopField .Reformat(); + aSizeWidthField .Reformat(); + aSizeHeightField.Reformat(); +} + +// -------------------------------------------------------------------------- + + +SfxTabPage* __EXPORT SwEnvFmtPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwEnvFmtPage(pParent, rSet); +} + +// ---------------------------------------------------------------------------- + + +void __EXPORT SwEnvFmtPage::ActivatePage(const SfxItemSet& rSet) +{ + SfxItemSet aSet(rSet); + aSet.Put(GetParent()->aEnvItem); + Reset(aSet); +} + +// ---------------------------------------------------------------------------- + + +int __EXPORT SwEnvFmtPage::DeactivatePage(SfxItemSet* _pSet) +{ + if( _pSet ) + FillItemSet(*_pSet); + return SfxTabPage::LEAVE_PAGE; +} + +// -------------------------------------------------------------------------- + + +void SwEnvFmtPage::FillItem(SwEnvItem& rItem) +{ + rItem.lAddrFromLeft = static_cast< sal_Int32 >(GetFldVal(aAddrLeftField)); + rItem.lAddrFromTop = static_cast< sal_Int32 >(GetFldVal(aAddrTopField )); + rItem.lSendFromLeft = static_cast< sal_Int32 >(GetFldVal(aSendLeftField)); + rItem.lSendFromTop = static_cast< sal_Int32 >(GetFldVal(aSendTopField )); + + USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()]; + if (nPaper == (USHORT)PAPER_USER) + { + long lWVal = static_cast< long >(GetFldVal(aSizeWidthField )); + long lHVal = static_cast< long >(GetFldVal(aSizeHeightField)); + rItem.lWidth = Max(lWVal, lHVal); + rItem.lHeight = Min(lWVal, lHVal); + } + else + { + long lWVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Width (); + long lHVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Height(); + rItem.lWidth = Max(lWVal, lHVal); + rItem.lHeight = Min(lWVal, lHVal); + } +} + +// -------------------------------------------------------------------------- + + +BOOL __EXPORT SwEnvFmtPage::FillItemSet(SfxItemSet& rSet) +{ + FillItem(GetParent()->aEnvItem); + rSet.Put(GetParent()->aEnvItem); + return TRUE; +} + +// -------------------------------------------------------------------------- + + +void __EXPORT SwEnvFmtPage::Reset(const SfxItemSet& rSet) +{ + const SwEnvItem& rItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP); + + Paper ePaper = SvxPaperInfo::GetSvxPaper( + Size( Min(rItem.lWidth, rItem.lHeight), + Max(rItem.lWidth, rItem.lHeight)), MAP_TWIP, TRUE); + for (USHORT i = 0; i < (USHORT) aIDs.Count(); i++) + if (aIDs[i] == (USHORT)ePaper) + aSizeFormatBox.SelectEntryPos(i); + + // Die MetricFields + SetFldVal(aAddrLeftField, rItem.lAddrFromLeft); + SetFldVal(aAddrTopField , rItem.lAddrFromTop ); + SetFldVal(aSendLeftField, rItem.lSendFromLeft); + SetFldVal(aSendTopField , rItem.lSendFromTop ); + SetFldVal(aSizeWidthField , Max(rItem.lWidth, rItem.lHeight)); + SetFldVal(aSizeHeightField , Min(rItem.lWidth, rItem.lHeight)); + SetMinMax(); + + DELETEZ(GetParent()->pSenderSet); + DELETEZ(GetParent()->pAddresseeSet); +} + + + diff --git a/sw/source/ui/envelp/envfmt.hrc b/sw/source/ui/envelp/envfmt.hrc new file mode 100644 index 000000000000..2b7d83705098 --- /dev/null +++ b/sw/source/ui/envelp/envfmt.hrc @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envfmt.hrc,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ENVFMT_HRC +#define _ENVFMT_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define FL_ADDRESSEE 11 +#define TXT_ADDR_POS 12 +#define TXT_ADDR_LEFT 13 +#define FLD_ADDR_LEFT 14 +#define TXT_ADDR_TOP 15 +#define FLD_ADDR_TOP 16 +#define TXT_ADDR_FORMAT 17 +#define BTN_ADDR_EDIT 18 + +#define FL_SENDER 21 +#define TXT_SEND_POS 22 +#define TXT_SEND_LEFT 23 +#define FLD_SEND_LEFT 24 +#define TXT_SEND_TOP 25 +#define FLD_SEND_TOP 26 +#define TXT_SEND_FORMAT 27 +#define BTN_SEND_EDIT 28 + +#define FL_SIZE 31 +#define TXT_SIZE_FORMAT 32 +#define BOX_SIZE_FORMAT 33 +#define TXT_SIZE_WIDTH 34 +#define FLD_SIZE_WIDTH 35 +#define TXT_SIZE_HEIGHT 36 +#define FLD_SIZE_HEIGHT 37 + +#define WIN_PREVIEW 41 + + +#define MID_CHAR 1 +#define MID_PARA 2 + +// Globale Resourcen ******************************************************** + +#define MNU_EDIT (RC_ENVFMT_BEGIN ) + +// Ueberlaufpruefung ******************************************************** + +#define ENVFMT_ACT_END MNU_EDIT + +#if ENVFMT_ACT_END > RC_ENVFMT_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx new file mode 100644 index 000000000000..16d77e4bccd2 --- /dev/null +++ b/sw/source/ui/envelp/envfmt.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envfmt.hxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ENVFMT_HXX +#define _ENVFMT_HXX + + +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#include <svtools/svstdarr.hxx> +#endif +#include <svtools/stdctrl.hxx> +#ifndef _FIELD_HXX //autogen +#include <vcl/field.hxx> +#endif +#ifndef _MENUBTN_HXX //autogen +#include <vcl/menubtn.hxx> +#endif +#ifndef _GROUP_HXX //autogen +#include <vcl/group.hxx> +#endif + +#include "envlop.hxx" + +class SwTxtFmtColl; + +// class SwEnvFmtPage --------------------------------------------------------- + +class SwEnvFmtPage : public SfxTabPage +{ + + FixedLine aAddrFL; + FixedInfo aAddrPosInfo; + FixedText aAddrLeftText; + MetricField aAddrLeftField; + FixedText aAddrTopText; + MetricField aAddrTopField; + FixedInfo aAddrFormatInfo; + MenuButton aAddrEditButton; + FixedLine aSendFL; + FixedInfo aSendPosInfo; + FixedText aSendLeftText; + MetricField aSendLeftField; + FixedText aSendTopText; + MetricField aSendTopField; + FixedInfo aSendFormatInfo; + MenuButton aSendEditButton; + FixedLine aSizeFL; + FixedText aSizeFormatText; + ListBox aSizeFormatBox; + FixedText aSizeWidthText; + MetricField aSizeWidthField; + FixedText aSizeHeightText; + MetricField aSizeHeightField; + SwEnvPreview aPreview; + + SvUShorts aIDs; + + SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet); + ~SwEnvFmtPage(); + + DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( EditHdl, MenuButton * ); + DECL_LINK( FormatHdl, ListBox * ); + + void SetMinMax(); + + SfxItemSet *GetCollItemSet(SwTxtFmtColl* pColl, BOOL bSender); + + using Window::GetParent; + SwEnvDlg *GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();} + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + void FillItem(SwEnvItem& rItem); + virtual BOOL FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); +}; + +#endif + + diff --git a/sw/source/ui/envelp/envfmt.src b/sw/source/ui/envelp/envfmt.src new file mode 100644 index 000000000000..ff9e0417bdba --- /dev/null +++ b/sw/source/ui/envelp/envfmt.src @@ -0,0 +1,318 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envfmt.src,v $ + * $Revision: 1.29 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "envfmt.hrc" +#include "helpid.h" + // TP_ENV_FMT --------------------------------------------------------------- +TabPage TP_ENV_FMT +{ + HelpID = HID_ENV_FMT ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_ADDRESSEE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Addressee" ; + }; + FixedText TXT_ADDR_POS + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Position"; + }; + FixedText TXT_ADDR_LEFT + { + Pos = MAP_APPFONT ( 18 , 27 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "from left" ; + }; + MetricField FLD_ADDR_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 25 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 0 ; + Maximum = 10000 ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + FixedText TXT_ADDR_TOP + { + Pos = MAP_APPFONT ( 18 , 43 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "from top" ; + }; + MetricField FLD_ADDR_TOP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 41 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 0 ; + Maximum = 10000 ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + FixedText TXT_ADDR_FORMAT + { + Pos = MAP_APPFONT ( 149 , 27 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Format"; + }; + MenuButton BTN_ADDR_EDIT + { + Pos = MAP_APPFONT ( 194 , 24 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Edit" ; + }; + FixedLine FL_SENDER + { + Pos = MAP_APPFONT ( 6 , 56 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Sender" ; + }; + FixedText TXT_SEND_POS + { + Pos = MAP_APPFONT ( 12 , 67 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Position"; + }; + FixedText TXT_SEND_LEFT + { + Pos = MAP_APPFONT ( 18 , 80 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "from left" ; + }; + MetricField FLD_SEND_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 78 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 0 ; + Maximum = 10000 ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + FixedText TXT_SEND_TOP + { + Pos = MAP_APPFONT ( 18 , 96 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "from top" ; + }; + MetricField FLD_SEND_TOP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 94 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 0 ; + Maximum = 10000 ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + FixedText TXT_SEND_FORMAT + { + Pos = MAP_APPFONT ( 149 , 80 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Format"; + }; + MenuButton BTN_SEND_EDIT + { + Pos = MAP_APPFONT ( 194 , 77 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Edit" ; + TabStop = TRUE ; + }; + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( 6 , 109 ) ; + Size = MAP_APPFONT ( 148 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText TXT_SIZE_FORMAT + { + Pos = MAP_APPFONT ( 12 , 122 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "F~ormat" ; + Left = TRUE ; + }; + ListBox BOX_SIZE_FORMAT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 120 ) ; + Size = MAP_APPFONT ( 40 , 72 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText TXT_SIZE_WIDTH + { + Pos = MAP_APPFONT ( 12 , 138 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "~Width" ; + Left = TRUE ; + }; + MetricField FLD_SIZE_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 136 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 500 ; + Maximum = 10000 ; + First = 500 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + FixedText TXT_SIZE_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 154 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Height" ; + }; + MetricField FLD_SIZE_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 152 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Minimum = 500 ; + Maximum = 10000 ; + First = 500 ; + Last = 10000 ; + SpinSize = 10 ; + Repeat = TRUE ; + }; + Window WIN_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 160 , 116 ) ; + Size = MAP_APPFONT ( 84 , 63 ) ; + }; +}; + // Menu ********************************************************************* +Menu MNU_EDIT +{ + ItemList = + { + MenuItem + { + IDENTIFIER = MID_CHAR ; + Text [ en-US ] = "C~haracter..." ; + }; + MenuItem + { + IDENTIFIER = MID_PARA ; + Text [ en-US ] = "P~aragraph..." ; + }; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx new file mode 100644 index 000000000000..fa1744ca1ae5 --- /dev/null +++ b/sw/source/ui/envelp/envimg.cxx @@ -0,0 +1,381 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envimg.cxx,v $ + * $Revision: 1.13.176.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <hintids.hxx> +#include <tools/stream.hxx> +#include <tools/resid.hxx> +#include <sfx2/app.hxx> +#include <svx/paperinf.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <svtools/useroptions.hxx> +#include <tools/shl.hxx> +#include <swmodule.hxx> +#include <errhdl.hxx> +#include <swtypes.hxx> +#include <envimg.hxx> + +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _ENVELP_HRC +#include <envelp.hrc> +#endif + +#include <unomid.h> + +#ifdef WIN +#define NEXTLINE UniString::CreateFromAscii("\r\n") +#else +#define NEXTLINE '\n' +#endif + +using namespace utl; +using namespace rtl; +using namespace ::com::sun::star::uno; + + +TYPEINIT1_AUTOFACTORY( SwEnvItem, SfxPoolItem ); + +// -------------------------------------------------------------------------- +SW_DLLPUBLIC String MakeSender() +{ + SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); + + String sRet; + String sSenderToken(SW_RES(STR_SENDER_TOKENS)); + xub_StrLen nSttPos = 0, nTokenCount = sSenderToken.GetTokenCount(';'); + BOOL bLastLength = TRUE; + for( xub_StrLen i = 0; i < nTokenCount; i++ ) + { + String sToken = sSenderToken.GetToken( 0, ';', nSttPos ); + if(sToken.EqualsAscii("COMPANY")) + { + xub_StrLen nOldLen = sRet.Len(); + sRet += (String)rUserOpt.GetCompany(); + bLastLength = sRet.Len() != nOldLen; + } + else if(sToken.EqualsAscii("CR")) + { + if(bLastLength) + sRet +=NEXTLINE; + bLastLength = TRUE; + } + else if(sToken.EqualsAscii("FIRSTNAME")) + sRet += (String)rUserOpt.GetFirstName(); + else if(sToken.EqualsAscii("LASTNAME")) + sRet += (String)rUserOpt.GetLastName(); + else if(sToken.EqualsAscii("ADDRESS")) + sRet += (String)rUserOpt.GetStreet(); + else if(sToken.EqualsAscii("COUNTRY")) + sRet += (String)rUserOpt.GetCountry(); + else if(sToken.EqualsAscii("POSTALCODE")) + sRet += (String)rUserOpt.GetZip(); + else if(sToken.EqualsAscii("CITY")) + sRet += (String)rUserOpt.GetCity(); + else if(sToken.EqualsAscii("STATEPROV")) + sRet += (String)rUserOpt.GetState(); + else if(sToken.Len()) //spaces + sRet += sToken; + } + return sRet; +} +// -------------------------------------------------------------------------- +SwEnvItem::SwEnvItem() : + SfxPoolItem(FN_ENVELOP) +{ + aAddrText = aEmptyStr; + bSend = TRUE; + aSendText = MakeSender(); + lSendFromLeft = 566; // 1 cm + lSendFromTop = 566; // 1 cm + Size aEnvSz = SvxPaperInfo::GetPaperSize(PAPER_ENV_C65); + lWidth = aEnvSz.Width(); + lHeight = aEnvSz.Height(); + eAlign = ENV_HOR_LEFT; + bPrintFromAbove = TRUE; + lShiftRight = 0; + lShiftDown = 0; + + lAddrFromLeft = Max(lWidth, lHeight) / 2; + lAddrFromTop = Min(lWidth, lHeight) / 2; +} +// -------------------------------------------------------------------------- +SwEnvItem::SwEnvItem(const SwEnvItem& rItem) : + SfxPoolItem(FN_ENVELOP), + aAddrText (rItem.aAddrText), + bSend (rItem.bSend), + aSendText (rItem.aSendText), + lAddrFromLeft (rItem.lAddrFromLeft), + lAddrFromTop (rItem.lAddrFromTop), + lSendFromLeft (rItem.lSendFromLeft), + lSendFromTop (rItem.lSendFromTop), + lWidth (rItem.lWidth), + lHeight (rItem.lHeight), + eAlign (rItem.eAlign), + bPrintFromAbove(rItem.bPrintFromAbove), + lShiftRight (rItem.lShiftRight), + lShiftDown (rItem.lShiftDown) +{ +} + +// -------------------------------------------------------------------------- +SwEnvItem& SwEnvItem::operator =(const SwEnvItem& rItem) +{ + aAddrText = rItem.aAddrText; + bSend = rItem.bSend; + aSendText = rItem.aSendText; + lSendFromLeft = rItem.lSendFromLeft; + lSendFromTop = rItem.lSendFromTop; + lAddrFromLeft = rItem.lAddrFromLeft; + lAddrFromTop = rItem.lAddrFromTop; + lWidth = rItem.lWidth; + lHeight = rItem.lHeight; + eAlign = rItem.eAlign; + bPrintFromAbove = rItem.bPrintFromAbove; + lShiftRight = rItem.lShiftRight; + lShiftDown = rItem.lShiftDown; + return *this; +} +// -------------------------------------------------------------------------- +int SwEnvItem::operator ==(const SfxPoolItem& rItem) const +{ + const SwEnvItem& rEnv = (const SwEnvItem&) rItem; + + return aAddrText == rEnv.aAddrText && + bSend == rEnv.bSend && + aSendText == rEnv.aSendText && + lSendFromLeft == rEnv.lSendFromLeft && + lSendFromTop == rEnv.lSendFromTop && + lAddrFromLeft == rEnv.lAddrFromLeft && + lAddrFromTop == rEnv.lAddrFromTop && + lWidth == rEnv.lWidth && + lHeight == rEnv.lHeight && + eAlign == rEnv.eAlign && + bPrintFromAbove == rEnv.bPrintFromAbove && + lShiftRight == rEnv.lShiftRight && + lShiftDown == rEnv.lShiftDown; +} + +// -------------------------------------------------------------------------- +SfxPoolItem* SwEnvItem::Clone(SfxItemPool*) const +{ + return new SwEnvItem(*this); +} +// -------------------------------------------------------------------------- +// -------------------------------------------------------------------------- +SwEnvCfgItem::SwEnvCfgItem() : + ConfigItem(C2U("Office.Writer/Envelope")) +{ + 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()) + { + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0: pValues[nProp] >>= aEnvItem.aAddrText; break;// "Inscription/Addressee", + case 1: pValues[nProp] >>= aEnvItem.aSendText; break;// "Inscription/Sender", + case 2: aEnvItem.bSend = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseSender", + case 3: + pValues[nProp] >>= aEnvItem.lAddrFromLeft;// "Format/AddresseeFromLeft", + aEnvItem.lAddrFromLeft = MM100_TO_TWIP(aEnvItem.lAddrFromLeft); + break; + case 4: + pValues[nProp] >>= aEnvItem.lAddrFromTop; // "Format/AddresseeFromTop", + aEnvItem.lAddrFromTop = MM100_TO_TWIP(aEnvItem.lAddrFromTop); + break; + case 5: + pValues[nProp] >>= aEnvItem.lSendFromLeft; // "Format/SenderFromLeft", + aEnvItem.lSendFromLeft = MM100_TO_TWIP(aEnvItem.lSendFromLeft); + break; + case 6: + pValues[nProp] >>= aEnvItem.lSendFromTop;// "Format/SenderFromTop", + aEnvItem.lSendFromTop = MM100_TO_TWIP(aEnvItem.lSendFromTop); + break; + case 7: + pValues[nProp] >>= aEnvItem.lWidth; // "Format/Width", + aEnvItem.lWidth = MM100_TO_TWIP(aEnvItem.lWidth); + break; + case 8: + pValues[nProp] >>= aEnvItem.lHeight; // "Format/Height", + aEnvItem.lHeight = MM100_TO_TWIP(aEnvItem.lHeight); + break; + case 9: + { + sal_Int32 nTemp = 0; + pValues[nProp] >>= nTemp; aEnvItem.eAlign = (SwEnvAlign)nTemp; break;// "Print/Alignment", + } + case 10: aEnvItem.bPrintFromAbove = *(sal_Bool*)pValues[nProp].getValue(); break;// "Print/FromAbove", + case 11: + pValues[nProp] >>= aEnvItem.lShiftRight; + aEnvItem.lShiftRight = MM100_TO_TWIP(aEnvItem.lShiftRight);// "Print/Right", + break; + case 12: + pValues[nProp] >>= aEnvItem.lShiftDown; + aEnvItem.lShiftDown = MM100_TO_TWIP(aEnvItem.lShiftDown); + break;// "Print/Down" + } + } + } + } +} +/* -----------------------------26.09.00 14:04-------------------------------- + + ---------------------------------------------------------------------------*/ +SwEnvCfgItem::~SwEnvCfgItem() +{ +} +/* -----------------------------26.09.00 14:05-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwEnvCfgItem::Commit() +{ + Sequence<OUString> aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0: pValues[nProp] <<= aEnvItem.aAddrText; break;// "Inscription/Addressee", + case 1: pValues[nProp] <<= aEnvItem.aSendText; break;// "Inscription/Sender", + case 2: pValues[nProp].setValue(&aEnvItem.bSend, rType);break;// "Inscription/UseSender", + case 3: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromLeft)) ; break;// "Format/AddresseeFromLeft", + case 4: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromTop)) ; break;// "Format/AddresseeFromTop", + case 5: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromLeft)) ; break;// "Format/SenderFromLeft", + case 6: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromTop)) ; break;// "Format/SenderFromTop", + case 7: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lWidth)) ; break;// "Format/Width", + case 8: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lHeight)) ; break;// "Format/Height", + case 9: pValues[nProp] <<= sal_Int32(aEnvItem.eAlign); break;// "Print/Alignment", + case 10: pValues[nProp].setValue(&aEnvItem.bPrintFromAbove, rType); break;// "Print/FromAbove", + case 11: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftRight));break; // "Print/Right", + case 12: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftDown)); break;// "Print/Down" + } + } + PutProperties(aNames, aValues); +} +/* -----------------------------26.09.00 14:04-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<rtl::OUString> SwEnvCfgItem::GetPropertyNames() +{ + static const char* aPropNames[] = + { + "Inscription/Addressee", // 0 + "Inscription/Sender", // 1 + "Inscription/UseSender", // 2 + "Format/AddresseeFromLeft", // 3 + "Format/AddresseeFromTop", // 4 + "Format/SenderFromLeft", // 5 + "Format/SenderFromTop", // 6 + "Format/Width", // 7 + "Format/Height", // 8 + "Print/Alignment", // 9 + "Print/FromAbove", // 10 + "Print/Right", // 11 + "Print/Down" // 12 + }; + const int nCount = 13; + Sequence<OUString> aNames(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + return aNames; +} + +BOOL SwEnvItem::QueryValue( Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bRet = sal_True; + switch(nMemberId & ~CONVERT_TWIPS) + { + case MID_ENV_ADDR_TEXT : rVal <<= aAddrText; break; + case MID_ENV_SEND : rVal <<= bSend; break; + case MID_SEND_TEXT : rVal <<= aSendText; break; + case MID_ENV_ADDR_FROM_LEFT : rVal <<= lAddrFromLeft; break; + case MID_ENV_ADDR_FROM_TOP : rVal <<= lAddrFromTop; break; + case MID_ENV_SEND_FROM_LEFT : rVal <<= lSendFromLeft; break; + case MID_ENV_SEND_FROM_TOP : rVal <<= lSendFromTop; break; + case MID_ENV_WIDTH : rVal <<= lWidth; break; + case MID_ENV_HEIGHT : rVal <<= lHeight; break; + case MID_ENV_ALIGN : rVal <<= (sal_Int16) eAlign; break; + case MID_ENV_PRINT_FROM_ABOVE : rVal <<= bPrintFromAbove; break; + case MID_ENV_SHIFT_RIGHT : rVal <<= lShiftRight; break; + case MID_ENV_SHIFT_DOWN : rVal <<= lShiftDown; break; + default: + DBG_ERROR("Wrong memberId"); + bRet = sal_False; + } + return bRet; +} +/* -----------------------------26.04.01 12:26-------------------------------- + + ---------------------------------------------------------------------------*/ +BOOL SwEnvItem::PutValue(const Any& rVal, BYTE nMemberId) +{ + BOOL bRet = FALSE; + switch(nMemberId & ~CONVERT_TWIPS) + { + case MID_ENV_ADDR_TEXT : bRet = (rVal >>= aAddrText); break; + case MID_ENV_SEND : bRet = (rVal >>= bSend); break; + case MID_SEND_TEXT : bRet = (rVal >>= aSendText); break; + case MID_ENV_ADDR_FROM_LEFT : bRet = (rVal >>= lAddrFromLeft); break; + case MID_ENV_ADDR_FROM_TOP : bRet = (rVal >>= lAddrFromTop); break; + case MID_ENV_SEND_FROM_LEFT : bRet = (rVal >>= lSendFromLeft); break; + case MID_ENV_SEND_FROM_TOP : bRet = (rVal >>= lSendFromTop); break; + case MID_ENV_WIDTH : bRet = (rVal >>= lWidth); break; + case MID_ENV_HEIGHT : bRet = (rVal >>= lHeight); break; + case MID_ENV_ALIGN : + { + sal_Int16 nTemp = 0; + bRet = (rVal >>= nTemp); + if (bRet) + eAlign = SwEnvAlign(nTemp); + break; + } + case MID_ENV_PRINT_FROM_ABOVE : bRet = (rVal >>= bPrintFromAbove); break; + case MID_ENV_SHIFT_RIGHT : bRet = (rVal >>= lShiftRight); break; + case MID_ENV_SHIFT_DOWN : bRet = (rVal >>= lShiftDown); break; + default: + DBG_ERROR("Wrong memberId"); + } + return bRet; +} diff --git a/sw/source/ui/envelp/envlop.hrc b/sw/source/ui/envelp/envlop.hrc new file mode 100644 index 000000000000..b8b7e70bc57a --- /dev/null +++ b/sw/source/ui/envelp/envlop.hrc @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envlop.hrc,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ENVLOP_HRC +#define _ENVLOP_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define TXT_ADDR 1 +#define EDT_ADDR 2 +#define FT_DATABASE 3 +#define LB_DATABASE 4 +#define FT_TABLE 5 +#define LB_TABLE 6 +#define BTN_INSERT 7 +#define FT_DBFIELD 8 +#define LB_DBFIELD 9 +#define BOX_SEND 10 +#define EDT_SEND 11 +#define WIN_PREVIEW 12 +#define ST_INSERT 13 +#define ST_CHANGE 14 +// Globale Resourcen ******************************************************** + +#define STR_DOC_TITLE (RC_ENVLOP_BEGIN) + +// Ueberlaufpruefung ******************************************************** + +#define ENVLOP_ACT_END STR_DOC_TITLE + +#if ENVLOP_ACT_END > RC_ENVLOP_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + + diff --git a/sw/source/ui/envelp/envlop.src b/sw/source/ui/envelp/envlop.src new file mode 100644 index 000000000000..f5a5bbde2dc4 --- /dev/null +++ b/sw/source/ui/envelp/envlop.src @@ -0,0 +1,209 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envlop.src,v $ + * $Revision: 1.38 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "envlop.hrc" +#include "helpid.h" + // DLG_ENV ------------------------------------------------------------------ +TabDialog DLG_ENV +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Envelope" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_ENV_ENV ; + Text [ en-US ] = "Envelope" ; + PageResID = TP_ENV_ENV ; + }; + PageItem + { + Identifier = TP_ENV_FMT ; + PageResID = TP_ENV_FMT ; + Text [ en-US ] = "Format"; + }; + PageItem + { + Identifier = TP_ENV_PRT ; + Text [ en-US ] = "Printer" ; + PageResID = TP_ENV_PRT ; + }; + }; + }; + String ST_INSERT + { + Text [ en-US ] = "~Insert" ; + }; + String ST_CHANGE + { + Text [ en-US ] = "~Modify" ; + }; +}; + // TP_ENV_ENV --------------------------------------------------------------- +TabPage TP_ENV_ENV +{ + HelpID = HID_ENV_ENV ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedText TXT_ADDR + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Addr~essee" ; + Group = TRUE ; + Left = TRUE ; + }; + MultiLineEdit EDT_ADDR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 17 ) ; + Size = MAP_APPFONT ( 124 , 66 ) ; + TabStop = TRUE ; + Left = TRUE ; + HScroll = TRUE ; + VScroll = TRUE ; + IgnoreTab = TRUE; + }; + FixedText FT_DATABASE + { + Pos = MAP_APPFONT ( 162 , 6 ) ; + Size = MAP_APPFONT ( 92 , 8 ) ; + Text [ en-US ] = "Database" ; + }; + ListBox LB_DATABASE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 162 , 17 ) ; + Size = MAP_APPFONT ( 82 , 50 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TABLE + { + Pos = MAP_APPFONT ( 162 , 33 ) ; + Size = MAP_APPFONT ( 92 , 8 ) ; + Text [ en-US ] = "Table" ; + }; + ListBox LB_TABLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 162 , 44 ) ; + Size = MAP_APPFONT ( 82 , 50 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + ImageButton BTN_INSERT + { + Pos = MAP_APPFONT ( 137 , 71 ) ; + Size = MAP_APPFONT ( 18 , 12 ) ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; + TabStop = TRUE ; + }; + FixedText FT_DBFIELD + { + Pos = MAP_APPFONT ( 162 , 60 ) ; + Size = MAP_APPFONT ( 92 , 8 ) ; + Text [ en-US ] = "~Database field" ; + }; + ListBox LB_DBFIELD + { + Border = TRUE ; + Pos = MAP_APPFONT ( 162 , 71 ) ; + Size = MAP_APPFONT ( 82 , 50 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + CheckBox BOX_SEND + { + Pos = MAP_APPFONT ( 6 , 105 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "~Sender" ; + TabStop = TRUE ; + }; + MultiLineEdit EDT_SEND + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 116) ; + Size = MAP_APPFONT ( 124 , 63 ) ; + TabStop = TRUE ; + Left = TRUE ; + HScroll = TRUE ; + VScroll = TRUE ; + IgnoreTab = TRUE; + }; + Window WIN_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 160 , 116 ) ; + Size = MAP_APPFONT ( 84 , 63 ) ; + }; +}; + // Strings ****************************************************************** +String STR_DOC_TITLE +{ + Text [ en-US ] = "Envelope" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx new file mode 100644 index 000000000000..07e0d60972aa --- /dev/null +++ b/sw/source/ui/envelp/envlop1.cxx @@ -0,0 +1,444 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envlop1.cxx,v $ + * $Revision: 1.22 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#include "dbmgr.hxx" +#include <sfx2/app.hxx> +#include <vcl/msgbox.hxx> +#include <swwait.hxx> +#include <viewopt.hxx> + +#include "wrtsh.hxx" +#include "errhdl.hxx" +#include "cmdid.h" +#include "helpid.h" +#include "envfmt.hxx" +#include "envlop.hxx" +#include "envprt.hxx" +#include "fmtcol.hxx" +#include "poolfmt.hxx" +#include "view.hxx" + +#include "envlop.hrc" +#include <comphelper/processfactory.hxx> + +#include <unomid.h> + +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; +using namespace ::rtl; + + +//impl in envimg.cxx +extern SW_DLLPUBLIC String MakeSender(); + +// -------------------------------------------------------------------------- + +SwEnvPreview::SwEnvPreview(SfxTabPage* pParent, const ResId& rResID) : + + Window(pParent, rResID) + +{ + SetMapMode(MapMode(MAP_PIXEL)); +} + +// -------------------------------------------------------------------------- + + + +SwEnvPreview::~SwEnvPreview() +{ +} + +// ---------------------------------------------------------------------------- +void SwEnvPreview::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + if ( DATACHANGED_SETTINGS == rDCEvt.GetType() ) + SetBackground( GetSettings().GetStyleSettings().GetDialogColor() ); +} + +// ---------------------------------------------------------------------------- + +void SwEnvPreview::Paint(const Rectangle &) +{ + const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + + const SwEnvItem& rItem = + ((SwEnvDlg*) GetParent()->GetParent()->GetParent())->aEnvItem; + + USHORT nPageW = (USHORT) Max(rItem.lWidth, rItem.lHeight), + nPageH = (USHORT) Min(rItem.lWidth, rItem.lHeight); + + float fx = static_cast< float >(GetOutputSizePixel().Width () / nPageW), + fy = static_cast< float >(GetOutputSizePixel().Height() / nPageH), + f = static_cast< float >(0.8 * ( fx < fy ? fx : fy )); + + Color aBack = rSettings.GetWindowColor( ); + Color aFront = SwViewOption::GetFontColor(); + Color aMedium = Color( ( aBack.GetRed() + aFront.GetRed() ) / 2, + ( aBack.GetGreen() + aFront.GetGreen() ) / 2, + ( aBack.GetBlue() + aFront.GetBlue() ) / 2 + ); + + SetLineColor( aFront ); + + // Umschlag + long nW = (USHORT) (f * nPageW), + nH = (USHORT) (f * nPageH), + nX = (GetOutputSizePixel().Width () - nW) / 2, + nY = (GetOutputSizePixel().Height() - nH) / 2; + SetFillColor( aBack ); + DrawRect(Rectangle(Point(nX, nY), Size(nW, nH))); + + // Absender + if (rItem.bSend) + { + long nSendX = nX + (USHORT) (f * rItem.lSendFromLeft), + nSendY = nY + (USHORT) (f * rItem.lSendFromTop ), + nSendW = (USHORT) (f * (rItem.lAddrFromLeft - rItem.lSendFromLeft)), + nSendH = (USHORT) (f * (rItem.lAddrFromTop - rItem.lSendFromTop - 566)); + SetFillColor( aMedium ); + + DrawRect(Rectangle(Point(nSendX, nSendY), Size(nSendW, nSendH))); + } + + // Empfaenger + long nAddrX = nX + (USHORT) (f * rItem.lAddrFromLeft), + nAddrY = nY + (USHORT) (f * rItem.lAddrFromTop ), + nAddrW = (USHORT) (f * (nPageW - rItem.lAddrFromLeft - 566)), + nAddrH = (USHORT) (f * (nPageH - rItem.lAddrFromTop - 566)); + SetFillColor( aMedium ); + DrawRect(Rectangle(Point(nAddrX, nAddrY), Size(nAddrW, nAddrH))); + + // Briefmarke + long nStmpW = (USHORT) (f * 1417 /* 2,5 cm */), + nStmpH = (USHORT) (f * 1701 /* 3,0 cm */), + nStmpX = nX + nW - (USHORT) (f * 566) - nStmpW, + nStmpY = nY + (USHORT) (f * 566); + + SetFillColor( aBack ); + DrawRect(Rectangle(Point(nStmpX, nStmpY), Size(nStmpW, nStmpH))); +} + +// -------------------------------------------------------------------------- + + + +SwEnvDlg::SwEnvDlg(Window* pParent, const SfxItemSet& rSet, + SwWrtShell* pWrtSh, Printer* pPrt, BOOL bInsert) : + + SfxTabDialog(pParent, SW_RES(DLG_ENV), &rSet, FALSE, &aEmptyStr), + sInsert(SW_RES(ST_INSERT)), + sChange(SW_RES(ST_CHANGE)), + aEnvItem((const SwEnvItem&) rSet.Get(FN_ENVELOP)), + pSh(pWrtSh), + pPrinter(pPrt), + pAddresseeSet(0), + pSenderSet(0) +{ + FreeResource(); + + GetOKButton().SetText(String(SW_RES(STR_BTN_NEWDOC))); + GetOKButton().SetHelpId(HID_ENVELOP_PRINT); + GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird + if (GetUserButton()) + { + GetUserButton()->SetText(bInsert ? sInsert : sChange); + GetUserButton()->SetHelpId(HID_ENVELOP_INSERT); + } + + AddTabPage(TP_ENV_ENV, SwEnvPage ::Create, 0); + AddTabPage(TP_ENV_FMT, SwEnvFmtPage::Create, 0); + AddTabPage(TP_ENV_PRT, SwEnvPrtPage::Create, 0); +} + +// -------------------------------------------------------------------------- + + + +SwEnvDlg::~SwEnvDlg() +{ + delete pAddresseeSet; + delete pSenderSet; +} + +// -------------------------------------------------------------------------- + + + +void SwEnvDlg::PageCreated(USHORT nId, SfxTabPage &rPage) +{ + if (nId == TP_ENV_PRT) + { + ((SwEnvPrtPage*)&rPage)->SetPrt(pPrinter); + } +} + +// -------------------------------------------------------------------------- + +short SwEnvDlg::Ok() +{ + short nRet = SfxTabDialog::Ok(); + + if (nRet == RET_OK || nRet == RET_USER) + { + if (pAddresseeSet) + { + SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_JAKETADRESS); + pColl->SetFmtAttr(*pAddresseeSet); + } + if (pSenderSet) + { + SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_SENDADRESS); + pColl->SetFmtAttr(*pSenderSet); + } + } + + return nRet; +} + +// -------------------------------------------------------------------------- + + + +SwEnvPage::SwEnvPage(Window* pParent, const SfxItemSet& rSet) : + + SfxTabPage(pParent, SW_RES(TP_ENV_ENV), rSet), + + aAddrText (this, SW_RES(TXT_ADDR )), + aAddrEdit (this, SW_RES(EDT_ADDR )), + aDatabaseFT (this, SW_RES(FT_DATABASE)), + aDatabaseLB (this, SW_RES(LB_DATABASE)), + aTableFT (this, SW_RES(FT_TABLE )), + aTableLB (this, SW_RES(LB_TABLE )), + aInsertBT (this, SW_RES(BTN_INSERT )), + aDBFieldFT (this, SW_RES(FT_DBFIELD )), + aDBFieldLB (this, SW_RES(LB_DBFIELD )), + aSenderBox (this, SW_RES(BOX_SEND )), + aSenderEdit (this, SW_RES(EDT_SEND )), + aPreview (this, SW_RES(WIN_PREVIEW)) + +{ + FreeResource(); + SetExchangeSupport(); + pSh = GetParent()->pSh; + + // Handler installieren + aDatabaseLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl )); + aTableLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl )); + aInsertBT .SetClickHdl (LINK(this, SwEnvPage, FieldHdl )); + aSenderBox .SetClickHdl (LINK(this, SwEnvPage, SenderHdl )); + aPreview.SetBorderStyle( WINDOW_BORDER_MONO ); + + SwDBData aData = pSh->GetDBData(); + sActDBName = aData.sDataSource; + sActDBName += DB_DELIM; + sActDBName += (String)aData.sCommand; + InitDatabaseBox(); +} + +// -------------------------------------------------------------------------- + + + +SwEnvPage::~SwEnvPage() +{ +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) +{ + SwWait aWait( *pSh->GetView().GetDocShell(), TRUE ); + + if (pListBox == &aDatabaseLB) + { + sActDBName = pListBox->GetSelectEntry(); + pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName); + sActDBName += DB_DELIM; + } + else + sActDBName.SetToken(1, DB_DELIM, aTableLB.GetSelectEntry()); + pSh->GetNewDBMgr()->GetColumnNames( + &aDBFieldLB, aDatabaseLB.GetSelectEntry(), aTableLB.GetSelectEntry()); + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPage, FieldHdl, Button *, EMPTYARG ) +{ + String aStr ( '<' ); + aStr += aDatabaseLB.GetSelectEntry(); + aStr += '.'; +// aStr += DB_DELIM; + aStr += aTableLB.GetSelectEntry(); + aStr += '.'; + aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1'; + aStr += '.'; +// aStr += DB_DELIM; + aStr += aDBFieldLB.GetSelectEntry(); + aStr += '>'; + aAddrEdit.ReplaceSelected(aStr); + Selection aSel = aAddrEdit.GetSelection(); + aAddrEdit.GrabFocus(); + aAddrEdit.SetSelection(aSel); + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPage, SenderHdl, Button *, EMPTYARG ) +{ + const BOOL bEnable = aSenderBox.IsChecked(); + GetParent()->aEnvItem.bSend = bEnable; + aSenderEdit.Enable(bEnable); + if ( bEnable ) + { + aSenderEdit.GrabFocus(); + if(!aSenderEdit.GetText().Len()) + aSenderEdit.SetText(MakeSender()); + } + aPreview.Invalidate(); + return 0; +} + +// -------------------------------------------------------------------------- + + + +void SwEnvPage::InitDatabaseBox() +{ + if (pSh->GetNewDBMgr()) + { + aDatabaseLB.Clear(); + Sequence<OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames(); + const OUString* pDataNames = aDataNames.getConstArray(); + for (long i = 0; i < aDataNames.getLength(); i++) + aDatabaseLB.InsertEntry(pDataNames[i]); + + String sDBName = sActDBName.GetToken( 0, DB_DELIM ); + String sTableName = sActDBName.GetToken( 1, DB_DELIM ); + aDatabaseLB.SelectEntry(sDBName); + if (pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sDBName)) + { + aTableLB.SelectEntry(sTableName); + pSh->GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sDBName, sTableName); + } + else + aDBFieldLB.Clear(); + + } +} + +// -------------------------------------------------------------------------- + + + +SfxTabPage* SwEnvPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwEnvPage(pParent, rSet); +} + +// -------------------------------------------------------------------------- + + + +void SwEnvPage::ActivatePage(const SfxItemSet& rSet) +{ + SfxItemSet aSet(rSet); + aSet.Put(GetParent()->aEnvItem); + Reset(aSet); +} + +// -------------------------------------------------------------------------- + + + +int SwEnvPage::DeactivatePage(SfxItemSet* _pSet) +{ + FillItem(GetParent()->aEnvItem); + if( _pSet ) + FillItemSet(*_pSet); + return SfxTabPage::LEAVE_PAGE; +} + +// -------------------------------------------------------------------------- + + + +void SwEnvPage::FillItem(SwEnvItem& rItem) +{ + rItem.aAddrText = aAddrEdit .GetText(); + rItem.bSend = aSenderBox .IsChecked(); + rItem.aSendText = aSenderEdit.GetText(); +} + +// -------------------------------------------------------------------------- + + + +BOOL SwEnvPage::FillItemSet(SfxItemSet& rSet) +{ + FillItem(GetParent()->aEnvItem); + rSet.Put(GetParent()->aEnvItem); + return TRUE; +} + +// ---------------------------------------------------------------------------- + + + +void SwEnvPage::Reset(const SfxItemSet& rSet) +{ + SwEnvItem aItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP); + aAddrEdit .SetText(String(aItem.aAddrText).ConvertLineEnd()); + aSenderEdit.SetText(String(aItem.aSendText).ConvertLineEnd()); + aSenderBox .Check (aItem.bSend); + aSenderBox.GetClickHdl().Call(&aSenderBox); +} + + diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx new file mode 100644 index 000000000000..c54911294912 --- /dev/null +++ b/sw/source/ui/envelp/envprt.cxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envprt.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <vcl/print.hxx> +#include <svtools/prnsetup.hxx> + +#include "swtypes.hxx" +#include "cmdid.h" +#include "envprt.hxx" +#include "envlop.hxx" +#include "uitool.hxx" + +#include "envprt.hrc" + + + + + +SwEnvPrtPage::SwEnvPrtPage(Window* pParent, const SfxItemSet& rSet) : + + SfxTabPage(pParent, SW_RES(TP_ENV_PRT), rSet), + + aAlignBox (this, SW_RES(BOX_ALIGN )), + aTopButton (this, SW_RES(BTN_TOP )), + aBottomButton(this, SW_RES(BTN_BOTTOM )), + aRightText (this, SW_RES(TXT_RIGHT )), + aRightField (this, SW_RES(FLD_RIGHT )), + aDownText (this, SW_RES(TXT_DOWN )), + aDownField (this, SW_RES(FLD_DOWN )), + aPrinterInfo (this, SW_RES(TXT_PRINTER)), + aNoNameFL (this, SW_RES(FL_NONAME )), + aPrinterFL (this, SW_RES(FL_PRINTER )), + aPrtSetup (this, SW_RES(BTN_PRTSETUP)) + +{ + FreeResource(); + SetExchangeSupport(); + + // Metriken + FieldUnit eUnit = ::GetDfltMetric(FALSE); + SetMetric(aRightField, eUnit); + SetMetric(aDownField , eUnit); + + // Handler installieren + aTopButton .SetClickHdl(LINK(this, SwEnvPrtPage, ClickHdl)); + aBottomButton.SetClickHdl(LINK(this, SwEnvPrtPage, ClickHdl)); + + aPrtSetup .SetClickHdl(LINK(this, SwEnvPrtPage, ButtonHdl)); + + // Bitmaps + aBottomButton.GetClickHdl().Call(&aBottomButton); + + // ToolBox + Size aSz = aAlignBox.CalcWindowSizePixel(); + aAlignBox.SetSizePixel(aSz); +// aAlignBox.SetPosPixel(Point(aNoNameFL.GetPosPixel().X() + (aNoNameFL.GetSizePixel().Width() - aSz.Width()) / 2, aAlignBox.GetPosPixel().Y())); + aAlignBox.SetClickHdl(LINK(this, SwEnvPrtPage, AlignHdl)); + +} + +// -------------------------------------------------------------------------- + + + +SwEnvPrtPage::~SwEnvPrtPage() +{ +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPrtPage, ClickHdl, Button *, EMPTYARG ) +{ + sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + if (aBottomButton.IsChecked()) + { + // Briefumschlaege von unten + aAlignBox.SetItemImage(ITM_HOR_LEFT, Bitmap(SW_RES(bHC ? BMP_HOR_LEFT_LOWER_H : BMP_HOR_LEFT_LOWER))); + aAlignBox.SetItemImage(ITM_HOR_CNTR, Bitmap(SW_RES(bHC ? BMP_HOR_CNTR_LOWER_H : BMP_HOR_CNTR_LOWER))); + aAlignBox.SetItemImage(ITM_HOR_RGHT, Bitmap(SW_RES(bHC ? BMP_HOR_RGHT_LOWER_H : BMP_HOR_RGHT_LOWER))); + aAlignBox.SetItemImage(ITM_VER_LEFT, Bitmap(SW_RES(bHC ? BMP_VER_LEFT_LOWER_H : BMP_VER_LEFT_LOWER))); + aAlignBox.SetItemImage(ITM_VER_CNTR, Bitmap(SW_RES(bHC ? BMP_VER_CNTR_LOWER_H : BMP_VER_CNTR_LOWER))); + aAlignBox.SetItemImage(ITM_VER_RGHT, Bitmap(SW_RES(bHC ? BMP_VER_RGHT_LOWER_H : BMP_VER_RGHT_LOWER))); + } + else + { + // Briefumschlaege von oben + aAlignBox.SetItemImage(ITM_HOR_LEFT, Bitmap(SW_RES(bHC ? BMP_HOR_LEFT_UPPER_H : BMP_HOR_LEFT_UPPER))); + aAlignBox.SetItemImage(ITM_HOR_CNTR, Bitmap(SW_RES(bHC ? BMP_HOR_CNTR_UPPER_H : BMP_HOR_CNTR_UPPER))); + aAlignBox.SetItemImage(ITM_HOR_RGHT, Bitmap(SW_RES(bHC ? BMP_HOR_RGHT_UPPER_H : BMP_HOR_RGHT_UPPER))); + aAlignBox.SetItemImage(ITM_VER_LEFT, Bitmap(SW_RES(bHC ? BMP_VER_LEFT_UPPER_H : BMP_VER_LEFT_UPPER))); + aAlignBox.SetItemImage(ITM_VER_CNTR, Bitmap(SW_RES(bHC ? BMP_VER_CNTR_UPPER_H : BMP_VER_CNTR_UPPER))); + aAlignBox.SetItemImage(ITM_VER_RGHT, Bitmap(SW_RES(bHC ? BMP_VER_RGHT_UPPER_H : BMP_VER_RGHT_UPPER))); + } + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn ) +{ + if (pBtn == &aPrtSetup) + { + // Druck-Setup aufrufen + if (pPrt) + { + PrinterSetupDialog* pDlg = new PrinterSetupDialog(this ); + pDlg->SetPrinter(pPrt); + pDlg->Execute(); + delete pDlg; + GrabFocus(); + aPrinterInfo.SetText(pPrt->GetName()); + } + } + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwEnvPrtPage, AlignHdl, ToolBox *, EMPTYARG ) +{ + if (aAlignBox.GetCurItemId()) + { + for (USHORT i = ITM_HOR_LEFT; i <= ITM_VER_RGHT; i++) + aAlignBox.CheckItem(i, FALSE); + aAlignBox.CheckItem(aAlignBox.GetCurItemId(), TRUE); + } + else + { + // GetCurItemId() == 0 ist moeglich! + const SwEnvItem& rItem = (const SwEnvItem&) GetItemSet().Get(FN_ENVELOP); + aAlignBox.CheckItem((USHORT) rItem.eAlign + ITM_HOR_LEFT, TRUE); + } + return 0; +} + +// -------------------------------------------------------------------------- + + + +SfxTabPage* SwEnvPrtPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwEnvPrtPage(pParent, rSet); +} + +// -------------------------------------------------------------------------- + + + +void SwEnvPrtPage::ActivatePage(const SfxItemSet&) +{ + if (pPrt) + aPrinterInfo.SetText(pPrt->GetName()); +} + +// -------------------------------------------------------------------------- + + + +int SwEnvPrtPage::DeactivatePage(SfxItemSet* _pSet) +{ + if( _pSet ) + FillItemSet(*_pSet); + return SfxTabPage::LEAVE_PAGE; +} + +// -------------------------------------------------------------------------- + + + +void SwEnvPrtPage::FillItem(SwEnvItem& rItem) +{ + USHORT nID = 0; + for (USHORT i = ITM_HOR_LEFT; i <= ITM_VER_RGHT && !nID; i++) + if (aAlignBox.IsItemChecked(i)) + nID = i; + + rItem.eAlign = (SwEnvAlign) (nID - ITM_HOR_LEFT); + rItem.bPrintFromAbove = aTopButton.IsChecked(); + rItem.lShiftRight = static_cast< sal_Int32 >(GetFldVal(aRightField)); + rItem.lShiftDown = static_cast< sal_Int32 >(GetFldVal(aDownField )); +} + +// -------------------------------------------------------------------------- + + + +BOOL SwEnvPrtPage::FillItemSet(SfxItemSet& rSet) +{ + FillItem(GetParent()->aEnvItem); + rSet.Put(GetParent()->aEnvItem); + return TRUE; +} + +// ---------------------------------------------------------------------------- + + + +void SwEnvPrtPage::Reset(const SfxItemSet& rSet) +{ +// SfxItemSet aSet(rSet); +// aSet.Put(GetParent()->aEnvItem); + + // Item auslesen + const SwEnvItem& rItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP); + aAlignBox.CheckItem((USHORT) rItem.eAlign + ITM_HOR_LEFT); + + if (rItem.bPrintFromAbove) + aTopButton .Check(); + else + aBottomButton.Check(); + + SetFldVal(aRightField, rItem.lShiftRight); + SetFldVal(aDownField , rItem.lShiftDown ); + + ActivatePage(rSet); + ClickHdl(&aTopButton); +} + + + + diff --git a/sw/source/ui/envelp/envprt.hrc b/sw/source/ui/envelp/envprt.hrc new file mode 100644 index 000000000000..a1505d855132 --- /dev/null +++ b/sw/source/ui/envelp/envprt.hrc @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envprt.hrc,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ENVPRT_HRC +#define _ENVPRT_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define BOX_ALIGN 1 +#define BTN_TOP 7 +#define BTN_BOTTOM 8 +#define TXT_RIGHT 9 +#define FLD_RIGHT 10 +#define TXT_DOWN 11 +#define FLD_DOWN 12 +#define TXT_PRINTER 13 +#define FL_NONAME 14 +#define BTN_PRTSETUP 15 +#define FL_PRINTER 16 + +// Globale Resourcen ******************************************************** + +#define BMP_HOR_LEFT_LOWER (RC_ENVPRT_BEGIN ) +#define BMP_HOR_LEFT_UPPER (RC_ENVPRT_BEGIN + 1) +#define BMP_HOR_CNTR_LOWER (RC_ENVPRT_BEGIN + 2) +#define BMP_HOR_CNTR_UPPER (RC_ENVPRT_BEGIN + 3) +#define BMP_HOR_RGHT_LOWER (RC_ENVPRT_BEGIN + 4) +#define BMP_HOR_RGHT_UPPER (RC_ENVPRT_BEGIN + 5) + +#define BMP_VER_LEFT_LOWER (RC_ENVPRT_BEGIN + 6) +#define BMP_VER_LEFT_UPPER (RC_ENVPRT_BEGIN + 7) +#define BMP_VER_CNTR_LOWER (RC_ENVPRT_BEGIN + 8) +#define BMP_VER_CNTR_UPPER (RC_ENVPRT_BEGIN + 9) +#define BMP_VER_RGHT_LOWER (RC_ENVPRT_BEGIN + 10) +#define BMP_VER_RGHT_UPPER (RC_ENVPRT_BEGIN + 11) + +#define ITM_HOR_LEFT (RC_ENVPRT_BEGIN + 12) +#define ITM_HOR_CNTR (RC_ENVPRT_BEGIN + 13) +#define ITM_HOR_RGHT (RC_ENVPRT_BEGIN + 14) +#define ITM_VER_LEFT (RC_ENVPRT_BEGIN + 15) +#define ITM_VER_CNTR (RC_ENVPRT_BEGIN + 16) +#define ITM_VER_RGHT (RC_ENVPRT_BEGIN + 17) + +#define BMP_HOR_LEFT_LOWER_H (RC_ENVPRT_HC_BEGIN ) +#define BMP_HOR_LEFT_UPPER_H (RC_ENVPRT_HC_BEGIN + 1) +#define BMP_HOR_CNTR_LOWER_H (RC_ENVPRT_HC_BEGIN + 2) +#define BMP_HOR_CNTR_UPPER_H (RC_ENVPRT_HC_BEGIN + 3) +#define BMP_HOR_RGHT_LOWER_H (RC_ENVPRT_HC_BEGIN + 4) +#define BMP_HOR_RGHT_UPPER_H (RC_ENVPRT_HC_BEGIN + 5) + +#define BMP_VER_LEFT_LOWER_H (RC_ENVPRT_HC_BEGIN + 6) +#define BMP_VER_LEFT_UPPER_H (RC_ENVPRT_HC_BEGIN + 7) +#define BMP_VER_CNTR_LOWER_H (RC_ENVPRT_HC_BEGIN + 8) +#define BMP_VER_CNTR_UPPER_H (RC_ENVPRT_HC_BEGIN + 9) +#define BMP_VER_RGHT_LOWER_H (RC_ENVPRT_HC_BEGIN + 10) +#define BMP_VER_RGHT_UPPER_H (RC_ENVPRT_HC_BEGIN + 11) + + +// Ueberlaufpruefung ******************************************************** + +#define ENVPRT_ACT_END BMP_VER_RGHT_UPPER_H + +#if ENVPRT_ACT_END > RC_ENVPRT_HC_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx new file mode 100644 index 000000000000..c69ccc2b5e85 --- /dev/null +++ b/sw/source/ui/envelp/envprt.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envprt.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ENVPRT_HXX +#define _ENVPRT_HXX + + +#include <sfx2/tabdlg.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <vcl/group.hxx> +#ifndef _SV_BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#include <svtools/stdctrl.hxx> + + + +#include "envimg.hxx" + +class SwEnvDlg; + +// class SwEnvPrtPage --------------------------------------------------------- + +class SwEnvPrtPage : public SfxTabPage +{ + ToolBox aAlignBox; + RadioButton aTopButton; + RadioButton aBottomButton; + FixedText aRightText; + MetricField aRightField; + FixedText aDownText; + MetricField aDownField; + FixedInfo aPrinterInfo; + FixedLine aNoNameFL; + FixedLine aPrinterFL; + PushButton aPrtSetup; + + Printer* pPrt; + + SwEnvPrtPage(Window* pParent, const SfxItemSet& rSet); + ~SwEnvPrtPage(); + + DECL_LINK( ClickHdl, Button * ); + DECL_LINK( AlignHdl, ToolBox * ); + DECL_LINK( ButtonHdl, Button * ); + + using Window::GetParent; + SwEnvDlg* GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();} + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + void FillItem(SwEnvItem& rItem); + virtual BOOL FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); + + inline void SetPrt(Printer* pPrinter) { pPrt = pPrinter; } +}; + +#endif + diff --git a/sw/source/ui/envelp/envprt.src b/sw/source/ui/envelp/envprt.src new file mode 100644 index 000000000000..f15a13d9f733 --- /dev/null +++ b/sw/source/ui/envelp/envprt.src @@ -0,0 +1,295 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: envprt.src,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ***************************************************************** + + // #include **************************************************************** +#include "envprt.hrc" +#include "helpid.h" + // TP_ENV_PRT --------------------------------------------------------------- +TabPage TP_ENV_PRT +{ + HelpID = HID_ENV_PRT ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_NONAME + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Envelope orientation"; + }; + ToolBox BOX_ALIGN + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + ItemList = + { + ToolBoxItem + { + Identifier = ITM_HOR_LEFT ; + HelpID = ITM_HOR_LEFT ; + }; + ToolBoxItem + { + Identifier = ITM_HOR_CNTR ; + HelpID = ITM_HOR_CNTR ; + }; + ToolBoxItem + { + Identifier = ITM_HOR_RGHT ; + HelpID = ITM_HOR_RGHT ; + }; + ToolBoxItem + { + Identifier = ITM_VER_LEFT ; + HelpID = ITM_VER_LEFT ; + }; + ToolBoxItem + { + Identifier = ITM_VER_CNTR ; + HelpID = ITM_VER_CNTR ; + }; + ToolBoxItem + { + Identifier = ITM_VER_RGHT ; + HelpID = ITM_VER_RGHT ; + }; + }; + }; + RadioButton BTN_TOP + { + Pos = MAP_APPFONT ( 18 , 42 ) ; + Size = MAP_APPFONT ( 179 , 10 ) ; + Text [ en-US ] = "~Print from top" ; + TabStop = TRUE ; + Group = TRUE ; + Check = TRUE ; + }; + RadioButton BTN_BOTTOM + { + Pos = MAP_APPFONT ( 18 , 56 ) ; + Size = MAP_APPFONT ( 179 , 10 ) ; + Text [ en-US ] = "Print from ~bottom" ; + TabStop = TRUE ; + }; + FixedText TXT_RIGHT + { + Pos = MAP_APPFONT ( 12 , 74 ) ; + Size = MAP_APPFONT ( 72 , 8 ) ; + Text [ en-US ] = "~Shift right" ; + Left = TRUE ; + }; + MetricField FLD_RIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 86 , 72 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 10000 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedText TXT_DOWN + { + Pos = MAP_APPFONT ( 12 , 90 ) ; + Size = MAP_APPFONT ( 72 , 8 ) ; + Text [ en-US ] = "Shift ~down" ; + Left = TRUE ; + }; + MetricField FLD_DOWN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 86 , 88 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 10000 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedLine FL_PRINTER + { + Pos = MAP_APPFONT ( 3 , 103 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Current printer"; + }; + FixedText TXT_PRINTER + { + Pos = MAP_APPFONT ( 12 , 116 ) ; + Size = MAP_APPFONT ( 179 , 8 ) ; + Text [ en-US ] = "- No printer installed -" ; + Left = TRUE ; + }; + PushButton BTN_PRTSETUP + { + Pos = MAP_APPFONT ( 198 , 114 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Setup..." ; + }; +}; + // Bitmaps ****************************************************************** +Bitmap BMP_HOR_LEFT_LOWER +{ + File = "envhl_l.bmp" ; +}; +Bitmap BMP_HOR_LEFT_UPPER +{ + File = "envhl_u.bmp" ; +}; +Bitmap BMP_HOR_CNTR_LOWER +{ + File = "envhc_l.bmp" ; +}; +Bitmap BMP_HOR_CNTR_UPPER +{ + File = "envhc_u.bmp" ; +}; +Bitmap BMP_HOR_RGHT_LOWER +{ + File = "envhr_l.bmp" ; +}; +Bitmap BMP_HOR_RGHT_UPPER +{ + File = "envhr_u.bmp" ; +}; +Bitmap BMP_VER_LEFT_LOWER +{ + File = "envvl_l.bmp" ; +}; +Bitmap BMP_VER_LEFT_UPPER +{ + File = "envvl_u.bmp" ; +}; +Bitmap BMP_VER_CNTR_LOWER +{ + File = "envvc_l.bmp" ; +}; +Bitmap BMP_VER_CNTR_UPPER +{ + File = "envvc_u.bmp" ; +}; +Bitmap BMP_VER_RGHT_LOWER +{ + File = "envvr_l.bmp" ; +}; +Bitmap BMP_VER_RGHT_UPPER +{ + File = "envvr_u.bmp" ; +}; +// HighContrast Bitmaps +Bitmap BMP_HOR_LEFT_LOWER_H +{ + File = "envhl_l_h.bmp" ; +}; +Bitmap BMP_HOR_LEFT_UPPER_H +{ + File = "envhl_u_h.bmp" ; +}; +Bitmap BMP_HOR_CNTR_LOWER_H +{ + File = "envhc_l_h.bmp" ; +}; +Bitmap BMP_HOR_CNTR_UPPER_H +{ + File = "envhc_u_h.bmp" ; +}; +Bitmap BMP_HOR_RGHT_LOWER_H +{ + File = "envhr_l_h.bmp" ; +}; +Bitmap BMP_HOR_RGHT_UPPER_H +{ + File = "envhr_u_h.bmp" ; +}; +Bitmap BMP_VER_LEFT_LOWER_H +{ + File = "envvl_l_h.bmp" ; +}; +Bitmap BMP_VER_LEFT_UPPER_H +{ + File = "envvl_u_h.bmp" ; +}; +Bitmap BMP_VER_CNTR_LOWER_H +{ + File = "envvc_l_h.bmp" ; +}; +Bitmap BMP_VER_CNTR_UPPER_H +{ + File = "envvc_u_h.bmp" ; +}; +Bitmap BMP_VER_RGHT_LOWER_H +{ + File = "envvr_l_h.bmp" ; +}; +Bitmap BMP_VER_RGHT_UPPER_H +{ + File = "envvr_u_h.bmp" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/label.hrc b/sw/source/ui/envelp/label.hrc new file mode 100644 index 000000000000..67b74eb4322f --- /dev/null +++ b/sw/source/ui/envelp/label.hrc @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: label.hrc,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _LABEL_HRC +#define _LABEL_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define TXT_WRITING 1 +#define BOX_ADDR 2 +#define EDT_WRITING 3 +#define FT_DATABASE 4 +#define LB_DATABASE 5 +#define FT_TABLE 6 +#define LB_TABLE 7 +#define FL_WRITING 8 +#define BTN_CONT 9 +#define BTN_SHEET 10 +#define TXT_MAKE 11 +#define BOX_MAKE 12 +#define TXT_TYPE 13 +#define BOX_TYPE 14 +#define INF_FORMAT 15 +#define FL_FORMAT 16 +#define FT_DBFIELD 17 +#define LB_DBFIELD 18 +#define BTN_INSERT 19 +#define BTN_SYNC 20 + +#define RB_FROM_AUTO_TEXT 1 +#define RB_FROM_EDIT 2 +#define LB_AUTO_TEXT 3 +#define FT_AUTO_TEXT_GROUP 4 +#define LB_AUTO_TEXT_GROUP 5 +#define ED_TEXT 6 +#define FL_CONTENT 7 +#define WIN_EXAMPLE 8 +#define ST_VISCARD_GROUP 10 + +#define FL_DATA 30 +#define FT_NAME 31 +#define ED_FIRSTNAME 32 +#define ED_NAME 33 +#define ED_SHORTCUT 34 +#define FT_STREET 35 +#define ED_STREET 36 +#define FT_ZIPCITY 37 +#define ED_ZIP 38 +#define ED_CITY 39 +#define FT_COUNTRYSTATE 40 +#define ED_COUNTRY 41 +#define FT_TITLEPROF 42 +#define ED_PROFESSION 43 +#define ED_TITLE 44 + +#define ED_PHONE 46 +#define ED_MOBILE 47 + +#define ED_FAX 49 +#define FT_WWWMAIL 50 +#define ED_WWW 51 +#define ED_MAIL 52 +#define ED_STATE 53 +#define FT_COMP 54 +#define ED_COMP 55 +#define FT_COMP_EXT 56 +#define ED_COMP_EXT 57 +#define FT_SLOGAN 58 +#define ED_SLOGAN 59 +#define FT_POSITION 60 +#define ED_POSITION 61 + +#define ST_BUSINESSCARDDLG 62 +#define ST_FIRSTPAGE_LAB 63 +#define ST_FIRSTPAGE_BC 64 + +#define FT_NAME_2 65 +#define ED_FIRSTNAME_2 66 +#define ED_NAME_2 67 +#define ED_SHORTCUT_2 68 + +#define FT_PHONE_MOBILE 70 +//#define FT_PHONE 71 +//#define FT_MOBILE 72 +#define FT_FAX 73 + +// Globale Resourcen ******************************************************** +#define STR_DOC_TITLE (RC_LABEL_BEGIN) +#define STR_CUSTOM (RC_LABEL_BEGIN + 1) + +// Ueberlaufpruefung ******************************************************** + +#define LABEL_ACT_END STR_CUSTOM + +#if LABEL_ACT_END > RC_LABEL_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + diff --git a/sw/source/ui/envelp/label.src b/sw/source/ui/envelp/label.src new file mode 100644 index 000000000000..f2f10723bd9d --- /dev/null +++ b/sw/source/ui/envelp/label.src @@ -0,0 +1,717 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: label.src,v $ + * $Revision: 1.59 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "label.hrc" +#include "globals.hrc" +#include "helpid.h" +// ----- defined strings ----------------------------------------------------- +#define LABEL_STRING \ + Text [ en-US ] = "Labels" ; \ + +#define BUSINESS_CARD_STRING \ + Text [ en-US ] = "Business Cards"; \ + + // DLG_LAB ------------------------------------------------------------------ +TabDialog DLG_LAB +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + LABEL_STRING + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_VISITING_CARDS; + PageResID = TP_VISITING_CARDS; + BUSINESS_CARD_STRING + }; + PageItem + { + Identifier = TP_PRIVATE_DATA; + PageResID = TP_PRIVATE_DATA; + Text [ en-US ] = "Private"; + }; + PageItem + { + Identifier = TP_BUSINESS_DATA; + PageResID = TP_BUSINESS_DATA; + Text [ en-US ] = "Business"; + }; + PageItem + { + Identifier = TP_LAB_FMT ; + PageResID = TP_LAB_FMT ; + Text [ en-US ] = "Format" ; + }; + PageItem + { + Identifier = TP_LAB_PRT ; + PageResID = TP_LAB_PRT ; + Text [ en-US ] = "Options" ; + }; + }; + }; + String ST_BUSINESSCARDDLG + { + BUSINESS_CARD_STRING + }; + String ST_FIRSTPAGE_LAB + { + LABEL_STRING + }; + String ST_FIRSTPAGE_BC + { + Text [ en-US ] = "Medium"; + }; +}; + // TP_LAB_LAB --------------------------------------------------------------- +TabPage TP_LAB_LAB +{ + HelpID = HID_LAB_LAB ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedText TXT_WRITING + { + Pos = MAP_APPFONT ( 12 , 15 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Group = TRUE ; + Left = TRUE ; + Text [ en-US ] = "Label text" ; + }; + CheckBox BOX_ADDR + { + Pos = MAP_APPFONT ( 67 , 14 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Address" ; + }; + MultiLineEdit EDT_WRITING + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 105 , 89 ) ; + TabStop = TRUE ; + Left = TRUE ; + HScroll = TRUE ; + VScroll = TRUE ; + IgnoreTab = TRUE; + }; + FixedText FT_DATABASE + { + Pos = MAP_APPFONT ( 149 , 16 ) ; + Size = MAP_APPFONT ( 99 , 8 ) ; + Text [ en-US ] = "Database" ; + }; + ListBox LB_DATABASE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 149 , 27 ) ; + Size = MAP_APPFONT ( 99 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TABLE + { + Pos = MAP_APPFONT ( 149 , 45 ) ; + Size = MAP_APPFONT ( 99 , 8 ) ; + Text [ en-US ] = "Table" ; + }; + ListBox LB_TABLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 149 , 56 ) ; + Size = MAP_APPFONT ( 99 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + ImageButton BTN_INSERT + { + Pos = MAP_APPFONT ( 124 , 92 ) ; + Size = MAP_APPFONT ( 18 , 12 ) ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; + TabStop = TRUE ; + }; + FixedText FT_DBFIELD + { + Pos = MAP_APPFONT ( 149 , 81 ) ; + Size = MAP_APPFONT ( 99 , 8 ) ; + Text [ en-US ] = "Database field" ; + }; + ListBox LB_DBFIELD + { + Border = TRUE ; + Pos = MAP_APPFONT ( 149 , 92 ) ; + Size = MAP_APPFONT ( 99 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedLine FL_WRITING + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Inscription" ; + }; + RadioButton BTN_CONT + { + Pos = MAP_APPFONT ( 12 , 137 ) ; + Size = MAP_APPFONT ( 65 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "~Continuous" ; + }; + RadioButton BTN_SHEET + { + Pos = MAP_APPFONT ( 12 , 153 ) ; + Size = MAP_APPFONT ( 65 , 10 ) ; + Text [ en-US ] = "~Sheet" ; + }; + FixedText TXT_MAKE + { + Pos = MAP_APPFONT ( 91 , 138 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "Brand" ; + Left = TRUE ; + }; + ListBox BOX_MAKE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 124 , 136 ) ; + Size = MAP_APPFONT ( 124 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText TXT_TYPE + { + Pos = MAP_APPFONT ( 91 , 154 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Type" ; + }; + ListBox BOX_TYPE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 124 , 152 ) ; + Size = MAP_APPFONT ( 124 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText INF_FORMAT + { + Pos = MAP_APPFONT ( 12 , 168 ) ; + Size = MAP_APPFONT ( 236 , 8 ) ; + Left = TRUE ; + }; + FixedLine FL_FORMAT + { + Pos = MAP_APPFONT ( 6 , 125 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Format" ; + }; +}; +#define WIDTH 100 +#define HEIGHT 16 +FloatingWindow DLG_SYNC_BTN +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( WIDTH , HEIGHT ) ; + Moveable = TRUE ; + Closeable = FALSE ; + Sizeable = FALSE ; + Zoomable = TRUE ; + HelpID = HID_SYNC_BTN ; + Hide = TRUE ; + PushButton BTN_SYNC + { + Pos = MAP_APPFONT ( 1 , 1 ) ; + Size = MAP_APPFONT ( WIDTH - 1 , HEIGHT - 1 ) ; + Text [ en-US ] = "Synchronize Labels" ; + }; +}; + // String ******************************************************************* +String STR_DOC_TITLE +{ + Text [ en-US ] = "Labels" ; +}; +String STR_CUSTOM +{ + Text [ en-US ] = "[User]"; +}; +/********************************************************************/ +TabPage TP_VISITING_CARDS +{ + HelpID = HID_TP_VISITING_CARDS ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + + Control LB_AUTO_TEXT + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 109 , 135 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_AUTO_TEXT_GROUP + { + Pos = MAP_APPFONT ( 12 , 153) ; + Size = MAP_APPFONT ( 109 , 8 ) ; + Text [ en-US ] = "AutoText - Section"; + }; + ListBox LB_AUTO_TEXT_GROUP + { + Pos = MAP_APPFONT ( 12 , 164) ; + Size = MAP_APPFONT ( 109 , 50 ) ; + Border = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedLine FL_CONTENT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Content"; + }; + Window WIN_EXAMPLE + { + Pos = MAP_APPFONT ( 139, 14 ) ; + Size = MAP_APPFONT ( 109 , 162 ) ; + }; + String ST_VISCARD_GROUP + { + Text = "Cards"; + }; +}; +TabPage TP_PRIVATE_DATA +{ + HelpID = HID_TP_PRIVATE_DATA ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_DATA + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Private data"; + }; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 12 , 16) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "First/Last ~name/Initials"; + }; + Edit ED_FIRSTNAME + { + Pos = MAP_APPFONT ( 105 , 14 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + }; + Edit ED_NAME + { + Pos = MAP_APPFONT ( 163 , 14 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + }; + Edit ED_SHORTCUT + { + Pos = MAP_APPFONT ( 221 , 14 ) ; + Size = MAP_APPFONT ( 27 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_NAME_2 + { + Pos = MAP_APPFONT ( 12 , 32) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "First/Last ~name/Initials 2"; + }; + Edit ED_FIRSTNAME_2 + { + Pos = MAP_APPFONT ( 105 , 30 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + }; + Edit ED_NAME_2 + { + Pos = MAP_APPFONT ( 163 , 30 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + }; + Edit ED_SHORTCUT_2 + { + Pos = MAP_APPFONT ( 221 , 30 ) ; + Size = MAP_APPFONT ( 27 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_STREET + { + Pos = MAP_APPFONT ( 12 , 48) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "S~treet"; + }; + Edit ED_STREET + { + Pos = MAP_APPFONT ( 105 , 46 ) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_ZIPCITY + { + Pos = MAP_APPFONT ( 12 , 64) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Zip/Cit~y"; + }; + Edit ED_ZIP + { + Pos = MAP_APPFONT ( 105 , 62 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + Border = TRUE ; + }; + Edit ED_CITY + { + Pos = MAP_APPFONT ( 158 , 62 ) ; + Size = MAP_APPFONT ( 90 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_COUNTRYSTATE + { + Pos = MAP_APPFONT ( 12 , 80) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Co~untry/State"; + }; + Edit ED_COUNTRY + { + Pos = MAP_APPFONT ( 105 , 78 ) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_STATE + { + Pos = MAP_APPFONT ( 179 , 78 ) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_TITLEPROF + { + Pos = MAP_APPFONT ( 12 , 96) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Title/~Profession"; + }; + Edit ED_TITLE + { + Pos = MAP_APPFONT ( 105 , 94 ) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_PROFESSION + { + Pos = MAP_APPFONT ( 179 , 94 ) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_PHONE_MOBILE + { + Pos = MAP_APPFONT ( 12 , 112) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Phone/Mobile"; + }; + Edit ED_PHONE + { + Pos = MAP_APPFONT ( 105 , 110 ) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_MOBILE + { + Pos = MAP_APPFONT ( 179 , 110 ) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_FAX + { + Pos = MAP_APPFONT ( 12 , 128) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Fa~x"; + }; + Edit ED_FAX + { + Pos = MAP_APPFONT ( 105 , 126 ) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_WWWMAIL + { + Pos = MAP_APPFONT ( 12 , 144) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Homepage / e-mail"; + }; + Edit ED_WWW + { + Pos = MAP_APPFONT ( 105 , 142) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_MAIL + { + Pos = MAP_APPFONT ( 179 , 142) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; +}; +TabPage TP_BUSINESS_DATA +{ + HelpID = HID_TP_BUSINESS_DATA; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_DATA + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Business data"; + }; + FixedText FT_COMP + { + Pos = MAP_APPFONT ( 12 , 16) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Company"; + }; + Edit ED_COMP + { + Pos = MAP_APPFONT ( 105 , 14) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_COMP_EXT + { + Pos = MAP_APPFONT ( 12 , 32) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Company 2nd line"; + }; + Edit ED_COMP_EXT + { + Pos = MAP_APPFONT ( 105 , 30) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_SLOGAN + { + Pos = MAP_APPFONT ( 12 , 48) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Slogan"; + }; + Edit ED_SLOGAN + { + Pos = MAP_APPFONT ( 105 , 46) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_STREET + { + Pos = MAP_APPFONT ( 12 , 64) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Street"; + }; + Edit ED_STREET + { + Pos = MAP_APPFONT ( 105 , 62) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_ZIPCITY + { + Pos = MAP_APPFONT ( 12 , 80) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "ZIP/City"; + }; + Edit ED_ZIP + { + Pos = MAP_APPFONT ( 105 , 78) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + Border = TRUE ; + }; + Edit ED_CITY + { + Pos = MAP_APPFONT ( 158 , 78) ; + Size = MAP_APPFONT ( 90 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_COUNTRYSTATE + { + Pos = MAP_APPFONT ( 12 , 96) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Country/State"; + }; + Edit ED_COUNTRY + { + Pos = MAP_APPFONT ( 105 , 94) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_STATE + { + Pos = MAP_APPFONT ( 179 , 94) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_POSITION + { + Pos = MAP_APPFONT ( 12 , 112) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Position"; + }; + Edit ED_POSITION + { + Pos = MAP_APPFONT ( 105 , 110) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_PHONE_MOBILE + { + Pos = MAP_APPFONT ( 12 , 128) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Phone/Mobile"; + }; + Edit ED_PHONE + { + Pos = MAP_APPFONT ( 105 , 126) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_MOBILE + { + Pos = MAP_APPFONT ( 179 , 126) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_FAX + { + Pos = MAP_APPFONT ( 12 , 144) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Fax"; + }; + Edit ED_FAX + { + Pos = MAP_APPFONT ( 105 , 142) ; + Size = MAP_APPFONT ( 143 , 12 ) ; + Border = TRUE ; + }; + FixedText FT_WWWMAIL + { + Pos = MAP_APPFONT ( 12 , 160) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Ho~mepage / e-mail"; + }; + Edit ED_WWW + { + Pos = MAP_APPFONT ( 105 , 158) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + Border = TRUE ; + }; + Edit ED_MAIL + { + Pos = MAP_APPFONT ( 179 , 158) ; + Size = MAP_APPFONT ( 69 , 12 ) ; + Border = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx new file mode 100644 index 000000000000..bc86c4719c4b --- /dev/null +++ b/sw/source/ui/envelp/label1.cxx @@ -0,0 +1,1114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: label1.cxx,v $ + * $Revision: 1.38 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <vcl/waitobj.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <swtypes.hxx> +#include <wrtsh.hxx> +#include <initui.hxx> +#include <labimp.hxx> +#include <labfmt.hxx> +#include <labprt.hxx> +#include <unotools.hxx> +#ifndef _DBMGR_HXX +#include <dbmgr.hxx> +#endif +#include "uitool.hxx" +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _HELPID_H +#include <helpid.h> +#endif +#ifndef _GLOBALS_HRC +#include <globals.hrc> +#endif +#ifndef _LABEL_HRC +#include <label.hrc> +#endif + +//impl in envimg.cxx +extern SW_DLLPUBLIC String MakeSender(); + + +SV_IMPL_PTRARR( SwLabRecs, SwLabRec* ); + +void SwLabRec::SetFromItem( const SwLabItem& rItem ) +{ + lHDist = rItem.lHDist; + lVDist = rItem.lVDist; + lWidth = rItem.lWidth; + lHeight = rItem.lHeight; + lLeft = rItem.lLeft; + lUpper = rItem.lUpper; + nCols = rItem.nCols; + nRows = rItem.nRows; + bCont = rItem.bCont; +} + +void SwLabRec::FillItem( SwLabItem& rItem ) const +{ + rItem.lHDist = lHDist; + rItem.lVDist = lVDist; + rItem.lWidth = lWidth; + rItem.lHeight = lHeight; + rItem.lLeft = lLeft; + rItem.lUpper = lUpper; + rItem.nCols = nCols; + rItem.nRows = nRows; +} + +// -------------------------------------------------------------------------- +void SwLabDlg::_ReplaceGroup( const String &rMake ) +{ + //Die alten Eintraege vernichten. + pRecs->Remove( 1, pRecs->Count() - 1 ); + aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs); + aLstGroup = rMake; +} + +// -------------------------------------------------------------------------- + + + +void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) +{ + if (nId == TP_LAB_LAB) + { + if(m_bLabel) + { + ((SwLabPage*)&rPage)->SetNewDBMgr(pNewDBMgr); + ((SwLabPage*)&rPage)->InitDatabaseBox(); + } + else + ((SwLabPage*)&rPage)->SetToBusinessCard(); + } + else if (nId == TP_LAB_PRT) + pPrtPage = (SwLabPrtPage*)&rPage; +} + +// -------------------------------------------------------------------------- + + + +SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, + SwNewDBMgr* pDBMgr, sal_Bool bLabel) : + SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ), + pNewDBMgr(pDBMgr), + pPrtPage(0), + + aTypeIds( 50, 10 ), + aMakes ( 5, 0 ), + + pRecs ( new SwLabRecs() ), + sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)), + sFormat(SW_RES(ST_FIRSTPAGE_LAB)), + sMedium(SW_RES(ST_FIRSTPAGE_BC)), + m_bLabel(bLabel) +{ + WaitObject aWait( pParent ); + + FreeResource(); + + GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC))); + GetOKButton().SetHelpId(HID_LABEL_INSERT); + GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird + + AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage ::Create, 0, sal_False, 0); + AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0); + AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0); + AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0); + AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 ); + AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0); + + + if(m_bLabel) + { + RemoveTabPage(TP_BUSINESS_DATA); + RemoveTabPage(TP_PRIVATE_DATA); + RemoveTabPage(TP_VISITING_CARDS); + } + else + { + SetText(sBusinessCardDlg); + } + // Benutzer-Etikette aus writer.cfg lesen + SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL )); + SwLabRec* pRec = new SwLabRec; + const String aTmp( SW_RES( STR_CUSTOM ) ); + pRec->aMake = pRec->aType = aTmp; + pRec->SetFromItem( aItem ); + + sal_Bool bDouble = sal_False; + + for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++) + { + if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake && + pRec->aType == pRecs->GetObject(nRecPos)->aType) + { + bDouble = sal_True; + break; + } + } + + if (!bDouble) + pRecs->C40_INSERT( SwLabRec, pRec, 0 ); + + sal_uInt16 nLstGroup = 0; + const UNO_NMSPC::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers(); + const rtl::OUString* pMan = rMan.getConstArray(); + for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++) + { + aMakes.Insert( new String(pMan[nMan]), aMakes.Count() ); + if ( pMan[nMan] == aItem.aLstMake ) + nLstGroup = (sal_uInt16) nMan; + } + + if ( aMakes.Count() ) + _ReplaceGroup( *aMakes[nLstGroup] ); + if (pExampleSet) + pExampleSet->Put(aItem); +} + +// -------------------------------------------------------------------------- + +SwLabDlg::~SwLabDlg() +{ + delete pRecs; +} +// -------------------------------------------------------------------------- + +void SwLabDlg::GetLabItem(SwLabItem &rItem) +{ + const SwLabItem& rActItem = (const SwLabItem&)GetExampleSet()->Get(FN_LABEL); + const SwLabItem& rOldItem = (const SwLabItem&)GetInputSetImpl()->Get(FN_LABEL); + + if (rActItem != rOldItem) + { // Wurde schon mal mit (hoffentlich) korrektem Inhalt "geputtet" + rItem = rActItem; + } + else + { + rItem = rOldItem; + + // Im rItem stehen (vom Namen mal abgesehen) immer nur die + // benutzerdefinierbaren Einstellungen. Daher richtige Werte + // direkt aus dem Record besorgen: + SwLabRec* pRec = GetRecord(rItem.aType, rItem.bCont); + pRec->FillItem( rItem ); + } +} + +// -------------------------------------------------------------------------- + +SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont) +{ + SwLabRec* pRec = NULL; + sal_Bool bFound = sal_False; + String sCustom(SW_RES(STR_CUSTOM)); + + const sal_uInt16 nCount = Recs().Count(); + for (sal_uInt16 i = 0; i < nCount; i++) + { + pRec = Recs()[i]; + if (pRec->aType != sCustom && + rRecName == pRec->aType && bCont == pRec->bCont) + { + bFound = sal_True; + break; + } + } + if (!bFound) // Benutzerdefiniert + pRec = Recs()[0]; + + return(pRec); +} + +// -------------------------------------------------------------------------- + +Printer *SwLabDlg::GetPrt() +{ + if (pPrtPage) + return (pPrtPage->GetPrt()); + else + return (NULL); +} + +// -------------------------------------------------------------------------- +SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) : + SfxTabPage(pParent, SW_RES(TP_LAB_LAB), rSet), + pNewDBMgr(NULL), + aItem ((const SwLabItem&) rSet.Get(FN_LABEL)), + + aWritingText (this, SW_RES(TXT_WRITING)), + aAddrBox (this, SW_RES(BOX_ADDR )), + aWritingEdit (this, SW_RES(EDT_WRITING)), + aDatabaseFT (this, SW_RES(FT_DATABASE)), + aDatabaseLB (this, SW_RES(LB_DATABASE)), + aTableFT (this, SW_RES(FT_TABLE )), + aTableLB (this, SW_RES(LB_TABLE )), + aInsertBT (this, SW_RES(BTN_INSERT )), + aDBFieldFT (this, SW_RES(FT_DBFIELD )), + aDBFieldLB (this, SW_RES(LB_DBFIELD )), + aWritingFL (this, SW_RES(FL_WRITING)), + aContButton (this, SW_RES(BTN_CONT )), + aSheetButton (this, SW_RES(BTN_SHEET )), + aMakeText (this, SW_RES(TXT_MAKE )), + aMakeBox (this, SW_RES(BOX_MAKE )), + aTypeText (this, SW_RES(TXT_TYPE )), + aTypeBox (this, SW_RES(BOX_TYPE )), + aHiddenSortTypeBox(this, WB_SORT|WB_HIDE), + aFormatInfo (this, SW_RES(INF_FORMAT )), + aFormatFL (this, SW_RES(FL_FORMAT )) +{ + WaitObject aWait( pParent ); + + FreeResource(); + SetExchangeSupport(); + + + // Handler installieren + aAddrBox .SetClickHdl (LINK(this, SwLabPage, AddrHdl )); + aDatabaseLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl )); + aTableLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl )); + aInsertBT .SetClickHdl (LINK(this, SwLabPage, FieldHdl )); + aContButton .SetClickHdl (LINK(this, SwLabPage, PageHdl )); + aSheetButton .SetClickHdl (LINK(this, SwLabPage, PageHdl )); + aMakeBox .SetSelectHdl(LINK(this, SwLabPage, MakeHdl )); + aTypeBox .SetSelectHdl(LINK(this, SwLabPage, TypeHdl )); + + InitDatabaseBox(); + + sal_uInt16 nLstGroup = 0; + + const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count(); + for (sal_uInt16 i = 0; i < nCount; ++i) + { + String &rStr = *GetParent()->Makes()[i]; + aMakeBox.InsertEntry( rStr ); + if ( rStr == String(aItem.aLstMake) ) + nLstGroup = i; + } +// Reset(rSet); + aMakeBox.SelectEntryPos( nLstGroup ); + aMakeBox.GetSelectHdl().Call( &aMakeBox ); +} + +// -------------------------------------------------------------------------- + + + +SwLabPage::~SwLabPage() +{ +} +/* -----------------29.09.99 09:08------------------- + + --------------------------------------------------*/ +void lcl_ChgYPos(Window& rWin, long nDiff) +{ + Point aTempPos(rWin.GetPosPixel()); + aTempPos.Y() += nDiff; + rWin.SetPosPixel(aTempPos); +} + +void SwLabPage::SetToBusinessCard() +{ + SetHelpId(HID_BUSINESS_FMT_PAGE); + aContButton.SetHelpId(HID_BUSINESS_FMT_PAGE_CONT); + aSheetButton.SetHelpId(HID_BUSINESS_FMT_PAGE_SHEET); + aMakeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_BRAND); + aTypeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_TYPE); + m_bLabel = sal_False; + aWritingText.Hide(); + aAddrBox.Hide(); + aWritingEdit.Hide(); + aDatabaseFT.Hide(); + aDatabaseLB.Hide(); + aTableFT.Hide(); + aTableLB.Hide(); + aInsertBT.Hide(); + aDBFieldFT.Hide(); + aDBFieldLB.Hide(); + aWritingFL.Hide(); + + //resize the form + Point aFLPos(aWritingFL.GetPosPixel()); + long nDiffPos = aFormatFL.GetPosPixel().Y() - aFLPos.Y(); + Size aFLSz(aFormatFL.GetSizePixel()); +// aFLSz.Height() += nDiffPos; + aFormatFL.SetPosSizePixel(aFLPos, aFLSz); + + // move all controls up + lcl_ChgYPos(aContButton, -nDiffPos); + lcl_ChgYPos(aSheetButton, -nDiffPos); + lcl_ChgYPos(aMakeText, -nDiffPos); + + lcl_ChgYPos(aTypeText, -nDiffPos); + lcl_ChgYPos(aFormatInfo, -nDiffPos); + + Size aTmpSz(3, 3); + aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT); + + lcl_ChgYPos(aMakeBox, - nDiffPos); + Point aLBPos(aMakeBox.GetPosPixel()); + aLBPos.Y() += aMakeBox.GetSizePixel().Height() + aTmpSz.Height(); + aTypeBox.SetPosPixel(aLBPos); +}; + +// -------------------------------------------------------------------------- + + +IMPL_LINK( SwLabPage, AddrHdl, Button *, EMPTYARG ) +{ + String aWriting; + if ( aAddrBox.IsChecked() ) + aWriting = MakeSender(); + aWritingEdit.SetText( aWriting.ConvertLineEnd() ); + aWritingEdit.GrabFocus(); + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwLabPage, DatabaseHdl, ListBox *, pListBox ) +{ + sActDBName = aDatabaseLB.GetSelectEntry(); + + WaitObject aObj( GetParent() ); + + if (pListBox == &aDatabaseLB) + GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName); + GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, aTableLB.GetSelectEntry()); + return 0; +} + + + +IMPL_LINK( SwLabPage, FieldHdl, Button *, EMPTYARG ) +{ + String aStr ( '<' ); + aStr += aDatabaseLB.GetSelectEntry(); + aStr += '.'; + aStr += aTableLB.GetSelectEntry(); + aStr += '.'; + aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1'; + aStr += '.'; + aStr += aDBFieldLB.GetSelectEntry(); + aStr += '>'; + aWritingEdit.ReplaceSelected(aStr); + Selection aSel = aWritingEdit.GetSelection(); + aWritingEdit.GrabFocus(); + aWritingEdit.SetSelection(aSel); + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK_INLINE_START( SwLabPage, PageHdl, Button *, EMPTYARG ) +{ + aMakeBox.GetSelectHdl().Call( &aMakeBox ); + return 0; +} +IMPL_LINK_INLINE_END( SwLabPage, PageHdl, Button *, EMPTYARG ) + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG ) +{ + WaitObject aWait( GetParent() ); + + aTypeBox.Clear(); + aHiddenSortTypeBox.Clear(); + GetParent()->TypeIds().Remove( 0, GetParent()->TypeIds().Count() ); + + const String aMake = aMakeBox.GetSelectEntry(); + GetParent()->ReplaceGroup( aMake ); + aItem.aLstMake = aMake; + + const sal_Bool bCont = aContButton.IsChecked(); + const sal_uInt16 nCount = GetParent()->Recs().Count(); + sal_uInt16 nLstType = 0; + + const String sCustom(SW_RES(STR_CUSTOM)); + //insert the entries into the sorted list box + for ( sal_uInt16 i = 0; i < nCount; ++i ) + { + const String aType ( GetParent()->Recs()[i]->aType ); + BOOL bInsert = FALSE; + if ( GetParent()->Recs()[i]->aType == sCustom ) + { + bInsert = TRUE; + aTypeBox.InsertEntry(aType ); + } + else if ( GetParent()->Recs()[i]->bCont == bCont ) + { + if ( aHiddenSortTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND ) + { + bInsert = TRUE; + aHiddenSortTypeBox.InsertEntry( aType ); + } + } + if(bInsert) + { + GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count()); + if ( !nLstType && aType == String(aItem.aLstType) ) + nLstType = GetParent()->TypeIds().Count(); + } + } + for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++) + { + aTypeBox.InsertEntry(aHiddenSortTypeBox.GetEntry(nEntry)); + } + if (nLstType) + aTypeBox.SelectEntry(aItem.aLstType); + else + aTypeBox.SelectEntryPos(0); + aTypeBox.GetSelectHdl().Call( &aTypeBox ); + return 0; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK_INLINE_START( SwLabPage, TypeHdl, ListBox *, EMPTYARG ) +{ + DisplayFormat(); + aItem.aType = aTypeBox.GetSelectEntry(); + return 0; +} +IMPL_LINK_INLINE_END( SwLabPage, TypeHdl, ListBox *, EMPTYARG ) + +// -------------------------------------------------------------------------- + + + +void SwLabPage::DisplayFormat() +{ + MetricField aField(this, WinBits(0)); + FieldUnit aMetric = ::GetDfltMetric(FALSE); + SetMetric(aField, aMetric); + aField.SetDecimalDigits(2); + aField.SetMin (0); + aField.SetMax (LONG_MAX); + + SwLabRec* pRec = GetSelectedEntryPos(); + aItem.aLstType = pRec->aType; + SETFLDVAL(aField, pRec->lWidth); + aField.Reformat(); + const String aWString = aField.GetText(); + + SETFLDVAL(aField, pRec->lHeight); + aField.Reformat(); + + String aText = pRec->aType; + aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": ")); + aText += aWString; + aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x ")); + aText += aField.GetText(); + aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" (")); + aText += String::CreateFromInt32( pRec->nCols ); + aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x ")); + aText += String::CreateFromInt32( pRec->nRows ); + aText += ')'; + aFormatInfo.SetText(aText); +} + +// -------------------------------------------------------------------------- + +SwLabRec* SwLabPage::GetSelectedEntryPos() +{ + String sSelEntry(aTypeBox.GetSelectEntry()); + + return GetParent()->GetRecord(sSelEntry, aContButton.IsChecked()); +} + +// -------------------------------------------------------------------------- + + + +void SwLabPage::InitDatabaseBox() +{ + if( GetNewDBMgr() ) + { + aDatabaseLB.Clear(); + UNO_NMSPC::Sequence<rtl::OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames(); + const rtl::OUString* pDataNames = aDataNames.getConstArray(); + for (long i = 0; i < aDataNames.getLength(); i++) + aDatabaseLB.InsertEntry(pDataNames[i]); + String sDBName = sActDBName.GetToken( 0, DB_DELIM ); + String sTableName = sActDBName.GetToken( 1, DB_DELIM ); + aDatabaseLB.SelectEntry(sDBName); + if( sDBName.Len() && GetNewDBMgr()->GetTableNames(&aTableLB, sDBName)) + { + aTableLB.SelectEntry(sTableName); + GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, sTableName); + } + else + aDBFieldLB.Clear(); + } +} + +// -------------------------------------------------------------------------- +SfxTabPage* SwLabPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwLabPage(pParent, rSet); +} + +// -------------------------------------------------------------------------- +void SwLabPage::ActivatePage(const SfxItemSet& rSet) +{ + Reset( rSet ); +} +// -------------------------------------------------------------------------- +int SwLabPage::DeactivatePage(SfxItemSet* _pSet) +{ + if (_pSet) + FillItemSet(*_pSet); + + return sal_True; +} + +// -------------------------------------------------------------------------- + + + +void SwLabPage::FillItem(SwLabItem& rItem) +{ + rItem.bAddr = aAddrBox.IsChecked(); + rItem.aWriting = aWritingEdit.GetText(); + rItem.bCont = aContButton.IsChecked(); + rItem.aMake = aMakeBox.GetSelectEntry(); + rItem.aType = aTypeBox.GetSelectEntry(); + rItem.sDBName = sActDBName; + + SwLabRec* pRec = GetSelectedEntryPos(); + pRec->FillItem( rItem ); + + rItem.aLstMake = aMakeBox.GetSelectEntry(); + rItem.aLstType = aTypeBox.GetSelectEntry(); +} + +// -------------------------------------------------------------------------- + + + +sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet) +{ + FillItem( aItem ); + rSet.Put( aItem ); + + return sal_True; +} + +// -------------------------------------------------------------------------- + +void SwLabPage::Reset(const SfxItemSet& rSet) +{ + aItem = (const SwLabItem&) rSet.Get(FN_LABEL); + String sDBName = aItem.sDBName; + + String aWriting( aItem.aWriting ); + + aAddrBox .Check ( aItem.bAddr ); + aWritingEdit.SetText ( aWriting.ConvertLineEnd() ); + + const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count(); + for (sal_uInt16 i = 0; i < nCount; ++i) + { + String &rStr = *GetParent()->Makes()[i]; + if(aMakeBox.GetEntryPos(String(rStr)) == LISTBOX_ENTRY_NOTFOUND) + aMakeBox.InsertEntry( rStr ); + } + + + aMakeBox .SelectEntry( aItem.aMake ); + //save the current type + String sType(aItem.aType); + aMakeBox.GetSelectHdl().Call( &aMakeBox ); + aItem.aType = sType; + //#102806# a newly added make may not be in the type ListBox already + if (aTypeBox.GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && aItem.aMake.getLength()) + GetParent()->UpdateGroup( aItem.aMake ); + if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND) + { + aTypeBox.SelectEntry(aItem.aType); + aTypeBox.GetSelectHdl().Call(&aTypeBox); + } + if (aDatabaseLB.GetEntryPos(sDBName) != LISTBOX_ENTRY_NOTFOUND) + { + aDatabaseLB.SelectEntry(sDBName); + aDatabaseLB.GetSelectHdl().Call(&aDatabaseLB); + } + + if (aItem.bCont) + aContButton .Check(); + else + aSheetButton.Check(); +} + +/*-- 08.07.99 14:00:02--------------------------------------------------- + + -----------------------------------------------------------------------*/ +//----------------------------------------------------------------------------- +void SwVisitingCardPage::ClearUserData() +{ + SvLBoxEntry* pEntry = aAutoTextLB.First(); + while(pEntry) + { + delete (String*)pEntry->GetUserData(); + pEntry = aAutoTextLB.Next(pEntry); + } +} + +//----------------------------------------------------------------------------- + +void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt, + const rtl::OUString* pNames, const rtl::OUString* pValues ) +{ + for( sal_uInt32 i = 0; i < nCnt; ++i ) + { + SvLBoxEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] ); + pEntry->SetUserData( new String( pValues[ i ] )); + } +} + +//----------------------------------------------------------------------------- + +SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) : + SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet), + aAutoTextLB(this, SW_RES( LB_AUTO_TEXT )), + aAutoTextGroupFT(this, SW_RES( FT_AUTO_TEXT_GROUP )), + aAutoTextGroupLB(this, SW_RES( LB_AUTO_TEXT_GROUP )), + aContentFL(this, SW_RES( FL_CONTENT )), + aExampleWIN(this, SW_RES( WIN_EXAMPLE )), + sVisCardGroup(SW_RES(ST_VISCARD_GROUP)), + pExampleFrame(0) +{ + FreeResource(); + aAutoTextLB.SetWindowBits( WB_HSCROLL ); + aAutoTextLB.SetSpaceBetweenEntries(0); + aAutoTextLB.SetSelectionMode( SINGLE_SELECTION ); + aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT); + + SetExchangeSupport(); + aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); + aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); + + aExampleWIN.Hide(); + + aAutoTextLB.Show(); + aAutoTextGroupFT.Show(); + aAutoTextGroupLB.Show(); + InitFrameControl(); +} +/*-- 08.07.99 14:00:03--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwVisitingCardPage::~SwVisitingCardPage() +{ + for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++) + delete (String*)aAutoTextGroupLB.GetEntryData( i ); + _xAutoText = 0; + + ClearUserData(); + delete pExampleFrame; +} +/*-- 08.07.99 14:00:03--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SwVisitingCardPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwVisitingCardPage(pParent, rSet); +} +/*-- 08.07.99 14:00:03--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet) +{ + Reset( rSet ); + UpdateFields(); +} +/*-- 08.07.99 14:00:04--------------------------------------------------- + + -----------------------------------------------------------------------*/ +int SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet) +{ + if (_pSet) + FillItemSet(*_pSet); + return LEAVE_PAGE; +} +/*-- 08.07.99 14:00:04--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet) +{ + String* pGroup = (String*)aAutoTextGroupLB.GetEntryData( + aAutoTextGroupLB.GetSelectEntryPos()); + DBG_ASSERT(pGroup, "no group selected?"); + if(pGroup) + aLabItem.sGlossaryGroup = *pGroup; + + SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected(); + if(pSelEntry) + aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData(); + rSet.Put(aLabItem); + return sal_True; +} +/*-- 08.07.99 14:00:05--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName) +{ + SvLBoxEntry* pEntry = rAutoTextLB.First(); + while(pEntry) + { + if(*(String*)pEntry->GetUserData() == rBlockName) + { + rAutoTextLB.Select(pEntry); + rAutoTextLB.MakeVisible(pEntry); + break; + } + pEntry = rAutoTextLB.Next(pEntry); + } +} +//----------------------------------------------------------------------------- +sal_Bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName) +{ + SvLBoxEntry* pEntry = rAutoTextLB.First(); + while(pEntry) + { + if(*(String*)pEntry->GetUserData() == rBlockName) + { + rAutoTextLB.Select(pEntry); + return sal_True; + } + pEntry = rAutoTextLB.Next(pEntry); + } + return sal_False; +} + +//----------------------------------------------------------------------------- +void SwVisitingCardPage::Reset(const SfxItemSet& rSet) +{ + aLabItem = (const SwLabItem&) rSet.Get(FN_LABEL); + + sal_Bool bFound = sal_False; + sal_uInt16 i; + for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++) + if( String(aLabItem.sGlossaryGroup) == + *(String*)aAutoTextGroupLB.GetEntryData( i )) + { + bFound = sal_True; + break; + } + + if(!bFound) + { + // initially search for a group starting with "crd" which is the name of the + // business card AutoTexts + for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++) + if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") ) + { + bFound = sal_True; + break; + } + } + if(bFound) + { + if(aAutoTextGroupLB.GetSelectEntryPos() != i) + { + aAutoTextGroupLB.SelectEntryPos(i); + AutoTextSelectHdl(&aAutoTextGroupLB); + } + if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName)) + { + SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected(); + if( pSelEntry && + *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName)) + { + lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName); + AutoTextSelectHdl(&aAutoTextLB); + } + } + } +} + +/* -----------------29.09.99 08:55------------------- + + --------------------------------------------------*/ +SwPrivateDataPage::SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet) : + SfxTabPage(pParent, SW_RES(TP_PRIVATE_DATA), rSet), + aDataFL (this, SW_RES( FL_DATA )), + + aNameFT (this, SW_RES( FT_NAME )), + aFirstNameED (this, SW_RES( ED_FIRSTNAME )), + aNameED (this, SW_RES( ED_NAME )), + aShortCutED (this, SW_RES( ED_SHORTCUT )), + + aName2FT (this, SW_RES( FT_NAME_2 )), + aFirstName2ED (this, SW_RES( ED_FIRSTNAME_2)), + aName2ED (this, SW_RES( ED_NAME_2 )), + aShortCut2ED (this, SW_RES( ED_SHORTCUT_2 )), + + aStreetFT (this, SW_RES( FT_STREET )), + aStreetED (this, SW_RES( ED_STREET )), + aZipCityFT (this, SW_RES( FT_ZIPCITY )), + aZipED (this, SW_RES( ED_ZIP )), + aCityED (this, SW_RES( ED_CITY )), + aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )), + aCountryED (this, SW_RES( ED_COUNTRY )), + aStateED (this, SW_RES( ED_STATE )), + aTitleProfessionFT (this, SW_RES( FT_TITLEPROF )), + aTitleED (this, SW_RES( ED_TITLE )), + aProfessionED (this, SW_RES( ED_PROFESSION )), + aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )), + aPhoneED (this, SW_RES( ED_PHONE )), + aMobilePhoneED (this, SW_RES( ED_MOBILE )), + aFaxFT (this, SW_RES( FT_FAX )), + aFaxED (this, SW_RES( ED_FAX )), + aWWWMailFT (this, SW_RES( FT_WWWMAIL )), + aHomePageED (this, SW_RES( ED_WWW )), + aMailED (this, SW_RES( ED_MAIL )) +{ + FreeResource(); + SetExchangeSupport(); +} + +/*-- 29.09.99 08:55:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwPrivateDataPage::~SwPrivateDataPage() +{ +} +/*-- 29.09.99 08:55:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SwPrivateDataPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwPrivateDataPage(pParent, rSet); +} +/*-- 29.09.99 08:55:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet) +{ + Reset(rSet); +} +/*-- 29.09.99 08:55:58--------------------------------------------------- + + -----------------------------------------------------------------------*/ +int SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet) +{ + if (_pSet) + FillItemSet(*_pSet); + return LEAVE_PAGE; +} +/*-- 29.09.99 08:55:58--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SwPrivateDataPage::FillItemSet(SfxItemSet& rSet) +{ + + SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL); + aItem.aPrivFirstName = aFirstNameED .GetText(); + aItem.aPrivName = aNameED .GetText( ); + aItem.aPrivShortCut = aShortCutED .GetText( ); + aItem.aPrivFirstName2 = aFirstName2ED .GetText(); + aItem.aPrivName2 = aName2ED .GetText( ); + aItem.aPrivShortCut2 = aShortCut2ED .GetText( ); + aItem.aPrivStreet = aStreetED .GetText( ); + aItem.aPrivZip = aZipED .GetText( ); + aItem.aPrivCity = aCityED .GetText( ); + aItem.aPrivCountry = aCountryED .GetText( ); + aItem.aPrivState = aStateED .GetText( ); + aItem.aPrivTitle = aTitleED .GetText( ); + aItem.aPrivProfession= aProfessionED.GetText( ); + aItem.aPrivPhone = aPhoneED .GetText( ); + aItem.aPrivMobile = aMobilePhoneED.GetText( ); + aItem.aPrivFax = aFaxED .GetText( ); + aItem.aPrivWWW = aHomePageED .GetText( ); + aItem.aPrivMail = aMailED .GetText( ); + + rSet.Put(aItem); + return sal_True; +} +/*-- 29.09.99 08:55:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwPrivateDataPage::Reset(const SfxItemSet& rSet) +{ + const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL); + aFirstNameED.SetText(aItem.aPrivFirstName); + aNameED .SetText(aItem.aPrivName); + aShortCutED .SetText(aItem.aPrivShortCut); + aFirstName2ED.SetText(aItem.aPrivFirstName2); + aName2ED .SetText(aItem.aPrivName2); + aShortCut2ED .SetText(aItem.aPrivShortCut2); + aStreetED .SetText(aItem.aPrivStreet); + aZipED .SetText(aItem.aPrivZip); + aCityED .SetText(aItem.aPrivCity); + aCountryED .SetText(aItem.aPrivCountry); + aStateED .SetText(aItem.aPrivState); + aTitleED .SetText(aItem.aPrivTitle); + aProfessionED.SetText(aItem.aPrivProfession); + aPhoneED .SetText(aItem.aPrivPhone); + aMobilePhoneED.SetText(aItem.aPrivMobile); + aFaxED .SetText(aItem.aPrivFax); + aHomePageED .SetText(aItem.aPrivWWW); + aMailED .SetText(aItem.aPrivMail); +} +/* -----------------29.09.99 08:56------------------- + + --------------------------------------------------*/ +SwBusinessDataPage::SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet) : + SfxTabPage(pParent, SW_RES(TP_BUSINESS_DATA), rSet), + aDataFL (this, SW_RES( FL_DATA )), + aCompanyFT (this, SW_RES( FT_COMP )), + aCompanyED (this, SW_RES( ED_COMP )), + aCompanyExtFT (this, SW_RES( FT_COMP_EXT )), + aCompanyExtED (this, SW_RES( ED_COMP_EXT )), + aSloganFT (this, SW_RES( FT_SLOGAN )), + aSloganED (this, SW_RES( ED_SLOGAN )), + aStreetFT (this, SW_RES( FT_STREET )), + aStreetED (this, SW_RES( ED_STREET )), + aZipCityFT (this, SW_RES( FT_ZIPCITY )), + aZipED (this, SW_RES( ED_ZIP )), + aCityED (this, SW_RES( ED_CITY )), + aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )), + aCountryED (this, SW_RES( ED_COUNTRY )), + aStateED (this, SW_RES( ED_STATE )), + aPositionFT (this, SW_RES( FT_POSITION )), + aPositionED (this, SW_RES( ED_POSITION )), + aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )), + aPhoneED (this, SW_RES( ED_PHONE )), + aMobilePhoneED (this, SW_RES( ED_MOBILE )), + aFaxFT (this, SW_RES( FT_FAX )), + aFaxED (this, SW_RES( ED_FAX )), + aWWWMailFT (this, SW_RES( FT_WWWMAIL )), + aHomePageED (this, SW_RES( ED_WWW )), + aMailED (this, SW_RES( ED_MAIL )) +{ + FreeResource(); + SetExchangeSupport(); +} + +/*-- 29.09.99 08:56:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwBusinessDataPage::~SwBusinessDataPage() +{ +} +/*-- 29.09.99 08:56:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SwBusinessDataPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwBusinessDataPage(pParent, rSet); +} +/*-- 29.09.99 08:56:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet) +{ + Reset(rSet); +} +/*-- 29.09.99 08:56:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +int SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet) +{ + if (_pSet) + FillItemSet(*_pSet); + return LEAVE_PAGE; +} +/*-- 29.09.99 08:56:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SwBusinessDataPage::FillItemSet(SfxItemSet& rSet) +{ + SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL); + + aItem.aCompCompany = aCompanyED .GetText(); + aItem.aCompCompanyExt= aCompanyExtED .GetText(); + aItem.aCompSlogan = aSloganED .GetText(); + aItem.aCompStreet = aStreetED .GetText(); + aItem.aCompZip = aZipED .GetText(); + aItem.aCompCity = aCityED .GetText(); + aItem.aCompCountry = aCountryED .GetText(); + aItem.aCompState = aStateED .GetText(); + aItem.aCompPosition = aPositionED .GetText(); + aItem.aCompPhone = aPhoneED .GetText(); + aItem.aCompMobile = aMobilePhoneED .GetText(); + aItem.aCompFax = aFaxED .GetText(); + aItem.aCompWWW = aHomePageED .GetText(); + aItem.aCompMail = aMailED .GetText(); + + rSet.Put(aItem); + return sal_True; +} +/*-- 29.09.99 08:56:07--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwBusinessDataPage::Reset(const SfxItemSet& rSet) +{ + const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL); + aCompanyED .SetText(aItem.aCompCompany); + aCompanyExtED .SetText(aItem.aCompCompanyExt); + aSloganED .SetText(aItem.aCompSlogan); + aStreetED .SetText(aItem.aCompStreet); + aZipED .SetText(aItem.aCompZip); + aCityED .SetText(aItem.aCompCity); + aCountryED .SetText(aItem.aCompCountry); + aStateED .SetText(aItem.aCompState); + aPositionED .SetText(aItem.aCompPosition); + aPhoneED .SetText(aItem.aCompPhone); + aMobilePhoneED .SetText(aItem.aCompMobile); + aFaxED .SetText(aItem.aCompFax); + aHomePageED .SetText(aItem.aCompWWW); + aMailED .SetText(aItem.aCompMail); +} + + + diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx new file mode 100644 index 000000000000..76a971c60db6 --- /dev/null +++ b/sw/source/ui/envelp/labelcfg.cxx @@ -0,0 +1,302 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labelcfg.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <swtypes.hxx> +#include <labelcfg.hxx> +#include <labimp.hxx> +#include <unotools/configpathes.hxx> + +#include <unomid.h> + +using namespace utl; +using namespace rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + +/* -----------------------------15.01.01 11:17-------------------------------- + + ---------------------------------------------------------------------------*/ +SwLabelConfig::SwLabelConfig() : + ConfigItem(C2U("Office.Labels/Manufacturer")) +{ + aNodeNames = GetNodeNames(OUString()); +} +/* -----------------------------06.09.00 16:50-------------------------------- + + ---------------------------------------------------------------------------*/ +SwLabelConfig::~SwLabelConfig() +{ +} +/* -----------------------------06.09.00 16:43-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwLabelConfig::Commit() +{ + // the config item is not writable yet +} +/* -----------------------------15.01.01 11:42-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<OUString> lcl_CreatePropertyNames(const OUString& rPrefix) +{ + Sequence<OUString> aProperties(2); + OUString* pProperties = aProperties.getArray(); + for(sal_Int32 nProp = 0; nProp < 2; nProp++) + pProperties[nProp] = rPrefix; + + pProperties[ 0] += C2U("Name"); + pProperties[ 1] += C2U("Measure"); + return aProperties; +} +//----------------------------------------------------------------------------- +SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& rValues, const OUString& rManufacturer) +{ + SwLabRec* pNewRec = new SwLabRec; + const Any* pValues = rValues.getConstArray(); + OUString sTmp; + pNewRec->aMake = rManufacturer; + for(sal_Int32 nProp = 0; nProp < rValues.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0: pValues[nProp] >>= sTmp; pNewRec->aType = sTmp; break; + case 1: + { +//all values are contained as colon-separated 1/100 mm values except for the +//continuous flag ('C'/'S') + pValues[nProp] >>= sTmp; + String sMeasure(sTmp); + USHORT nTokenCount = sMeasure.GetTokenCount(';'); + for(USHORT i = 0; i < nTokenCount; i++) + { + String sToken(sMeasure.GetToken(i, ';' )); + int nVal = sToken.ToInt32(); + switch(i) + { + case 0 : pNewRec->bCont = sToken.GetChar(0) == 'C'; break; + case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal);break; + case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal);break; + case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal);break; + case 4 : pNewRec->lHeight = MM100_TO_TWIP(nVal); break; + case 5 : pNewRec->lLeft = MM100_TO_TWIP(nVal);break; + case 6 : pNewRec->lUpper = MM100_TO_TWIP(nVal);break; + case 7 : pNewRec->nCols = nVal; break; + case 8 : pNewRec->nRows = nVal; break; + } + } + } + break; + } + } + } + return pNewRec; +} +//----------------------------------------------------------------------------- +Sequence<PropertyValue> lcl_CreateProperties( + Sequence<OUString>& rPropNames, const SwLabRec& rRec) +{ + const OUString* pNames = rPropNames.getConstArray(); + Sequence<PropertyValue> aRet(rPropNames.getLength()); + PropertyValue* pValues = aRet.getArray(); + OUString sColon(C2U(";")); + + for(sal_Int32 nProp = 0; nProp < rPropNames.getLength(); nProp++) + { + pValues[nProp].Name = pNames[nProp]; + switch(nProp) + { + case 0: pValues[nProp].Value <<= OUString(rRec.aType); break; + case 1: + { + OUString sTmp; + sTmp += C2U( rRec.bCont ? "C" : "S"); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHDist) ); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lVDist)); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lWidth) ); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHeight) ); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lLeft) ); sTmp += sColon; + sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lUpper) ); sTmp += sColon; + sTmp += OUString::valueOf(rRec.nCols );sTmp += sColon; + sTmp += OUString::valueOf(rRec.nRows ); + pValues[nProp].Value <<= sTmp; + } + break; + } + } + return aRet; +} +//----------------------------------------------------------------------------- +void SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLabArr) +{ + OUString sManufacturer(wrapConfigurationElementName(rManufacturer)); + const Sequence<OUString> aLabels = GetNodeNames(sManufacturer); + const OUString* pLabels = aLabels.getConstArray(); + for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++) + { + OUString sPrefix(sManufacturer); + sPrefix += C2U("/"); + sPrefix += pLabels[nLabel]; + sPrefix += C2U("/"); + Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix); + Sequence<Any> aValues = GetProperties(aPropNames); + SwLabRec* pNewRec = lcl_CreateSwLabRec(aValues, rManufacturer); + rLabArr.C40_INSERT( SwLabRec, pNewRec, rLabArr.Count() ); + } +} +/* -----------------------------23.01.01 11:36-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool SwLabelConfig::HasLabel(const rtl::OUString& rManufacturer, const rtl::OUString& rType) +{ + const OUString* pNode = aNodeNames.getConstArray(); + sal_Bool bFound = sal_False; + for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength() && !bFound; nNode++) + { + if(pNode[nNode] == rManufacturer) + bFound = sal_True; + } + if(bFound) + { + OUString sManufacturer(wrapConfigurationElementName(rManufacturer)); + const Sequence<OUString> aLabels = GetNodeNames(sManufacturer); + const OUString* pLabels = aLabels.getConstArray(); + for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++) + { + OUString sPrefix(sManufacturer); + sPrefix += C2U("/"); + sPrefix += pLabels[nLabel]; + sPrefix += C2U("/"); + Sequence<OUString> aProperties(1); + aProperties.getArray()[0] = sPrefix; + aProperties.getArray()[0] += C2U("Name"); + Sequence<Any> aValues = GetProperties(aProperties); + const Any* pValues = aValues.getConstArray(); + if(pValues[0].hasValue()) + { + OUString sTmp; + pValues[0] >>= sTmp; + if(rType == sTmp) + return sal_True; + } + } + } + return sal_False; +} +/* -----------------------------23.01.01 11:36-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool lcl_Exists(const OUString& rNode, const Sequence<OUString>& rLabels) +{ + const OUString* pLabels = rLabels.getConstArray(); + for(sal_Int32 i = 0; i < rLabels.getLength(); i++) + if(pLabels[i] == rNode) + return sal_True; + return sal_False; +} +//----------------------------------------------------------------------------- +void SwLabelConfig::SaveLabel( const rtl::OUString& rManufacturer, + const rtl::OUString& rType, const SwLabRec& rRec) +{ + const OUString* pNode = aNodeNames.getConstArray(); + sal_Bool bFound = sal_False; + for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength() && !bFound; nNode++) + { + if(pNode[nNode] == rManufacturer) + bFound = sal_True; + } + if(!bFound) + { + if(!AddNode(OUString(), rManufacturer)) + { + DBG_ERROR("New configuration node could not be created"); + return ; + } + else + { + aNodeNames = GetNodeNames(OUString()); + } + } + + OUString sManufacturer(wrapConfigurationElementName(rManufacturer)); + const Sequence<OUString> aLabels = GetNodeNames(sManufacturer); + const OUString* pLabels = aLabels.getConstArray(); + OUString sFoundNode; + for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++) + { + OUString sPrefix(sManufacturer); + sPrefix += C2U("/"); + sPrefix += pLabels[nLabel]; + sPrefix += C2U("/"); + Sequence<OUString> aProperties(1); + aProperties.getArray()[0] = sPrefix; + aProperties.getArray()[0] += C2U("Name"); + Sequence<Any> aValues = GetProperties(aProperties); + const Any* pValues = aValues.getConstArray(); + if(pValues[0].hasValue()) + { + OUString sTmp; + pValues[0] >>= sTmp; + if(rType == sTmp) + { + sFoundNode = pLabels[nLabel]; + break; + } + } + } + // if not found - generate a unique node name + if(!sFoundNode.getLength()) + { + sal_Int32 nIndex = aLabels.getLength(); + OUString sPrefix(C2U("Label")); + sFoundNode = sPrefix; + sFoundNode += OUString::valueOf(nIndex); + while(lcl_Exists(sFoundNode, aLabels)) + { + sFoundNode = sPrefix; + sFoundNode += OUString::valueOf(nIndex++); + } + } + OUString sPrefix(wrapConfigurationElementName(rManufacturer)); + sPrefix += C2U("/"); + sPrefix += sFoundNode; + sPrefix += C2U("/"); + Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix); + Sequence<PropertyValue> aPropValues = lcl_CreateProperties(aPropNames, rRec); + SetSetProperties(wrapConfigurationElementName(rManufacturer), aPropValues); + +} + + diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx new file mode 100644 index 000000000000..5c32abede88a --- /dev/null +++ b/sw/source/ui/envelp/labelexp.cxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labelexp.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <swtypes.hxx> +#include <labfmt.hxx> +#include <unotools.hxx> +#include <unoatxt.hxx> +#include <unoobj.hxx> +#include <unoprnms.hxx> + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::uno; +using namespace ::comphelper; +using ::rtl::OUString; + +#ifdef SW_PROP_NAME_STR +#undef SW_PROP_NAME_STR +#endif +#define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName + +/* -----------------08.07.99 15:15------------------- + + --------------------------------------------------*/ +void SwVisitingCardPage::InitFrameControl() +{ + Link aLink(LINK(this, SwVisitingCardPage, FrameControlInitializedHdl)); + pExampleFrame = new SwOneExampleFrame( aExampleWIN, + EX_SHOW_BUSINESS_CARDS, &aLink ); + + uno::Reference< lang::XMultiServiceFactory > xMgr = + getProcessServiceFactory(); + //now the AutoText ListBoxes have to be filled + + uno::Reference< uno::XInterface > xAText = + xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") ); + _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); + + uno::Sequence<OUString> aNames = _xAutoText->getElementNames(); + const OUString* pGroups = aNames.getConstArray(); + OUString uTitleName( C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE)) ); + + for(sal_uInt16 i = 0; i < aNames.getLength(); i++) + { + uno::Any aGroup = _xAutoText->getByName(pGroups[i]); + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; + uno::Reference< container::XIndexAccess > xIdxAcc(xGroup, uno::UNO_QUERY); + try + { + if(!xIdxAcc.is() || xIdxAcc->getCount()) + { + uno::Reference< beans::XPropertySet > xPrSet(xGroup, uno::UNO_QUERY); + uno::Any aTitle = xPrSet->getPropertyValue( uTitleName ); + OUString uTitle; + aTitle >>= uTitle; + String sGroup(pGroups[i]); + sal_uInt16 nEntry = aAutoTextGroupLB.InsertEntry(uTitle); + aAutoTextGroupLB.SetEntryData(nEntry, new String(sGroup)); + } + } + catch(Exception&) + { + } + } + if(aAutoTextGroupLB.GetEntryCount()) + { + if(LISTBOX_ENTRY_NOTFOUND == aAutoTextGroupLB.GetSelectEntryPos()) + aAutoTextGroupLB.SelectEntryPos(0); + String sCurGroupName( + *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos())); + if(_xAutoText->hasByName(sCurGroupName)) + { + uno::Any aGroup = _xAutoText->getByName(sCurGroupName); + try + { + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; + uno::Sequence< OUString > aBlockNames = xGroup->getElementNames(); + uno::Sequence< OUString > aTitles = xGroup->getTitles() ; + + SetUserData( aBlockNames.getLength(), aTitles.getConstArray(), + aBlockNames.getConstArray() ); + } + catch( uno::RuntimeException& ) + { + // we'll be her if path settings were wrong + } + } + } +} +/* -----------------01.10.99 13:19------------------- + + --------------------------------------------------*/ +IMPL_LINK( SwVisitingCardPage, FrameControlInitializedHdl, void*, EMPTYARG ) +{ + SvLBoxEntry* pSel = aAutoTextLB.FirstSelected(); + String sEntry; + if( pSel ) + sEntry = *(String*)pSel->GetUserData(); + uno::Reference< text::XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); + OUString uEntry(sEntry); + + if(LISTBOX_ENTRY_NOTFOUND != aAutoTextGroupLB.GetSelectEntryPos()) + { + String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( + aAutoTextGroupLB.GetSelectEntryPos() ) ); + uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; + + if( sEntry.Len() && xGroup->hasByName( uEntry ) ) + { + uno::Any aEntry(xGroup->getByName(uEntry)); + uno::Reference< text::XAutoTextEntry > xEntry; + aEntry >>= xEntry; + if(xEntry.is()) + { + uno::Reference< text::XTextRange > xRange(xCrsr, uno::UNO_QUERY); + xEntry->applyTo(xRange); + } + UpdateFields(); + } + } + return 0; +} +/* -----------------22.07.99 11:06------------------- + + --------------------------------------------------*/ +IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) +{ + if(_xAutoText.is()) + { + if( &aAutoTextGroupLB == pBox ) + { + String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( + aAutoTextGroupLB.GetSelectEntryPos())); + uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; + + ClearUserData(); + aAutoTextLB.Clear(); + + uno::Sequence<OUString> aBlockNames = xGroup->getElementNames(); + uno::Sequence< OUString > aTitles = xGroup->getTitles() ; + SetUserData( aBlockNames.getLength(), aTitles.getConstArray(), + aBlockNames.getConstArray() ); + } + if(pExampleFrame->IsInitialized()) + pExampleFrame->ClearDocument( TRUE ); + } + return 0; +} + +/* -----------------01.10.99 11:59------------------- + + --------------------------------------------------*/ +void SwVisitingCardPage::UpdateFields() +{ + uno::Reference< frame::XModel > xModel; + if( pExampleFrame && (xModel = pExampleFrame->GetModel()).is()) + { + SwLabDlg::UpdateFieldInformation(xModel, aLabItem); + } +} +/* -----------------01.10.99 15:16------------------- + + --------------------------------------------------*/ +void SwLabDlg::UpdateFieldInformation(uno::Reference< frame::XModel > & xModel, const SwLabItem& rItem) +{ + uno::Reference< text::XTextFieldsSupplier > xFlds(xModel, uno::UNO_QUERY); + uno::Reference< container::XNameAccess > xFldMasters = xFlds->getTextFieldMasters(); + + static const struct _SwLabItemMap { + const char* pName; + rtl::OUString SwLabItem:: *pValue; + } aArr[] = { + { "BC_PRIV_FIRSTNAME" , &SwLabItem::aPrivFirstName }, + { "BC_PRIV_NAME" , &SwLabItem::aPrivName }, + { "BC_PRIV_INITIALS" , &SwLabItem::aPrivShortCut }, + { "BC_PRIV_FIRSTNAME_2", &SwLabItem::aPrivFirstName2 }, + { "BC_PRIV_NAME_2" , &SwLabItem::aPrivName2 }, + { "BC_PRIV_INITIALS_2" , &SwLabItem::aPrivShortCut2 }, + { "BC_PRIV_STREET" , &SwLabItem::aPrivStreet }, + { "BC_PRIV_ZIP" , &SwLabItem::aPrivZip }, + { "BC_PRIV_CITY" , &SwLabItem::aPrivCity }, + { "BC_PRIV_COUNTRY" , &SwLabItem::aPrivCountry }, + { "BC_PRIV_STATE" , &SwLabItem::aPrivState }, + { "BC_PRIV_TITLE" , &SwLabItem::aPrivTitle }, + { "BC_PRIV_PROFESSION" , &SwLabItem::aPrivProfession }, + { "BC_PRIV_PHONE" , &SwLabItem::aPrivPhone }, + { "BC_PRIV_MOBILE" , &SwLabItem::aPrivMobile }, + { "BC_PRIV_FAX" , &SwLabItem::aPrivFax }, + { "BC_PRIV_WWW" , &SwLabItem::aPrivWWW }, + { "BC_PRIV_MAIL" , &SwLabItem::aPrivMail }, + { "BC_COMP_COMPANY" , &SwLabItem::aCompCompany }, + { "BC_COMP_COMPANYEXT" , &SwLabItem::aCompCompanyExt }, + { "BC_COMP_SLOGAN" , &SwLabItem::aCompSlogan }, + { "BC_COMP_STREET" , &SwLabItem::aCompStreet }, + { "BC_COMP_ZIP" , &SwLabItem::aCompZip }, + { "BC_COMP_CITY" , &SwLabItem::aCompCity }, + { "BC_COMP_COUNTRY" , &SwLabItem::aCompCountry }, + { "BC_COMP_STATE" , &SwLabItem::aCompState }, + { "BC_COMP_POSITION" , &SwLabItem::aCompPosition }, + { "BC_COMP_PHONE" , &SwLabItem::aCompPhone }, + { "BC_COMP_MOBILE" , &SwLabItem::aCompMobile }, + { "BC_COMP_FAX" , &SwLabItem::aCompFax }, + { "BC_COMP_WWW" , &SwLabItem::aCompWWW }, + { "BC_COMP_MAIL" , &SwLabItem::aCompMail }, + { 0, 0 } + }; + + try + { + String sFldName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( + "com.sun.star.text.FieldMaster.User." ))); + OUString uCntName( C2U( SW_PROP_NAME_STR(UNO_NAME_CONTENT ))); + for( const _SwLabItemMap* p = aArr; p->pName; ++p ) + { + String sCurFldName( sFldName ); + sCurFldName.AppendAscii( p->pName ); + OUString uFldName( sCurFldName ); + if( xFldMasters->hasByName( uFldName )) + { + uno::Any aFirstName = xFldMasters->getByName( uFldName ); + uno::Reference< beans::XPropertySet > xFld; + aFirstName >>= xFld; + uno::Any aContent; + aContent <<= rItem.*p->pValue; + xFld->setPropertyValue( uCntName, aContent ); + } + } + } + catch( uno::RuntimeException&) + { + // + } + + uno::Reference< container::XEnumerationAccess > xFldAcc = xFlds->getTextFields(); + uno::Reference< util::XRefreshable > xRefresh(xFldAcc, uno::UNO_QUERY); + xRefresh->refresh(); +} + diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx new file mode 100644 index 000000000000..575895a35b73 --- /dev/null +++ b/sw/source/ui/envelp/labfmt.cxx @@ -0,0 +1,715 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labfmt.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <tools/poly.hxx> +#include <viewopt.hxx> + +#include "swtypes.hxx" +#include "cmdid.h" +#include "label.hxx" +#include "labimp.hxx" +#include "labimg.hxx" +#include "labfmt.hxx" +#include "uitool.hxx" + +#include "label.hrc" +#include "labfmt.hrc" +#include <unomid.h> + +using namespace utl; +using namespace rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + +// #define ------------------------------------------------------------------ + +#define ROUND(x) ((USHORT) ((x) + .5)) + +// -------------------------------------------------------------------------- +SwLabPreview::SwLabPreview( const SwLabFmtPage* pParent, const ResId& rResID ) : + + Window((Window*) pParent, rResID), + + aGrayColor(COL_LIGHTGRAY), + + aHDistStr (SW_RES(STR_HDIST )), + aVDistStr (SW_RES(STR_VDIST )), + aWidthStr (SW_RES(STR_WIDTH )), + aHeightStr(SW_RES(STR_HEIGHT)), + aLeftStr (SW_RES(STR_LEFT )), + aUpperStr (SW_RES(STR_UPPER )), + aColsStr (SW_RES(STR_COLS )), + aRowsStr (SW_RES(STR_ROWS )) +{ + SetMapMode(MAP_PIXEL); + + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color& rWinColor = rStyleSettings.GetWindowColor(); + SetBackground(Wallpaper(rWinColor)); + + Font aFont = GetFont(); + aFont.SetTransparent(TRUE); + aFont.SetWeight (WEIGHT_NORMAL); + SetFont(aFont); + + const Size aSz(GetOutputSizePixel()); + + lOutWPix = aSz.Width (); + lOutHPix = aSz.Height(); + + + lHDistWidth = GetTextWidth(aHDistStr ); + lVDistWidth = GetTextWidth(aVDistStr ); + lHeightWidth = GetTextWidth(aHeightStr); + lLeftWidth = GetTextWidth(aLeftStr ); + lUpperWidth = GetTextWidth(aUpperStr ); + lColsWidth = GetTextWidth(aColsStr ); + + lXHeight = GetTextHeight(); + lXWidth = GetTextWidth('X'); + + // Skalierungsfaktor + float fx = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix; + + lOutWPix23 = (long)((float)lOutWPix * fx); + lOutHPix23 = (long)((float)lOutHPix * fx); +} + +// -------------------------------------------------------------------------- +SwLabPreview::~SwLabPreview() +{ +} +// -------------------------------------------------------------------------- +void SwLabPreview::Paint(const Rectangle &) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color& rWinColor = rStyleSettings.GetWindowColor(); + const Color& rFieldTextColor = SwViewOption::GetFontColor(); + + Font aFont = GetFont(); + aFont.SetFillColor( rWinColor ); + aFont.SetColor(rFieldTextColor); + SetFont(aFont); + + SetBackground(Wallpaper(rWinColor)); + + SetLineColor(rWinColor); + SetFillColor(aGrayColor); + Font aPaintFont(GetFont()); + aPaintFont.SetTransparent(FALSE); + SetFont(aPaintFont); + + // Groesse des darzustellenden Bereichs + long lDispW = ROUND(aItem.lLeft + aItem.lHDist); + long lDispH = ROUND(aItem.lUpper + aItem.lVDist); + if (aItem.nCols == 1) + lDispW += ROUND(aItem.lLeft ); + else + lDispW += ROUND(aItem.lHDist / 10); + if (aItem.nRows == 1) + lDispH += ROUND(aItem.lUpper); + else + lDispH += ROUND(aItem.lVDist / 10); + + // Skalierungsfaktor + float fx = (float) lOutWPix23 / Max(1L, lDispW), + fy = (float) lOutHPix23 / Max(1L, lDispH), + f = fx < fy ? fx : fy; + + // Nullpunkt + long lOutlineW = ROUND(f * lDispW); + long lOutlineH = ROUND(f * lDispH); + + long lX0 = (lOutWPix - lOutlineW) / 2; + long lY0 = (lOutHPix - lOutlineH) / 2; + long lX1 = ROUND(lX0 + f * aItem.lLeft ); + long lY1 = ROUND(lY0 + f * aItem.lUpper); + long lX2 = ROUND(lX0 + f * (aItem.lLeft + aItem.lWidth )); + long lY2 = ROUND(lY0 + f * (aItem.lUpper + aItem.lHeight)); + long lX3 = ROUND(lX0 + f * (aItem.lLeft + aItem.lHDist )); + long lY3 = ROUND(lY0 + f * (aItem.lUpper + aItem.lVDist )); + + // Umriss zeichnen (Flaeche) + DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH))); + + // Umriss zeichnen (Umrandung) + SetLineColor(rFieldTextColor); + DrawLine(Point(lX0, lY0), Point(lX0 + lOutlineW - 1, lY0)); // Oben + DrawLine(Point(lX0, lY0), Point(lX0, lY0 + lOutlineH - 1)); // Links + if (aItem.nCols == 1) + DrawLine(Point(lX0 + lOutlineW - 1, lY0), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Rechts + if (aItem.nRows == 1) + DrawLine(Point(lX0, lY0 + lOutlineH - 1), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Unten + + // Etiketten + SetClipRegion (Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH))); + SetFillColor(rWinColor); + for (USHORT nRow = 0; nRow < Min((USHORT) 2, (USHORT) aItem.nRows); nRow++) + for (USHORT nCol = 0; nCol < Min((USHORT) 2, (USHORT) aItem.nCols); nCol++) + DrawRect(Rectangle( + Point(ROUND(lX0 + f * (aItem.lLeft + nCol * aItem.lHDist)), + ROUND(lY0 + f * (aItem.lUpper + nRow * aItem.lVDist))), + Size (ROUND(f * aItem.lWidth ), + ROUND(f * aItem.lHeight)))); + SetClipRegion(); + + // Beschritung: Rand links + if (aItem.lLeft) + { + long lX = (lX0 + lX1) / 2; + DrawArrow(Point(lX0, lY0 - 5), Point(lX1, lY0 - 5), FALSE); + DrawArrow(Point(lX, lY0 - 10), Point(lX, lY0 - 5), TRUE); + DrawText(Point(lX1 - lLeftWidth, lY0 - 10 - lXHeight), aLeftStr); + } + + // Beschriftung: Rand oben + if (aItem.lUpper) + { + DrawArrow(Point(lX0 - 5, lY0), Point(lX0 - 5, lY1), FALSE); + DrawText(Point(lX0 - 10 - lUpperWidth, ROUND(lY0 + f * aItem.lUpper / 2 - lXHeight / 2)), aUpperStr); + } + + // Beschriftung: Breite und Hoehe + { + long lX = lX2 - lXWidth / 2 - lHeightWidth / 2; + long lY = lY1 + lXHeight; + + DrawLine(Point(lX1, lY), Point(lX2 - 1, lY)); + DrawLine(Point(lX, lY1), Point(lX, lY2 - 1)); + + DrawText(Point(lX1 + lXWidth / 2, lY - lXHeight / 2), aWidthStr); + DrawText(Point(lX - lHeightWidth / 2, lY2 - lXHeight - lXHeight / 2), aHeightStr); + } + + // Beschriftung: Horz. Abstand + if (aItem.nCols > 1) + { + long lX = (lX1 + lX3) / 2; + DrawArrow(Point(lX1, lY0 - 5), Point(lX3, lY0 - 5), FALSE); + DrawArrow(Point(lX, lY0 - 10), Point(lX, lY0 - 5), TRUE); + DrawText(Point(lX - lHDistWidth / 2, lY0 - 10 - lXHeight), aHDistStr); + } + + // Beschriftung: Vertikaler Abstand + if (aItem.nRows > 1) + { + DrawArrow(Point(lX0 - 5, lY1), Point(lX0 - 5, lY3), FALSE); + DrawText(Point(lX0 - 10 - lVDistWidth, ROUND(lY1 + f * aItem.lVDist / 2 - lXHeight / 2)), aVDistStr); + } + + // Beschriftung: Spalten + { + long lY = lY0 + lOutlineH + 4; + DrawArrow(Point(lX0, lY), Point(lX0 + lOutlineW - 1, lY), TRUE); + DrawText(Point((lX0 + lX0 + lOutlineW - 1) / 2 - lColsWidth / 2, lY + 5), aColsStr); + } + + // Beschriftung: Zeilen + { + long lX = lX0 + lOutlineW + 4; + DrawArrow(Point(lX, lY0), Point(lX, lY0 + lOutlineH - 1), TRUE); + DrawText(Point(lX + 5, (lY0 + lY0 + lOutlineH - 1 - lXHeight / 2) / 2), aRowsStr); + } +} + +// Pfeil bzw. Intervall zeichnen -------------------------------------------- + + + +void SwLabPreview::DrawArrow(const Point &rP1, const Point &rP2, BOOL bArrow) +{ + DrawLine(rP1, rP2); + + if (bArrow) + { + Point aArr[3]; + + // Pfeil zeichnen + if (rP1.Y() == rP2.Y()) + { + // Waagerecht + aArr[0].X() = rP2.X() - 5; + aArr[0].Y() = rP2.Y() - 2; + aArr[1].X() = rP2.X(); + aArr[1].Y() = rP2.Y(); + aArr[2].X() = rP2.X() - 5; + aArr[2].Y() = rP2.Y() + 2; + } + else + { + // Senkrecht + aArr[0].X() = rP2.X() - 2; + aArr[0].Y() = rP2.Y() - 5; + aArr[1].X() = rP2.X() + 2; + aArr[1].Y() = rP2.Y() - 5; + aArr[2].X() = rP2.X(); + aArr[2].Y() = rP2.Y(); + } + + const Color& rFieldTextColor = SwViewOption::GetFontColor(); + SetFillColor(rFieldTextColor); + DrawPolygon(Polygon(3, aArr)); + } + else + { + // Intervall zeichnen + if (rP1.Y() == rP2.Y()) + { + // Waagerecht + DrawLine(Point(rP1.X(), rP1.Y() - 2), Point(rP1.X(), rP1.Y() + 2)); + DrawLine(Point(rP2.X(), rP2.Y() - 2), Point(rP2.X(), rP2.Y() + 2)); + } + else + { + // Senkrecht + DrawLine(Point(rP1.X() - 2, rP1.Y()), Point(rP1.X() + 2, rP1.Y())); + DrawLine(Point(rP2.X() - 2, rP2.Y()), Point(rP2.X() + 2, rP2.Y())); + } + } +} + +// -------------------------------------------------------------------------- + +void SwLabPreview::Update(const SwLabItem& rItem) +{ + aItem = rItem; + Invalidate(); +} + +// -------------------------------------------------------------------------- + + + +SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) : + + SfxTabPage(pParent, SW_RES(TP_LAB_FMT), rSet), + aMakeFI (this, SW_RES(FI_MAKE)), + aTypeFI (this, SW_RES(FI_TYPE)), + aPreview (this, SW_RES(WIN_PREVIEW)), + aHDistText (this, SW_RES(TXT_HDIST )), + aHDistField (this, SW_RES(FLD_HDIST )), + aVDistText (this, SW_RES(TXT_VDIST )), + aVDistField (this, SW_RES(FLD_VDIST )), + aWidthText (this, SW_RES(TXT_WIDTH )), + aWidthField (this, SW_RES(FLD_WIDTH )), + aHeightText (this, SW_RES(TXT_HEIGHT )), + aHeightField (this, SW_RES(FLD_HEIGHT )), + aLeftText (this, SW_RES(TXT_LEFT )), + aLeftField (this, SW_RES(FLD_LEFT )), + aUpperText (this, SW_RES(TXT_UPPER )), + aUpperField (this, SW_RES(FLD_UPPER )), + aColsText (this, SW_RES(TXT_COLUMNS)), + aColsField (this, SW_RES(FLD_COLUMNS)), + aRowsText (this, SW_RES(TXT_ROWS )), + aRowsField (this, SW_RES(FLD_ROWS )), + aSavePB (this, SW_RES(PB_SAVE )), + bModified(FALSE), + aItem ((const SwLabItem&) rSet.Get(FN_LABEL)) +{ + FreeResource(); + SetExchangeSupport(); + + // Metriken + FieldUnit aMetric = ::GetDfltMetric(FALSE); + SetMetric(aHDistField , aMetric); + SetMetric(aVDistField , aMetric); + SetMetric(aWidthField , aMetric); + SetMetric(aHeightField, aMetric); + SetMetric(aLeftField , aMetric); + SetMetric(aUpperField , aMetric); + + // Handler installieren + Link aLk = LINK(this, SwLabFmtPage, ModifyHdl); + aHDistField .SetModifyHdl( aLk ); + aVDistField .SetModifyHdl( aLk ); + aWidthField .SetModifyHdl( aLk ); + aHeightField.SetModifyHdl( aLk ); + aLeftField .SetModifyHdl( aLk ); + aUpperField .SetModifyHdl( aLk ); + aColsField .SetModifyHdl( aLk ); + aRowsField .SetModifyHdl( aLk ); + + aLk = LINK(this, SwLabFmtPage, LoseFocusHdl); + aHDistField .SetLoseFocusHdl( aLk ); + aVDistField .SetLoseFocusHdl( aLk ); + aWidthField .SetLoseFocusHdl( aLk ); + aHeightField.SetLoseFocusHdl( aLk ); + aLeftField .SetLoseFocusHdl( aLk ); + aUpperField .SetLoseFocusHdl( aLk ); + aColsField .SetLoseFocusHdl( aLk ); + aRowsField .SetLoseFocusHdl( aLk ); + + aSavePB.SetClickHdl( LINK (this, SwLabFmtPage, SaveHdl)); + // Timer einstellen + aPreviewTimer.SetTimeout(1000); + aPreviewTimer.SetTimeoutHdl(LINK(this, SwLabFmtPage, PreviewHdl)); +} + +// -------------------------------------------------------------------------- + + + +SwLabFmtPage::~SwLabFmtPage() +{ +} + +// Modify-Handler der MetricFields. Preview-Timer starten ------------------- + + + +IMPL_LINK_INLINE_START( SwLabFmtPage, ModifyHdl, Edit *, EMPTYARG ) +{ + bModified = TRUE; + aPreviewTimer.Start(); + return 0; +} +IMPL_LINK_INLINE_END( SwLabFmtPage, ModifyHdl, Edit *, EMPTYARG ) + +// Preview invalidaten ------------------------------------------------------ + + + +IMPL_LINK_INLINE_START( SwLabFmtPage, PreviewHdl, Timer *, EMPTYARG ) +{ + aPreviewTimer.Stop(); + ChangeMinMax(); + FillItem( aItem ); + aPreview.Update( aItem ); + + return 0; +} +IMPL_LINK_INLINE_END( SwLabFmtPage, PreviewHdl, Timer *, EMPTYARG ) + +// LoseFocus-Handler: Bei Aenderung sofort updaten -------------------------- + + + +IMPL_LINK_INLINE_START( SwLabFmtPage, LoseFocusHdl, Control *, pControl ) +{ + if (((Edit*) pControl)->IsModified()) + PreviewHdl(0); + return 0; +} +IMPL_LINK_INLINE_END( SwLabFmtPage, LoseFocusHdl, Control *, pControl ) + +// Minima und Maxima fuer Fields festlegen ---------------------------------- + + +void SwLabFmtPage::ChangeMinMax() +{ + long lMax = 31748; // 56 cm + + // Min und Max + + long lLeft = static_cast< long >(GETFLDVAL(aLeftField )), + lUpper = static_cast< long >(GETFLDVAL(aUpperField)), + lHDist = static_cast< long >(GETFLDVAL(aHDistField)), + lVDist = static_cast< long >(GETFLDVAL(aVDistField)); + + long nMinSize = 10; // 0,1cm + + aHDistField .SetMin(nMinSize, FUNIT_CM); + aVDistField .SetMin(nMinSize, FUNIT_CM); + + aHDistField .SetMax((long) 100 * ((lMax - lLeft ) / Max(1L, (long) aColsField.GetValue())), FUNIT_TWIP); + aVDistField .SetMax((long) 100 * ((lMax - lUpper) / Max(1L, (long) aRowsField.GetValue())), FUNIT_TWIP); + + aWidthField .SetMin(nMinSize, FUNIT_CM); + aHeightField.SetMin(nMinSize, FUNIT_CM); + + aWidthField .SetMax((long) 100 * (lHDist), FUNIT_TWIP); + aHeightField.SetMax((long) 100 * (lVDist), FUNIT_TWIP); + + aLeftField .SetMax((long) 100 * (lMax - (long) aColsField.GetValue() * GETFLDVAL(aHDistField)), FUNIT_TWIP); + aUpperField .SetMax((long) 100 * (lMax - (long) aRowsField.GetValue() * GETFLDVAL(aVDistField)), FUNIT_TWIP); + + aColsField .SetMax((lMax - lLeft ) / Max(1L, lHDist)); + aRowsField .SetMax((lMax - lUpper) / Max(1L, lVDist)); + + // First und Last + + aHDistField .SetFirst(aHDistField .GetMin()); + aVDistField .SetFirst(aVDistField .GetMin()); + + aHDistField .SetLast (aHDistField .GetMax()); + aVDistField .SetLast (aVDistField .GetMax()); + + aWidthField .SetFirst(aWidthField .GetMin()); + aHeightField.SetFirst(aHeightField.GetMin()); + + aWidthField .SetLast (aWidthField .GetMax()); + aHeightField.SetLast (aHeightField.GetMax()); + + aLeftField .SetLast (aLeftField .GetMax()); + aUpperField .SetLast (aUpperField .GetMax()); + + aColsField .SetLast (aColsField .GetMax()); + aRowsField .SetLast (aRowsField .GetMax()); + + aHDistField .Reformat(); + aVDistField .Reformat(); + aWidthField .Reformat(); + aHeightField.Reformat(); + aLeftField .Reformat(); + aUpperField .Reformat(); + aColsField .Reformat(); + aRowsField .Reformat(); +} + +// -------------------------------------------------------------------------- + + + +SfxTabPage* SwLabFmtPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwLabFmtPage(pParent, rSet); +} + +// ---------------------------------------------------------------------------- + + + +void SwLabFmtPage::ActivatePage(const SfxItemSet& rSet) +{ + SfxItemSet aSet(rSet); + Reset(aSet); +} + +// ---------------------------------------------------------------------------- + + + +int SwLabFmtPage::DeactivatePage(SfxItemSet* _pSet) +{ + if (_pSet) + FillItemSet(*_pSet); + + return TRUE; +} + +// -------------------------------------------------------------------------- + + + +void SwLabFmtPage::FillItem(SwLabItem& rItem) +{ + if (bModified) + { + rItem.aMake = rItem.aType = SW_RESSTR(STR_CUSTOM); + + SwLabRec& rRec = *GetParent()->Recs()[0]; + rItem.lHDist = rRec.lHDist = static_cast< long >(GETFLDVAL(aHDistField )); + rItem.lVDist = rRec.lVDist = static_cast< long >(GETFLDVAL(aVDistField )); + rItem.lWidth = rRec.lWidth = static_cast< long >(GETFLDVAL(aWidthField )); + rItem.lHeight = rRec.lHeight = static_cast< long >(GETFLDVAL(aHeightField)); + rItem.lLeft = rRec.lLeft = static_cast< long >(GETFLDVAL(aLeftField )); + rItem.lUpper = rRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField )); + rItem.nCols = rRec.nCols = (USHORT) aColsField.GetValue(); + rItem.nRows = rRec.nRows = (USHORT) aRowsField.GetValue(); + } +} + +// -------------------------------------------------------------------------- + + + +BOOL SwLabFmtPage::FillItemSet(SfxItemSet& rSet) +{ + FillItem(aItem); + rSet.Put(aItem); + + return TRUE; +} + +// -------------------------------------------------------------------------- +void SwLabFmtPage::Reset(const SfxItemSet& ) +{ + // Fields initialisieren + GetParent()->GetLabItem(aItem); + + aHDistField .SetMax(100 * aItem.lHDist , FUNIT_TWIP); + aVDistField .SetMax(100 * aItem.lVDist , FUNIT_TWIP); + aWidthField .SetMax(100 * aItem.lWidth , FUNIT_TWIP); + aHeightField.SetMax(100 * aItem.lHeight, FUNIT_TWIP); + aLeftField .SetMax(100 * aItem.lLeft , FUNIT_TWIP); + aUpperField .SetMax(100 * aItem.lUpper , FUNIT_TWIP); + + SETFLDVAL(aHDistField , aItem.lHDist ); + SETFLDVAL(aVDistField , aItem.lVDist ); + SETFLDVAL(aWidthField , aItem.lWidth ); + SETFLDVAL(aHeightField, aItem.lHeight); + SETFLDVAL(aLeftField , aItem.lLeft ); + SETFLDVAL(aUpperField , aItem.lUpper ); + + aColsField.SetMax(aItem.nCols); + aRowsField.SetMax(aItem.nRows); + + aColsField .SetValue(aItem.nCols); + aRowsField .SetValue(aItem.nRows); + aMakeFI.SetText(aItem.aMake); + aTypeFI.SetText(aItem.aType); + PreviewHdl(0); +} +/* -----------------------------22.01.01 15:11-------------------------------- + + ---------------------------------------------------------------------------*/ + +IMPL_LINK( SwLabFmtPage, SaveHdl, PushButton *, EMPTYARG ) +{ + SwLabRec aRec; + aRec.lHDist = static_cast< long >(GETFLDVAL(aHDistField )); + aRec.lVDist = static_cast< long >(GETFLDVAL(aVDistField )); + aRec.lWidth = static_cast< long >(GETFLDVAL(aWidthField )); + aRec.lHeight = static_cast< long >(GETFLDVAL(aHeightField)); + aRec.lLeft = static_cast< long >(GETFLDVAL(aLeftField )); + aRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField )); + aRec.nCols = (USHORT) aColsField.GetValue(); + aRec.nRows = (USHORT) aRowsField.GetValue(); + aRec.bCont = aItem.bCont; + SwSaveLabelDlg* pSaveDlg = new SwSaveLabelDlg(this, aRec); + pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType); + pSaveDlg->Execute(); + if(pSaveDlg->GetLabel(aItem)) + { + bModified = FALSE; + const Sequence<OUString>& rMan = GetParent()->GetLabelsConfig().GetManufacturers(); + SvStringsDtor& rMakes = GetParent()->Makes(); + if(rMakes.Count() < (USHORT)rMan.getLength()) + { + rMakes.DeleteAndDestroy(0, rMakes.Count()); + const OUString* pMan = rMan.getConstArray(); + for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++) + { + rMakes.Insert( new String(pMan[nMan]), rMakes.Count() ); + } + } + aMakeFI.SetText(aItem.aMake); + aTypeFI.SetText(aItem.aType); + } + delete pSaveDlg; + return 0; +} +/* -----------------------------23.01.01 10:41-------------------------------- + + ---------------------------------------------------------------------------*/ +SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) : + ModalDialog(pParent, SW_RES(DLG_SAVE_LABEL)), + aOptionsFL(this,SW_RES(FL_OPTIONS )), + aMakeFT(this, SW_RES(FT_MAKE )), + aMakeCB(this, SW_RES(CB_MAKE )), + aTypeFT(this, SW_RES(FT_TYPE )), + aTypeED(this, SW_RES(ED_TYPE )), + + aOKPB(this, SW_RES(PB_OK )), + aCancelPB(this, SW_RES(PB_CANCEL )), + aHelpPB(this, SW_RES(PB_HELP )), + + aQueryMB(this, SW_RES(MB_QUERY )), + + bSuccess(sal_False), + pLabPage(pParent), + rLabRec(rRec) +{ + FreeResource(); + + aOKPB.SetClickHdl(LINK(this, SwSaveLabelDlg, OkHdl)); + Link aLk(LINK(this, SwSaveLabelDlg, ModifyHdl)); + aMakeCB.SetModifyHdl(aLk); + aTypeED.SetModifyHdl(aLk); + + SwLabelConfig& rCfg = pLabPage->GetParent()->GetLabelsConfig(); + const Sequence<OUString>& rMan = rCfg.GetManufacturers(); + const OUString* pMan = rMan.getConstArray(); + for(sal_Int32 i = 0; i < rMan.getLength(); i++) + aMakeCB.InsertEntry(pMan[i]); +} +/* -----------------------------23.01.01 10:40-------------------------------- + + ---------------------------------------------------------------------------*/ +IMPL_LINK(SwSaveLabelDlg, OkHdl, OKButton*, EMPTYARG) +{ + SwLabelConfig& rCfg = pLabPage->GetParent()->GetLabelsConfig(); + String sMake(aMakeCB.GetText()); + String sType(aTypeED.GetText()); + if(rCfg.HasLabel(sMake, sType)) + { + String sTmp(aQueryMB.GetMessText()); + String sQuery(sTmp); + sQuery.SearchAndReplace(C2S("%1"), sMake); + sQuery.SearchAndReplace(C2S("%2"), sType); + aQueryMB.SetMessText(sQuery); + + short eRet = aQueryMB.Execute(); + aQueryMB.SetMessText(sTmp); + if(RET_YES != eRet) + return 0; + } + rLabRec.aType = sType; + rCfg.SaveLabel(sMake, sType, rLabRec); + bSuccess = sal_True; + EndDialog(RET_OK); + return 0; +} +/* -----------------------------23.01.01 11:22-------------------------------- + + ---------------------------------------------------------------------------*/ +IMPL_LINK(SwSaveLabelDlg, ModifyHdl, Edit*, EMPTYARG) +{ + aOKPB.Enable(aMakeCB.GetText().Len() && aTypeED.GetText().Len()); + return 0; +} +/* -----------------------------23.01.01 16:06-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool SwSaveLabelDlg::GetLabel(SwLabItem& rItem) +{ + if(bSuccess) + { + rItem.aMake = aMakeCB.GetText(); + rItem.aType = aTypeED.GetText(); + rItem.lHDist = rLabRec.lHDist; + rItem.lVDist = rLabRec.lVDist; + rItem.lWidth = rLabRec.lWidth; + rItem.lHeight = rLabRec.lHeight; + rItem.lLeft = rLabRec.lLeft; + rItem.lUpper = rLabRec.lUpper; + rItem.nCols = rLabRec.nCols; + rItem.nRows = rLabRec.nRows; + } + return bSuccess; +} + diff --git a/sw/source/ui/envelp/labfmt.hrc b/sw/source/ui/envelp/labfmt.hrc new file mode 100644 index 000000000000..aa681e36ab24 --- /dev/null +++ b/sw/source/ui/envelp/labfmt.hrc @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labfmt.hrc,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _LABFMT_HRC +#define _LABFMT_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define WIN_PREVIEW 1 +#define TXT_HDIST 2 +#define FLD_HDIST 3 +#define TXT_VDIST 4 +#define FLD_VDIST 5 +#define TXT_WIDTH 6 +#define FLD_WIDTH 7 +#define TXT_HEIGHT 8 +#define FLD_HEIGHT 9 +#define TXT_LEFT 10 +#define FLD_LEFT 11 +#define TXT_UPPER 12 +#define FLD_UPPER 13 +#define TXT_COLUMNS 14 +#define FLD_COLUMNS 15 +#define TXT_ROWS 16 +#define FLD_ROWS 17 +#define FL_NONAME 18 +#define PB_SAVE 19 +#define FI_MAKE 20 +#define FI_TYPE 21 + +#define FL_OPTIONS 1 +#define FT_MAKE 2 +#define CB_MAKE 3 +#define FT_TYPE 4 +#define ED_TYPE 5 +#define PB_OK 6 +#define PB_CANCEL 7 +#define PB_HELP 8 +#define MB_QUERY 9 + +// Globale Resourcen ******************************************************** + +#define STR_HDIST (RC_LABFMT_BEGIN + 1) +#define STR_VDIST (RC_LABFMT_BEGIN + 2) +#define STR_WIDTH (RC_LABFMT_BEGIN + 3) +#define STR_HEIGHT (RC_LABFMT_BEGIN + 4) +#define STR_LEFT (RC_LABFMT_BEGIN + 5) +#define STR_UPPER (RC_LABFMT_BEGIN + 6) +#define STR_COLS (RC_LABFMT_BEGIN + 7) +#define STR_ROWS (RC_LABFMT_BEGIN + 8) + +// Ueberlaufpruefung ******************************************************** + +#define LABFMT_ACT_END STR_ROWS + +#if LABFMT_ACT_END > RC_LABFMT_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx new file mode 100644 index 000000000000..98a7599c2c63 --- /dev/null +++ b/sw/source/ui/envelp/labfmt.hxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labfmt.hxx,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LABFMT_HXX +#define _LABFMT_HXX + +#include "swuilabimp.hxx" +#include "labimg.hxx" +#include <vcl/msgbox.hxx> +class SwLabFmtPage; + +// class SwLabPreview ------------------------------------------------------- + +class SwLabPreview : public Window +{ + long lOutWPix; + long lOutHPix; + long lOutWPix23; + long lOutHPix23; + + Color aGrayColor; + + String aHDistStr; + String aVDistStr; + String aWidthStr; + String aHeightStr; + String aLeftStr; + String aUpperStr; + String aColsStr; + String aRowsStr; + + long lHDistWidth; + long lVDistWidth; + long lHeightWidth; + long lLeftWidth; + long lUpperWidth; + long lColsWidth; + + long lXWidth; + long lXHeight; + + SwLabItem aItem; + + void Paint(const Rectangle&); + + void DrawArrow(const Point& rP1, const Point& rP2, BOOL bArrow); + + using Window::GetParent; + SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();} + + using Window::Update; + +public: + + SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID); + ~SwLabPreview(); + + void Update(const SwLabItem& rItem); +}; + +// class SwLabFmtPage ------------------------------------------------------- + +class SwLabFmtPage : public SfxTabPage +{ + FixedInfo aMakeFI; + FixedInfo aTypeFI; + SwLabPreview aPreview; + FixedText aHDistText; + MetricField aHDistField; + FixedText aVDistText; + MetricField aVDistField; + FixedText aWidthText; + MetricField aWidthField; + FixedText aHeightText; + MetricField aHeightField; + FixedText aLeftText; + MetricField aLeftField; + FixedText aUpperText; + MetricField aUpperField; + FixedText aColsText; + NumericField aColsField; + FixedText aRowsText; + NumericField aRowsField; + PushButton aSavePB; + + Timer aPreviewTimer; + BOOL bModified; + + SwLabItem aItem; + + SwLabFmtPage(Window* pParent, const SfxItemSet& rSet); + ~SwLabFmtPage(); + + DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( PreviewHdl, Timer * ); + DECL_LINK( LoseFocusHdl, Control * ); + DECL_LINK( SaveHdl, PushButton* ); + + void ChangeMinMax(); + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + using Window::GetParent; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + void FillItem(SwLabItem& rItem); + virtual BOOL FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); + + SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();} +}; +/* -----------------------------23.01.01 10:26-------------------------------- + + ---------------------------------------------------------------------------*/ +class SwSaveLabelDlg : public ModalDialog +{ + FixedLine aOptionsFL; + FixedText aMakeFT; + ComboBox aMakeCB; + FixedText aTypeFT; + Edit aTypeED; + + OKButton aOKPB; + CancelButton aCancelPB; + HelpButton aHelpPB; + + QueryBox aQueryMB; + + sal_Bool bSuccess; + SwLabFmtPage* pLabPage; + SwLabRec& rLabRec; + + DECL_LINK(OkHdl, OKButton*); + DECL_LINK(ModifyHdl, Edit*); + +public: + SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec); + + void SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType) + { + aMakeCB.SetText(String(rMake)); + aTypeED.SetText(String(rType)); + } + sal_Bool GetLabel(SwLabItem& rItem); +}; +#endif + diff --git a/sw/source/ui/envelp/labfmt.src b/sw/source/ui/envelp/labfmt.src new file mode 100644 index 000000000000..ed338672ccc3 --- /dev/null +++ b/sw/source/ui/envelp/labfmt.src @@ -0,0 +1,362 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labfmt.src,v $ + * $Revision: 1.29 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "labfmt.hrc" +#include "helpid.h" + // TP_LAB_FMT --------------------------------------------------------------- +TabPage TP_LAB_FMT +{ + HelpID = HID_LAB_FMT ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedText FI_MAKE + { + Pos = MAP_APPFONT ( 108 , 6 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + }; + FixedText FI_TYPE + { + Pos = MAP_APPFONT ( 162 , 6 ) ; + Size = MAP_APPFONT ( 92 , 8 ) ; + }; + Window WIN_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 108 , 17 ) ; + Size = MAP_APPFONT ( 146 , 161 ) ; + }; + FixedText TXT_HDIST + { + Pos = MAP_APPFONT ( 6 , 19 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Hori~zontal pitch" ; + Group = TRUE ; + Left = TRUE ; + }; + MetricField FLD_HDIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 17 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + SpinSize = 10 ; + }; + FixedText TXT_VDIST + { + Pos = MAP_APPFONT ( 6 , 35 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Vertical pitch" ; + Left = TRUE ; + }; + MetricField FLD_VDIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 33 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + SpinSize = 10 ; + }; + FixedText TXT_WIDTH + { + Pos = MAP_APPFONT ( 6 , 51 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Width" ; + Left = TRUE ; + }; + MetricField FLD_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 49 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + SpinSize = 10 ; + }; + FixedText TXT_HEIGHT + { + Pos = MAP_APPFONT ( 6 , 67 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Height" ; + Left = TRUE ; + }; + MetricField FLD_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 65 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + SpinSize = 10 ; + }; + FixedText TXT_LEFT + { + Pos = MAP_APPFONT ( 6 , 83 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Left margin" ; + Left = TRUE ; + }; + MetricField FLD_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 81 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + Minimum = 0 ; + First = 0 ; + SpinSize = 10 ; + }; + FixedText TXT_UPPER + { + Pos = MAP_APPFONT ( 6 , 99 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Top margin" ; + Left = TRUE ; + }; + MetricField FLD_UPPER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 97 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Repeat = TRUE ; + Minimum = 0 ; + First = 0 ; + SpinSize = 10 ; + }; + FixedText TXT_COLUMNS + { + Pos = MAP_APPFONT ( 6 , 115 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Columns" ; + Left = TRUE ; + }; + NumericField FLD_COLUMNS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 113 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + }; + FixedText TXT_ROWS + { + Pos = MAP_APPFONT ( 6 , 131 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "R~ows" ; + Left = TRUE ; + }; + NumericField FLD_ROWS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 129 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + }; + PushButton PB_SAVE + { + Pos = MAP_APPFONT ( 50 , 148 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Save..."; + }; +}; + // String ******************************************************************* +String STR_HDIST +{ + Text [ en-US ] = "H. Pitch" ; +}; +String STR_VDIST +{ + Text [ en-US ] = "V. Pitch" ; +}; +String STR_WIDTH +{ + Text [ en-US ] = "Width" ; +}; +String STR_HEIGHT +{ + Text [ en-US ] = "Height" ; +}; +String STR_LEFT +{ + Text [ en-US ] = "Left margin" ; +}; +String STR_UPPER +{ + Text [ en-US ] = "Top margin" ; +}; +String STR_COLS +{ + Text [ en-US ] = "Columns" ; +}; +String STR_ROWS +{ + Text [ en-US ] = "Rows" ; +}; +ModalDialog DLG_SAVE_LABEL +{ + HelpID = HID_SAVE_LABEL_DLG ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 230 , 60 ) ; + Moveable = TRUE ; + FixedText FT_MAKE + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + Text [ en-US ] = "Brand" ; + Left = TRUE ; + }; + ComboBox CB_MAKE + { + Pos = MAP_APPFONT ( 65 , 15 ) ; + Size = MAP_APPFONT ( 100 , 50 ) ; + Border = TRUE; + DropDown = TRUE; + }; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 12 , 31 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + Text [ en-US ] = "T~ype" ; + Left = TRUE ; + }; + Edit ED_TYPE + { + Pos = MAP_APPFONT ( 65 , 30 ) ; + Size = MAP_APPFONT ( 100 , 12 ) ; + Border = TRUE; + }; + FixedLine FL_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 165 , 8 ) ; + Text [ en-US ] = "Options"; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 174 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 174 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 174 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + }; + QueryBox MB_QUERY + { + Buttons = WB_YES_NO ; + DefButton = WB_DEF_CANCEL ; + Message [ en-US ] = "The label \"%1 / %2\" already exists.\nDo you want to overwrite it?"; + }; + Text [ en-US ] = "Save Label Format"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/labimg.cxx b/sw/source/ui/envelp/labimg.cxx new file mode 100644 index 000000000000..6406861f114b --- /dev/null +++ b/sw/source/ui/envelp/labimg.cxx @@ -0,0 +1,483 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labimg.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <tools/stream.hxx> +#ifndef _RESID_HXX //autogen +#include <tools/resid.hxx> +#endif +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <svtools/useroptions.hxx> +#include <tools/shl.hxx> +#include <swmodule.hxx> +#include "labimg.hxx" +#include "cmdid.h" +#include "swtypes.hxx" +#include <unomid.h> + +using namespace utl; +using namespace rtl; +using namespace ::com::sun::star::uno; + + +// ---------------------------------------------------------------------------- +SwLabItem::SwLabItem() : + + SfxPoolItem(FN_LABEL), + lLeft (0), + lUpper(0), + nCols (1), + nRows (1), + nCol (1), + nRow (1) +{ + bAddr = bCont = bSynchron = FALSE; + bPage = TRUE; + lHDist = + lVDist = + lWidth = + lHeight = 5669; // 10 cm +} + +// ---------------------------------------------------------------------------- +SwLabItem::SwLabItem(const SwLabItem& rItem) : + SfxPoolItem(FN_LABEL) +{ + *this = rItem; +} +// ---------------------------------------------------------------------------- +SwLabItem& SwLabItem::operator =(const SwLabItem& rItem) +{ + bAddr = rItem.bAddr; + aWriting = rItem.aWriting; + bCont = rItem.bCont; + sDBName = rItem.sDBName; + aLstMake = rItem.aLstMake; + aLstType = rItem.aLstType; + aMake = rItem.aMake; + aType = rItem.aType; + bPage = rItem.bPage; + bSynchron = rItem.bSynchron; + aBin = rItem.aBin; + nCol = rItem.nCol; + nRow = rItem.nRow; + lHDist = rItem.lHDist; + lVDist = rItem.lVDist; + lWidth = rItem.lWidth; + lHeight = rItem.lHeight; + lLeft = rItem.lLeft; + lUpper = rItem.lUpper; + nCols = rItem.nCols; + nRows = rItem.nRows; + aPrivFirstName = rItem.aPrivFirstName; + aPrivName = rItem.aPrivName; + aPrivShortCut = rItem.aPrivShortCut; + aPrivFirstName2 = rItem.aPrivFirstName2; + aPrivName2 = rItem.aPrivName2; + aPrivShortCut2 = rItem.aPrivShortCut2; + aPrivStreet = rItem.aPrivStreet; + aPrivZip = rItem.aPrivZip; + aPrivCity = rItem.aPrivCity; + aPrivCountry = rItem.aPrivCountry; + aPrivState = rItem.aPrivState; + aPrivTitle = rItem.aPrivTitle; + aPrivProfession = rItem.aPrivProfession; + aPrivPhone = rItem.aPrivPhone; + aPrivMobile = rItem.aPrivMobile; + aPrivFax = rItem.aPrivFax; + aPrivWWW = rItem.aPrivWWW; + aPrivMail = rItem.aPrivMail; + aCompCompany = rItem.aCompCompany; + aCompCompanyExt = rItem.aCompCompanyExt; + aCompSlogan = rItem.aCompSlogan; + aCompStreet = rItem.aCompStreet; + aCompZip = rItem.aCompZip; + aCompCity = rItem.aCompCity; + aCompCountry = rItem.aCompCountry; + aCompState = rItem.aCompState; + aCompPosition = rItem.aCompPosition; + aCompPhone = rItem.aCompPhone; + aCompMobile = rItem.aCompMobile; + aCompFax = rItem.aCompFax; + aCompWWW = rItem.aCompWWW; + aCompMail = rItem.aCompMail; + sGlossaryGroup = rItem.sGlossaryGroup; + sGlossaryBlockName = rItem.sGlossaryBlockName; + return *this; +} + +// -------------------------------------------------------------------------- + + + +int SwLabItem::operator ==(const SfxPoolItem& rItem) const +{ + const SwLabItem& rLab = (const SwLabItem&) rItem; + + return bAddr == rLab.bAddr && + bCont == rLab.bCont && + bPage == rLab.bPage && + bSynchron == rLab.bSynchron && + aBin == rLab.aBin && + nCol == rLab.nCol && + nRow == rLab.nRow && + lHDist == rLab.lHDist && + lVDist == rLab.lVDist && + lWidth == rLab.lWidth && + lHeight == rLab.lHeight && + lLeft == rLab.lLeft && + lUpper == rLab.lUpper && + nCols == rLab.nCols && + nRows == rLab.nRows && + aWriting == rLab.aWriting&& + aMake == rLab.aMake && + aType == rLab.aType && + aLstMake == rLab.aLstMake&& + aLstType == rLab.aLstType&& + sDBName == rLab.sDBName && + aPrivFirstName == rLab.aPrivFirstName&& + aPrivName == rLab.aPrivName&& + aPrivShortCut == rLab.aPrivShortCut&& + aPrivFirstName2 == rLab.aPrivFirstName2&& + aPrivName2 == rLab.aPrivName2&& + aPrivShortCut2 == rLab.aPrivShortCut2&& + aPrivStreet == rLab.aPrivStreet&& + aPrivZip == rLab.aPrivZip&& + aPrivCity == rLab.aPrivCity&& + aPrivCountry == rLab.aPrivCountry&& + aPrivState == rLab.aPrivState&& + aPrivTitle == rLab.aPrivTitle&& + aPrivProfession == rLab.aPrivProfession&& + aPrivPhone == rLab.aPrivPhone&& + aPrivMobile == rLab.aPrivMobile&& + aPrivFax == rLab.aPrivFax&& + aPrivWWW == rLab.aPrivWWW&& + aPrivMail == rLab.aPrivMail&& + aCompCompany == rLab.aCompCompany&& + aCompCompanyExt == rLab.aCompCompanyExt&& + aCompSlogan == rLab.aCompSlogan&& + aCompStreet == rLab.aCompStreet&& + aCompZip == rLab.aCompZip&& + aCompCity == rLab.aCompCity&& + aCompCountry == rLab.aCompCountry&& + aCompState == rLab.aCompState&& + aCompPosition == rLab.aCompPosition&& + aCompPhone == rLab.aCompPhone&& + aCompMobile == rLab.aCompMobile&& + aCompFax == rLab.aCompFax&& + aCompWWW == rLab.aCompWWW&& + aCompMail == rLab.aCompMail && + sGlossaryGroup == rLab.sGlossaryGroup && + sGlossaryBlockName == rLab.sGlossaryBlockName; +} + +// -------------------------------------------------------------------------- +SfxPoolItem* SwLabItem::Clone(SfxItemPool*) const +{ + return new SwLabItem(*this); +} + +/* -----------------------------25.09.00 16:25-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<rtl::OUString> SwLabCfgItem::GetPropertyNames() +{ + static const char* aLabelPropNames[] = + { + "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[] = + { + "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; +} +/* ---------------------------------------------------------------------------- + + ---------------------------------------------------------------------------*/ +SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) : + ConfigItem(bLabel ? C2U("Office.Writer/Label") : C2U("Office.Writer/BusinessCard")), + bIsLabel(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"); + sal_Bool bNoConfigValues = sal_True; + if(aValues.getLength() == aNames.getLength()) + { + for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++) + { + + if(pValues[nProp].hasValue()) + { + //to have a contiuous switch an offset is added + if(nProp == 15 && !bIsLabel) + nProperty += 3; + if(nProperty >= 18) + bNoConfigValues = sal_False; + 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" + } + } + } + } + if(!bIsLabel && bNoConfigValues) + { + + SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); + aItem.aPrivFirstName = rUserOpt.GetFirstName(); + aItem.aPrivName = rUserOpt.GetLastName(); + aItem.aPrivShortCut = rUserOpt.GetID(); + aItem.aCompCompany = rUserOpt.GetCompany(); + aItem.aCompStreet = aItem.aPrivStreet = rUserOpt.GetStreet(); + + aItem.aCompCountry = aItem.aPrivCountry = rUserOpt.GetCountry(); + aItem.aCompZip = aItem.aPrivZip= rUserOpt.GetZip(); + aItem.aCompCity = aItem.aPrivCity = rUserOpt.GetCity(); + aItem.aPrivTitle = rUserOpt.GetTitle(); + aItem.aCompPosition = rUserOpt.GetPosition(); + aItem.aPrivPhone = rUserOpt.GetTelephoneHome(); + aItem.aCompPhone = rUserOpt.GetTelephoneWork(); + aItem.aCompFax = aItem.aPrivFax = rUserOpt.GetFax(); + aItem.aCompMail = aItem.aPrivMail = rUserOpt.GetEmail(); + aItem.aCompState = aItem.aPrivState = rUserOpt.GetState(); + aItem.bSynchron = TRUE; + SetModified(); + } +} +/* -----------------------------25.09.00 16:26-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwLabCfgItem::Commit() +{ + Sequence<OUString> aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++) + { + //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] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHDist));break;// "Format/HorizontalDistance", + case 6: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lVDist));break;// "Format/VerticalDistance", + case 7: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lWidth)); break;// "Format/Width", + case 8: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHeight)); break;// "Format/Height", + case 9: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lLeft)); break;// "Format/LeftMargin", + case 10: pValues[nProp] <<= static_cast<sal_Int32>(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" + } + } + PutProperties(aNames, aValues); +} + diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx new file mode 100644 index 000000000000..794e374005c2 --- /dev/null +++ b/sw/source/ui/envelp/labimp.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labimp.hxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LABIMP_HXX +#define _LABIMP_HXX + + +#include <sfx2/tabdlg.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/fixed.hxx> +#include <svtools/svmedit.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XWordCursor.hpp> +#include <com/sun/star/text/XParagraphCursor.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/text/XSentenceCursor.hpp> +#include <com/sun/star/awt/XFileDialog.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XProgressMonitor.hpp> +#include <com/sun/star/awt/TextAlign.hpp> +#include <com/sun/star/awt/XScrollBar.hpp> +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#include <com/sun/star/awt/XTabControllerModel.hpp> +#include <com/sun/star/awt/XMessageBox.hpp> +#include <com/sun/star/awt/XTextEditField.hpp> +#include <com/sun/star/awt/Style.hpp> +#include <com/sun/star/awt/XTimeField.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XSpinField.hpp> +#include <com/sun/star/awt/XUnoControlContainer.hpp> +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#include <com/sun/star/awt/XNumericField.hpp> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/awt/XTextArea.hpp> +#include <com/sun/star/awt/XImageButton.hpp> +#include <com/sun/star/awt/XFixedText.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/awt/ScrollBarOrientation.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> +#include <com/sun/star/awt/XCurrencyField.hpp> +#include <com/sun/star/awt/XPatternField.hpp> +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#include <com/sun/star/awt/XTabController.hpp> +#include <com/sun/star/awt/XVclContainer.hpp> +#include <com/sun/star/awt/XDateField.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/MessageBoxCommand.hpp> +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#include <com/sun/star/awt/XProgressBar.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <svtools/svtreebx.hxx> +#include <label.hxx> +#include <labimg.hxx> + +#define GETFLDVAL(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP)) +#define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP) + +class SwNewDBMgr; + +class SwLabRec +{ +public: + SwLabRec() {} + + void SetFromItem( const SwLabItem& rItem ); + void FillItem( SwLabItem& rItem ) const; + + 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; +}; + +/* -------------------------------------------------- + + --------------------------------------------------*/ +SV_DECL_PTRARR_DEL( SwLabRecs, SwLabRec*, 110, 10 ) + +#endif + diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx new file mode 100644 index 000000000000..de5197af2622 --- /dev/null +++ b/sw/source/ui/envelp/labprt.cxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labprt.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <svtools/prnsetup.hxx> +#include <svtools/cmdoptions.hxx> +#include <vcl/print.hxx> +#include <wrtsh.hxx> +#include <label.hxx> +#include <labprt.hxx> +#include <labimg.hxx> +#ifndef _LABIMP_HXX +#include "swuilabimp.hxx" +#endif + +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _LABPRT_HRC +#include <labprt.hrc> +#endif + + +// -------------------------------------------------------------------------- + + + +SwLabPrtPage::SwLabPrtPage(Window* pParent, const SfxItemSet& rSet) : + + SfxTabPage(pParent, SW_RES(TP_LAB_PRT), rSet), + + pPrinter( 0 ), + aPageButton (this, SW_RES(BTN_PAGE )), + aSingleButton (this, SW_RES(BTN_SINGLE )), + aColText (this, SW_RES(TXT_COL )), + aColField (this, SW_RES(FLD_COL )), + aRowText (this, SW_RES(TXT_ROW )), + aRowField (this, SW_RES(FLD_ROW )), + aSynchronCB (this, SW_RES(CB_SYNCHRON)), + aFLDontKnow (this, SW_RES(FL_DONTKNOW)), + aPrinterInfo (this, SW_RES(INF_PRINTER)), + aPrtSetup (this, SW_RES(BTN_PRTSETUP)), + aFLPrinter (this, SW_RES(FL_PRINTER )) + +{ + FreeResource(); + SetExchangeSupport(); + + // Handler installieren + Link aLk = LINK(this, SwLabPrtPage, CountHdl); + aPageButton .SetClickHdl( aLk ); + aSingleButton.SetClickHdl( aLk ); + + aPrtSetup.SetClickHdl( aLk ); + + SvtCommandOptions aCmdOpts; + if ( aCmdOpts.Lookup( + SvtCommandOptions::CMDOPTION_DISABLED, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Print" ) ) ) ) + { + aPrinterInfo.Hide(); + aPrtSetup.Hide(); + aFLPrinter.Hide(); + } +} + +// -------------------------------------------------------------------------- + + + +SwLabPrtPage::~SwLabPrtPage() +{ + if (pPrinter) + delete pPrinter; +} + +// -------------------------------------------------------------------------- + + + +IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) +{ + if (pButton == &aPrtSetup) + { + // Druck-Setup aufrufen + if (!pPrinter) + pPrinter = new Printer; + + PrinterSetupDialog* pDlg = new PrinterSetupDialog(this ); + pDlg->SetPrinter(pPrinter); + pDlg->Execute(); + delete pDlg; + GrabFocus(); + aPrinterInfo.SetText(pPrinter->GetName()); + return 0; + } + const BOOL bEnable = pButton == &aSingleButton; + aColText .Enable(bEnable); + aColField.Enable(bEnable); + aRowText .Enable(bEnable); + aRowField.Enable(bEnable); + aSynchronCB.Enable(!bEnable); + + if ( bEnable ) + aColField.GrabFocus(); +#ifndef PRODUCT + else + ASSERT( pButton == &aPageButton, "NewButton?" ); +#endif + return 0; +} + +// -------------------------------------------------------------------------- + + + +SfxTabPage* SwLabPrtPage::Create(Window* pParent, const SfxItemSet& rSet) +{ + return new SwLabPrtPage( pParent, rSet ); +} + +// -------------------------------------------------------------------------- + + + +void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet ) +{ + Reset(rSet); +} + +// -------------------------------------------------------------------------- + + + +int SwLabPrtPage::DeactivatePage(SfxItemSet* _pSet) +{ + if ( _pSet ) + FillItemSet(*_pSet); + + return TRUE; +} + +// -------------------------------------------------------------------------- + + + +void SwLabPrtPage::FillItem(SwLabItem& rItem) +{ + rItem.bPage = aPageButton.IsChecked(); + rItem.nCol = (USHORT) aColField.GetValue(); + rItem.nRow = (USHORT) aRowField.GetValue(); + rItem.bSynchron = aSynchronCB.IsChecked() && aSynchronCB.IsEnabled(); +} + +// -------------------------------------------------------------------------- + + + +BOOL SwLabPrtPage::FillItemSet(SfxItemSet& rSet) +{ + SwLabItem aItem; + GetParent()->GetLabItem(aItem); + FillItem(aItem); + rSet.Put(aItem); + + return TRUE; +} + +// -------------------------------------------------------------------------- + + + +void SwLabPrtPage::Reset(const SfxItemSet& ) +{ + SwLabItem aItem; + GetParent()->GetLabItem(aItem); + + aColField.SetValue (aItem.nCol); + aRowField.SetValue (aItem.nRow); + + if (aItem.bPage) + { + aPageButton.Check(); + aPageButton.GetClickHdl().Call(&aPageButton); + } + else + { + aSingleButton.GetClickHdl().Call(&aSingleButton); + aSingleButton.Check(); + } + + if (pPrinter) + { + // Drucker anzeigen + aPrinterInfo.SetText(pPrinter->GetName()); + } + else + aPrinterInfo.SetText(Printer::GetDefaultPrinterName()); + + aColField.SetMax(aItem.nCols); + aRowField.SetMax(aItem.nRows); + + aColField.SetLast(aColField.GetMax()); + aRowField.SetLast(aRowField.GetMax()); + + aSynchronCB.Check(aItem.bSynchron); +} + + + + diff --git a/sw/source/ui/envelp/labprt.hrc b/sw/source/ui/envelp/labprt.hrc new file mode 100644 index 000000000000..8662571b94d9 --- /dev/null +++ b/sw/source/ui/envelp/labprt.hrc @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labprt.hrc,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _LABPRT_HRC +#define _LABPRT_HRC + +// #include ***************************************************************** + +#include "envelp.hrc" + +// Lokale Resourcen ********************************************************* + +#define BTN_PAGE 1 +#define BTN_SINGLE 2 +#define INF_PRINTER 3 +#define TXT_COL 4 +#define FLD_COL 5 +#define TXT_ROW 6 +#define FLD_ROW 7 +#define BTN_PRTSETUP 8 +#define FL_PRINTER 9 +#define FL_DONTKNOW 10 +#define CB_SYNCHRON 11 + +// Ueberlaufpruefung ******************************************************** + +#define LABPRT_ACT_END 0 + +#if LABPRT_ACT_END > RC_LABPRT_END +#error Resource-Ueberlauf in #file, #line +#endif + +#endif + + diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx new file mode 100644 index 000000000000..df85772c453a --- /dev/null +++ b/sw/source/ui/envelp/labprt.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labprt.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LABPRT_HXX +#define _LABPRT_HXX + +#include <vcl/group.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> +#ifndef _SV_BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#include <sfx2/tabdlg.hxx> + + +class SwLabDlg; +class SwLabItem; + +// class SwLabPrtPage ------------------------------------------------------- + +class SwLabPrtPage : public SfxTabPage +{ + Printer* pPrinter; //Fuer die Schachteinstellug - leider. + + RadioButton aPageButton; + RadioButton aSingleButton; + FixedText aColText; + NumericField aColField; + FixedText aRowText; + NumericField aRowField; + CheckBox aSynchronCB; + FixedLine aFLDontKnow; + + FixedInfo aPrinterInfo; + PushButton aPrtSetup; + FixedLine aFLPrinter; + + SwLabPrtPage(Window* pParent, const SfxItemSet& rSet); + ~SwLabPrtPage(); + + DECL_LINK( CountHdl, Button * ); + + using Window::GetParent; + SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();} + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + void FillItem(SwLabItem& rItem); + virtual BOOL FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); + inline Printer* GetPrt() { return (pPrinter); } +}; + +#endif + + diff --git a/sw/source/ui/envelp/labprt.src b/sw/source/ui/envelp/labprt.src new file mode 100644 index 000000000000..2c922fb0921a --- /dev/null +++ b/sw/source/ui/envelp/labprt.src @@ -0,0 +1,154 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labprt.src,v $ + * $Revision: 1.35 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "labprt.hrc" +#include "helpid.h" + // TP_LAB_PRT --------------------------------------------------------------- +TabPage TP_LAB_PRT +{ + HelpID = HID_LAB_PRT ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + RadioButton BTN_PAGE + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "~Entire page" ; + }; + RadioButton BTN_SINGLE + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Single label" ; + }; + FixedText TXT_COL + { + Pos = MAP_APPFONT ( 127 , 29 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "Colu~mn" ; + Left = TRUE ; + }; + NumericField FLD_COL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 160 , 27 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + }; + FixedText TXT_ROW + { + Pos = MAP_APPFONT ( 191 , 29 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "Ro~w" ; + Left = TRUE ; + }; + NumericField FLD_ROW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 224 , 27 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + }; + CheckBox CB_SYNCHRON + { + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 120 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Synchroni~ze contents" ; + }; + FixedLine FL_DONTKNOW + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Distribute"; + }; + FixedText INF_PRINTER + { + Pos = MAP_APPFONT ( 12 , 73 ) ; + Size = MAP_APPFONT ( 182 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Printer Name" ; + }; + PushButton BTN_PRTSETUP + { + Pos = MAP_APPFONT ( 198 , 70 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Setup..." ; + }; + FixedLine FL_PRINTER + { + Pos = MAP_APPFONT ( 6 , 59 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = " Printer " ; + }; +}; + // ************************************************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx new file mode 100644 index 000000000000..fd9caec98c24 --- /dev/null +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -0,0 +1,944 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mailmrge.cxx,v $ + * $Revision: 1.39 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <tools/urlobj.hxx> +#include <svtools/urihelper.hxx> +#include <svtools/pathoptions.hxx> +#include <goodies/mailenum.hxx> +#include <svx/svxdlg.hxx> +#include <svx/dialogs.hrc> +#include <helpid.h> +#include <view.hxx> +#include <docsh.hxx> +#include <IDocumentDeviceAccess.hxx> +#include <wrtsh.hxx> +#include <dbmgr.hxx> +#include <dbui.hxx> +#include <prtopt.hxx> +#include <swmodule.hxx> +#include <modcfg.hxx> +#include <mailmergehelper.hxx> +#include <envelp.hrc> +#include <mailmrge.hrc> +#include <mailmrge.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdb/XResultSetAccess.hpp> +#include <com/sun/star/sdbc/XDataSource.hpp> +#include <toolkit/unohlp.hxx> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/form/XFormController.hpp> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XContainerQuery.hpp> +#include <com/sun/star/container/XEnumeration.hpp> + +#include <unomid.h> + +#include <algorithm> + +using namespace rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdb; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::form; +using namespace ::com::sun::star::view; +using namespace ::com::sun::star::ui::dialogs; + + +/* -----------------------------05.06.01 13:54-------------------------------- + + ---------------------------------------------------------------------------*/ +struct SwMailMergeDlg_Impl +{ + uno::Reference<XFormController> xFController; + uno::Reference<XSelectionChangeListener> xChgLstnr; + uno::Reference<XSelectionSupplier> xSelSupp; +}; +/* -----------------------------05.06.01 13:47-------------------------------- + helper classes + ---------------------------------------------------------------------------*/ +class SwXSelChgLstnr_Impl : public cppu::WeakImplHelper1 +< + view::XSelectionChangeListener +> +{ + SwMailMergeDlg& rParent; +public: + SwXSelChgLstnr_Impl(SwMailMergeDlg& rParentDlg); + ~SwXSelChgLstnr_Impl(); + + virtual void SAL_CALL selectionChanged( const EventObject& aEvent ) throw (RuntimeException); + virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); +}; +/* -----------------------------05.06.01 13:51-------------------------------- + + ---------------------------------------------------------------------------*/ +SwXSelChgLstnr_Impl::SwXSelChgLstnr_Impl(SwMailMergeDlg& rParentDlg) : + rParent(rParentDlg) +{} +/* -----------------------------05.06.01 14:06-------------------------------- + + ---------------------------------------------------------------------------*/ +SwXSelChgLstnr_Impl::~SwXSelChgLstnr_Impl() +{} +/* -----------------------------05.06.01 14:06-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& ) throw (RuntimeException) +{ + //call the parent to enable selection mode + Sequence <Any> aSelection; + if(rParent.pImpl->xSelSupp.is()) + rParent.pImpl->xSelSupp->getSelection() >>= aSelection; + + sal_Bool bEnable = aSelection.getLength() > 0; + rParent.aMarkedRB.Enable(bEnable); + if(bEnable) + rParent.aMarkedRB.Check(); + else if(rParent.aMarkedRB.IsChecked()) + { + rParent.aAllRB.Check(); + rParent.m_aSelection.realloc(0); + } +} +/* -----------------------------05.06.01 14:06-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwXSelChgLstnr_Impl::disposing( const EventObject& ) throw (RuntimeException) +{ + DBG_ERROR("disposing"); +} +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, + const String& rSourceName, + const String& rTblName, + sal_Int32 nCommandType, + const uno::Reference< XConnection>& _xConnection, + Sequence< Any >* pSelection) : + + SvxStandardDialog(pParent, SW_RES(DLG_MAILMERGE)), + pBeamerWin (new Window(this, SW_RES(WIN_BEAMER))), + + aAllRB (this, SW_RES(RB_ALL)), + aMarkedRB (this, SW_RES(RB_MARKED)), + aFromRB (this, SW_RES(RB_FROM)), + aFromNF (this, SW_RES(NF_FROM)), + aBisFT (this, SW_RES(FT_BIS)), + aToNF (this, SW_RES(NF_TO)), + aRecordFL (this, SW_RES(FL_RECORD)), + + aSeparatorFL (this, SW_RES(FL_SEPARATOR)), + + aPrinterRB (this, SW_RES(RB_PRINTER)), + aMailingRB (this, SW_RES(RB_MAILING)), + aFileRB (this, SW_RES(RB_FILE)), + + aSingleJobsCB (this, SW_RES(CB_SINGLE_JOBS)), + + aSaveMergedDocumentFL(this, SW_RES( FL_SAVE_MERGED_DOCUMENT)), + aSaveSingleDocRB(this, SW_RES( RB_SAVE_SINGLE_DOC )), + aSaveIndividualRB(this, SW_RES( RB_SAVE_INDIVIDUAL )), + aGenerateFromDataBaseCB(this, SW_RES( RB_GENERATE_FROM_DATABASE )), + + aColumnFT (this, SW_RES(FT_COLUMN)), + aColumnLB (this, SW_RES(LB_COLUMN)), + + aPathFT (this, SW_RES(FT_PATH)), + aPathED (this, SW_RES(ED_PATH)), + aPathPB (this, SW_RES(PB_PATH)), + aFilterFT (this, SW_RES(FT_FILTER)), + aFilterLB (this, SW_RES(LB_FILTER)), + + aAddressFldLB (this, SW_RES(LB_ADDRESSFLD)), + aSubjectFT (this, SW_RES(FT_SUBJECT)), + aSubjectED (this, SW_RES(ED_SUBJECT)), + aFormatFT (this, SW_RES(FT_FORMAT)), + aAttachFT (this, SW_RES(FT_ATTACH)), + aAttachED (this, SW_RES(ED_ATTACH)), + aAttachPB (this, SW_RES(PB_ATTACH)), + aFormatHtmlCB (this, SW_RES(CB_FORMAT_HTML)), + aFormatRtfCB (this, SW_RES(CB_FORMAT_RTF)), + aFormatSwCB (this, SW_RES(CB_FORMAT_SW)), + aDestFL (this, SW_RES(FL_DEST)), + + aBottomSeparatorFL(this, SW_RES(FL_BOTTOM_SEPARATOR)), + + aOkBTN (this, SW_RES(BTN_OK)), + aCancelBTN (this, SW_RES(BTN_CANCEL)), + aHelpBTN (this, SW_RES(BTN_HELP)), + + pImpl (new SwMailMergeDlg_Impl), + + rSh (rShell), + rDBName (rSourceName), + rTableName (rTblName), + nMergeType (DBMGR_MERGE_MAILING), + m_aDialogSize( GetSizePixel() ) +{ + FreeResource(); + //task #97066# mailing of form letters is currently not supported + aMailingRB.Show(FALSE); + aSubjectFT.Show(FALSE); + aSubjectED.Show(FALSE); + aFormatFT.Show(FALSE); + aFormatSwCB.Show(FALSE); + aFormatHtmlCB.Show(FALSE); + aFormatRtfCB.Show(FALSE); + aAttachFT.Show(FALSE); + aAttachED.Show(FALSE); + aAttachPB.Show(FALSE); + + Point aMailPos = aMailingRB.GetPosPixel(); + Point aFilePos = aFileRB.GetPosPixel(); + aFilePos.X() -= (aFilePos.X() - aMailPos.X()) /2; + aFileRB.SetPosPixel(aFilePos); + uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); + if(pSelection) + { + m_aSelection = *pSelection; + //move all controls + long nDiff = aRecordFL.GetPosPixel().Y() - pBeamerWin->GetPosPixel().Y(); + pBeamerWin->Show(FALSE); + ::Size aSize = GetSizePixel(); + aSize.Height() -= nDiff; + SetSizePixel(aSize); + Window* aCntrlArr[] = { + &aAllRB , + &aMarkedRB , + &aFromRB , + &aFromNF , + &aBisFT , + &aToNF , + &aRecordFL , + &aPrinterRB , + &aMailingRB , + &aFileRB , + &aSingleJobsCB, + &aPathFT , + &aPathED , + &aPathPB , + &aFilterFT , + &aFilterLB , + &aColumnLB , + &aAddressFldLB, + &aSubjectFT , + &aSubjectED , + &aFormatFT , + &aAttachFT , + &aAttachED , + &aAttachPB , + &aFormatHtmlCB, + &aFormatRtfCB , + &aFormatSwCB , + &aDestFL , + &aSeparatorFL , + 0}; + + for( Window** ppW = aCntrlArr; *ppW; ++ppW ) + { + ::Point aPnt( (*ppW)->GetPosPixel() ); + aPnt.Y() -= nDiff; + (*ppW)->SetPosPixel( aPnt ); + } + } + else + { + try + { + // create a frame wrapper for myself + uno::Reference< XMultiServiceFactory > + xMgr = comphelper::getProcessServiceFactory(); + xFrame = uno::Reference< XFrame >(xMgr->createInstance(C2U("com.sun.star.frame.Frame")), UNO_QUERY); + if(xFrame.is()) + { + xFrame->initialize( VCLUnoHelper::GetInterface ( pBeamerWin ) ); + } + } + catch (Exception&) + { + xFrame.clear(); + } + if(xFrame.is()) + { + uno::Reference<XDispatchProvider> xDP(xFrame, UNO_QUERY); + URL aURL; + aURL.Complete = C2U(".component:DB/DataSourceBrowser"); + uno::Reference<XDispatch> xD = xDP->queryDispatch(aURL, + C2U(""), + 0x0C); + if(xD.is()) + { + Sequence<PropertyValue> aProperties(3); + PropertyValue* pProperties = aProperties.getArray(); + pProperties[0].Name = C2U("DataSourceName"); + pProperties[0].Value <<= OUString(rSourceName); + pProperties[1].Name = C2U("Command"); + pProperties[1].Value <<= OUString(rTableName); + pProperties[2].Name = C2U("CommandType"); + pProperties[2].Value <<= nCommandType; + xD->dispatch(aURL, aProperties); + pBeamerWin->Show(); + } + uno::Reference<XController> xController = xFrame->getController(); + pImpl->xFController = uno::Reference<XFormController>(xController, UNO_QUERY); + if(pImpl->xFController.is()) + { + uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( ); + pImpl->xSelSupp = uno::Reference<XSelectionSupplier>(xCtrl, UNO_QUERY); + if(pImpl->xSelSupp.is()) + { + pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this); + pImpl->xSelSupp->addSelectionChangeListener( pImpl->xChgLstnr ); + } + } + } + } + + pModOpt = SW_MOD()->GetModuleConfig(); + + aSingleJobsCB.Check(pModOpt->IsSinglePrintJob()); + + sal_Int16 nMailingMode(pModOpt->GetMailingFormats()); + aFormatSwCB.Check((nMailingMode & TXTFORMAT_OFFICE) != 0); + aFormatHtmlCB.Check((nMailingMode & TXTFORMAT_HTML) != 0); + aFormatRtfCB.Check((nMailingMode & TXTFORMAT_RTF) != 0); + + aAllRB.Check(TRUE); + + // Handler installieren + Link aLk = LINK(this, SwMailMergeDlg, ButtonHdl); + aOkBTN.SetClickHdl(aLk); + + aPathPB.SetClickHdl(LINK(this, SwMailMergeDlg, InsertPathHdl)); + aAttachPB.SetClickHdl(LINK(this, SwMailMergeDlg, AttachFileHdl)); + + aLk = LINK(this, SwMailMergeDlg, OutputTypeHdl); + aPrinterRB.SetClickHdl(aLk); + aMailingRB.SetClickHdl(aLk); + aFileRB.SetClickHdl(aLk); + + //#i63267# printing might be disabled + bool bIsPrintable = !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); + aPrinterRB.Enable(bIsPrintable); + OutputTypeHdl(bIsPrintable ? &aPrinterRB : &aFileRB); + + aLk = LINK(this, SwMailMergeDlg, FilenameHdl); + aGenerateFromDataBaseCB.SetClickHdl( aLk ); + BOOL bColumn = pModOpt->IsNameFromColumn(); + if(bColumn) + aGenerateFromDataBaseCB.Check(); + + FilenameHdl( &aGenerateFromDataBaseCB ); + aLk = LINK(this, SwMailMergeDlg, SaveTypeHdl); + aSaveSingleDocRB.Check( true ); + aSaveSingleDocRB.SetClickHdl( aLk ); + aSaveIndividualRB.SetClickHdl( aLk ); + aLk.Call( &aSaveSingleDocRB ); + + aLk = LINK(this, SwMailMergeDlg, ModifyHdl); + aFromNF.SetModifyHdl(aLk); + aToNF.SetModifyHdl(aLk); + aFromNF.SetMax(SAL_MAX_INT32); + aToNF.SetMax(SAL_MAX_INT32); + + SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr(); + if(_xConnection.is()) + pNewDBMgr->GetColumnNames(&aAddressFldLB, _xConnection, rTableName); + else + pNewDBMgr->GetColumnNames(&aAddressFldLB, rDBName, rTableName); + for(USHORT nEntry = 0; nEntry < aAddressFldLB.GetEntryCount(); nEntry++) + aColumnLB.InsertEntry(aAddressFldLB.GetEntry(nEntry)); + + aAddressFldLB.SelectEntry(C2S("EMAIL")); + + String sPath(pModOpt->GetMailingPath()); + if(!sPath.Len()) + { + SvtPathOptions aPathOpt; + sPath = aPathOpt.GetWorkPath(); + } + INetURLObject aURL(sPath); + if(aURL.GetProtocol() == INET_PROT_FILE) + aPathED.SetText(aURL.PathToFileName()); + else + aPathED.SetText(aURL.GetFull()); + + if (!bColumn ) + { + aColumnLB.SelectEntry(C2S("NAME")); + } + else + aColumnLB.SelectEntry(pModOpt->GetNameFromColumn()); + + if (aAddressFldLB.GetSelectEntryCount() == 0) + aAddressFldLB.SelectEntryPos(0); + if (aColumnLB.GetSelectEntryCount() == 0) + aColumnLB.SelectEntryPos(0); + + const BOOL bEnable = m_aSelection.getLength() != 0; + aMarkedRB.Enable(bEnable); + if (bEnable) + aMarkedRB.Check(); + else + { + aAllRB.Check(); + aMarkedRB.Enable(FALSE); + } + SetMinOutputSizePixel(m_aDialogSize); + try + { + uno::Reference< container::XNameContainer> xFilterFactory( + xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY_THROW); + uno::Reference< container::XContainerQuery > xQuery(xFilterFactory, UNO_QUERY_THROW); + OUString sCommand(C2U("matchByDocumentService=com.sun.star.text.TextDocument:iflags=")); + sCommand += String::CreateFromInt32(SFX_FILTER_EXPORT); + sCommand += C2U(":eflags="); + sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG); + sCommand += C2U(":default_first"); + uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand); + const ::rtl::OUString sName = OUString::createFromAscii("Name"); + const ::rtl::OUString sFlags = OUString::createFromAscii("Flags"); + const ::rtl::OUString sUIName = OUString::createFromAscii("UIName"); + USHORT nODT = USHRT_MAX; + while(xList->hasMoreElements()) + { + comphelper::SequenceAsHashMap aFilter(xList->nextElement()); + OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString()); + + uno::Any aProps = xFilterFactory->getByName(sFilter); + uno::Sequence< beans::PropertyValue > aFilterProperties; + aProps >>= aFilterProperties; + ::rtl::OUString sUIName2; + const beans::PropertyValue* pFilterProperties = aFilterProperties.getConstArray(); + for(int nProp = 0; nProp < aFilterProperties.getLength(); nProp++) + { + if(!pFilterProperties[nProp].Name.compareToAscii("UIName")) + { + pFilterProperties[nProp].Value >>= sUIName2; + break; + } + } + if( sUIName2.getLength() ) + { + USHORT nFilter = aFilterLB.InsertEntry( sUIName2 ); + if( 0 == sFilter.compareToAscii("writer8") ) + nODT = nFilter; + aFilterLB.SetEntryData( nFilter, new ::rtl::OUString( sFilter ) ); + } + } + aFilterLB.SelectEntryPos( nODT ); + } + catch( const uno::Exception& ) + { + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwMailMergeDlg::~SwMailMergeDlg() +{ + if(xFrame.is()) + { + xFrame->setComponent(NULL, NULL); + xFrame->dispose(); + } + else + delete pBeamerWin; + + for( USHORT nFilter = 0; nFilter < aFilterLB.GetEntryCount(); ++nFilter ) + { + ::rtl::OUString* pData = reinterpret_cast< ::rtl::OUString* >( aFilterLB.GetEntryData(nFilter) ); + delete pData; + } + delete pImpl; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +void SwMailMergeDlg::Apply() +{ +} +/*-- 01.06.2007 13:06:50--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_MoveControlY( Window* ppW, long nDiffSize ) +{ + Point aPos( ppW->GetPosPixel()); + aPos.Y() += nDiffSize; + ppW->SetPosPixel( aPos ); +} +void lcl_MoveControlX( Window* ppW, long nDiffSize ) +{ + Point aPos( ppW->GetPosPixel()); + aPos.X() += nDiffSize; + ppW->SetPosPixel( aPos ); +} +void lcl_ChangeWidth( Window* ppW, long nDiffSize ) +{ + Size aSize( ppW->GetSizePixel()); + aSize.Width() += nDiffSize; + ppW->SetSizePixel( aSize ); +} +void SwMailMergeDlg::Resize() +{ + //the only controls that profit from the resize is pBeamerWin + // and aPathED, aFilenameED and aColumnLB + + Size aCurSize( GetSizePixel() ); + //find the difference + Size aDiffSize( aCurSize.Width() - m_aDialogSize.Width(), + aCurSize.Height() - m_aDialogSize.Height() ); + m_aDialogSize = aCurSize; + if( pBeamerWin->IsVisible() ) + { + Window* aCntrlArr[] = { + &aAllRB , + &aMarkedRB , + &aFromRB , + &aFromNF , + &aBisFT , + &aToNF , + &aRecordFL , + &aPrinterRB , + &aMailingRB , + &aFileRB , + &aSingleJobsCB, + &aSaveMergedDocumentFL, + &aSaveSingleDocRB, + &aSaveIndividualRB, + &aGenerateFromDataBaseCB, + &aPathFT , + &aPathED , + &aPathPB , + &aColumnFT, + &aColumnLB , + &aFilterFT , + &aFilterLB , + &aAddressFldLB, + &aSubjectFT , + &aSubjectED , + &aFormatFT , + &aAttachFT , + &aAttachED , + &aAttachPB , + &aFormatHtmlCB, + &aFormatRtfCB , + &aFormatSwCB , + &aDestFL , + &aSeparatorFL , + &aBottomSeparatorFL, + &aOkBTN, + &aCancelBTN, + &aHelpBTN, + 0}; + for( Window** ppW = aCntrlArr; *ppW; ++ppW ) + { + lcl_MoveControlY( *ppW, aDiffSize.Height() ); + } + //some controls have to be extended horizontally + lcl_MoveControlX( &aOkBTN, aDiffSize.Width() ); + lcl_MoveControlX( &aCancelBTN, aDiffSize.Width() ); + lcl_MoveControlX( &aHelpBTN, aDiffSize.Width() ); + lcl_MoveControlX( &aPathPB, aDiffSize.Width() ); + lcl_MoveControlX( &aFileRB, aDiffSize.Width()/2 ); + + lcl_ChangeWidth( &aBottomSeparatorFL, aDiffSize.Width() ); + lcl_ChangeWidth( &aSaveMergedDocumentFL, aDiffSize.Width() ); + lcl_ChangeWidth( &aColumnLB, aDiffSize.Width() ); + lcl_ChangeWidth( &aPathED, aDiffSize.Width() ); + lcl_ChangeWidth( &aFilterLB, aDiffSize.Width() ); + lcl_ChangeWidth( &aDestFL, aDiffSize.Width() ); + + Size aBeamerSize( pBeamerWin->GetSizePixel() ) ; + aBeamerSize.Width() += aDiffSize.Width(); + aBeamerSize.Height() += aDiffSize.Height(); + pBeamerWin->SetSizePixel(aBeamerSize); + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn ) +{ + if (pBtn == &aOkBTN) + { + if( ExecQryShell() ) + EndDialog(RET_OK); + } + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, RadioButton *, pBtn ) +{ + sal_Bool bPrint = pBtn == &aPrinterRB; + aSingleJobsCB.Enable(bPrint); + + aSaveMergedDocumentFL.Enable( !bPrint ); + aSaveSingleDocRB.Enable( !bPrint ); + aSaveIndividualRB.Enable( !bPrint ); + + if( !bPrint ) + { + SaveTypeHdl( aSaveSingleDocRB.IsChecked() ? &aSaveSingleDocRB : &aSaveIndividualRB ); + } + else + { + aPathFT.Enable(false); + aPathED.Enable(false); + aPathPB.Enable(false); + aColumnFT.Enable(false); + aColumnLB.Enable(false); + aFilterFT.Enable(false); + aFilterLB.Enable(false); + aGenerateFromDataBaseCB.Enable(false); + } + + return 0; +} +/*-- 01.06.2007 12:36:43--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, RadioButton*, pBtn ) +{ + bool bIndividual = pBtn == &aSaveIndividualRB; + + aGenerateFromDataBaseCB.Enable( bIndividual ); + if( bIndividual ) + { + FilenameHdl( &aGenerateFromDataBaseCB ); + } + else + { + aColumnFT.Enable(false); + aColumnLB.Enable(false); + aPathFT.Enable( false ); + aPathED.Enable( false ); + aPathPB.Enable( false ); + aFilterFT.Enable( false ); + aFilterLB.Enable( false ); + } + return 0; +} +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, FilenameHdl, CheckBox*, pBox ) +{ + BOOL bEnable = pBox->IsChecked(); + aColumnFT.Enable( bEnable ); + aColumnLB.Enable(bEnable); + aPathFT.Enable( bEnable ); + aPathED.Enable(bEnable); + aPathPB.Enable( bEnable ); + aFilterFT.Enable( bEnable ); + aFilterLB.Enable( bEnable ); + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, ModifyHdl, NumericField *, EMPTYARG ) +{ + aFromRB.Check(); + return (0); +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +bool SwMailMergeDlg::ExecQryShell() +{ + if(pImpl->xSelSupp.is()) + { + pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr ); + } + SwNewDBMgr* pMgr = rSh.GetNewDBMgr(); + + if (aPrinterRB.IsChecked()) + nMergeType = DBMGR_MERGE_MAILMERGE; + else if (aMailingRB.IsChecked()) + { + nMergeType = DBMGR_MERGE_MAILING; + pMgr->SetEMailColumn(aAddressFldLB.GetSelectEntry()); + pMgr->SetSubject(aSubjectED.GetText()); + pMgr->SetAttachment(aAttachED.GetText()); + } + else + { + nMergeType = static_cast< USHORT >( aSaveSingleDocRB.IsChecked() ? + DBMGR_MERGE_SINGLE_FILE : DBMGR_MERGE_MAILFILES ); + SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); + INetURLObject aAbs; + if( pMedium ) + aAbs = pMedium->GetURLObject(); + String sPath( + URIHelper::SmartRel2Abs( + aAbs, aPathED.GetText(), URIHelper::GetMaybeFileHdl())); + pModOpt->SetMailingPath(sPath); + String sDelim(INET_PATH_TOKEN); + + if (sPath.Len() >= sDelim.Len() && + sPath.Copy(sPath.Len()-sDelim.Len()).CompareTo(sDelim) != COMPARE_EQUAL) + sPath += sDelim; + + pModOpt->SetIsNameFromColumn(aGenerateFromDataBaseCB.IsChecked()); + + if (aGenerateFromDataBaseCB.IsEnabled() && aGenerateFromDataBaseCB.IsChecked()) + { + pMgr->SetEMailColumn(aColumnLB.GetSelectEntry()); + pModOpt->SetNameFromColumn(aColumnLB.GetSelectEntry()); + if( aFilterLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) + m_sSaveFilter = *static_cast<const ::rtl::OUString*>(aFilterLB.GetEntryData( aFilterLB.GetSelectEntryPos() )); + } + else + { + //#i97667# reset column name - otherwise it's remembered from the last run + pMgr->SetEMailColumn(::rtl::OUString()); + //start save as dialog + String sFilter; + sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); + if(!sPath.Len()) + return false; + m_sSaveFilter = sFilter; + } + + pMgr->SetSubject(sPath); + } + + if (aFromRB.IsChecked()) // Liste Einfuegen + { + // Safe: the maximal value of the fields is limited + sal_Int32 nStart = sal::static_int_cast<sal_Int32>(aFromNF.GetValue()); + sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(aToNF.GetValue()); + + if (nEnd < nStart) + std::swap(nEnd, nStart); + + m_aSelection.realloc(nEnd - nStart + 1); + Any* pSelection = m_aSelection.getArray(); + for (sal_Int32 i = nStart; i != nEnd; ++i, ++pSelection) + *pSelection <<= i; + } + else if (aAllRB.IsChecked() ) + m_aSelection.realloc(0); // Leere Selektion = Alles einfuegen + else + { + if(pImpl->xSelSupp.is()) + { + //update selection + uno::Reference< XRowLocate > xRowLocate(GetResultSet(),UNO_QUERY); + uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY); + pImpl->xSelSupp->getSelection() >>= m_aSelection; + if ( xRowLocate.is() ) + { + Any* pBegin = m_aSelection.getArray(); + Any* pEnd = pBegin + m_aSelection.getLength(); + for (;pBegin != pEnd ; ++pBegin) + { + if ( xRowLocate->moveToBookmark(*pBegin) ) + *pBegin <<= xRes->getRow(); + } + } + } + } + SwPrintData aPrtData = *SW_MOD()->GetPrtOptions(FALSE); + IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); + SwPrintData* pShellPrintData = pIDDA->getPrintData(); + if(pShellPrintData) + aPrtData = *pShellPrintData; + aPrtData.SetPrintSingleJobs(aSingleJobsCB.IsChecked()); + pIDDA->setPrintData(aPrtData); + + pModOpt->SetSinglePrintJob(aSingleJobsCB.IsChecked()); + + BYTE nMailingMode = 0; + + if (aFormatSwCB.IsChecked()) + nMailingMode |= TXTFORMAT_OFFICE; + if (aFormatHtmlCB.IsChecked()) + nMailingMode |= TXTFORMAT_HTML; + if (aFormatRtfCB.IsChecked()) + nMailingMode |= TXTFORMAT_RTF; + pModOpt->SetMailingFormats(nMailingMode); + return true; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, InsertPathHdl, PushButton *, EMPTYARG ) +{ + String sPath( aPathED.GetText() ); + if( !sPath.Len() ) + { + SvtPathOptions aPathOpt; + sPath = aPathOpt.GetWorkPath(); + } + + uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); + uno::Reference < XFolderPicker > xFP; + if( xMgr.is() ) + { + xFP = uno::Reference< XFolderPicker >( + xMgr->createInstance( + C2U( "com.sun.star.ui.dialogs.FolderPicker" ) ), + UNO_QUERY ); + } +// pFileDlg->SetHelpId(HID_FILEDLG_MAILMRGE1); + xFP->setDisplayDirectory(sPath); + if( xFP->execute() == RET_OK ) + { + INetURLObject aURL(xFP->getDirectory()); + if(aURL.GetProtocol() == INET_PROT_FILE) + aPathED.SetText(aURL.PathToFileName()); + else + aPathED.SetText(aURL.GetFull()); + } + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SwMailMergeDlg, AttachFileHdl, PushButton *, EMPTYARG ) +{ + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if(pFact) + { + AbstractSvxMultiFileDialog* pFileDlg = pFact->CreateSvxMultiFileDialog( this, RID_SVXDLG_MULTIPATH); + DBG_ASSERT(pFileDlg, "Dialogdiet fail!"); + pFileDlg->SetFiles(aAttachED.GetText()); + pFileDlg->SetHelpId(HID_FILEDLG_MAILMRGE2); + + if (pFileDlg->Execute()) + aAttachED.SetText(pFileDlg->GetFiles()); + + delete pFileDlg; + } + return 0; +} +/* -----------------------------05.06.01 14:56-------------------------------- + + ---------------------------------------------------------------------------*/ +uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const +{ + uno::Reference< XResultSet > xResSetClone; + if ( pImpl->xFController.is() ) + { + // we create a clone to do the task + uno::Reference< XResultSetAccess > xResultSetAccess( pImpl->xFController->getModel(),UNO_QUERY); + if ( xResultSetAccess.is() ) + xResSetClone = xResultSetAccess->createResultSet(); + } + return xResSetClone; +} +/*-- 27.11.2002 12:27:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(Window* pParent) : + ModalDialog(pParent, SW_RES(DLG_MERGE_CREATE)), + aCreateFromFL( this, SW_RES( FL_CREATEFROM )), + aThisDocRB( this, SW_RES( RB_THISDOC )), + aUseTemplateRB( this, SW_RES( RB_TEMPLATE )), + aOK( this, SW_RES( BT_OK )), + aCancel( this, SW_RES( BT_CANCEL )), + aHelp( this, SW_RES( BT_HELP )) +{ + FreeResource(); +} +/*-- 27.11.2002 12:27:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg() +{ +} +/* -----------------04.02.2003 13:45----------------- + * + * --------------------------------------------------*/ +SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(Window* pParent) : + ModalDialog(pParent, SW_RES(DLG_MERGE_FIELD_CONNECTIONS)), + aConnectionsFL( this, SW_RES( FL_CONNECTIONS )), + aUseExistingRB( this, SW_RES( RB_USEEXISTING )), + aCreateNewRB( this, SW_RES( RB_CREATENEW )), + aInfoFI( this, SW_RES( FT_INFO )), + aOK( this, SW_RES( BT_OK )), + aCancel( this, SW_RES( BT_CANCEL )), + aHelp( this, SW_RES( BT_HELP )) +{ + FreeResource(); +} +/* -----------------04.02.2003 13:45----------------- + * + * --------------------------------------------------*/ +SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg() +{ +} + + diff --git a/sw/source/ui/envelp/mailmrge.hrc b/sw/source/ui/envelp/mailmrge.hrc new file mode 100644 index 000000000000..60d957870b8e --- /dev/null +++ b/sw/source/ui/envelp/mailmrge.hrc @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mailmrge.hrc,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MAILMRGE_HRC +#define _MAILMRGE_HRC + +// #include ----------------------------------------------------------------- + +#include "envelp.hrc" + +// Elemente ----------------------------------------------------------------- + +#define FL_RECORD 1 +#define RB_ALL 2 +#define RB_MARKED 3 +#define RB_FROM 4 +#define NF_FROM 5 +#define FT_BIS 6 +#define NF_TO 7 +#define BTN_OK 8 +#define BTN_CANCEL 9 +#define BTN_HELP 10 +#define RB_PRINTER 11 +#define RB_MAILING 12 +#define FT_ADDRESS 13 +#define LB_ADDRESSFLD 14 +#define FT_SUBJECT 15 +#define ED_SUBJECT 16 +#define FL_DEST 17 +#define CB_SINGLE_JOBS 18 +#define FT_FORMAT 19 +#define CB_FORMAT_SW 20 +#define CB_FORMAT_HTML 21 +#define CB_FORMAT_RTF 22 +#define RB_FILE 23 +#define FT_PATH 24 +#define ED_PATH 25 +#define PB_PATH 26 +#define LB_COLUMN 30 +#define FT_ATTACH 32 +#define ED_ATTACH 33 +#define PB_ATTACH 34 +#define WIN_BEAMER 35 +#define FL_SEPARATOR 36 +#define FL_BOTTOM_SEPARATOR 37 +#define FL_SAVE_MERGED_DOCUMENT 38 +#define RB_SAVE_SINGLE_DOC 39 +#define RB_SAVE_INDIVIDUAL 40 +#define RB_GENERATE_FROM_DATABASE 41 +#define FT_COLUMN 42 +#define FT_FILTER 43 +#define LB_FILTER 44 + +#define FL_CREATEFROM 1 +#define RB_THISDOC 2 +#define RB_TEMPLATE 3 +#define BT_OK 4 +#define BT_CANCEL 5 +#define BT_HELP 6 +#define FL_CONNECTIONS 7 +#define RB_USEEXISTING 8 +#define RB_CREATENEW 9 +#define FT_INFO 10 + + +#endif + + diff --git a/sw/source/ui/envelp/mailmrge.src b/sw/source/ui/envelp/mailmrge.src new file mode 100644 index 000000000000..0d9cbc5a46ea --- /dev/null +++ b/sw/source/ui/envelp/mailmrge.src @@ -0,0 +1,431 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mailmrge.src,v $ + * $Revision: 1.44 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + // #include ***************************************************************** +#include "mailmrge.hrc" +#include "cmdid.h" +#include "helpid.h" + +#define _MAIL_MERGE_STRING_ \ + Text [ en-US ] = "Mail Merge" ; \ + +ModalDialog DLG_MAILMERGE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 312 , 264 ) ; + _MAIL_MERGE_STRING_ + Moveable = TRUE ; + Sizeable = TRUE; + HelpID = FN_QRY_MERGE ; + Window WIN_BEAMER + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 300 , 80 ) ; + }; + RadioButton RB_ALL + { + Pos = MAP_APPFONT ( 12 , 97 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~All" ; + TabStop = TRUE ; + }; + RadioButton RB_MARKED + { + Pos = MAP_APPFONT ( 12 , 110 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Selected records" ; + TabStop = TRUE ; + }; + RadioButton RB_FROM + { + Pos = MAP_APPFONT ( 12 , 123 ) ; + Size = MAP_APPFONT ( 33 , 10 ) ; + Text [ en-US ] = "~From:" ; + TabStop = TRUE ; + }; + NumericField NF_FROM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 48 , 122 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + StrictFormat = TRUE ; + Minimum = 1 ; + Maximum = 999999 ; + }; + FixedText FT_BIS + { + Pos = MAP_APPFONT ( 75 , 123 ) ; + Size = MAP_APPFONT ( 27 , 10 ) ; + Text [ en-US ] = "~To:" ; + Center = TRUE ; + }; + NumericField NF_TO + { + Border = TRUE ; + Pos = MAP_APPFONT ( 105 , 122 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + StrictFormat = TRUE ; + Minimum = 1 ; + Maximum = 999999 ; + }; + FixedLine FL_RECORD + { + Pos = MAP_APPFONT ( 6 , 86 ) ; + Size = MAP_APPFONT ( 126 , 8 ) ; + Text [ en-US ] = "Records" ; + }; + RadioButton RB_PRINTER + { + Pos = MAP_APPFONT ( 144 , 97 ) ; + Size = MAP_APPFONT ( 53 , 10 ) ; + Check = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "~Printer" ; + }; + RadioButton RB_MAILING + { + Pos = MAP_APPFONT ( 200 , 97 ) ; + Size = MAP_APPFONT ( 53 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Electronic" ; + }; + RadioButton RB_FILE + { + Pos = MAP_APPFONT ( 256 , 97 ) ; + Size = MAP_APPFONT ( 56 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "File" ; + }; + CheckBox CB_SINGLE_JOBS + { + Pos = MAP_APPFONT ( 150 , 112 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Single print jobs" ; + }; + FixedLine FL_SAVE_MERGED_DOCUMENT + { + Pos = MAP_APPFONT ( 144, 128 ) ; + Size = MAP_APPFONT ( 156 , 8 ) ; + Text [ en-US ] = "Save merged document" ; + }; + RadioButton RB_SAVE_SINGLE_DOC + { + Pos = MAP_APPFONT ( 150, 139 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "S~ave as single document"; + }; + RadioButton RB_SAVE_INDIVIDUAL + { + Pos = MAP_APPFONT ( 150, 152 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Sa~ve as individual documents"; + }; + CheckBox RB_GENERATE_FROM_DATABASE + { + Pos = MAP_APPFONT ( 156, 168 ) ; + Size = MAP_APPFONT ( 144 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Generate file name from ~Database"; + }; + FixedText FT_COLUMN + { + Pos = MAP_APPFONT ( 162 , 184 ) ; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Field" ; + }; + ListBox LB_COLUMN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 205 , 182 ) ; + Size = MAP_APPFONT ( 103 , 84 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_PATH + { + Pos = MAP_APPFONT ( 162 , 200 ) ; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "~Path" ; + }; + Edit ED_PATH + { + Pos = MAP_APPFONT ( 205 , 198 ) ; + Size = MAP_APPFONT ( 86 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_PATH + { + Pos = MAP_APPFONT ( 294 , 198 ) ; + Size = MAP_APPFONT ( 14 , 12 ) ; + // Soll Groesse des Edits haben (12)! + Text = "~..." ; + TabStop = TRUE ; + }; + FixedText FT_FILTER + { + Pos = MAP_APPFONT ( 162 , 216 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "F~ile format" ; + }; + ListBox LB_FILTER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 205 , 214 ) ; + Size = MAP_APPFONT ( 103 , 84 ) ; + Disable = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + ListBox LB_ADDRESSFLD + { + Border = TRUE ; + Pos = MAP_APPFONT ( 220 , 110 ) ; + Size = MAP_APPFONT ( 74 , 84 ) ; + Disable = TRUE ; + Hide = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_SUBJECT + { + Pos = MAP_APPFONT ( 144 , 125 ) ; + Size = MAP_APPFONT ( 51 , 10 ) ; + Disable = TRUE ; + Text [ en-US ] = "~Subject" ; + }; + Edit ED_SUBJECT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 220 , 127 ) ; + Size = MAP_APPFONT ( 88 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_ATTACH + { + Pos = MAP_APPFONT ( 144 , 140 ) ; + Size = MAP_APPFONT ( 51 , 10 ) ; + Disable = TRUE ; + Text [ en-US ] = "Attachments" ; + }; + Edit ED_ATTACH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 220 , 140 ) ; + Size = MAP_APPFONT ( 72 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + ReadOnly = TRUE ; + }; + PushButton PB_ATTACH + { + Pos = MAP_APPFONT ( 294 , 140 ) ; + Size = MAP_APPFONT ( 14 , 12 ) ; + // Soll Groesse des Edits haben (12)! + Text = "~..." ; + TabStop = TRUE ; + Disable = TRUE ; + }; + FixedText FT_FORMAT + { + Pos = MAP_APPFONT ( 144 , 157 ) ; + Size = MAP_APPFONT ( 51 , 8 ) ; + Disable = TRUE ; + Text [ en-US ] = "Mail Format" ; + }; + CheckBox CB_FORMAT_HTML + { + Pos = MAP_APPFONT ( 220 , 156 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Disable = TRUE ; + /* ### ACHTUNG: Neuer Text in Resource? HTM~L : HTML */ + TabStop = TRUE ; + Text [ en-US ] = "HTM~L" ; + }; + CheckBox CB_FORMAT_RTF + { + Pos = MAP_APPFONT ( 220 , 169 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "RT~F" ; + }; + CheckBox CB_FORMAT_SW + { + Pos = MAP_APPFONT ( 220, 182 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "%PRODUCTNAME Writer" ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 133 , 93 ) ; + Size = MAP_APPFONT ( 4 , 136 ) ; + Vert = TRUE; + }; + FixedLine FL_DEST + { + Pos = MAP_APPFONT ( 138 , 86 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text [ en-US ] = "Output" ; + }; + FixedLine FL_BOTTOM_SEPARATOR + { + Pos = MAP_APPFONT ( 0, 232 ) ; + Size = MAP_APPFONT ( 312 , 8 ) ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 147 , 244 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 200 , 244 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 256 , 244 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; +}; + +ModalDialog DLG_MERGE_CREATE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 145 , 63 ) ; + Moveable = TRUE ; + HelpID = HID_MAIL_MERGE_CREATE_FROM; + _MAIL_MERGE_STRING_ + FixedLine FL_CREATEFROM + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Create" ; + }; + RadioButton RB_THISDOC + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Check = TRUE; + TabStop = TRUE ; + Text [ en-US ] = "From this ~document" ; + }; + RadioButton RB_TEMPLATE + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "From a ~template" ; + }; + OKButton BT_OK + { + Pos = MAP_APPFONT ( 89 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( 89 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton BT_HELP + { + Pos = MAP_APPFONT ( 89 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + +}; +ModalDialog DLG_MERGE_FIELD_CONNECTIONS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 205 , 97 ) ; + Moveable = TRUE ; + HelpID = HID_MAIL_MERGE_INSERT_FIELDS; + Text [ en-US ] = "Data Source Connection" ; + FixedLine FL_CONNECTIONS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 140 , 8 ) ; + Text [ en-US ] = "Connect" ; + }; + RadioButton RB_USEEXISTING + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 130 , 10 ) ; + Check = TRUE; + TabStop = TRUE ; + Text [ en-US ] = "~Use existing" ; + }; + RadioButton RB_CREATENEW + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 130 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Create new connection" ; + }; + FixedText FT_INFO + { + Pos = MAP_APPFONT ( 6 , 41 ) ; + Size = MAP_APPFONT ( 141 , 50 ) ; + WordBreak = TRUE; + Text [ en-US ] = "Fields are used to personalize form letters. The fields are placeholders for data from a data source, such as a database. The fields in the form letter must be connected to the data source." ; + }; + OKButton BT_OK + { + Pos = MAP_APPFONT ( 149 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( 149 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton BT_HELP + { + Pos = MAP_APPFONT ( 149 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + +}; + diff --git a/sw/source/ui/envelp/makefile.mk b/sw/source/ui/envelp/makefile.mk new file mode 100644 index 000000000000..5e5105d3d48e --- /dev/null +++ b/sw/source/ui/envelp/makefile.mk @@ -0,0 +1,84 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.10 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=sw +TARGET=envelp +LIBTARGET=no +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/inc$/swpre.mk +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/inc$/sw.mk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES =\ + envelp.src \ + envfmt.src \ + envlop.src \ + envprt.src \ + label.src \ + labfmt.src \ + labprt.src \ + mailmrge.src + +SLOFILES = \ + $(SLO)$/envfmt.obj \ + $(SLO)$/envimg.obj \ + $(SLO)$/envlop1.obj \ + $(SLO)$/envprt.obj \ + $(SLO)$/labelcfg.obj \ + $(SLO)$/label1.obj \ + $(SLO)$/labelexp.obj \ + $(SLO)$/labfmt.obj \ + $(SLO)$/labprt.obj \ + $(SLO)$/labimg.obj \ + $(SLO)$/mailmrge.obj \ + $(SLO)$/syncbtn.obj + +EXCEPTIONSFILES= \ + $(SLO)$/labelexp.obj \ + $(SLO)$/mailmrge.obj + +LIB1TARGET = $(SLB)$/$(TARGET).lib + +LIB1OBJFILES = \ + $(SLO)$/envimg.obj \ + $(SLO)$/labelcfg.obj \ + $(SLO)$/labimg.obj \ + $(SLO)$/syncbtn.obj +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx new file mode 100644 index 000000000000..18f1d0b929c9 --- /dev/null +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: swuilabimp.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWUILABIMP_HXX +#define _SWUILABIMP_HXX +#include "labimp.hxx" + +class SwLabPage : public SfxTabPage +{ + SwNewDBMgr* pNewDBMgr; + String sActDBName; + SwLabItem aItem; + + FixedText aWritingText; + CheckBox aAddrBox; + MultiLineEdit aWritingEdit; + FixedText aDatabaseFT; + ListBox aDatabaseLB; + FixedText aTableFT; + ListBox aTableLB; + ImageButton aInsertBT; + FixedText aDBFieldFT; + ListBox aDBFieldLB; +// PushButton aDatabaseButton; + FixedLine aWritingFL; + + RadioButton aContButton; + RadioButton aSheetButton; + FixedText aMakeText; + ListBox aMakeBox; + FixedText aTypeText; + ListBox aTypeBox; + ListBox aHiddenSortTypeBox; + FixedInfo aFormatInfo; + FixedLine aFormatFL; + + sal_Bool m_bLabel; + + SwLabPage(Window* pParent, const SfxItemSet& rSet); + ~SwLabPage(); + + DECL_LINK( AddrHdl, Button * ); + DECL_LINK( DatabaseHdl, ListBox *pListBox ); +// DECL_LINK( DatabaseButtonHdl, Button * ); + DECL_LINK( FieldHdl, Button * ); + DECL_LINK( PageHdl, Button * ); + DECL_LINK( MakeHdl, ListBox * ); + DECL_LINK( TypeHdl, ListBox * ); + + void DisplayFormat (); + SwLabRec* GetSelectedEntryPos(); + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + using Window::GetParent; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + void FillItem(SwLabItem& rItem); + virtual sal_Bool FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); + + SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();} + + void SetToBusinessCard(); + + void InitDatabaseBox(); + inline void SetNewDBMgr(SwNewDBMgr* pDBMgr) { pNewDBMgr = pDBMgr; } + inline SwNewDBMgr* GetNewDBMgr() const { return pNewDBMgr; } +}; + +/* -----------------08.07.99 13:48------------------- + + --------------------------------------------------*/ +class SwOneExampleFrame; +class SwVisitingCardPage : public SfxTabPage +{ + SvTreeListBox aAutoTextLB; + FixedText aAutoTextGroupFT; + ListBox aAutoTextGroupLB; + + FixedLine aContentFL; + + Window aExampleWIN; + + String sVisCardGroup; + String sTempURL; + + SwLabItem aLabItem; + + SwOneExampleFrame* pExampleFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText; + + + DECL_LINK( AutoTextSelectHdl, void* ); + DECL_LINK( FrameControlInitializedHdl, void* ); + + void InitFrameControl(); + void UpdateFields(); + + void ClearUserData(); + + using SfxTabPage::SetUserData; + void SetUserData( sal_uInt32 nCnt, + const rtl::OUString* pNames, + const rtl::OUString* pValues ); + + SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet); + ~SwVisitingCardPage(); + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + virtual sal_Bool FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); +}; +/* -----------------29.09.99 08:51------------------- + + --------------------------------------------------*/ +class SwPrivateDataPage : public SfxTabPage +{ + FixedLine aDataFL; + + FixedText aNameFT; + Edit aFirstNameED; + Edit aNameED; + Edit aShortCutED; + + FixedText aName2FT; + Edit aFirstName2ED; + Edit aName2ED; + Edit aShortCut2ED; + + FixedText aStreetFT; + Edit aStreetED; + FixedText aZipCityFT; + Edit aZipED; + Edit aCityED; + FixedText aCountryStateFT; + Edit aCountryED; + Edit aStateED; + FixedText aTitleProfessionFT; + Edit aTitleED; + Edit aProfessionED; + FixedText aPhoneFT; + Edit aPhoneED; + Edit aMobilePhoneED; + FixedText aFaxFT; + Edit aFaxED; + FixedText aWWWMailFT; + Edit aHomePageED; + Edit aMailED; + + SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet); + ~SwPrivateDataPage(); + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + virtual sal_Bool FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); +}; +/* -----------------29.09.99 08:51------------------- + + --------------------------------------------------*/ +class SwBusinessDataPage : public SfxTabPage +{ + FixedLine aDataFL; + FixedText aCompanyFT; + Edit aCompanyED; + FixedText aCompanyExtFT; + Edit aCompanyExtED; + FixedText aSloganFT; + Edit aSloganED; + + FixedText aStreetFT; + Edit aStreetED; + FixedText aZipCityFT; + Edit aZipED; + Edit aCityED; + FixedText aCountryStateFT; + Edit aCountryED; + Edit aStateED; + + FixedText aPositionFT; + Edit aPositionED; + + FixedText aPhoneFT; + Edit aPhoneED; + Edit aMobilePhoneED; + FixedText aFaxFT; + Edit aFaxED; + + FixedText aWWWMailFT; + Edit aHomePageED; + Edit aMailED; + + SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet); + ~SwBusinessDataPage(); + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + +public: + + static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet); + + virtual void ActivatePage(const SfxItemSet& rSet); + virtual int DeactivatePage(SfxItemSet* pSet = 0); + virtual sal_Bool FillItemSet(SfxItemSet& rSet); + virtual void Reset(const SfxItemSet& rSet); +}; + +#endif + diff --git a/sw/source/ui/envelp/syncbtn.cxx b/sw/source/ui/envelp/syncbtn.cxx new file mode 100644 index 000000000000..8da7e0945ea1 --- /dev/null +++ b/sw/source/ui/envelp/syncbtn.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: syncbtn.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + + + +#include <sfx2/viewfrm.hxx> +#include <sfx2/dispatch.hxx> + +#include "cmdid.h" +#include "swmodule.hxx" +#include "view.hxx" +#include "edtwin.hxx" +#include "label.hrc" + +#define _SYNCDLG +#include "syncbtn.hxx" +#include "swtypes.hxx" + +SFX_IMPL_FLOATINGWINDOW( SwSyncChildWin, FN_SYNC_LABELS ) + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwSyncChildWin::SwSyncChildWin( Window* _pParent, + USHORT nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ) : + SfxChildWindow( _pParent, nId ) +{ + pWindow = new SwSyncBtnDlg( pBindings, this, _pParent); + + if (!pInfo->aSize.Width() || !pInfo->aSize.Height()) + { + SwView* pActiveView = ::GetActiveView(); + if(pActiveView) + { + const SwEditWin &rEditWin = pActiveView->GetEditWin(); + pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0))); + } + else + pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0))); + pInfo->aPos = pWindow->GetPosPixel(); + pInfo->aSize = pWindow->GetSizePixel(); + } + + ((SwSyncBtnDlg *)pWindow)->Initialize(pInfo); + + pWindow->Show(); +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings, + SfxChildWindow* pChild, + Window *pParent) : + SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_SYNC_BTN)), + aSyncBtn (this, SW_RES(BTN_SYNC )) +{ + FreeResource(); + aSyncBtn.SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl)); +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +__EXPORT SwSyncBtnDlg::~SwSyncBtnDlg() +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +IMPL_LINK( SwSyncBtnDlg, BtnHdl, PushButton *, EMPTYARG ) +{ + SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SFX_CALLMODE_ASYNCHRON); + return 0; +} + + |