summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-09-16 10:11:25 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2010-09-16 10:11:25 +0200
commit18c9ae89e16e620999af675d7a6abab503cf143f (patch)
tree1c4dbfed9f5002f30b3c4dd2dfc5508dbbe16515
parentfa0e57adc40e440129055f0c8ab52eaab1006896 (diff)
calc-find-replace-empty-cells-svx.diff: Support find and replace empty cells
i#49380, n#415352
-rw-r--r--svx/inc/srchdlg.hxx2
-rw-r--r--svx/source/dialog/srchdlg.cxx49
2 files changed, 45 insertions, 6 deletions
diff --git a/svx/inc/srchdlg.hxx b/svx/inc/srchdlg.hxx
index 856f3fc5c3..fad0f4bd4c 100644
--- a/svx/inc/srchdlg.hxx
+++ b/svx/inc/srchdlg.hxx
@@ -160,6 +160,8 @@ public:
INT32 GetTransliterationFlags() const;
+ void SetSaveToModule(bool b);
+
private:
FixedText aSearchText;
ComboBox aSearchLB;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 5a2824c24d..74a338ffe6 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -659,6 +659,11 @@ INT32 SvxSearchDialog::GetTransliterationFlags() const
return nTransliterationFlags;
}
+void SvxSearchDialog::SetSaveToModule(bool b)
+{
+ pImpl->bSaveToModule = b;
+}
+
// -----------------------------------------------------------------------
void SvxSearchDialog::ApplyTransliterationFlags_Impl( INT32 nSettings )
@@ -926,9 +931,36 @@ void SvxSearchDialog::CalculateDelta_Impl()
// -----------------------------------------------------------------------
+namespace {
+
+class ToggleSaveToModule
+{
+public:
+ ToggleSaveToModule(SvxSearchDialog& rDialog, bool bValue) :
+ mrDialog(rDialog), mbValue(bValue)
+ {
+ mrDialog.SetSaveToModule(mbValue);
+ }
+
+ ~ToggleSaveToModule()
+ {
+ mrDialog.SetSaveToModule(!mbValue);
+ }
+private:
+ SvxSearchDialog& mrDialog;
+ bool mbValue;
+};
+
+}
+
void SvxSearchDialog::Init_Impl( int bSearchPattern )
{
DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+
+ // We don't want to save any intermediate state to the module while the
+ // dialog is being initialized.
+ ToggleSaveToModule aNoModuleSave(*this, false);
+
bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
pImpl->bMultiLineEdit = FALSE;
@@ -1078,10 +1110,8 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
bSet = TRUE;
- pImpl->bSaveToModule = FALSE;
FlagHdl_Impl( &aSimilarityBox );
FlagHdl_Impl( &aJapOptionsCB );
- pImpl->bSaveToModule = TRUE;
FASTBOOL bDisableSearch = FALSE;
SfxViewShell* pViewShell = SfxViewShell::Current();
@@ -1609,16 +1639,23 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd )
else
bSet = FALSE;
+ // Calc allows searching for empty cells.
+ bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC);
+
if ( pEd == &aSearchLB || pEd == &aReplaceLB )
{
- xub_StrLen nLBTxtLen = aSearchLB.GetText().Len(), nTxtLen;
+ xub_StrLen nSrchTxtLen = aSearchLB.GetText().Len();
+ xub_StrLen nReplTxtLen = 0;
+ if (bAllowEmptySearch)
+ nReplTxtLen = aReplaceLB.GetText().Len();
+ xub_StrLen nAttrTxtLen = 0;
if ( !pImpl->bMultiLineEdit )
- nTxtLen = aSearchAttrText.GetText().Len();
+ nAttrTxtLen = aSearchAttrText.GetText().Len();
else
- nTxtLen = pImpl->aSearchFormats.GetText().Len();
+ nAttrTxtLen = pImpl->aSearchFormats.GetText().Len();
- if ( nLBTxtLen || nTxtLen )
+ if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen)
{
EnableControl_Impl( &aSearchBtn );
EnableControl_Impl( &aReplaceBtn );