summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorDennis Francis <dennisfrancis.in@gmail.com>2015-10-17 23:14:35 +0530
committerEike Rathke <erack@redhat.com>2015-10-23 00:24:18 +0000
commit9a85743766e8a063d20d5f93ee88758e243397f4 (patch)
tree5cfcdbf0072a5ba099ee22d06af618717bffa22b /svx
parentb5a1a23ed05d5b72d50bf08b8f6fd550eea17b64 (diff)
tdf#48456 : when searching for a number, consider formatting
Change-Id: I4a1e3e269a269bb37e88aa8810a46d0f4ecfc518 Reviewed-on: https://gerrit.libreoffice.org/19420 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/tbunosearchcontrollers.hxx33
-rw-r--r--svx/source/dialog/srchdlg.cxx7
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx114
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.src5
-rw-r--r--svx/uiconfig/ui/findreplacedialog.ui17
-rw-r--r--svx/util/svx.component4
6 files changed, 178 insertions, 2 deletions
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index c180023d28a3..f7477dfacd15 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -222,6 +222,39 @@ private:
VclPtr<CheckBox> m_pMatchCaseControl;
};
+class SearchFormattedToolboxController : public svt::ToolboxController,
+ public css::lang::XServiceInfo
+{
+public:
+ SearchFormattedToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~SearchFormattedToolboxController();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException, std::exception ) override;
+ virtual void SAL_CALL acquire() throw () override;
+ virtual void SAL_CALL release() throw () override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException, std::exception ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception) override;
+
+ // XToolbarController
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
+
+private:
+ VclPtr<CheckBox> m_pSearchFormattedControl;
+};
+
class FindAllToolboxController : public svt::ToolboxController,
public css::lang::XServiceInfo
{
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 49533b2cf6f3..c3e58152a1bd 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -300,6 +300,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
get(m_pSearchComponent2PB, "component2");
get(m_pMatchCaseCB, "matchcase");
+ get(m_pSearchFormattedCB, "searchformatted");
get(m_pWordBtn, "wholewords");
aCalcStr = get<FixedText>("entirecells")->GetText();
@@ -383,6 +384,7 @@ void SvxSearchDialog::dispose()
m_pSearchComponent1PB.clear();
m_pSearchComponent2PB.clear();
m_pMatchCaseCB.clear();
+ m_pSearchFormattedCB.clear();
m_pWordBtn.clear();
m_pCloseBtn.clear();
m_pIgnoreDiacritics.clear();
@@ -740,6 +742,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl()
m_pRowsBtn->Show();
m_pColumnsBtn->Show();
m_pAllSheetsCB->Show();
+ m_pSearchFormattedCB->Show();
}
}
@@ -813,6 +816,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pRowsBtn->SetClickHdl( aLink );
m_pColumnsBtn->SetClickHdl( aLink );
m_pAllSheetsCB->SetClickHdl( aLink );
+ m_pSearchFormattedCB->SetClickHdl( aLink );
sal_uIntPtr nModifyFlagCheck;
switch ( pSearchItem->GetCellType() )
@@ -854,6 +858,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
}
else
{
+ m_pSearchFormattedCB->Hide();
m_pWordBtn->SetText( aCalcStr.getToken( 1, '#' ) );
if ( pSearchItem->GetAppFlag() == SvxSearchApp::DRAW )
@@ -1293,6 +1298,7 @@ IMPL_LINK_TYPED( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void )
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
+ pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
}
if (pBtn == m_pSearchBtn)
@@ -2230,6 +2236,7 @@ void SvxSearchDialog::SaveToModule_Impl()
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
+ pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
}
pSearchItem->SetCommand( SvxSearchCmd::FIND );
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index b7e71b5bee98..0dd67acaf7d9 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -53,6 +53,7 @@ namespace {
static const char SEARCHITEM_COMMAND[] = "SearchItem.Command";
static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward";
+static const char SEARCHITEM_SEARCHFORMATTED[] = "SearchItem.SearchFormatted";
static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags";
static const char SEARCHITEM_TRANSLITERATEFLAGS[] = "SearchItem.TransliterateFlags";
static const char SEARCHITEM_ALGORITHMTYPE[] = "SearchItem.AlgorithmType";
@@ -63,6 +64,7 @@ static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch";
static const char COMMAND_UPSEARCH[] = ".uno:UpSearch";
static const char COMMAND_EXITSEARCH[] = ".uno:ExitSearch";
static const char COMMAND_MATCHCASE[] = ".uno:MatchCase";
+static const char COMMAND_SEARCHFORMATTED[] = ".uno:SearchFormattedDisplayString";
static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory";
static const sal_Int32 REMEMBER_SIZE = 10;
@@ -80,6 +82,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
OUString sFindText;
bool aMatchCase = false;
+ bool bSearchFormatted = false;
if ( pToolBox )
{
sal_uInt16 nItemCount = pToolBox->GetItemCount();
@@ -96,11 +99,16 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
if (pItemWin)
aMatchCase = pItemWin->IsChecked();
+ } else if ( sItemCommand == COMMAND_SEARCHFORMATTED )
+ {
+ CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
+ if (pItemWin)
+ bSearchFormatted = pItemWin->IsChecked();
}
}
}
- css::uno::Sequence< css::beans::PropertyValue > lArgs(6);
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(7);
lArgs[0].Name = SEARCHITEM_SEARCHSTRING;
lArgs[0].Value <<= sFindText;
lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
@@ -119,6 +127,8 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND );
lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE;
lArgs[5].Value <<= (sal_Int16)0; // 0 == SearchAlgorithms_ABSOLUTE
+ lArgs[6].Name = SEARCHITEM_SEARCHFORMATTED;
+ lArgs[6].Value <<= bSearchFormatted;
css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
if ( xDispatchProvider.is() )
@@ -699,6 +709,100 @@ void SAL_CALL MatchCaseToolboxController::statusChanged( const css::frame::Featu
{
}
+SearchFormattedToolboxController::SearchFormattedToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
+ : svt::ToolboxController( rxContext,
+ css::uno::Reference< css::frame::XFrame >(),
+ OUString(COMMAND_SEARCHFORMATTED) )
+ , m_pSearchFormattedControl(NULL)
+{
+}
+
+SearchFormattedToolboxController::~SearchFormattedToolboxController()
+{
+}
+
+// XInterface
+css::uno::Any SAL_CALL SearchFormattedToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException, std::exception )
+{
+ css::uno::Any a = ToolboxController::queryInterface( aType );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
+}
+
+void SAL_CALL SearchFormattedToolboxController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL SearchFormattedToolboxController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+OUString SAL_CALL SearchFormattedToolboxController::getImplementationName() throw( css::uno::RuntimeException, std::exception )
+{
+ return OUString( "com.sun.star.svx.SearchFormattedToolboxController" );
+}
+
+sal_Bool SAL_CALL SearchFormattedToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException, std::exception )
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence< OUString > SAL_CALL SearchFormattedToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception )
+{
+ css::uno::Sequence< OUString > aSNS( 1 );
+ aSNS[0] = "com.sun.star.frame.ToolbarController";
+ return aSNS;
+}
+
+// XComponent
+void SAL_CALL SearchFormattedToolboxController::dispose() throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aSolarMutexGuard;
+
+ SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+
+ svt::ToolboxController::dispose();
+
+ m_pSearchFormattedControl.disposeAndClear();
+}
+
+// XInitialization
+void SAL_CALL SearchFormattedToolboxController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception)
+{
+ svt::ToolboxController::initialize(aArguments);
+
+ SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+}
+
+css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception )
+{
+ css::uno::Reference< css::awt::XWindow > xItemWindow;
+
+ css::uno::Reference< css::awt::XWindow > xParent( Parent );
+ vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ if ( pParent )
+ {
+ ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
+ m_pSearchFormattedControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
+ m_pSearchFormattedControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_SEARCHFORMATTED ) );
+ Size aSize( m_pSearchFormattedControl->GetOptimalSize() );
+ m_pSearchFormattedControl->SetSizePixel( aSize );
+ }
+ xItemWindow = VCLUnoHelper::GetInterface( m_pSearchFormattedControl );
+
+ return xItemWindow;
+}
+
+// XStatusListener
+void SAL_CALL SearchFormattedToolboxController::statusChanged( const css::frame::FeatureStateEvent& ) throw ( css::uno::RuntimeException, std::exception )
+{
+}
+
FindAllToolboxController::FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext )
: svt::ToolboxController( rxContext,
css::uno::Reference< css::frame::XFrame >(),
@@ -1145,6 +1249,14 @@ com_sun_star_svx_MatchCaseToolboxController_get_implementation(
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_svx_SearchFormattedToolboxController_get_implementation(
+ css::uno::XComponentContext *context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new SearchFormattedToolboxController(context));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_svx_FindAllToolboxController_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.src b/svx/source/tbxctrls/tbunosearchcontrollers.src
index d3b89201994c..e722d649d602 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.src
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.src
@@ -29,4 +29,9 @@ String RID_SVXSTR_FINDBAR_MATCHCASE
Text [ en-US ] = "Match Case" ;
};
+String RID_SVXSTR_FINDBAR_SEARCHFORMATTED
+{
+ Text [ en-US ] = "Search Formatted Display String" ;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/findreplacedialog.ui b/svx/uiconfig/ui/findreplacedialog.ui
index 49305d5da51a..aa25614eb5fe 100644
--- a/svx/uiconfig/ui/findreplacedialog.ui
+++ b/svx/uiconfig/ui/findreplacedialog.ui
@@ -921,6 +921,21 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="searchformatted">
+ <property name="label" translatable="yes">Search formatted display string</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -955,7 +970,7 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
diff --git a/svx/util/svx.component b/svx/util/svx.component
index 967677befed0..0cff72e9b423 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -56,6 +56,10 @@
constructor="com_sun_star_svx_MatchCaseToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="com.sun.star.svx.SearchFormattedToolboxController"
+ constructor="com_sun_star_svx_SearchFormattedToolboxController_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
<implementation name="com.sun.star.svx.FindAllToolboxController"
constructor="com_sun_star_svx_FindAllToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>