summaryrefslogtreecommitdiff
path: root/sw/source/ui/dbui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/dbui')
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx115
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx53
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.cxx57
3 files changed, 114 insertions, 111 deletions
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index e166f4d7d3e7..084819ca76d9 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1478,72 +1478,73 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove)
TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
- if(pBeginAttrib &&
- (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
- && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ if(!pBeginAttrib ||
+ !(pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex() &&
+ pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ return;
+
+ //current item has been found
+ sal_uInt32 nPara = rSelection.GetStart().GetPara();
+ sal_Int32 nIndex = pBeginAttrib->GetStart();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ const OUString sCurrentItem = pTextEngine->GetText(aEntrySel);
+ pTextEngine->RemoveAttrib( nPara, *pBeginAttrib );
+ pTextEngine->ReplaceText(aEntrySel, OUString());
+ switch(nMove)
{
- //current item has been found
- sal_uInt32 nPara = rSelection.GetStart().GetPara();
- sal_Int32 nIndex = pBeginAttrib->GetStart();
- TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
- const OUString sCurrentItem = pTextEngine->GetText(aEntrySel);
- pTextEngine->RemoveAttrib( nPara, *pBeginAttrib );
- pTextEngine->ReplaceText(aEntrySel, OUString());
- switch(nMove)
- {
- case MoveItemFlags::Left :
- if(nIndex)
- {
- //go left to find a predecessor or simple text
- --nIndex;
- const OUString sPara = pTextEngine->GetText( nPara );
- sal_Int32 nSearchIndex = sPara.lastIndexOf( '>', nIndex+1 );
- if( nSearchIndex != -1 && nSearchIndex == nIndex )
- {
- nSearchIndex = sPara.lastIndexOf( '<', nIndex );
- if( nSearchIndex != -1 )
- nIndex = nSearchIndex;
- }
- }
- break;
- case MoveItemFlags::Right:
+ case MoveItemFlags::Left :
+ if(nIndex)
{
- //go right to find a successor or simple text
- ++nIndex;
- const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
- if(pEndAttrib && pEndAttrib->GetEnd() >= nIndex)
+ //go left to find a predecessor or simple text
+ --nIndex;
+ const OUString sPara = pTextEngine->GetText( nPara );
+ sal_Int32 nSearchIndex = sPara.lastIndexOf( '>', nIndex+1 );
+ if( nSearchIndex != -1 && nSearchIndex == nIndex )
{
- nIndex = pEndAttrib->GetEnd();
+ nSearchIndex = sPara.lastIndexOf( '<', nIndex );
+ if( nSearchIndex != -1 )
+ nIndex = nSearchIndex;
}
}
- break;
- case MoveItemFlags::Up :
- --nPara;
- nIndex = 0;
- break;
- case MoveItemFlags::Down :
- ++nPara;
- nIndex = 0;
- break;
- default: break;
- }
- //add a new paragraph if there is none yet
- if(nPara >= pTextEngine->GetParagraphCount())
+ break;
+ case MoveItemFlags::Right:
{
-
- TextPaM aTemp(nPara - 1, pTextEngine->GetTextLen( nPara - 1 ));
- pTextEngine->ReplaceText(aTemp, "\n");
+ //go right to find a successor or simple text
+ ++nIndex;
+ const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pEndAttrib && pEndAttrib->GetEnd() >= nIndex)
+ {
+ nIndex = pEndAttrib->GetEnd();
+ }
}
- InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex );
+ break;
+ case MoveItemFlags::Up :
+ --nPara;
+ nIndex = 0;
+ break;
+ case MoveItemFlags::Down :
+ ++nPara;
+ nIndex = 0;
+ break;
+ default: break;
+ }
+ //add a new paragraph if there is none yet
+ if(nPara >= pTextEngine->GetParagraphCount())
+ {
- // select the new entry [#i40817]
- const TextCharAttrib *pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
- if (pAttrib)
- aEntrySel = TextSelection(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
- pTextView->SetSelection(aEntrySel);
- Invalidate();
- Modify();
+ TextPaM aTemp(nPara - 1, pTextEngine->GetTextLen( nPara - 1 ));
+ pTextEngine->ReplaceText(aTemp, "\n");
}
+ InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex );
+
+ // select the new entry [#i40817]
+ const TextCharAttrib *pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
+ if (pAttrib)
+ aEntrySel = TextSelection(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
+ pTextView->SetSelection(aEntrySel);
+ Invalidate();
+ Modify();
+
}
MoveItemFlags AddressMultiLineEdit::IsCurrentItemMoveable()
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 4ed83ff6dd95..05b354d9eb6d 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -441,32 +441,33 @@ void SwMMResultEmailDialog::FillInEmailSettings()
}
//fill mail address ListBox
- if (!m_pMailToLB->GetEntryCount())
- {
- //select first column
- uno::Reference< sdbcx::XColumnsSupplier > xColsSupp(xConfigItem->GetResultSet(), uno::UNO_QUERY);
- //get the name of the actual columns
- uno::Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr;
- uno::Sequence< OUString > aFields;
- if (xColAccess.is())
- aFields = xColAccess->getElementNames();
- const OUString* pFields = aFields.getConstArray();
- for (sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
- m_pMailToLB->InsertEntry(pFields[nField]);
-
- m_pMailToLB->SelectEntryPos(0);
- // then select the right one - may not be available
- const std::vector<std::pair<OUString, int>>& rHeaders = xConfigItem->GetDefaultAddressHeaders();
- OUString sEMailColumn = rHeaders[MM_PART_E_MAIL].first;
- Sequence< OUString> aAssignment = xConfigItem->GetColumnAssignment(xConfigItem->GetCurrentDBData());
- if (aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty())
- sEMailColumn = aAssignment[MM_PART_E_MAIL];
- m_pMailToLB->SelectEntry(sEMailColumn);
-
- // HTML format pre-selected
- m_pSendAsLB->SelectEntryPos(3);
- SendTypeHdl_Impl(*m_pSendAsLB);
- }
+ if (m_pMailToLB->GetEntryCount())
+ return;
+
+ //select first column
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp(xConfigItem->GetResultSet(), uno::UNO_QUERY);
+ //get the name of the actual columns
+ uno::Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr;
+ uno::Sequence< OUString > aFields;
+ if (xColAccess.is())
+ aFields = xColAccess->getElementNames();
+ const OUString* pFields = aFields.getConstArray();
+ for (sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
+ m_pMailToLB->InsertEntry(pFields[nField]);
+
+ m_pMailToLB->SelectEntryPos(0);
+ // then select the right one - may not be available
+ const std::vector<std::pair<OUString, int>>& rHeaders = xConfigItem->GetDefaultAddressHeaders();
+ OUString sEMailColumn = rHeaders[MM_PART_E_MAIL].first;
+ Sequence< OUString> aAssignment = xConfigItem->GetColumnAssignment(xConfigItem->GetCurrentDBData());
+ if (aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty())
+ sEMailColumn = aAssignment[MM_PART_E_MAIL];
+ m_pMailToLB->SelectEntry(sEMailColumn);
+
+ // HTML format pre-selected
+ m_pSendAsLB->SelectEntryPos(3);
+ SendTypeHdl_Impl(*m_pSendAsLB);
+
}
IMPL_LINK(SwMMResultSaveDialog, DocumentSelectionHdl_Impl, Button*, pButton, void)
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
index e1b5909817ea..45d605773161 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.cxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -160,36 +160,37 @@ void SwSelectDBTableDialog::dispose()
IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, Button*, pButton, void)
{
SvTreeListEntry* pEntry = m_pTable->FirstSelected();
- if(pEntry)
- {
- OUString sTableOrQuery = SvTabListBox::GetEntryText(pEntry, 0);
- sal_Int32 nCommandType = nullptr == pEntry->GetUserData() ? 0 : 1;
+ if(!pEntry)
+ return;
- OUString sDataSourceName;
- Reference<XChild> xChild(m_xConnection, UNO_QUERY);
- if(xChild.is())
- {
- Reference<XDataSource> xSource(xChild->getParent(), UNO_QUERY);
- Reference<XPropertySet> xPrSet(xSource, UNO_QUERY);
- xPrSet->getPropertyValue("Name") >>= sDataSourceName;
- }
- OSL_ENSURE(!sDataSourceName.isEmpty(), "no data source found");
- Sequence<PropertyValue> aProperties(5);
- PropertyValue* pProperties = aProperties.getArray();
- pProperties[0].Name = "DataSourceName";
- pProperties[0].Value <<= sDataSourceName;
- pProperties[1].Name = "Command";
- pProperties[1].Value <<= sTableOrQuery;
- pProperties[2].Name = "CommandType";
- pProperties[2].Value <<= nCommandType;
- pProperties[3].Name = "ShowTreeView";
- pProperties[3].Value <<= false;
- pProperties[4].Name = "ShowTreeViewButton";
- pProperties[4].Value <<= false;
-
- VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties);
- pDlg->Execute();
+ OUString sTableOrQuery = SvTabListBox::GetEntryText(pEntry, 0);
+ sal_Int32 nCommandType = nullptr == pEntry->GetUserData() ? 0 : 1;
+
+ OUString sDataSourceName;
+ Reference<XChild> xChild(m_xConnection, UNO_QUERY);
+ if(xChild.is())
+ {
+ Reference<XDataSource> xSource(xChild->getParent(), UNO_QUERY);
+ Reference<XPropertySet> xPrSet(xSource, UNO_QUERY);
+ xPrSet->getPropertyValue("Name") >>= sDataSourceName;
}
+ OSL_ENSURE(!sDataSourceName.isEmpty(), "no data source found");
+ Sequence<PropertyValue> aProperties(5);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = "DataSourceName";
+ pProperties[0].Value <<= sDataSourceName;
+ pProperties[1].Name = "Command";
+ pProperties[1].Value <<= sTableOrQuery;
+ pProperties[2].Name = "CommandType";
+ pProperties[2].Value <<= nCommandType;
+ pProperties[3].Name = "ShowTreeView";
+ pProperties[3].Value <<= false;
+ pProperties[4].Name = "ShowTreeViewButton";
+ pProperties[4].Value <<= false;
+
+ VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties);
+ pDlg->Execute();
+
}
OUString SwSelectDBTableDialog::GetSelectedTable(bool& bIsTable)