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/DateFormFieldDialog.cxx140
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.cxx28
-rw-r--r--sw/source/ui/fldui/DropDownFormFieldDialog.cxx76
-rw-r--r--sw/source/ui/fldui/flddb.cxx56
-rw-r--r--sw/source/ui/fldui/flddok.cxx24
-rw-r--r--sw/source/ui/fldui/fldpage.cxx38
-rw-r--r--sw/source/ui/fldui/fldref.cxx42
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx46
8 files changed, 225 insertions, 225 deletions
diff --git a/sw/source/ui/fldui/DateFormFieldDialog.cxx b/sw/source/ui/fldui/DateFormFieldDialog.cxx
index e038eaa34ea7..3739e17ef5b3 100644
--- a/sw/source/ui/fldui/DateFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DateFormFieldDialog.cxx
@@ -40,84 +40,84 @@ DateFormFieldDialog::~DateFormFieldDialog() {}
void DateFormFieldDialog::Apply()
{
- if (m_pDateField != nullptr)
+ if (m_pDateField == nullptr)
+ return;
+
+ // Try to find out the current date value and replace the content
+ // with the right formatted date string
+ sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+ const SvNumberformat* pFormat = m_pNumberFormatter->GetEntry(m_xFormatLB->GetFormat());
+
+ // Get date value first
+ std::pair<bool, double> aResult = m_pDateField->GetCurrentDate();
+
+ // Then set the date format
+ (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
+ (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE]
+ <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
+
+ // Update current date
+ if (aResult.first)
+ {
+ m_pDateField->SetCurrentDate(aResult.second);
+ }
+ else
{
- // Try to find out the current date value and replace the content
- // with the right formatted date string
- sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
- const SvNumberformat* pFormat = m_pNumberFormatter->GetEntry(m_xFormatLB->GetFormat());
-
- // Get date value first
- std::pair<bool, double> aResult = m_pDateField->GetCurrentDate();
-
- // Then set the date format
- (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
- (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE]
- <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
-
- // Update current date
- if (aResult.first)
- {
- m_pDateField->SetCurrentDate(aResult.second);
- }
- else
- {
- (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
- }
+ (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
}
}
void DateFormFieldDialog::InitControls()
{
- if (m_pDateField != nullptr)
+ if (m_pDateField == nullptr)
+ return;
+
+ sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+
+ OUString sFormatString;
+ auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
+ if (pResult != pParameters->end())
+ {
+ pResult->second >>= sFormatString;
+ }
+
+ OUString sLang;
+ pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
+ if (pResult != pParameters->end())
{
- sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
-
- OUString sFormatString;
- auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
- if (pResult != pParameters->end())
- {
- pResult->second >>= sFormatString;
- }
-
- OUString sLang;
- pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
- if (pResult != pParameters->end())
- {
- pResult->second >>= sLang;
- }
-
- if (!sFormatString.isEmpty() && !sLang.isEmpty())
- {
- LanguageType aLangType = LanguageTag(sLang).getLanguageType();
- sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sFormatString, aLangType);
- if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
- {
- sal_Int32 nCheckPos = 0;
- SvNumFormatType nType;
- m_pNumberFormatter->PutEntry(sFormatString, nCheckPos, nType, nFormat,
- LanguageTag(sLang).getLanguageType());
- }
-
- if (aLangType != LANGUAGE_DONTKNOW && nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
- {
- if (m_xFormatLB->GetCurLanguage() == aLangType)
- {
- m_xFormatLB->SetAutomaticLanguage(true);
- }
- else
- {
- m_xFormatLB->SetAutomaticLanguage(false);
- m_xFormatLB->SetLanguage(aLangType);
-
- // Change format and change back for regenerating the list
- m_xFormatLB->SetFormatType(SvNumFormatType::ALL);
- m_xFormatLB->SetFormatType(SvNumFormatType::DATE);
- }
- m_xFormatLB->SetDefFormat(nFormat);
- }
- }
+ pResult->second >>= sLang;
+ }
+
+ if (sFormatString.isEmpty() || sLang.isEmpty())
+ return;
+
+ LanguageType aLangType = LanguageTag(sLang).getLanguageType();
+ sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sFormatString, aLangType);
+ if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ sal_Int32 nCheckPos = 0;
+ SvNumFormatType nType;
+ m_pNumberFormatter->PutEntry(sFormatString, nCheckPos, nType, nFormat,
+ LanguageTag(sLang).getLanguageType());
+ }
+
+ if (aLangType == LANGUAGE_DONTKNOW || nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ return;
+
+ if (m_xFormatLB->GetCurLanguage() == aLangType)
+ {
+ m_xFormatLB->SetAutomaticLanguage(true);
+ }
+ else
+ {
+ m_xFormatLB->SetAutomaticLanguage(false);
+ m_xFormatLB->SetLanguage(aLangType);
+
+ // Change format and change back for regenerating the list
+ m_xFormatLB->SetFormatType(SvNumFormatType::ALL);
+ m_xFormatLB->SetFormatType(SvNumFormatType::DATE);
}
+ m_xFormatLB->SetDefFormat(nFormat);
}
} // namespace sw
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index 08c866294b43..d85bc5365bee 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -83,23 +83,23 @@ sw::DropDownFieldDialog::~DropDownFieldDialog()
void sw::DropDownFieldDialog::Apply()
{
- if (m_pDropField)
- {
- OUString sSelect = m_xListItemsLB->get_selected_text();
- if (m_pDropField->GetPar1() != sSelect)
- {
- m_rSh.StartAllAction();
+ if (!m_pDropField)
+ return;
- std::unique_ptr<SwDropDownField> const pCopy(
- static_cast<SwDropDownField*>(m_pDropField->CopyField().release()));
+ OUString sSelect = m_xListItemsLB->get_selected_text();
+ if (m_pDropField->GetPar1() == sSelect)
+ return;
- pCopy->SetPar1(sSelect);
- m_rSh.SwEditShell::UpdateOneField(*pCopy);
+ m_rSh.StartAllAction();
- m_rSh.SetUndoNoResetModified();
- m_rSh.EndAllAction();
- }
- }
+ std::unique_ptr<SwDropDownField> const pCopy(
+ static_cast<SwDropDownField*>(m_pDropField->CopyField().release()));
+
+ pCopy->SetPar1(sSelect);
+ m_rSh.SwEditShell::UpdateOneField(*pCopy);
+
+ m_rSh.SetUndoNoResetModified();
+ m_rSh.EndAllAction();
}
bool sw::DropDownFieldDialog::PrevButtonPressed() const
diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
index 4457b29f5eaf..a70488e46f19 100644
--- a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
@@ -129,30 +129,30 @@ void DropDownFormFieldDialog::InitControls()
void DropDownFormFieldDialog::AppendItemToList()
{
- if (m_xListAddButton->get_sensitive())
+ if (!m_xListAddButton->get_sensitive())
+ return;
+
+ if (m_xListItemsTreeView->n_children() >= ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT)
{
- if (m_xListItemsTreeView->n_children() >= ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT)
- {
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(
- m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok,
- SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT)));
- xInfoBox->run();
- return;
- }
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(
+ m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok,
+ SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT)));
+ xInfoBox->run();
+ return;
+ }
- const OUString sEntry(m_xListItemEntry->get_text());
- if (!sEntry.isEmpty())
- {
- m_xListItemsTreeView->append_text(sEntry);
- m_xListItemsTreeView->select_text(sEntry);
- m_bListHasChanged = true;
+ const OUString sEntry(m_xListItemEntry->get_text());
+ if (!sEntry.isEmpty())
+ {
+ m_xListItemsTreeView->append_text(sEntry);
+ m_xListItemsTreeView->select_text(sEntry);
+ m_bListHasChanged = true;
- // Clear entry
- m_xListItemEntry->set_text(OUString());
- m_xListItemEntry->grab_focus();
- }
- UpdateButtons();
+ // Clear entry
+ m_xListItemEntry->set_text(OUString());
+ m_xListItemEntry->grab_focus();
}
+ UpdateButtons();
}
void DropDownFormFieldDialog::UpdateButtons()
@@ -170,28 +170,28 @@ void DropDownFormFieldDialog::UpdateButtons()
void DropDownFormFieldDialog::Apply()
{
- if (m_pDropDownField != nullptr && m_bListHasChanged)
- {
- mark::IFieldmark::parameter_map_t* pParameters = m_pDropDownField->GetParameters();
+ if (!(m_pDropDownField != nullptr && m_bListHasChanged))
+ return;
- css::uno::Sequence<OUString> vListEntries(m_xListItemsTreeView->n_children());
- for (int nIndex = 0; nIndex < m_xListItemsTreeView->n_children(); ++nIndex)
- {
- vListEntries[nIndex] = m_xListItemsTreeView->get_text(nIndex);
- }
+ mark::IFieldmark::parameter_map_t* pParameters = m_pDropDownField->GetParameters();
- if (m_xListItemsTreeView->n_children() != 0)
- {
- (*pParameters)[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
- }
- else
- {
- pParameters->erase(ODF_FORMDROPDOWN_LISTENTRY);
- }
+ css::uno::Sequence<OUString> vListEntries(m_xListItemsTreeView->n_children());
+ for (int nIndex = 0; nIndex < m_xListItemsTreeView->n_children(); ++nIndex)
+ {
+ vListEntries[nIndex] = m_xListItemsTreeView->get_text(nIndex);
+ }
- // After editing the drop down field's list we don't specify the selected item
- pParameters->erase(ODF_FORMDROPDOWN_RESULT);
+ if (m_xListItemsTreeView->n_children() != 0)
+ {
+ (*pParameters)[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
}
+ else
+ {
+ pParameters->erase(ODF_FORMDROPDOWN_LISTENTRY);
+ }
+
+ // After editing the drop down field's list we don't specify the selected item
+ pParameters->erase(ODF_FORMDROPDOWN_RESULT);
}
} // namespace sw
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 601dcadf69a6..99a7d5f05b3b 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -437,41 +437,41 @@ void SwFieldDBPage::CheckInsert()
IMPL_LINK(SwFieldDBPage, TreeSelectHdl, weld::TreeView&, rBox, void)
{
std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
- if (rBox.get_selected(xIter.get()))
- {
- const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
+ if (!rBox.get_selected(xIter.get()))
+ return;
- bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- if (nTypeId == SwFieldTypesEnum::Database && bEntry)
- bEntry = m_xDatabaseTLB->iter_parent(*xIter);
+ bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
- CheckInsert();
+ if (nTypeId == SwFieldTypesEnum::Database && bEntry)
+ bEntry = m_xDatabaseTLB->iter_parent(*xIter);
- if (nTypeId == SwFieldTypesEnum::Database)
- {
- bool bNumFormat = false;
+ CheckInsert();
- if (bEntry)
- {
- OUString sTableName;
- OUString sColumnName;
- sal_Bool bIsTable;
- OUString sDBName = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
- bNumFormat = GetFieldMgr().IsDBNumeric(sDBName,
- sTableName,
- bIsTable,
- sColumnName);
- if (!IsFieldEdit())
- m_xDBFormatRB->set_active(true);
- }
+ if (nTypeId != SwFieldTypesEnum::Database)
+ return;
- m_xDBFormatRB->set_sensitive(bNumFormat);
- m_xNewFormatRB->set_sensitive(bNumFormat);
- m_xNumFormatLB->set_sensitive(bNumFormat);
- m_xFormat->set_sensitive(bNumFormat);
- }
+ bool bNumFormat = false;
+
+ if (bEntry)
+ {
+ OUString sTableName;
+ OUString sColumnName;
+ sal_Bool bIsTable;
+ OUString sDBName = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
+ bNumFormat = GetFieldMgr().IsDBNumeric(sDBName,
+ sTableName,
+ bIsTable,
+ sColumnName);
+ if (!IsFieldEdit())
+ m_xDBFormatRB->set_active(true);
}
+
+ m_xDBFormatRB->set_sensitive(bNumFormat);
+ m_xNewFormatRB->set_sensitive(bNumFormat);
+ m_xNumFormatLB->set_sensitive(bNumFormat);
+ m_xFormat->set_sensitive(bNumFormat);
}
IMPL_LINK_NOARG(SwFieldDBPage, AddDBHdl, weld::Button&, void)
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 31bf38943ae5..d86416f68df3 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -497,20 +497,20 @@ IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, weld::TreeView&, void)
nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(nPos).toUInt32());
}
- if (nTypeId == SwFieldTypesEnum::NextPage || nTypeId == SwFieldTypesEnum::PreviousPage)
- {
- // Prev/Next - PageNumFields special treatment:
- sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
- const OUString sOldText( m_xValueFT->get_label() );
- const OUString sNewText( SwResId( SVX_NUM_CHAR_SPECIAL == nTmp ? STR_VALUE
- : STR_OFFSET ));
+ if (nTypeId != SwFieldTypesEnum::NextPage && nTypeId != SwFieldTypesEnum::PreviousPage)
+ return;
- if (sOldText != sNewText)
- m_xValueFT->set_label(sNewText);
+ // Prev/Next - PageNumFields special treatment:
+ sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
+ const OUString sOldText( m_xValueFT->get_label() );
+ const OUString sNewText( SwResId( SVX_NUM_CHAR_SPECIAL == nTmp ? STR_VALUE
+ : STR_OFFSET ));
- if (sOldText != m_xValueFT->get_label())
- m_xValueED->set_text(OUString());
- }
+ if (sOldText != sNewText)
+ m_xValueFT->set_label(sNewText);
+
+ if (sOldText != m_xValueFT->get_label())
+ m_xValueED->set_text(OUString());
}
bool SwFieldDokPage::FillItemSet(SfxItemSet* )
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 606f149ab331..b010a1afd767 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -71,26 +71,26 @@ void SwFieldPage::Init()
// Dok-Switch (fldtdlg:ReInitTabPage)
m_pCurField = m_aMgr.GetCurField();
- if( bNewMode != m_bFieldDlgHtmlMode )
- {
- m_bFieldDlgHtmlMode = bNewMode;
+ if( bNewMode == m_bFieldDlgHtmlMode )
+ return;
- // initialise Rangelistbox
- if( m_bFieldDlgHtmlMode && m_bFirstHTMLInit )
- {
- m_bFirstHTMLInit = false;
- SwWrtShell *pSh = m_pWrtShell;
- if(! pSh)
- pSh = ::GetActiveWrtShell();
- if(pSh)
- {
- SwDoc* pDoc = pSh->GetDoc();
- pSh->InsertFieldType( SwSetExpFieldType( pDoc,
- "HTML_ON", 1));
- pSh->InsertFieldType( SwSetExpFieldType(pDoc,
- "HTML_OFF", 1));
- }
- }
+ m_bFieldDlgHtmlMode = bNewMode;
+
+ // initialise Rangelistbox
+ if( !(m_bFieldDlgHtmlMode && m_bFirstHTMLInit) )
+ return;
+
+ m_bFirstHTMLInit = false;
+ SwWrtShell *pSh = m_pWrtShell;
+ if(! pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwDoc* pDoc = pSh->GetDoc();
+ pSh->InsertFieldType( SwSetExpFieldType( pDoc,
+ "HTML_ON", 1));
+ pSh->InsertFieldType( SwSetExpFieldType(pDoc,
+ "HTML_OFF", 1));
}
}
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 9a94726ad74d..6c92d6f4d07a 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -119,29 +119,29 @@ void SwFieldRefPage::SaveSelectedTextNode()
{
mpSavedSelectedTextNode = nullptr;
mnSavedSelectedPos = 0;
- if ( m_xSelectionToolTipLB->get_visible() )
+ if ( !m_xSelectionToolTipLB->get_visible() )
+ return;
+
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ if (nEntry == -1)
+ return;
+
+ const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+
+ if ( nTypeId == REFFLDFLAG_HEADING )
{
- int nEntry = m_xSelectionToolTipLB->get_selected_index();
- if (nEntry != -1)
+ mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
+ if ( mnSavedSelectedPos < maOutlineNodes.size() )
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
-
- if ( nTypeId == REFFLDFLAG_HEADING )
- {
- mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
- if ( mnSavedSelectedPos < maOutlineNodes.size() )
- {
- mpSavedSelectedTextNode = maOutlineNodes[mnSavedSelectedPos];
- }
- }
- else if ( nTypeId == REFFLDFLAG_NUMITEM )
- {
- mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
- if ( mnSavedSelectedPos < maNumItems.size() )
- {
- mpSavedSelectedTextNode = maNumItems[mnSavedSelectedPos]->GetTextNode();
- }
- }
+ mpSavedSelectedTextNode = maOutlineNodes[mnSavedSelectedPos];
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
+ if ( mnSavedSelectedPos < maNumItems.size() )
+ {
+ mpSavedSelectedTextNode = maNumItems[mnSavedSelectedPos]->GetTextNode();
}
}
}
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 4a12a7538586..fefd2eb8cd3a 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -205,20 +205,20 @@ void SwFieldDlg::ReInitTabPage(const OString& rPageId, bool bOnlyActivate)
void SwFieldDlg::Activate()
{
SwView* pView = ::GetActiveView();
- if( pView )
- {
- bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
- const SwWrtShell& rSh = pView->GetWrtShell();
- GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
- !rSh.HasReadonlySel());
+ if( !pView )
+ return;
- ReInitTabPage("variables", true);
+ bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
+ const SwWrtShell& rSh = pView->GetWrtShell();
+ GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
+ !rSh.HasReadonlySel());
- if( !bHtmlMode )
- {
- ReInitTabPage("ref", true);
- ReInitTabPage("functions", true);
- }
+ ReInitTabPage("variables", true);
+
+ if( !bHtmlMode )
+ {
+ ReInitTabPage("ref", true);
+ ReInitTabPage("functions", true);
}
}
@@ -268,20 +268,20 @@ void SwFieldDlg::ShowReferencePage()
void SwFieldDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
{
#if HAVE_FEATURE_DBCONNECTIVITY
- if (rId == "database")
+ if (rId != "database")
+ return;
+
+ SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
+ SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
+ if(pViewFrame)
{
- SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
- SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
- if(pViewFrame)
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst( true, checkSfxViewShell<SwView> );
+ while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst( true, checkSfxViewShell<SwView> );
- while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
- {
- pViewShell = SfxViewShell::GetNext( *pViewShell, true, checkSfxViewShell<SwView> );
- }
- if(pViewShell)
- static_cast<SwFieldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
+ pViewShell = SfxViewShell::GetNext( *pViewShell, true, checkSfxViewShell<SwView> );
}
+ if(pViewShell)
+ static_cast<SwFieldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
}
#else
(void) rId;