summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2002-08-07 08:29:47 +0000
committerOliver Specht <os@openoffice.org>2002-08-07 08:29:47 +0000
commit2fdd7f7aba389a64a79dd232b40102e54ea00037 (patch)
tree39b2d8da637c47adf96c0ac28a68256900c1c822 /sw
parentcb114eff4808662d207f02e69acd310211e6b72b (diff)
#100756# recording of fields re-implemented
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/cmdid.h11
-rw-r--r--sw/sdi/_textsh.sdi10
-rw-r--r--sw/sdi/swriter.sdi50
-rw-r--r--sw/source/ui/fldui/fldpage.cxx46
-rw-r--r--sw/source/ui/shells/textfld.cxx95
5 files changed, 194 insertions, 18 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 2ef14fcbec23..4d0f3b045f04 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -2,9 +2,9 @@
*
* $RCSfile: cmdid.h,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: os $ $Date: 2002-08-06 14:36:51 $
+ * last change: $Author: os $ $Date: 2002-08-07 09:29:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -368,6 +368,7 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_CHANGE_DBFIELD (FN_INSERT + 9 ) /* Datenbankfeld aendern */
#define FN_INSERT_CAPTION (FN_INSERT + 10) /* Beschriftung */
+#define FN_INSERT_DBFIELD (FN_INSERT + 11) /* Insert database field - for recording */
#define FN_INSERT_FOOTNOTE_DLG (FN_INSERT + 12) /* Dialog Fussnote */
#define FN_INSERT_REF_FIELD (FN_INSERT + 13) /* Refernzfeld einfuegen */
@@ -1099,7 +1100,11 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_PARAM_TABLE_SPACE (FN_PARAM+51)
#define FN_PARAM_TABLE_COLUMNS (FN_PARAM+52)
-#define FN_PARAM_GRF_CONNECT (FN_PARAM+54)
+#define FN_PARAM_GRF_CONNECT (FN_PARAM+53)
+#define FN_PARAM_FIELD_TYPE (FN_PARAM+54)
+//already defined in svxids.hrc: #define FN_PARAM_FIELD_CONTENT (FN_PARAM+55)
+#define FN_PARAM_FIELD_SUBTYPE (FN_PARAM+56)
+#define FN_PARAM_FIELD_FORMAT (FN_PARAM+57)
#define FN_PARAM_EVENT (FN_PARAM+68)
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index f14ba145cb79..289640884833 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -2,9 +2,9 @@
*
* $RCSfile: _textsh.sdi,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: tl $ $Date: 2002-08-05 09:49:08 $
+ * last change: $Author: os $ $Date: 2002-08-07 09:29:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -802,6 +802,12 @@ interface BaseText : Selection
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
AutoUpdate ;
]
+ FN_INSERT_DBFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
FN_INSERT_REF_FIELD
[
ExecMethod = ExecField ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index e8abf9455e8b..69038f7d9925 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -4122,7 +4122,14 @@ SfxVoidItem InsertEnvelope FN_ENVELOP
//--------------------------------------------------------------------------
SfxBoolItem InsertField FN_INSERT_FIELD
-
+(
+SfxUInt16Item Type FN_PARAM_FIELD_TYPE,
+SfxUInt16Item SubType FN_PARAM_FIELD_SUBTYPE,
+SfxStringItem Name FN_INSERT_FIELD,
+SfxStringItem Content FN_PARAM_FIELD_CONTENT,
+SfxUInt32Item Format FN_PARAM_FIELD_FORMAT
+SfxStringItem Separator FN_PARAM_3;
+)
[
/* flags: */
AutoUpdate = FALSE,
@@ -4138,7 +4145,6 @@ SfxBoolItem InsertField FN_INSERT_FIELD
Synchron;
ImageRotation = TRUE;
- Readonly = FALSE,
/* config: */
AccelConfig = TRUE,
@@ -4852,7 +4858,7 @@ SfxVoidItem InsertPara FN_INSERT_BREAK
]
//--------------------------------------------------------------------------
-SfxVoidItem InsertReferenzField FN_INSERT_REF_FIELD
+SfxVoidItem InsertReferenceField FN_INSERT_REF_FIELD
()
[
/* flags: */
@@ -9557,4 +9563,42 @@ SfxBoolItem SelectTextMode FN_READONLY_SELECTION_MODE
ToolBoxConfig = TRUE,
GroupId = GID_EDIT;
]
+//--------------------------------------------------------------------------
+SfxBoolItem InsertDBField FN_INSERT_DBFIELD
+(
+SfxUInt16Item Type FN_PARAM_FIELD_TYPE,
+SfxStringItem DBName FN_INSERT_DBFIELD,
+SfxStringItem Command FN_PARAM_1,
+SfxStringItem ColumnName FN_PARAM_2,
+SfxInt32Item CommandType FN_PARAM_3,
+SfxStringItem Content FN_PARAM_FIELD_CONTENT,
+SfxUInt32Item Format FN_PARAM_FIELD_FORMAT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Synchron;
+
+ /* plugin: */
+ Container = FALSE,
+
+ /* api: */
+ Export = TRUE,
+ Hidden = FALSE,
+ IsCollection = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index ca58aba75440..57bf04a6539f 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fldpage.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: jp $ $Date: 2001-09-20 12:49:58 $
+ * last change: $Author: os $ $Date: 2002-08-07 09:29:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -121,6 +121,9 @@
#ifndef _GLOBALS_HRC
#include <globals.hrc>
#endif
+#ifndef _SFX_BINDINGS_HXX
+#include <sfx2/bindings.hxx>
+#endif
/*--------------------------------------------------------------------
Beschreibung:
@@ -220,13 +223,50 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1,
const String& rPar2, ULONG nFormatId, sal_Unicode cSeparator)
{
BOOL bRet = FALSE;
- SwWrtShell *pSh = ::GetActiveView()->GetWrtShellPtr();
+ SwView* pView = GetActiveView();
+ SwWrtShell *pSh = pView->GetWrtShellPtr();
if (!IsFldEdit()) // Neues Feld einfuegen
{
SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator );
bRet = aMgr.InsertFld( aData );
+ com::sun::star::uno::Reference< com::sun::star::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
{
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index 55cc3e2319ed..090a267ed54a 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: textfld.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: mba $ $Date: 2002-07-08 16:14:50 $
+ * last change: $Author: os $ $Date: 2002-08-07 09:29:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -304,15 +304,95 @@ void SwTextShell::ExecField(SfxRequest &rReq)
SwFldMgr aFldMgr(GetShellPtr());
switch(nSlot)
{
+ case FN_INSERT_DBFIELD:
+ {
+ BOOL bRes = FALSE;
+ if( pItem )
+ {
+ ULONG nFormat = 0;
+ USHORT nType = 0;
+ String aPar1 = ((SfxStringItem *)pItem)->GetValue();
+ String aPar2;
+ sal_Int32 nCommand = 0;
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
+ FALSE, &pItem ))
+ nType = ((SfxUInt16Item *)pItem)->GetValue();
+ aPar1 += DB_DELIM;
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_1, FALSE, &pItem ))
+ {
+ aPar1 += ((SfxStringItem *)pItem)->GetValue();
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_3, FALSE, &pItem ))
+ nCommand = ((SfxInt32Item*)pItem)->GetValue();
+ aPar1 += DB_DELIM;
+ aPar1 += String::CreateFromInt32(nCommand);
+ aPar1 += DB_DELIM;
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_2, FALSE, &pItem ))
+ {
+ aPar1 += ((SfxStringItem *)pItem)->GetValue();
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_CONTENT, FALSE, &pItem ))
+ aPar2 = ((SfxStringItem *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_FORMAT, FALSE, &pItem ))
+ nFormat = ((SfxUInt32Item *)pItem)->GetValue();
+ DBG_WARNING("Command is not yet used")
+ sal_Unicode cSeparator = ' ';
+ SwInsertFld_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
+ bRes = aFldMgr.InsertFld(aData);
+ }
+ rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
+ }
+ break;
case FN_INSERT_FIELD_CTRL:
case FN_INSERT_FIELD:
{
BOOL bRes = FALSE;
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
- bRes = pVFrame->GetChildWindow( nSlot ) != 0;
- Invalidate(rReq.GetSlot());
- Invalidate(FN_INSERT_FIELD_CTRL);
+ if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
+ {
+ ULONG nFormat = 0;
+ USHORT nType = 0;
+ USHORT nSubType = 0;
+ String aPar1 = ((SfxStringItem *)pItem)->GetValue();
+ String aPar2;
+ sal_Unicode cSeparator = ' ';
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
+ FALSE, &pItem ))
+ nType = ((SfxUInt16Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
+ FALSE, &pItem ))
+ nSubType = ((SfxUInt16Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_CONTENT, FALSE, &pItem ))
+ aPar2 = ((SfxStringItem *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_FORMAT, FALSE, &pItem ))
+ nFormat = ((SfxUInt32Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_3, FALSE, &pItem ))
+ {
+ String sTmp = ((SfxStringItem *)pItem)->GetValue();
+ if(sTmp.Len())
+ cSeparator = sTmp.GetChar(0);
+ }
+ SwInsertFld_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
+ bRes = aFldMgr.InsertFld( aData );
+ }
+ else
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
+ bRes = pVFrame->GetChildWindow( nSlot ) != 0;
+ Invalidate(rReq.GetSlot());
+ Invalidate(FN_INSERT_FIELD_CTRL);
+ rReq.Ignore();
+ }
rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
}
break;
@@ -328,6 +408,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
if (pWrp)
pWrp->ShowPage();
+ rReq.Ignore();
}
break;