summaryrefslogtreecommitdiff
path: root/sw/source/ui/fldui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/fldui')
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.cxx147
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.hrc37
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.src122
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.cxx81
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.hxx44
-rw-r--r--sw/source/ui/fldui/changedb.cxx363
-rw-r--r--sw/source/ui/fldui/changedb.hrc62
-rw-r--r--sw/source/ui/fldui/changedb.src128
-rw-r--r--sw/source/ui/fldui/flddb.cxx583
-rw-r--r--sw/source/ui/fldui/flddb.hxx106
-rw-r--r--sw/source/ui/fldui/flddb.src198
-rw-r--r--sw/source/ui/fldui/flddinf.cxx537
-rw-r--r--sw/source/ui/fldui/flddinf.hxx89
-rw-r--r--sw/source/ui/fldui/flddinf.src138
-rw-r--r--sw/source/ui/fldui/flddok.cxx731
-rw-r--r--sw/source/ui/fldui/flddok.hxx95
-rw-r--r--sw/source/ui/fldui/flddok.src195
-rw-r--r--sw/source/ui/fldui/fldedt.cxx421
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx744
-rw-r--r--sw/source/ui/fldui/fldfunc.hxx113
-rw-r--r--sw/source/ui/fldui/fldfunc.src269
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx1793
-rw-r--r--sw/source/ui/fldui/fldpage.cxx433
-rw-r--r--sw/source/ui/fldui/fldpage.hxx107
-rw-r--r--sw/source/ui/fldui/fldref.cxx1073
-rw-r--r--sw/source/ui/fldui/fldref.hxx114
-rw-r--r--sw/source/ui/fldui/fldref.src145
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx386
-rw-r--r--sw/source/ui/fldui/fldtdlg.hrc171
-rw-r--r--sw/source/ui/fldui/fldtdlg.src118
-rw-r--r--sw/source/ui/fldui/fldui.src684
-rw-r--r--sw/source/ui/fldui/fldvar.cxx1383
-rw-r--r--sw/source/ui/fldui/fldvar.hxx126
-rw-r--r--sw/source/ui/fldui/fldvar.src236
-rw-r--r--sw/source/ui/fldui/fldwrap.cxx212
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx209
-rw-r--r--sw/source/ui/fldui/inpdlg.hrc34
-rw-r--r--sw/source/ui/fldui/inpdlg.src131
-rw-r--r--sw/source/ui/fldui/javaedit.cxx366
-rw-r--r--sw/source/ui/fldui/javaedit.hrc51
-rw-r--r--sw/source/ui/fldui/javaedit.src172
-rw-r--r--sw/source/ui/fldui/makefile.mk94
-rw-r--r--sw/source/ui/fldui/xfldui.cxx184
43 files changed, 13425 insertions, 0 deletions
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
new file mode 100644
index 000000000000..68ce692f6a32
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <fldmgr.hxx>
+#ifndef _MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#include <DropDownFieldDialog.hxx>
+#include <flddropdown.hxx>
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _SW_DROPDOWNFIELDDIALOG_HRC
+#include <DropDownFieldDialog.hrc>
+#endif
+
+using namespace ::com::sun::star;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+sw::DropDownFieldDialog::DropDownFieldDialog( Window *pParent, SwWrtShell &rS,
+ SwField* pField, BOOL bNextButton ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_FLD_DROPDOWN)),
+ aItemsFL( this, SW_RES( FL_ITEMS )),
+ aListItemsLB( this, SW_RES( LB_LISTITEMS )),
+
+ aOKPB( this, SW_RES( PB_OK )),
+ aCancelPB( this, SW_RES( PB_CANCEL )),
+ aNextPB( this, SW_RES( PB_NEXT )),
+ aHelpPB( this, SW_RES( PB_HELP )),
+
+ aEditPB( this, SW_RES( PB_EDIT )),
+
+ rSh( rS ),
+ pDropField(0)
+{
+ Link aButtonLk = LINK(this, DropDownFieldDialog, ButtonHdl);
+ aEditPB.SetClickHdl(aButtonLk);
+ if( bNextButton )
+ {
+ aNextPB.Show();
+ aNextPB.SetClickHdl(aButtonLk);
+ }
+ else
+ {
+ long nDiff = aCancelPB.GetPosPixel().Y() - aOKPB.GetPosPixel().Y();
+ Point aPos = aHelpPB.GetPosPixel();
+ aPos.Y() -= nDiff;
+ aHelpPB.SetPosPixel(aPos);
+ }
+ if( RES_DROPDOWN == pField->GetTyp()->Which() )
+ {
+ //
+ pDropField = (SwDropDownField*)pField;
+ String sTitle = GetText();
+ sTitle += pDropField->GetPar2();
+ SetText(sTitle);
+ uno::Sequence< rtl::OUString > aItems = pDropField->GetItemSequence();
+ const rtl::OUString* pArray = aItems.getConstArray();
+ for(sal_Int32 i = 0; i < aItems.getLength(); i++)
+ aListItemsLB.InsertEntry(pArray[i]);
+ aListItemsLB.SelectEntry(pDropField->GetSelectedItem());
+ }
+
+ BOOL bEnable = !rSh.IsCrsrReadonly();
+ aOKPB.Enable( bEnable );
+
+ aListItemsLB.GrabFocus();
+ FreeResource();
+}
+
+sw::DropDownFieldDialog::~DropDownFieldDialog()
+{
+}
+
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+
+void sw::DropDownFieldDialog::Apply()
+{
+ if(pDropField)
+ {
+ String sSelect = aListItemsLB.GetSelectEntry();
+ if(pDropField->GetPar1() != sSelect)
+ {
+ rSh.StartAllAction();
+
+ SwDropDownField * pCopy = (SwDropDownField *) pDropField->Copy();
+
+ pCopy->SetPar1(sSelect);
+ rSh.SwEditShell::UpdateFlds(*pCopy);
+
+ delete pCopy;
+
+ rSh.SetUndoNoResetModified();
+ rSh.EndAllAction();
+ }
+ }
+}
+/* -----------------17.06.2003 10:50-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK(sw::DropDownFieldDialog, ButtonHdl, PushButton*, pButton)
+{
+ EndDialog(&aNextPB == pButton ? RET_OK : RET_YES );
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.hrc b/sw/source/ui/fldui/DropDownFieldDialog.hrc
new file mode 100644
index 000000000000..dc63ae58e5ac
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SW_DROPDOWNFIELDDIALOG_HRC
+#define _SW_DROPDOWNFIELDDIALOG_HRC
+#define FL_ITEMS 1
+#define LB_LISTITEMS 2
+#define PB_OK 3
+#define PB_CANCEL 4
+#define PB_NEXT 5
+#define PB_HELP 6
+#define PB_EDIT 7
+
+#endif
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.src b/sw/source/ui/fldui/DropDownFieldDialog.src
new file mode 100644
index 000000000000..407ee199a8ef
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.src
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "fldui.hrc"
+#include "DropDownFieldDialog.hrc"
+#include "helpid.h"
+ModalDialog DLG_FLD_DROPDOWN
+{
+ HelpID = HID_FLD_DROPDOWN ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 119 ) ;
+ Text [ en-US ] = "Choose Item: " ;
+ Moveable = TRUE ;
+ FixedLine FL_ITEMS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 127 , 8 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+ ListBox LB_LISTITEMS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 99 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 139 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 139 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ Pos = MAP_APPFONT ( 139 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Next" ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 139 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_EDIT
+ {
+ Pos = MAP_APPFONT ( 139 , 99 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit" ;
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.cxx b/sw/source/ui/fldui/FldRefTreeListBox.cxx
new file mode 100644
index 000000000000..38910327754e
--- /dev/null
+++ b/sw/source/ui/fldui/FldRefTreeListBox.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <FldRefTreeListBox.hxx>
+
+#include <helpid.h>
+#include <vcl/help.hxx>
+
+SwFldRefTreeListBox::SwFldRefTreeListBox( Window* pParent,
+ const ResId& rResId)
+ : SvTreeListBox( pParent, rResId )
+{
+ SetHelpId( HID_REFSELECTION_TOOLTIP );
+}
+
+SwFldRefTreeListBox::~SwFldRefTreeListBox()
+{
+}
+
+void SwFldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ bool bCallBase( true );
+ if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( pEntry )
+ {
+ String sEntry( GetEntryText( pEntry ) );
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if( pItem )
+ {
+ aPos = GetEntryPosition( pEntry );
+
+ aPos.X() = GetTabPos( pEntry, pTab );
+ Size aSize( pItem->GetSize( this, pEntry ) );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ bCallBase = false;
+ }
+ }
+ }
+ if ( bCallBase )
+ {
+ Window::RequestHelp( rHEvt );
+ }
+}
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.hxx b/sw/source/ui/fldui/FldRefTreeListBox.hxx
new file mode 100644
index 000000000000..92df954c8ddd
--- /dev/null
+++ b/sw/source/ui/fldui/FldRefTreeListBox.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _FLDREFTREELISTBOX_HXX
+#define _FLDREFTREELISTBOX_HXX
+
+#include <svtools/svtreebx.hxx>
+
+class SwFldRefTreeListBox : public SvTreeListBox
+{
+protected:
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+public:
+ SwFldRefTreeListBox(Window* pParent, const ResId& rResId);
+ virtual ~SwFldRefTreeListBox();
+
+// virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* );
+};
+#endif
+
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
new file mode 100644
index 000000000000..7d607b803536
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+
+#define _CHANGEDB_CXX
+
+#include <svtools/stdctrl.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDatabaseAccess.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <fldmgr.hxx>
+#include <expfld.hxx>
+#include <txtatr.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <dbfld.hxx>
+#include <changedb.hxx>
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _CHANGEDB_HRC
+#include <changedb.hrc>
+#endif
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+
+SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) :
+ SvxStandardDialog(&rVw.GetViewFrame()->GetWindow(), SW_RES(DLG_CHANGE_DB)),
+
+ aDBListFL (this, SW_RES(FL_DBLIST )),
+ aUsedDBFT (this, SW_RES(FT_USEDDB )),
+ aAvailDBFT (this, SW_RES(FT_AVAILDB )),
+ aUsedDBTLB (this, SW_RES(TLB_USEDDB )),
+ aAvailDBTLB (this, SW_RES(TLB_AVAILDB ), 0),
+ aAddDBPB (this, SW_RES(PB_ADDDB)),
+ aDescFT (this, SW_RES(FT_DESC )),
+ aDocDBTextFT(this, SW_RES(FT_DOCDBTEXT )),
+ aDocDBNameFT(this, SW_RES(FT_DOCDBNAME )),
+ aOKBT (this, SW_RES(BT_OK )),
+ aCancelBT (this, SW_RES(BT_CANCEL )),
+ aHelpBT (this, SW_RES(BT_HELP )),
+// aChangeBT (this, SW_RES(BT_CHANGEDB )),
+ aImageList (SW_RES(ILIST_DB_DLG )),
+ aImageListHC (SW_RES(ILIST_DB_DLG_HC )),
+
+ pSh(rVw.GetWrtShellPtr()),
+ pMgr( new SwFldMgr() )
+{
+ aAvailDBTLB.SetWrtShell(*pSh);
+ FillDBPopup();
+
+ FreeResource();
+
+ ShowDBName(pSh->GetDBData());
+ aOKBT.SetClickHdl(LINK(this, SwChangeDBDlg, ButtonHdl));
+ aAddDBPB.SetClickHdl(LINK(this, SwChangeDBDlg, AddDBHdl));
+
+ aUsedDBTLB.SetSelectionMode(MULTIPLE_SELECTION);
+ aUsedDBTLB.SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ aUsedDBTLB.SetSpaceBetweenEntries(0);
+
+ aUsedDBTLB.SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE),
+ aImageList.GetImage(IMG_EXPAND ), BMP_COLOR_NORMAL );
+ aUsedDBTLB.SetNodeBitmaps( aImageListHC.GetImage(IMG_COLLAPSE),
+ aImageListHC.GetImage(IMG_EXPAND ), BMP_COLOR_HIGHCONTRAST );
+
+ Link aLink = LINK(this, SwChangeDBDlg, TreeSelectHdl);
+
+ aUsedDBTLB.SetSelectHdl(aLink);
+ aUsedDBTLB.SetDeselectHdl(aLink);
+ aAvailDBTLB.SetSelectHdl(aLink);
+ aAvailDBTLB.SetDeselectHdl(aLink);
+ TreeSelectHdl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbank-Listboxen initialisieren
+ --------------------------------------------------------------------*/
+
+
+void SwChangeDBDlg::FillDBPopup()
+{
+ Reference<XNameAccess> xDBContext;
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
+ xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ }
+ DBG_ASSERT(xDBContext.is(), "com.sun.star.sdb.DataBaseContext: service not available");
+
+ const SwDBData& rDBData = pSh->GetDBData();
+ String sDBName(rDBData.sDataSource);
+ String sTableName(rDBData.sCommand);
+ aAvailDBTLB.Select(sDBName, sTableName, aEmptyStr);
+
+ SvStringsDtor aAllDBNames(5, 5);
+
+ Sequence< ::rtl::OUString > aDBNames = xDBContext->getElementNames();
+ const ::rtl::OUString* pDBNames = aDBNames.getConstArray();
+ sal_Int32 nDBCount = aDBNames.getLength();
+ for(sal_Int32 i = 0; i < nDBCount; i++)
+ {
+ aAllDBNames.Insert(new String(pDBNames[i]), aAllDBNames.Count());
+ }
+
+ SvStringsDtor aDBNameList(5, 1);
+ pSh->GetAllUsedDB( aDBNameList, &aAllDBNames );
+
+ USHORT nCount = aDBNameList.Count();
+ aUsedDBTLB.Clear();
+ SvLBoxEntry *pFirst = 0;
+ SvLBoxEntry *pLast = 0;
+
+ for (USHORT k = 0; k < nCount; k++)
+ {
+ sDBName = *aDBNameList.GetObject(k);
+ sDBName = sDBName.GetToken(0);
+ pLast = Insert(sDBName);
+ if (!pFirst)
+ pFirst = pLast;
+ }
+
+ if (pFirst)
+ {
+ aUsedDBTLB.MakeVisible(pFirst);
+ aUsedDBTLB.Select(pFirst);
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SvLBoxEntry* SwChangeDBDlg::Insert(const String& rDBName)
+{
+ String sDBName(rDBName.GetToken(0, DB_DELIM));
+ String sTableName(rDBName.GetToken(1, DB_DELIM));
+ int nCommandType = rDBName.GetToken(2, DB_DELIM).ToInt32();
+ SvLBoxEntry* pParent;
+ SvLBoxEntry* pChild;
+
+ USHORT nParent = 0;
+ USHORT nChild = 0;
+
+ Image aTableImg = aImageList.GetImage(IMG_DBTABLE);
+ Image aDBImg = aImageList.GetImage(IMG_DB);
+ Image aQueryImg = aImageList.GetImage(IMG_DBQUERY);
+ Image aHCTableImg = aImageListHC.GetImage(IMG_DBTABLE);
+ Image aHCDBImg = aImageListHC.GetImage(IMG_DB);
+ Image aHCQueryImg = aImageListHC.GetImage(IMG_DBQUERY);
+ Image& rToInsert = nCommandType ? aQueryImg : aTableImg;
+ Image& rHCToInsert = nCommandType ? aHCQueryImg : aHCTableImg;
+ while ((pParent = aUsedDBTLB.GetEntry(nParent++)) != NULL)
+ {
+ if (sDBName == aUsedDBTLB.GetEntryText(pParent))
+ {
+ while ((pChild = aUsedDBTLB.GetEntry(pParent, nChild++)) != NULL)
+ {
+ if (sTableName == aUsedDBTLB.GetEntryText(pChild))
+ return pChild;
+ }
+ SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent);
+ aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ pRet->SetUserData((void*)nCommandType);
+ return pRet;
+ }
+ }
+ pParent = aUsedDBTLB.InsertEntry(sDBName, aDBImg, aDBImg);
+ aUsedDBTLB.SetExpandedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST);
+
+ SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent);
+ aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ pRet->SetUserData((void*)nCommandType);
+ return pRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog zerstoeren
+ --------------------------------------------------------------------*/
+__EXPORT SwChangeDBDlg::~SwChangeDBDlg()
+{
+ delete pMgr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schliessen
+ --------------------------------------------------------------------*/
+void __EXPORT SwChangeDBDlg::Apply()
+{
+ UpdateFlds();
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwChangeDBDlg::UpdateFlds()
+{
+ SvStringsDtor aDBNames( (BYTE)aUsedDBTLB.GetSelectionCount(), 1 );
+ SvLBoxEntry* pEntry = aUsedDBTLB.FirstSelected();
+
+ while( pEntry )
+ {
+ if( aUsedDBTLB.GetParent( pEntry ))
+ {
+ String* pTmp = new String( aUsedDBTLB.GetEntryText(
+ aUsedDBTLB.GetParent( pEntry )));
+ *pTmp += DB_DELIM;
+ *pTmp += aUsedDBTLB.GetEntryText( pEntry );
+ *pTmp += DB_DELIM;
+ int nCommandType = (int)(ULONG)pEntry->GetUserData();
+ *pTmp += String::CreateFromInt32(nCommandType);
+ aDBNames.Insert(pTmp, aDBNames.Count() );
+ }
+ pEntry = aUsedDBTLB.NextSelected(pEntry);
+ }
+
+ pSh->StartAllAction();
+ String sTableName, sColumnName;
+ sal_Bool bIsTable = sal_False;
+ String sTemp(aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable));
+ sTemp += DB_DELIM;
+ sTemp += sTableName;
+ sTemp += DB_DELIM;
+ sTemp += bIsTable ? '0' : '1';
+ pSh->ChangeDBFields( aDBNames, sTemp);
+ pSh->EndAllAction();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwChangeDBDlg, ButtonHdl, Button *, EMPTYARG )
+{
+ String sTableName, sColumnName;
+ SwDBData aData;
+ sal_Bool bIsTable = sal_False;
+ aData.sDataSource = aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ aData.sCommand = sTableName;
+ aData.nCommandType = bIsTable ? 0 : 1;;
+ pSh->ChgDBData(aData);
+ ShowDBName(pSh->GetDBData());
+ EndDialog(RET_OK);
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwChangeDBDlg, TreeSelectHdl, SvTreeListBox *, EMPTYARG )
+{
+ BOOL bEnable = FALSE;
+
+ SvLBoxEntry* pEntry = aAvailDBTLB.GetCurEntry();
+
+ if (pEntry)
+ {
+ if (aAvailDBTLB.GetParent(pEntry))
+ bEnable = TRUE;
+ aOKBT.Enable( bEnable );
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankname fuer Anzeige wandeln
+ --------------------------------------------------------------------*/
+
+void SwChangeDBDlg::ShowDBName(const SwDBData& rDBData)
+{
+ String sTmp(rDBData.sDataSource);
+ String sName;
+ sTmp += '.';
+ sTmp += (String)rDBData.sCommand;
+
+ for (USHORT i = 0; i < sTmp.Len(); i++)
+ {
+ sName += sTmp.GetChar(i);
+ if (sTmp.GetChar(i) == '~')
+ sName += '~';
+ }
+
+ aDocDBNameFT.SetText(sName);
+}
+/*-- 27.05.2004 09:14:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwChangeDBDlg, AddDBHdl, PushButton *, EMPTYARG )
+{
+ String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource();
+ if(sNewDB.Len())
+ aAvailDBTLB.AddDataSource(sNewDB);
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/changedb.hrc b/sw/source/ui/fldui/changedb.hrc
new file mode 100644
index 000000000000..7bccd2fa9363
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _CHANGEDB_HRC
+#define _CHANGEDB_HRC
+
+// #include -----------------------------------------------------------------
+
+// Elemente -----------------------------------------------------------------
+
+#define FT_DESC 1
+#define FT_DOCDBTEXT 2
+#define FT_DOCDBNAME 3
+#define BT_CHANGEDB 4
+#define FT_USEDDB 5
+#define FT_AVAILDB 6
+#define TLB_USEDDB 7
+#define TLB_AVAILDB 8
+#define FL_DBLIST 9
+#define BT_OK 10
+#define BT_CANCEL 11
+#define BT_HELP 12
+#define PB_ADDDB 13
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bitmaps
+ --------------------------------------------------------------------*/
+
+#define IMG_COLLAPSE 18002 /*RID_SVXIMG_COLLAPSEDNODE*/
+#define IMG_EXPAND 18003 /*RID_SVXIMG_EXPANDEDNODE*/
+#define IMG_DB 1
+#define IMG_DBTABLE 2
+#define IMG_DBQUERY 3
+
+#endif
+
+
diff --git a/sw/source/ui/fldui/changedb.src b/sw/source/ui/fldui/changedb.src
new file mode 100644
index 000000000000..babf0b5bba13
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.src
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "changedb.hrc"
+#include "fldui.hrc"
+
+
+ModalDialog DLG_CHANGE_DB
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 286 , 175 ) ;
+
+ Text [ en-US ] = "Exchange Databases" ;
+ Moveable = TRUE ;
+ FixedLine FL_DBLIST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 218 , 8 ) ;
+
+ Text [ en-US ] = "Exchange databases" ;
+ };
+ FixedText FT_USEDDB
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Databases in Use" ;
+ };
+ FixedText FT_AVAILDB
+ {
+ Pos = MAP_APPFONT ( 118 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Available Databases" ;
+ };
+ Control TLB_USEDDB
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 100 , 62 ) ;
+ TabStop = TRUE ;
+ };
+ Control TLB_AVAILDB
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 118 , 25 ) ;
+ Size = MAP_APPFONT ( 100 , 62 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_ADDDB
+ {
+ Pos = MAP_APPFONT ( 118 , 90 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Browse..." ;
+ };
+ FixedText FT_DESC
+ {
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 210 , 45 ) ;
+ WordBreak = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Use this dialog to replace the databases you access in your document via database fields, with other databases. You can only make one change at a time. Multiple selection is possible in the list on the left.\nUse the browse button to select a database file." ;
+ };
+ FixedText FT_DOCDBTEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 161 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Database applied to document:" ;
+ };
+ FixedText FT_DOCDBNAME
+ {
+ Pos = MAP_APPFONT ( 109 , 161 ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Addresses.Addresses" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 230 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Define" ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 230 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Close" ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 230 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
new file mode 100644
index 000000000000..3c67cdb6afe7
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -0,0 +1,583 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <dbfld.hxx>
+#ifndef _FLDTDLG_HXX
+#include <fldtdlg.hxx>
+#endif
+#include <numrule.hxx>
+
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDDB_HXX
+#include <flddb.hxx>
+#endif
+#include <dbconfig.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDBPage::SwFldDBPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_DB ), rCoreSet ),
+ aTypeFT (this, SW_RES(FT_DBTYPE)),
+ aTypeLB (this, SW_RES(LB_DBTYPE)),
+ aSelectionFT(this, SW_RES(FT_DBSELECTION)),
+ aDatabaseTLB(this, SW_RES(TLB_DBLIST), 0, aEmptyStr, FALSE),
+ aAddDBFT(this, SW_RES(FT_ADDDB)),
+ aAddDBPB(this, SW_RES(PB_ADDDB)),
+ aConditionFT(this, SW_RES(FT_DBCONDITION)),
+ aConditionED(this, SW_RES(ED_DBCONDITION)),
+ aValueFT (this, SW_RES(FT_DBSETNUMBER)),
+ aValueED (this, SW_RES(ED_DBSETNUMBER)),
+ aDBFormatRB (this, SW_RES(RB_DBOWNFORMAT)),
+ aNewFormatRB(this, SW_RES(RB_DBFORMAT)),
+ aNumFormatLB(this, SW_RES(LB_DBNUMFORMAT)),
+ aFormatLB (this, SW_RES(LB_DBFORMAT)),
+ aFormatFL (this, SW_RES(FL_DBFORMAT)),
+ aFormatVertFL (this, SW_RES(FL_DBFORMAT_VERT))
+{
+ FreeResource();
+
+ aOldNumSelectHdl = aNumFormatLB.GetSelectHdl();
+
+ aNumFormatLB.SetSelectHdl(LINK(this, SwFldDBPage, NumSelectHdl));
+ aDatabaseTLB.SetSelectHdl(LINK(this, SwFldDBPage, TreeSelectHdl));
+ aDatabaseTLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
+
+ aValueED.SetModifyHdl(LINK(this, SwFldDBPage, ModifyHdl));
+ aAddDBPB.SetClickHdl(LINK(this, SwFldDBPage, AddDBHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDBPage::~SwFldDBPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage initialisieren
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDBPage::Reset(const SfxItemSet&)
+{
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ USHORT nOldPos = aTypeLB.GetSelectEntryPos();
+ sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
+
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId, i;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for(i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ nTypeId = GetCurField()->GetTypeId();
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+
+ // alte Pos selektieren
+ if (GetTypeSel() != LISTBOX_ENTRY_NOTFOUND)
+ aTypeLB.SelectEntryPos(GetTypeSel());
+
+ aFormatLB.Clear();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(TYP_DBSETNUMBERFLD, FALSE, IsFldDlgHtmlMode());
+ for( i = 0; i < nSize; ++i )
+ {
+ USHORT nEntryPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(TYP_DBSETNUMBERFLD, i));
+ USHORT nFmtId = GetFldMgr().GetFormatId( TYP_DBSETNUMBERFLD, i );
+ aFormatLB.SetEntryData( nEntryPos, reinterpret_cast<void*>(nFmtId) );
+ if( SVX_NUM_ARABIC == nFmtId )
+ aFormatLB.SelectEntryPos( nEntryPos );
+ }
+
+ if (!IsFldEdit())
+ {
+ if (nOldPos != LISTBOX_ENTRY_NOTFOUND)
+ aTypeLB.SelectEntryPos(nOldPos);
+
+ if (sOldDBName.Len())
+ {
+ aDatabaseTLB.Select(sOldDBName, sOldTableName, sOldColumnName);
+ }
+ else
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwDBData aTmp(pSh->GetDBData());
+ aDatabaseTLB.Select(aTmp.sDataSource, aTmp.sCommand, aEmptyStr);
+ }
+ }
+ }
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = (USHORT)sVal.ToInt32();
+ if(nVal != USHRT_MAX)
+ {
+ for(i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+ aTypeLB.SetSelectHdl(LINK(this, SwFldDBPage, TypeHdl));
+ aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
+
+ if (IsFldEdit())
+ {
+ aConditionED.SaveValue();
+ aValueED.SaveValue();
+ sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
+ nOldFormat = GetCurField()->GetFormat();
+ nOldSubType = GetCurField()->GetSubType();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDBPage::FillItemSet(SfxItemSet& )
+{
+ String sTableName, sColumnName;
+ SwDBData aData;
+ sal_Bool bIsTable;
+ aData.sDataSource = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ aData.sCommand = sTableName;
+ aData.nCommandType = bIsTable ? 0 : 1;
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+
+ if (!aData.sDataSource.getLength())
+ aData = pSh->GetDBData();
+
+ if(aData.sDataSource.getLength()) // Ohne Datenbank kein neuer Feldbefehl
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ String aVal(aValueED.GetText());
+ String aName(aConditionED.GetText());
+ ULONG nFormat = 0;
+ USHORT nSubType = 0;
+
+ String sDBName = aData.sDataSource;
+ sDBName += DB_DELIM;
+ sDBName += (String)aData.sCommand;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(aData.nCommandType);
+ sDBName += DB_DELIM;
+ if(sColumnName.Len())
+ {
+ sDBName += sColumnName;
+ sDBName += DB_DELIM;
+ }
+ aName.Insert(sDBName, 0);
+
+ switch (nTypeId)
+ {
+ case TYP_DBFLD:
+ nFormat = aNumFormatLB.GetFormat();
+ if (aNewFormatRB.IsEnabled() && aNewFormatRB.IsChecked())
+ nSubType = nsSwExtendedSubType::SUB_OWN_FMT;
+ aName = sDBName;
+ break;
+
+ case TYP_DBSETNUMBERFLD:
+ nFormat = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ break;
+ }
+
+
+ String sTempDBName, sTempTableName, sTempColumnName;
+ sTempDBName = aDatabaseTLB.GetDBName(sTempTableName, sTempColumnName);
+ BOOL bDBListBoxChanged = sOldDBName != sTempDBName ||
+ sOldTableName != sTempTableName || sOldColumnName != sTempColumnName;
+ if (!IsFldEdit() ||
+ aConditionED.GetSavedValue() != aConditionED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ bDBListBoxChanged ||
+ nOldFormat != nFormat || nOldSubType != nSubType)
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat);
+ }
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDBPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDBPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDBPage::GetGroup()
+{
+ return GRP_DB;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ BOOL bCond = FALSE, bSetNo = FALSE, bFormat = FALSE, bDBFormat = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ aDatabaseTLB.ShowColumns(nTypeId == TYP_DBFLD);
+
+ if (IsFldEdit())
+ {
+ SwDBData aData;
+ String sColumnName;
+ if (nTypeId == TYP_DBFLD)
+ {
+ aData = ((SwDBField*)GetCurField())->GetDBData();
+ sColumnName = ((SwDBFieldType*)GetCurField()->GetTyp())->GetColumnName();
+ }
+ else
+ {
+ aData = ((SwDBNameInfField*)GetCurField())->GetDBData(pSh->GetDoc());
+ }
+ aDatabaseTLB.Select(aData.sDataSource, aData.sCommand, sColumnName);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_DBFLD:
+ bFormat = TRUE;
+ bDBFormat = TRUE;
+ aNumFormatLB.Show();
+ aFormatLB.Hide();
+
+ if (pBox) // Typ wurde vom User geaendert
+ aDBFormatRB.Check();
+
+ if (IsFldEdit())
+ {
+ if (GetCurField()->GetFormat() != 0 && GetCurField()->GetFormat() != SAL_MAX_UINT32)
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+
+ if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_OWN_FMT)
+ aNewFormatRB.Check();
+ else
+ aDBFormatRB.Check();
+ }
+ break;
+
+ case TYP_DBNUMSETFLD:
+ bSetNo = TRUE;
+ // kein break!
+ case TYP_DBNEXTSETFLD:
+ bCond = TRUE;
+ if (IsFldEdit())
+ {
+ aConditionED.SetText(GetCurField()->GetPar1());
+ aValueED.SetText(GetCurField()->GetPar2());
+ }
+ break;
+
+ case TYP_DBNAMEFLD:
+ break;
+
+ case TYP_DBSETNUMBERFLD:
+ bFormat = TRUE;
+ aNewFormatRB.Check();
+ aNumFormatLB.Hide();
+ aFormatLB.Show();
+ if( IsFldEdit() )
+ {
+ for( USHORT nI = aFormatLB.GetEntryCount(); nI; )
+ if( GetCurField()->GetFormat() == (USHORT)(ULONG)
+ aFormatLB.GetEntryData( --nI ))
+ {
+ aFormatLB.SelectEntryPos( nI );
+ break;
+ }
+ }
+ break;
+ }
+
+ aConditionFT.Enable(bCond);
+ aConditionED.Enable(bCond);
+ aValueFT.Enable(bSetNo);
+ aValueED.Enable(bSetNo);
+ if (nTypeId != TYP_DBFLD)
+ {
+ aDBFormatRB.Enable(bDBFormat);
+ aNewFormatRB.Enable(bDBFormat|bFormat);
+ aNumFormatLB.Enable(bDBFormat);
+ aFormatLB.Enable(bFormat);
+ }
+ aFormatFL.Enable(bDBFormat|bFormat);
+
+ if (!IsFldEdit())
+ {
+ aValueED.SetText(aEmptyStr);
+ if (bCond)
+ aConditionED.SetText( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "TRUE" )));
+ else
+ aConditionED.SetText(aEmptyStr);
+ }
+
+ CheckInsert();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, NumSelectHdl, NumFormatListBox *, pLB )
+{
+ aNewFormatRB.Check();
+ aOldNumSelectHdl.Call(pLB);
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+void SwFldDBPage::CheckInsert()
+{
+ BOOL bInsert = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ SvLBoxEntry* pEntry = aDatabaseTLB.GetCurEntry();
+
+ if (pEntry)
+ {
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ if (nTypeId == TYP_DBFLD && pEntry)
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ bInsert &= pEntry != 0;
+ }
+ else
+ bInsert = FALSE;
+
+ if (nTypeId == TYP_DBNUMSETFLD)
+ {
+ BOOL bHasValue = aValueED.GetText().Len() != 0;
+
+ bInsert &= bHasValue;
+ }
+
+ EnableInsert(bInsert);
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, TreeSelectHdl, SvTreeListBox *, pBox )
+{
+ SvLBoxEntry* pColEntry;
+ SvLBoxEntry* pEntry = pColEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ if (nTypeId == TYP_DBFLD && pEntry)
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ CheckInsert();
+
+ if (nTypeId == TYP_DBFLD)
+ {
+ BOOL bNumFormat = FALSE;
+
+ if (pEntry != 0)
+ {
+ String sTableName;
+ String sColumnName;
+ BOOL bIsTable;
+ String sDBName = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ bNumFormat = GetFldMgr().IsDBNumeric(sDBName,
+ sTableName,
+ bIsTable,
+ sColumnName);
+ if (!IsFldEdit())
+ aDBFormatRB.Check();
+ }
+
+ aDBFormatRB.Enable(bNumFormat);
+ aNewFormatRB.Enable(bNumFormat);
+ aNumFormatLB.Enable(bNumFormat);
+ aFormatFL.Enable(bNumFormat);
+ }
+ }
+ return 0;
+}
+/*-- 27.05.2004 09:14:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwFldDBPage, AddDBHdl, PushButton *, EMPTYARG )
+{
+ String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource();
+ if(sNewDB.Len())
+ {
+ aDatabaseTLB.AddDataSource(sNewDB);
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ CheckInsert();
+ return 0;
+}
+
+/* -----------------12.01.99 11:21-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDBPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = (USHORT)(ULONG)aTypeLB.GetEntryData( nTypeSel );
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+/* -----------------12.12.2002 11:33-----------------
+ *
+ * --------------------------------------------------*/
+void SwFldDBPage::ActivateMailMergeAddress()
+{
+ ULONG nData = TYP_DBFLD;
+ aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos( (const void*) nData ));
+ aTypeLB.GetSelectHdl().Call(&aTypeLB);
+ const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource();
+ aDatabaseTLB.Select(rData.sDataSource, rData.sCommand, aEmptyStr);
+}
+/*-- 07.10.2003 13:59:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldDBPage::SetWrtShell(SwWrtShell& rSh)
+{
+ aDatabaseTLB.SetWrtShell(rSh);
+}
diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx
new file mode 100644
index 000000000000..2472031777a1
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDDB_HXX
+#define _SWFLDDB_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+
+#include "condedit.hxx"
+#include "dbtree.hxx"
+#include "numfmtlb.hxx"
+
+#include "fldpage.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDBPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ SwDBTreeList aDatabaseTLB;
+
+ FixedText aAddDBFT;
+ PushButton aAddDBPB;
+
+ FixedText aConditionFT;
+ ConditionEdit aConditionED;
+ FixedText aValueFT;
+ Edit aValueED;
+ RadioButton aDBFormatRB;
+ RadioButton aNewFormatRB;
+ NumFormatListBox aNumFormatLB;
+ ListBox aFormatLB;
+ FixedLine aFormatFL;
+ FixedLine aFormatVertFL;
+
+ String sOldDBName;
+ String sOldTableName;
+ String sOldColumnName;
+ ULONG nOldFormat;
+ USHORT nOldSubType;
+ Link aOldNumSelectHdl;
+
+ DECL_LINK( TypeHdl, ListBox* );
+ DECL_LINK( NumSelectHdl, NumFormatListBox* pLB = 0);
+ DECL_LINK( TreeSelectHdl, SvTreeListBox* pBox );
+ DECL_LINK( ModifyHdl, Edit *pED = 0 );
+ DECL_LINK( AddDBHdl, PushButton* );
+
+ void CheckInsert();
+
+ using SwFldPage::SetWrtShell;
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDBPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldDBPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+ void ActivateMailMergeAddress();
+
+ void SetWrtShell(SwWrtShell& rSh);
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddb.src b/sw/source/ui/fldui/flddb.src
new file mode 100644
index 000000000000..ce9f3dd8a09a
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.src
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DB
+{
+ HelpID = HID_FLD_DB ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DBTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DBTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 104 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ /* StringList =
+ {
+ < "Beliebiger Datensatz" ; > ;
+ < "Datensatznummer" ; > ;
+ < "Nächster Datensatz" ; > ;
+ < "Serienbrieffeld" ; > ;
+ < "Datenbankname" ; > ;
+ };*/
+ };
+ FixedText FT_DBCONDITION
+ {
+ Pos = MAP_APPFONT ( 6 , 126 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Condition" ;
+ Left = TRUE ;
+ };
+ Edit ED_DBCONDITION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 137 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_DBSETNUMBER
+ {
+ Pos = MAP_APPFONT ( 6 , 156 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "Record number" ;
+ Left = TRUE ;
+ };
+ Edit ED_DBSETNUMBER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 167 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_DBSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Database s~election" ;
+ };
+ Control TLB_DBLIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 160 , 104 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ADDDB
+ {
+ Pos = MAP_APPFONT ( 88 , 123) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Add database file" ;
+ };
+ PushButton PB_ADDDB
+ {
+ Pos = MAP_APPFONT ( 198 , 121) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Browse..." ;
+ };
+
+ RadioButton RB_DBOWNFORMAT
+ {
+ Pos = MAP_APPFONT ( 94 , 153 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "From database" ;
+ };
+ RadioButton RB_DBFORMAT
+ {
+ Pos = MAP_APPFONT ( 94 , 166 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "User-defined" ;
+ };
+ ListBox LB_DBNUMFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 164 ) ;
+ Size = MAP_APPFONT ( 53 , 60 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_DBFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 163 ) ;
+ Size = MAP_APPFONT ( 53 , 60 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ DropDown = TRUE ;
+ Sort = FALSE ;
+ Hide = TRUE ;
+ };
+ FixedLine FL_DBFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 141 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ FixedLine FL_DBFORMAT_VERT
+ {
+ Pos = MAP_APPFONT ( 87 , 152 ) ;
+ Size = MAP_APPFONT ( 4 , 28 ) ;
+ Vert = TRUE;
+ };
+ Text [ en-US ] = "Database" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
new file mode 100644
index 000000000000..07ab852e199e
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <sfx2/request.hxx>
+#include <sfx2/frame.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+
+#include <helpid.h>
+#include <swtypes.hxx>
+#include <globals.hrc>
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#include <wrtsh.hxx>
+
+#include <fldui.hrc>
+
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDDINF_HXX
+#include <flddinf.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+using namespace nsSwDocInfoSubType;
+using namespace com::sun::star;
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pWindow, SW_RES( TP_FLD_DOKINF ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_DOKINFTYPE)),
+ aTypeTLB (this, SW_RES(TLB_DOKINFTYPE)),
+ aSelectionFT(this, SW_RES(FT_DOKINFSELECTION)),
+ aSelectionLB(this, SW_RES(LB_DOKINFSELECTION)),
+ aFormatFT (this, SW_RES(FT_DOKINFFORMAT)),
+ aFormatLB (this, SW_RES(LB_DOKINFFORMAT)),
+ aFixedCB (this, SW_RES(CB_DOKINFFIXEDCONTENT)),
+
+ pSelEntry (0),
+ aInfoStr (SW_RES(STR_DOKINF_INFO))
+{
+ FreeResource();
+
+ aTypeTLB.SetHelpId(HID_FIELD_DINF_TYPE);
+ aTypeTLB.SetSelectionMode(SINGLE_SELECTION);
+ aTypeTLB.SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ // Font nicht setzen, damit der Font des Controls uebernommen wird!
+ // Sonst bei falschem Font Bug an OV.
+ aTypeTLB.SetSpaceBetweenEntries(0);
+
+ aTypeTLB.SetNodeDefaultImages();
+ //enable 'active' language selection
+ aFormatLB.SetShowLanguageControl(TRUE);
+
+ SFX_ITEMSET_ARG( &rCoreSet, pItem, SfxUnoAnyItem, SID_DOCINFO, FALSE );
+ if ( pItem )
+ pItem->GetValue() >>= xCustomPropertySet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDokInfPage::~SwFldDokInfPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDokInfPage::Reset(const SfxItemSet& )
+{
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ aTypeTLB.SetUpdateMode(FALSE);
+ aTypeTLB.Clear();
+ pSelEntry = 0;
+
+ // SubTypes in der TypeLB anzeigen
+ USHORT nTypeId = TYP_DOCINFOFLD;
+ SvLBoxEntry* pEntry = 0;
+
+ SvLBoxEntry* pInfo = 0;
+
+ USHORT nSubType = USHRT_MAX;
+ if (IsFldEdit())
+ {
+ const SwField* pCurField = GetCurField();
+ nSubType = ((SwDocInfoField*)pCurField)->GetSubType() & 0xff;
+ if( nSubType == DI_CUSTOM )
+ {
+ m_sOldCustomFieldName = static_cast<const SwDocInfoField*>(pCurField)->GetName();
+ }
+ aFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ USHORT nSelEntryData = USHRT_MAX;
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ nSelEntryData = static_cast< USHORT >(sVal.ToInt32());
+ }
+
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ for (USHORT i = 0; i < aLst.Count(); ++i)
+ {
+ if (!IsFldEdit() || nSubType == i)
+ {
+ if (DI_CUSTOM == i)
+ {
+ if(xCustomPropertySet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xSetInfo = xCustomPropertySet->getPropertySetInfo();
+ const uno::Sequence< beans::Property > rProperties = xSetInfo->getProperties();
+// uno::Sequence< ::rtl::OUString > aPropertyNames(rProperties.getLength());
+// for (sal_Int32 i = 0; i < rProperties.getLength(); ++i) {
+// aPropertyNames[i] = rProperties[i].Name;
+// }
+ //if ( !IsFldEdit() )
+ if( rProperties.getLength() )
+ {
+ pInfo = aTypeTLB.InsertEntry( String(SW_RES( STR_CUSTOM )) );
+ pInfo->SetUserData(reinterpret_cast<void*>(USHRT_MAX));
+
+ for (sal_Int32 n=0; n < rProperties.getLength(); n++)
+ {
+ rtl::OUString sEntry = rProperties[n].Name;
+ pEntry = aTypeTLB.InsertEntry(sEntry, pInfo);
+ if(m_sOldCustomFieldName.equals( sEntry ))
+ {
+ pSelEntry = pEntry;
+ aTypeTLB.Expand( pInfo );
+ }
+ pEntry->SetUserData(reinterpret_cast<void*>(i));
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!(IsFldDlgHtmlMode() && (i == DI_EDIT || i == DI_THEMA || i == DI_PRINT)))
+ {
+ pEntry = aTypeTLB.InsertEntry(*aLst[i]);
+ pEntry->SetUserData(reinterpret_cast<void*>(i));
+ }
+ }
+ if(nSelEntryData == i)
+ pSelEntry = pEntry;
+ }
+ }
+
+ // alte Pos selektieren
+ if (pSelEntry != 0)
+ {
+ aTypeTLB.Select(pSelEntry);
+ nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ }
+ else if ( aTypeTLB.GetEntry(0) )
+ {
+ pSelEntry = aTypeTLB.GetEntry(0);
+ nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ }
+
+ FillSelectionLB(nSubType);
+ if ( pSelEntry )
+ TypeHdl();
+
+ aTypeTLB.SetUpdateMode(TRUE);
+ aTypeTLB.SetSelectHdl(LINK(this, SwFldDokInfPage, TypeHdl));
+ aTypeTLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+ aSelectionLB.SetSelectHdl(LINK(this, SwFldDokInfPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+
+ if (IsFldEdit())
+ {
+ nOldSel = aSelectionLB.GetSelectEntryPos();
+ nOldFormat = GetCurField()->GetFormat();
+ aFixedCB.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokInfPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ SvLBoxEntry* pOldEntry = pSelEntry;
+
+ // Aktuelle ListBoxPos
+ pSelEntry = aTypeTLB.FirstSelected();
+
+ if(!pSelEntry)
+ {
+ pSelEntry = aTypeTLB.GetEntry(0);
+ aTypeTLB.Select(pSelEntry);
+ }
+ else
+
+ if (pOldEntry != pSelEntry)
+ FillSelectionLB((USHORT)(ULONG)pSelEntry->GetUserData());
+
+ SubTypeHdl();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ USHORT nExtSubType;
+ USHORT nNewType = 0;
+
+ if (nSubType != DI_EDIT)
+ {
+ if (nPos == LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (!aSelectionLB.GetEntryCount())
+ {
+ aFormatLB.Clear();
+ aFormatLB.Enable(FALSE);
+ aFormatFT.Enable(FALSE);
+ if( nSubType == DI_CUSTOM )
+ {
+ //find out which type the custom field has - for a start set to DATE format
+ ::rtl::OUString sName = aTypeTLB.GetEntryText(pSelEntry);
+ try
+ {
+ uno::Any aVal = xCustomPropertySet->getPropertyValue( sName );
+ const uno::Type& rValueType = aVal.getValueType();
+ if( rValueType == ::getCppuType( (util::DateTime*)0 ))
+ {
+ nNewType = NUMBERFORMAT_DATETIME;
+ }
+ else if( rValueType == ::getCppuType( (util::Date*)0 ))
+ {
+ nNewType = NUMBERFORMAT_DATE;
+ }
+ else if( rValueType == ::getCppuType( (util::Time*)0 ))
+ {
+ nNewType = NUMBERFORMAT_TIME;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ else
+ return 0;
+ }
+ nPos = 0;
+ }
+
+ nExtSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+ else
+ nExtSubType = DI_SUB_TIME;
+
+ USHORT nOldType = 0;
+ BOOL bEnable = FALSE;
+ BOOL bOneArea = FALSE;
+
+ if (aFormatLB.IsEnabled())
+ nOldType = aFormatLB.GetFormatType();
+
+ switch (nExtSubType)
+ {
+ case DI_SUB_AUTHOR:
+ break;
+
+ case DI_SUB_DATE:
+ nNewType = NUMBERFORMAT_DATE;
+ bOneArea = TRUE;
+ break;
+
+ case DI_SUB_TIME:
+ nNewType = NUMBERFORMAT_TIME;
+ bOneArea = TRUE;
+ break;
+ }
+ if (!nNewType)
+ {
+ aFormatLB.Clear();
+ }
+ else
+ {
+ if (nOldType != nNewType)
+ {
+ aFormatLB.SetFormatType(nNewType);
+ aFormatLB.SetOneArea(bOneArea);
+ }
+ bEnable = TRUE;
+ }
+
+ ULONG nFormat = IsFldEdit() ? ((SwDocInfoField*)GetCurField())->GetFormat() : 0;
+
+ USHORT nOldSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
+
+ if (IsFldEdit())
+ {
+ nPos = aSelectionLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+
+ nOldSubType &= ~DI_SUB_FIXED;
+ if (nOldSubType == nSubType)
+ {
+ if (!nFormat && (nNewType == NUMBERFORMAT_DATE || nNewType == NUMBERFORMAT_TIME))
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(pSh)
+ {
+ SvNumberFormatter* pFormatter = pSh->GetNumberFormatter();
+ LanguageType eLang = aFormatLB.GetCurLanguage();
+ if (nNewType == NUMBERFORMAT_DATE)
+ nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang);
+ else if (nNewType == NUMBERFORMAT_TIME)
+ nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang);
+ }
+ }
+ aFormatLB.SetDefFormat(nFormat);
+ }
+ }
+ else if( (nSubType == DI_CUSTOM) && (nNewType != 0) )
+ {
+ aFormatLB.SetDefFormat(nFormat);
+ }
+ }
+
+ aFormatLB.Enable(bEnable);
+ aFormatFT.Enable(bEnable);
+
+ if (bEnable && aFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ aFormatLB.SelectEntryPos(0);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokInfPage::FillSelectionLB(USHORT nSubType)
+{
+ // Format-Listbox fuellen
+ USHORT nTypeId = TYP_DOCINFOFLD;
+
+ EnableInsert(nSubType != USHRT_MAX);
+
+ if (nSubType == USHRT_MAX) // Info-Text
+ nSubType = DI_SUBTYPE_BEGIN;
+
+ aSelectionLB.Clear();
+
+ USHORT nSize = 0;
+ USHORT nSelPos = USHRT_MAX;
+ USHORT nExtSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
+
+ if (IsFldEdit())
+ {
+ aFixedCB.Check((nExtSubType & DI_SUB_FIXED) != 0);
+ nExtSubType = ((nExtSubType & ~DI_SUB_FIXED) >> 8) - 1;
+ }
+
+ if (nSubType < DI_CREATE || nSubType == DI_DOCNO || nSubType == DI_EDIT|| nSubType == DI_CUSTOM )
+ {
+ // Format Box ist fuer Title und Time leer
+ }
+ else
+ {
+ nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId(nTypeId, i)));
+ if (IsFldEdit() && i == nExtSubType)
+ nSelPos = nPos;
+ }
+ }
+
+ BOOL bEnable = nSize != 0;
+
+ if (nSize)
+ {
+ if (!aSelectionLB.GetSelectEntryCount())
+ aSelectionLB.SelectEntryPos(nSelPos == USHRT_MAX ? 0 : nSelPos);
+
+ bEnable = TRUE;
+ }
+
+ aSelectionFT.Enable(bEnable);
+ aSelectionLB.Enable(bEnable);
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDokInfPage::FillItemSet(SfxItemSet& )
+{
+ if (!pSelEntry || (USHORT)(ULONG)pSelEntry->GetUserData() == USHRT_MAX)
+ return FALSE;
+
+ USHORT nTypeId = TYP_DOCINFOFLD;
+ USHORT nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+
+ ULONG nFormat = 0;
+
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+
+ ::rtl::OUString aName;
+ if (DI_CUSTOM == nSubType)
+ aName = aTypeTLB.GetEntryText(pSelEntry);
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ nSubType |= (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+
+ if (aFixedCB.IsChecked())
+ nSubType |= DI_SUB_FIXED;
+
+ nPos = aFormatLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = aFormatLB.GetFormat();
+
+ if (!IsFldEdit() || nOldSel != aSelectionLB.GetSelectEntryPos() ||
+ nOldFormat != nFormat || aFixedCB.GetState() != aFixedCB.GetSavedValue()
+ || (DI_CUSTOM == nSubType && !aName.equals( m_sOldCustomFieldName )))
+ {
+ InsertFld(nTypeId, nSubType, aName, aEmptyStr, nFormat,
+ ' ', aFormatLB.IsAutomaticLanguage());
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDokInfPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDokInfPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokInfPage::GetGroup()
+{
+ return GRP_REG;
+}
+/* -----------------12.01.99 11:21-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDokInfPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ SvLBoxEntry* pEntry = aTypeTLB.FirstSelected();
+ USHORT nTypeSel = pEntry ? sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(pEntry->GetUserData())) : USHRT_MAX;
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+
+
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
new file mode 100644
index 000000000000..20f9ebf3b786
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDDINF_HXX
+#define _SWFLDDINF_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <svtools/svtreebx.hxx>
+
+#include "numfmtlb.hxx"
+#include "fldpage.hxx"
+
+namespace com{namespace sun{ namespace star{ namespace beans{
+ class XPropertySet;
+}}}}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDokInfPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ SvTreeListBox aTypeTLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aFormatFT;
+ NumFormatListBox aFormatLB;
+ CheckBox aFixedCB;
+
+ SvLBoxEntry* pSelEntry;
+ com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet;
+
+ String aInfoStr;
+
+ USHORT nOldSel;
+ ULONG nOldFormat;
+ ::rtl::OUString m_sOldCustomFieldName;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+
+ USHORT FillSelectionLB(USHORT nSubTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDokInfPage(Window* pWindow, const SfxItemSet& rSet);
+
+ ~SwFldDokInfPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddinf.src b/sw/source/ui/fldui/flddinf.src
new file mode 100644
index 000000000000..8a3e86c4548b
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.src
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DOKINF
+{
+ HelpID = HID_FLD_DOKINF ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DOKINFTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ Control TLB_DOKINFTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 16 ) ;
+ Size = MAP_APPFONT ( 76 , 163 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DOKINFSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKINFSELECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 16 ) ;
+ Size = MAP_APPFONT ( 76 , 163 ) ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Author" ; > ;
+ < "Time" ; > ;
+ < "Date" ; > ;
+ < "Date Time Author" ; > ;
+ };
+ };
+ FixedText FT_DOKINFFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_DOKINFFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 16 ) ;
+ Size = MAP_APPFONT ( 84 , 148 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ CheckBox CB_DOKINFFIXEDCONTENT
+ {
+ Pos = MAP_APPFONT ( 170 , 170 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fixed content" ;
+ };
+ Bitmap BMP_DOKINFROOT_OPENED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_DOKINFROOT_CLOSED
+ {
+ File = "minus.bmp" ;
+ };
+ String STR_DOKINF_INFO
+ {
+ Text [ en-US ] = "Info" ;
+ };
+ Text [ en-US ] = "DocInformation" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
new file mode 100644
index 000000000000..12d71b6f4577
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -0,0 +1,731 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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/svapp.hxx>
+#include <flddat.hxx>
+#include <docufld.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <chpfld.hxx>
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDDOK_HXX
+#include <flddok.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <svl/zformat.hxx>
+
+#include <index.hrc>
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDokPage::SwFldDokPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pWindow, SW_RES( TP_FLD_DOK ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_DOKTYPE)),
+ aTypeLB (this, SW_RES(LB_DOKTYPE)),
+ aSelectionFT (this, SW_RES(FT_DOKSELECTION)),
+ aSelectionLB (this, SW_RES(LB_DOKSELECTION)),
+ aValueFT (this, SW_RES(FT_DOKVALUE)),
+ aValueED (this, SW_RES(ED_DOKVALUE)),
+ aLevelED (this, SW_RES(ED_DOKLEVEL)),
+ aDateOffsetED (this, SW_RES(ED_DOKDATEOFF)),
+
+ aFormatFT (this, SW_RES(FT_DOKFORMAT)),
+ aFormatLB (this, SW_RES(LB_DOKFORMAT)),
+ aNumFormatLB (this, SW_RES(LB_DOKNUMFORMAT)),
+ aFixedCB (this, SW_RES(CB_DOKFIXEDCONTENT)),
+
+ sDateOffset (SW_RES(STR_DOKDATEOFF)),
+ sTimeOffset (SW_RES(STR_DOKTIMEOFF)),
+ aRootOpened (SW_RES(BMP_DOKROOT_OPENED)),
+ aRootClosed (SW_RES(BMP_DOKROOT_CLOSED))
+{
+ FreeResource();
+
+ aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aNumFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, NumFormatHdl));
+
+ aLevelED.SetMax(MAXLEVEL);
+ aDateOffsetED.SetMin(LONG_MIN);
+ aDateOffsetED.SetMax(LONG_MAX);
+ //enable 'active' language selection
+ aNumFormatLB.SetShowLanguageControl(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDokPage::~SwFldDokPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDokPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+ BOOL bPage = FALSE;
+
+ if (!IsFldEdit())
+ {
+ // Typ-Listbox fuellen
+ for(short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+
+ switch (nTypeId)
+ {
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ if (!bPage)
+ {
+ nPos = aTypeLB.InsertEntry(SW_RESSTR(FMT_REF_PAGE));
+ aTypeLB.SetEntryData(nPos, (void*)USHRT_MAX);
+ bPage = TRUE;
+ }
+ break;
+
+ default:
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ break;
+ }
+ }
+ }
+ else
+ {
+ const SwField* pCurField = GetCurField();
+ nTypeId = pCurField->GetTypeId();
+ if (nTypeId == TYP_FIXDATEFLD)
+ nTypeId = TYP_DATEFLD;
+ if (nTypeId == TYP_FIXTIMEFLD)
+ nTypeId = TYP_TIMEFLD;
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aNumFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetUpdateMode(TRUE);
+ aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aTypeLB.SetSelectHdl(LINK(this, SwFldDokPage, TypeHdl));
+ aFormatLB.SetSelectHdl(LINK(this, SwFldDokPage, FormatHdl));
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if( sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1 ))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ if (IsFldEdit())
+ {
+ nOldSel = aSelectionLB.GetSelectEntryPos();
+ nOldFormat = GetCurField()->GetFormat();
+ aFixedCB.SaveValue();
+ aValueED.SaveValue();
+ aLevelED.SaveValue();
+ aDateOffsetED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ USHORT nCount;
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.Clear();
+
+ if (nTypeId != USHRT_MAX)
+ {
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+
+ if (nTypeId != TYP_AUTHORFLD)
+ nCount = aLst.Count();
+ else
+ nCount = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ USHORT nPos;
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (!IsFldEdit())
+ {
+ if (nTypeId != TYP_AUTHORFLD)
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ else
+ nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+ else
+ {
+ BOOL bInsert = FALSE;
+
+ switch (nTypeId)
+ {
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (((SwDateTimeField*)GetCurField())->IsFixed() && !i)
+ aSelectionLB.SelectEntryPos(nPos);
+ if (!((SwDateTimeField*)GetCurField())->IsFixed() && i)
+ aSelectionLB.SelectEntryPos(nPos);
+ break;
+
+ case TYP_EXTUSERFLD:
+ case TYP_DOCSTATFLD:
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (GetCurField()->GetSubType() == i)
+ aSelectionLB.SelectEntryPos(nPos);
+ break;
+
+ case TYP_AUTHORFLD:
+ {
+ String sFmt(GetFldMgr().GetFormatStr(nTypeId, i));
+ nPos = aSelectionLB.InsertEntry(sFmt);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ aSelectionLB.SelectEntry(GetFldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
+ break;
+ }
+
+ default:
+ if (*aLst[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+ }
+ if (bInsert)
+ {
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ break;
+ }
+ }
+ }
+ aSelectionLB.SetSelectHdl(Link());
+ }
+ else
+ {
+ AddSubType(TYP_PAGENUMBERFLD);
+ AddSubType(TYP_PREVPAGEFLD);
+ AddSubType(TYP_NEXTPAGEFLD);
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(0);
+ nCount = 3;
+ aSelectionLB.SetSelectHdl(LINK(this, SwFldDokPage, SubTypeHdl));
+ }
+
+ BOOL bEnable = nCount != 0;
+
+ if (bEnable && !aSelectionLB.GetSelectEntryCount())
+ aSelectionLB.SelectEntryPos(0);
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ // Format-Listbox fuellen
+ USHORT nSize = FillFormatLB(nTypeId);
+
+ BOOL bValue = FALSE, bLevel = FALSE, bNumFmt = FALSE, bOffset = FALSE;
+ BOOL bFormat = nSize != 0;
+ BOOL bOneArea = FALSE;
+ BOOL bFixed = FALSE;
+ USHORT nFmtType = 0;
+
+ switch (nTypeId)
+ {
+ case TYP_DATEFLD:
+ bFormat = bNumFmt = bOneArea = bOffset = TRUE;
+
+ nFmtType = NUMBERFORMAT_DATE;
+ aValueFT.SetText(sDateOffset);
+ aDateOffsetED.SetFirst(-31); // Ein Monat
+ aDateOffsetED.SetLast(31);
+
+ if (IsFldEdit())
+ aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() / 24 / 60);
+ break;
+
+ case TYP_TIMEFLD:
+ bFormat = bNumFmt = bOneArea = bOffset = TRUE;
+
+ nFmtType = NUMBERFORMAT_TIME;
+ aValueFT.SetText(sTimeOffset);
+ aDateOffsetED.SetFirst(-1440); // Ein Tag
+ aDateOffsetED.SetLast(1440);
+
+ if (IsFldEdit())
+ aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() );
+ break;
+
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ if (IsFldEdit())
+ {
+ USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ String sOldTxt(aValueFT.GetText());
+
+ if(SVX_NUM_CHAR_SPECIAL != nTmp)
+ {
+ INT32 nOff = GetCurField()->GetPar2().ToInt32();
+ if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
+ aValueED.SetText(
+ String::CreateFromInt32(nOff - 1) );
+ else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
+ aValueED.SetText(
+ String::CreateFromInt32(nOff + 1) );
+ else
+ aValueED.SetText(aEmptyStr);
+ }
+ else
+ aValueED.SetText(((SwPageNumberField*)GetCurField())->GetUserString());
+ }
+ bValue = TRUE;
+ break;
+
+ case TYP_CHAPTERFLD:
+ aValueFT.SetText(SW_RESSTR(STR_LEVEL));
+ if (IsFldEdit())
+ aLevelED.SetText(String::CreateFromInt32(((SwChapterField*)GetCurField())->GetLevel() + 1));
+ bLevel = TRUE;
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
+ if (IsFldEdit())
+ aValueED.SetText(GetCurField()->GetPar2());
+ bValue = TRUE;
+ break;
+
+ case TYP_EXTUSERFLD:
+ case TYP_AUTHORFLD:
+ case TYP_FILENAMEFLD:
+ bFixed = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ if (bNumFmt)
+ {
+ if (IsFldEdit())
+ {
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+
+ if (aNumFormatLB.GetFormatType() == (NUMBERFORMAT_DATE|NUMBERFORMAT_TIME))
+ {
+ // Format-Typ immer einstellen, da sonst bei kombinierten Datum/Zeitformaten
+ // beide Formate gleichzeitig angezeigt werden wuerden
+ aNumFormatLB.SetFormatType(0);
+ aNumFormatLB.SetFormatType(nFmtType);
+ // Nochmal richtiges Format einstellen
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+ }
+ }
+ else
+ aNumFormatLB.SetFormatType(nFmtType);
+
+ aNumFormatLB.SetOneArea(bOneArea);
+ }
+
+ aFormatLB.Show(!bNumFmt);
+ aNumFormatLB.Show(bNumFmt);
+
+ Size aSz(aFormatLB.GetSizePixel());
+
+ if (bValue | bLevel | bOffset)
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 137), MAP_APPFONT).Height();
+ else
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 152), MAP_APPFONT).Height();
+
+ aValueFT.Show(bValue | bLevel | bOffset);
+ aValueED.Show(bValue);
+ aLevelED.Show(bLevel);
+ aDateOffsetED.Show(bOffset);
+ aFixedCB.Show(!bValue && !bLevel && !bOffset);
+
+ aFormatLB.SetSizePixel(aSz);
+ aNumFormatLB.SetSizePixel(aSz);
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+ aFixedCB.Enable(bFixed);
+
+ if (IsFldEdit())
+ aFixedCB.Check( static_cast< BOOL >(((GetCurField()->GetFormat() & AF_FIXED) != 0) & bFixed));
+
+ if (aNumFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ aNumFormatLB.SelectEntryPos(0);
+ aValueFT.Enable(bValue | bLevel | bOffset);
+ aValueED.Enable(bValue);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDokPage::AddSubType(USHORT nTypeId)
+{
+ USHORT nPos = aSelectionLB.InsertEntry(SwFieldType::GetTypeStr(nTypeId));
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+
+ USHORT nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ FillFormatLB(nTypeId);
+
+ USHORT nTextRes = 0;
+ switch (nTypeId)
+ {
+ case TYP_CHAPTERFLD:
+ nTextRes = STR_LEVEL;
+ break;
+
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ nTextRes = SVX_NUM_CHAR_SPECIAL == (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() )
+ ? STR_VALUE : STR_OFFSET;
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ nTextRes = STR_OFFSET;
+ break;
+ }
+
+ if( nTextRes )
+ aValueFT.SetText( SW_RESSTR( nTextRes ));
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokPage::FillFormatLB(USHORT nTypeId)
+{
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ if (nTypeId == TYP_AUTHORFLD)
+ return aFormatLB.GetEntryCount();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for( USHORT i = 0; i < nSize; ++i )
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ USHORT nFmtId = GetFldMgr().GetFormatId( nTypeId, i );
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>( nFmtId ));
+ if (IsFldEdit() && nFmtId == (GetCurField()->GetFormat() & ~AF_FIXED))
+ aFormatLB.SelectEntryPos( nPos );
+ }
+
+ if( nSize && !aFormatLB.GetSelectEntryCount() )
+ {
+ aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_PAGEDESC) );
+ if( !aFormatLB.GetSelectEntryCount() )
+ {
+ aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_ARABIC) );
+ if( !aFormatLB.GetSelectEntryCount() )
+ aFormatLB.SelectEntryPos( 0 );
+ }
+ }
+
+ FormatHdl();
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, FormatHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if (nTypeId == USHRT_MAX)
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+
+ if (nTypeId == TYP_NEXTPAGEFLD || nTypeId == TYP_PREVPAGEFLD)
+ {
+ // Prev/Next - PageNumFelder Sonderbehandlung:
+ USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ String sOldTxt( aValueFT.GetText() );
+ String sNewTxt( SW_RES( SVX_NUM_CHAR_SPECIAL == nTmp ? STR_VALUE
+ : STR_OFFSET ));
+
+ if( sOldTxt != sNewTxt )
+ aValueFT.SetText( sNewTxt );
+
+ if (sOldTxt != aValueFT.GetText())
+ aValueED.SetText( aEmptyStr );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDokPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bPage = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if (nTypeId == USHRT_MAX)
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ bPage = TRUE;
+ }
+
+ String aVal(aValueED.GetText());
+ ULONG nFormat = 0;
+ USHORT nSubType = 0;
+
+ if (aFormatLB.IsEnabled())
+ {
+ USHORT nPos = aFormatLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = (USHORT)(ULONG)aFormatLB.GetEntryData(nPos);
+ }
+
+ if (aSelectionLB.IsEnabled())
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_AUTHORFLD:
+ nFormat = nSubType;
+ nSubType = 0;
+ // kein break!
+ case TYP_EXTUSERFLD:
+ nFormat |= aFixedCB.IsChecked() ? AF_FIXED : 0;
+ break;
+
+ case TYP_FILENAMEFLD:
+ nFormat |= aFixedCB.IsChecked() ? FF_FIXED : 0;
+ break;
+
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ {
+ nFormat = aNumFormatLB.GetFormat();
+ long nVal = static_cast< long >(aDateOffsetED.GetValue());
+ if (nTypeId == TYP_DATEFLD)
+ aVal = String::CreateFromInt32(nVal * 60 * 24);
+ else
+ aVal = String::CreateFromInt32(nVal);
+ break;
+ }
+
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ case TYP_GETREFPAGEFLD:
+ {
+ if( SVX_NUM_CHAR_SPECIAL != nFormat &&
+ (TYP_PREVPAGEFLD == nTypeId || TYP_NEXTPAGEFLD == nTypeId))
+ {
+ INT32 nVal = aValueED.GetText().ToInt32();
+ aVal = String::CreateFromInt32(nVal);
+ }
+ break;
+ }
+
+ case TYP_CHAPTERFLD:
+ aVal = aLevelED.GetText();
+ break;
+
+ default:
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ nOldSel != aSelectionLB.GetSelectEntryPos() ||
+ nOldFormat != nFormat ||
+ aFixedCB.GetState() != aFixedCB.GetSavedValue() ||
+ aValueED.GetText() != aValueED.GetSavedValue() ||
+ aLevelED.GetText() != aLevelED.GetSavedValue() ||
+ aDateOffsetED.GetText() != aDateOffsetED.GetSavedValue())
+ {
+ InsertFld( nTypeId, nSubType, aEmptyStr, aVal, nFormat, ' ', aNumFormatLB.IsAutomaticLanguage() );
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDokPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDokPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokPage::GetGroup()
+{
+ return GRP_DOC;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDokPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
new file mode 100644
index 000000000000..bd46111c0b8e
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDDOK_HXX
+#define _SWFLDDOK_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+
+#include "numfmtlb.hxx"
+#include "fldpage.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDokPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aValueFT;
+ Edit aValueED;
+ NumericField aLevelED;
+ NumericField aDateOffsetED;
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ NumFormatListBox aNumFormatLB;
+ CheckBox aFixedCB;
+
+ String sDateOffset;
+ String sTimeOffset;
+ Bitmap aRootOpened;
+ Bitmap aRootClosed;
+
+ USHORT nOldSel;
+ ULONG nOldFormat;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( FormatHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+
+ void AddSubType(USHORT nTypeId);
+ USHORT FillFormatLB(USHORT nTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDokPage(Window* pWindow, const SfxItemSet& rSet);
+
+ ~SwFldDokPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddok.src b/sw/source/ui/fldui/flddok.src
new file mode 100644
index 000000000000..f566ab716362
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.src
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DOK
+{
+ HelpID = HID_FLD_DOK ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DOKTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_DOKSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKSELECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 15 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DOKFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_DOKFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 151 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ ListBox LB_DOKNUMFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 151 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_DOKVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 155 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "O~ffset" ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ Edit ED_DOKVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ NumericField ED_DOKLEVEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ Text = "1" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Hide = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ First = 1 ;
+ SpinSize = 1 ;
+ };
+ NumericField ED_DOKDATEOFF
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ Text = "0" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Hide = TRUE ;
+ SpinSize = 1 ;
+ };
+ CheckBox CB_DOKFIXEDCONTENT
+ {
+ Pos = MAP_APPFONT ( 170 , 170 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fixed content" ;
+ };
+ Bitmap BMP_DOKROOT_OPENED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_DOKROOT_CLOSED
+ {
+ File = "minus.bmp" ;
+ };
+ String STR_DOKDATEOFF
+ {
+ Text [ en-US ] = "Offs~et in days" ;
+ };
+ String STR_DOKTIMEOFF
+ {
+ Text [ en-US ] = "Offs~et in minutes" ;
+ };
+ Text [ en-US ] = "Document" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
new file mode 100644
index 000000000000..2c354551f1f3
--- /dev/null
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <sfx2/basedlgs.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <svx/optgenrl.hxx>
+#include <docufld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <dbfld.hxx>
+#include <wrtsh.hxx>
+#ifndef _FLDDB_HXX
+#include <flddb.hxx>
+#endif
+#ifndef _FLDDINF_HXX
+#include <flddinf.hxx>
+#endif
+#ifndef _FLDVAR_HXX
+#include <fldvar.hxx>
+#endif
+#ifndef _FLDDOK_HXX
+#include <flddok.hxx>
+#endif
+#ifndef _FLDFUNC_HXX
+#include <fldfunc.hxx>
+#endif
+#ifndef _FLDREF_HXX
+#include <fldref.hxx>
+#endif
+#include <fldedt.hxx>
+#include <crsskip.hxx>
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldEditDlg::SwFldEditDlg(SwView& rVw) :
+ SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0, 0),
+ pSh (rVw.GetWrtShellPtr()),
+ aPrevBT (this, SW_RES(BTN_FLDEDT_PREV)),
+ aNextBT (this, SW_RES(BTN_FLDEDT_NEXT)),
+ aAddressBT (this, SW_RES(PB_FLDEDT_ADDRESS))
+{
+ SwFldMgr aMgr(pSh);
+
+ SwField *pCurFld = aMgr.GetCurFld();
+ if(!pCurFld)
+ return;
+
+ pSh->SetCareWin(this);
+
+ /* #108536# Only create selection if there is none
+ already. Normalize PaM instead of swapping. */
+ if ( ! pSh->HasSelection() )
+ pSh->Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+
+ pSh->NormalizePam();
+
+ USHORT nGroup = aMgr.GetGroup(FALSE, pCurFld->GetTypeId(), pCurFld->GetSubType());
+
+ CreatePage(nGroup);
+
+ GetOKButton()->SetClickHdl(LINK(this, SwFldEditDlg, OKHdl));
+
+ // Buttons selbst positionieren, da sie sonst bei unterschiedlichen
+ // Fontgroessen im Wald stehen, und da PB im SingleTabDlg feste Pixelgroessen
+ // fuer seine Buttons und die Dialogbreite verwendet.
+ aPrevBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aPrevBT.GetPosPixel().Y()));
+ USHORT nWidth = static_cast< USHORT >(GetOKButton()->GetOutputSize().Width() / 2 - 3);
+ Size aNewSize(LogicToPixel(Size(nWidth, GetOKButton()->GetOutputSize().Height())));
+ aPrevBT.SetSizePixel(aNewSize);
+
+ aNextBT.SetSizePixel(aPrevBT.GetSizePixel());
+
+ long nXPos = GetOKButton()->GetPosPixel().X() + GetOKButton()->GetSizePixel().Width()
+ - aNextBT.GetSizePixel().Width() - 1;
+ aNextBT.SetPosPixel(Point(nXPos, aNextBT.GetPosPixel().Y()));
+
+ aAddressBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aAddressBT.GetPosPixel().Y()));
+ aAddressBT.SetSizePixel(GetOKButton()->GetSizePixel());
+
+ aPrevBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl));
+ aNextBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl));
+
+ aAddressBT.SetClickHdl(LINK(this, SwFldEditDlg, AddressHdl));
+ aAddressBT.SetHelpId(HID_FLDEDT_ADDRESS);
+
+ Init();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Controlls initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::Init()
+{
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+
+ if( pTabPage )
+ {
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+
+ SwField *pCurFld = rMgr.GetCurFld();
+
+ if(!pCurFld)
+ return;
+
+ // Traveling nur bei mehr als einem Feld
+ pSh->StartAction();
+ pSh->CreateCrsr();
+
+ BOOL bMove = rMgr.GoNext();
+ if( bMove )
+ rMgr.GoPrev();
+ aNextBT.Enable(bMove);
+
+ if( 0 != ( bMove = rMgr.GoPrev() ) )
+ rMgr.GoNext();
+ aPrevBT.Enable( bMove );
+
+ if (pCurFld->GetTypeId() == TYP_EXTUSERFLD)
+ aAddressBT.Show();
+
+ pSh->DestroyCrsr();
+ pSh->EndAction();
+ }
+
+ GetOKButton()->Enable( !pSh->IsReadOnlyAvailable() ||
+ !pSh->HasReadonlySel() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldEditDlg::CreatePage(USHORT nGroup)
+{
+ // TabPage erzeugen
+ SfxTabPage* pTabPage = 0;
+ USHORT nHelpId = 0;
+
+ switch (nGroup)
+ {
+ case GRP_DOC:
+ pTabPage = SwFldDokPage::Create(this, *(SfxItemSet*)0);
+ nHelpId = HID_EDIT_FLD_DOK;
+ break;
+ case GRP_FKT:
+ pTabPage = SwFldFuncPage::Create(this, *(SfxItemSet*)0);
+ nHelpId = HID_EDIT_FLD_FUNC;
+ break;
+ case GRP_REF:
+ pTabPage = SwFldRefPage::Create(this, *(SfxItemSet*)0);
+ nHelpId = HID_EDIT_FLD_REF;
+ break;
+ case GRP_REG:
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ SfxItemSet* pSet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ uno::Reference< beans::XPropertySet > xUDProps(
+ xDocProps->getUserDefinedProperties(),
+ uno::UNO_QUERY_THROW);
+// uno::Reference< beans::XPropertySetInfo > xSetInfo
+// = xUDProps->getPropertySetInfo();
+// const uno::Sequence< beans::Property > props
+// = xSetInfo->getProperties();
+// uno::Sequence< ::rtl::OUString > names(props.getLength());
+// for (sal_Int32 i = 0; i < props.getLength(); ++i) {
+// names[i] = props[i].Name;
+// }
+ pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) );
+ pTabPage = SwFldDokInfPage::Create(this, *pSet);
+ nHelpId = HID_EDIT_FLD_DOKINF;
+ break;
+ }
+ case GRP_DB:
+ pTabPage = SwFldDBPage::Create(this, *(SfxItemSet*)0);
+ static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh);
+ nHelpId = HID_EDIT_FLD_DB;
+ break;
+ case GRP_VAR:
+ pTabPage = SwFldVarPage::Create(this, *(SfxItemSet*)0);
+ nHelpId = HID_EDIT_FLD_VAR;
+ break;
+
+ }
+ pTabPage->SetHelpId(nHelpId);
+ static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh);
+
+ SetTabPage(pTabPage);
+
+ String sTitle(GetText());
+ sTitle.Insert(String::CreateFromAscii(": "), 0);
+ sTitle.Insert(SW_RESSTR(STR_FLD_EDIT_DLG), 0);
+ SetText(sTitle);
+
+ return pTabPage;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldEditDlg::~SwFldEditDlg()
+{
+ pSh->SetCareWin(NULL);
+ pSh->EnterStdMode();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::EnableInsert(BOOL bEnable)
+{
+ if( bEnable && pSh->IsReadOnlyAvailable() && pSh->HasReadonlySel() )
+ bEnable = FALSE;
+ GetOKButton()->Enable( bEnable );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::InsertHdl()
+{
+ GetOKButton()->Click();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aendern des Feldes anstossen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, OKHdl, Button *, EMPTYARG )
+{
+ if (GetOKButton()->IsEnabled())
+ {
+ SfxTabPage* pTabPage = GetTabPage();
+ if (pTabPage)
+ {
+ pTabPage->FillItemSet(*(SfxItemSet*)0);
+
+ }
+ EndDialog( RET_OK );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short SwFldEditDlg::Execute()
+{
+ // Ohne TabPage kein Dialog
+ return GetTabPage() ? Dialog::Execute() : RET_CANCEL;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling zwishen Feldern gleichen Typs
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton )
+{
+ BOOL bNext = pButton == &aNextBT;
+
+ pSh->EnterStdMode();
+
+ SwFieldType *pOldTyp = 0;
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+
+ //#112462# FillItemSet may delete the current field
+ //that's why it has to be called before accessing the current field
+ if( GetOKButton()->IsEnabled() )
+ pTabPage->FillItemSet(*(SfxItemSet*)0);
+
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+ SwField *pCurFld = rMgr.GetCurFld();
+ if (pCurFld->GetTypeId() == TYP_DBFLD)
+ pOldTyp = (SwDBFieldType*)pCurFld->GetTyp();
+
+ rMgr.GoNextPrev( bNext, pOldTyp );
+ pCurFld = rMgr.GetCurFld();
+
+ /* #108536# Only create selection if there is none
+ already. Normalize PaM instead of swapping. */
+ if ( ! pSh->HasSelection() )
+ pSh->Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+
+ pSh->NormalizePam();
+
+ USHORT nGroup = rMgr.GetGroup(FALSE, pCurFld->GetTypeId(), pCurFld->GetSubType());
+
+ if (nGroup != pTabPage->GetGroup())
+ pTabPage = (SwFldPage*)CreatePage(nGroup);
+
+ pTabPage->EditNewField();
+
+ Init();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG )
+{
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+ SwField *pCurFld = rMgr.GetCurFld();
+
+ SfxItemSet aSet( pSh->GetAttrPool(),
+ SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS,
+ 0L );
+
+ USHORT nEditPos = UNKNOWN_EDIT;
+
+ switch(pCurFld->GetSubType())
+ {
+ case EU_FIRSTNAME: nEditPos = FIRSTNAME_EDIT; break;
+ case EU_NAME: nEditPos = LASTNAME_EDIT; break;
+ case EU_SHORTCUT: nEditPos = SHORTNAME_EDIT; break;
+ case EU_COMPANY: nEditPos = COMPANY_EDIT; break;
+ case EU_STREET: nEditPos = STREET_EDIT; break;
+ case EU_TITLE: nEditPos = TITLE_EDIT; break;
+ case EU_POSITION: nEditPos = POSITION_EDIT; break;
+ case EU_PHONE_PRIVATE:nEditPos = TELPRIV_EDIT; break;
+ case EU_PHONE_COMPANY:nEditPos = TELCOMPANY_EDIT; break;
+ case EU_FAX: nEditPos = FAX_EDIT; break;
+ case EU_EMAIL: nEditPos = EMAIL_EDIT; break;
+ case EU_COUNTRY: nEditPos = COUNTRY_EDIT; break;
+ case EU_ZIP: nEditPos = PLZ_EDIT; break;
+ case EU_CITY: nEditPos = CITY_EDIT; break;
+ case EU_STATE: nEditPos = STATE_EDIT; break;
+
+ default: nEditPos = UNKNOWN_EDIT; break;
+
+ }
+ aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, nEditPos));
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet,
+ pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_DLG_ADDR );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ pSh->UpdateFlds( *pCurFld );
+ }
+ delete pDlg;
+ return 0;
+}
+
+
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
new file mode 100644
index 000000000000..ae05a35681a7
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -0,0 +1,744 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <docsh.hxx>
+#include <swtypes.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDFUNC_HXX
+#include <fldfunc.hxx>
+#endif
+#include <flddropdown.hxx>
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+using namespace ::com::sun::star;
+
+using rtl::OUString;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldFuncPage::SwFldFuncPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_FUNC ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_FUNCTYPE)),
+ aTypeLB (this, SW_RES(LB_FUNCTYPE)),
+ aSelectionFT(this, SW_RES(FT_FUNCSELECTION)),
+ aSelectionLB(this, SW_RES(LB_FUNCSELECTION)),
+ aFormatFT (this, SW_RES(FT_FUNCFORMAT)),
+ aFormatLB (this, SW_RES(LB_FUNCFORMAT)),
+ aNameFT (this, SW_RES(FT_FUNCNAME)),
+ aNameED (this, SW_RES(ED_FUNCNAME)),
+ aValueFT (this, SW_RES(FT_FUNCVALUE)),
+ aValueED (this, SW_RES(ED_FUNCVALUE)),
+ aCond1FT (this, SW_RES(FT_FUNCCOND1)),
+ aCond1ED (this, SW_RES(ED_FUNCCOND1)),
+ aCond2FT (this, SW_RES(FT_FUNCCOND2)),
+ aCond2ED (this, SW_RES(ED_FUNCCOND2)),
+ aMacroBT (this, SW_RES(BT_FUNCMACRO)),
+ aListItemFT( this, SW_RES( FT_LISTITEM )),
+ aListItemED( this, SW_RES( ED_LISTITEM )),
+ aListAddPB( this, SW_RES( PB_LISTADD )),
+ aListItemsFT( this, SW_RES( FT_LISTITEMS )),
+ aListItemsLB( this, SW_RES( LB_LISTITEMS )),
+ aListRemovePB( this, SW_RES( PB_LISTREMOVE )),
+ aListUpPB( this, SW_RES( PB_LISTUP )),
+ aListDownPB( this, SW_RES( PB_LISTDOWN )),
+ aListNameFT( this, SW_RES( FT_LISTNAME )),
+ aListNameED( this, SW_RES( ED_LISTNAME )),
+ bDropDownLBChanged(false)
+{
+ FreeResource();
+
+ aNameED.SetPosPixel(Point(aNameED.GetPosPixel().X(), aFormatLB.GetPosPixel().Y()));
+
+ aNameED.SetModifyHdl(LINK(this, SwFldFuncPage, ModifyHdl));
+
+ sOldValueFT = aValueFT.GetText();
+ sOldNameFT = aNameFT.GetText();
+
+ aCond1ED.ShowBrackets(FALSE);
+ aCond2ED.ShowBrackets(FALSE);
+
+// SwWrtShell* pSh = (SwWrtShell*)ViewShell::GetCurrShell();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldFuncPage::~SwFldFuncPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldFuncPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ // Typ-Listbox fuellen
+ for(short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ nTypeId = GetCurField()->GetTypeId();
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+
+ if (nTypeId == TYP_MACROFLD)
+ {
+ String sName(GetCurField()->GetPar1());
+ GetFldMgr().SetMacroPath(sName);
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldFuncPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldFuncPage, SelectHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertMacroHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertHdl));
+ aMacroBT.SetClickHdl (LINK(this, SwFldFuncPage, MacroHdl));
+ Link aListModifyLk( LINK(this, SwFldFuncPage, ListModifyHdl));
+ aListAddPB.SetClickHdl(aListModifyLk);
+ aListRemovePB.SetClickHdl(aListModifyLk);
+ aListUpPB.SetClickHdl(aListModifyLk);
+ aListDownPB.SetClickHdl(aListModifyLk);
+ aListItemED.SetReturnActionLink(aListModifyLk);
+ Link aListEnableLk = LINK(this, SwFldFuncPage, ListEnableHdl);
+ aListItemED.SetModifyHdl(aListEnableLk);
+ aListItemsLB.SetSelectHdl(aListEnableLk);
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ if (IsFldEdit())
+ {
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ aCond1ED.SaveValue();
+ aCond2ED.SaveValue();
+ nOldFormat = GetCurField()->GetFormat();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ UpdateSubType();
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, i )) );
+ }
+
+ if (nSize)
+ {
+ if (IsFldEdit() && nTypeId == TYP_JUMPEDITFLD)
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_MARK_BEGIN + (USHORT)GetCurField()->GetFormat()));
+
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+
+ BOOL bValue = FALSE, bName = FALSE, bMacro = FALSE, bInsert = TRUE;
+ BOOL bShowSelection = FALSE;
+ BOOL bFormat = nSize != 0;
+
+ // fuer Conditional Text zwei Controls
+ BOOL bDropDown = TYP_DROPDOWN == nTypeId;
+ BOOL bCondTxtFld = TYP_CONDTXTFLD == nTypeId;
+
+ aCond1FT.Show(!bDropDown && bCondTxtFld);
+ aCond1ED.Show(!bDropDown && bCondTxtFld);
+ aCond2FT.Show(!bDropDown && bCondTxtFld);
+ aCond2ED.Show(!bDropDown && bCondTxtFld);
+ aValueFT.Show(!bDropDown && !bCondTxtFld);
+ aValueED.Show(!bDropDown && !bCondTxtFld);
+ aMacroBT.Show(!bDropDown);
+ aNameED.Show(!bDropDown);
+ aNameFT.Show(!bDropDown);
+
+ aListItemFT.Show(bDropDown);
+ aListItemED.Show(bDropDown);
+ aListAddPB.Show(bDropDown);
+ aListItemsFT.Show(bDropDown);
+ aListItemsLB.Show(bDropDown);
+ aListRemovePB.Show(bDropDown);
+ aListUpPB.Show(bDropDown);
+ aListDownPB.Show(bDropDown);
+ aListNameFT.Show(bDropDown);
+ aListNameED.Show(bDropDown);
+
+ aNameED.SetDropEnable(FALSE);
+
+ if (IsFldEdit())
+ {
+ if(bDropDown)
+ {
+ const SwDropDownField* pDrop = (const SwDropDownField*)GetCurField();
+ uno::Sequence<OUString> aItems = pDrop->GetItemSequence();
+ const OUString* pArray = aItems.getConstArray();
+ aListItemsLB.Clear();
+ for(sal_Int32 i = 0; i < aItems.getLength(); i++)
+ aListItemsLB.InsertEntry(pArray[i]);
+ aListItemsLB.SelectEntry(pDrop->GetSelectedItem());
+ aListNameED.SetText(pDrop->GetPar2());
+ aListNameED.SaveValue();
+ bDropDownLBChanged = false;
+ }
+ else
+ {
+ aNameED.SetText(GetCurField()->GetPar1());
+ aValueED.SetText(GetCurField()->GetPar2());
+ }
+ }
+ else
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+ if(bDropDown)
+ ListEnableHdl(0);
+
+ if( aNameFT.GetText() != sOldNameFT )
+ aNameFT.SetText(sOldNameFT);
+ if (aValueFT.GetText() != sOldValueFT)
+ aValueFT.SetText(sOldValueFT);
+
+ switch (nTypeId)
+ {
+ case TYP_MACROFLD:
+ bMacro = TRUE;
+ if (GetFldMgr().GetMacroPath().Len())
+ bValue = TRUE;
+ else
+ bInsert = FALSE;
+
+ aNameFT.SetText(SW_RESSTR(STR_MACNAME));
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ aNameED.SetText(GetFldMgr().GetMacroName());
+ break;
+
+ case TYP_HIDDENPARAFLD:
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ bName = TRUE;
+ break;
+
+ case TYP_HIDDENTXTFLD:
+ {
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ aValueFT.SetText(SW_RESSTR(STR_INSTEXT));
+ SwWrtShell* pSh = GetActiveWrtShell();
+ if (!IsFldEdit() && pSh )
+ aValueED.SetText(pSh->GetSelTxt());
+ bName = bValue = TRUE;
+ }
+ break;
+
+ case TYP_CONDTXTFLD:
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ if (IsFldEdit())
+ {
+ aCond1ED.SetText(GetCurField()->GetPar2().GetToken(0, '|'));
+ aCond2ED.SetText(GetCurField()->GetPar2().GetToken(1, '|'));
+ }
+
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_JUMPEDITFLD:
+ aNameFT.SetText(SW_RESSTR(STR_JUMPEDITFLD));
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_INPUTFLD:
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ bValue = TRUE;
+ // bShowSelection = TRUE;
+ break;
+
+ case TYP_COMBINED_CHARS:
+ {
+ aNameFT.SetText(SW_RESSTR(STR_COMBCHRS_FT));
+ aNameED.SetDropEnable(TRUE);
+ bName = TRUE;
+
+ const USHORT nLen = aNameED.GetText().Len();
+ if( !nLen || nLen > MAX_COMBINED_CHARACTERS )
+ bInsert = FALSE;
+ }
+ break;
+ case TYP_DROPDOWN :
+ break;
+ default:
+ break;
+ }
+
+ if (bShowSelection)
+ {
+ aSelectionLB.Show();
+ aSelectionFT.Show();
+ aFormatLB.Hide();
+ aFormatFT.Hide();
+ }
+ else
+ {
+ aFormatLB.Show();
+ aFormatFT.Show();
+ aSelectionLB.Hide();
+ aSelectionFT.Hide();
+ }
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+ aNameFT.Enable(bName);
+ aNameED.Enable(bName);
+ aValueFT.Enable(bValue);
+ aValueED.Enable(bValue);
+ aMacroBT.Enable(bMacro);
+
+ EnableInsert( bInsert );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, SelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if( TYP_MACROFLD == nTypeId )
+ aNameED.SetText( aSelectionLB.GetSelectEntry() );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, InsertMacroHdl, ListBox *, EMPTYARG )
+{
+ SelectHdl();
+ InsertHdl();
+
+ return 0;
+}
+/* -----------------16.06.2003 16:24-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwFldFuncPage, ListModifyHdl, Control*, pControl)
+{
+ aListItemsLB.SetUpdateMode(FALSE);
+ if(pControl == &aListAddPB ||
+ (pControl == &aListItemED && aListAddPB.IsEnabled()))
+ {
+ String sEntry(aListItemED.GetText());
+ aListItemsLB.InsertEntry(sEntry);
+ aListItemsLB.SelectEntry(sEntry);
+ }
+ else if(aListItemsLB.GetSelectEntryCount())
+ {
+ USHORT nSelPos = aListItemsLB.GetSelectEntryPos();
+ if(pControl == &aListRemovePB)
+ {
+ aListItemsLB.RemoveEntry(nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos ? nSelPos - 1 : 0);
+ }
+ else if(pControl == &aListUpPB)
+ {
+ if(nSelPos)
+ {
+ String sEntry = aListItemsLB.GetSelectEntry();
+ aListItemsLB.RemoveEntry(nSelPos);
+ nSelPos--;
+ aListItemsLB.InsertEntry(sEntry, nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos);
+ }
+ }
+ else if(pControl == &aListDownPB)
+ {
+ if(nSelPos < aListItemsLB.GetEntryCount() - 1)
+ {
+ String sEntry = aListItemsLB.GetSelectEntry();
+ aListItemsLB.RemoveEntry(nSelPos);
+ nSelPos++;
+ aListItemsLB.InsertEntry(sEntry, nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos);
+ }
+ }
+ }
+ bDropDownLBChanged = true;
+ aListItemsLB.SetUpdateMode(TRUE);
+ ListEnableHdl(0);
+ return 0;
+}
+/* -----------------17.06.2003 08:36-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwFldFuncPage, ListEnableHdl, void*, EMPTYARG)
+{
+ //enable "Add" button when text is in the Edit that's not already member of the box
+ aListAddPB.Enable(aListItemED.GetText().Len() &&
+ LISTBOX_ENTRY_NOTFOUND == aListItemsLB.GetEntryPos(aListItemED.GetText()));
+ BOOL bEnableButtons = aListItemsLB.GetSelectEntryCount() > 0;
+ aListRemovePB.Enable(bEnableButtons);
+ aListUpPB.Enable(bEnableButtons && (aListItemsLB.GetSelectEntryPos() > 0));
+ aListDownPB.Enable(bEnableButtons &&
+ (aListItemsLB.GetSelectEntryPos() < (aListItemsLB.GetEntryCount() - 1)));
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in der SelectionBox erneuern
+ --------------------------------------------------------------------*/
+
+
+void SwFldFuncPage::UpdateSubType()
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ USHORT nCount = aLst.Count();
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ USHORT nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+
+ BOOL bEnable = nCount != 0;
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if (bEnable)
+ {
+ aSelectionLB.SelectEntryPos(0);
+ }
+
+ if (nTypeId == TYP_MACROFLD)
+ {
+ BOOL bHasMacro = GetFldMgr().GetMacroPath().Len() != 0;
+
+ if (bHasMacro)
+ {
+ aNameED.SetText(GetFldMgr().GetMacroName());
+ aValueFT.Enable();
+ aValueED.Enable();
+ }
+ EnableInsert(bHasMacro);
+ }
+
+ aSelectionLB.SetUpdateMode(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: MacroBrowser aufrufen, Listbox mit Macros fuellen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, MacroHdl, Button *, pBtn )
+{
+ Window* pDefModalDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+
+ String sMacro(TurnMacroString(aNameED.GetText()));
+ while (sMacro.SearchAndReplace('.', ';') != STRING_NOTFOUND) ;
+
+ if (GetFldMgr().ChooseMacro(sMacro))
+ UpdateSubType();
+
+ Application::SetDefDialogParent( pDefModalDlgParent );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldFuncPage::FillItemSet(SfxItemSet& )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ USHORT nSubType = 0;
+
+ ULONG nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ switch(nTypeId)
+ {
+ case TYP_INPUTFLD:
+ nSubType = INP_TXT;
+ // to prevent removal of CR/LF restore old content
+ if(!aNameED.IsModified() && IsFldEdit())
+ aName = GetCurField()->GetPar1();
+
+ break;
+
+ case TYP_MACROFLD:
+ // use the full script URL, not the name in the Edit control
+ aName = GetFldMgr().GetMacroPath();
+ break;
+
+ case TYP_CONDTXTFLD:
+ aVal = aCond1ED.GetText();
+ aVal += '|';
+ aVal += aCond2ED.GetText();
+ break;
+ case TYP_DROPDOWN :
+ {
+ aName = aListNameED.GetText();
+ for(USHORT i = 0; i < aListItemsLB.GetEntryCount(); i++)
+ {
+ if(i)
+ aVal += DB_DELIM;
+ aVal += aListItemsLB.GetEntry(i);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aCond1ED.GetSavedValue() != aCond1ED.GetText() ||
+ aCond2ED.GetSavedValue() != aCond2ED.GetText() ||
+ aListNameED.GetSavedValue() != aListNameED.GetText() ||
+ bDropDownLBChanged ||
+ nOldFormat != nFormat)
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat );
+ }
+
+ ModifyHdl(); // Insert ggf enablen/disablen
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+String SwFldFuncPage::TurnMacroString(const String &rMacro)
+{
+ if (rMacro.Len())
+ {
+ // Inhalt von aName umdrehen
+ String sTmp, sBuf;
+ USHORT nPos = 0;
+
+ for (USHORT i = 0; i < 4 && nPos != STRING_NOTFOUND; i++)
+ {
+ if (i == 3)
+ sTmp = rMacro.Copy(nPos);
+ else
+ sTmp = rMacro.GetToken(0, '.', nPos);
+
+ if( sBuf.Len() )
+ sTmp += '.';
+ sBuf.Insert( sTmp, 0 );
+ }
+ return sBuf;
+ }
+
+ return rMacro;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldFuncPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldFuncPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldFuncPage::GetGroup()
+{
+ return GRP_FKT;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldFuncPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+IMPL_LINK( SwFldFuncPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String aName(aNameED.GetText());
+ const USHORT nLen = aName.Len();
+
+ BOOL bEnable = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if( TYP_COMBINED_CHARS == nTypeId &&
+ (!nLen || nLen > MAX_COMBINED_CHARACTERS ))
+ bEnable = FALSE;
+
+ EnableInsert( bEnable );
+
+ return 0;
+}
+
+
+
+
diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx
new file mode 100644
index 000000000000..7a63385a5935
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDFUNC_HXX
+#define _SWFLDFUNC_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+
+#include "condedit.hxx"
+#include "fldpage.hxx"
+#include <actctrl.hxx>
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldFuncPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ FixedText aNameFT;
+ ConditionEdit aNameED;
+ FixedText aValueFT;
+ Edit aValueED;
+ FixedText aCond1FT;
+ ConditionEdit aCond1ED;
+ FixedText aCond2FT;
+ ConditionEdit aCond2ED;
+ PushButton aMacroBT;
+
+ //controls of "Input list"
+ FixedText aListItemFT;
+ ReturnActionEdit aListItemED;
+ PushButton aListAddPB;
+ FixedText aListItemsFT;
+ ListBox aListItemsLB;
+ PushButton aListRemovePB;
+ PushButton aListUpPB;
+ PushButton aListDownPB;
+ FixedText aListNameFT;
+ Edit aListNameED;
+
+ String sOldValueFT;
+ String sOldNameFT;
+
+ ULONG nOldFormat;
+ bool bDropDownLBChanged;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SelectHdl, ListBox* pLB = 0 );
+ DECL_LINK( InsertMacroHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pEd = 0 );
+ DECL_LINK( ListModifyHdl, Control*);
+ DECL_LINK( ListEnableHdl, void*);
+
+ // Macro ausw„hlen
+ DECL_LINK( MacroHdl, Button * );
+
+ void UpdateSubType();
+ String TurnMacroString(const String &rMacro);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldFuncPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldFuncPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldfunc.src b/sw/source/ui/fldui/fldfunc.src
new file mode 100644
index 000000000000..312299fac02d
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.src
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_FUNC
+{
+ HelpID = HID_FLD_FUNC ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_FUNCTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_FUNCTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_FUNCSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Hide = TRUE ;
+ Left = TRUE ;
+ };
+ ListBox LB_FUNCSELECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_FUNCFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_FUNCFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_FUNCNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_FUNCNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_FUNCVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 30 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Left = TRUE ;
+ };
+ Edit ED_FUNCVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 41 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_FUNCCOND1
+ {
+ Pos = MAP_APPFONT ( 170 , 30 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Then" ;
+ };
+ Edit ED_FUNCCOND1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 41 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_FUNCCOND2
+ {
+ Pos = MAP_APPFONT ( 170 , 57 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Else" ;
+ };
+ Edit ED_FUNCCOND2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 68 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BT_FUNCMACRO
+ {
+ Pos = MAP_APPFONT ( 204 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Macro..." ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LISTITEM
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Ite~m" ;
+ };
+ Edit ED_LISTITEM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE;
+ };
+ PushButton PB_LISTADD
+ {
+ Pos = MAP_APPFONT ( 170 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Add" ;
+ };
+ FixedText FT_LISTITEMS
+ {
+ Pos = MAP_APPFONT ( 170 , 46 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Items on ~list" ;
+ };
+ ListBox LB_LISTITEMS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 57 ) ;
+ Size = MAP_APPFONT ( 83 , 44 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ PushButton PB_LISTREMOVE
+ {
+ Pos = MAP_APPFONT ( 203 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Remove" ;
+ };
+ PushButton PB_LISTUP
+ {
+ Pos = MAP_APPFONT ( 203 , 121 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Move ~Up" ;
+ };
+ PushButton PB_LISTDOWN
+ {
+ Pos = MAP_APPFONT ( 203 , 138 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Move Do~wn" ;
+ };
+ FixedText FT_LISTNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 156 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_LISTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE;
+ };
+ Text [ en-US ] = "Functions" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
new file mode 100644
index 000000000000..3499c8875093
--- /dev/null
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -0,0 +1,1793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <cmdid.h>
+#include <hintids.hxx>
+#include <svl/stritem.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/unolingu.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+#include <editeng/langitem.hxx>
+#include <svl/macitem.hxx>
+#include <basic/sbmod.hxx>
+#include <fmtrfmrk.hxx>
+#include <basic/sbmeth.hxx>
+#include <basic/sbx.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <vcl/mnemonic.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx> // Actives Fenster
+#include <doc.hxx> // Actives Fenster
+#include <docsh.hxx> // Actives Fenster
+#include <swmodule.hxx>
+#include <charatr.hxx>
+#include <fmtinfmt.hxx>
+#include <cellatr.hxx>
+#include <dbmgr.hxx>
+#include <shellres.hxx>
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#include <chpfld.hxx>
+#include <ddefld.hxx>
+#include <expfld.hxx>
+#include <reffld.hxx>
+#include <usrfld.hxx>
+#include <dbfld.hxx>
+#include <authfld.hxx>
+#include <flddat.hxx>
+#include <fldmgr.hxx>
+#include <crsskip.hxx>
+#include <flddropdown.hxx>
+#include <fldui.hrc>
+#include <tox.hxx>
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::text;
+using namespace com::sun::star::style;
+using namespace com::sun::star::sdbc;
+using namespace ::com::sun::star;
+using namespace nsSwDocInfoSubType;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Gruppen der Felder
+ --------------------------------------------------------------------*/
+enum
+{
+ GRP_DOC_BEGIN = 0,
+ GRP_DOC_END = GRP_DOC_BEGIN + 11,
+
+ GRP_FKT_BEGIN = GRP_DOC_END,
+ GRP_FKT_END = GRP_FKT_BEGIN + 8,
+
+ GRP_REF_BEGIN = GRP_FKT_END,
+ GRP_REF_END = GRP_REF_BEGIN + 2,
+
+ GRP_REG_BEGIN = GRP_REF_END,
+ GRP_REG_END = GRP_REG_BEGIN + 1,
+
+ GRP_DB_BEGIN = GRP_REG_END,
+ GRP_DB_END = GRP_DB_BEGIN + 5,
+
+ GRP_VAR_BEGIN = GRP_DB_END,
+ GRP_VAR_END = GRP_VAR_BEGIN + 9
+};
+
+enum
+{
+ GRP_WEB_DOC_BEGIN = 0,
+ GRP_WEB_DOC_END = GRP_WEB_DOC_BEGIN + 9,
+
+ GRP_WEB_FKT_BEGIN = GRP_WEB_DOC_END + 2,
+ GRP_WEB_FKT_END = GRP_WEB_FKT_BEGIN + 0, // Die Gruppe ist leer!
+
+ GRP_WEB_REF_BEGIN = GRP_WEB_FKT_END + 6, // Die Gruppe ist leer!
+ GRP_WEB_REF_END = GRP_WEB_REF_BEGIN + 0,
+
+ GRP_WEB_REG_BEGIN = GRP_WEB_REF_END + 2,
+ GRP_WEB_REG_END = GRP_WEB_REG_BEGIN + 1,
+
+ GRP_WEB_DB_BEGIN = GRP_WEB_REG_END, // Die Gruppe ist leer!
+ GRP_WEB_DB_END = GRP_WEB_DB_BEGIN + 0,
+
+ GRP_WEB_VAR_BEGIN = GRP_WEB_DB_END + 5,
+ GRP_WEB_VAR_END = GRP_WEB_VAR_BEGIN + 1
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Formate in der richtigen Reihenfolge
+ --------------------------------------------------------------------*/
+static const USHORT __FAR_DATA aSetFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_SETVAR_???
+// uebereinstimmen
+ 0,
+ 0
+};
+
+static const USHORT __FAR_DATA aGetFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_GETVAR_???
+// uebereinstimmen
+ 0
+};
+
+static const USHORT __FAR_DATA aUsrFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_SETVAR_???
+// uebereinstimmen
+ 0,
+ nsSwExtendedSubType::SUB_CMD
+};
+
+static const USHORT __FAR_DATA aDBFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_DBFLD_???
+// uebereinstimmen
+ nsSwExtendedSubType::SUB_OWN_FMT
+};
+
+static const USHORT VF_COUNT = sizeof(aGetFmt) / sizeof(USHORT);
+static const USHORT VF_USR_COUNT = sizeof(aUsrFmt) / sizeof(USHORT);
+static const USHORT VF_DB_COUNT = sizeof(aDBFmt) / sizeof(USHORT);
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen und Subtypes
+ --------------------------------------------------------------------*/
+struct SwFldPack
+{
+ USHORT nTypeId;
+
+ USHORT nSubTypeStart;
+ USHORT nSubTypeEnd;
+
+ ULONG nFmtBegin;
+ ULONG nFmtEnd;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings und Formate
+ --------------------------------------------------------------------*/
+static const SwFldPack __FAR_DATA aSwFlds[] =
+{
+ // Dokument
+ { TYP_EXTUSERFLD, FLD_EU_BEGIN, FLD_EU_END, 0, 0 },
+ { TYP_AUTHORFLD, 0, 0, FMT_AUTHOR_BEGIN, FMT_AUTHOR_END },
+ { TYP_DATEFLD, FLD_DATE_BEGIN, FLD_DATE_END, 0, 0 },
+ { TYP_TIMEFLD, FLD_TIME_BEGIN, FLD_TIME_END, 0, 0 },
+ { TYP_PAGENUMBERFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+ { TYP_NEXTPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END },
+ { TYP_PREVPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END },
+ { TYP_FILENAMEFLD, 0, 0, FMT_FF_BEGIN, FMT_FF_END },
+ { TYP_DOCSTATFLD, FLD_STAT_BEGIN, FLD_STAT_END, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+
+ { TYP_CHAPTERFLD, 0, 0, FMT_CHAPTER_BEGIN, FMT_CHAPTER_END },
+ { TYP_TEMPLNAMEFLD, 0, 0, FMT_FF_BEGIN, FMT_FF_END },
+
+ // Funktion
+ { TYP_CONDTXTFLD, 0, 0, 0, 0 },
+ { TYP_DROPDOWN, 0, 0, 0, 0 },
+ { TYP_INPUTFLD, FLD_INPUT_BEGIN, FLD_INPUT_END, 0, 0 },
+ { TYP_MACROFLD, 0, 0, 0, 0 },
+ { TYP_JUMPEDITFLD, 0, 0, FMT_MARK_BEGIN, FMT_MARK_END },
+ { TYP_COMBINED_CHARS, 0, 0, 0, 0 },
+ { TYP_HIDDENTXTFLD, 0, 0, 0, 0 },
+ { TYP_HIDDENPARAFLD, 0, 0, 0, 0 },
+
+ // Referenzen
+ { TYP_SETREFFLD, 0, 0, 0, 0 },
+ { TYP_GETREFFLD, 0, 0, FMT_REF_BEGIN, FMT_REF_END },
+
+ // Ablage
+ { TYP_DOCINFOFLD, 0, 0, FMT_REG_BEGIN, FMT_REG_END },
+
+ // Datenbank
+ { TYP_DBFLD, 0, 0, FMT_DBFLD_BEGIN, FMT_DBFLD_END },
+ { TYP_DBNEXTSETFLD, 0, 0, 0, 0 },
+ { TYP_DBNUMSETFLD, 0, 0, 0, 0 },
+ { TYP_DBSETNUMBERFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-2 },
+ { TYP_DBNAMEFLD, 0, 0, 0, 0 },
+
+ // Variablen
+ { TYP_SETFLD, 0, 0, FMT_SETVAR_BEGIN, FMT_SETVAR_END },
+
+ { TYP_GETFLD, 0, 0, FMT_GETVAR_BEGIN, FMT_GETVAR_END },
+ { TYP_DDEFLD, 0, 0, FMT_DDE_BEGIN, FMT_DDE_END },
+ { TYP_FORMELFLD, 0, 0, FMT_GETVAR_BEGIN, FMT_GETVAR_END },
+ { TYP_INPUTFLD, FLD_INPUT_BEGIN, FLD_INPUT_END, 0, 0 },
+ { TYP_SEQFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-2 },
+ { TYP_SETREFPAGEFLD, FLD_PAGEREF_BEGIN, FLD_PAGEREF_END,0, 0 },
+ { TYP_GETREFPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+ { TYP_USERFLD, 0, 0, FMT_USERVAR_BEGIN, FMT_USERVAR_END }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff auf die Shell
+ --------------------------------------------------------------------*/
+
+static SwWrtShell* lcl_GetShell()
+{
+ SwView* pView;
+ if ( 0 != (pView = ::GetActiveView()) )
+ return pView->GetWrtShellPtr();
+ DBG_ERROR("no current shell found!");
+ return 0;
+}
+
+inline USHORT GetPackCount() { return sizeof(aSwFlds) / sizeof(SwFldPack); }
+
+/*--------------------------------------------------------------------
+ Beschreibung: FieldManager regelt das Einfuegen und Updaten
+ von Feldern
+ --------------------------------------------------------------------*/
+
+SwFldMgr::SwFldMgr(SwWrtShell* pSh ) :
+ pModule(0),
+ pMacroItem(0),
+ pWrtShell(pSh),
+ bEvalExp(TRUE)
+{
+ // aktuelles Feld ermitteln falls vorhanden
+ GetCurFld();
+}
+
+
+SwFldMgr::~SwFldMgr()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: RefMark ueber Namen organisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::CanInsertRefMark( const String& rStr )
+{
+ BOOL bRet = FALSE;
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ {
+ USHORT nCnt = pSh->GetCrsrCnt();
+
+ // der letzte Crsr muss keine aufgespannte Selektion
+ if( 1 < nCnt && !pSh->SwCrsrShell::HasSelection() )
+ --nCnt;
+
+ bRet = 2 > nCnt && 0 == pSh->GetRefMark( rStr );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff ueber ResIds
+ --------------------------------------------------------------------*/
+
+void SwFldMgr::RemoveFldType(USHORT nResId, const String& rName )
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if( pSh )
+ pSh->RemoveFldType(nResId, rName);
+}
+
+USHORT SwFldMgr::GetFldTypeCount(USHORT nResId) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldTypeCount(nResId) : 0;
+}
+
+
+SwFieldType* SwFldMgr::GetFldType(USHORT nResId, USHORT nId) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldType(nId, nResId) : 0;
+}
+
+
+SwFieldType* SwFldMgr::GetFldType(USHORT nResId, const String& rName) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldType(nResId, rName) : 0;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelles Feld ermitteln
+ --------------------------------------------------------------------*/
+SwField* SwFldMgr::GetCurFld()
+{
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if ( pSh )
+ pCurFld = pSh->GetCurFld();
+ else
+ pCurFld = NULL;
+
+ // Strings und Format initialisieren
+ //
+ aCurPar1.Erase();
+ aCurPar2.Erase();
+ sCurFrame.Erase();
+ nCurFmt = 0;
+
+ if(!pCurFld)
+ return 0;
+
+ // Aktuelle Werte aufbereiten Parameter 1 und Parameter 2
+ // als auch das Format ermitteln
+ //
+ const USHORT nTypeId = pCurFld->GetTypeId();
+
+ nCurFmt = pCurFld->GetFormat();
+ aCurPar1 = pCurFld->GetPar1();
+ aCurPar2 = pCurFld->GetPar2();
+
+ switch( nTypeId )
+ {
+ case TYP_PAGENUMBERFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_GETREFPAGEFLD:
+ if( nCurFmt == SVX_NUM_PAGEDESC )
+ nCurFmt -= 2;
+ break;
+ }
+ return pCurFld;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Gruppen-Bereich liefern
+ --------------------------------------------------------------------*/
+
+
+const SwFldGroupRgn& SwFldMgr::GetGroupRange(BOOL bHtmlMode, USHORT nGrpId) const
+{
+static SwFldGroupRgn __READONLY_DATA aRanges[] =
+{
+ { /* Dokument */ GRP_DOC_BEGIN, GRP_DOC_END },
+ { /* Funktionen */ GRP_FKT_BEGIN, GRP_FKT_END },
+ { /* Referenzen */ GRP_REF_BEGIN, GRP_REF_END },
+ { /* Ablage */ GRP_REG_BEGIN, GRP_REG_END },
+ { /* DB */ GRP_DB_BEGIN, GRP_DB_END },
+ { /* User */ GRP_VAR_BEGIN, GRP_VAR_END }
+};
+static SwFldGroupRgn __READONLY_DATA aWebRanges[] =
+{
+ { /* Dokument */ GRP_WEB_DOC_BEGIN, GRP_WEB_DOC_END },
+ { /* Funktionen */ GRP_WEB_FKT_BEGIN, GRP_WEB_FKT_END },
+ { /* Referenzen */ GRP_WEB_REF_BEGIN, GRP_WEB_REF_END },
+ { /* Ablage */ GRP_WEB_REG_BEGIN, GRP_WEB_REG_END },
+ { /* DB */ GRP_WEB_DB_BEGIN, GRP_WEB_DB_END },
+ { /* User */ GRP_WEB_VAR_BEGIN, GRP_WEB_VAR_END }
+};
+
+ if (bHtmlMode)
+ return aWebRanges[(USHORT)nGrpId];
+ else
+ return aRanges[(USHORT)nGrpId];
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: GroupId bestimmen
+ --------------------------------------------------------------------*/
+
+USHORT SwFldMgr::GetGroup(BOOL bHtmlMode, USHORT nTypeId, USHORT nSubType) const
+{
+ if (nTypeId == TYP_SETINPFLD)
+ nTypeId = TYP_SETFLD;
+
+ if (nTypeId == TYP_INPUTFLD && (nSubType & INP_USR))
+ nTypeId = TYP_USERFLD;
+
+ if (nTypeId == TYP_FIXDATEFLD)
+ nTypeId = TYP_DATEFLD;
+
+ if (nTypeId == TYP_FIXTIMEFLD)
+ nTypeId = TYP_TIMEFLD;
+
+ for (USHORT i = GRP_DOC; i <= GRP_VAR; i++)
+ {
+ const SwFldGroupRgn& rRange = GetGroupRange(bHtmlMode, i);
+ for (USHORT nPos = rRange.nStart; nPos < rRange.nEnd; nPos++)
+ {
+ if (aSwFlds[nPos].nTypeId == nTypeId)
+ return i;
+ }
+ }
+ return USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Namen zur TypeId ermitteln
+ ZUGRIFF ueber TYP_....
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetTypeId(USHORT nPos)
+{
+ ASSERT(nPos < ::GetPackCount(), "unzulaessige Pos");
+ return aSwFlds[ nPos ].nTypeId;
+}
+
+
+const String& SwFldMgr::GetTypeStr(USHORT nPos)
+{
+ ASSERT(nPos < ::GetPackCount(), "unzulaessige TypeId");
+
+ USHORT nFldWh = aSwFlds[ nPos ].nTypeId;
+
+ // Sonderbehandlung fuer Datum/Zeit Felder (ohne var/fix)
+ if( TYP_DATEFLD == nFldWh )
+ {
+ static String g_aDate( SW_RES( STR_DATEFLD ) );
+ return g_aDate;
+ }
+ if( TYP_TIMEFLD == nFldWh )
+ {
+ static String g_aTime( SW_RES( STR_TIMEFLD ) );
+ return g_aTime;
+ }
+
+ return SwFieldType::GetTypeStr( nFldWh );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pos in der Liste bestimmen
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetPos(USHORT nTypeId)
+{
+ switch( nTypeId )
+ {
+ case TYP_FIXDATEFLD: nTypeId = TYP_DATEFLD; break;
+ case TYP_FIXTIMEFLD: nTypeId = TYP_TIMEFLD; break;
+ case TYP_SETINPFLD: nTypeId = TYP_SETFLD; break;
+ case TYP_USRINPFLD: nTypeId = TYP_USERFLD; break;
+ }
+
+ for(USHORT i = 0; i < GetPackCount(); i++)
+ if(aSwFlds[i].nTypeId == nTypeId)
+ return i;
+
+ return USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Subtypen eines Feldes lokalisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::GetSubTypes(USHORT nTypeId, SvStringsDtor& rToFill)
+{
+ BOOL bRet = FALSE;
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ {
+ const USHORT nPos = GetPos(nTypeId);
+
+ switch(nTypeId)
+ {
+ case TYP_SETREFFLD:
+ case TYP_GETREFFLD:
+ {
+ // Referenzen sind keine Felder
+ pSh->GetRefMarks( &rToFill );
+ break;
+ }
+ case TYP_MACROFLD:
+ {
+ break;
+ }
+ case TYP_INPUTFLD:
+ { String* pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart);
+ rToFill.Insert(pNew, rToFill.Count());
+ // Weiter bei generischen Typen
+ }
+ case TYP_DDEFLD:
+ case TYP_SEQFLD:
+ case TYP_FORMELFLD:
+ case TYP_GETFLD:
+ case TYP_SETFLD:
+ case TYP_USERFLD:
+ {
+
+ const USHORT nCount = pSh->GetFldTypeCount();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ SwFieldType* pFldType = pSh->GetFldType( i );
+ const USHORT nWhich = pFldType->Which();
+
+ if((nTypeId == TYP_DDEFLD && pFldType->Which() == RES_DDEFLD) ||
+
+ (nTypeId == TYP_USERFLD && nWhich == RES_USERFLD) ||
+
+ (nTypeId == TYP_GETFLD && nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ (nTypeId == TYP_SETFLD && nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ (nTypeId == TYP_SEQFLD && nWhich == RES_SETEXPFLD &&
+ (((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ ((nTypeId == TYP_INPUTFLD || nTypeId == TYP_FORMELFLD) &&
+ (nWhich == RES_USERFLD ||
+ nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ) )
+ {
+ String* pNew = new String(pFldType->GetName());
+ rToFill.Insert(pNew, rToFill.Count());
+ }
+ }
+ break;
+ }
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBNAMEFLD:
+ case TYP_DBSETNUMBERFLD:
+ break;
+
+ default:
+ {
+ // statische SubTypes
+ if(nPos != USHRT_MAX)
+ {
+ USHORT nCount;
+ if (nTypeId == TYP_DOCINFOFLD)
+ nCount = DI_SUBTYPE_END - DI_SUBTYPE_BEGIN;
+ else
+ nCount = aSwFlds[nPos].nSubTypeEnd - aSwFlds[nPos].nSubTypeStart;
+
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ String* pNew;
+ if (nTypeId == TYP_DOCINFOFLD)
+ {
+ if ( i == DI_CUSTOM )
+ pNew = new String( String(SW_RES( STR_CUSTOM )) );
+ else
+ pNew = new String(*ViewShell::GetShellRes()->aDocInfoLst[i]);
+ }
+ else
+ pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart + i);
+
+ rToFill.Insert(pNew, rToFill.Count());
+ }
+ }
+ }
+ }
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Format ermitteln
+ ZUGRIFF ueber TYP_....
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetFormatCount(USHORT nTypeId, BOOL bIsText, BOOL bHtmlMode) const
+{
+ ASSERT(nTypeId < TYP_END, "unzulaessige TypeId");
+
+ {
+ const USHORT nPos = GetPos(nTypeId);
+
+ if(nPos == USHRT_MAX || (bHtmlMode && nTypeId == TYP_SETFLD))
+ return 0;
+
+ ULONG nStart = aSwFlds[nPos].nFmtBegin;
+ ULONG nEnd = aSwFlds[nPos].nFmtEnd;
+
+ if (bIsText && nEnd - nStart >= 2)
+ return 2;
+
+ if (nTypeId == TYP_FILENAMEFLD)
+ nEnd -= 2; // Kein Bereich oder Vorlage
+
+ switch(nStart)
+ {
+ case FMT_GETVAR_BEGIN:
+ case FMT_SETVAR_BEGIN: return VF_COUNT;
+ case FMT_USERVAR_BEGIN: return VF_USR_COUNT;
+ case FMT_DBFLD_BEGIN: return VF_DB_COUNT;
+ case FMT_NUM_BEGIN:
+ {
+ USHORT nCount = (USHORT)(nEnd - nStart);
+ GetNumberingInfo();
+ if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ //skip all values below or equal to CHARS_LOWER_LETTER_N
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ // #i28073# it's not necessarily a sorted sequence
+ ++nCount;
+ }
+ }
+ }
+ return nCount;
+ }
+
+ }
+ return (USHORT)(nEnd - nStart);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FormatString zu einem Typ ermitteln
+ --------------------------------------------------------------------*/
+
+
+String SwFldMgr::GetFormatStr(USHORT nTypeId, ULONG nFormatId) const
+{
+ String aRet;
+ ASSERT(nTypeId < TYP_END, "unzulaessige TypeId");
+
+ const USHORT nPos = GetPos(nTypeId);
+
+ if(nPos == USHRT_MAX)
+ return aRet;
+
+ ULONG nStart;
+
+ nStart = aSwFlds[nPos].nFmtBegin;
+
+ if (TYP_AUTHORFLD == nTypeId|| TYP_FILENAMEFLD == nTypeId)
+ nFormatId &= ~FF_FIXED; // Fixed-Flag ausmaskieren
+
+ if((nStart + nFormatId) < aSwFlds[nPos].nFmtEnd)
+ aRet = SW_RESSTR((USHORT)(nStart + nFormatId));
+ else if( FMT_NUM_BEGIN == nStart)
+ {
+ if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ sal_Int32 nOffset = aSwFlds[nPos].nFmtEnd - nStart;
+ sal_Int32 nValidEntry = 0;
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ if(nValidEntry == ((sal_Int32)nFormatId) - nOffset)
+ {
+ aRet = xNumberingInfo->getNumberingIdentifier( pTypes[nType] );
+ break;
+ }
+ ++nValidEntry;
+ }
+ }
+ }
+ }
+
+ return aRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FormatId aus Pseudo-ID ermitteln
+ --------------------------------------------------------------------*/
+
+USHORT SwFldMgr::GetFormatId(USHORT nTypeId, ULONG nFormatId) const
+{
+ USHORT nId = (USHORT)nFormatId;
+
+ switch( nTypeId )
+ {
+ case TYP_DOCINFOFLD:
+ switch( aSwFlds[ GetPos( nTypeId ) ].nFmtBegin + nFormatId )
+ {
+ case FMT_REG_AUTHOR: nId = DI_SUB_AUTHOR; break;
+ case FMT_REG_TIME: nId = DI_SUB_TIME; break;
+ case FMT_REG_DATE: nId = DI_SUB_DATE; break;
+ }
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_DOCSTATFLD:
+ case TYP_DBSETNUMBERFLD:
+ case TYP_SEQFLD:
+ case TYP_GETREFPAGEFLD:
+ {
+ USHORT nPos = GetPos( nTypeId );
+ ULONG nBegin = aSwFlds[ nPos ].nFmtBegin;
+ ULONG nEnd = aSwFlds[nPos].nFmtEnd;
+ if((nBegin + nFormatId) < nEnd)
+ {
+ switch( nBegin + nFormatId )
+ {
+ case FMT_NUM_ABC: nId = SVX_NUM_CHARS_UPPER_LETTER; break;
+ case FMT_NUM_SABC: nId = SVX_NUM_CHARS_LOWER_LETTER; break;
+ case FMT_NUM_ROMAN: nId = SVX_NUM_ROMAN_UPPER; break;
+ case FMT_NUM_SROMAN: nId = SVX_NUM_ROMAN_LOWER; break;
+ case FMT_NUM_ARABIC: nId = SVX_NUM_ARABIC; break;
+ case FMT_NUM_PAGEDESC: nId = SVX_NUM_PAGEDESC; break;
+ case FMT_NUM_PAGESPECIAL: nId = SVX_NUM_CHAR_SPECIAL; break;
+ case FMT_NUM_ABC_N: nId = SVX_NUM_CHARS_UPPER_LETTER_N; break;
+ case FMT_NUM_SABC_N: nId = SVX_NUM_CHARS_LOWER_LETTER_N; break;
+ }
+ }
+ else if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ sal_Int32 nOffset = nEnd - nBegin;
+ sal_Int32 nValidEntry = 0;
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ if(nValidEntry == ((sal_Int32)nFormatId) - nOffset)
+ {
+ nId = pTypes[nType];
+ break;
+ }
+ ++nValidEntry;
+ }
+ }
+ }
+ }
+ break;
+ case TYP_DDEFLD:
+ switch ( aSwFlds[ GetPos( nTypeId ) ].nFmtBegin + nFormatId )
+ {
+ case FMT_DDE_NORMAL: nId = sfx2::LINKUPDATE_ONCALL; break;
+ case FMT_DDE_HOT: nId = sfx2::LINKUPDATE_ALWAYS; break;
+ }
+ break;
+ }
+
+ return nId;
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling
+ --------------------------------------------------------------------*/
+
+
+BOOL SwFldMgr::GoNextPrev( BOOL bNext, SwFieldType* pTyp )
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if(!pSh)
+ return FALSE;
+
+ if( !pTyp && pCurFld )
+ {
+ const USHORT nTypeId = pCurFld->GetTypeId();
+ if( TYP_SETINPFLD == nTypeId || TYP_USRINPFLD == nTypeId )
+ pTyp = pSh->GetFldType( 0, RES_INPUTFLD );
+ else
+ pTyp = pCurFld->GetTyp();
+ }
+
+ if (pTyp && pTyp->Which() == RES_DBFLD)
+ {
+ // Fuer Feldbefehl-bearbeiten (alle DB-Felder anspringen)
+ return pSh->MoveFldType( 0, bNext, USHRT_MAX, RES_DBFLD );
+ }
+
+ return pTyp && pSh ? pSh->MoveFldType( pTyp, bNext ) : FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen einfuegen
+ --------------------------------------------------------------------*/
+
+
+void SwFldMgr::InsertFldType(SwFieldType& rType)
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ pSh->InsertFldType(rType);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelle TypeId ermitteln
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetCurTypeId() const
+{
+ return pCurFld ? pCurFld->GetTypeId() : USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ueber String Feld einfuegen oder Update
+ --------------------------------------------------------------------*/
+
+
+BOOL SwFldMgr::InsertFld( const SwInsertFld_Data& rData )
+{
+ SwField* pFld = 0;
+ BOOL bExp = FALSE;
+ BOOL bTbl = FALSE;
+ BOOL bPageVar = FALSE;
+ ULONG nFormatId = rData.nFormatId;
+ USHORT nSubType = rData.nSubType;
+ sal_Unicode cSeparator = rData.cSeparator;
+ SwWrtShell* pCurShell = rData.pSh;
+ if(!pCurShell)
+ pCurShell = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pCurShell, "no SwWrtShell found");
+ if(!pCurShell)
+ return FALSE;
+
+ switch(rData.nTypeId)
+ { // ACHTUNG dieses Feld wird ueber einen gesonderten Dialog eingefuegt
+ case TYP_POSTITFLD:
+ {
+ SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD);
+ pFld = new SwPostItField(pType, rData.sPar1, rData.sPar2, DateTime());
+ break;
+ }
+ case TYP_SCRIPTFLD:
+ {
+ SwScriptFieldType* pType =
+ (SwScriptFieldType*)pCurShell->GetFldType(0, RES_SCRIPTFLD);
+ pFld = new SwScriptField(pType, rData.sPar1, rData.sPar2, (BOOL)nFormatId);
+ break;
+ }
+ case TYP_COMBINED_CHARS:
+ {
+ SwCombinedCharFieldType* pType = (SwCombinedCharFieldType*)
+ pCurShell->GetFldType( 0, RES_COMBINED_CHARS );
+ pFld = new SwCombinedCharField( pType, rData.sPar1 );
+ }
+ break;
+ case TYP_AUTHORITY:
+ {
+ SwAuthorityFieldType* pType =
+ (SwAuthorityFieldType*)pCurShell->GetFldType(0, RES_AUTHORITY);
+ if(!pType)
+ {
+ pType =
+ (SwAuthorityFieldType*)pCurShell->InsertFldType(
+ SwAuthorityFieldType(pCurShell->GetDoc()));
+ }
+ pFld = new SwAuthorityField(pType, rData.sPar1);
+ }
+ break;
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ {
+ USHORT nSub = static_cast< USHORT >(rData.nTypeId == TYP_DATEFLD ? DATEFLD : TIMEFLD);
+ nSub |= nSubType == DATE_VAR ? 0 : FIXEDFLD;
+
+ SwDateTimeFieldType* pTyp =
+ (SwDateTimeFieldType*)pCurShell->GetFldType(0, RES_DATETIMEFLD);
+ pFld = new SwDateTimeField(pTyp, nSub, nFormatId);
+ pFld->SetPar2(rData.sPar2);
+ break;
+ }
+ case TYP_FILENAMEFLD:
+ {
+ SwFileNameFieldType* pTyp =
+ (SwFileNameFieldType*)pCurShell->GetFldType(0, RES_FILENAMEFLD);
+ pFld = new SwFileNameField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_TEMPLNAMEFLD:
+ {
+ SwTemplNameFieldType* pTyp =
+ (SwTemplNameFieldType*)pCurShell->GetFldType(0, RES_TEMPLNAMEFLD);
+ pFld = new SwTemplNameField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_CHAPTERFLD:
+ {
+ USHORT nByte = (USHORT)rData.sPar2.ToInt32();
+ SwChapterFieldType* pTyp =
+ (SwChapterFieldType*)pCurShell->GetFldType(0, RES_CHAPTERFLD);
+ pFld = new SwChapterField(pTyp, nFormatId);
+ nByte = Max(USHORT(1), nByte);
+ nByte = Min(nByte, USHORT(MAXLEVEL));
+ nByte -= 1;
+ ((SwChapterField*)pFld)->SetLevel((BYTE)nByte);
+ break;
+ }
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ {
+ short nOff = (short)rData.sPar2.ToInt32();
+
+ if(rData.nTypeId == TYP_NEXTPAGEFLD)
+ {
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId )
+ nOff = 1;
+ else
+ nOff += 1;
+ nSubType = PG_NEXT;
+ }
+ else if(rData.nTypeId == TYP_PREVPAGEFLD)
+ {
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId )
+ nOff = -1;
+ else
+ nOff -= 1;
+ nSubType = PG_PREV;
+ }
+ else
+ nSubType = PG_RANDOM;
+
+ SwPageNumberFieldType* pTyp =
+ (SwPageNumberFieldType*)pCurShell->GetFldType(0, RES_PAGENUMBERFLD);
+ pFld = new SwPageNumberField(pTyp, nSubType, nFormatId, nOff);
+
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId &&
+ ( PG_PREV == nSubType || PG_NEXT == nSubType ) )
+ ((SwPageNumberField*)pFld)->SetUserString( rData.sPar2 );
+ break;
+ }
+ case TYP_DOCSTATFLD:
+ { SwDocStatFieldType* pTyp =
+ (SwDocStatFieldType*)pCurShell->GetFldType(0, RES_DOCSTATFLD);
+ pFld = new SwDocStatField(pTyp, nSubType, nFormatId);
+ break;
+ }
+ case TYP_AUTHORFLD:
+ { SwAuthorFieldType* pTyp =
+ (SwAuthorFieldType*)pCurShell->GetFldType(0, RES_AUTHORFLD);
+ pFld = new SwAuthorField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_CONDTXTFLD:
+ case TYP_HIDDENTXTFLD:
+ {
+ SwHiddenTxtFieldType* pTyp =
+ (SwHiddenTxtFieldType*)pCurShell->GetFldType(0, RES_HIDDENTXTFLD);
+ pFld = new SwHiddenTxtField(pTyp, TRUE, rData.sPar1, rData.sPar2, FALSE, rData.nTypeId);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_HIDDENPARAFLD:
+ {
+ SwHiddenParaFieldType* pTyp =
+ (SwHiddenParaFieldType*)pCurShell->GetFldType(0, RES_HIDDENPARAFLD);
+ pFld = new SwHiddenParaField(pTyp, rData.sPar1);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_SETREFFLD:
+ {
+ if( rData.sPar1.Len() > 0 && CanInsertRefMark( rData.sPar1 ) )
+ {
+ pCurShell->SetAttr( SwFmtRefMark( rData.sPar1 ) );
+ return TRUE;
+ }
+ return FALSE;
+ }
+ case TYP_GETREFFLD:
+ {
+ SwGetRefFieldType* pTyp =
+ (SwGetRefFieldType*)pCurShell->GetFldType(0, RES_GETREFFLD);
+ USHORT nSeqNo = (USHORT)rData.sPar2.ToInt32();
+ pFld = new SwGetRefField(pTyp, rData.sPar1, nSubType, nSeqNo, nFormatId);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DDEFLD:
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ String sCmd( rData.sPar2 );
+ USHORT nTmpPos = sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+
+ SwDDEFieldType* pTyp = (SwDDEFieldType*)pCurShell->InsertFldType(
+ SwDDEFieldType( rData.sPar1, sCmd, (USHORT)nFormatId ));
+ pFld = new SwDDEField( pTyp );
+ break;
+ }
+ case TYP_MACROFLD:
+ {
+ SwMacroFieldType* pTyp =
+ (SwMacroFieldType*)pCurShell->GetFldType(0, RES_MACROFLD);
+
+ pFld = new SwMacroField(pTyp, rData.sPar1, rData.sPar2);
+
+ break;
+ }
+ case TYP_INTERNETFLD:
+ {
+ SwFmtINetFmt aFmt( rData.sPar1, sCurFrame );
+ if( pMacroItem )
+ aFmt.SetMacroTbl( &pMacroItem->GetMacroTable() );
+ return pCurShell->InsertURL( aFmt, rData.sPar2 );
+ }
+ case TYP_JUMPEDITFLD:
+ {
+ SwJumpEditFieldType* pTyp =
+ (SwJumpEditFieldType*)pCurShell->GetFldType(0, RES_JUMPEDITFLD);
+
+ pFld = new SwJumpEditField(pTyp, nFormatId, rData.sPar1, rData.sPar2 );
+ break;
+ }
+ case TYP_DOCINFOFLD:
+ {
+ SwDocInfoFieldType* pTyp = (SwDocInfoFieldType*)pCurShell->GetFldType(
+ 0, RES_DOCINFOFLD );
+ pFld = new SwDocInfoField(pTyp, nSubType, rData.sPar1, nFormatId);
+ break;
+ }
+ case TYP_EXTUSERFLD:
+ {
+ SwExtUserFieldType* pTyp = (SwExtUserFieldType*)pCurShell->GetFldType(
+ 0, RES_EXTUSERFLD);
+ pFld = new SwExtUserField(pTyp, nSubType, nFormatId);
+ break;
+ }
+ case TYP_DBFLD:
+ {
+ SwDBData aDBData;
+ String sPar1;
+
+ if (rData.sPar1.Search(DB_DELIM) == STRING_NOTFOUND)
+ {
+ aDBData = pCurShell->GetDBData();
+ sPar1 = rData.sPar1;
+ }
+ else
+ {
+ aDBData.sDataSource = rData.sPar1.GetToken(0, DB_DELIM);
+ aDBData.sCommand = rData.sPar1.GetToken(1, DB_DELIM);
+ aDBData.nCommandType = rData.sPar1.GetToken(2, DB_DELIM).ToInt32();
+ sPar1 = rData.sPar1.GetToken(3, DB_DELIM);
+ }
+
+ if(aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
+ pCurShell->ChgDBData(aDBData);
+
+ SwDBFieldType* pTyp = (SwDBFieldType*)pCurShell->InsertFldType(
+ SwDBFieldType(pCurShell->GetDoc(), sPar1, aDBData) );
+ pFld = new SwDBField(pTyp);
+ pFld->SetSubType(nSubType);
+
+ if( !(nSubType & nsSwExtendedSubType::SUB_OWN_FMT) ) // Datenbankformat ermitteln
+ {
+ Reference< XDataSource> xSource;
+ rData.aDBDataSource >>= xSource;
+ Reference<XConnection> xConnection;
+ rData.aDBConnection >>= xConnection;
+ Reference<XPropertySet> xColumn;
+ rData.aDBColumn >>= xColumn;
+ if(xColumn.is())
+ {
+ nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(xSource, xConnection, xColumn,
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ }
+ else
+ nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(
+ aDBData.sDataSource, aDBData.sCommand, sPar1,
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ }
+ pFld->ChangeFormat( nFormatId );
+
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBSETNUMBERFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNAMEFLD:
+ {
+ USHORT nPos, nTablePos, nCmdTypePos, nExpPos;
+ String sPar1;
+ SwDBData aDBData;
+
+ // DBName aus rData.sPar1 extrahieren. Format: DBName.TableName.CommandType.ExpStrg
+ if ((nTablePos = rData.sPar1.Search(DB_DELIM)) != STRING_NOTFOUND)
+ aDBData.sDataSource = rData.sPar1.Copy(0, nTablePos++);
+ if ((nCmdTypePos = rData.sPar1.Search(DB_DELIM, nTablePos)) != STRING_NOTFOUND)
+ {
+ aDBData.sCommand = rData.sPar1.Copy(nTablePos, nCmdTypePos++ - nTablePos);
+ }
+ if ((nExpPos = rData.sPar1.Search(DB_DELIM, nCmdTypePos)) != STRING_NOTFOUND)
+ {
+ aDBData.nCommandType = rData.sPar1.Copy(nCmdTypePos, nExpPos++ - nCmdTypePos).ToInt32();
+ }
+ if (nExpPos != STRING_NOTFOUND)
+ nPos = nExpPos;
+ else if (nTablePos != STRING_NOTFOUND)
+ nPos = nTablePos;
+ else
+ nPos = 0;
+ sPar1 = rData.sPar1.Copy(nPos);
+
+ if (aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
+ pCurShell->ChgDBData(aDBData);
+
+ switch(rData.nTypeId)
+ {
+ case TYP_DBNAMEFLD:
+ {
+ SwDBNameFieldType* pTyp =
+ (SwDBNameFieldType*)pCurShell->GetFldType(0, RES_DBNAMEFLD);
+ pFld = new SwDBNameField(pTyp, aDBData);
+
+ break;
+ }
+ case TYP_DBNEXTSETFLD:
+ {
+ SwDBNextSetFieldType* pTyp = (SwDBNextSetFieldType*)pCurShell->GetFldType(
+ 0, RES_DBNEXTSETFLD);
+ pFld = new SwDBNextSetField(pTyp, sPar1, rData.sPar2, aDBData);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBNUMSETFLD:
+ {
+ SwDBNumSetFieldType* pTyp = (SwDBNumSetFieldType*)pCurShell->GetFldType(
+ 0, RES_DBNUMSETFLD);
+ pFld = new SwDBNumSetField( pTyp, sPar1, rData.sPar2, aDBData);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBSETNUMBERFLD:
+ {
+ SwDBSetNumberFieldType* pTyp = (SwDBSetNumberFieldType*)
+ pCurShell->GetFldType(0, RES_DBSETNUMBERFLD);
+ pFld = new SwDBSetNumberField( pTyp, aDBData, nFormatId);
+ bExp = TRUE;
+ break;
+ }
+ }
+ break;
+ }
+ case TYP_USERFLD:
+ {
+ SwUserFieldType* pTyp =
+ (SwUserFieldType*)pCurShell->GetFldType(RES_USERFLD, rData.sPar1);
+
+ // nur wenn vorhanden
+ if(!pTyp)
+ {
+ pTyp = (SwUserFieldType*)pCurShell->InsertFldType(
+ SwUserFieldType(pCurShell->GetDoc(), rData.sPar1));
+ }
+ if (pTyp->GetContent(nFormatId) != rData.sPar2)
+ pTyp->SetContent(rData.sPar2, nFormatId);
+ pFld = new SwUserField(pTyp, 0, nFormatId);
+ if (pFld->GetSubType() != nSubType)
+ pFld->SetSubType(nSubType);
+ bTbl = TRUE;
+ break;
+ }
+ case TYP_INPUTFLD:
+ {
+ if ((nSubType & 0x00ff) == INP_VAR)
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+
+ // kein Experssion Type mit dem Namen vorhanden -> anlegen
+ if(pTyp)
+ {
+ SwSetExpField* pExpFld =
+ new SwSetExpField(pTyp, aEmptyStr, nFormatId);
+
+ // Typ vom SwSetExpFieldType nicht veraendern:
+ USHORT nOldSubType = pExpFld->GetSubType();
+ pExpFld->SetSubType(nOldSubType | (nSubType & 0xff00));
+
+ pExpFld->SetPromptText(rData.sPar2);
+ pExpFld->SetInputFlag(TRUE) ;
+ bExp = TRUE;
+ pFld = pExpFld;
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ SwInputFieldType* pTyp =
+ (SwInputFieldType*)pCurShell->GetFldType(0, RES_INPUTFLD);
+
+ SwInputField* pInpFld =
+ new SwInputField(pTyp, rData.sPar1, rData.sPar2, nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId);
+ pFld = pInpFld;
+ }
+
+ // Dialog starten
+ //
+ pCurShell->StartInputFldDlg(pFld, FALSE, rData.pParent);
+ break;
+ }
+ case TYP_SETFLD:
+ {
+ if (!rData.sPar2.Len()) // Leere Variablen sind nicht erlaubt
+ return FALSE;
+
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1) );
+
+ SwSetExpField* pExpFld = new SwSetExpField( pTyp, rData.sPar2, nFormatId);
+ pExpFld->SetSubType(nSubType);
+ pExpFld->SetPar2(rData.sPar2);
+ bExp = TRUE;
+ pFld = pExpFld;
+ break;
+ }
+ case TYP_SEQFLD:
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1, nsSwGetSetExpType::GSE_SEQ));
+
+ BYTE nLevel = static_cast< BYTE >(nSubType & 0xff);
+
+ pTyp->SetOutlineLvl(nLevel);
+ if (nLevel != 0x7f && cSeparator == 0)
+ cSeparator = '.';
+
+ pTyp->SetDelimiter(cSeparator);
+ SwSetExpField* pExpFld = new SwSetExpField(pTyp, rData.sPar2, nFormatId);
+ bExp = TRUE;
+ pFld = pExpFld;
+ nSubType = nsSwGetSetExpType::GSE_SEQ;
+ break;
+ }
+ case TYP_GETFLD:
+ {
+ // gibt es ein entprechendes SetField
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+
+ if(pSetTyp)
+ {
+ SwGetExpFieldType* pTyp = (SwGetExpFieldType*)pCurShell->GetFldType(
+ 0, RES_GETEXPFLD);
+ pFld = new SwGetExpField(pTyp, rData.sPar1, pSetTyp->GetType(), nFormatId);
+ pFld->SetSubType(nSubType | pSetTyp->GetType());
+ bExp = TRUE;
+ }
+ else
+ return FALSE;
+ break;
+ }
+ case TYP_FORMELFLD:
+ {
+ if(pCurShell->GetFrmType(0,FALSE) & FRMTYPE_TABLE)
+ {
+ pCurShell->StartAllAction();
+
+ SvNumberFormatter* pFormatter = pCurShell->GetDoc()->GetNumberFormatter();
+ const SvNumberformat* pEntry = pFormatter->GetEntry(nFormatId);
+
+ if (pEntry)
+ {
+ SfxStringItem aFormat(FN_NUMBER_FORMAT, pEntry->GetFormatstring());
+ pCurShell->GetView().GetViewFrame()->GetDispatcher()->
+ Execute(FN_NUMBER_FORMAT, SFX_CALLMODE_SYNCHRON, &aFormat, 0L);
+ }
+
+ SfxItemSet aBoxSet( pCurShell->GetAttrPool(),
+ RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+
+ String sFml( rData.sPar2 );
+ if( sFml.EraseLeadingChars().Len() &&
+ '=' == sFml.GetChar( 0 ) )
+ sFml.Erase( 0, 1 );
+
+ aBoxSet.Put( SwTblBoxFormula( sFml ));
+ pCurShell->SetTblBoxFormulaAttrs( aBoxSet );
+ pCurShell->UpdateTable();
+
+ pCurShell->EndAllAction();
+ return TRUE;
+
+/* // In der Tabelle Tabellenformeln einfuegen
+ SwTblFieldType* pTyp = (SwTblFieldType*)pCurShell->GetFldType(
+ 0, RES_TABLEFLD);
+ pFld = new SwTblField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_EXPR, nFormatId);
+ bTbl = TRUE;*/
+ }
+ else
+ {
+ SwGetExpFieldType* pTyp = (SwGetExpFieldType*)
+ pCurShell->GetFldType(0, RES_GETEXPFLD);
+ pFld = new SwGetExpField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_FORMULA, nFormatId);
+ pFld->SetSubType(nSubType);
+ bExp = TRUE;
+ }
+ break;
+ }
+ case TYP_SETREFPAGEFLD:
+ pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGESETFLD ),
+ (short)rData.sPar2.ToInt32(), 0 != nSubType );
+ bPageVar = TRUE;
+ break;
+
+ case TYP_GETREFPAGEFLD:
+ pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ), nFormatId );
+ bPageVar = TRUE;
+ break;
+ case TYP_DROPDOWN :
+ {
+ pFld = new SwDropDownField(pCurShell->GetFldType( 0, RES_DROPDOWN ));
+ xub_StrLen nTokenCount = rData.sPar2.Len() ? rData.sPar2.GetTokenCount(DB_DELIM) : 0;
+ Sequence<OUString> aEntries(nTokenCount);
+ OUString* pArray = aEntries.getArray();
+ for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++)
+ pArray[nToken] = rData.sPar2.GetToken(nToken, DB_DELIM);
+ ((SwDropDownField*)pFld)->SetItems(aEntries);
+ ((SwDropDownField*)pFld)->SetName(rData.sPar1);
+ }
+ break;
+ default:
+ { ASSERT(!this, "Falscher Feldtyp");
+ return FALSE;
+ }
+ }
+ ASSERT(pFld, "Feld nicht vorhanden");
+
+
+ //the auto language flag has to be set prior to the language!
+ pFld->SetAutomaticLanguage(rData.bIsAutomaticLanguage);
+ USHORT nLang = GetCurrLanguage();
+ pFld->SetLanguage(nLang);
+
+ // Einfuegen
+ pCurShell->StartAllAction();
+
+ pCurShell->Insert(*pFld);
+
+ if(bExp && bEvalExp)
+ pCurShell->UpdateExpFlds(TRUE);
+
+ if(bTbl)
+ {
+ pCurShell->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ pCurShell->UpdateFlds(*pFld);
+ pCurShell->Right(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ }
+ else if( bPageVar )
+ ((SwRefPageGetFieldType*)pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ))->UpdateFlds();
+ else if( TYP_GETREFFLD == rData.nTypeId )
+ pFld->GetTyp()->Modify( 0, 0 );
+
+ // temporaeres Feld loeschen
+ delete pFld;
+
+ pCurShell->EndAllAction();
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder Update
+ --------------------------------------------------------------------*/
+
+
+void SwFldMgr::UpdateCurFld(ULONG nFormat,
+ const String& rPar1,
+ const String& rPar2,
+ SwField * _pTmpFld) // #111840#
+{
+ // Format aendern
+ ASSERT(pCurFld, "kein Feld an der CursorPos");
+
+ bool bDelete = false;
+ SwField *pTmpFld; // mb: fixed memory leak
+ if (NULL != _pTmpFld)
+ {
+ pTmpFld = _pTmpFld;
+ }
+ else
+ {
+ pTmpFld = pCurFld->Copy();
+ bDelete = true;
+ }
+
+ SwFieldType* pType = pTmpFld->GetTyp();
+ const USHORT nTypeId = pTmpFld->GetTypeId();
+
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(!pSh)
+ return;
+ pSh->StartAllAction();
+
+ BOOL bSetPar2 = TRUE;
+ BOOL bSetPar1 = TRUE;
+ String sPar1( rPar1 );
+ String sPar2( rPar2 );
+
+ // Order to Format
+ switch( nTypeId )
+ {
+ case TYP_DDEFLD:
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sPar2.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sPar2.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+ break;
+ }
+
+ case TYP_CHAPTERFLD:
+ {
+ USHORT nByte = (USHORT)rPar2.ToInt32();
+ nByte = Max(USHORT(1), nByte);
+ nByte = Min(nByte, USHORT(MAXLEVEL));
+ nByte -= 1;
+ ((SwChapterField*)pTmpFld)->SetLevel((BYTE)nByte);
+ bSetPar2 = FALSE;
+ break;
+ }
+
+ case TYP_SCRIPTFLD:
+ ((SwScriptField*)pTmpFld)->SetCodeURL((BOOL)nFormat);
+ break;
+
+ case TYP_NEXTPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ {
+ ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ sPar2 = '1';
+ }
+ else
+ {
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ short nOff = (short)sPar2.ToInt32();
+ nOff += 1;
+ sPar2 = String::CreateFromInt32(nOff);
+ }
+ break;
+
+ case TYP_PREVPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ {
+ ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ sPar2 = String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM("-1"));
+ }
+ else
+ {
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ short nOff = (short)sPar2.ToInt32();
+ nOff -= 1;
+ sPar2 = String::CreateFromInt32(nOff);
+ }
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ case TYP_GETREFPAGEFLD:
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ break;
+
+ case TYP_GETREFFLD:
+ {
+ bSetPar2 = FALSE;
+ ((SwGetRefField*)pTmpFld)->SetSubType( (USHORT)rPar2.ToInt32() );
+ USHORT nPos = rPar2.Search( '|' );
+ if( STRING_NOTFOUND != nPos )
+ ((SwGetRefField*)pTmpFld)->SetSeqNo( (USHORT)rPar2.Copy( nPos + 1 ).ToInt32());
+ }
+ break;
+ case TYP_DROPDOWN:
+ {
+ xub_StrLen nTokenCount = sPar2.Len() ? sPar2.GetTokenCount(DB_DELIM) : 0;
+ Sequence<OUString> aEntries(nTokenCount);
+ OUString* pArray = aEntries.getArray();
+ for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++)
+ pArray[nToken] = sPar2.GetToken(nToken, DB_DELIM);
+ ((SwDropDownField*)pTmpFld)->SetItems(aEntries);
+ ((SwDropDownField*)pTmpFld)->SetName(sPar1);
+ bSetPar1 = bSetPar2 = FALSE;
+ }
+ break;
+ case TYP_AUTHORITY :
+ {
+ //#i99069# changes to a bibliography field should change the field type
+ SwAuthorityField* pAuthorityField = static_cast<SwAuthorityField*>(pTmpFld);
+ SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType);
+ SwAuthEntry aTempEntry;
+ for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+ aTempEntry.SetAuthorField( (ToxAuthorityField)i,
+ rPar1.GetToken( i, TOX_STYLE_DELIMITER ));
+ if( pAuthorityType->ChangeEntryContent( &aTempEntry ) )
+ {
+ pType->UpdateFlds();
+ pSh->SetModified();
+ }
+
+ if( aTempEntry.GetAuthorField( AUTH_FIELD_IDENTIFIER ) ==
+ pAuthorityField->GetFieldText( AUTH_FIELD_IDENTIFIER ) )
+ bSetPar1 = FALSE; //otherwise it's a new or changed entry, the field needs to be updated
+ bSetPar2 = FALSE;
+ }
+ break;
+ }
+
+ // Format setzen
+ // Format wegen NumberFormatter vor SetPar2 einstellen!
+ pTmpFld->ChangeFormat(nFormat);
+
+ if(bSetPar1)
+ pTmpFld->SetPar1( sPar1 );
+ if( bSetPar2 )
+ pTmpFld->SetPar2( sPar2 );
+
+ // Update anschmeissen
+ if(nTypeId == TYP_DDEFLD ||
+ nTypeId == TYP_USERFLD ||
+ nTypeId == TYP_USRINPFLD)
+ {
+ pType->UpdateFlds();
+ pSh->SetModified();
+ }
+ else {
+ // mb: #32157
+ pSh->SwEditShell::UpdateFlds(*pTmpFld);
+ GetCurFld();
+ }
+
+ if (bDelete)
+ delete pTmpFld;
+
+ pSh->EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ExpressionFields explizit evaluieren
+ --------------------------------------------------------------------*/
+void SwFldMgr::EvalExpFlds(SwWrtShell* pSh)
+{
+ if (pSh == NULL)
+ pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+
+ if(pSh)
+ {
+ pSh->StartAllAction();
+ pSh->UpdateExpFlds(TRUE);
+ pSh->EndAllAction();
+ }
+}
+USHORT SwFldMgr::GetCurrLanguage() const
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if( pSh )
+ return pSh->GetCurLang();
+ return SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
+}
+
+void SwFieldType::_GetFldName()
+{
+ static const USHORT coFldCnt = STR_TYPE_END - STR_TYPE_BEGIN;
+
+ static USHORT __READONLY_DATA coFldNms[ coFldCnt ] = {
+ FLD_DATE_STD,
+ FLD_TIME_STD,
+ STR_FILENAMEFLD,
+ STR_DBNAMEFLD,
+ STR_CHAPTERFLD,
+ STR_PAGENUMBERFLD,
+ STR_DOCSTATFLD,
+ STR_AUTHORFLD,
+ STR_SETFLD,
+ STR_GETFLD,
+ STR_FORMELFLD,
+ STR_HIDDENTXTFLD,
+ STR_SETREFFLD,
+ STR_GETREFFLD,
+ STR_DDEFLD,
+ STR_MACROFLD,
+ STR_INPUTFLD,
+ STR_HIDDENPARAFLD,
+ STR_DOCINFOFLD,
+ STR_DBFLD,
+ STR_USERFLD,
+ STR_POSTITFLD,
+ STR_TEMPLNAMEFLD,
+ STR_SEQFLD,
+ STR_DBNEXTSETFLD,
+ STR_DBNUMSETFLD,
+ STR_DBSETNUMBERFLD,
+ STR_CONDTXTFLD,
+ STR_NEXTPAGEFLD,
+ STR_PREVPAGEFLD,
+ STR_EXTUSERFLD,
+ FLD_DATE_FIX,
+ FLD_TIME_FIX,
+ STR_SETINPUTFLD,
+ STR_USRINPUTFLD,
+ STR_SETREFPAGEFLD,
+ STR_GETREFPAGEFLD,
+ STR_INTERNETFLD,
+ STR_JUMPEDITFLD,
+ STR_SCRIPTFLD,
+ STR_AUTHORITY,
+ STR_COMBINED_CHARS,
+ STR_DROPDOWN
+ };
+
+ // Infos fuer Felder einfuegen
+ SwFieldType::pFldNames = new SvStringsDtor( (BYTE)coFldCnt, 2 );
+ for( USHORT nIdx = 0; nIdx < coFldCnt; ++nIdx )
+ {
+ String* pTmp = new SW_RESSTR( coFldNms[ nIdx ] );
+ pTmp->Assign( MnemonicGenerator::EraseAllMnemonicChars( *pTmp ) );
+ SwFieldType::pFldNames->Insert(pTmp, nIdx );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::ChooseMacro(const String&)
+{
+ BOOL bRet = FALSE;
+
+ // choose script dialog
+ ::rtl::OUString aScriptURL = SfxApplication::ChooseScript();
+
+ // the script selector dialog returns a valid script URL
+ if ( aScriptURL.getLength() != 0 )
+ {
+ SetMacroPath( aScriptURL );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+void SwFldMgr::SetMacroPath(const String& rPath)
+{
+ sMacroPath = rPath;
+ sMacroName = rPath;
+
+ // try to set sMacroName member variable by parsing the macro path
+ // using the new URI parsing services
+
+ Reference< XMultiServiceFactory > xSMgr =
+ ::comphelper::getProcessServiceFactory();
+
+ Reference< uri::XUriReferenceFactory >
+ xFactory( xSMgr->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY );
+
+ if ( xFactory.is() )
+ {
+ Reference< uri::XVndSunStarScriptUrl >
+ xUrl( xFactory->parse( sMacroPath ), UNO_QUERY );
+
+ if ( xUrl.is() )
+ {
+ sMacroName = xUrl->getName();
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+ULONG SwFldMgr::GetDefaultFormat(USHORT nTypeId, BOOL bIsText, SvNumberFormatter* pFormatter, double* pVal)
+{
+ double fValue;
+ short nDefFormat;
+
+ switch (nTypeId)
+ {
+ case TYP_TIMEFLD:
+ case TYP_DATEFLD:
+ {
+ Date aDate;
+ Date* pNullDate = pFormatter->GetNullDate();
+
+ fValue = aDate - *pNullDate;
+
+ Time aTime;
+
+ ULONG nNumFmtTime = (ULONG)aTime.GetSec() + (ULONG)aTime.GetMin() * 60L +
+ (ULONG)aTime.GetHour() * 3600L;
+
+ fValue += (double)nNumFmtTime / 86400.0;
+
+ nDefFormat = (nTypeId == TYP_DATEFLD) ? NUMBERFORMAT_DATE : NUMBERFORMAT_TIME;
+ }
+ break;
+
+ default:
+ if (bIsText)
+ {
+ fValue = 0.0;
+ nDefFormat = NUMBERFORMAT_TEXT;
+ }
+ else
+ {
+ fValue = 0.0;
+ nDefFormat = NUMBERFORMAT_ALL;
+ }
+ break;
+ }
+
+ if (pVal)
+ *pVal = fValue;
+
+ return pFormatter->GetStandardFormat(nDefFormat, GetCurrLanguage());
+}
+
+/* -----------------------------01.03.01 16:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XNumberingTypeInfo> SwFldMgr::GetNumberingInfo() const
+{
+ if(!xNumberingInfo.is())
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.text.DefaultNumberingProvider" ));
+ Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY);
+ DBG_ASSERT(xDefNum.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
+ ((SwFldMgr*)this)->xNumberingInfo = Reference<XNumberingTypeInfo>(xDefNum, UNO_QUERY);
+ }
+ return xNumberingInfo;
+}
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
new file mode 100644
index 000000000000..39a6a98d764b
--- /dev/null
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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/lstbox.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/htmlmode.hxx>
+#include <dbfld.hxx>
+#include <flddat.hxx>
+#include <fmtfld.hxx>
+#include <viewopt.hxx>
+#include <fldedt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <expfld.hxx>
+#ifndef _FLDTDLG_HXX
+#include <fldtdlg.hxx>
+#endif
+#ifndef _FLDPAGE_HXX
+#include <fldpage.hxx>
+#endif
+#include <docufld.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <sfx2/bindings.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldPage::SwFldPage( Window *pParent, const ResId &rId,
+ const SfxItemSet &rAttrSet )
+ :SfxTabPage (pParent, rId, rAttrSet),
+ m_pCurFld (0),
+ m_pWrtShell (0),
+ m_nPageId ( static_cast< USHORT >(rId.GetId()) ),
+ m_nTypeSel (LISTBOX_ENTRY_NOTFOUND),
+ m_nSelectionSel (LISTBOX_ENTRY_NOTFOUND),
+ m_bFldEdit (FALSE),
+ m_bInsert (TRUE),
+ m_bFldDlgHtmlMode (FALSE),
+ m_bRefresh (FALSE),
+ m_bFirstHTMLInit (TRUE)
+{
+// FreeResource();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldPage::~SwFldPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::Init()
+{
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ BOOL bNewMode = 0 != (::GetHtmlMode(pDocSh) & HTMLMODE_ON);
+
+ m_bFldEdit = 0 == GetTabDialog();
+
+ // FieldManager neu initialisieren wichtig fuer
+ // Dok-Wechsel (fldtdlg:ReInitTabPage)
+ m_pCurFld = m_aMgr.GetCurFld();
+
+ if( bNewMode != m_bFldDlgHtmlMode )
+ {
+ m_bFldDlgHtmlMode = bNewMode;
+
+ // Bereichslistbox initialisieren
+ if( m_bFldDlgHtmlMode && m_bFirstHTMLInit )
+ {
+ m_bFirstHTMLInit = FALSE;
+ SwWrtShell *pSh = m_pWrtShell;
+ if(! pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwDoc* pDoc = pSh->GetDoc();
+ pSh->InsertFldType( SwSetExpFieldType( pDoc,
+ String::CreateFromAscii("HTML_ON"), 1));
+ pSh->InsertFldType( SwSetExpFieldType(pDoc,
+ String::CreateFromAscii("HTML_OFF"), 1));
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seite neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::ActivatePage()
+{
+ EnableInsert(m_bInsert);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kompletter Reset; neues Feld editieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::EditNewField( BOOL bOnlyActivate )
+{
+ if( !bOnlyActivate )
+ {
+ m_nTypeSel = LISTBOX_ENTRY_NOTFOUND;
+ }
+ m_nSelectionSel = LISTBOX_ENTRY_NOTFOUND;
+ m_bRefresh = TRUE;
+ Reset(*(SfxItemSet*)0);
+ m_bRefresh = FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feld einfuegen
+ --------------------------------------------------------------------*/
+
+BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1,
+ const String& rPar2, ULONG nFormatId,
+ sal_Unicode cSeparator, BOOL bIsAutomaticLanguage)
+{
+ BOOL bRet = FALSE;
+ SwView* pView = GetActiveView();
+ SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr();
+
+ if (!IsFldEdit()) // Neues Feld einfuegen
+ {
+ SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator, bIsAutomaticLanguage );
+ //#i26566# provide parent for SwWrtShell::StartInputFldDlg
+ aData.pParent = &GetTabDialog()->GetOKButton();
+ bRet = m_aMgr.InsertFld( aData );
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pView->GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ BOOL bRecordDB = TYP_DBFLD == nTypeId ||
+ TYP_DBSETNUMBERFLD == nTypeId ||
+ TYP_DBNUMSETFLD == nTypeId ||
+ TYP_DBNEXTSETFLD == nTypeId ||
+ TYP_DBNAMEFLD == nTypeId ;
+
+ SfxRequest aReq( pView->GetViewFrame(),
+ bRecordDB ? FN_INSERT_DBFIELD : FN_INSERT_FIELD );
+ if(bRecordDB)
+ {
+ aReq.AppendItem(SfxStringItem
+ (FN_INSERT_DBFIELD,rPar1.GetToken(0, DB_DELIM)));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_1,rPar1.GetToken(1, DB_DELIM)));
+ aReq.AppendItem(SfxInt32Item
+ (FN_PARAM_3,rPar1.GetToken(1, DB_DELIM).ToInt32()));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_2,rPar1.GetToken(3, DB_DELIM)));
+ }
+ else
+ {
+ aReq.AppendItem(SfxStringItem(FN_INSERT_FIELD, rPar1));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_3,String(cSeparator)));
+ aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_SUBTYPE, nSubType));
+ }
+ aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_TYPE , nTypeId));
+ aReq.AppendItem(SfxStringItem(FN_PARAM_FIELD_CONTENT, rPar2));
+ aReq.AppendItem(SfxUInt32Item(FN_PARAM_FIELD_FORMAT , nFormatId));
+ aReq.Done();
+ }
+
+ }
+ else // Feld aendern
+ {
+ SwField * pTmpFld = m_pCurFld->Copy();
+
+ String sPar1(rPar1);
+ String sPar2(rPar2);
+ BOOL bDBChanged = FALSE;
+ switch( nTypeId )
+ {
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ nSubType = static_cast< USHORT >(((nTypeId == TYP_DATEFLD) ? DATEFLD : TIMEFLD) |
+ ((nSubType == DATE_VAR) ? 0 : FIXEDFLD));
+ break;
+
+ case TYP_DBNAMEFLD:
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBSETNUMBERFLD:
+ {
+ xub_StrLen nPos = 0;
+ SwDBData aData;
+
+ aData.sDataSource = rPar1.GetToken(0, DB_DELIM, nPos);
+ aData.sCommand = rPar1.GetToken(0, DB_DELIM, nPos);
+ aData.nCommandType = rPar1.GetToken(0, DB_DELIM, nPos).ToInt32();
+ sPar1 = rPar1.Copy(nPos);
+
+ ((SwDBNameInfField*)pTmpFld)->SetDBData(aData);
+ bDBChanged = TRUE;
+ }
+ break;
+
+ case TYP_DBFLD:
+ {
+ SwDBData aData;
+ aData.sDataSource = rPar1.GetToken(0, DB_DELIM);
+ aData.sCommand = rPar1.GetToken(1, DB_DELIM);
+ aData.nCommandType = rPar1.GetToken(2, DB_DELIM).ToInt32();
+ String sColumn = rPar1.GetToken(3, DB_DELIM);
+
+ SwDBFieldType* pOldTyp = (SwDBFieldType*)pTmpFld->GetTyp();
+ SwDBFieldType* pTyp = (SwDBFieldType*)pSh->InsertFldType(
+ SwDBFieldType(pSh->GetDoc(), sColumn, aData));
+
+ SwClientIter aIter( *pOldTyp );
+
+ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+ pFmtFld; pFmtFld = (SwFmtFld*)aIter.Next() )
+ {
+ if( pFmtFld->GetFld() == m_pCurFld)
+ {
+ pTyp->Add(pFmtFld); // Feld auf neuen Typ umhaengen
+ pTmpFld->ChgTyp(pTyp);
+ break;
+ }
+ }
+ bDBChanged = TRUE;
+ }
+ break;
+
+ case TYP_SEQFLD:
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pTmpFld->GetTyp();
+ pTyp->SetOutlineLvl( static_cast< BYTE >(nSubType & 0xff));
+ pTyp->SetDelimiter(cSeparator);
+
+ nSubType = nsSwGetSetExpType::GSE_SEQ;
+ }
+ break;
+
+ case TYP_INPUTFLD:
+ {
+ // User- oder SetField ?
+ if (m_aMgr.GetFldType(RES_USERFLD, sPar1) == 0 &&
+ !(pTmpFld->GetSubType() & INP_TXT)) // SETEXPFLD
+ {
+ SwSetExpField* pFld = (SwSetExpField*)pTmpFld;
+ pFld->SetPromptText(sPar2);
+ sPar2 = pFld->GetPar2();
+ }
+ }
+ break;
+ case TYP_DOCINFOFLD:
+ {
+ if( nSubType == nsSwDocInfoSubType::DI_CUSTOM )
+ {
+ SwDocInfoField* pDocInfo = static_cast<SwDocInfoField*>( pTmpFld );
+ pDocInfo->SetName( rPar1 );
+ }
+ }
+ break;
+ }
+
+ pSh->StartAllAction();
+
+ pTmpFld->SetSubType(nSubType);
+ pTmpFld->SetAutomaticLanguage(bIsAutomaticLanguage);
+
+ m_aMgr.UpdateCurFld( nFormatId, sPar1, sPar2, pTmpFld );
+
+ m_pCurFld = m_aMgr.GetCurFld();
+
+ switch (nTypeId)
+ {
+ case TYP_HIDDENTXTFLD:
+ case TYP_HIDDENPARAFLD:
+ m_aMgr.EvalExpFlds(pSh);
+ break;
+ }
+
+ pSh->SetUndoNoResetModified();
+ pSh->EndAllAction();
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldPage::SavePos( const ListBox* pLst1, const ListBox* pLst2,
+ const ListBox* pLst3 )
+{
+ const ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 };
+
+ const ListBox** ppLB = aLBArr;
+ for( int i = 0; i < coLBCount; ++i, ++ppLB )
+ if( (*ppLB) && (*ppLB)->GetEntryCount() )
+ m_aLstStrArr[ i ] = (*ppLB)->GetSelectEntry();
+ else
+ m_aLstStrArr[ i ].Erase();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldPage::RestorePos(ListBox* pLst1, ListBox* pLst2, ListBox* pLst3)
+{
+ USHORT nPos = 0;
+ ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 };
+ ListBox** ppLB = aLBArr;
+ for( int i = 0; i < coLBCount; ++i, ++ppLB )
+ if( (*ppLB) && (*ppLB)->GetEntryCount() && m_aLstStrArr[ i ].Len() &&
+ LISTBOX_ENTRY_NOTFOUND !=
+ ( nPos = (*ppLB)->GetEntryPos(m_aLstStrArr[ i ] ) ) )
+ (*ppLB)->SelectEntryPos( nPos );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von neuen Feldern
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldPage, InsertHdl, Button *, pBtn )
+{
+ SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog();
+
+ if (pDlg)
+ {
+ pDlg->InsertHdl();
+
+ if (pBtn)
+ pBtn->GrabFocus(); // Wegen InputField-Dlg
+ }
+ else
+ {
+ SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent();
+ pEditDlg->InsertHdl();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: "Einfuegen"-Button Enablen/Disablen
+ --------------------------------------------------------------------*/
+
+void SwFldPage::EnableInsert(BOOL bEnable)
+{
+ SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog();
+
+ if (pDlg)
+ {
+ if (pDlg->GetCurPageId() == m_nPageId)
+ pDlg->EnableInsert(bEnable);
+ }
+ else
+ {
+ SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent();
+ pEditDlg->EnableInsert(bEnable);
+ }
+
+ m_bInsert = bEnable;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldPage, NumFormatHdl, ListBox *, EMPTYARG )
+{
+ InsertHdl();
+
+ return 0;
+}
+/*-- 19.12.2005 14:05:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldPage::SetWrtShell( SwWrtShell* pShell )
+{
+ m_pWrtShell = pShell;
+ m_aMgr.SetWrtShell( pShell );
+}
diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx
new file mode 100644
index 000000000000..f2dc85e07f7c
--- /dev/null
+++ b/sw/source/ui/fldui/fldpage.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDPAGE_HXX
+#define _SWFLDPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <fldmgr.hxx>
+
+class ListBox;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const int coLBCount = 3;
+
+class SwFldPage : public SfxTabPage
+{
+ String m_aLstStrArr[ coLBCount ];
+ SwFldMgr m_aMgr;
+ SwField *m_pCurFld;
+ SwWrtShell* m_pWrtShell;
+ USHORT m_nPageId;
+ USHORT m_nTypeSel;
+ USHORT m_nSelectionSel;
+ BOOL m_bFldEdit;
+ BOOL m_bInsert;
+ BOOL m_bFldDlgHtmlMode;
+ BOOL m_bRefresh;
+ BOOL m_bFirstHTMLInit;
+
+protected:
+
+ USHORT GetTypeSel() const { return m_nTypeSel;}
+ void SetTypeSel(USHORT nSet) { m_nTypeSel = nSet;}
+ USHORT GetSelectionSel() const { return m_nSelectionSel;}
+ void SetSelectionSel(USHORT nSet){ m_nSelectionSel = nSet;}
+ BOOL IsFldDlgHtmlMode() const { return m_bFldDlgHtmlMode;}
+ BOOL IsRefresh() const { return m_bRefresh;}
+ SwField* GetCurField() { return m_pCurFld;}
+ SwWrtShell* GetWrtShell() { return m_pWrtShell;}
+
+ DECL_LINK( InsertHdl, Button *pBtn = 0 );
+ DECL_LINK( NumFormatHdl, ListBox *pBtn = 0 );
+
+ void Init();
+ void SavePos( const ListBox* pLst1,
+ const ListBox* pLst2 = 0,
+ const ListBox* pLst3 = 0);
+ void RestorePos( ListBox* pLst1, ListBox* pLst2 = 0,
+ ListBox* pLst3 = 0 );
+ void EnableInsert(BOOL bEnable = TRUE);
+ inline BOOL IsFldEdit() const { return m_bFldEdit; }
+
+ // Feld einfuegen
+ BOOL InsertFld( USHORT nTypeId,
+ USHORT nSubType,
+ const String& rPar1,
+ const String& rPar2,
+ ULONG nFormatId,
+ sal_Unicode cDelim = ' ',
+ BOOL bIsAutomaticLanguage = TRUE);
+
+ using SfxTabPage::ActivatePage;
+
+public:
+ SwFldPage( Window *pParent,
+ const ResId &rId,
+ const SfxItemSet &rAttrSet );
+
+ virtual ~SwFldPage();
+
+ virtual void ActivatePage();
+
+ inline SwFldMgr& GetFldMgr() { return m_aMgr; }
+ void SetWrtShell( SwWrtShell* m_pWrtShell );
+ void EditNewField( BOOL bOnlyActivate = FALSE );
+ virtual USHORT GetGroup() = 0;
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
new file mode 100644
index 000000000000..1c7ff9e09564
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -0,0 +1,1073 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "swtypes.hxx"
+#include <view.hxx>
+#include <IMark.hxx>
+#include <expfld.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDREF_HXX
+#include <fldref.hxx>
+#endif
+#include <reffld.hxx>
+#include <wrtsh.hxx>
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+// --> OD 2007-11-14 #i83479#
+#include <SwNodeNum.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <ndtxt.hxx>
+// <--
+
+// sw/inc/expfld.hxx
+SV_IMPL_PTRARR( _SwSeqFldList, _SeqFldLstElem* )
+
+#define REFFLDFLAG 0x4000
+#define REFFLDFLAG_BOOKMARK 0x4800
+#define REFFLDFLAG_FOOTNOTE 0x5000
+#define REFFLDFLAG_ENDNOTE 0x6000
+// --> OD 2007-11-09 #i83479#
+#define REFFLDFLAG_HEADING 0x7100
+#define REFFLDFLAG_NUMITEM 0x7200
+// <--
+
+USHORT nFldDlgFmtSel = 0;
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldRefPage::SwFldRefPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_REF ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_REFTYPE)),
+ aTypeLB (this, SW_RES(LB_REFTYPE)),
+ aSelectionFT (this, SW_RES(FT_REFSELECTION)),
+ aSelectionLB (this, SW_RES(LB_REFSELECTION)),
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB( this, SW_RES(LB_REFSELECTION_TOOLTIP) ),
+ // <--
+ aFormatFT (this, SW_RES(FT_REFFORMAT)),
+ aFormatLB (this, SW_RES(LB_REFFORMAT)),
+ aNameFT (this, SW_RES(FT_REFNAME)),
+ aNameED (this, SW_RES(ED_REFNAME)),
+ aValueFT (this, SW_RES(FT_REFVALUE)),
+ aValueED (this, SW_RES(ED_REFVALUE)),
+
+ sBookmarkTxt (SW_RES(STR_REFBOOKMARK)),
+ sFootnoteTxt (SW_RES(STR_REFFOOTNOTE)),
+ sEndnoteTxt (SW_RES(STR_REFENDNOTE)),
+ // --> OD 2007-11-09 #i83479#
+ sHeadingTxt (SW_RES(STR_REFHEADING)),
+ sNumItemTxt (SW_RES(STR_REFNUMITEM)),
+ maOutlineNodes(),
+ maNumItems(),
+ mpSavedSelectedTxtNode( 0 ),
+ mnSavedSelectedPos( 0 )
+ // <--
+{
+ FreeResource();
+
+ aNameED.SetModifyHdl(LINK(this, SwFldRefPage, ModifyHdl));
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldRefPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldRefPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.SetSelectHdl( LINK(this, SwFldRefPage, SubTypeHdl) );
+ aSelectionToolTipLB.SetDoubleClickHdl( LINK(this, SwFldRefPage, InsertHdl) );
+ aSelectionToolTipLB.SetWindowBits( aSelectionToolTipLB.GetWindowBits() | WB_HSCROLL );
+ aSelectionToolTipLB.SetSpaceBetweenEntries(1);
+ aSelectionToolTipLB.SetHighlightRange();
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldRefPage::~SwFldRefPage()
+{
+}
+
+// --> OD 2007-11-22 #i83479#
+void SwFldRefPage::SaveSelectedTxtNode()
+{
+ mpSavedSelectedTxtNode = 0;
+ mnSavedSelectedPos = 0;
+ if ( aSelectionToolTipLB.IsVisible() )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ if ( pEntry )
+ {
+ const USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ SwWrtShell *pSh = GetWrtShell();
+ if ( !pSh )
+ {
+ pSh = ::GetActiveWrtShell();
+ }
+ if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ mnSavedSelectedPos = static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData()));
+ if ( mnSavedSelectedPos < maOutlineNodes.size() )
+ {
+ mpSavedSelectedTxtNode = maOutlineNodes[mnSavedSelectedPos];
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ mnSavedSelectedPos = static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData()));
+ if ( mnSavedSelectedPos < maNumItems.size() )
+ {
+ mpSavedSelectedTxtNode = maNumItems[mnSavedSelectedPos]->GetTxtNode();
+ }
+ }
+ }
+ }
+}
+
+const SwTxtNode* SwFldRefPage::GetSavedSelectedTxtNode() const
+{
+ return mpSavedSelectedTxtNode;
+}
+
+sal_uInt16 SwFldRefPage::GetSavedSelectedPos() const
+{
+ return mnSavedSelectedPos;
+}
+
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldRefPage::Reset(const SfxItemSet& )
+{
+ if (!IsFldEdit())
+ {
+ SavePos(&aTypeLB);
+ // --> OD 2007-11-22 #i83479#
+ SaveSelectedTxtNode();
+ // <--
+ }
+ SetSelectionSel(LISTBOX_ENTRY_NOTFOUND);
+ SetTypeSel(LISTBOX_ENTRY_NOTFOUND);
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ // Typ-Listbox fuellen
+
+ USHORT nPos;
+ // Referenz setzen / einfuegen
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for (short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ const USHORT nTypeId = GetFldMgr().GetTypeId(i);
+
+ if (!IsFldEdit() || nTypeId != TYP_SETREFFLD)
+ {
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i), i - rRg.nStart);
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+
+ // --> OD 2007-11-09 #i83479#
+ // entries for headings and numbered items
+ nPos = aTypeLB.InsertEntry(sHeadingTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_HEADING);
+ nPos = aTypeLB.InsertEntry(sNumItemTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_NUMITEM);
+ // <--
+
+ // mit den Sequence-Typen auffuellen
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+
+ USHORT nFldTypeCnt = pSh->GetFldTypeCount(RES_SETEXPFLD);
+
+ for (USHORT n = 0; n < nFldTypeCnt; ++n)
+ {
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(n, RES_SETEXPFLD);
+
+ if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->GetDepends() && pSh->IsUsed(*pType))
+ {
+ nPos = aTypeLB.InsertEntry(pType->GetName());
+ aTypeLB.SetEntryData(nPos, (void*)(REFFLDFLAG | n));
+ }
+ }
+
+ // Textmarken - jetzt immer (wegen Globaldokumenten)
+ nPos = aTypeLB.InsertEntry(sBookmarkTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_BOOKMARK);
+
+ // Fussnoten:
+ if( pSh->HasFtns() )
+ {
+ nPos = aTypeLB.InsertEntry(sFootnoteTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_FOOTNOTE);
+ }
+
+ // Endnoten:
+ if ( pSh->HasFtns(true) )
+ {
+ nPos = aTypeLB.InsertEntry(sEndnoteTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_ENDNOTE);
+ }
+
+ // alte Pos selektieren
+ if (!IsFldEdit())
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ nFldDlgFmtSel = 0;
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(!IsRefresh() && sUserData.GetToken(0, ';').
+ EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ if (IsFldEdit())
+ {
+ aTypeLB.SaveValue();
+ aSelectionLB.SaveValue();
+ aFormatLB.SaveValue();
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (IsFldEdit())
+ {
+ // Positionen selektieren
+ String sName;
+ USHORT nFlag = 0;
+
+ switch( GetCurField()->GetSubType() )
+ {
+ case REF_BOOKMARK:
+ {
+ // --> OD 2007-11-14 #i83479#
+// sName = sBookmarkTxt;
+// nFlag = REFFLDFLAG_BOOKMARK;
+ SwGetRefField* pRefFld = dynamic_cast<SwGetRefField*>(GetCurField());
+ if ( pRefFld &&
+ pRefFld->IsRefToHeadingCrossRefBookmark() )
+ {
+ sName = sHeadingTxt;
+ nFlag = REFFLDFLAG_HEADING;
+ }
+ else if ( pRefFld &&
+ pRefFld->IsRefToNumItemCrossRefBookmark() )
+ {
+ sName = sNumItemTxt;
+ nFlag = REFFLDFLAG_NUMITEM;
+ }
+ else
+ {
+ sName = sBookmarkTxt;
+ nFlag = REFFLDFLAG_BOOKMARK;
+ }
+ // <--
+ }
+ break;
+
+ case REF_FOOTNOTE:
+ sName = sFootnoteTxt;
+ nFlag = REFFLDFLAG_FOOTNOTE;
+ break;
+
+ case REF_ENDNOTE:
+ sName = sEndnoteTxt;
+ nFlag = REFFLDFLAG_ENDNOTE;
+ break;
+
+ case REF_SETREFATTR:
+ sName = SW_RESSTR(STR_GETREFFLD);
+ nFlag = REF_SETREFATTR;
+ break;
+
+ case REF_SEQUENCEFLD:
+ sName = ((SwGetRefField*)GetCurField())->GetSetRefName();
+ nFlag = REFFLDFLAG;
+ break;
+ }
+
+ if (aTypeLB.GetEntryPos(sName) == LISTBOX_ENTRY_NOTFOUND) // Referenz zu gel?schter Marke
+ {
+ USHORT nPos = aTypeLB.InsertEntry(sName);
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nFlag));
+ }
+
+ aTypeLB.SelectEntry(sName);
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+ }
+ else
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ UpdateSubType();
+
+ BOOL bName = FALSE; nFldDlgFmtSel = 0;
+
+ if ( ( !IsFldEdit() || aSelectionLB.GetEntryCount() ) &&
+ nOld != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_GETREFFLD:
+ if (REFFLDFLAG & (USHORT)(ULONG)aTypeLB.GetEntryData(nOld))
+ // dann bleibt die alte bestehen
+ nFldDlgFmtSel = aFormatLB.GetSelectEntryPos();
+ bName = TRUE;
+ break;
+
+ case TYP_SETREFFLD:
+ bName = TRUE;
+ break;
+
+ case REFFLDFLAG_BOOKMARK:
+ bName = TRUE;
+ // kein break!!!
+ default:
+ if( REFFLDFLAG & nTypeId )
+ {
+ USHORT nOldId = (USHORT)(ULONG)aTypeLB.GetEntryData(nOld);
+ if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
+ // dann bleibt die alte bestehen
+ nFldDlgFmtSel = aFormatLB.GetSelectEntryPos();
+ }
+ break;
+ }
+
+ aNameED.Enable(bName);
+ aNameFT.Enable(bName);
+
+ // Format-Listbox fuellen
+ USHORT nSize = FillFormatLB(nTypeId);
+ BOOL bFormat = nSize != 0;
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+
+ SubTypeHdl();
+ ModifyHdl();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch(nTypeId)
+ {
+ case TYP_GETREFFLD:
+ if (!IsFldEdit() || aSelectionLB.GetSelectEntryCount())
+ {
+ aNameED.SetText(aSelectionLB.GetSelectEntry());
+ ModifyHdl(&aNameED);
+ }
+ break;
+
+ case TYP_SETREFFLD:
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ aValueED.SetText(pSh->GetSelTxt());
+ }
+
+ }
+ break;
+ // --> OD 2007-11-21 #i83479#
+ case REFFLDFLAG_HEADING:
+ case REFFLDFLAG_NUMITEM:
+ {
+ if ( aSelectionToolTipLB.GetCurEntry() )
+ {
+ aNameED.SetText( aSelectionToolTipLB.GetEntryText(
+ aSelectionToolTipLB.GetCurEntry() ) );
+ }
+ }
+ break;
+ // <--
+
+ default:
+ if (!IsFldEdit() || aSelectionLB.GetSelectEntryCount())
+ aNameED.SetText(aSelectionLB.GetSelectEntry());
+ break;
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in SelectionLB erneuern
+ --------------------------------------------------------------------*/
+
+void SwFldRefPage::UpdateSubType()
+{
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ SwGetRefField* pRefFld = (SwGetRefField*)GetCurField();
+ const USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ String sOldSel;
+ // --> OD 2007-11-22 #i83479#
+ if ( aSelectionLB.IsVisible() )
+ {
+ const USHORT nSelectionSel = aSelectionLB.GetSelectEntryPos();
+ if (nSelectionSel != LISTBOX_ENTRY_NOTFOUND)
+ {
+ sOldSel = aSelectionLB.GetEntry(nSelectionSel);
+ }
+ }
+ // <--
+ if (IsFldEdit() && !sOldSel.Len())
+ sOldSel = String::CreateFromInt32( pRefFld->GetSeqNo() + 1 );
+
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.SetUpdateMode(FALSE);
+ aSelectionToolTipLB.Clear();
+ bool bShowSelectionToolTipLB( false );
+ // <--
+
+ if( REFFLDFLAG & nTypeId )
+ {
+ if (nTypeId == REFFLDFLAG_BOOKMARK) // TextMarken!
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT);
+ // alle Textmarken besorgen
+ IDocumentMarkAccess* const pMarkAccess = pSh->getIDocumentMarkAccess();
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
+ ppMark != pMarkAccess->getBookmarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* pBkmk = ppMark->get();
+ if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(*pBkmk))
+ aSelectionLB.InsertEntry( pBkmk->GetName() );
+ }
+ if (IsFldEdit())
+ sOldSel = pRefFld->GetSetRefName();
+ }
+ else if (nTypeId == REFFLDFLAG_FOOTNOTE)
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle() & ~WB_SORT);
+ SwSeqFldList aArr;
+ USHORT nCnt = pSh->GetSeqFtnList( aArr );
+
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && pRefFld->GetSeqNo() == aArr[ n ]->nSeqNo)
+ sOldSel = aArr[n]->sDlgEntry;
+ }
+ }
+ else if (nTypeId == REFFLDFLAG_ENDNOTE)
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle() & ~WB_SORT);
+ SwSeqFldList aArr;
+ USHORT nCnt = pSh->GetSeqFtnList( aArr, true );
+
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && pRefFld->GetSeqNo() == aArr[ n ]->nSeqNo)
+ sOldSel = aArr[n]->sDlgEntry;
+ }
+ }
+ // --> OD 2007-11-14 #i83479#
+ else if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ bShowSelectionToolTipLB = true;
+
+ const IDocumentOutlineNodes* pIDoc( pSh->getIDocumentOutlineNodesAccess() );
+ pIDoc->getOutlineNodes( maOutlineNodes );
+ bool bCertainTxtNodeSelected( false );
+ SvLBoxEntry* pEntry = 0;
+ sal_uInt16 nOutlIdx = 0;
+ for ( nOutlIdx = 0; nOutlIdx < maOutlineNodes.size(); ++nOutlIdx )
+ {
+ pEntry = aSelectionToolTipLB.InsertEntry(
+ pIDoc->getOutlineText( nOutlIdx, true, true ) );
+ pEntry->SetUserData( reinterpret_cast<void*>(nOutlIdx) );
+ if ( ( IsFldEdit() &&
+ pRefFld->GetReferencedTxtNode() == maOutlineNodes[nOutlIdx] ) ||
+ GetSavedSelectedTxtNode() == maOutlineNodes[nOutlIdx] )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ bCertainTxtNodeSelected = true;
+ }
+ else if ( !bCertainTxtNodeSelected &&
+ GetSavedSelectedPos() == nOutlIdx )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ }
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ bShowSelectionToolTipLB = true;
+
+ const IDocumentListItems* pIDoc( pSh->getIDocumentListItemsAccess() );
+ pIDoc->getNumItems( maNumItems );
+ bool bCertainTxtNodeSelected( false );
+ SvLBoxEntry* pEntry = 0;
+ sal_uInt16 nNumItemIdx = 0;
+ for ( nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
+ {
+ pEntry = aSelectionToolTipLB.InsertEntry(
+ pIDoc->getListItemText( *maNumItems[nNumItemIdx], true, true ) );
+ pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
+ if ( ( IsFldEdit() &&
+ pRefFld->GetReferencedTxtNode() == maNumItems[nNumItemIdx]->GetTxtNode() ) ||
+ GetSavedSelectedTxtNode() == maNumItems[nNumItemIdx]->GetTxtNode() )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ bCertainTxtNodeSelected = true;
+ }
+ else if ( !bCertainTxtNodeSelected &&
+ GetSavedSelectedPos() == nNumItemIdx )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ }
+ }
+ }
+ // <--
+ else
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT);
+ // zum Seq-FeldTyp die Felder besorgen:
+
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(
+ nTypeId & ~REFFLDFLAG, RES_SETEXPFLD );
+ if( pType )
+ {
+ SwSeqFldList aArr;
+ // old selection should be kept in non-edit mode
+ if(IsFldEdit())
+ sOldSel.Erase();
+
+ USHORT nCnt = pType->GetSeqFldList( aArr );
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && !sOldSel.Len() &&
+ aArr[ n ]->nSeqNo == pRefFld->GetSeqNo())
+ sOldSel = aArr[ n ]->sDlgEntry;
+ }
+
+ if (IsFldEdit() && !sOldSel.Len())
+ sOldSel = String::CreateFromInt32( pRefFld->GetSeqNo() + 1);
+ }
+ }
+ }
+ else
+ {
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ for (USHORT i = 0; i < aLst.Count(); ++i)
+ aSelectionLB.InsertEntry(*aLst[i]);
+
+ if (IsFldEdit())
+ sOldSel = pRefFld->GetSetRefName();
+ }
+
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.Show( bShowSelectionToolTipLB );
+ aSelectionLB.Show( !bShowSelectionToolTipLB );
+ if ( bShowSelectionToolTipLB )
+ {
+ aSelectionToolTipLB.SetUpdateMode(TRUE);
+
+ BOOL bEnable = aSelectionToolTipLB.GetEntryCount() != 0;
+ aSelectionToolTipLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if ( aSelectionToolTipLB.GetCurEntry() != 0 )
+ {
+ aSelectionToolTipLB.MakeVisible( aSelectionToolTipLB.GetCurEntry() );
+ }
+
+ if ( IsFldEdit() && aSelectionToolTipLB.GetCurEntry() == 0 )
+ {
+ aNameED.SetText(sOldSel);
+ }
+ }
+ else
+ {
+ aSelectionLB.SetUpdateMode(TRUE);
+
+ // Enable oder Disable
+ BOOL bEnable = aSelectionLB.GetEntryCount() != 0;
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if ( bEnable )
+ {
+ aSelectionLB.SelectEntry(sOldSel);
+ if (!aSelectionLB.GetSelectEntryCount() && !IsFldEdit())
+ aSelectionLB.SelectEntryPos(0);
+ }
+
+ if (IsFldEdit() && !aSelectionLB.GetSelectEntryCount()) // Falls die Referenz schon geloescht wurde...
+ aNameED.SetText(sOldSel);
+ }
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldRefPage::FillFormatLB(USHORT nTypeId)
+{
+ String sOldSel;
+
+ USHORT nFormatSel = aFormatLB.GetSelectEntryPos();
+ if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aFormatLB.GetEntry(nFormatSel);
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ // Referenz hat weniger als die Beschriftung
+ USHORT nSize( 0 );
+ bool bAddCrossRefFormats( false );
+ switch (nTypeId)
+ {
+ // --> OD 2007-11-16 #i83479#
+ case REFFLDFLAG_HEADING:
+ case REFFLDFLAG_NUMITEM:
+ bAddCrossRefFormats = true;
+ // intentional no break here
+ // <--
+
+ case TYP_GETREFFLD:
+ case REFFLDFLAG_BOOKMARK:
+ case REFFLDFLAG_FOOTNOTE:
+ case REFFLDFLAG_ENDNOTE:
+ nSize = FMT_REF_PAGE_PGDSC - FMT_REF_BEGIN + 1;
+ break;
+
+ default:
+ // --> OD 2007-11-16 #i83479#
+// nSize = GetFldMgr().GetFormatCount( (REFFLDFLAG & nTypeId)
+// ? (USHORT)TYP_GETREFFLD : nTypeId,
+// FALSE, IsFldDlgHtmlMode() );
+ if ( REFFLDFLAG & nTypeId )
+ {
+ nSize = FMT_REF_ONLYSEQNO - FMT_REF_BEGIN + 1;
+ }
+ else
+ {
+ nSize = GetFldMgr().GetFormatCount( nTypeId, FALSE, IsFldDlgHtmlMode() );
+ }
+ break;
+ }
+
+ if (REFFLDFLAG & nTypeId)
+ nTypeId = TYP_GETREFFLD;
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, i ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, i )));
+ }
+ // --> OD 2007-11-16 #i83479#
+ if ( bAddCrossRefFormats )
+ {
+ USHORT nFormat = FMT_REF_NUMBER - FMT_REF_BEGIN;
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nFormat = FMT_REF_NUMBER_NO_CONTEXT - FMT_REF_BEGIN;
+ nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nFormat = FMT_REF_NUMBER_FULL_CONTEXT - FMT_REF_BEGIN;
+ nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nSize += 3;
+ }
+ // <--
+
+ // select a certain entry
+ if (nSize)
+ {
+ if (!IsFldEdit())
+ aFormatLB.SelectEntry(sOldSel);
+ else
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_REF_BEGIN + (USHORT)GetCurField()->GetFormat()));
+
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntryPos(nFldDlgFmtSel);
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+ }
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String aName(aNameED.GetText());
+ const USHORT nLen = aName.Len();
+
+ BOOL bEnable = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if ((nTypeId == TYP_SETREFFLD && !GetFldMgr().CanInsertRefMark(aName)) ||
+ (nLen == 0 && (nTypeId == TYP_GETREFFLD || nTypeId == TYP_SETREFFLD ||
+ nTypeId == REFFLDFLAG_BOOKMARK)))
+ bEnable = FALSE;
+
+ EnableInsert(bEnable);
+
+ aSelectionLB.SelectEntry(aName);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldRefPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ USHORT nSubType = 0;
+ ULONG nFormat;
+
+ nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ switch(nTypeId)
+ {
+ case TYP_GETREFFLD:
+ // aName = aSelectionLB.GetSelectEntry();
+ nSubType = REF_SETREFATTR;
+ break;
+
+ case TYP_SETREFFLD:
+ {
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_SETEXPFLD, aName);
+
+ if(!pType) // Nur einfuegen, wenn es den Namen noch nicht gibt
+ {
+ aSelectionLB.InsertEntry(aName);
+ aSelectionLB.Enable();
+ aSelectionFT.Enable();
+ }
+ break;
+ }
+ }
+
+ SwGetRefField* pRefFld = (SwGetRefField*)GetCurField();
+
+ if (REFFLDFLAG & nTypeId)
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ {
+ pSh = ::GetActiveWrtShell();
+ }
+ if (nTypeId == REFFLDFLAG_BOOKMARK) // TextMarken!
+ {
+ aName = aNameED.GetText();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ else if (REFFLDFLAG_FOOTNOTE == nTypeId) // Fussnoten
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_FOOTNOTE;
+ aName.Erase();
+
+ if (pSh->GetSeqFtnList(aArr) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ else if (REFFLDFLAG_ENDNOTE == nTypeId) // Endnoten
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_ENDNOTE;
+ aName.Erase();
+
+ if (pSh->GetSeqFtnList(aArr, true) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ // --> OD 2007-11-16 #i83479#
+ else if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ ASSERT( pEntry,
+ "<SwFldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
+ if ( pEntry )
+ {
+ const sal_uInt16 nOutlIdx( static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData())) );
+ pSh->getIDocumentOutlineNodesAccess()->getOutlineNodes( maOutlineNodes );
+ if ( nOutlIdx < maOutlineNodes.size() )
+ {
+ ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode(
+ *(maOutlineNodes[nOutlIdx]),
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK);
+ aName = pMark->GetName();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ ASSERT( pEntry,
+ "<SwFldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
+ if ( pEntry )
+ {
+ const sal_uInt16 nNumItemIdx( static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData())) );
+ pSh->getIDocumentListItemsAccess()->getNumItems( maNumItems );
+ if ( nNumItemIdx < maNumItems.size() )
+ {
+ ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode(
+ *(maNumItems[nNumItemIdx]->GetTxtNode()),
+ IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK);
+ aName = pMark->GetName();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ }
+ }
+ // <--
+ else // SeqenceFelder
+ {
+ // zum Seq-FeldTyp die Felder besorgen:
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(
+ nTypeId & ~REFFLDFLAG, RES_SETEXPFLD );
+ if( pType )
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_SEQUENCEFLD;
+ aName = pType->GetName();
+
+ if (pType->GetSeqFldList(aArr) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ }
+ }
+
+ if (IsFldEdit() && nTypeId == TYP_GETREFFLD)
+ {
+ aVal.Insert('|', 0);
+ aVal.Insert(String::CreateFromInt32(nSubType), 0);
+ }
+
+ if (!IsFldEdit() || bModified ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aTypeLB.GetSavedValue() != aTypeLB.GetSelectEntryPos() ||
+ aSelectionLB.GetSavedValue() != aSelectionLB.GetSelectEntryPos() ||
+ aFormatLB.GetSavedValue() != aFormatLB.GetSelectEntryPos())
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat );
+ }
+
+ ModifyHdl(); // Insert ggf enablen/disablen
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldRefPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldRefPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldRefPage::GetGroup()
+{
+ return GRP_REF;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldRefPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
new file mode 100644
index 000000000000..0facb24bf823
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDREF_HXX
+#define _SWFLDREF_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+
+#include "fldpage.hxx"
+// --> OD 2007-11-15 #i83479#
+#include <IDocumentOutlineNodes.hxx>
+#include <IDocumentListItems.hxx>
+#include <FldRefTreeListBox.hxx>
+class SwTxtNode;
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldRefPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ // --> OD 2007-11-21 #i83479#
+ SwFldRefTreeListBox aSelectionToolTipLB;
+ // <--
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aValueFT;
+ Edit aValueED;
+ const String sBookmarkTxt;
+ const String sFootnoteTxt;
+ const String sEndnoteTxt;
+ // --> OD 2007-11-09 #i83479#
+ const String sHeadingTxt;
+ const String sNumItemTxt;
+
+ IDocumentOutlineNodes::tSortedOutlineNodeList maOutlineNodes;
+ IDocumentListItems::tSortedNodeNumList maNumItems;
+
+ // selected text node in the listbox for headings and numbered items
+ // in order to restore selection after update of selection listbox
+ const SwTxtNode* mpSavedSelectedTxtNode;
+ // fallback, if previously selected text node doesn't exist anymore
+ sal_uInt16 mnSavedSelectedPos;
+ // <--
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pEd = 0 );
+
+ void UpdateSubType();
+ USHORT FillFormatLB(USHORT nTypeId);
+
+ // --> OD 2007-12-05 #i83479#
+ void SaveSelectedTxtNode();
+ const SwTxtNode* GetSavedSelectedTxtNode() const;
+ sal_uInt16 GetSavedSelectedPos() const;
+ // <--
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldRefPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldRefPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldref.src b/sw/source/ui/fldui/fldref.src
new file mode 100644
index 000000000000..847c9358db69
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.src
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_REF
+{
+ HelpID = HID_FLD_REF ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_REFTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_REFTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_REFSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~election" ;
+ Left = TRUE ;
+ };
+ ListBox LB_REFSELECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 166 , 73 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ /* TreeListBox in order to have tool tips - shares window position and size with LB_REFSELECTION */
+ Control LB_REFSELECTION_TOOLTIP
+ {
+ HelpID = HID_REFSELECTION_TOOLTIP ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 166 , 73 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_REFFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 93 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Insert ~reference to" ;
+ };
+ ListBox LB_REFFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 104 ) ;
+ Size = MAP_APPFONT ( 76 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ // Sort = TRUE;
+ };
+ FixedText FT_REFNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 93 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_REFNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 104 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_REFVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 122 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Disable = TRUE ;
+ Left = TRUE ;
+ };
+ Edit ED_REFVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 136 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Left = TRUE ;
+ };
+ String STR_REFBOOKMARK
+ {
+ Text [ en-US ] = "Bookmarks" ;
+ };
+ String STR_REFFOOTNOTE
+ {
+ Text [ en-US ] = "Footnotes" ;
+ };
+ String STR_REFENDNOTE
+ {
+ Text [ en-US ] = "Endnotes" ;
+ };
+ String STR_REFHEADING
+ {
+ Text [ en-US ] = "Headings" ;
+ };
+ String STR_REFNUMITEM
+ {
+ Text [ en-US ] = "Numbered Paragraphs" ;
+ };
+ Text [ en-US ] = "Cross-references" ;
+};
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
new file mode 100644
index 000000000000..308bc379d4f4
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <swtypes.hxx>
+#include <unotools/confignode.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#include <docsh.hxx>
+#include <fldwrap.hxx>
+#include <flddb.hxx>
+#include <flddinf.hxx>
+#include <fldvar.hxx>
+#include <flddok.hxx>
+#include <fldfunc.hxx>
+#include <fldref.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <fldtdlg.hxx>
+#include <swmodule.hxx>
+
+#include <helpid.h>
+#include <fldui.hrc>
+#include <globals.hrc>
+#include <fldtdlg.hrc>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Traeger des Dialoges
+ --------------------------------------------------------------------*/
+
+
+SwFldDlg::SwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent)
+ : SfxTabDialog( pParent, SW_RES( DLG_FLD_INSERT )),
+ m_pChildWin(pCW),
+ m_pBindings(pB),
+ m_bDataBaseMode(FALSE)
+{
+ SetStyle(GetStyle()|WB_STDMODELESS);
+ m_bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
+
+ RemoveResetButton();
+
+ GetOKButton().SetText(String(SW_RES(STR_FLD_INSERT)));
+ GetOKButton().SetHelpId(HID_FIELD_INSERT);
+ GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+
+ GetCancelButton().SetText(String(SW_RES(STR_FLD_CLOSE)));
+ GetCancelButton().SetHelpId(HID_FIELD_CLOSE);
+ GetCancelButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+
+ FreeResource();
+
+ GetOKButton().SetClickHdl(LINK(this, SwFldDlg, OKHdl));
+
+ AddTabPage(TP_FLD_DOK, SwFldDokPage::Create, 0);
+ AddTabPage(TP_FLD_VAR, SwFldVarPage::Create, 0);
+ AddTabPage(TP_FLD_DOKINF, SwFldDokInfPage::Create, 0);
+
+ if (!m_bHtmlMode)
+ {
+ AddTabPage(TP_FLD_REF, SwFldRefPage::Create, 0);
+ AddTabPage(TP_FLD_FUNC, SwFldFuncPage::Create, 0);
+
+ utl::OConfigurationTreeRoot aCfgRoot
+ = utl::OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.Office.DataAccess/Policies/Features/Writer" ) ),
+ -1,
+ utl::OConfigurationTreeRoot::CM_READONLY);
+
+ sal_Bool bDatabaseFields = sal_True;
+ aCfgRoot.getNodeValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseFields"))) >>= bDatabaseFields;
+
+ if (bDatabaseFields)
+ AddTabPage(TP_FLD_DB, SwFldDBPage::Create, 0);
+ else
+ RemoveTabPage(TP_FLD_DB);
+ }
+ else
+ {
+ RemoveTabPage(TP_FLD_REF);
+ RemoveTabPage(TP_FLD_FUNC);
+ RemoveTabPage(TP_FLD_DB);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDlg::~SwFldDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldDlg::Close()
+{
+ m_pBindings->GetDispatcher()->
+ Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::Initialize(SfxChildWinInfo *pInfo)
+{
+ Point aPos;
+ Size aSize;
+
+ if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 )
+ {
+ aPos = pInfo->aPos;
+ if ( GetStyle() & WB_SIZEABLE )
+ SetSizePixel( pInfo->aSize );
+
+ // Initiale Gr"o\se aus pInfo merken
+ aSize = GetSizePixel();
+
+ // Soll das FloatingWindow eingezoomt werden ?
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ RollUp();
+ }
+ else
+ {
+ // Initiale Gr"o\se aus Resource oder ctor merken
+ aSize = GetSizePixel();
+
+ Size aParentSize = GetParent()->GetOutputSizePixel();
+ aPos.X() += ( aParentSize.Width() - aSize.Width() ) / 2;
+ aPos.Y() += ( aParentSize.Height() - aSize.Height() ) / 2;
+ }
+
+ Point aPoint;
+ Rectangle aRect = GetDesktopRectPixel();
+ aPoint.X() = aRect.Right() - aSize.Width();
+ aPoint.Y() = aRect.Bottom() - aSize.Height();
+
+ aPoint = OutputToScreenPixel( aPoint );
+
+ if ( aPos.X() > aPoint.X() )
+ aPos.X() = aPoint.X() ;
+ if ( aPos.Y() > aPoint.Y() )
+ aPos.Y() = aPoint.Y();
+
+ if ( aPos.X() < 0 ) aPos.X() = 0;
+ if ( aPos.Y() < 0 ) aPos.Y() = 0;
+
+ SetPosPixel( aPos );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxItemSet* SwFldDlg::CreateInputItemSet( USHORT nID )
+{
+ if ( nID == TP_FLD_DOKINF )
+ {
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ uno::Reference< beans::XPropertySet > xUDProps(
+ xDocProps->getUserDefinedProperties(),
+ uno::UNO_QUERY_THROW);
+ pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) );
+ return pISet;
+ }
+ else
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von neuen Feldern anstossen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDlg, OKHdl, Button *, EMPTYARG )
+{
+ if (GetOKButton().IsEnabled())
+ {
+ SfxTabPage* pPage = GetTabPage(GetCurPageId());
+ pPage->FillItemSet(*(SfxItemSet*)0);
+
+ GetOKButton().GrabFocus(); // Wegen InputField-Dlg
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::ReInitDlg()
+{
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ BOOL bNewMode = (::GetHtmlMode(pDocSh) & HTMLMODE_ON) != 0;
+
+ if (bNewMode != m_bHtmlMode)
+ {
+ SfxViewFrame::Current()->GetDispatcher()->
+ Execute(FN_INSERT_FIELD, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ Close();
+ }
+
+ SwView* pActiveView = ::GetActiveView();
+ if(!pActiveView)
+ return;
+ const SwWrtShell& rSh = pActiveView->GetWrtShell();
+ GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
+ !rSh.HasReadonlySel() );
+
+ ReInitTabPage(TP_FLD_DOK);
+ ReInitTabPage(TP_FLD_VAR);
+ ReInitTabPage(TP_FLD_DOKINF);
+
+ if (!m_bHtmlMode)
+ {
+ ReInitTabPage(TP_FLD_REF);
+ ReInitTabPage(TP_FLD_FUNC);
+ ReInitTabPage(TP_FLD_DB);
+ }
+
+ m_pChildWin->SetOldDocShell(pDocSh);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel TabPage neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::ReInitTabPage( USHORT nPageId, BOOL bOnlyActivate )
+{
+ SwFldPage* pPage = (SwFldPage* )GetTabPage(nPageId);
+
+ if ( pPage )
+ pPage->EditNewField( bOnlyActivate ); // TabPage neu initialisieren
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Aktivierung einige TabPages neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::Activate()
+{
+ SwView* pView = ::GetActiveView();
+ if( pView )
+ {
+ BOOL bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
+ const SwWrtShell& rSh = pView->GetWrtShell();
+ GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
+ !rSh.HasReadonlySel() );
+
+ ReInitTabPage( TP_FLD_VAR, TRUE );
+
+ if( !bHtmlMode )
+ {
+ ReInitTabPage( TP_FLD_REF, TRUE );
+ ReInitTabPage( TP_FLD_FUNC, TRUE );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::EnableInsert(BOOL bEnable)
+{
+ if( bEnable )
+ {
+ SwView* pView = ::GetActiveView();
+ DBG_ASSERT(pView, "no view found");
+ if( !pView ||
+ (pView->GetWrtShell().IsReadOnlyAvailable() &&
+ pView->GetWrtShell().HasReadonlySel()) )
+ bEnable = FALSE;
+ }
+ GetOKButton().Enable(bEnable);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::InsertHdl()
+{
+ GetOKButton().Click();
+}
+/* -----------------27.11.2002 15:24-----------------
+ *
+ * --------------------------------------------------*/
+void SwFldDlg::ActivateDatabasePage()
+{
+ m_bDataBaseMode = TRUE;
+ ShowPage( TP_FLD_DB );
+ SfxTabPage* pDBPage = GetTabPage( TP_FLD_DB );
+ if( pDBPage )
+ {
+ ((SwFldDBPage*)pDBPage)->ActivateMailMergeAddress();
+ }
+ //remove all other pages
+ RemoveTabPage(TP_FLD_DOK);
+ RemoveTabPage(TP_FLD_VAR);
+ RemoveTabPage(TP_FLD_DOKINF);
+ RemoveTabPage(TP_FLD_REF);
+ RemoveTabPage(TP_FLD_FUNC);
+}
+/*-- 07.10.2003 14:01:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldDlg::PageCreated(USHORT nId, SfxTabPage& rPage)
+{
+ if( TP_FLD_DB == nId)
+ {
+ SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
+ SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0;
+ if(pViewFrame)
+ {
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aSwViewTypeId );
+ while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
+ {
+ pViewShell = SfxViewShell::GetNext( *pViewShell, &aSwViewTypeId );
+ }
+ if(pViewShell)
+ static_cast<SwFldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/fldui/fldtdlg.hrc b/sw/source/ui/fldui/fldtdlg.hrc
new file mode 100644
index 000000000000..221b943779c0
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.hrc
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _FLDTDLG_HRC
+#define _FLDTDLG_HRC
+
+// #include -----------------------------------------------------------------
+
+// #define ------------------------------------------------------------------
+
+#define RC_FLDTDLG_BEGIN 0
+
+// Datenbankfeld-TabPage:
+#define RC_TP_DB_START (RC_FLDTDLG_BEGIN)
+#define FT_DBTYPE (RC_TP_DB_START + 1)
+#define LB_DBTYPE (RC_TP_DB_START + 2)
+#define FL_DBFORMAT (RC_TP_DB_START + 3)
+#define FT_DBSELECTION (RC_TP_DB_START + 4)
+#define TLB_DBLIST (RC_TP_DB_START + 5)
+#define FT_DBCONDITION (RC_TP_DB_START + 6)
+#define FT_DBSETNUMBER (RC_TP_DB_START + 7)
+#define ED_DBCONDITION (RC_TP_DB_START + 8)
+#define ED_DBSETNUMBER (RC_TP_DB_START + 9)
+#define LB_DBFORMAT (RC_TP_DB_START + 10)
+#define LB_DBNUMFORMAT (RC_TP_DB_START + 11)
+#define RB_DBFORMAT (RC_TP_DB_START + 12)
+#define RB_DBOWNFORMAT (RC_TP_DB_START + 13)
+#define RC_TP_DB_END (RC_TP_DB_START + 14)
+#define FL_DBFORMAT_VERT (RC_TP_DB_START + 15)
+#define FT_ADDDB (RC_TP_DB_START + 16)
+#define PB_ADDDB (RC_TP_DB_START + 17)
+
+// Dokumentinfo-TabPage:
+#define RC_TP_DOCINF_START (RC_TP_DB_END)
+#define FT_DOKINFTYPE (RC_TP_DOCINF_START + 1)
+#define TLB_DOKINFTYPE (RC_TP_DOCINF_START + 2)
+#define FT_DOKINFSELECTION (RC_TP_DOCINF_START + 3)
+#define LB_DOKINFSELECTION (RC_TP_DOCINF_START + 4)
+#define FT_DOKINFFORMAT (RC_TP_DOCINF_START + 5)
+#define LB_DOKINFFORMAT (RC_TP_DOCINF_START + 6)
+#define CB_DOKINFFIXEDCONTENT (RC_TP_DOCINF_START + 7)
+#define BMP_DOKINFROOT_OPENED (RC_TP_DOCINF_START + 8)
+#define BMP_DOKINFROOT_CLOSED (RC_TP_DOCINF_START + 9)
+#define STR_DOKINF_INFO (RC_TP_DOCINF_START + 10)
+#define RC_TP_DOCINF_END (RC_TP_DOCINF_START + 11)
+
+// Variablen-TabPage:
+#define RC_TP_VAR_START (RC_TP_DOCINF_END)
+#define FT_VARTYPE (RC_TP_VAR_START + 1)
+#define LB_VARTYPE (RC_TP_VAR_START + 2)
+#define FT_VARSELECTION (RC_TP_VAR_START + 3)
+#define LB_VARSELECTION (RC_TP_VAR_START + 4)
+#define FT_VARNAME (RC_TP_VAR_START + 5)
+#define ED_VARNAME (RC_TP_VAR_START + 6)
+#define FT_VARVALUE (RC_TP_VAR_START + 7)
+#define ED_VARVALUE (RC_TP_VAR_START + 8)
+#define FT_VARFORMAT (RC_TP_VAR_START + 9)
+#define LB_VARNUMFORMAT (RC_TP_VAR_START + 10)
+#define LB_VARFORMAT (RC_TP_VAR_START + 11)
+#define FT_VARCHAPTERHEADER (RC_TP_VAR_START + 12)
+#define FT_VARCHAPTERLEVEL (RC_TP_VAR_START + 13)
+#define LB_VARCHAPTERLEVEL (RC_TP_VAR_START + 14)
+#define CB_VARINVISIBLE (RC_TP_VAR_START + 15)
+#define FT_VARSEPARATOR (RC_TP_VAR_START + 16)
+#define ED_VARSEPARATOR (RC_TP_VAR_START + 17)
+#define TBX_VARNEWDEL (RC_TP_VAR_START + 18)
+#define BT_VARAPPLY (RC_TP_VAR_START + 19)
+#define BT_VARDELETE (RC_TP_VAR_START + 20)
+#define RC_TP_VAR_END (RC_TP_VAR_START + 21)
+
+// Dokument-TabPage:
+#define RC_TP_DOC_START (RC_TP_VAR_END)
+#define FT_DOKTYPE (RC_TP_DOC_START + 1)
+#define LB_DOKTYPE (RC_TP_DOC_START + 2)
+#define FT_DOKSELECTION (RC_TP_DOC_START + 3)
+#define LB_DOKSELECTION (RC_TP_DOC_START + 4)
+#define LB_DOKNUMFORMAT (RC_TP_DOC_START + 5)
+#define LB_DOKFORMAT (RC_TP_DOC_START + 6)
+#define FT_DOKFORMAT (RC_TP_DOC_START + 7)
+#define FT_DOKVALUE (RC_TP_DOC_START + 8)
+#define ED_DOKVALUE (RC_TP_DOC_START + 9)
+#define ED_DOKLEVEL (RC_TP_DOC_START + 10)
+#define ED_DOKDATEOFF (RC_TP_DOC_START + 11)
+#define CB_DOKFIXEDCONTENT (RC_TP_DOC_START + 12)
+#define STR_DOKDATEOFF (RC_TP_DOC_START + 13)
+#define STR_DOKTIMEOFF (RC_TP_DOC_START + 14)
+#define BMP_DOKROOT_OPENED (RC_TP_DOC_START + 15)
+#define BMP_DOKROOT_CLOSED (RC_TP_DOC_START + 16)
+#define RC_TP_DOC_END (RC_TP_DOC_START + 17)
+
+// Funktion-TabPage:
+#define RC_TP_FUNC_START (RC_TP_DOC_END)
+#define FT_FUNCTYPE (RC_TP_FUNC_START + 1)
+#define LB_FUNCTYPE (RC_TP_FUNC_START + 2)
+#define LB_FUNCSELECTION (RC_TP_FUNC_START + 3)
+#define FT_FUNCSELECTION (RC_TP_FUNC_START + 4)
+#define FT_FUNCFORMAT (RC_TP_FUNC_START + 5)
+#define LB_FUNCFORMAT (RC_TP_FUNC_START + 6)
+#define FT_FUNCNAME (RC_TP_FUNC_START + 7)
+#define ED_FUNCNAME (RC_TP_FUNC_START + 8)
+#define FT_FUNCVALUE (RC_TP_FUNC_START + 9)
+#define ED_FUNCVALUE (RC_TP_FUNC_START + 10)
+#define FT_FUNCCOND1 (RC_TP_FUNC_START + 11)
+#define ED_FUNCCOND1 (RC_TP_FUNC_START + 12)
+#define FT_FUNCCOND2 (RC_TP_FUNC_START + 13)
+#define ED_FUNCCOND2 (RC_TP_FUNC_START + 14)
+#define BT_FUNCMACRO (RC_TP_FUNC_START + 15)
+#define RC_TP_FUNC_END (RC_TP_FUNC_START + 16)
+#define FT_LISTITEM (RC_TP_FUNC_START + 17)
+#define ED_LISTITEM (RC_TP_FUNC_START + 18)
+#define PB_LISTADD (RC_TP_FUNC_START + 19)
+#define FT_LISTITEMS (RC_TP_FUNC_START + 20)
+#define LB_LISTITEMS (RC_TP_FUNC_START + 21)
+#define PB_LISTREMOVE (RC_TP_FUNC_START + 22)
+#define PB_LISTUP (RC_TP_FUNC_START + 23)
+#define PB_LISTDOWN (RC_TP_FUNC_START + 24)
+#define FT_LISTNAME (RC_TP_FUNC_START + 25)
+#define ED_LISTNAME (RC_TP_FUNC_START + 26)
+
+// Referenz-TabPage:
+#define RC_TP_REF_START (RC_TP_FUNC_END)
+#define FT_REFTYPE (RC_TP_REF_START + 1)
+#define LB_REFTYPE (RC_TP_REF_START + 2)
+#define FT_REFSELECTION (RC_TP_REF_START + 3)
+#define LB_REFSELECTION (RC_TP_REF_START + 4)
+#define LB_REFSELECTION_TOOLTIP (RC_TP_REF_START + 5)
+#define LB_REFFORMAT (RC_TP_REF_START + 6)
+#define FT_REFFORMAT (RC_TP_REF_START + 7)
+#define FT_REFNAME (RC_TP_REF_START + 8)
+#define ED_REFNAME (RC_TP_REF_START + 9)
+#define FT_REFVALUE (RC_TP_REF_START + 10)
+#define ED_REFVALUE (RC_TP_REF_START + 11)
+#define STR_REFBOOKMARK (RC_TP_REF_START + 12)
+#define STR_REFFOOTNOTE (RC_TP_REF_START + 13)
+#define STR_REFENDNOTE (RC_TP_REF_START + 14)
+#define STR_REFHEADING (RC_TP_REF_START + 15)
+#define STR_REFNUMITEM (RC_TP_REF_START + 16)
+#define RC_TP_REF_END (RC_TP_REF_START + 17)
+
+#define RC_TP_END (RC_TP_REF_END)
+
+// Strings ------------------------------------------------------------------
+
+#define STR_FLD_INSERT (RC_TP_END + 1)
+#define STR_FLD_CLOSE (RC_TP_END + 2)
+
+#endif
diff --git a/sw/source/ui/fldui/fldtdlg.src b/sw/source/ui/fldui/fldtdlg.src
new file mode 100644
index 000000000000..3034146466e3
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldui.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabDialog DLG_FLD_INSERT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FLD_DOK ;
+ PageResID = TP_FLD_DOK ;
+ Text [ en-US ] = "Document" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_REF ;
+ PageResID = TP_FLD_REF ;
+ Text [ en-US ] = "Cross-references" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_FUNC ;
+ PageResID = TP_FLD_FUNC ;
+ Text [ en-US ] = "Functions" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_DOKINF ;
+ PageResID = TP_FLD_DOKINF ;
+ Text [ en-US ] = "DocInformation" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_VAR ;
+ PageResID = TP_FLD_VAR ;
+ Text [ en-US ] = "Variables" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_DB ;
+ PageResID = TP_FLD_DB ;
+ Text [ en-US ] = "Database" ;
+ };
+ };
+ };
+ String STR_FLD_INSERT
+ {
+ Text [ en-US ] = "~Insert" ;
+ };
+ String STR_FLD_CLOSE
+ {
+ Text [ en-US ] = "~Close" ;
+ };
+ Text [ en-US ] = "Fields" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldui.src b/sw/source/ui/fldui/fldui.src
new file mode 100644
index 000000000000..7fb6a2e730c8
--- /dev/null
+++ b/sw/source/ui/fldui/fldui.src
@@ -0,0 +1,684 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define _FLDUI_SRC
+#include "index.hrc"
+#include "fldui.hrc"
+#include "helpid.h"
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings fuer die Types
+ --------------------------------------------------------------------*/
+String STR_FLD_EDIT_DLG
+{
+ Text [ en-US ] = "Edit Fields" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Strings fuer die Types
+ --------------------------------------------------------------------*/
+ //
+ // Bereich Dokument
+ //
+String STR_DATEFLD
+{
+ Text [ en-US ] = "Date" ;
+};
+String STR_TIMEFLD
+{
+ Text [ en-US ] = "Time" ;
+};
+String STR_FILENAMEFLD
+{
+ Text [ en-US ] = "File name" ;
+};
+String STR_DBNAMEFLD
+{
+ Text [ en-US ] = "Database Name" ;
+};
+String STR_CHAPTERFLD
+{
+ Text [ en-US ] = "Chapter" ;
+};
+String STR_PAGENUMBERFLD
+{
+ Text [ en-US ] = "Page numbers" ;
+};
+String STR_DOCSTATFLD
+{
+ Text [ en-US ] = "Statistics" ;
+};
+String STR_AUTHORFLD
+{
+ Text [ en-US ] = "Author" ;
+};
+String STR_TEMPLNAMEFLD
+{
+ Text [ en-US ] = "Templates" ;
+};
+String STR_EXTUSERFLD
+{
+ Text [ en-US ] = "Sender" ;
+};
+ //
+ // Bereich Funktionen
+ //
+String STR_SETFLD
+{
+ Text [ en-US ] = "Set variable" ;
+};
+String STR_GETFLD
+{
+ Text [ en-US ] = "Show variable" ;
+};
+String STR_FORMELFLD
+{
+ Text [ en-US ] = "Insert Formula" ;
+};
+String STR_INPUTFLD
+{
+ Text [ en-US ] = "Input field" ;
+};
+String STR_SETINPUTFLD
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ Text [ en-US ] = "Input field (variable)" ;
+};
+String STR_USRINPUTFLD
+{
+ Text [ en-US ] = "Input field (user)" ;
+};
+String STR_CONDTXTFLD
+{
+ Text [ en-US ] = "Conditional text" ;
+};
+String STR_DDEFLD
+{
+ Text [ en-US ] = "DDE field" ;
+};
+String STR_MACROFLD
+{
+ Text [ en-US ] = "Execute macro" ;
+};
+String STR_SEQFLD
+{
+ Text [ en-US ] = "Number range" ;
+};
+String STR_SETREFPAGEFLD
+{
+ Text [ en-US ] = "Set page variable" ;
+};
+String STR_GETREFPAGEFLD
+{
+ Text [ en-US ] = "Show page variable" ;
+};
+String STR_INTERNETFLD
+{
+ Text [ en-US ] = "Load URL" ;
+};
+String STR_JUMPEDITFLD
+{
+ Text [ en-US ] = "Placeholder" ;
+};
+String STR_COMBINED_CHARS
+{
+ Text [ en-US ] = "Combine characters";
+};
+String STR_DROPDOWN
+{
+ Text [ en-US ] = "Input list" ;
+};
+ //
+ // Bereich Referenzen
+ //
+String STR_SETREFFLD
+{
+ Text [ en-US ] = "Set Reference" ;
+};
+String STR_GETREFFLD
+{
+ Text [ en-US ] = "Insert Reference" ;
+};
+ //
+ // Bereich Datenbank
+ //
+String STR_DBFLD
+{
+ Text [ en-US ] = "Mail merge fields" ;
+};
+String STR_DBNEXTSETFLD
+{
+ Text [ en-US ] = "Next record" ;
+};
+String STR_DBNUMSETFLD
+{
+ Text [ en-US ] = "Any record" ;
+};
+String STR_DBSETNUMBERFLD
+{
+ Text [ en-US ] = "Record number" ;
+};
+String STR_PREVPAGEFLD
+{
+ Text [ en-US ] = "Previous page" ;
+};
+String STR_NEXTPAGEFLD
+{
+ Text [ en-US ] = "Next page" ;
+};
+String STR_HIDDENTXTFLD
+{
+ Text [ en-US ] = "Hidden text" ;
+};
+ //
+ // Bereich Benutzerfelder
+ //
+String STR_USERFLD
+{
+ Text [ en-US ] = "User Field" ;
+};
+String STR_POSTITFLD
+{
+ Text [ en-US ] = "Note" ;
+};
+String STR_SCRIPTFLD
+{
+ Text [ en-US ] = "Script" ;
+};
+String STR_AUTHORITY
+{
+ Text [ en-US ] = "Bibliography entry";
+};
+String STR_HIDDENPARAFLD
+{
+ Text [ en-US ] = "Hidden Paragraph" ;
+};
+ //
+ // Bereich DokumentInfo
+ //
+String STR_DOCINFOFLD
+{
+ Text [ en-US ] = "DocInformation" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: SubCmd-Strings
+ --------------------------------------------------------------------*/
+String FLD_DATE_STD
+{
+ Text [ en-US ] = "Date";
+};
+String FLD_DATE_FIX
+{
+ Text [ en-US ] = "Date (fixed)" ;
+};
+String FLD_TIME_STD
+{
+ Text [ en-US ] = "Time";
+};
+String FLD_TIME_FIX
+{
+ Text [ en-US ] = "Time (fixed)" ;
+};
+ //
+ // SubCmd Statistik
+ //
+String FLD_STAT_TABLE
+{
+ Text [ en-US ] = "Tables" ;
+};
+String FLD_STAT_CHAR
+{
+ Text [ en-US ] = "Characters" ;
+};
+String FLD_STAT_WORD
+{
+ Text [ en-US ] = "Words" ;
+};
+String FLD_STAT_PARA
+{
+ Text [ en-US ] = "Paragraphs" ;
+};
+String FLD_STAT_GRF
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String FLD_STAT_OBJ
+{
+ Text [ en-US ] = "Objects" ;
+};
+String FLD_STAT_PAGE
+{
+ Text [ en-US ] = "Pages" ;
+};
+ // SubCmd DDETypen
+ //
+String FMT_DDE_HOT
+{
+ Text [ en-US ] = "DDE automatic" ;
+};
+String FMT_DDE_NORMAL
+{
+ Text [ en-US ] = "DDE manual" ;
+};
+String FLD_INPUT_TEXT
+{
+ TEXT = "[Text]" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: SubType Extuser
+ --------------------------------------------------------------------*/
+String FLD_EU_FIRMA
+{
+ Text [ en-US ] = "Company" ;
+};
+String FLD_EU_VORNAME
+{
+ Text [ en-US ] = "First Name" ;
+};
+String FLD_EU_NAME
+{
+ Text [ en-US ] = "Last Name" ;
+};
+String FLD_EU_ABK
+{
+ Text [ en-US ] = "Initials" ;
+};
+String FLD_EU_STRASSE
+{
+ Text [ en-US ] = "Street" ;
+};
+String FLD_EU_LAND
+{
+ Text [ en-US ] = "Country" ;
+};
+String FLD_EU_PLZ
+{
+ Text [ en-US ] = "Zip code" ;
+};
+String FLD_EU_ORT
+{
+ Text [ en-US ] = "City" ;
+};
+String FLD_EU_TITEL
+{
+ Text [ en-US ] = "Title" ;
+};
+String FLD_EU_POS
+{
+ Text [ en-US ] = "Position" ;
+};
+String FLD_EU_TELPRIV
+{
+ Text [ en-US ] = "Tel. (Home)" ;
+};
+String FLD_EU_TELFIRMA
+{
+ Text [ en-US ] = "Tel. (Work)" ;
+};
+String FLD_EU_FAX
+{
+ Text [ en-US ] = "FAX" ;
+};
+String FLD_EU_EMAIL
+{
+ Text [ en-US ] = "E-mail" ;
+};
+String FLD_EU_STATE
+{
+ Text [ en-US ] = "State" ;
+};
+String FLD_PAGEREF_OFF
+{
+ Text [ en-US ] = "off" ;
+};
+String FLD_PAGEREF_ON
+{
+ Text [ en-US ] = "on" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Pfadname
+ --------------------------------------------------------------------*/
+ // Formate FileName
+String FMT_FF_NAME
+{
+ Text [ en-US ] = "File name" ;
+};
+String FMT_FF_NAME_NOEXT
+{
+ Text [ en-US ] = "File name without extension" ;
+};
+String FMT_FF_PATHNAME
+{
+ Text [ en-US ] = "Path/File name" ;
+};
+String FMT_FF_PATH
+{
+ Text [ en-US ] = "Path" ;
+};
+String FMT_FF_UI_NAME
+{
+ Text [ en-US ] = "Style" ;
+};
+String FMT_FF_UI_RANGE
+{
+ Text [ en-US ] = "Category" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Format Kapitel
+ --------------------------------------------------------------------*/
+String FMT_CHAPTER_NAME
+{
+ Text [ en-US ] = "Chapter name" ;
+};
+String FMT_CHAPTER_NO
+{
+ Text [ en-US ] = "Chapter number" ;
+};
+String FMT_CHAPTER_NO_NOSEPARATOR
+{
+ Text [ en-US ] = "Chapter number without separator" ;
+};
+String FMT_CHAPTER_NAMENO
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Kapitelnummer und Name : Nummer und Name */
+ Text [ en-US ] = "Chapter number and name" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Formate
+ --------------------------------------------------------------------*/
+String FMT_NUM_ABC
+{
+ TEXT = "A B C" ;
+};
+String FMT_NUM_SABC
+{
+ TEXT = "a b c" ;
+};
+String FMT_NUM_ABC_N
+{
+ TEXT = "A .. AA .. AAA" ;
+};
+String FMT_NUM_SABC_N
+{
+ TEXT = "a .. aa .. aaa" ;
+};
+String FMT_NUM_ROMAN
+{
+ Text [ en-US ] = "Roman (I II III)" ;
+};
+String FMT_NUM_SROMAN
+{
+ Text [ en-US ] = "Roman (i ii iii)" ;
+};
+String FMT_NUM_ARABIC
+{
+ Text [ en-US ] = "Arabic (1 2 3)" ;
+};
+String FMT_NUM_PAGEDESC
+{
+ Text [ en-US ] = "As Page Style" ;
+};
+String FMT_NUM_PAGESPECIAL
+{
+ Text [ en-US ] = "Text" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Author
+ --------------------------------------------------------------------*/
+String FMT_AUTHOR_NAME
+{
+ Text [ en-US ] = "Name" ;
+};
+String FMT_AUTHOR_SCUT
+{
+ Text [ en-US ] = "Initials" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Varibale setzen
+ --------------------------------------------------------------------*/
+String FMT_SETVAR_SYS
+{
+ Text [ en-US ] = "System" ;
+};
+String FMT_SETVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_GETVAR_NAME
+{
+ Text [ en-US ] = "Name" ;
+};
+String FMT_GETVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_USERVAR_CMD
+{
+ Text [ en-US ] = "Formula" ;
+};
+String FMT_USERVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_DBFLD_DB
+{
+ Text [ en-US ] = "Database" ;
+};
+String FMT_DBFLD_SYS
+{
+ Text [ en-US ] = "System" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Ablagefelder
+ --------------------------------------------------------------------*/
+String FMT_REG_AUTHOR
+{
+ Text [ en-US ] = "Author" ;
+};
+String FMT_REG_TIME
+{
+ Text [ en-US ] = "Time" ;
+};
+String FMT_REG_DATE
+{
+ Text [ en-US ] = "Date" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Formate Referenzen
+ --------------------------------------------------------------------*/
+String FMT_REF_TEXT
+{
+ Text [ en-US ] = "Reference" ;
+};
+String FMT_REF_PAGE
+{
+ Text [ en-US ] = "Page" ;
+};
+String FMT_REF_CHAPTER
+{
+ Text [ en-US ] = "Chapter" ;
+};
+String FMT_REF_UPDOWN
+{
+ Text [ en-US ] = "Above/Below" ;
+};
+String FMT_REF_PAGE_PGDSC
+{
+ Text [ en-US ] = "As Page Style" ;
+};
+String FMT_REF_ONLYNUMBER
+{
+ Text [ en-US ] = "Category and Number" ;
+};
+String FMT_REF_ONLYCAPTION
+{
+ Text [ en-US ] = "Caption Text" ;
+};
+String FMT_REF_ONLYSEQNO
+{
+ Text [ en-US ] = "Numbering";
+};
+String FMT_REF_NUMBER
+{
+ Text [ en-US ] = "Number";
+};
+String FMT_REF_NUMBER_NO_CONTEXT
+{
+ Text [ en-US ] = "Number (no context)";
+};
+String FMT_REF_NUMBER_FULL_CONTEXT
+{
+ Text [ en-US ] = "Number (full context)";
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Platzhalter
+ --------------------------------------------------------------------*/
+String FMT_MARK_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_MARK_TABLE
+{
+ Text [ en-US ] = "Table" ;
+};
+String FMT_MARK_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+String FMT_MARK_GRAFIC
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String FMT_MARK_OLE
+{
+ Text [ en-US ] = "Object" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Nur-Text
+ --------------------------------------------------------------------*/
+String FMT_TEXT
+{
+ TEXT = "Text" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: globale String-Ressourcen
+ --------------------------------------------------------------------*/
+String STR_ALL
+{
+ Text [ en-US ] = "All" ;
+};
+String STR_INSERT
+{
+ Text [ en-US ] = "Insert" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: AustauschStrings fuer Edit/NameFT
+ --------------------------------------------------------------------*/
+String STR_COND
+{
+ Text [ en-US ] = "~Condition" ;
+};
+String STR_TEXT
+{
+ Text [ en-US ] = "Then, Else" ;
+};
+String STR_DDE_CMD
+{
+ Text [ en-US ] = "DDE Statement" ;
+};
+String STR_INSTEXT
+{
+ Text [ en-US ] = "Hidden t~ext" ;
+};
+String STR_MACNAME
+{
+ Text [ en-US ] = "~Macro name" ;
+};
+String STR_PROMPT
+{
+ Text [ en-US ] = "~Reference" ;
+};
+String STR_COMBCHRS_FT
+{
+ Text [ en-US ] = "Ch~aracters";
+};
+String STR_SETNO
+{
+ Text [ en-US ] = "Record number" ;
+};
+String STR_OFFSET
+{
+ Text [ en-US ] = "O~ffset" ;
+};
+String STR_VALUE
+{
+ Text [ en-US ] = "Value" ;
+};
+String STR_FORMULA
+{
+ Text [ en-US ] = "Formula" ;
+};
+String STR_URLPROMPT
+{
+ Text [ en-US ] = "~URL" ;
+};
+String STR_ALL_DATABASE
+{
+ Text [ en-US ] = "<All>" ;
+};
+ImageButton BTN_FLDEDT_PREV
+{
+ Pos = MAP_APPFONT ( 263 , 115 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_PREV ;
+ Helpid = HID_DLG_FLDEDT_PREV ;
+};
+ImageButton BTN_FLDEDT_NEXT
+{
+ Pos = MAP_APPFONT ( 294 , 115 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_NEXT ;
+ Helpid = HID_DLG_FLDEDT_NEXT ;
+};
+PushButton PB_FLDEDT_ADDRESS
+{
+ Pos = MAP_APPFONT ( 294 , 100 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Edit" ;
+ Helpid = HID_DLG_FLDEDT_ADDRESS ;
+};
+String STR_CUSTOM
+{
+ Text [ en-US ] = "Custom" ;
+};
+
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
new file mode 100644
index 000000000000..6aee7bba2cf3
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -0,0 +1,1383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <swtypes.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <usrfld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <ddefld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDVAR_HXX
+#include <fldvar.hxx>
+#endif
+#include <calc.hxx>
+#include <svl/zformat.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldVarPage::SwFldVarPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage ( pParent, SW_RES( TP_FLD_VAR ), rCoreSet ),
+ aTypeFT (this, SW_RES(FT_VARTYPE)),
+ aTypeLB (this, SW_RES(LB_VARTYPE)),
+ aSelectionFT (this, SW_RES(FT_VARSELECTION)),
+ aSelectionLB (this, SW_RES(LB_VARSELECTION)),
+ aNameFT (this, SW_RES(FT_VARNAME)),
+ aNameED (this, SW_RES(ED_VARNAME)),
+ aValueFT (this, SW_RES(FT_VARVALUE)),
+ aValueED (this, SW_RES(ED_VARVALUE)),
+ aFormatFT (this, SW_RES(FT_VARFORMAT)),
+ aNumFormatLB (this, SW_RES(LB_VARNUMFORMAT)),
+ aFormatLB (this, SW_RES(LB_VARFORMAT)),
+ aChapterHeaderFT(this, SW_RES(FT_VARCHAPTERHEADER)),
+ aChapterLevelFT (this, SW_RES(FT_VARCHAPTERLEVEL)),
+ aChapterLevelLB (this, SW_RES(LB_VARCHAPTERLEVEL)),
+ aInvisibleCB (this, SW_RES(CB_VARINVISIBLE)),
+ aSeparatorFT (this, SW_RES(FT_VARSEPARATOR)),
+ aSeparatorED (this, SW_RES(ED_VARSEPARATOR)),
+ aNewDelTBX (this, SW_RES(TBX_VARNEWDEL)),
+ bInit (TRUE)
+{
+ FreeResource();
+
+ aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() );
+
+ long nDelta = ( aValueED.GetSizePixel().Height() -
+ aNewDelTBX.GetSizePixel().Height() ) / 2;
+ Point aNewPnt = aNewDelTBX.GetPosPixel();
+ aNewPnt.Y() += nDelta;
+ aNewDelTBX.SetPosPixel( aNewPnt );
+
+ sOldValueFT = aValueFT.GetText();
+ sOldNameFT = aNameFT.GetText();
+
+ for (USHORT i = 1; i <= MAXLEVEL; i++)
+ aChapterLevelLB.InsertEntry(String::CreateFromInt32(i));
+
+ aChapterLevelLB.SelectEntryPos(0);
+ //enable 'active' language selection
+ aNumFormatLB.SetShowLanguageControl(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldVarPage::~SwFldVarPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldVarPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for (short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ SwField* pCurField = GetCurField();
+ nTypeId = pCurField->GetTypeId();
+ if (nTypeId == TYP_SETINPFLD)
+ nTypeId = TYP_INPUTFLD;
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aNumFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldVarPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldVarPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aNumFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aNameED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
+ aValueED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
+ aNewDelTBX.SetClickHdl (LINK(this, SwFldVarPage, TBClickHdl));
+ aChapterLevelLB.SetSelectHdl (LINK(this, SwFldVarPage, ChapterHdl));
+ aSeparatorED.SetModifyHdl (LINK(this, SwFldVarPage, SeparatorHdl));
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(!IsRefresh() && sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = (USHORT)sVal.ToInt32();
+ if( USHRT_MAX != nVal )
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ if (IsFldEdit())
+ {
+ aSelectionLB.SaveValue();
+ aFormatLB.SaveValue();
+ nOldFormat = aNumFormatLB.GetFormat();
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ aInvisibleCB.SaveValue();
+ aChapterLevelLB.SaveValue();
+ aSeparatorED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel() || nOld == LISTBOX_ENTRY_NOTFOUND)
+ {
+ bInit = TRUE;
+ if (nOld != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ aValueED.SetDropEnable(FALSE);
+ UpdateSubType(); // Auswahl-Listboxen initialisieren
+ }
+
+ bInit = FALSE;
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, SubTypeHdl, ListBox *, pBox )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ USHORT nSelPos = aSelectionLB.GetSelectEntryPos();
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
+
+ if (IsFldEdit() && (!pBox || bInit))
+ {
+ if (nTypeId != TYP_FORMELFLD)
+ aNameED.SetText(GetFldMgr().GetCurFldPar1());
+
+ aValueED.SetText(GetFldMgr().GetCurFldPar2());
+ }
+
+ if (aNameFT.GetText() != sOldNameFT)
+ aNameFT.SetText(sOldNameFT);
+ if (aValueFT.GetText() != sOldValueFT)
+ aValueFT.SetText(sOldValueFT);
+
+ aNumFormatLB.SetUpdateMode(FALSE);
+ aFormatLB.SetUpdateMode(FALSE);
+ FillFormatLB(nTypeId);
+
+ USHORT nSize = aFormatLB.GetEntryCount();
+
+ BOOL bValue = FALSE, bName = FALSE, bNumFmt = FALSE,
+ bInvisible = FALSE, bSeparator = FALSE, bChapterLevel = FALSE;
+ BOOL bFormat = nSize != 0;
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ // Benutzertyp aendern oder anlegen
+ SwUserFieldType* pType = (SwUserFieldType*)
+ GetFldMgr().GetFldType(RES_USERFLD, nSelPos);
+
+ if (pType)
+ {
+ if (!IsFldEdit())
+ {
+ if (pBox || (bInit && !IsRefresh())) // Nur bei Interaktion mit Maus
+ {
+ aNameED.SetText(pType->GetName());
+
+ if (pType->GetType() == UF_STRING)
+ {
+ aValueED.SetText(pType->GetContent());
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ else
+ aValueED.SetText(pType->GetContent());
+// aValueED.SetText(pType->GetContent(aNumFormatLB.GetFormat()));
+ }
+ }
+ else
+ aValueED.SetText(pType->GetContent());
+ }
+ else
+ {
+ if (pBox) // Nur bei Interaktion mit Maus
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+ }
+ bValue = bName = bNumFmt = bInvisible = TRUE;
+
+ aValueED.SetDropEnable(TRUE);
+ break;
+ }
+
+ case TYP_SETFLD:
+ bValue = TRUE;
+
+ bNumFmt = bInvisible = TRUE;
+
+ if (!IsFldDlgHtmlMode())
+ bName = TRUE;
+ else
+ {
+ aNumFormatLB.Clear();
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ // gibt es ein entprechendes SetField
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ {
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ String sName(aSelectionLB.GetSelectEntry());
+ aNameED.SetText(sName);
+
+ if (!IsFldDlgHtmlMode())
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pSh->GetFldType(RES_SETEXPFLD, sName);
+
+ if (pSetTyp && pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING)
+ aNumFormatLB.SelectEntryPos(0); // Textuell
+ }
+ }
+ }
+ }
+ if (IsFldEdit())
+ {
+ // GetFormula fuehrt bei Datumsformaten zu Problemen,
+ // da nur der numerische Wert ohne Formatierung returned wird.
+ // Muss aber verwendet werden, da sonst bei GetPar2 nur der vom
+ // Kalkulator errechnete Wert angezeigt werden wuerde
+ // (statt test2 = test + 1)
+ aValueED.SetText(((SwSetExpField*)GetCurField())->GetFormula());
+ }
+ aValueED.SetDropEnable(TRUE);
+ break;
+
+ case TYP_FORMELFLD:
+ {
+ bValue = TRUE;
+ bNumFmt = TRUE;
+ aValueFT.SetText(SW_RESSTR(STR_FORMULA));
+ aValueED.SetDropEnable(TRUE);
+ }
+ break;
+
+ case TYP_GETFLD:
+ {
+ if (!IsFldEdit())
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ String sName(aSelectionLB.GetSelectEntry());
+ if (!IsFldEdit())
+ aNameED.SetText(sName);
+
+ // gibt es ein entprechendes SetField
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pSh->GetFldType(RES_SETEXPFLD, sName);
+
+ if(pSetTyp)
+ {
+ if (pSetTyp->GetType() & nsSwGetSetExpType::GSE_STRING) // Textuell?
+ bFormat = TRUE;
+ else // Numerisch
+ bNumFmt = TRUE;
+ }
+ }
+ }
+ else
+ bFormat = FALSE;
+
+ EnableInsert(bFormat|bNumFmt);
+ }
+ break;
+
+ case TYP_INPUTFLD:
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ bValue = bNumFmt = TRUE;
+
+ String sName;
+
+ sName = aSelectionLB.GetSelectEntry();
+ aNameED.SetText( sName );
+
+ // User- oder SetField ?
+ USHORT nInpType = 0;
+ nInpType = static_cast< USHORT >(GetFldMgr().GetFldType(RES_USERFLD, sName) ? 0 : TYP_SETINPFLD);
+
+ if (nInpType) // SETEXPFLD
+ {
+ // gibt es ein entprechendes SetField
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+
+ if(pSetTyp)
+ {
+ if (pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING) // Textuell?
+ {
+ aNumFormatLB.Clear();
+
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ }
+ if (IsFldEdit() && (!pBox || bInit) )
+ aValueED.SetText(((SwSetExpField*)GetCurField())->GetPromptText());
+ }
+ else // USERFLD
+ bFormat = bNumFmt = FALSE;
+ }
+ break;
+
+ case TYP_DDEFLD:
+ aValueFT.SetText(SW_RESSTR(STR_DDE_CMD));
+
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ {
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ SwDDEFieldType* pType =
+ (SwDDEFieldType*) GetFldMgr().GetFldType(RES_DDEFLD, nSelPos);
+
+ if(pType)
+ {
+ aNameED.SetText(pType->GetName());
+
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet
+ String sCmd( pType->GetCmd() );
+ USHORT nTmpPos = sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ' );
+ sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ', nTmpPos );
+
+ aValueED.SetText( sCmd );
+ aFormatLB.SelectEntryPos(pType->GetType());
+ }
+ }
+ }
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_SEQFLD:
+ {
+ // aNumRB.Check(TRUE);
+ bName = bValue = bSeparator = bChapterLevel = TRUE;
+
+ SwFieldType* pFldTyp;
+ if( IsFldEdit() )
+ pFldTyp = GetCurField()->GetTyp();
+ else
+ {
+ String sFldTypeName( aSelectionLB.GetEntry( nSelPos ));
+ if( sFldTypeName.Len() )
+ pFldTyp = GetFldMgr().GetFldType( RES_SETEXPFLD,
+ sFldTypeName );
+ else
+ pFldTyp = 0;
+ }
+
+ if( IsFldEdit() )
+ aValueED.SetText( ((SwSetExpField*)GetCurField())->
+ GetFormula() );
+
+ if( IsFldEdit() || pBox ) // Nur bei Interaktion mit Maus
+ aNameED.SetText( aSelectionLB.GetSelectEntry() );
+
+ if( pFldTyp )
+ {
+ BYTE nLevel = ((SwSetExpFieldType*)pFldTyp)->GetOutlineLvl();
+ if( 0x7f == nLevel )
+ aChapterLevelLB.SelectEntryPos( 0 );
+ else
+ aChapterLevelLB.SelectEntryPos( nLevel + 1 );
+ String sDelim = ((SwSetExpFieldType*)pFldTyp)->GetDelimiter();
+ aSeparatorED.SetText( sDelim );
+ ChapterHdl();
+ }
+ }
+ break;
+
+ case TYP_SETREFPAGEFLD:
+ {
+ bValue = FALSE;
+ aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
+
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ aNameED.SetText(aEmptyStr);
+
+ if (nSelPos != 0 && nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ bValue = TRUE; // SubType OFF - kennt keinen Offset
+ if (IsFldEdit())
+ aValueED.SetText(String::CreateFromInt32(((SwRefPageSetField*)GetCurField())->GetOffset()));
+ }
+ }
+ break;
+
+ case TYP_GETREFPAGEFLD:
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ break;
+ }
+
+ aNumFormatLB.Show(bNumFmt);
+ aFormatLB.Show(!bNumFmt);
+
+ if (IsFldEdit())
+ bName = FALSE;
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat|bNumFmt);
+ aNameFT.Enable(bName);
+ aNameED.Enable(bName);
+ aValueFT.Enable(bValue);
+ aValueED.Enable(bValue);
+
+ Size aSz(aFormatLB.GetSizePixel());
+
+ if (bChapterLevel)
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 94), MAP_APPFONT).Height();
+ else
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 123), MAP_APPFONT).Height();
+
+ aFormatLB.SetSizePixel(aSz);
+
+ aInvisibleCB.Show(!bSeparator);
+ aSeparatorFT.Show(bSeparator);
+ aSeparatorED.Show(bSeparator);
+ aChapterHeaderFT.Show(bChapterLevel);
+ aChapterLevelFT.Show(bChapterLevel);
+ aChapterLevelLB.Show(bChapterLevel);
+ aInvisibleCB.Enable(bInvisible);
+
+ ModifyHdl(); // Anwenden/Einfuegen/Loeschen Status update
+
+ aNumFormatLB.SetUpdateMode(TRUE);
+ aFormatLB.SetUpdateMode(TRUE);
+
+ if(aSelectionLB.IsCallAddSelection())
+ {
+ nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch (nTypeId)
+ {
+ case TYP_FORMELFLD:
+ {
+ nSelPos = aSelectionLB.GetSelectEntryPos();
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND && pBox && !bInit)
+ {
+ aValueED.ReplaceSelected(aSelectionLB.GetSelectEntry());
+ ModifyHdl();
+ }
+ }
+ break;
+ }
+ aSelectionLB.ResetCallAddSelection();
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in der SelectionBox erneuern
+ --------------------------------------------------------------------*/
+
+void SwFldVarPage::UpdateSubType()
+{
+ String sOldSel;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ SetSelectionSel(aSelectionLB.GetSelectEntryPos());
+ if(GetSelectionSel() != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aSelectionLB.GetEntry(GetSelectionSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+
+ SvStringsDtor aList;
+ GetFldMgr().GetSubTypes(nTypeId, aList);
+ USHORT nCount = aList.Count();
+ USHORT nPos;
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (nTypeId != TYP_INPUTFLD || i)
+ {
+ if (!IsFldEdit())
+ {
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+ else
+ {
+ BOOL bInsert = FALSE;
+
+ switch (nTypeId)
+ {
+ case TYP_INPUTFLD:
+ if (*aList[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+
+ case TYP_FORMELFLD:
+ bInsert = TRUE;
+ break;
+
+ case TYP_GETFLD:
+ if (*aList[i] == ((SwFormulaField*)GetCurField())->GetFormula())
+ bInsert = TRUE;
+ break;
+
+ case TYP_SETFLD:
+ case TYP_USERFLD:
+ if (*aList[i] == GetCurField()->GetTyp()->GetName())
+ {
+ bInsert = TRUE;
+ if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)
+ aInvisibleCB.Check();
+ }
+ break;
+
+ case TYP_SETREFPAGEFLD:
+ if ((((SwRefPageSetField*)GetCurField())->IsOn() && i) ||
+ (!((SwRefPageSetField*)GetCurField())->IsOn() && !i))
+ sOldSel = *aList[i];
+
+ // Alle Eintr?ge zur Auswahl zulassen:
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ break;
+
+ default:
+ if (*aList[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+ }
+ if (bInsert)
+ {
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (nTypeId != TYP_FORMELFLD)
+ break;
+ }
+ }
+ }
+ }
+
+ BOOL bEnable = aSelectionLB.GetEntryCount() != 0;
+ ListBox *pLB = 0;
+
+ if (bEnable)
+ {
+ aSelectionLB.SelectEntry(sOldSel);
+ if (!aSelectionLB.GetSelectEntryCount())
+ {
+ aSelectionLB.SelectEntryPos(0);
+ pLB = &aSelectionLB; // Alle Controls neu initialisieren
+ }
+ }
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ SubTypeHdl(pLB);
+ aSelectionLB.SetUpdateMode(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldVarPage::FillFormatLB(USHORT nTypeId)
+{
+ String sOldSel, sOldNumSel;
+ ULONG nOldNumFormat = 0;
+
+ USHORT nFormatSel = aFormatLB.GetSelectEntryPos();
+ if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aFormatLB.GetEntry(nFormatSel);
+
+ USHORT nNumFormatSel = aNumFormatLB.GetSelectEntryPos();
+ if (nNumFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ {
+ sOldNumSel = aNumFormatLB.GetEntry(nNumFormatSel);
+ nOldNumFormat = aNumFormatLB.GetFormat();
+ }
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+ aNumFormatLB.Clear();
+ BOOL bSpecialFmt = FALSE;
+
+ if( TYP_GETREFPAGEFLD != nTypeId )
+ {
+ if (IsFldEdit())
+ {
+ bSpecialFmt = GetCurField()->GetFormat() == SAL_MAX_UINT32;
+
+ if (!bSpecialFmt)
+ {
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+ sOldNumSel = aEmptyStr;
+ }
+ else
+ if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
+ aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
+ }
+ else
+ {
+ if (nOldNumFormat && nOldNumFormat != ULONG_MAX)
+ aNumFormatLB.SetDefFormat(nOldNumFormat);
+ else
+ aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
+ }
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ if (!IsFldEdit() || bSpecialFmt)
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_MARK_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_CMD), 1);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ }
+ break;
+
+ case TYP_SETFLD:
+ {
+ if (!IsFldEdit() || bSpecialFmt)
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ }
+ break;
+
+ case TYP_FORMELFLD:
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ break;
+
+ case TYP_GETFLD:
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ break;
+ }
+
+ if (IsFldEdit() && bSpecialFmt)
+ {
+ if (nTypeId == TYP_USERFLD && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
+ aNumFormatLB.SelectEntryPos(1);
+ else
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ else
+ {
+ if (!nOldNumFormat && (nNumFormatSel = aNumFormatLB.GetEntryPos(sOldNumSel)) != LISTBOX_ENTRY_NOTFOUND)
+ aNumFormatLB.SelectEntryPos(nNumFormatSel);
+ else if (nOldNumFormat && nOldNumFormat == ULONG_MAX)
+ aNumFormatLB.SelectEntry(sOldSel);
+ }
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ USHORT nFldId = GetFldMgr().GetFormatId( nTypeId, i );
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(nFldId) );
+ if (IsFldEdit() && nFldId == GetCurField()->GetFormat())
+ aFormatLB.SelectEntryPos( nPos );
+ }
+
+ if (nSize && (!IsFldEdit() || !aFormatLB.GetSelectEntryCount()))
+ {
+ aFormatLB.SelectEntry(sOldSel);
+
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_PAGEDESC));
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_ARABIC));
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+ }
+ }
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String sValue(aValueED.GetText());
+ BOOL bHasValue = sValue.Len() != 0;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ BOOL bInsert = FALSE, bApply = FALSE, bDelete = FALSE;
+
+ String sName( aNameED.GetText() );
+ xub_StrLen nLen = sName.Len();
+
+ switch( nTypeId )
+ {
+ case TYP_DDEFLD:
+ case TYP_USERFLD:
+ case TYP_SETFLD:
+ case TYP_SEQFLD:
+ SwCalc::IsValidVarName( sName, &sName );
+ if( sName.Len() != nLen )
+ {
+ nLen = sName.Len();
+ Selection aSel(aNameED.GetSelection());
+ aNameED.SetText( sName );
+ aNameED.SetSelection( aSel ); // Cursorpos restaurieren
+ }
+ break;
+ }
+
+
+ // Buttons ueberpruefen
+ switch (nTypeId)
+ {
+ case TYP_DDEFLD:
+ if( nLen )
+ {
+ // Gibts schon einen entsprechenden Type
+ bInsert = bApply = TRUE;
+
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_DDEFLD, sName);
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh && pType)
+ bDelete = !pSh->IsUsed( *pType );
+ }
+ break;
+
+ case TYP_USERFLD:
+ if( nLen )
+ {
+ // Gibts schon einen entsprechenden Type
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, sName);
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh && pType)
+ bDelete = !pSh->IsUsed( *pType );
+
+ pType = GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+ if (!pType) // Kein Namenskonflikt mit Variablen
+ {
+ // Benutzerfelder duerfen auch ohne Inhalt eingefuegt werden!
+ // Bug #56845
+ bInsert = bApply = TRUE;
+ }
+ }
+ break;
+
+ default:
+ bInsert = TRUE;
+
+ if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD)
+ {
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)
+ GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+
+ if (pFldType)
+ {
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SwFldTypes* p = pSh->GetDoc()->GetFldTypes();
+ USHORT i;
+
+ for (i = 0; i < INIT_FLDTYPES; i++)
+ {
+ SwFieldType* pType = (*p)[ i ];
+ if (pType == pFldType)
+ break;
+ }
+
+ if (i >= INIT_FLDTYPES && !pSh->IsUsed(*pFldType))
+ bDelete = TRUE;
+
+ if (nTypeId == TYP_SEQFLD && !(pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ bInsert = FALSE;
+
+ if (nTypeId == TYP_SETFLD && (pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ bInsert = FALSE;
+ }
+ }
+ if (GetFldMgr().GetFldType(RES_USERFLD, sName))
+ bInsert = FALSE;
+ }
+
+ if( !nLen && ( nTypeId == TYP_SETFLD ||
+ (!IsFldEdit() && nTypeId == TYP_GETFLD ) ) )
+ bInsert = FALSE;
+
+ if( (nTypeId == TYP_SETFLD || nTypeId == TYP_FORMELFLD) &&
+ !bHasValue )
+ bInsert = FALSE;
+ break;
+ }
+
+ aNewDelTBX.EnableItem(BT_VARAPPLY, bApply);
+ aNewDelTBX.EnableItem(BT_VARDELETE, bDelete);
+ EnableInsert(bInsert);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, TBClickHdl, ToolBox *, pBox )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch (pBox->GetCurItemId())
+ {
+ case BT_VARDELETE:
+ {
+ if( nTypeId == TYP_USERFLD )
+ GetFldMgr().RemoveFldType(RES_USERFLD, aSelectionLB.GetSelectEntry());
+ else
+ {
+ USHORT nWhich;
+
+ switch(nTypeId)
+ {
+ case TYP_SETFLD:
+ case TYP_SEQFLD:
+ nWhich = RES_SETEXPFLD;
+ break;
+ default:
+ nWhich = RES_DDEFLD;
+ break;
+ }
+
+ GetFldMgr().RemoveFldType(nWhich, aSelectionLB.GetSelectEntry());
+ }
+
+ UpdateSubType();
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ pSh->SetModified();
+ }
+ }
+ break;
+
+ case BT_VARAPPLY:
+ {
+ String sName(aNameED.GetText()), sValue(aValueED.GetText());
+ SwFieldType* pType = 0;
+ USHORT nId = 0;
+ USHORT nNumFormatPos = aNumFormatLB.GetSelectEntryPos();
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD: nId = RES_USERFLD; break;
+ case TYP_DDEFLD: nId = RES_DDEFLD; break;
+ case TYP_SETFLD: nId = RES_SETEXPFLD;break;
+ }
+ pType = GetFldMgr().GetFldType(nId, sName);
+
+ ULONG nFormat = aFormatLB.GetSelectEntryPos();
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ if (pType) // Aendern
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ pSh->StartAllAction();
+
+ if (nTypeId == TYP_USERFLD)
+ {
+ if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ ULONG nFmt = nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat();
+ if (nFmt)
+ { // Sprache auf Office-Sprache umstellen, da String im Office
+ // Format vom Kalkulator erwartet wird und so in den Dlg
+ // eingegeben werden sollte
+ nFmt = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFmt);
+ }
+ ((SwUserFieldType*)pType)->SetContent(aValueED.GetText(), nFmt);
+ ((SwUserFieldType*)pType)->SetType(
+ nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR );
+ }
+ }
+ else
+ {
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+ ((SwDDEFieldType*)pType)->SetCmd(sValue);
+ ((SwDDEFieldType*)pType)->SetType((USHORT)nFormat);
+ }
+ }
+ pType->UpdateFlds();
+
+ pSh->EndAllAction();
+ }
+ }
+ else // Neu
+ {
+ if(nTypeId == TYP_USERFLD)
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwUserFieldType aType( pSh->GetDoc(), sName );
+
+ if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aType.SetType(nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
+ aType.SetContent( sValue, nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat() );
+ aSelectionLB.InsertEntry(sName);
+ aSelectionLB.SelectEntry(sName);
+ GetFldMgr().InsertFldType( aType ); // Userfld Neu
+ }
+ }
+ }
+ else
+ {
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+
+ SwDDEFieldType aType(sName, sValue, (USHORT)nFormat);
+ aSelectionLB.InsertEntry(sName);
+ aSelectionLB.SelectEntry(sName);
+ GetFldMgr().InsertFldType(aType); // DDE-Feld Neu
+ }
+ }
+ }
+ if (IsFldEdit())
+ GetFldMgr().GetCurFld(); // FieldManager Updaten
+
+ UpdateSubType();
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, ChapterHdl, ListBox *, EMPTYARG )
+{
+ BOOL bEnable = aChapterLevelLB.GetSelectEntryPos() != 0;
+
+ aSeparatorED.Enable(bEnable);
+ aSeparatorFT.Enable(bEnable);
+ SeparatorHdl();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, SeparatorHdl, Edit *, EMPTYARG )
+{
+ BOOL bEnable = aSeparatorED.GetText().Len() != 0 ||
+ aChapterLevelLB.GetSelectEntryPos() == 0;
+ EnableInsert(bEnable);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldVarPage::FillItemSet(SfxItemSet& )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ USHORT nSubType = aSelectionLB.GetSelectEntryPos();
+ if(nSubType == LISTBOX_ENTRY_NOTFOUND)
+ nSubType = 0;
+ else
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSubType);
+
+ ULONG nFormat;
+
+ if (!aNumFormatLB.IsVisible())
+ {
+ nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+ }
+ else
+ {
+ nFormat = aNumFormatLB.GetFormat();
+
+ if (nFormat && nFormat != ULONG_MAX && aNumFormatLB.IsAutomaticLanguage())
+ {
+ // Sprache auf Office-Sprache umstellen, da String im Office-
+ // Format vom Kalkulator erwartet wird und so in den Dlg
+ // eingegeben werden sollte
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ nFormat = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFormat);
+ }
+ }
+ }
+ sal_Unicode cSeparator = ' ';
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ nSubType = (nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR;
+
+ if (nFormat == ULONG_MAX && aNumFormatLB.GetSelectEntry() == SW_RESSTR(FMT_USERVAR_CMD))
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+
+ if (aInvisibleCB.IsChecked())
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ break;
+ }
+ case TYP_FORMELFLD:
+ {
+ nSubType = nsSwGetSetExpType::GSE_FORMULA;
+ if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ break;
+ }
+ case TYP_GETFLD:
+ {
+ nSubType &= 0xff00;
+ if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ break;
+ }
+ case TYP_INPUTFLD:
+ {
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, aName);
+ nSubType = static_cast< USHORT >((nSubType & 0xff00) | ((pType) ? INP_USR : INP_VAR));
+ break;
+ }
+
+ case TYP_SETFLD:
+ {
+ if (IsFldDlgHtmlMode())
+ {
+ nSubType = 0x0100;
+ nSubType = (nSubType & 0xff00) | nsSwGetSetExpType::GSE_STRING;
+ }
+ else
+ nSubType = (nSubType & 0xff00) | ((nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
+
+ if (aInvisibleCB.IsChecked())
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ break;
+ }
+ case TYP_SEQFLD:
+ {
+ // nSubType = nsSwGetSetExpType::GSE_SEQ; // nsSwGetSetExpType::GSE_SEQ wird im Fldmgr fest gesetzt, kann also entfallen
+ nSubType = aChapterLevelLB.GetSelectEntryPos();
+ if (nSubType == 0)
+ nSubType = 0x7f;
+ else
+ {
+ nSubType--;
+ String sSeparator(aSeparatorED.GetText().GetChar(0));
+ cSeparator = sSeparator.Len() ? sSeparator.GetChar(0) : ' ';
+ //nSubType |= (USHORT)(((BYTE)) << 8);
+ }
+ break;
+ }
+ case TYP_GETREFPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ aVal = aValueED.GetText();
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aSelectionLB.GetSavedValue() != aSelectionLB.GetSelectEntryPos() ||
+ aFormatLB.GetSavedValue() != aFormatLB.GetSelectEntryPos() ||
+ nOldFormat != aNumFormatLB.GetFormat() ||
+ aInvisibleCB.GetState() != aInvisibleCB.GetSavedValue() ||
+ aChapterLevelLB.GetSavedValue() != aChapterLevelLB.GetSelectEntryPos() ||
+ aSeparatorED.GetSavedValue() != aSeparatorED.GetText())
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat,
+ cSeparator, aNumFormatLB.IsAutomaticLanguage() );
+ }
+
+ UpdateSubType();
+
+ return FALSE;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldVarPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldVarPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldVarPage::GetGroup()
+{
+ return GRP_VAR;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SelectionListBox::SelectionListBox( SwFldVarPage* pDialog, const ResId& rResId ) :
+ ListBox (pDialog, rResId),
+ pDlg (pDialog),
+ bCallAddSelection(FALSE)
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SelectionListBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = ListBox::PreNotify( rNEvt );
+ //BOOL bAddSel = FALSE;
+ if ( rNEvt.GetType() == EVENT_KEYUP )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+ const USHORT nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_SPACE && !nModifier)
+// bAddSel = TRUE;
+ bCallAddSelection = TRUE;
+ }
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
+
+ if (pMEvt && (pMEvt->IsMod1() || pMEvt->IsMod2())) // Alt oder Ctrl
+ //bAddSel = TRUE;
+ bCallAddSelection = TRUE;
+ }
+
+// if (bAddSel)
+// pDlg->AddSelection(this);
+
+ return nHandled;
+}
+/* -----------------12.01.99 11:14-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldVarPage::FillUserData()
+{
+ String sData(String::CreateFromAscii(USER_DATA_VERSION));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = (USHORT)(ULONG)aTypeLB.GetEntryData( nTypeSel );
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx
new file mode 100644
index 000000000000..dd4665198589
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SWFLDVAR_HXX
+#define _SWFLDVAR_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/edit.hxx>
+
+#include "fldpage.hxx"
+#include "condedit.hxx"
+#include "numfmtlb.hxx"
+
+class SwFldVarPage;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SelectionListBox : public ListBox
+{
+ SwFldVarPage* pDlg;
+ BOOL bCallAddSelection;
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SelectionListBox( SwFldVarPage* pDialog, const ResId& rResId );
+
+ // Selektieren per Ctrl oder Alt erkennen und mit SelectHdl auswerten
+ BOOL IsCallAddSelection() const {return bCallAddSelection;}
+ void ResetCallAddSelection() {bCallAddSelection = FALSE;}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldVarPage : public SwFldPage
+{
+ friend class SelectionListBox;
+
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ SelectionListBox aSelectionLB;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aValueFT;
+ ConditionEdit aValueED;
+ FixedText aFormatFT;
+ NumFormatListBox aNumFormatLB;
+ ListBox aFormatLB;
+ FixedText aChapterHeaderFT;
+ FixedText aChapterLevelFT;
+ ListBox aChapterLevelLB;
+ CheckBox aInvisibleCB;
+ FixedText aSeparatorFT;
+ Edit aSeparatorED;
+ ToolBox aNewDelTBX;
+
+ String sOldValueFT;
+ String sOldNameFT;
+
+ ULONG nOldFormat;
+ BOOL bInit;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pED = 0 );
+ DECL_LINK( TBClickHdl, ToolBox *pTB = 0);
+ DECL_LINK( ChapterHdl, ListBox *pLB = 0);
+ DECL_LINK( SeparatorHdl, Edit *pED = 0 );
+
+ void UpdateSubType();
+ USHORT FillFormatLB(USHORT nTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldVarPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldVarPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldvar.src b/sw/source/ui/fldui/fldvar.src
new file mode 100644
index 000000000000..7405a2956849
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.src
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+TabPage TP_FLD_VAR
+{
+ HelpID = HID_FLD_VAR ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_VARTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_VARTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 135 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_VARSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "S~election" ;
+ };
+ ListBox LB_VARSELECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 135 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_VARFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Format" ;
+ };
+ ListBox LB_VARFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 123 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ ListBox LB_VARNUMFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 123 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ CheckBox CB_VARINVISIBLE
+ {
+ Pos = MAP_APPFONT ( 170 , 141 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ Text [ en-US ] = "Invisi~ble" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_VARCHAPTERHEADER
+ {
+ Pos = MAP_APPFONT ( 170 , 112 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Numbering by chapter" ;
+ };
+ FixedText FT_VARCHAPTERLEVEL
+ {
+ Pos = MAP_APPFONT ( 175 , 125 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Level" ;
+ };
+ ListBox LB_VARCHAPTERLEVEL
+ {
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 123 ) ;
+ Size = MAP_APPFONT ( 46 , 76 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ };
+ };
+ FixedText FT_VARSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 175 , 140 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Separator" ;
+ };
+ Edit ED_VARSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 208 , 138 ) ;
+ Size = MAP_APPFONT ( 46 , 12 ) ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ MaxTextLength = 1 ;
+ TEXT = "." ;
+ };
+ FixedText FT_VARNAME
+ {
+ Pos = MAP_APPFONT ( 6 , 155 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_VARNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 166 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_VARVALUE
+ {
+ Pos = MAP_APPFONT ( 88 , 155 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Left = TRUE ;
+ };
+ Edit ED_VARVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 166 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ ToolBox TBX_VARNEWDEL
+ {
+ Pos = MAP_APPFONT ( 167 , 167 ) ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = BT_VARAPPLY ;
+ HelpID = HID_FLDVAR_APPLY ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap{ File = "sc20558.bmp" ;};
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = BT_VARDELETE ;
+ HelpID = HID_FLDVAR_DELETE ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap{ File = "sc20557.bmp" ;};
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+ };
+ Text [ en-US ] = "Variables" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldwrap.cxx b/sw/source/ui/fldui/fldwrap.cxx
new file mode 100644
index 000000000000..18f291d5b6e6
--- /dev/null
+++ b/sw/source/ui/fldui/fldwrap.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <swtypes.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <fldwrap.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#include "swabstdlg.hxx"
+
+SFX_IMPL_CHILDWINDOW(SwFldDlgWrapper, FN_INSERT_FIELD)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwChildWinWrapper::SwChildWinWrapper(Window *pParentWindow, USHORT nId) :
+ SfxChildWindow(pParentWindow, nId),
+ m_pDocSh(0)
+{
+ // Flackern der Buttons vermeiden:
+ m_aUpdateTimer.SetTimeout(200);
+ m_aUpdateTimer.SetTimeoutHdl(LINK(this, SwChildWinWrapper, UpdateHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwChildWinWrapper, UpdateHdl, void*, EMPTYARG )
+{
+ GetWindow()->Activate(); // Dialog aktualisieren
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwChildWinWrapper::ReInitDlg(SwDocShell *)
+{
+ BOOL bRet = FALSE;
+
+ if (m_pDocSh != GetOldDocShell())
+ {
+ m_aUpdateTimer.Stop();
+ bRet = TRUE; // Sofortiges Update
+ }
+ else
+ m_aUpdateTimer.Start();
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxChildWinInfo SwFldDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
+ return aInfo;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDlgWrapper::SwFldDlgWrapper( Window* _pParent, USHORT nId,
+ SfxBindings* pB,
+ SfxChildWinInfo* )
+ : SwChildWinWrapper( _pParent, nId )
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlgInterface = pDlg;
+ pWindow = pDlg->GetWindow();
+ pDlg->Start();
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
+{
+ BOOL bRet;
+
+ if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == TRUE) // Sofort aktualisieren, Dok-Wechsel
+ {
+ pDlgInterface->ReInitDlg();
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlgWrapper::ShowPage(USHORT nPage)
+{
+ pDlgInterface->ShowPage(nPage ? nPage : TP_FLD_REF);
+}
+
+SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper, FN_INSERT_FIELD_DATA_ONLY)
+
+/* -----------------04.02.2003 14:17-----------------
+ *
+ * --------------------------------------------------*/
+SfxChildWinInfo SwFldDataOnlyDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+// prevent instatiation of dialog other than by calling
+// the mail merge dialog
+ aInfo.bVisible = FALSE;
+ return aInfo;
+}
+/* -----------------04.02.2003 14:17-----------------
+ *
+ * --------------------------------------------------*/
+SwFldDataOnlyDlgWrapper::SwFldDataOnlyDlgWrapper( Window* _pParent, USHORT nId,
+ SfxBindings* pB,
+ SfxChildWinInfo* pInfo )
+ : SwChildWinWrapper( _pParent, nId )
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlgInterface = pDlg;
+
+ pWindow = pDlg->GetWindow();
+ pDlg->ActivateDatabasePage();
+ pDlg->Start();
+ pDlg->Initialize( pInfo );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+/* -----------------04.02.2003 14:17-----------------
+ * re-init after doc activation
+ * --------------------------------------------------*/
+BOOL SwFldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
+{
+ BOOL bRet;
+ if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == TRUE) // Sofort aktualisieren, Dok-Wechsel
+ {
+ pDlgInterface->ReInitDlg();
+ }
+
+ return bRet;
+}
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
new file mode 100644
index 000000000000..46c05c4ac63b
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+
+
+#define _INPDLG_CXX
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <unotools/charclass.hxx>
+#include <editeng/unolingu.hxx>
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <inpdlg.hxx>
+#include <fldmgr.hxx>
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _INPDLG_HRC
+#include <inpdlg.hrc>
+#endif
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+SwFldInputDlg::SwFldInputDlg( Window *pParent, SwWrtShell &rS,
+ SwField* pField, BOOL bNextButton ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_FLD_INPUT)),
+
+ rSh( rS ),
+ pInpFld(0),
+ pSetFld(0),
+ pUsrType(0),
+
+ aLabelED (this, SW_RES(ED_LABEL )),
+ aEditED (this, SW_RES(ED_EDIT )),
+ aEditFL (this, SW_RES(FL_EDIT )),
+
+ aOKBT (this, SW_RES(BT_OK )),
+ aCancelBT (this, SW_RES(BT_CANCEL )),
+ aNextBT (this, SW_RES(PB_NEXT )),
+ aHelpBT (this, SW_RES(PB_HELP ))
+{
+ // Font fuers Edit umschalten
+ Font aFont(aEditED.GetFont());
+ aFont.SetWeight(WEIGHT_LIGHT);
+ aEditED.SetFont(aFont);
+
+ if( bNextButton )
+ {
+ aNextBT.Show();
+ aNextBT.SetClickHdl(LINK(this, SwFldInputDlg, NextHdl));
+ }
+ else
+ {
+ long nDiff = aCancelBT.GetPosPixel().Y() - aOKBT.GetPosPixel().Y();
+ Point aPos = aHelpBT.GetPosPixel();
+ aPos.Y() -= nDiff;
+ aHelpBT.SetPosPixel(aPos);
+ }
+
+ // Auswertung hier
+ String aStr;
+ if( RES_INPUTFLD == pField->GetTyp()->Which() )
+ { // Es ist eine Eingabefeld
+ //
+ pInpFld = (SwInputField*)pField;
+ aLabelED.SetText( pInpFld->GetPar2() );
+ USHORT nSubType = pInpFld->GetSubType();
+
+ switch(nSubType & 0xff)
+ {
+ case INP_TXT:
+ aStr = pInpFld->GetPar1();
+ break;
+
+ case INP_USR:
+ // Benutzerfeld
+ if( 0 != ( pUsrType = (SwUserFieldType*)rSh.GetFldType(
+ RES_USERFLD, pInpFld->GetPar1() ) ) )
+ aStr = pUsrType->GetContent();
+ break;
+ }
+ }
+ else
+ {
+ // es ist eine SetExpression
+ pSetFld = (SwSetExpField*)pField;
+ String sFormula(pSetFld->GetFormula());
+ //values are formatted - formulas are not
+ CharClass aCC( SvxCreateLocale( pSetFld->GetLanguage() ));
+ if( aCC.isNumeric( sFormula ))
+ aStr = pSetFld->Expand();
+ else
+ aStr = sFormula;
+ aLabelED.SetText( pSetFld->GetPromptText() );
+ }
+
+ // JP 31.3.00: Inputfields in readonly regions must be allowed to
+ // input any content. - 74639
+ BOOL bEnable = !rSh.IsCrsrReadonly();
+ /*!rSh.IsReadOnlyAvailable() || !rSh.HasReadonlySel()*/;
+ aOKBT.Enable( bEnable );
+ aEditED.SetReadOnly( !bEnable );
+
+ if( aStr.Len() )
+ aEditED.SetText( aStr.ConvertLineEnd() );
+ FreeResource();
+}
+
+SwFldInputDlg::~SwFldInputDlg()
+{
+}
+
+void SwFldInputDlg::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ aEditED.GrabFocus();
+ SvxStandardDialog::StateChanged( nType );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schliessen
+ --------------------------------------------------------------------*/
+
+void SwFldInputDlg::Apply()
+{
+ String aTmp( aEditED.GetText() );
+ aTmp.EraseAllChars( '\r' );
+
+ rSh.StartAllAction();
+ BOOL bModified = FALSE;
+ if(pInpFld)
+ {
+ if(pUsrType)
+ {
+ if( aTmp != pUsrType->GetContent() )
+ {
+ pUsrType->SetContent(aTmp);
+ pUsrType->UpdateFlds();
+ bModified = TRUE;
+ }
+ }
+ else if( aTmp != pInpFld->GetPar1() )
+ {
+ pInpFld->SetPar1(aTmp);
+ rSh.SwEditShell::UpdateFlds(*pInpFld);
+ bModified = TRUE;
+ }
+ }
+ else if( aTmp != pSetFld->GetPar2() )
+ {
+ pSetFld->SetPar2(aTmp);
+ rSh.SwEditShell::UpdateFlds(*pSetFld);
+ bModified = TRUE;
+ }
+
+ if( bModified )
+ rSh.SetUndoNoResetModified();
+
+ rSh.EndAllAction();
+}
+
+
+IMPL_LINK(SwFldInputDlg, NextHdl, PushButton*, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+
diff --git a/sw/source/ui/fldui/inpdlg.hrc b/sw/source/ui/fldui/inpdlg.hrc
new file mode 100644
index 000000000000..bbd04c092010
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define FT_LABEL 1
+#define ED_EDIT 3
+#define FL_EDIT 4
+#define BT_OK 5
+#define BT_CANCEL 6
+#define ED_LABEL 7
+#define PB_NEXT 8
+#define PB_HELP 9
diff --git a/sw/source/ui/fldui/inpdlg.src b/sw/source/ui/fldui/inpdlg.src
new file mode 100644
index 000000000000..8b60525dfe5c
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.src
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "fldui.hrc"
+#include "inpdlg.hrc"
+#include "helpid.h"
+ModalDialog DLG_FLD_INPUT
+{
+ HelpID = HID_FLD_INPUT ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 119 ) ;
+ Text [ en-US ] = "Input Field" ;
+ Moveable = TRUE ;
+ /* FixedText FT_LABEL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 8 ) ;
+ Text [ en-US ] = "Input" ;
+ Left = TRUE ;
+ };*/
+ Edit ED_LABEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Input" ;
+ Readonly = TRUE ;
+ };
+ MultiLineEdit ED_EDIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 115 , 72 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedLine FL_EDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 127 , 8 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 139 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 139 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ Pos = MAP_APPFONT ( 139 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Next" ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 139 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx
new file mode 100644
index 000000000000..443bc075b7db
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 ---------------------------------------------------------------
+
+
+
+#define _JAVAEDIT_CXX
+#include <hintids.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <svl/urihelper.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <sfx2/docfile.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <fldmgr.hxx>
+#include <docufld.hxx>
+#include <uitool.hxx>
+#ifndef _JAVAEDIT_HXX
+#include <javaedit.hxx>
+#endif
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _JAVAEDIT_HRC
+#include <javaedit.hrc>
+#endif
+
+// static ----------------------------------------------------------------
+
+// class SwJavaEditDialog ------------------------------------------------
+
+
+
+SwJavaEditDialog::SwJavaEditDialog(Window* pParent, SwWrtShell* pWrtSh) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_JAVAEDIT)),
+
+ aTypeFT ( this, SW_RES( FT_TYPE ) ),
+ aTypeED ( this, SW_RES( ED_TYPE ) ),
+ aUrlRB ( this, SW_RES( RB_URL ) ),
+ aEditRB ( this, SW_RES( RB_EDIT ) ),
+ aUrlPB ( this, SW_RES( PB_URL ) ),
+ aUrlED ( this, SW_RES( ED_URL ) ),
+ aEditED ( this, SW_RES( ED_EDIT ) ),
+ aPostItFL ( this, SW_RES( FL_POSTIT ) ),
+
+ aOKBtn ( this, SW_RES( BTN_POST_OK ) ),
+ aCancelBtn ( this, SW_RES( BTN_POST_CANCEL ) ),
+ aPrevBtn ( this, SW_RES( BTN_PREV ) ),
+ aNextBtn ( this, SW_RES( BTN_NEXT ) ),
+ aHelpBtn ( this, SW_RES( BTN_POST_HELP ) ),
+
+ bNew(TRUE),
+ bIsUrl(FALSE),
+
+ pSh(pWrtSh),
+ pFileDlg(NULL),
+ pOldDefDlgParent(NULL)
+{
+ // Handler installieren
+ aPrevBtn.SetClickHdl( LINK( this, SwJavaEditDialog, PrevHdl ) );
+ aNextBtn.SetClickHdl( LINK( this, SwJavaEditDialog, NextHdl ) );
+ aOKBtn.SetClickHdl( LINK( this, SwJavaEditDialog, OKHdl ) );
+
+ Link aLk = LINK(this, SwJavaEditDialog, RadioButtonHdl);
+ aUrlRB.SetClickHdl(aLk);
+ aEditRB.SetClickHdl(aLk);
+ aUrlPB.SetClickHdl(LINK(this, SwJavaEditDialog, InsertFileHdl));
+
+ Font aFont( aEditED.GetFont() );
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aEditED.SetFont( aFont );
+
+ pMgr = new SwFldMgr;
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+
+ bNew = !(pFld && pFld->GetTyp()->Which() == RES_SCRIPTFLD);
+
+ CheckTravel();
+
+ if( !bNew )
+ SetText( SW_RES( STR_JAVA_EDIT ) );
+ else
+ // neu anlegen
+ SetText( SW_RES( STR_JAVA_INSERT ) );
+
+ FreeResource();
+
+ RadioButtonHdl(NULL);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+SwJavaEditDialog::~SwJavaEditDialog()
+{
+ delete pMgr;
+ delete pFileDlg;
+ Application::SetDefDialogParent( pOldDefDlgParent );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK_INLINE_START( SwJavaEditDialog, PrevHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ pMgr->GoPrev();
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+ CheckTravel();
+ RadioButtonHdl(NULL);
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwJavaEditDialog, PrevHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK_INLINE_START( SwJavaEditDialog, NextHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ pMgr->GoNext();
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+ CheckTravel();
+ RadioButtonHdl(NULL);
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwJavaEditDialog, NextHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwJavaEditDialog, OKHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ EndDialog( RET_OK );
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::Apply()
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::CheckTravel()
+{
+ BOOL bTravel = FALSE;
+ BOOL bNext(FALSE), bPrev(FALSE);
+
+ if(!bNew)
+ {
+ // Traveling nur bei mehr als einem Feld
+ pSh->StartAction();
+ pSh->CreateCrsr();
+
+ bNext = pMgr->GoNext();
+ if( bNext )
+ pMgr->GoPrev();
+
+ if( 0 != ( bPrev = pMgr->GoPrev() ) )
+ pMgr->GoNext();
+ bTravel |= bNext|bPrev;
+
+ pSh->DestroyCrsr();
+ pSh->EndAction();
+
+ if (pFld->IsCodeURL())
+ {
+ String sURL(pFld->GetPar2());
+ if(sURL.Len())
+ {
+ INetURLObject aINetURL(sURL);
+ if(INET_PROT_FILE == aINetURL.GetProtocol())
+ sURL = aINetURL.PathToFileName();
+ }
+ aUrlED.SetText(sURL);
+ aEditED.SetText(aEmptyStr);
+ aUrlRB.Check();
+ }
+ else
+ {
+ aEditED.SetText(pFld->GetPar2());
+ aUrlED.SetText(aEmptyStr);
+ aEditRB.Check();
+ }
+ aTypeED.SetText(pFld->GetPar1());
+ }
+
+ if ( !bTravel )
+ {
+ aPrevBtn.Hide();
+ aNextBtn.Hide();
+ }
+ else
+ {
+ aPrevBtn.Enable(bPrev);
+ aNextBtn.Enable(bNext);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::SetFld()
+{
+ if( !aOKBtn.IsEnabled() )
+ return ;
+
+ aType = aTypeED.GetText();
+ bIsUrl = aUrlRB.IsChecked();
+
+ if( bIsUrl )
+ {
+ aText = aUrlED.GetText();
+ if(aText.Len())
+ {
+ SfxMedium* pMedium = pSh->GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+
+ aText = URIHelper::SmartRel2Abs(
+ aAbs, aText, URIHelper::GetMaybeFileHdl());
+ }
+ }
+ else
+ aText = aEditED.GetText();
+
+ if( !aType.Len() )
+ aType = String::CreateFromAscii("JavaScript");
+}
+
+BOOL SwJavaEditDialog::IsUpdate()
+{
+ return pFld && ( bIsUrl != pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwJavaEditDialog, RadioButtonHdl, RadioButton *, EMPTYARG )
+{
+ BOOL bEnable = aUrlRB.IsChecked();
+ aUrlPB.Enable(bEnable);
+ aUrlED.Enable(bEnable);
+ aEditED.Enable(!bEnable);
+
+ if( !bNew )
+ {
+ bEnable = !pSh->IsReadOnlyAvailable() || !pSh->HasReadonlySel();
+ aOKBtn.Enable( bEnable );
+ aUrlED.SetReadOnly( !bEnable );
+ aEditED.SetReadOnly( !bEnable);
+ aTypeED.SetReadOnly( !bEnable);
+ if( aUrlPB.IsEnabled() && !bEnable )
+ aUrlPB.Enable( FALSE );
+ }
+ return 0;
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+IMPL_LINK( SwJavaEditDialog, InsertFileHdl, PushButton *, pBtn )
+{
+ if ( !pFileDlg )
+ {
+ pOldDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+
+ pFileDlg = new ::sfx2::FileDialogHelper(
+ (SFXWB_INSERT | WB_3DLOOK), String::CreateFromAscii("swriter") );
+ }
+
+ pFileDlg->StartExecuteModal( LINK( this, SwJavaEditDialog, DlgClosedHdl ) );
+ return 0;
+}
+
+IMPL_LINK( SwJavaEditDialog, DlgClosedHdl, sfx2::FileDialogHelper *, EMPTYARG )
+{
+ if ( pFileDlg->GetError() == ERRCODE_NONE )
+ {
+ String sFileName = pFileDlg->GetPath();
+ if ( sFileName.Len() > 0 )
+ {
+ INetURLObject aINetURL( sFileName );
+ if ( INET_PROT_FILE == aINetURL.GetProtocol() )
+ sFileName = aINetURL.PathToFileName();
+ }
+ aUrlED.SetText( sFileName );
+ }
+
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/javaedit.hrc b/sw/source/ui/fldui/javaedit.hrc
new file mode 100644
index 000000000000..d7448936d4cb
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _SW_JAVAEDIT_HRC
+#define _SW_JAVAEDIT_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_TYPE 10
+#define ED_TYPE 11
+#define RB_EDIT 12
+#define ED_EDIT 13
+#define FL_POSTIT 14
+#define BTN_PREV 15
+#define BTN_NEXT 16
+#define STR_JAVA_EDIT 17
+#define STR_JAVA_INSERT 18
+#define RB_URL 19
+#define ED_URL 20
+#define PB_URL 21
+
+#define BTN_POST_OK 30
+#define BTN_POST_CANCEL 31
+#define BTN_POST_HELP 32
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/javaedit.src b/sw/source/ui/fldui/javaedit.src
new file mode 100644
index 000000000000..45dbf468e7ae
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.src
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "javaedit.hrc"
+#include "fldui.hrc"
+#include "helpid.h"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_POSTIT -----------------------------------------------------
+ModalDialog DLG_JAVAEDIT
+{
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 248 , 157 ) ;
+ Moveable = TRUE ;
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Text [ en-US ] = "Script type" ;
+ };
+ Edit ED_TYPE
+ {
+ Border = TRUE ;
+ Text = "JavaScript" ;
+ // Nicht uebersetzen!!!
+ Pos = MAP_APPFONT ( 70 , 14 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_URL
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "URL" ;
+ };
+ Edit ED_URL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 70 , 27 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_URL
+ {
+ Pos = MAP_APPFONT ( 163 , 26 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_EDIT
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 140 , 10 ) ;
+ Text [ en-US ] = "~Text" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ MultiLineEdit ED_EDIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 23 , 54 ) ;
+ Size = MAP_APPFONT ( 155 , 91 ) ;
+ Left = TRUE ;
+ VScroll = TRUE ;
+ HScroll = TRUE ;
+ IgnoreTab = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_POSTIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 179 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ };
+ OKButton BTN_POST_OK
+ {
+ Pos = MAP_APPFONT ( 191 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_POST_CANCEL
+ {
+ Pos = MAP_APPFONT ( 191 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ HelpButton BTN_POST_HELP
+ {
+ Pos = MAP_APPFONT ( 191 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ ImageButton BTN_PREV
+ {
+ Pos = MAP_APPFONT ( 191 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton BTN_NEXT
+ {
+ Pos = MAP_APPFONT ( 217 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ // lokale Strings
+ String STR_JAVA_EDIT
+ {
+ Text [ en-US ] = "Edit Script" ;
+ };
+ String STR_JAVA_INSERT
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Script einfügen : Script einf³gen */
+ Text [ en-US ] = "Insert Script" ;
+ };
+ Text [ en-US ] = "Edit Script" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/makefile.mk b/sw/source/ui/fldui/makefile.mk
new file mode 100644
index 000000000000..ee9dbff9cf7e
--- /dev/null
+++ b/sw/source/ui/fldui/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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=..$/..$/..
+LIBTARGET=no
+PRJNAME=sw
+TARGET=fldui
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ changedb.src \
+ DropDownFieldDialog.src\
+ flddb.src \
+ flddinf.src \
+ flddok.src \
+ fldfunc.src \
+ fldref.src \
+ fldtdlg.src \
+ fldui.src \
+ fldvar.src \
+ javaedit.src \
+ inpdlg.src
+
+SLOFILES = \
+ $(SLO)$/changedb.obj \
+ $(SLO)$/DropDownFieldDialog.obj \
+ $(SLO)$/flddb.obj \
+ $(SLO)$/flddinf.obj \
+ $(SLO)$/flddok.obj \
+ $(SLO)$/fldedt.obj \
+ $(SLO)$/fldfunc.obj \
+ $(SLO)$/fldmgr.obj \
+ $(SLO)$/fldpage.obj \
+ $(SLO)$/fldref.obj \
+ $(SLO)$/fldtdlg.obj \
+ $(SLO)$/fldvar.obj \
+ $(SLO)$/javaedit.obj \
+ $(SLO)$/inpdlg.obj \
+ $(SLO)$/fldwrap.obj \
+ $(SLO)$/xfldui.obj \
+ $(SLO)$/FldRefTreeListBox.obj
+
+
+EXCEPTIONSFILES = \
+ $(SLO)$/fldtdlg.obj \
+ $(SLO)$/fldedt.obj \
+ $(SLO)$/flddinf.obj \
+ $(SLO)$/xfldui.obj
+
+LIB1TARGET = $(SLB)$/$(TARGET).lib
+
+LIB1OBJFILES = \
+ $(SLO)$/fldmgr.obj \
+ $(SLO)$/fldwrap.obj \
+ $(SLO)$/xfldui.obj
+
+# $(SLO)$/DropDownFieldDialog.obj \
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/ui/fldui/xfldui.cxx b/sw/source/ui/fldui/xfldui.cxx
new file mode 100644
index 000000000000..a86a78943711
--- /dev/null
+++ b/sw/source/ui/fldui/xfldui.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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/debug.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <fldmgr.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <wrtsh.hxx> // Actives Fenster
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+
+
+using namespace ::com::sun::star::uno;
+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;
+
+
+// ---------------------------------------------------------------------------
+// This file contains all routines of the fldui directory, which must compile
+// with exceptions. So we can reduce the code of the other files, which don't
+// need any exception handling.
+// ---------------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ist das Datenbankfeld numerisch?
+ Anm: Im Fehlerfall wird TRUE returnt.
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::IsDBNumeric( const String& rDBName, const String& rTblQryName,
+ BOOL bIsTable, const String& rFldName)
+{
+ BOOL bNumeric = TRUE;
+
+ SwNewDBMgr* pDBMgr = pWrtShell ? pWrtShell->GetNewDBMgr() :
+ ::GetActiveView()->GetWrtShell().GetNewDBMgr();
+
+ ::rtl::OUString sSource(rDBName);
+ Reference< XConnection> xConnection =
+ pDBMgr->RegisterConnection(sSource);
+
+ if( !xConnection.is() )
+ return bNumeric;
+
+ Reference<XColumnsSupplier> xColsSupplier;
+ if(bIsTable)
+ {
+ Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ DBG_ASSERT(xTbls->hasByName(rTblQryName), "table not available anymore?");
+ try
+ {
+ Any aTable = xTbls->getByName(rTblQryName);
+ Reference<XPropertySet> xPropSet;
+ aTable >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&){}
+ }
+ }
+ else
+ {
+ Reference<XQueriesSupplier> xQSupplier = Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ DBG_ASSERT(xQueries->hasByName(rTblQryName), "table not available anymore?");
+ try
+ {
+ Any aQuery = xQueries->getByName(rTblQryName);
+ Reference<XPropertySet> xPropSet;
+ aQuery >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&){}
+ }
+ }
+
+ if(xColsSupplier.is())
+ {
+ Reference <XNameAccess> xCols;
+ try
+ {
+ xCols = xColsSupplier->getColumns();
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("Exception in getColumns()");
+ }
+ if(xCols.is() && xCols->hasByName(rFldName))
+ {
+ Any aCol = xCols->getByName(rFldName);
+ Reference <XPropertySet> xCol;
+ aCol >>= xCol;
+ Any aType = xCol->getPropertyValue( UniString::CreateFromAscii("Type"));
+ sal_Int32 eDataType = 0;
+ aType >>= eDataType;
+ switch(eDataType)
+ {
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ break;
+
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ case DataType::SQLNULL:
+ case DataType::OTHER:
+ case DataType::OBJECT:
+ case DataType::DISTINCT:
+ case DataType::STRUCT:
+ case DataType::ARRAY:
+ case DataType::BLOB:
+ case DataType::CLOB:
+ case DataType::REF:
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ default:
+ bNumeric = FALSE;
+ }
+ }
+ }
+ return bNumeric;
+}
+
+