convert db field page to .ui

Change-Id: I36a61bd9bac45e8f4533eb624859aea51360cc14
This commit is contained in:
Caolán McNamara 2013-08-21 13:55:55 +01:00
parent 426f4f8136
commit 04fe354350
11 changed files with 564 additions and 332 deletions

View File

@ -275,6 +275,9 @@
<glade-widget-class title="Check List Box" name="svxcorelo-SvxCheckListBox"
generic-name="Check List Box" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="SwDBTreeList" name="swlo-SwDBTreeList"
generic-name="SwDBTreeList" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Paragraph Preview" name="svxlo-SvxParaPrevWindow"
generic-name="Paragraph Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>

View File

@ -101,7 +101,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\
sw/source/ui/envelp/label.src \
sw/source/ui/envelp/labfmt.src \
sw/source/ui/envelp/mailmrge.src \
sw/source/ui/fldui/flddb.src \
sw/source/ui/fldui/fldtdlg.src \
sw/source/ui/fldui/fldui.src \
sw/source/ui/frmdlg/frmpage.src \

View File

@ -90,6 +90,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/envformatpage \
sw/uiconfig/swriter/ui/envprinterpage \
sw/uiconfig/swriter/ui/exchangedatabases \
sw/uiconfig/swriter/ui/flddbpage \
sw/uiconfig/swriter/ui/flddocinfopage \
sw/uiconfig/swriter/ui/flddocumentpage \
sw/uiconfig/swriter/ui/fldfuncpage \

View File

@ -141,8 +141,6 @@
#define HID_GRF_EXT "SW_HID_GRF_EXT"
#define HID_COND_COLL "SW_HID_COND_COLL"
#define HID_FLD_DB "SW_HID_FLD_DB"
#define HID_EDIT_FLD_DB "SW_HID_EDIT_FLD_DB"
#define HID_EDIT_FLD_DOKINF "SW_HID_EDIT_FLD_DOKINF"
#define HID_EDIT_FLD_VAR "SW_HID_EDIT_FLD_VAR"

View File

@ -187,8 +187,8 @@ SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId,
InitTreeList();
}
SwDBTreeList::SwDBTreeList(Window *pParent)
: SvTreeListBox(pParent, WB_TABSTOP)
SwDBTreeList::SwDBTreeList(Window *pParent, WinBits nStyle)
: SvTreeListBox(pParent, nStyle)
, aImageList(SW_RES(ILIST_DB_DLG))
, bInitialized(false)
, bShowColumns(false)
@ -200,9 +200,13 @@ SwDBTreeList::SwDBTreeList(Window *pParent)
InitTreeList();
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwDBTreeList(Window *pParent, VclBuilder::stringmap &)
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwDBTreeList(Window *pParent, VclBuilder::stringmap &rMap)
{
return new SwDBTreeList(pParent);
WinBits nStyle = WB_TABSTOP;
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nStyle |= WB_BORDER;
return new SwDBTreeList(pParent, nStyle);
}
Size SwDBTreeList::GetOptimalSize() const

View File

@ -34,35 +34,41 @@
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
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, sal_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))
SwFldDBPage::SwFldDBPage(Window* pParent, const SfxItemSet& rCoreSet)
: SwFldPage(pParent, "FldDbPage",
"modules/swriter/ui/flddbpage.ui", rCoreSet)
{
FreeResource();
get(m_pTypeLB, "type");
m_pTypeLB->SetStyle(m_pTypeLB->GetStyle() | WB_SORT);
get(m_pDatabaseTLB, "select");
get(m_pCondition, "condgroup");
get(m_pConditionED, "condition");
get(m_pValue, "recgroup");
get(m_pValueED, "recnumber");
get(m_pFormat, "formatframe");
get(m_pAddDBPB, "browse");
get(m_pDBFormatRB, "fromdatabasecb");
get(m_pNewFormatRB, "userdefinedcb");
get(m_pNumFormatLB, "numformat");
get(m_pFormatLB, "format");
m_pFormatLB->SetStyle(m_pFormatLB->GetStyle() | WB_SORT);
aOldNumSelectHdl = aNumFormatLB.GetSelectHdl();
long nHeight = m_pTypeLB->GetTextHeight() * 14;
m_pTypeLB->set_height_request(nHeight);
m_pDatabaseTLB->set_height_request(nHeight);
aNumFormatLB.SetSelectHdl(LINK(this, SwFldDBPage, NumSelectHdl));
aDatabaseTLB.SetSelectHdl(LINK(this, SwFldDBPage, TreeSelectHdl));
aDatabaseTLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
long nWidth = m_pTypeLB->LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MAP_APPFONT)).Width();
m_pTypeLB->set_width_request(nWidth);
m_pDatabaseTLB->set_width_request(nWidth*2);
aValueED.SetModifyHdl(LINK(this, SwFldDBPage, ModifyHdl));
aAddDBPB.SetClickHdl(LINK(this, SwFldDBPage, AddDBHdl));
aOldNumSelectHdl = m_pNumFormatLB->GetSelectHdl();
m_pNumFormatLB->SetSelectHdl(LINK(this, SwFldDBPage, NumSelectHdl));
m_pDatabaseTLB->SetSelectHdl(LINK(this, SwFldDBPage, TreeSelectHdl));
m_pDatabaseTLB->SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
m_pValueED->SetModifyHdl(LINK(this, SwFldDBPage, ModifyHdl));
m_pAddDBPB->SetClickHdl(LINK(this, SwFldDBPage, AddDBHdl));
}
SwFldDBPage::~SwFldDBPage()
@ -76,11 +82,11 @@ void SwFldDBPage::Reset(const SfxItemSet&)
{
Init(); // Allgemeine initialisierung
aTypeLB.SetUpdateMode(sal_False);
sal_uInt16 nOldPos = aTypeLB.GetSelectEntryPos();
sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
m_pTypeLB->SetUpdateMode(sal_False);
sal_uInt16 nOldPos = m_pTypeLB->GetSelectEntryPos();
sOldDBName = m_pDatabaseTLB->GetDBName(sOldTableName, sOldColumnName);
aTypeLB.Clear();
m_pTypeLB->Clear();
sal_uInt16 nPos, nTypeId, i;
@ -92,41 +98,41 @@ void SwFldDBPage::Reset(const SfxItemSet&)
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));
nPos = m_pTypeLB->InsertEntry(GetFldMgr().GetTypeStr(i));
m_pTypeLB->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));
nPos = m_pTypeLB->InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
}
// select old Pos
if (GetTypeSel() != LISTBOX_ENTRY_NOTFOUND)
aTypeLB.SelectEntryPos(GetTypeSel());
m_pTypeLB->SelectEntryPos(GetTypeSel());
aFormatLB.Clear();
m_pFormatLB->Clear();
sal_uInt16 nSize = GetFldMgr().GetFormatCount(TYP_DBSETNUMBERFLD, false, IsFldDlgHtmlMode());
for( i = 0; i < nSize; ++i )
{
sal_uInt16 nEntryPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(TYP_DBSETNUMBERFLD, i));
sal_uInt16 nEntryPos = m_pFormatLB->InsertEntry(GetFldMgr().GetFormatStr(TYP_DBSETNUMBERFLD, i));
sal_uInt16 nFmtId = GetFldMgr().GetFormatId( TYP_DBSETNUMBERFLD, i );
aFormatLB.SetEntryData( nEntryPos, reinterpret_cast<void*>(nFmtId) );
m_pFormatLB->SetEntryData( nEntryPos, reinterpret_cast<void*>(nFmtId) );
if( SVX_NUM_ARABIC == nFmtId )
aFormatLB.SelectEntryPos( nEntryPos );
m_pFormatLB->SelectEntryPos( nEntryPos );
}
if (!IsFldEdit())
{
if (nOldPos != LISTBOX_ENTRY_NOTFOUND)
aTypeLB.SelectEntryPos(nOldPos);
m_pTypeLB->SelectEntryPos(nOldPos);
if (sOldDBName.Len())
{
aDatabaseTLB.Select(sOldDBName, sOldTableName, sOldColumnName);
m_pDatabaseTLB->Select(sOldDBName, sOldTableName, sOldColumnName);
}
else
{
@ -136,7 +142,7 @@ void SwFldDBPage::Reset(const SfxItemSet&)
if(pSh)
{
SwDBData aTmp(pSh->GetDBData());
aDatabaseTLB.Select(aTmp.sDataSource, aTmp.sCommand, aEmptyStr);
m_pDatabaseTLB->Select(aTmp.sDataSource, aTmp.sCommand, aEmptyStr);
}
}
}
@ -150,10 +156,10 @@ void SwFldDBPage::Reset(const SfxItemSet&)
sal_uInt16 nVal = (sal_uInt16)sVal.ToInt32();
if(nVal != USHRT_MAX)
{
for(i = 0; i < aTypeLB.GetEntryCount(); i++)
if(nVal == (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(i))
for(i = 0; i < m_pTypeLB->GetEntryCount(); i++)
if(nVal == (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(i))
{
aTypeLB.SelectEntryPos(i);
m_pTypeLB->SelectEntryPos(i);
break;
}
}
@ -161,15 +167,15 @@ void SwFldDBPage::Reset(const SfxItemSet&)
}
TypeHdl(0);
aTypeLB.SetUpdateMode(sal_True);
aTypeLB.SetSelectHdl(LINK(this, SwFldDBPage, TypeHdl));
aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
m_pTypeLB->SetUpdateMode(sal_True);
m_pTypeLB->SetSelectHdl(LINK(this, SwFldDBPage, TypeHdl));
m_pTypeLB->SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
if (IsFldEdit())
{
aConditionED.SaveValue();
aValueED.SaveValue();
sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
m_pConditionED->SaveValue();
m_pValueED->SaveValue();
sOldDBName = m_pDatabaseTLB->GetDBName(sOldTableName, sOldColumnName);
nOldFormat = GetCurField()->GetFormat();
nOldSubType = GetCurField()->GetSubType();
}
@ -180,7 +186,7 @@ sal_Bool SwFldDBPage::FillItemSet(SfxItemSet& )
String sTableName, sColumnName;
SwDBData aData;
sal_Bool bIsTable;
aData.sDataSource = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
aData.sDataSource = m_pDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
aData.sCommand = sTableName;
aData.nCommandType = bIsTable ? 0 : 1;
SwWrtShell *pSh = GetWrtShell();
@ -192,9 +198,9 @@ sal_Bool SwFldDBPage::FillItemSet(SfxItemSet& )
if(!aData.sDataSource.isEmpty()) // without database no new field command
{
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(GetTypeSel());
String aVal(aValueED.GetText());
String aName(aConditionED.GetText());
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(GetTypeSel());
String aVal(m_pValueED->GetText());
String aName(m_pConditionED->GetText());
sal_uLong nFormat = 0;
sal_uInt16 nSubType = 0;
@ -214,26 +220,26 @@ sal_Bool SwFldDBPage::FillItemSet(SfxItemSet& )
switch (nTypeId)
{
case TYP_DBFLD:
nFormat = aNumFormatLB.GetFormat();
if (aNewFormatRB.IsEnabled() && aNewFormatRB.IsChecked())
nFormat = m_pNumFormatLB->GetFormat();
if (m_pNewFormatRB->IsEnabled() && m_pNewFormatRB->IsChecked())
nSubType = nsSwExtendedSubType::SUB_OWN_FMT;
aName = sDBName;
break;
case TYP_DBSETNUMBERFLD:
nFormat = (sal_uInt16)(sal_uLong)aFormatLB.GetEntryData(
aFormatLB.GetSelectEntryPos() );
nFormat = (sal_uInt16)(sal_uLong)m_pFormatLB->GetEntryData(
m_pFormatLB->GetSelectEntryPos() );
break;
}
String sTempDBName, sTempTableName, sTempColumnName;
sTempDBName = aDatabaseTLB.GetDBName(sTempTableName, sTempColumnName);
sTempDBName = m_pDatabaseTLB->GetDBName(sTempTableName, sTempColumnName);
sal_Bool bDBListBoxChanged = sOldDBName != sTempDBName ||
sOldTableName != sTempTableName || sOldColumnName != sTempColumnName;
if (!IsFldEdit() ||
aConditionED.GetSavedValue() != aConditionED.GetText() ||
aValueED.GetSavedValue() != aValueED.GetText() ||
m_pConditionED->GetSavedValue() != m_pConditionED->GetText() ||
m_pValueED->GetSavedValue() != m_pValueED->GetText() ||
bDBListBoxChanged ||
nOldFormat != nFormat || nOldSubType != nSubType)
{
@ -261,12 +267,12 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
const sal_uInt16 nOld = GetTypeSel();
// current ListBoxPos
SetTypeSel(aTypeLB.GetSelectEntryPos());
SetTypeSel(m_pTypeLB->GetSelectEntryPos());
if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
{
SetTypeSel(0);
aTypeLB.SelectEntryPos(0);
m_pTypeLB->SelectEntryPos(0);
}
if (nOld != GetTypeSel())
@ -275,9 +281,9 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
if(!pSh)
pSh = ::GetActiveWrtShell();
sal_Bool bCond = sal_False, bSetNo = sal_False, bFormat = sal_False, bDBFormat = sal_False;
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(GetTypeSel());
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(GetTypeSel());
aDatabaseTLB.ShowColumns(nTypeId == TYP_DBFLD);
m_pDatabaseTLB->ShowColumns(nTypeId == TYP_DBFLD);
if (IsFldEdit())
{
@ -292,7 +298,7 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
{
aData = ((SwDBNameInfField*)GetCurField())->GetDBData(pSh->GetDoc());
}
aDatabaseTLB.Select(aData.sDataSource, aData.sCommand, sColumnName);
m_pDatabaseTLB->Select(aData.sDataSource, aData.sCommand, sColumnName);
}
switch (nTypeId)
@ -300,21 +306,21 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
case TYP_DBFLD:
bFormat = sal_True;
bDBFormat = sal_True;
aNumFormatLB.Show();
aFormatLB.Hide();
m_pNumFormatLB->Show();
m_pFormatLB->Hide();
if (pBox) // type was changed by user
aDBFormatRB.Check();
m_pDBFormatRB->Check();
if (IsFldEdit())
{
if (GetCurField()->GetFormat() != 0 && GetCurField()->GetFormat() != SAL_MAX_UINT32)
aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_OWN_FMT)
aNewFormatRB.Check();
m_pNewFormatRB->Check();
else
aDBFormatRB.Check();
m_pDBFormatRB->Check();
}
break;
@ -325,8 +331,8 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
bCond = sal_True;
if (IsFldEdit())
{
aConditionED.SetText(GetCurField()->GetPar1());
aValueED.SetText(GetCurField()->GetPar2());
m_pConditionED->SetText(GetCurField()->GetPar1());
m_pValueED->SetText(GetCurField()->GetPar2());
}
break;
@ -335,42 +341,40 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
case TYP_DBSETNUMBERFLD:
bFormat = sal_True;
aNewFormatRB.Check();
aNumFormatLB.Hide();
aFormatLB.Show();
m_pNewFormatRB->Check();
m_pNumFormatLB->Hide();
m_pFormatLB->Show();
if( IsFldEdit() )
{
for( sal_uInt16 nI = aFormatLB.GetEntryCount(); nI; )
for( sal_uInt16 nI = m_pFormatLB->GetEntryCount(); nI; )
if( GetCurField()->GetFormat() == (sal_uInt16)(sal_uLong)
aFormatLB.GetEntryData( --nI ))
m_pFormatLB->GetEntryData( --nI ))
{
aFormatLB.SelectEntryPos( nI );
m_pFormatLB->SelectEntryPos( nI );
break;
}
}
break;
}
aConditionFT.Enable(bCond);
aConditionED.Enable(bCond);
aValueFT.Enable(bSetNo);
aValueED.Enable(bSetNo);
m_pCondition->Enable(bCond);
m_pValue->Enable(bSetNo);
if (nTypeId != TYP_DBFLD)
{
aDBFormatRB.Enable(bDBFormat);
aNewFormatRB.Enable(bDBFormat|bFormat);
aNumFormatLB.Enable(bDBFormat);
aFormatLB.Enable(bFormat);
m_pDBFormatRB->Enable(bDBFormat);
m_pNewFormatRB->Enable(bDBFormat|bFormat);
m_pNumFormatLB->Enable(bDBFormat);
m_pFormatLB->Enable(bFormat);
}
aFormatFL.Enable(bDBFormat|bFormat);
m_pFormat->Enable(bDBFormat|bFormat);
if (!IsFldEdit())
{
aValueED.SetText(aEmptyStr);
m_pValueED->SetText(aEmptyStr);
if (bCond)
aConditionED.SetText(OUString("TRUE"));
m_pConditionED->SetText(OUString("TRUE"));
else
aConditionED.SetText(aEmptyStr);
m_pConditionED->SetText(aEmptyStr);
}
CheckInsert();
@ -381,7 +385,7 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
IMPL_LINK( SwFldDBPage, NumSelectHdl, NumFormatListBox *, pLB )
{
aNewFormatRB.Check();
m_pNewFormatRB->Check();
aOldNumSelectHdl.Call(pLB);
return 0;
@ -390,16 +394,16 @@ IMPL_LINK( SwFldDBPage, NumSelectHdl, NumFormatListBox *, pLB )
void SwFldDBPage::CheckInsert()
{
sal_Bool bInsert = sal_True;
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(GetTypeSel());
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(GetTypeSel());
SvTreeListEntry* pEntry = aDatabaseTLB.GetCurEntry();
SvTreeListEntry* pEntry = m_pDatabaseTLB->GetCurEntry();
if (pEntry)
{
pEntry = aDatabaseTLB.GetParent(pEntry);
pEntry = m_pDatabaseTLB->GetParent(pEntry);
if (nTypeId == TYP_DBFLD && pEntry)
pEntry = aDatabaseTLB.GetParent(pEntry);
pEntry = m_pDatabaseTLB->GetParent(pEntry);
bInsert &= pEntry != 0;
}
@ -408,7 +412,7 @@ void SwFldDBPage::CheckInsert()
if (nTypeId == TYP_DBNUMSETFLD)
{
sal_Bool bHasValue = !aValueED.GetText().isEmpty();
sal_Bool bHasValue = !m_pValueED->GetText().isEmpty();
bInsert &= bHasValue;
}
@ -422,12 +426,12 @@ IMPL_LINK( SwFldDBPage, TreeSelectHdl, SvTreeListBox *, pBox )
SvTreeListEntry* pEntry = pColEntry = pBox->GetCurEntry();
if (pEntry)
{
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(GetTypeSel());
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(GetTypeSel());
pEntry = aDatabaseTLB.GetParent(pEntry);
pEntry = m_pDatabaseTLB->GetParent(pEntry);
if (nTypeId == TYP_DBFLD && pEntry)
pEntry = aDatabaseTLB.GetParent(pEntry);
pEntry = m_pDatabaseTLB->GetParent(pEntry);
CheckInsert();
@ -440,19 +444,19 @@ IMPL_LINK( SwFldDBPage, TreeSelectHdl, SvTreeListBox *, pBox )
String sTableName;
String sColumnName;
sal_Bool bIsTable;
String sDBName = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
String sDBName = m_pDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
bNumFormat = GetFldMgr().IsDBNumeric(sDBName,
sTableName,
bIsTable,
sColumnName);
if (!IsFldEdit())
aDBFormatRB.Check();
m_pDBFormatRB->Check();
}
aDBFormatRB.Enable(bNumFormat);
aNewFormatRB.Enable(bNumFormat);
aNumFormatLB.Enable(bNumFormat);
aFormatFL.Enable(bNumFormat);
m_pDBFormatRB->Enable(bNumFormat);
m_pNewFormatRB->Enable(bNumFormat);
m_pNumFormatLB->Enable(bNumFormat);
m_pFormat->Enable(bNumFormat);
}
}
return 0;
@ -463,7 +467,7 @@ IMPL_LINK_NOARG(SwFldDBPage, AddDBHdl)
String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource();
if(sNewDB.Len())
{
aDatabaseTLB.AddDataSource(sNewDB);
m_pDatabaseTLB->AddDataSource(sNewDB);
}
return 0;
}
@ -481,12 +485,12 @@ void SwFldDBPage::FillUserData()
{
String sData(OUString(USER_DATA_VERSION));
sData += ';';
sal_uInt16 nTypeSel = aTypeLB.GetSelectEntryPos();
sal_uInt16 nTypeSel = m_pTypeLB->GetSelectEntryPos();
if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
nTypeSel = USHRT_MAX;
else
nTypeSel = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData( nTypeSel );
nTypeSel = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData( nTypeSel );
sData += OUString::number( nTypeSel );
SetUserData(sData);
}
@ -494,15 +498,15 @@ void SwFldDBPage::FillUserData()
void SwFldDBPage::ActivateMailMergeAddress()
{
sal_uLong nData = TYP_DBFLD;
aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos( (const void*) nData ));
aTypeLB.GetSelectHdl().Call(&aTypeLB);
m_pTypeLB->SelectEntryPos(m_pTypeLB->GetEntryPos( (const void*) nData ));
m_pTypeLB->GetSelectHdl().Call(m_pTypeLB);
const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource();
aDatabaseTLB.Select(rData.sDataSource, rData.sCommand, aEmptyStr);
m_pDatabaseTLB->Select(rData.sDataSource, rData.sCommand, aEmptyStr);
}
void SwFldDBPage::SetWrtShell(SwWrtShell& rSh)
{
aDatabaseTLB.SetWrtShell(rSh);
m_pDatabaseTLB->SetWrtShell(rSh);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -32,24 +32,20 @@
class SwFldDBPage : public SwFldPage
{
FixedText aTypeFT;
ListBox aTypeLB;
FixedText aSelectionFT;
SwDBTreeList aDatabaseTLB;
ListBox* m_pTypeLB;
SwDBTreeList* m_pDatabaseTLB;
FixedText aAddDBFT;
PushButton aAddDBPB;
PushButton* m_pAddDBPB;
FixedText aConditionFT;
ConditionEdit aConditionED;
FixedText aValueFT;
Edit aValueED;
RadioButton aDBFormatRB;
RadioButton aNewFormatRB;
NumFormatListBox aNumFormatLB;
ListBox aFormatLB;
FixedLine aFormatFL;
FixedLine aFormatVertFL;
VclContainer* m_pCondition;
ConditionEdit* m_pConditionED;
VclContainer* m_pValue;
Edit* m_pValueED;
RadioButton* m_pDBFormatRB;
RadioButton* m_pNewFormatRB;
NumFormatListBox* m_pNumFormatLB;
ListBox* m_pFormatLB;
VclContainer* m_pFormat;
String sOldDBName;
String sOldTableName;

View File

@ -1,166 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "globals.hrc"
#include "fldtdlg.hrc"
#include "helpid.h"
TabPage TP_FLD_DB
{
HelpID = HID_FLD_DB ;
SVLook = TRUE ;
Hide = TRUE ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
FixedText FT_DBTYPE
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 76 , 8 ) ;
Text [ en-US ] = "~Type" ;
Left = TRUE ;
};
ListBox LB_DBTYPE
{
HelpID = "sw:ListBox:TP_FLD_DB: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
{
HelpID = "sw:Edit:TP_FLD_DB: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
{
HelpID = "sw:Edit:TP_FLD_DB: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
{
HelpID = "sw:PushButton:TP_FLD_DB:PB_ADDDB";
Pos = MAP_APPFONT ( 198 , 121) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "Browse..." ;
};
RadioButton RB_DBOWNFORMAT
{
HelpID = "sw:RadioButton:TP_FLD_DB:RB_DBOWNFORMAT";
Pos = MAP_APPFONT ( 94 , 153 ) ;
Size = MAP_APPFONT ( 150 , 10 ) ;
Check = TRUE ;
Text [ en-US ] = "From database" ;
};
RadioButton RB_DBFORMAT
{
HelpID = "sw:RadioButton:TP_FLD_DB:RB_DBFORMAT";
Pos = MAP_APPFONT ( 94 , 166 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text [ en-US ] = "User-defined" ;
};
ListBox LB_DBNUMFORMAT
{
HelpID = "sw:ListBox:TP_FLD_DB:LB_DBNUMFORMAT";
Border = TRUE ;
Pos = MAP_APPFONT ( 195 , 164 ) ;
Size = MAP_APPFONT ( 53 , 60 ) ;
TabStop = TRUE ;
AutoHScroll = TRUE ;
DropDown = TRUE ;
};
ListBox LB_DBFORMAT
{
HelpID = "sw:ListBox:TP_FLD_DB: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" ;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -22,34 +22,8 @@
#define FIELD_COLUMN_WIDTH 76
#define RC_FLDTDLG_BEGIN 0
// database field 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)
#define RC_TP_END (RC_TP_DB_END)
// Strings ------------------------------------------------------------------
#define STR_FLD_INSERT (RC_TP_END + 1)
#define STR_FLD_CLOSE (RC_TP_END + 2)
#define STR_FLD_INSERT 1
#define STR_FLD_CLOSE 2
#endif

View File

@ -56,7 +56,7 @@ public:
SwWrtShell* pSh,
const String& rDefDBName = aEmptyStr,
const sal_Bool bShowCol = sal_False );
SwDBTreeList(Window* pParent);
SwDBTreeList(Window* pParent, WinBits nStyle);
virtual ~SwDBTreeList();
virtual Size GetOptimalSize() const;

View File

@ -0,0 +1,419 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkBox" id="FldDbPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="typeframe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="GtkTreeView" id="type:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkGrid" id="condgroup">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Condition</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">condition</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="swlo-ConditionEdit" id="condition">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="recgroup">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkEntry" id="recnumber">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Record number</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">recnumber</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="selectframe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="swlo-SwDBTreeList" id="select:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="SwDBTreeList-selection1"/>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Database s_election</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">1</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="browseft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Add database file</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">browse</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse">
<property name="label" translatable="yes">Browse...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="formatframe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkRadioButton" id="fromdatabasecb">
<property name="label" translatable="yes">From database</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">userdefinedcb</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="userdefinedcb">
<property name="label" translatable="yes">User-defined</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">fromdatabasecb</property>
<accessibility>
<relation type="label-for" target="format"/>
<relation type="label-for" target="numformat"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkComboBoxText" id="format">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<accessibility>
<relation type="labelled-by" target="userdefinedcb"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="swlo-NumFormatListBox" id="numformat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<accessibility>
<relation type="labelled-by" target="userdefinedcb"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Database s_election</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</interface>