include/svx/txencbox.hxx                            |    3 
 sc/inc/pch/precompiled_sc.hxx                       |    7 
 sc/inc/pch/precompiled_scfilt.hxx                   |   17 
 sc/inc/pch/precompiled_scui.hxx                     |    5 
 sc/inc/pch/precompiled_vbaobj.hxx                   |   64 --
 sc/inc/scabstdlg.hxx                                |    2 
 sc/qa/unit/screenshots/screenshots.cxx              |    2 
 sc/source/ui/Accessibility/AccessibleCsvControl.cxx |  304 ++++----------
 sc/source/ui/attrdlg/scdlgfact.cxx                  |   28 -
 sc/source/ui/attrdlg/scdlgfact.hxx                  |   14 
 sc/source/ui/dbgui/csvcontrol.cxx                   |   34 -
 sc/source/ui/dbgui/csvgrid.cxx                      |  197 +++++----
 sc/source/ui/dbgui/csvruler.cxx                     |  115 ++---
 sc/source/ui/dbgui/csvtablebox.cxx                  |  316 ++++++--------
 sc/source/ui/dbgui/scuiasciiopt.cxx                 |  429 ++++++++------------
 sc/source/ui/inc/AccessibleCsvControl.hxx           |  147 ++----
 sc/source/ui/inc/csvcontrol.hxx                     |   27 -
 sc/source/ui/inc/csvgrid.hxx                        |   36 -
 sc/source/ui/inc/csvruler.hxx                       |   35 -
 sc/source/ui/inc/csvtablebox.hxx                    |   64 +-
 sc/source/ui/inc/scuiasciiopt.hxx                   |   90 ++--
 sc/source/ui/unoobj/filtuno.cxx                     |    3 
 sc/source/ui/view/cellsh2.cxx                       |    2 
 sc/source/ui/view/viewfun5.cxx                      |    2 
 sc/uiconfig/scalc/ui/textimportcsv.ui               |   73 +++
 solenv/sanitizers/ui/modules/scalc.suppr            |    1 
 26 files changed, 901 insertions(+), 1116 deletions(-)

New commits:
commit 1e97ca02773e2ba968606eed61d25d88f0d7e417
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Oct 14 11:05:07 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Oct 17 13:38:03 2019 +0200

    weld ScImportAsciiDlg
    
    notably the csv control is always LTR even in RTL mode, but the surrounding
    ScrollingWindow follows the environment direction, except the horizontal
    scrolling widget itself must LTR scroll.
    
    Change-Id: I72ee2b9dade73a11bcc4391e755fdb02886a884d
    Reviewed-on: https://gerrit.libreoffice.org/80765
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
index 2ed7ffa6bad9..9745dc3f84e2 100644
--- a/include/svx/txencbox.hxx
+++ b/include/svx/txencbox.hxx
@@ -132,7 +132,10 @@ public:
     rtl_TextEncoding    GetSelectTextEncoding() const;
 
     void connect_changed(const Link<weld::ComboBox&, void>& rLink) { 
m_xControl->connect_changed(rLink); }
+    void set_sensitive(bool bSensitive) { 
m_xControl->set_sensitive(bSensitive); }
     void grab_focus() { m_xControl->grab_focus(); }
+    int get_active() const { return m_xControl->get_active(); }
+    void set_active(int nActive) { m_xControl->set_active(nActive); }
     void show() { m_xControl->show(); }
     void hide() { m_xControl->hide(); }
 };
diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index 747ed1b57eb4..902e2929f5c7 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2019-09-25 10:58:26 using:
+ Generated on 2019-10-15 16:58:12 using:
  ./bin/update_pch sc sc --cutoff=12 --exclude:system --include:module 
--include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -52,6 +52,7 @@
 #include <boost/optional.hpp>
 #include <boost/optional/optional.hpp>
 #include <boost/property_tree/json_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
 #endif // PCH_LEVEL >= 1
 #if PCH_LEVEL >= 2
 #include <osl/conditn.hxx>
@@ -67,7 +68,6 @@
 #include <osl/mutex.hxx>
 #include <osl/security.h>
 #include <osl/security.hxx>
-#include <osl/thread.h>
 #include <osl/time.h>
 #include <rtl/alloc.h>
 #include <rtl/bootstrap.hxx>
@@ -102,7 +102,6 @@
 #include <vcl/IDialogRenderable.hxx>
 #include <vcl/NotebookBarAddonsMerger.hxx>
 #include <vcl/Scanline.hxx>
-#include <vcl/abstdlg.hxx>
 #include <vcl/alpha.hxx>
 #include <vcl/animate/Animation.hxx>
 #include <vcl/animate/AnimationBitmap.hxx>
@@ -111,7 +110,6 @@
 #include <vcl/builder.hxx>
 #include <vcl/checksum.hxx>
 #include <vcl/ctrl.hxx>
-#include <vcl/dialog.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/dndhelp.hxx>
 #include <vcl/edit.hxx>
@@ -399,7 +397,6 @@
 #include <tools/fontenum.hxx>
 #include <tools/fract.hxx>
 #include <tools/gen.hxx>
-#include <tools/globname.hxx>
 #include <tools/helpers.hxx>
 #include <tools/link.hxx>
 #include <tools/mapunit.hxx>
diff --git a/sc/inc/pch/precompiled_scfilt.hxx 
b/sc/inc/pch/precompiled_scfilt.hxx
index 239ad1710773..e10d8f8e087b 100644
--- a/sc/inc/pch/precompiled_scfilt.hxx
+++ b/sc/inc/pch/precompiled_scfilt.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2019-05-12 16:57:02 using:
+ Generated on 2019-10-15 16:57:59 using:
  ./bin/update_pch sc scfilt --cutoff=4 --exclude:system --exclude:module 
--include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -25,8 +25,6 @@
 #include <cassert>
 #include <cstddef>
 #include <cstring>
-#include <deque>
-#include <exception>
 #include <functional>
 #include <iomanip>
 #include <limits.h>
@@ -46,11 +44,14 @@
 #include <utility>
 #include <vector>
 #include <boost/optional.hpp>
+#include <boost/property_tree/ptree.hpp>
 #endif // PCH_LEVEL >= 1
 #if PCH_LEVEL >= 2
 #include <osl/diagnose.h>
 #include <osl/endian.h>
+#include <osl/file.hxx>
 #include <osl/interlck.h>
+#include <osl/mutex.h>
 #include <osl/mutex.hxx>
 #include <osl/thread.h>
 #include <rtl/alloc.h>
@@ -74,6 +75,7 @@
 #include <sal/log.hxx>
 #include <sal/macros.h>
 #include <sal/mathconf.h>
+#include <sal/saldllapi.h>
 #include <sal/types.h>
 #include <vcl/GraphicExternalLink.hxx>
 #include <vcl/GraphicObject.hxx>
@@ -82,11 +84,9 @@
 #include <vcl/checksum.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/errcode.hxx>
-#include <vcl/field.hxx>
 #include <vcl/font.hxx>
 #include <vcl/gfxlink.hxx>
 #include <vcl/graph.hxx>
-#include <vcl/idle.hxx>
 #include <vcl/mapmod.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/svapp.hxx>
@@ -123,13 +123,11 @@
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/Sequence.h>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Type.h>
 #include <com/sun/star/uno/genfunc.hxx>
 #include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/xml/sax/SAXException.hpp>
 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
 #include <com/sun/star/xml/sax/XFastContextHandler.hpp>
 #include <comphelper/comphelperdllapi.h>
@@ -196,6 +194,7 @@
 #include <svl/listener.hxx>
 #include <svl/lstner.hxx>
 #include <svl/poolitem.hxx>
+#include <svl/sharedstring.hxx>
 #include <svl/sharedstringpool.hxx>
 #include <svl/stritem.hxx>
 #include <svl/style.hxx>
@@ -214,15 +213,12 @@
 #include <svx/svdorect.hxx>
 #include <svx/svdotext.hxx>
 #include <svx/svdpage.hxx>
-#include <svx/svdpagv.hxx>
 #include <svx/svdtext.hxx>
 #include <svx/svdtrans.hxx>
 #include <svx/svdtypes.hxx>
 #include <svx/svxdllapi.h>
 #include <svx/unoapi.hxx>
-#include <svx/xenum.hxx>
 #include <svx/xit.hxx>
-#include <svx/xtextit0.hxx>
 #include <tools/color.hxx>
 #include <tools/date.hxx>
 #include <tools/datetime.hxx>
@@ -269,6 +265,7 @@
 #include <global.hxx>
 #include <patattr.hxx>
 #include <postit.hxx>
+#include <queryparam.hxx>
 #include <rangelst.hxx>
 #include <rangenam.hxx>
 #include <scdllapi.h>
diff --git a/sc/inc/pch/precompiled_scui.hxx b/sc/inc/pch/precompiled_scui.hxx
index 6bbfa3803c5c..61dee39e0410 100644
--- a/sc/inc/pch/precompiled_scui.hxx
+++ b/sc/inc/pch/precompiled_scui.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2019-10-02 19:35:59 using:
+ Generated on 2019-10-15 16:58:12 using:
  ./bin/update_pch sc scui --cutoff=1 --exclude:system --exclude:module 
--include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -40,12 +40,10 @@
 #include <vcl/event.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/layout.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/ptrstyle.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/waitobj.hxx>
 #include <vcl/weld.hxx>
 #endif // PCH_LEVEL >= 2
 #if PCH_LEVEL >= 3
@@ -105,6 +103,7 @@
 #include <svx/txencbox.hxx>
 #include <tools/color.hxx>
 #include <tools/fldunit.hxx>
+#include <tools/lineend.hxx>
 #include <unotools/collatorwrapper.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/transliterationwrapper.hxx>
diff --git a/sc/inc/pch/precompiled_vbaobj.hxx 
b/sc/inc/pch/precompiled_vbaobj.hxx
index 51177730850b..e1f51bb7a5db 100644
--- a/sc/inc/pch/precompiled_vbaobj.hxx
+++ b/sc/inc/pch/precompiled_vbaobj.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2019-04-29 21:16:41 using:
+ Generated on 2019-10-15 16:58:13 using:
  ./bin/update_pch sc vbaobj --cutoff=1 --exclude:system --exclude:module 
--include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -26,14 +26,12 @@
 #include <memory>
 #include <unordered_map>
 #include <vector>
-#include <boost/optional.hpp>
 #endif // PCH_LEVEL >= 1
 #if PCH_LEVEL >= 2
 #include <osl/file.hxx>
 #include <rtl/instance.hxx>
 #include <rtl/math.hxx>
 #include <rtl/ref.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <sal/config.h>
 #include <sal/log.hxx>
 #include <sal/macros.h>
@@ -46,34 +44,20 @@
 #include <basic/basmgr.hxx>
 #include <basic/sberrors.hxx>
 #include <basic/sbmeth.hxx>
-#include <basic/sbmod.hxx>
 #include <basic/sbstar.hxx>
 #include <basic/sbuno.hxx>
 #include <basic/sbx.hxx>
 #include <basic/sbxobj.hxx>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
 #include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/awt/TextAlign.hpp>
 #include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 #include <com/sun/star/awt/XTopWindowListener.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
 #include <com/sun/star/awt/XWindowListener.hpp>
-#include <com/sun/star/beans/MethodConcept.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/PropertyVetoException.hpp>
-#include <com/sun/star/beans/XIntrospection.hpp>
 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
-#include <com/sun/star/beans/XProperty.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/bridge/oleautomation/Date.hpp>
-#include <com/sun/star/chart/ChartDataCaption.hpp>
 #include <com/sun/star/chart/ChartDataRowSource.hpp>
 #include <com/sun/star/chart/ChartSolidType.hpp>
 #include <com/sun/star/chart/ChartSymbolType.hpp>
@@ -91,7 +75,6 @@
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
 #include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/drawing/TextFitToSizeType.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
@@ -106,15 +89,11 @@
 #include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-#include <com/sun/star/reflection/XIdlMethod.hpp>
 #include <com/sun/star/script/ArrayWrapper.hpp>
 #include <com/sun/star/script/BasicErrorException.hpp>
 #include <com/sun/star/script/ModuleInfo.hpp>
@@ -130,10 +109,8 @@
 #include <com/sun/star/sheet/FilterConnection.hpp>
 #include <com/sun/star/sheet/FilterOperator2.hpp>
 #include <com/sun/star/sheet/FormulaResult.hpp>
-#include <com/sun/star/sheet/FunctionArgument.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
 #include <com/sun/star/sheet/GlobalSheetSettings.hpp>
-#include <com/sun/star/sheet/TableFilterField.hpp>
 #include <com/sun/star/sheet/TableFilterField2.hpp>
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/ValidationType.hpp>
@@ -141,7 +118,6 @@
 #include <com/sun/star/sheet/XCalculatable.hpp>
 #include <com/sun/star/sheet/XCellAddressable.hpp>
 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XCellRangeData.hpp>
 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
 #include <com/sun/star/sheet/XCellRangesQuery.hpp>
@@ -166,11 +142,9 @@
 #include <com/sun/star/sheet/XSheetCondition.hpp>
 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
 #include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
-#include <com/sun/star/sheet/XSheetFilterable.hpp>
 #include <com/sun/star/sheet/XSheetOperation.hpp>
 #include <com/sun/star/sheet/XSheetOutline.hpp>
 #include <com/sun/star/sheet/XSheetPageBreak.hpp>
-#include <com/sun/star/sheet/XSheetPastable.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
@@ -179,6 +153,8 @@
 #include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
 #include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
 #include <com/sun/star/sheet/XUsedAreaCursor.hpp>
+#include <com/sun/star/sheet/XViewFreezable.hpp>
+#include <com/sun/star/sheet/XViewSplitable.hpp>
 #include <com/sun/star/style/VerticalAlignment.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/CellAddress.hpp>
@@ -190,7 +166,6 @@
 #include <com/sun/star/table/TableBorder.hpp>
 #include <com/sun/star/table/TableSortField.hpp>
 #include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/table/XCellCursor.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 #include <com/sun/star/table/XColumnRowRange.hpp>
 #include <com/sun/star/table/XTableChart.hpp>
@@ -202,6 +177,7 @@
 #include <com/sun/star/text/WritingMode.hpp>
 #include <com/sun/star/text/XSimpleText.hpp>
 #include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
 #include <com/sun/star/text/XTextRange.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
@@ -215,42 +191,32 @@
 #include <com/sun/star/util/TriState.hpp>
 #include <com/sun/star/util/XChangesListener.hpp>
 #include <com/sun/star/util/XChangesNotifier.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
 #include <com/sun/star/util/XMergeable.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 #include <com/sun/star/util/XNumberFormats.hpp>
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
 #include <com/sun/star/util/XProtectable.hpp>
 #include <com/sun/star/util/XReplaceable.hpp>
 #include <com/sun/star/util/XSortable.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/view/DocumentZoomType.hpp>
-#include <com/sun/star/view/XControlAccess.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <com/sun/star/xml/AttributeData.hpp>
+#include <comphelper/documentinfo.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/servicedecl.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
-#include <cppuhelper/bootstrap.hxx>
-#include <cppuhelper/component_context.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/implbase.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/queryinterface.hxx>
 #include <editeng/eeitem.hxx>
 #include <filter/msfilter/msvbahelper.hxx>
 #include <filter/msfilter/util.hxx>
-#include <i18nutil/paper.hxx>
 #include <o3tl/any.hxx>
 #include <ooo/vba/XCommandBarControls.hpp>
 #include <ooo/vba/XCommandBars.hpp>
 #include <ooo/vba/XControlProvider.hpp>
-#include <ooo/vba/XExecutableDialog.hpp>
 #include <ooo/vba/excel/Constants.hpp>
-#include <ooo/vba/excel/Range.hpp>
 #include <ooo/vba/excel/XApplication.hpp>
 #include <ooo/vba/excel/XApplicationOutgoing.hpp>
 #include <ooo/vba/excel/XAxis.hpp>
@@ -261,7 +227,6 @@
 #include <ooo/vba/excel/XPivotTable.hpp>
 #include <ooo/vba/excel/XRange.hpp>
 #include <ooo/vba/excel/XStyle.hpp>
-#include <ooo/vba/excel/XWorkbook.hpp>
 #include <ooo/vba/excel/XWorksheet.hpp>
 #include <ooo/vba/excel/XlAutoFillType.hpp>
 #include <ooo/vba/excel/XlAutoFilterOperator.hpp>
@@ -275,7 +240,6 @@
 #include <ooo/vba/excel/XlChartType.hpp>
 #include <ooo/vba/excel/XlColorIndex.hpp>
 #include <ooo/vba/excel/XlConsolidationFunction.hpp>
-#include <ooo/vba/excel/XlCreator.hpp>
 #include <ooo/vba/excel/XlDVAlertStyle.hpp>
 #include <ooo/vba/excel/XlDVType.hpp>
 #include <ooo/vba/excel/XlDeleteShiftDirection.hpp>
@@ -294,6 +258,7 @@
 #include <ooo/vba/excel/XlOrientation.hpp>
 #include <ooo/vba/excel/XlPageBreak.hpp>
 #include <ooo/vba/excel/XlPageOrientation.hpp>
+#include <ooo/vba/excel/XlPaperSize.hpp>
 #include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
 #include <ooo/vba/excel/XlPasteType.hpp>
 #include <ooo/vba/excel/XlPattern.hpp>
@@ -310,8 +275,6 @@
 #include <ooo/vba/excel/XlSortOrder.hpp>
 #include <ooo/vba/excel/XlSortOrientation.hpp>
 #include <ooo/vba/excel/XlSpecialCellsValue.hpp>
-#include <ooo/vba/excel/XlTextParsingType.hpp>
-#include <ooo/vba/excel/XlTextQualifier.hpp>
 #include <ooo/vba/excel/XlUnderlineStyle.hpp>
 #include <ooo/vba/excel/XlVAlign.hpp>
 #include <ooo/vba/excel/XlWindowState.hpp>
@@ -329,19 +292,9 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sfxdlg.hxx>
 #include <sfx2/viewfrm.hxx>
-#include <svl/eitem.hxx>
 #include <svl/itemset.hxx>
 #include <svl/srchitem.hxx>
-#include <svtools/bindablecontrolhelper.hxx>
-#include <svtools/helpopt.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdouno.hxx>
-#include <svx/svdpage.hxx>
-#include <svx/unoshape.hxx>
-#include <svx/xtable.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/urlobj.hxx>
@@ -359,24 +312,21 @@
 #include <columnspanset.hxx>
 #include <compiler.hxx>
 #include <convuno.hxx>
-#include <defaultsoptions.hxx>
 #include <docoptio.hxx>
 #include <document.hxx>
 #include <docuno.hxx>
-#include <drwlayer.hxx>
 #include <global.hxx>
 #include <macromgr.hxx>
 #include <markdata.hxx>
-#include <miscuno.hxx>
 #include <nameuno.hxx>
 #include <olinetab.hxx>
 #include <patattr.hxx>
 #include <queryentry.hxx>
+#include <queryparam.hxx>
 #include <rangelst.hxx>
 #include <rangenam.hxx>
 #include <scabstdlg.hxx>
 #include <scdll.hxx>
-#include <scextopt.hxx>
 #include <scitems.hxx>
 #include <scmod.hxx>
 #include <sortparam.hxx>
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 02cf139e4e34..16690afefcc0 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -393,7 +393,7 @@ class ScAbstractDialogFactory
 public:
     SC_DLLPUBLIC static ScAbstractDialogFactory*    Create();
 
-    virtual     VclPtr<AbstractScImportAsciiDlg> 
CreateScImportAsciiDlg(vcl::Window* pParent,
+    virtual     VclPtr<AbstractScImportAsciiDlg> 
CreateScImportAsciiDlg(weld::Window* pParent,
                                                                     const 
OUString& aDatName,
                                                                     SvStream* 
pInStream,
                                                                     
ScImportAsciiCall eCall) = 0;
diff --git a/sc/qa/unit/screenshots/screenshots.cxx 
b/sc/qa/unit/screenshots/screenshots.cxx
index 418b5655afbb..632466e828f1 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -230,7 +230,7 @@ VclPtr<VclAbstractDialog> 
ScScreenshotTest::createDialogByID(sal_uInt32 nID)
 
         case 13: // "modules/scalc/ui/textimportcsv.ui"
         {
-            pReturnDialog = mpFact->CreateScImportAsciiDlg(nullptr, 
OUString(), mpStream.get(), SC_PASTETEXT);
+            pReturnDialog = 
mpFact->CreateScImportAsciiDlg(mpViewShell->GetFrameWeld(), OUString(), 
mpStream.get(), SC_PASTETEXT);
             break;
         }
         case 14: // "modules/scalc/ui/formatcellsdialog.ui"
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx 
b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index 0bced19306e1..baf18888cbbf 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -23,7 +23,6 @@
 #include <utility>
 
 #include <AccessibleCsvControl.hxx>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -38,6 +37,7 @@
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/langitem.hxx>
+#include <csvtablebox.hxx>
 #include <csvcontrol.hxx>
 #include <csvruler.hxx>
 #include <csvgrid.hxx>
@@ -64,39 +64,27 @@ using ::com::sun::star::lang::IllegalArgumentException;
 using ::com::sun::star::beans::PropertyValue;
 using namespace ::com::sun::star::accessibility;
 
-const sal_uInt16 nRulerRole         = AccessibleRole::TEXT;
-const sal_uInt16 nGridRole          = AccessibleRole::TABLE;
-const sal_uInt16 nCellRole          = AccessibleRole::TEXT;
-
-#define RULER_IMPL_NAME             "ScAccessibleCsvRuler"
-#define GRID_IMPL_NAME              "ScAccessibleCsvGrid"
-#define CELL_IMPL_NAME              "ScAccessibleCsvCell"
-
 const sal_Unicode cRulerDot         = '.';
 const sal_Unicode cRulerLine        = '|';
 
 const sal_Int32 CSV_LINE_HEADER     = CSV_POS_INVALID;
 const sal_uInt32 CSV_COLUMN_HEADER  = CSV_COLUMN_INVALID;
 
-ScAccessibleCsvControl::ScAccessibleCsvControl(
-        const Reference< XAccessible >& rxParent,
-        ScCsvControl& rControl,
-        sal_uInt16 nRole ) :
-    ScAccessibleContextBase( rxParent, nRole ),
-    mpControl( &rControl )
+ScAccessibleCsvControl::ScAccessibleCsvControl(ScCsvControl& rControl)
+    : mpControl(&rControl)
 {
 }
 
 ScAccessibleCsvControl::~ScAccessibleCsvControl()
 {
-    implDispose();
+    ensureDisposed();
 }
 
 void SAL_CALL ScAccessibleCsvControl::disposing()
 {
     SolarMutexGuard aGuard;
     mpControl = nullptr;
-    ScAccessibleContextBase::disposing();
+    comphelper::OAccessibleComponentHelper::disposing();
 }
 
 // XAccessibleComponent -------------------------------------------------------
@@ -107,20 +95,6 @@ Reference< XAccessible > SAL_CALL 
ScAccessibleCsvControl::getAccessibleAtPoint(
     return nullptr;
 }
 
-bool ScAccessibleCsvControl::isVisible()
-{
-    SolarMutexGuard aGuard;
-    ensureAlive();
-    return implGetControl().IsVisible();
-}
-
-bool ScAccessibleCsvControl::isShowing()
-{
-    SolarMutexGuard aGuard;
-    ensureAlive();
-    return implGetControl().IsReallyVisible();
-}
-
 void SAL_CALL ScAccessibleCsvControl::grabFocus()
 {
     SolarMutexGuard aGuard;
@@ -132,10 +106,12 @@ void SAL_CALL ScAccessibleCsvControl::grabFocus()
 
 void ScAccessibleCsvControl::SendFocusEvent( bool bFocused )
 {
-    if( bFocused )
-        CommitFocusGained();
+    Any aOldAny, aNewAny;
+    if (bFocused)
+        aNewAny <<= AccessibleStateType::FOCUSED;
     else
-        CommitFocusLost();
+        aOldAny <<= AccessibleStateType::FOCUSED;
+    NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny);
 }
 
 void ScAccessibleCsvControl::SendCaretEvent()
@@ -145,18 +121,12 @@ void ScAccessibleCsvControl::SendCaretEvent()
 
 void ScAccessibleCsvControl::SendVisibleEvent()
 {
-    AccessibleEventObject aEvent;
-    aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
-    aEvent.Source = Reference< XAccessible >( this );
-    CommitChange( aEvent );
+    NotifyAccessibleEvent(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), 
Any());
 }
 
 void ScAccessibleCsvControl::SendSelectionEvent()
 {
-    AccessibleEventObject aEvent;
-    aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-    aEvent.Source = Reference< XAccessible >( this );
-    CommitChange( aEvent );
+    NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, Any(), Any());
 }
 
 void ScAccessibleCsvControl::SendTableUpdateEvent( sal_uInt32 /* nFirstColumn 
*/, sal_uInt32 /* nLastColumn */, bool /* bAllRows */ )
@@ -176,24 +146,12 @@ void ScAccessibleCsvControl::SendRemoveColumnEvent( 
sal_uInt32 /* nFirstColumn *
 
 // helpers --------------------------------------------------------------------
 
-tools::Rectangle ScAccessibleCsvControl::GetBoundingBoxOnScreen() const
-{
-    SolarMutexGuard aGuard;
-    ensureAlive();
-    return implGetControl().GetWindowExtentsRelative( nullptr );
-}
-
-tools::Rectangle ScAccessibleCsvControl::GetBoundingBox() const
+css::awt::Rectangle ScAccessibleCsvControl::implGetBounds()
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return implGetControl().GetWindowExtentsRelative( 
implGetControl().GetAccessibleParentWindow() );
-}
-
-void ScAccessibleCsvControl::ensureAlive() const
-{
-    if( !implIsAlive() )
-        throw DisposedException();
+    Size aOutSize(implGetControl().GetOutputSizePixel());
+    return css::awt::Rectangle(0, 0, aOutSize.Width(), aOutSize.Height());
 }
 
 ScCsvControl& ScAccessibleCsvControl::implGetControl() const
@@ -202,46 +160,19 @@ ScCsvControl& ScAccessibleCsvControl::implGetControl() 
const
     return *mpControl;
 }
 
-Reference< XAccessible > ScAccessibleCsvControl::implGetChildByRole(
-        const Reference< XAccessible >& rxParentObj, sal_uInt16 nRole )
-{
-    Reference< XAccessible > xAccObj;
-    if( rxParentObj.is() )
-    {
-        Reference< XAccessibleContext > xParentCtxt = 
rxParentObj->getAccessibleContext();
-        if( xParentCtxt.is() )
-        {
-            sal_Int32 nCount = xParentCtxt->getAccessibleChildCount();
-            sal_Int32 nIndex = 0;
-            while( !xAccObj.is() && (nIndex < nCount) )
-            {
-                Reference< XAccessible > xCurrObj = 
xParentCtxt->getAccessibleChild( nIndex );
-                if( xCurrObj.is() )
-                {
-                    Reference< XAccessibleContext > xCurrCtxt = 
xCurrObj->getAccessibleContext();
-                    if( xCurrCtxt.is() && (xCurrCtxt->getAccessibleRole() == 
nRole) )
-                        xAccObj = xCurrObj;
-                }
-                ++nIndex;
-            }
-        }
-    }
-    return xAccObj;
-}
-
 AccessibleStateSetHelper* ScAccessibleCsvControl::implCreateStateSet()
 {
     SolarMutexGuard aGuard;
     AccessibleStateSetHelper* pStateSet = new AccessibleStateSetHelper();
-    if( implIsAlive() )
+    if (isAlive())
     {
         const ScCsvControl& rCtrl = implGetControl();
         pStateSet->AddState( AccessibleStateType::OPAQUE );
         if( rCtrl.IsEnabled() )
             pStateSet->AddState( AccessibleStateType::ENABLED );
-        if( isShowing() )
+        if( rCtrl.IsReallyVisible() )
             pStateSet->AddState( AccessibleStateType::SHOWING );
-        if( isVisible() )
+        if( rCtrl.IsVisible() )
             pStateSet->AddState( AccessibleStateType::VISIBLE );
     }
     else
@@ -249,21 +180,6 @@ AccessibleStateSetHelper* 
ScAccessibleCsvControl::implCreateStateSet()
     return pStateSet;
 }
 
-void ScAccessibleCsvControl::implDispose()
-{
-    if( implIsAlive() )
-    {
-        // prevent multiple call of dtor
-        osl_atomic_increment( &m_refCount );
-        dispose();
-    }
-}
-
-Point ScAccessibleCsvControl::implGetAbsPos( const Point& rPos ) const
-{
-    return rPos + implGetControl().GetWindowExtentsRelative( nullptr 
).TopLeft();
-}
-
 // Ruler ======================================================================
 
 /** Converts a ruler cursor position to API text index. */
@@ -332,15 +248,15 @@ static void lcl_FillFontAttributes( Sequence< 
PropertyValue >& rSeq, const vcl::
     lcl_FillProperty( rSeq[ nIndex++ ], "CharLocale",        aLangItem,   
MID_LANG_LOCALE );
 }
 
-ScAccessibleCsvRuler::ScAccessibleCsvRuler( ScCsvRuler& rRuler ) :
-    ScAccessibleCsvControl( 
rRuler.GetAccessibleParentWindow()->GetAccessible(), rRuler, nRulerRole )
+ScAccessibleCsvRuler::ScAccessibleCsvRuler(ScCsvRuler& rRuler)
+    : ScAccessibleCsvControl(rRuler)
 {
     constructStringBuffer();
 }
 
 ScAccessibleCsvRuler::~ScAccessibleCsvRuler()
 {
-    implDispose();
+    ensureDisposed();
 }
 
 // XAccessibleComponent -----------------------------------------------------
@@ -349,14 +265,14 @@ sal_Int32 SAL_CALL ScAccessibleCsvRuler::getForeground(  )
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return 
sal_Int32(implGetRuler().GetSettings().GetStyleSettings().GetLabelTextColor());
+    return 
sal_Int32(Application::GetSettings().GetStyleSettings().GetLabelTextColor());
 }
 
 sal_Int32 SAL_CALL ScAccessibleCsvRuler::getBackground(  )
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return 
sal_Int32(implGetRuler().GetSettings().GetStyleSettings().GetFaceColor());
+    return 
sal_Int32(Application::GetSettings().GetStyleSettings().GetFaceColor());
 }
 
 // XAccessibleContext ---------------------------------------------------------
@@ -378,13 +294,19 @@ Reference< XAccessibleRelationSet > SAL_CALL 
ScAccessibleCsvRuler::getAccessible
     SolarMutexGuard aGuard;
     ensureAlive();
     AccessibleRelationSetHelper* pRelationSet = new 
AccessibleRelationSetHelper();
-    Reference< XAccessible > xAccObj = implGetChildByRole( 
getAccessibleParent(), nGridRole );
+
+    ScCsvRuler& rRuler = implGetRuler();
+    ScCsvTableBox* pTableBox = rRuler.GetTableBox();
+    ScCsvGrid& rGrid = pTableBox->GetGrid();
+
+    css::uno::Reference<css::accessibility::XAccessible> 
xAccObj(static_cast<ScAccessibleCsvGrid*>(rGrid.GetAccessible()));
     if( xAccObj.is() )
     {
         Sequence< Reference< XInterface > > aSeq( 1 );
         aSeq[ 0 ] = xAccObj;
         pRelationSet->AddRelation( AccessibleRelation( 
AccessibleRelationType::CONTROLLER_FOR, aSeq ) );
     }
+
     return pRelationSet;
 }
 
@@ -392,7 +314,7 @@ Reference< XAccessibleStateSet > SAL_CALL 
ScAccessibleCsvRuler::getAccessibleSta
 {
     SolarMutexGuard aGuard;
     AccessibleStateSetHelper* pStateSet = implCreateStateSet();
-    if( implIsAlive() )
+    if( isAlive() )
     {
         pStateSet->AddState( AccessibleStateType::FOCUSABLE );
         pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
@@ -437,7 +359,7 @@ Sequence< PropertyValue > SAL_CALL 
ScAccessibleCsvRuler::getCharacterAttributes(
     ensureAlive();
     ensureValidIndexWithEnd( nIndex );
     Sequence< PropertyValue > aSeq;
-    lcl_FillFontAttributes( aSeq, implGetRuler().GetFont() );
+    lcl_FillFontAttributes( aSeq, 
implGetRuler().GetDrawingArea()->get_ref_device().GetFont() );
     return aSeq;
 }
 
@@ -448,7 +370,7 @@ css::awt::Rectangle SAL_CALL 
ScAccessibleCsvRuler::getCharacterBounds( sal_Int32
     ensureValidIndexWithEnd( nIndex );
     ScCsvRuler& rRuler = implGetRuler();
     Point aPos( rRuler.GetX( lcl_GetRulerPos( nIndex ) ) - 
rRuler.GetCharWidth() / 2, 0 );
-    css::awt::Rectangle aRect( aPos.X(), aPos.Y(), rRuler.GetCharWidth(), 
rRuler.GetSizePixel().Height() );
+    css::awt::Rectangle aRect( aPos.X(), aPos.Y(), rRuler.GetCharWidth(), 
rRuler.GetOutputSizePixel().Height() );
     // do not return rectangle out of window
     sal_Int32 nWidth = rRuler.GetOutputSizePixel().Width();
     if( aRect.X >= nWidth )
@@ -706,13 +628,6 @@ void SAL_CALL ScAccessibleCsvRuler::release() throw ()
     ScAccessibleCsvControl::release();
 }
 
-// XServiceInfo ---------------------------------------------------------------
-
-OUString SAL_CALL ScAccessibleCsvRuler::getImplementationName()
-{
-    return RULER_IMPL_NAME;
-}
-
 // XTypeProvider --------------------------------------------------------------
 
 Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvRuler::getTypes()
@@ -731,24 +646,22 @@ Sequence< sal_Int8 > SAL_CALL 
ScAccessibleCsvRuler::getImplementationId()
 void ScAccessibleCsvRuler::SendCaretEvent()
 {
     sal_Int32 nPos = implGetRuler().GetRulerCursorPos();
-    if( nPos != CSV_POS_INVALID )
+    if (nPos != CSV_POS_INVALID)
     {
-        AccessibleEventObject aEvent;
-        aEvent.EventId = AccessibleEventId::CARET_CHANGED;
-        aEvent.Source = Reference< XAccessible >( this );
-        aEvent.NewValue <<= nPos;
-        CommitChange( aEvent );
+        Any aOldValue, aNewValue;
+        aNewValue <<= nPos;
+        NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, 
aNewValue );
     }
 }
 
 // helpers --------------------------------------------------------------------
 
-OUString ScAccessibleCsvRuler::createAccessibleName()
+OUString SAL_CALL ScAccessibleCsvRuler::getAccessibleName()
 {
     return ScResId( STR_ACC_CSVRULER_NAME );
 }
 
-OUString ScAccessibleCsvRuler::createAccessibleDescription()
+OUString SAL_CALL ScAccessibleCsvRuler::getAccessibleDescription()
 {
     return ScResId( STR_ACC_CSVRULER_DESCR );
 }
@@ -824,6 +737,11 @@ sal_Int32 ScAccessibleCsvRuler::implGetLastEqualFormatted( 
sal_Int32 nApiPos )
     return nApiPos;
 }
 
+css::uno::Reference<css::accessibility::XAccessible> SAL_CALL 
ScAccessibleCsvRuler::getAccessibleParent()
+{
+    return implGetControl().GetDrawingArea()->get_accessible_parent();
+}
+
 // Grid =======================================================================
 
 /** Converts a grid columnm index to an API column index. */
@@ -838,14 +756,14 @@ static sal_uInt32 lcl_GetGridColumn( sal_Int32 nApiColumn 
)
     return (nApiColumn > 0) ? static_cast< sal_uInt32 >( nApiColumn - 1 ) : 
CSV_COLUMN_HEADER;
 }
 
-ScAccessibleCsvGrid::ScAccessibleCsvGrid( ScCsvGrid& rGrid ) :
-    ScAccessibleCsvControl( 
rGrid.GetAccessibleParentWindow()->GetAccessible(), rGrid, nGridRole )
+ScAccessibleCsvGrid::ScAccessibleCsvGrid(ScCsvGrid& rGrid)
+    : ScAccessibleCsvControl(rGrid)
 {
 }
 
 ScAccessibleCsvGrid::~ScAccessibleCsvGrid()
 {
-    implDispose();
+    ensureDisposed();
 }
 
 void ScAccessibleCsvGrid::disposing()
@@ -882,7 +800,7 @@ sal_Int32 SAL_CALL ScAccessibleCsvGrid::getForeground(  )
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return 
sal_Int32(implGetGrid().GetSettings().GetStyleSettings().GetButtonTextColor());
+    return 
sal_Int32(Application::GetSettings().GetStyleSettings().GetButtonTextColor());
 }
 
 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getBackground(  )
@@ -912,7 +830,7 @@ Reference<XAccessible> 
ScAccessibleCsvGrid::getAccessibleCell(sal_Int32 nRow, sa
         return Reference<XAccessible>(aI->second.get());
     }
     // key does not exist
-    rtl::Reference<ScAccessibleCsvControl> xNew = implCreateCellObj(nRow, 
nColumn);
+    rtl::Reference<ScAccessibleCsvCell> xNew = implCreateCellObj(nRow, 
nColumn);
     maAccessibleChildren.insert(aI, XAccessibleSet::value_type(nIndex, xNew));
     return Reference<XAccessible>(xNew.get());
 }
@@ -931,13 +849,22 @@ Reference< XAccessibleRelationSet > SAL_CALL 
ScAccessibleCsvGrid::getAccessibleR
     SolarMutexGuard aGuard;
     ensureAlive();
     AccessibleRelationSetHelper* pRelationSet = new 
AccessibleRelationSetHelper();
-    Reference< XAccessible > xAccObj = implGetChildByRole( 
getAccessibleParent(), nRulerRole );
-    if( xAccObj.is() )
+
+    ScCsvGrid& rGrid = implGetGrid();
+    ScCsvTableBox* pTableBox = rGrid.GetTableBox();
+    ScCsvRuler& rRuler = pTableBox->GetRuler();
+
+    if (rRuler.IsVisible())
     {
-        Sequence< Reference< XInterface > > aSeq( 1 );
-        aSeq[ 0 ] = xAccObj;
-        pRelationSet->AddRelation( AccessibleRelation( 
AccessibleRelationType::CONTROLLED_BY, aSeq ) );
+        css::uno::Reference<css::accessibility::XAccessible> 
xAccObj(static_cast<ScAccessibleCsvGrid*>(rRuler.GetAccessible()));
+        if( xAccObj.is() )
+        {
+            Sequence< Reference< XInterface > > aSeq( 1 );
+            aSeq[ 0 ] = xAccObj;
+            pRelationSet->AddRelation( AccessibleRelation( 
AccessibleRelationType::CONTROLLED_BY, aSeq ) );
+        }
     }
+
     return pRelationSet;
 }
 
@@ -945,7 +872,7 @@ Reference< XAccessibleStateSet > SAL_CALL 
ScAccessibleCsvGrid::getAccessibleStat
 {
     SolarMutexGuard aGuard;
     AccessibleStateSetHelper* pStateSet = implCreateStateSet();
-    if( implIsAlive() )
+    if( isAlive() )
     {
         pStateSet->AddState( AccessibleStateType::FOCUSABLE );
         pStateSet->AddState( AccessibleStateType::MULTI_SELECTABLE );
@@ -1189,13 +1116,6 @@ void SAL_CALL ScAccessibleCsvGrid::release() throw ()
     ScAccessibleCsvControl::release();
 }
 
-// XServiceInfo ---------------------------------------------------------------
-
-OUString SAL_CALL ScAccessibleCsvGrid::getImplementationName()
-{
-    return GRID_IMPL_NAME;
-}
-
 // XTypeProvider --------------------------------------------------------------
 
 Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvGrid::getTypes()
@@ -1216,12 +1136,10 @@ Sequence< sal_Int8 > SAL_CALL 
ScAccessibleCsvGrid::getImplementationId()
 void ScAccessibleCsvGrid::SendFocusEvent( bool bFocused )
 {
     ScAccessibleCsvControl::SendFocusEvent( bFocused );
-    AccessibleEventObject aEvent;
-    aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
-    aEvent.Source = Reference< XAccessible >( this );
-    (bFocused ? aEvent.NewValue : aEvent.OldValue) <<=
+    Any aOldAny, aNewAny;
+    (bFocused ? aNewAny : aOldAny) <<=
         getAccessibleCellAt( 0, lcl_GetApiColumn( 
implGetGrid().GetFocusColumn() ) );
-    CommitChange( aEvent );
+    NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 
aOldAny, aNewAny);
 }
 
 void ScAccessibleCsvGrid::SendTableUpdateEvent( sal_uInt32 nFirstColumn, 
sal_uInt32 nLastColumn, bool bAllRows )
@@ -1231,11 +1149,9 @@ void ScAccessibleCsvGrid::SendTableUpdateEvent( 
sal_uInt32 nFirstColumn, sal_uIn
         AccessibleTableModelChange aModelChange(
             AccessibleTableModelChangeType::UPDATE, 0, bAllRows ? 
implGetRowCount() - 1 : 0,
             lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) 
);
-        AccessibleEventObject aEvent;
-        aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
-        aEvent.Source = Reference< XAccessible >( this );
-        aEvent.NewValue <<= aModelChange;
-        CommitChange( aEvent );
+        Any aOldAny, aNewAny;
+        aNewAny <<= aModelChange;
+        NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, 
aNewAny);
     }
 }
 
@@ -1246,11 +1162,9 @@ void ScAccessibleCsvGrid::SendInsertColumnEvent( 
sal_uInt32 nFirstColumn, sal_uI
         AccessibleTableModelChange aModelChange(
             AccessibleTableModelChangeType::INSERT, 0, implGetRowCount() - 1,
             lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) 
);
-        AccessibleEventObject aEvent;
-        aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
-        aEvent.Source = Reference< XAccessible >( this );
-        aEvent.NewValue <<= aModelChange;
-        CommitChange( aEvent );
+        Any aOldAny, aNewAny;
+        aNewAny <<= aModelChange;
+        NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, 
aNewAny);
     }
 }
 
@@ -1261,22 +1175,20 @@ void ScAccessibleCsvGrid::SendRemoveColumnEvent( 
sal_uInt32 nFirstColumn, sal_uI
         AccessibleTableModelChange aModelChange(
             AccessibleTableModelChangeType::DELETE, 0, implGetRowCount() - 1,
             lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) 
);
-        AccessibleEventObject aEvent;
-        aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
-        aEvent.Source = Reference< XAccessible >( this );
-        aEvent.NewValue <<= aModelChange;
-        CommitChange( aEvent );
+        Any aOldAny, aNewAny;
+        aNewAny <<= aModelChange;
+        NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, 
aNewAny);
     }
 }
 
 // helpers --------------------------------------------------------------------
 
-OUString ScAccessibleCsvGrid::createAccessibleName()
+OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleName()
 {
     return ScResId( STR_ACC_CSVGRID_NAME );
 }
 
-OUString ScAccessibleCsvGrid::createAccessibleDescription()
+OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleDescription()
 {
     return ScResId( STR_ACC_CSVGRID_DESCR );
 }
@@ -1355,16 +1267,21 @@ OUString ScAccessibleCsvGrid::implGetCellText( 
sal_Int32 nRow, sal_Int32 nColumn
     return aCellStr;
 }
 
-ScAccessibleCsvControl* ScAccessibleCsvGrid::implCreateCellObj( sal_Int32 
nRow, sal_Int32 nColumn ) const
+ScAccessibleCsvCell* ScAccessibleCsvGrid::implCreateCellObj( sal_Int32 nRow, 
sal_Int32 nColumn )
 {
-    return new ScAccessibleCsvCell( implGetGrid(), implGetCellText( nRow, 
nColumn ), nRow, nColumn );
+    return new ScAccessibleCsvCell(implGetGrid(), implGetCellText(nRow, 
nColumn), nRow, nColumn);
+}
+
+css::uno::Reference<css::accessibility::XAccessible> SAL_CALL 
ScAccessibleCsvGrid::getAccessibleParent()
+{
+    return implGetControl().GetDrawingArea()->get_accessible_parent();
 }
 
 ScAccessibleCsvCell::ScAccessibleCsvCell(
         ScCsvGrid& rGrid,
         const OUString& rCellText,
         sal_Int32 nRow, sal_Int32 nColumn ) :
-    ScAccessibleCsvControl( rGrid.GetAccessible(), rGrid, nCellRole ),
+    ScAccessibleCsvControl( rGrid ),
     AccessibleStaticTextBase( SvxEditSourcePtr() ),
     maCellText( rCellText ),
     mnLine( nRow ? (nRow + rGrid.GetFirstVisLine() - 1) : CSV_LINE_HEADER ),
@@ -1399,7 +1316,7 @@ sal_Int32 SAL_CALL ScAccessibleCsvCell::getForeground(  )
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return 
sal_Int32(implGetGrid().GetSettings().GetStyleSettings().GetButtonTextColor());
+    return 
sal_Int32(Application::GetSettings().GetStyleSettings().GetButtonTextColor());
 }
 
 sal_Int32 SAL_CALL ScAccessibleCsvCell::getBackground(  )
@@ -1439,7 +1356,7 @@ Reference< XAccessibleStateSet > SAL_CALL 
ScAccessibleCsvCell::getAccessibleStat
 {
     SolarMutexGuard aGuard;
     AccessibleStateSetHelper* pStateSet = implCreateStateSet();
-    if( implIsAlive() )
+    if( isAlive() )
     {
         const ScCsvGrid& rGrid = implGetGrid();
         pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
@@ -1461,37 +1378,14 @@ IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCsvCell, 
ScAccessibleCsvControl, Acce
 
 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCsvCell, ScAccessibleCsvControl, 
AccessibleStaticTextBase )
 
-// XServiceInfo ---------------------------------------------------------------
-
-OUString SAL_CALL ScAccessibleCsvCell::getImplementationName()
-{
-    return CELL_IMPL_NAME;
-}
-
 // helpers --------------------------------------------------------------------
 
-tools::Rectangle ScAccessibleCsvCell::GetBoundingBoxOnScreen() const
-{
-    SolarMutexGuard aGuard;
-    ensureAlive();
-    tools::Rectangle aRect( implGetBoundingBox() );
-    aRect.SetPos( implGetAbsPos( aRect.TopLeft() ) );
-    return aRect;
-}
-
-tools::Rectangle ScAccessibleCsvCell::GetBoundingBox() const
-{
-    SolarMutexGuard aGuard;
-    ensureAlive();
-    return implGetBoundingBox();
-}
-
-OUString ScAccessibleCsvCell::createAccessibleName()
+OUString SAL_CALL ScAccessibleCsvCell::getAccessibleName()
 {
     return maCellText;
 }
 
-OUString ScAccessibleCsvCell::createAccessibleDescription()
+OUString SAL_CALL ScAccessibleCsvCell::getAccessibleDescription()
 {
     return OUString();
 }
@@ -1523,10 +1417,10 @@ Size ScAccessibleCsvCell::implGetRealSize() const
         (mnLine == CSV_LINE_HEADER) ? rGrid.GetHdrHeight() : 
rGrid.GetLineHeight() );
 }
 
-tools::Rectangle ScAccessibleCsvCell::implGetBoundingBox() const
+css::awt::Rectangle ScAccessibleCsvCell::implGetBounds()
 {
     ScCsvGrid& rGrid = implGetGrid();
-    tools::Rectangle aClipRect( Point( 0, 0 ), rGrid.GetSizePixel() );
+    tools::Rectangle aClipRect( Point( 0, 0 ), rGrid.GetOutputSizePixel() );
     if( mnColumn != CSV_COLUMN_HEADER )
     {
         aClipRect.SetLeft( rGrid.GetFirstX() );
@@ -1539,15 +1433,25 @@ tools::Rectangle 
ScAccessibleCsvCell::implGetBoundingBox() const
     aRect.Intersection( aClipRect );
     if( (aRect.GetWidth() <= 0) || (aRect.GetHeight() <= 0) )
         aRect.SetSize( Size( -1, -1 ) );
-    return aRect;
+
+    return css::awt::Rectangle(aRect.Left(), aRect.Top(), aRect.GetWidth(), 
aRect.GetHeight());
 }
 
 ::std::unique_ptr< SvxEditSource > ScAccessibleCsvCell::implCreateEditSource()
 {
     ScCsvGrid& rGrid = implGetGrid();
 
-    ::std::unique_ptr< SvxEditSource > pEditSource( new 
ScAccessibilityEditSource( std::make_unique<ScAccessibleCsvTextData>(&rGrid, 
rGrid.GetEditEngine(), maCellText, implGetRealSize()) ) );
+    ::std::unique_ptr< SvxEditSource > pEditSource( new 
ScAccessibilityEditSource( 
std::make_unique<ScAccessibleCsvTextData>(&rGrid.GetDrawingArea()->get_ref_device(),
 rGrid.GetEditEngine(), maCellText, implGetRealSize()) ) );
     return pEditSource;
 }
 
+css::uno::Reference<css::accessibility::XAccessible> SAL_CALL 
ScAccessibleCsvCell::getAccessibleParent()
+{
+    ScCsvGrid& rGrid = implGetGrid();
+
+    ScAccessibleCsvGrid* pAcc = 
static_cast<ScAccessibleCsvGrid*>(rGrid.GetAccessible());
+
+    return pAcc;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index caccf863349e..3c4b3ec9c92a 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -70,7 +70,10 @@
 #include <sfx2/sfxdlg.hxx>
 #include <conditio.hxx>
 
-IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl);
+short AbstractScImportAsciiDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 
 short AbstractScAutoFormatDlg_Impl::Execute()
 {
@@ -273,12 +276,24 @@ short AbstractScLinkedAreaDlg_Impl::Execute()
 
 void AbstractScImportAsciiDlg_Impl::GetOptions( ScAsciiOptions& rOpt )
 {
-    pDlg->GetOptions( rOpt );
+    m_xDlg->GetOptions( rOpt );
 }
 
 void AbstractScImportAsciiDlg_Impl::SaveParameters()
 {
-    pDlg->SaveParameters();
+    m_xDlg->SaveParameters();
+}
+
+BitmapEx AbstractScImportAsciiDlg_Impl::createScreenshot() const
+{
+    VclPtr<VirtualDevice> 
xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
+    m_xDlg->getDialog()->draw(*xDialogSurface);
+    return xDialogSurface->GetBitmapEx(Point(), 
xDialogSurface->GetOutputSizePixel());
+}
+
+OString AbstractScImportAsciiDlg_Impl::GetScreenshotId() const
+{
+    return m_xDlg->get_help_id();
 }
 
 sal_uInt16 AbstractScAutoFormatDlg_Impl::GetIndex() const
@@ -916,12 +931,11 @@ OString ScAbstractTabController_Impl::GetScreenshotId() 
const
 }
 
 // =========================Factories  for createdialog ===================
-VclPtr<AbstractScImportAsciiDlg> 
ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg ( vcl::Window* pParent,
+VclPtr<AbstractScImportAsciiDlg> 
ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg(weld::Window* pParent,
                                                     const OUString& aDatName,
-                                                    SvStream* pInStream, 
ScImportAsciiCall eCall )
+                                                    SvStream* pInStream, 
ScImportAsciiCall eCall)
 {
-    VclPtr<ScImportAsciiDlg> pDlg = VclPtr<ScImportAsciiDlg>::Create( pParent, 
aDatName,pInStream, eCall );
-    return VclPtr<AbstractScImportAsciiDlg_Impl>::Create( pDlg );
+    return 
VclPtr<AbstractScImportAsciiDlg_Impl>::Create(std::make_unique<ScImportAsciiDlg>(pParent,
 aDatName,pInStream, eCall));
 }
 
 VclPtr<AbstractScTextImportOptionsDlg> 
ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(weld::Window* 
pParent)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index 445bf57ff6a1..d6790a7f40a6 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -101,9 +101,19 @@ OString Class::GetScreenshotId() const              \
 
 class AbstractScImportAsciiDlg_Impl : public AbstractScImportAsciiDlg
 {
-    DECL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl, ScImportAsciiDlg)
+    std::unique_ptr<ScImportAsciiDlg> m_xDlg;
+public:
+    explicit AbstractScImportAsciiDlg_Impl(std::unique_ptr<ScImportAsciiDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
     virtual void                        GetOptions( ScAsciiOptions& rOpt ) 
override;
     virtual void                        SaveParameters() override;
+
+    // screenshotting
+    virtual BitmapEx createScreenshot() const override;
+    virtual OString GetScreenshotId() const override;
 };
 
 class AbstractScAutoFormatDlg_Impl : public AbstractScAutoFormatDlg
@@ -648,7 +658,7 @@ class ScAbstractDialogFactory_Impl : public 
ScAbstractDialogFactory
 public:
     virtual ~ScAbstractDialogFactory_Impl() {}
 
-    virtual VclPtr<AbstractScImportAsciiDlg> 
CreateScImportAsciiDlg(vcl::Window* pParent,
+    virtual VclPtr<AbstractScImportAsciiDlg> 
CreateScImportAsciiDlg(weld::Window* pParent,
                                                                     const 
OUString& aDatName,
                                                                     SvStream* 
pInStream,
                                                                     
ScImportAsciiCall eCall) override;
diff --git a/sc/source/ui/dbgui/csvcontrol.cxx 
b/sc/source/ui/dbgui/csvcontrol.cxx
index f30a5d181082..b5ec628e170c 100644
--- a/sc/source/ui/dbgui/csvcontrol.cxx
+++ b/sc/source/ui/dbgui/csvcontrol.cxx
@@ -19,7 +19,6 @@
 
 #include <csvcontrol.hxx>
 #include <vcl/settings.hxx>
-#include <AccessibleCsvControl.hxx>
 
 ScCsvLayoutData::ScCsvLayoutData() :
     mnPosCount( 1 ),
@@ -55,45 +54,30 @@ ScCsvDiff ScCsvLayoutData::GetDiff( const ScCsvLayoutData& 
rData ) const
     return nRet;
 }
 
-ScCsvControl::ScCsvControl( ScCsvControl& rParent ) :
-    VclReferenceBase(),
-    Control( &rParent, WB_TABSTOP | WB_NODIALOGCONTROL ),
-    mrData( rParent.GetLayoutData() ),
-    mbValidGfx( false )
-{
-}
-
-ScCsvControl::ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& 
rData, WinBits nBits ) :
-    Control( pParent, nBits ),
-    mrData( rData ),
-    mbValidGfx( false )
+ScCsvControl::ScCsvControl(const ScCsvLayoutData& rData)
+    : mrData(rData)
+    , mbValidGfx(false)
 {
 }
 
 ScCsvControl::~ScCsvControl()
 {
-    disposeOnce();
-}
-
-void ScCsvControl::dispose()
-{
     if( mxAccessible.is() )
         mxAccessible->dispose();
     mxAccessible = nullptr; // lp#1566050: prevent cyclic reference zombies
-    Control::dispose();
 }
 
 // event handling -------------------------------------------------------------
 
 void ScCsvControl::GetFocus()
 {
-    Control::GetFocus();
+    weld::CustomWidgetController::GetFocus();
     AccSendFocusEvent( true );
 }
 
 void ScCsvControl::LoseFocus()
 {
-    Control::LoseFocus();
+    weld::CustomWidgetController::LoseFocus();
     AccSendFocusEvent( false );
 }
 
@@ -295,12 +279,4 @@ ScMoveMode ScCsvControl::GetVertDirection( sal_uInt16 
nCode, bool bHomeEnd )
     return MOVE_NONE;
 }
 
-// accessibility --------------------------------------------------------------
-
-css::uno::Reference< css::accessibility::XAccessible > 
ScCsvControl::CreateAccessible()
-{
-    mxAccessible = ImplCreateAccessible().get();
-    return css::uno::Reference< css::accessibility::XAccessible 
>(mxAccessible.get());
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 458d8475b0ac..1275113c7f29 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <csvgrid.hxx>
+#include <csvtablebox.hxx>
 
 #include <algorithm>
 #include <memory>
@@ -35,6 +36,7 @@
 #include <vcl/commandevent.hxx>
 #include <vcl/event.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
 #include <vcl/virdev.hxx>
 
 #include <editeng/colritem.hxx>
@@ -63,46 +65,63 @@ struct Func_Select
         { rState.Select( mbSelect ); }
 };
 
-ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) :
-    ScCsvControl( rParent ),
-    mpBackgrDev( VclPtr<VirtualDevice>::Create() ),
-    mpGridDev( VclPtr<VirtualDevice>::Create() ),
-    mpPopup( VclPtr<PopupMenu>::Create() ),
-    mpColorConfig( nullptr ),
-    mpEditEngine( new ScEditEngineDefaulter( EditEngine::CreatePool(), true ) 
),
-    maHeaderFont( GetFont() ),
-    maColStates( 1 ),
-    maTypeNames( 1 ),
-    mnFirstImpLine( 0 ),
-    mnRecentSelCol( CSV_COLUMN_INVALID ),
-    mnMTCurrCol( SAL_MAX_UINT32 ),
-    mbMTSelecting( false )
+ScCsvGrid::ScCsvGrid(const ScCsvLayoutData& rData, std::unique_ptr<weld::Menu> 
xPopup, ScCsvTableBox* pTableBox)
+    : ScCsvControl(rData)
+    , mpTableBox(pTableBox)
+    , mpBackgrDev( VclPtr<VirtualDevice>::Create() )
+    , mpGridDev( VclPtr<VirtualDevice>::Create() )
+    , mxPopup(std::move(xPopup))
+    , mpColorConfig( nullptr )
+    , mpEditEngine( new ScEditEngineDefaulter( EditEngine::CreatePool(), true 
) )
+    , maColStates( 1 )
+    , maTypeNames( 1 )
+    , mnFirstImpLine( 0 )
+    , mnRecentSelCol( CSV_COLUMN_INVALID )
+    , mnMTCurrCol( SAL_MAX_UINT32 )
+    , mbTracking( false )
+    , mbMTSelecting( false )
 {
     mpEditEngine->SetRefDevice( mpBackgrDev.get() );
     mpEditEngine->SetRefMapMode( MapMode( MapUnit::MapPixel ) );
     maEdEngSize = mpEditEngine->GetPaperSize();
+}
+
+void ScCsvGrid::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+    OutputDevice& rRefDevice = pDrawingArea->get_ref_device();
+    maHeaderFont = Application::GetSettings().GetStyleSettings().GetAppFont();
+
+    // expand the point size of the desired font to the equivalent pixel size
+    if (vcl::Window* pDefaultDevice = 
dynamic_cast<vcl::Window*>(Application::GetDefaultDevice()))
+    {
+        pDefaultDevice->SetPointFont(rRefDevice, maHeaderFont);
+        maHeaderFont = rRefDevice.GetFont();
+    }
 
-    mpPopup->SetMenuFlags( mpPopup->GetMenuFlags() | 
MenuFlags::NoAutoMnemonics );
+    // Because this is an always LeftToRight layout widget the initial size of
+    // this widget needs to be smaller than the size of the parent scrolling
+    // window (ScCsvTableBox ctor) because in RTL mode the alignment is against
+    // the right edge of the parent, and if larger than the scrolling window
+    // the left edge will be lost. If this widget is smaller than the scrolling
+    // window it is stretched to fit the parent and the problem doesn't arise.
+    Size aInitialSize(10, 10);
+    ScCsvControl::SetDrawingArea(pDrawingArea);
+    pDrawingArea->set_size_request(aInitialSize.Width(), 
aInitialSize.Height());
+    SetOutputSizePixel(aInitialSize);
 
     EnableRTL( false ); // RTL
+
     InitFonts();
     ImplClearSplits();
 }
 
 ScCsvGrid::~ScCsvGrid()
 {
-    disposeOnce();
-}
-
-void ScCsvGrid::dispose()
-{
     OSL_ENSURE(mpColorConfig, "the object hasn't been initialized properly");
     if (mpColorConfig)
         mpColorConfig->RemoveListener(this);
-    mpPopup.disposeAndClear();
     mpBackgrDev.disposeAndClear();
     mpGridDev.disposeAndClear();
-    ScCsvControl::dispose();
 }
 
 void
@@ -119,11 +138,12 @@ ScCsvGrid::Init()
 void ScCsvGrid::UpdateLayoutData()
 {
     DisableRepaint();
-    SetFont( maMonoFont );
-    Execute( CSVCMD_SETCHARWIDTH, GetTextWidth( OUString( 'X' ) ) );
-    Execute( CSVCMD_SETLINEHEIGHT, GetTextHeight() + 1 );
-    SetFont( maHeaderFont );
-    Execute( CSVCMD_SETHDRHEIGHT, GetTextHeight() + 1 );
+    OutputDevice& rRefDevice = GetDrawingArea()->get_ref_device();
+    rRefDevice.SetFont(maMonoFont);
+    Execute(CSVCMD_SETCHARWIDTH, rRefDevice.GetTextWidth(OUString('X')));
+    Execute(CSVCMD_SETLINEHEIGHT, rRefDevice.GetTextHeight() + 1);
+    rRefDevice.SetFont(maHeaderFont);
+    Execute(CSVCMD_SETHDRHEIGHT, rRefDevice.GetTextHeight() + 1);
     UpdateOffsetX();
     EnableRepaint();
 }
@@ -134,7 +154,7 @@ void ScCsvGrid::UpdateOffsetX()
     sal_Int32 nDigits = 2;
     while( nLastLine /= 10 ) ++nDigits;
     nDigits = std::max( nDigits, sal_Int32( 3 ) );
-    Execute( CSVCMD_SETHDRWIDTH, GetTextWidth( OUString( '0' ) ) * nDigits );
+    Execute(CSVCMD_SETHDRWIDTH, 
GetDrawingArea()->get_approximate_digit_width() * nDigits);
 }
 
 void ScCsvGrid::ApplyLayout( const ScCsvLayoutData& rOldData )
@@ -220,7 +240,7 @@ void ScCsvGrid::InitColors()
     maAppBackColor = mpColorConfig->GetColorValue( ::svtools::APPBACKGROUND 
).nColor;
     maTextColor = mpColorConfig->GetColorValue( ::svtools::FONTCOLOR ).nColor;
 
-    const StyleSettings& rSett = GetSettings().GetStyleSettings();
+    const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
     maHeaderBackColor = rSett.GetFaceColor();
     maHeaderGridColor = rSett.GetDarkShadowColor();
     maHeaderTextColor = rSett.GetButtonTextColor();
@@ -280,7 +300,7 @@ void ScCsvGrid::InitFonts()
 
 void ScCsvGrid::InitSizeData()
 {
-    maWinSize = GetSizePixel();
+    maWinSize = GetOutputSizePixel();
     mpBackgrDev->SetOutputSizePixel( maWinSize );
     mpGridDev->SetOutputSizePixel( maWinSize );
     InvalidateGfx();
@@ -510,12 +530,10 @@ void ScCsvGrid::SetTypeNames( const 
std::vector<OUString>& rTypeNames )
     maTypeNames = rTypeNames;
     Repaint( true );
 
-    mpPopup->Clear();
+    mxPopup->clear();
     sal_uInt32 nCount = maTypeNames.size();
-    sal_uInt32 nIx;
-    sal_uInt16 nItemId;
-    for( nIx = 0, nItemId = 1; nIx < nCount; ++nIx, ++nItemId )
-        mpPopup->InsertItem( nItemId, maTypeNames[ nIx ] );
+    for (sal_uInt32 nIx = 0; nIx < nCount; ++nIx)
+        mxPopup->append(OUString::number(nIx), maTypeNames[nIx]);
 
     ::std::for_each( maColStates.begin(), maColStates.end(), Func_SetType( 
CSV_TYPE_DEFAULT ) );
 }
@@ -587,9 +605,9 @@ void ScCsvGrid::ScrollVertRel( ScMoveMode eDir )
 
 void ScCsvGrid::ExecutePopup( const Point& rPos )
 {
-    sal_uInt16 nItemId = mpPopup->Execute( this, rPos );
-    if( nItemId )   // 0 = cancelled
-        Execute( CSVCMD_SETCOLUMNTYPE, mpPopup->GetItemPos( nItemId ) );
+    OString sItemId = mxPopup->popup_at_rect(GetDrawingArea(), 
tools::Rectangle(rPos, Size(1, 1)));
+    if (!sItemId.isEmpty())   // empty = cancelled
+        Execute(CSVCMD_SETCOLUMNTYPE, sItemId.toInt32());
 }
 
 // selection handling ---------------------------------------------------------
@@ -724,7 +742,7 @@ void ScCsvGrid::DoSelectAction( sal_uInt32 nColIndex, 
sal_uInt16 nModifier )
         SelectRange( mnRecentSelCol, nColIndex );
     else if( !(nModifier & KEY_MOD1) )      // no SHIFT/CTRL always selects 1 
column
         Select( nColIndex );
-    else if( IsTracking() )                 // CTRL in tracking does not toggle
+    else if( mbTracking )                 // CTRL in tracking does not toggle
         Select( nColIndex, mbMTSelecting );
     else                                    // CTRL only toggles
         ToggleSelect( nColIndex );
@@ -838,6 +856,8 @@ const OUString& ScCsvGrid::GetCellText( sal_uInt32 
nColIndex, sal_Int32 nLine )
 
 void ScCsvGrid::Resize()
 {
+    mpTableBox->InitControls();
+
     ScCsvControl::Resize();
     InitSizeData();
     Execute( CSVCMD_UPDATECELLTEXTS );
@@ -856,7 +876,7 @@ void ScCsvGrid::LoseFocus()
     Repaint();
 }
 
-void ScCsvGrid::MouseButtonDown( const MouseEvent& rMEvt )
+bool ScCsvGrid::MouseButtonDown( const MouseEvent& rMEvt )
 {
     DisableRepaint();
     if( !HasFocus() )
@@ -877,35 +897,43 @@ void ScCsvGrid::MouseButtonDown( const MouseEvent& rMEvt )
             DoSelectAction( nColIx, rMEvt.GetModifier() );
             mnMTCurrCol = nColIx;
             mbMTSelecting = IsSelected( nColIx );
-            StartTracking( StartTrackingFlags::ButtonRepeat );
+            mbTracking = true;
         }
     }
     EnableRepaint();
+    return true;
 }
 
-void ScCsvGrid::Tracking( const TrackingEvent& rTEvt )
+bool ScCsvGrid::MouseButtonUp( const MouseEvent& )
 {
-    if( rTEvt.IsTrackingEnded() || rTEvt.IsTrackingRepeat() )
-    {
-        DisableRepaint();
-        const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
+    mbTracking = false;
+    return true;
+}
 
-        sal_Int32 nPos = (rMEvt.GetPosPixel().X() - GetFirstX()) / 
GetCharWidth() + GetFirstVisPos();
-        // on mouse tracking: keep position valid
-        nPos = std::max( std::min( nPos, GetPosCount() - sal_Int32( 1 ) ), 
sal_Int32( 0 ) );
-        Execute( CSVCMD_MAKEPOSVISIBLE, nPos );
+bool ScCsvGrid::MouseMove( const MouseEvent& rMEvt )
+{
+    if (!mbTracking)
+        return true;
 
-        sal_uInt32 nColIx = GetColumnFromPos( nPos );
-        if( mnMTCurrCol != nColIx )
-        {
-            DoSelectAction( nColIx, rMEvt.GetModifier() );
-            mnMTCurrCol = nColIx;
-        }
-        EnableRepaint();
+    DisableRepaint();
+
+    sal_Int32 nPos = (rMEvt.GetPosPixel().X() - GetFirstX()) / GetCharWidth() 
+ GetFirstVisPos();
+    // on mouse tracking: keep position valid
+    nPos = std::max( std::min( nPos, GetPosCount() - sal_Int32( 1 ) ), 
sal_Int32( 0 ) );
+    Execute( CSVCMD_MAKEPOSVISIBLE, nPos );
+
+    sal_uInt32 nColIx = GetColumnFromPos( nPos );
+    if( mnMTCurrCol != nColIx )
+    {
+        DoSelectAction( nColIx, rMEvt.GetModifier() );
+        mnMTCurrCol = nColIx;
     }
+    EnableRepaint();
+
+    return true;
 }
 
-void ScCsvGrid::KeyInput( const KeyEvent& rKEvt )
+bool ScCsvGrid::KeyInput( const KeyEvent& rKEvt )
 {
     const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
     sal_uInt16 nCode = rKCode.GetCode();
@@ -955,12 +983,12 @@ void ScCsvGrid::KeyInput( const KeyEvent& rKEvt )
         }
     }
 
-    if( rKCode.GetGroup() != KEYGROUP_CURSOR )
-        ScCsvControl::KeyInput( rKEvt );
+    return rKCode.GetGroup() == KEYGROUP_CURSOR;
 }
 
-void ScCsvGrid::Command( const CommandEvent& rCEvt )
+bool ScCsvGrid::Command( const CommandEvent& rCEvt )
 {
+    bool bConsumed = true;
     switch( rCEvt.GetCommand() )
     {
         case CommandEventId::ContextMenu:
@@ -985,8 +1013,8 @@ void ScCsvGrid::Command( const CommandEvent& rCEvt )
                 sal_Int32 nX2 = std::min( GetColumnX( nColIx + 1 ), GetWidth() 
);
                 ExecutePopup( Point( (nX1 + nX2) / 2, GetHeight() / 2 ) );
             }
+            break;
         }
-        break;
         case CommandEventId::Wheel:
         {
             tools::Rectangle aRect( Point(), maWinSize );
@@ -996,23 +1024,23 @@ void ScCsvGrid::Command( const CommandEvent& rCEvt )
                 if( pData && (pData->GetMode() == CommandWheelMode::SCROLL) && 
!pData->IsHorz() )
                     Execute( CSVCMD_SETLINEOFFSET, GetFirstVisLine() - 
pData->GetNotchDelta() );
             }
+            break;
         }
-        break;
         default:
-            ScCsvControl::Command( rCEvt );
+            bConsumed = false;
+            break;
     }
+    return bConsumed;
 }
 
-void ScCsvGrid::DataChanged( const DataChangedEvent& rDCEvt )
+void ScCsvGrid::StyleUpdated()
 {
-    if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && 
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
-    {
-        InitColors();
-        InitFonts();
-        UpdateLayoutData();
-        Execute( CSVCMD_UPDATECELLTEXTS );
-    }
-    ScCsvControl::DataChanged( rDCEvt );
+    InitColors();
+    InitFonts();
+    UpdateLayoutData();
+    Execute( CSVCMD_UPDATECELLTEXTS );
+
+    ScCsvControl::StyleUpdated();
 }
 
 void ScCsvGrid::ConfigurationChanged( utl::ConfigurationBroadcaster*, 
ConfigurationHints )
@@ -1023,12 +1051,12 @@ void ScCsvGrid::ConfigurationChanged( 
utl::ConfigurationBroadcaster*, Configurat
 
 // painting -------------------------------------------------------------------
 
-void ScCsvGrid::Paint( vcl::RenderContext& /*rRenderContext*/, const 
tools::Rectangle& )
+void ScCsvGrid::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
 {
-    Repaint();
+    ImplRedraw(rRenderContext);
 }
 
-void ScCsvGrid::ImplRedraw()
+void ScCsvGrid::ImplRedraw(vcl::RenderContext& rRenderContext)
 {
     if( IsVisible() )
     {
@@ -1038,8 +1066,7 @@ void ScCsvGrid::ImplRedraw()
             ImplDrawBackgrDev();
             ImplDrawGridDev();
         }
-        DrawOutDev( Point(), maWinSize, Point(), maWinSize, *mpGridDev );
-        ImplDrawTrackingRect( GetFocusColumn() );
+        rRenderContext.DrawOutDev( Point(), maWinSize, Point(), maWinSize, 
*mpGridDev );
     }
 }
 
@@ -1355,24 +1382,26 @@ void ScCsvGrid::ImplInvertCursor( sal_Int32 nPos )
     }
 }
 
-void ScCsvGrid::ImplDrawTrackingRect( sal_uInt32 nColIndex )
+tools::Rectangle ScCsvGrid::GetFocusRect()
 {
+    auto nColIndex = GetFocusColumn();
     if( HasFocus() && IsVisibleColumn( nColIndex ) )
     {
         sal_Int32 nX1 = std::max( GetColumnX( nColIndex ), GetFirstX() ) + 1;
         sal_Int32 nX2 = std::min( GetColumnX( nColIndex + 1 ) - sal_Int32( 1 
), GetLastX() );
         sal_Int32 nY2 = std::min( GetY( GetLastVisLine() + 1 ), GetHeight() ) 
- 1;
-        InvertTracking( tools::Rectangle( nX1, 0, nX2, nY2 ), 
ShowTrackFlags::Small | ShowTrackFlags::TrackWindow );
+        return tools::Rectangle( nX1, 0, nX2, nY2 );
     }
+    return weld::CustomWidgetController::GetFocusRect();
 }
 
 // accessibility ==============================================================
 
-rtl::Reference<ScAccessibleCsvControl> ScCsvGrid::ImplCreateAccessible()
+css::uno::Reference<css::accessibility::XAccessible> 
ScCsvGrid::CreateAccessible()
 {
-    rtl::Reference<ScAccessibleCsvControl> pControl(new ScAccessibleCsvGrid( 
*this ));
-    pControl->Init();
-    return pControl;
+    rtl::Reference<ScAccessibleCsvGrid> xRef(new ScAccessibleCsvGrid(*this));
+    mxAccessible.set(xRef.get());
+    return css::uno::Reference<css::accessibility::XAccessible>(xRef.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx
index 093b01d059bd..2812f1a5ffbc 100644
--- a/sc/source/ui/dbgui/csvruler.cxx
+++ b/sc/source/ui/dbgui/csvruler.cxx
@@ -25,8 +25,9 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <vcl/event.hxx>
 #include <vcl/settings.hxx>
-#include <vcl/virdev.hxx>
 #include <vcl/ptrstyle.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
 
 using namespace com::sun::star::uno;
 
@@ -89,40 +90,41 @@ static void save_FixedWidthList(const ScCsvSplits& rSplits)
     aItem.PutProperties(aNames, aValues);
 }
 
-ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
-    ScCsvControl( rParent ),
-    mnPosCursorLast( 1 )
+ScCsvRuler::ScCsvRuler(ScCsvLayoutData& rData, ScCsvTableBox* pTableBox)
+    : ScCsvControl(rData)
+    , mpTableBox(pTableBox)
+    , mnPosCursorLast(1)
+    , mbTracking(false)
+{
+}
+
+void ScCsvRuler::SetDrawingArea(weld::DrawingArea* pDrawingArea)
 {
+    ScCsvControl::SetDrawingArea(pDrawingArea);
+
+    mnSplitSize = (GetCharWidth() * 3 / 5) | 1; // make an odd number
+
+    Size aSize(1, GetTextHeight() + mnSplitSize + 2);
+    pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
+    SetOutputSizePixel(aSize);
+
     EnableRTL( false ); // RTL
     InitColors();
     InitSizeData();
-    maBackgrDev->SetFont( GetFont() );
-    maRulerDev->SetFont( GetFont() );
 
+    OutputDevice& rRefDevice = pDrawingArea->get_ref_device();
+    maBackgrDev->SetFont( rRefDevice.GetFont() );
+    maRulerDev->SetFont( rRefDevice.GetFont() );
     load_FixedWidthList( maSplits );
 }
 
 ScCsvRuler::~ScCsvRuler()
 {
-    disposeOnce();
-}
-
-void ScCsvRuler::dispose()
-{
     save_FixedWidthList( maSplits );
-    ScCsvControl::dispose();
 }
 
 // common ruler handling ------------------------------------------------------
 
-void ScCsvRuler::setPosSizePixel(
-        long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags )
-{
-    if( nFlags & PosSizeFlags::Height )
-        nHeight = GetTextHeight() + mnSplitSize + 2;
-    ScCsvControl::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
-}
-
 void ScCsvRuler::ApplyLayout( const ScCsvLayoutData& rOldData )
 {
     ScCsvDiff nDiff = GetLayoutData().GetDiff( rOldData ) & 
(ScCsvDiff::HorizontalMask | ScCsvDiff::RulerCursor);
@@ -148,7 +150,7 @@ void ScCsvRuler::ApplyLayout( const ScCsvLayoutData& 
rOldData )
 
 void ScCsvRuler::InitColors()
 {
-    const StyleSettings& rSett = GetSettings().GetStyleSettings();
+    const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
     maBackColor = rSett.GetFaceColor();
     maActiveColor = rSett.GetWindowColor();
     maTextColor = rSett.GetLabelTextColor();
@@ -158,9 +160,7 @@ void ScCsvRuler::InitColors()
 
 void ScCsvRuler::InitSizeData()
 {
-    maWinSize = GetSizePixel();
-
-    mnSplitSize = (GetCharWidth() * 3 / 5) | 1; // make an odd number
+    maWinSize = GetOutputSizePixel();
 
     sal_Int32 nActiveWidth = std::min( GetWidth() - GetHdrWidth(), 
GetPosCount() * GetCharWidth() );
     sal_Int32 nActiveHeight = GetTextHeight();
@@ -379,17 +379,15 @@ void ScCsvRuler::LoseFocus()
     MoveCursor( CSV_POS_INVALID );
 }
 
-void ScCsvRuler::DataChanged( const DataChangedEvent& rDCEvt )
+void ScCsvRuler::StyleUpdated()
 {
-    if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && 
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
-    {
-        InitColors();
-        Repaint();
-    }
-    ScCsvControl::DataChanged( rDCEvt );
+    InitColors();
+    Repaint();
+
+    ScCsvControl::StyleUpdated();
 }
 
-void ScCsvRuler::MouseButtonDown( const MouseEvent& rMEvt )
+bool ScCsvRuler::MouseButtonDown( const MouseEvent& rMEvt )
 {
     DisableRepaint();
     if( !HasFocus() )
@@ -402,14 +400,21 @@ void ScCsvRuler::MouseButtonDown( const MouseEvent& rMEvt 
)
         ImplSetMousePointer( nPos );
     }
     EnableRepaint();
+    return true;
+}
+
+bool ScCsvRuler::MouseButtonUp( const MouseEvent& )
+{
+    mbTracking = false;
+    return true;
 }
 
-void ScCsvRuler::MouseMove( const MouseEvent& rMEvt )
+bool ScCsvRuler::MouseMove( const MouseEvent& rMEvt )
 {
     if( !rMEvt.IsModifierChanged() )
     {
         sal_Int32 nPos = GetPosFromX( rMEvt.GetPosPixel().X() );
-        if( IsTracking() )
+        if( mbTracking )
         {
             // on mouse tracking: keep position valid
             nPos = std::max( std::min( nPos, GetPosCount() - sal_Int32( 1 ) ), 
sal_Int32( 1 ) );
@@ -425,17 +430,10 @@ void ScCsvRuler::MouseMove( const MouseEvent& rMEvt )
         }
         ImplSetMousePointer( nPos );
     }
+    return true;
 }
 
-void ScCsvRuler::Tracking( const TrackingEvent& rTEvt )
-{
-    if( rTEvt.IsTrackingEnded() || rTEvt.IsTrackingRepeat() )
-        MouseMove( rTEvt.GetMouseEvent() );
-    if( rTEvt.IsTrackingEnded() )
-        EndMouseTracking( !rTEvt.IsTrackingCanceled() );
-}
-
-void ScCsvRuler::KeyInput( const KeyEvent& rKEvt )
+bool ScCsvRuler::KeyInput( const KeyEvent& rKEvt )
 {
     const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
     sal_uInt16 nCode = rKCode.GetCode();
@@ -467,8 +465,7 @@ void ScCsvRuler::KeyInput( const KeyEvent& rKEvt )
     else if( bShift && (nCode == KEY_DELETE) )
         Execute( CSVCMD_REMOVEALLSPLITS );
 
-    if( rKCode.GetGroup() != KEYGROUP_CURSOR )
-        ScCsvControl::KeyInput( rKEvt );
+    return rKCode.GetGroup() == KEYGROUP_CURSOR;
 }
 
 void ScCsvRuler::StartMouseTracking( sal_Int32 nPos )
@@ -478,7 +475,7 @@ void ScCsvRuler::StartMouseTracking( sal_Int32 nPos )
     maOldSplits = maSplits;
     Execute( CSVCMD_INSERTSPLIT, nPos );
     if( HasSplit( nPos ) )
-        StartTracking( StartTrackingFlags::ButtonRepeat );
+        mbTracking = true;
 }
 
 void ScCsvRuler::MoveMouseTracking( sal_Int32 nPos )
@@ -520,12 +517,12 @@ void ScCsvRuler::EndMouseTracking( bool bApply )
 
 // painting -------------------------------------------------------------------
 
-void ScCsvRuler::Paint( vcl::RenderContext& /*rRenderContext*/, const 
tools::Rectangle& )
+void ScCsvRuler::Paint( vcl::RenderContext& rRenderContext, const 
tools::Rectangle& )
 {
-    Repaint();
+    ImplRedraw(rRenderContext);
 }
 
-void ScCsvRuler::ImplRedraw()
+void ScCsvRuler::ImplRedraw(vcl::RenderContext& rRenderContext)
 {
     if( IsVisible() )
     {
@@ -535,14 +532,18 @@ void ScCsvRuler::ImplRedraw()
             ImplDrawBackgrDev();
             ImplDrawRulerDev();
         }
-        DrawOutDev( Point(), maWinSize, Point(), maWinSize, *maRulerDev );
-        /* Draws directly tracking rectangle to the column with the specified 
index. */
-        if( HasFocus() )
-            InvertTracking( tools::Rectangle( 0, 0, GetWidth() - 1, 
GetHeight() - 2 ),
-                ShowTrackFlags::Small | ShowTrackFlags::TrackWindow );
+        rRenderContext.DrawOutDev( Point(), maWinSize, Point(), maWinSize, 
*maRulerDev );
     }
 }
 
+tools::Rectangle ScCsvRuler::GetFocusRect()
+{
+    /* Draws directly tracking rectangle to the column with the specified 
index. */
+    if(HasFocus())
+        return tools::Rectangle(0, 0, GetWidth() - 1, GetHeight() - 2);
+    return weld::CustomWidgetController::GetFocusRect();
+}
+
 void ScCsvRuler::ImplDrawArea( sal_Int32 nPosX, sal_Int32 nWidth )
 {
     maBackgrDev->SetLineColor();
@@ -652,9 +653,11 @@ void ScCsvRuler::ImplSetMousePointer( sal_Int32 nPos )
 
 // accessibility ==============================================================
 
-rtl::Reference<ScAccessibleCsvControl> ScCsvRuler::ImplCreateAccessible()
+css::uno::Reference<css::accessibility::XAccessible> 
ScCsvRuler::CreateAccessible()
 {
-    return new ScAccessibleCsvRuler( *this );
+    rtl::Reference<ScAccessibleCsvRuler> xRef(new ScAccessibleCsvRuler(*this));
+    mxAccessible.set(xRef.get());
+    return css::uno::Reference<css::accessibility::XAccessible>(xRef.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/csvtablebox.cxx 
b/sc/source/ui/dbgui/csvtablebox.cxx
index efa8a75787d6..3ffc6901eeb6 100644
--- a/sc/source/ui/dbgui/csvtablebox.cxx
+++ b/sc/source/ui/dbgui/csvtablebox.cxx
@@ -24,58 +24,38 @@
 #include <vcl/settings.hxx>
 #include <AccessibleCsvControl.hxx>
 
-ScCsvTableBox::ScCsvTableBox( vcl::Window* pParent, WinBits nBits ) :
-    ScCsvControl( pParent, maData, nBits ),
-    maRuler( VclPtr<ScCsvRuler>::Create(*this) ),
-    maGrid( VclPtr<ScCsvGrid>::Create(*this) ),
-    maHScroll( VclPtr<ScrollBar>::Create( this, WB_HORZ | WB_DRAG ) ),
-    maVScroll( VclPtr<ScrollBar>::Create( this, WB_VERT | WB_DRAG ) ),
-    maScrollBox( VclPtr<ScrollBarBox>::Create(this) )
+ScCsvTableBox::ScCsvTableBox(weld::Builder& rBuilder)
+    : mxRuler(new ScCsvRuler(maData, this))
+    , mxGrid(new ScCsvGrid(maData, rBuilder.weld_menu("popup"), this))
+    , mxScroll(rBuilder.weld_scrolled_window("scrolledwindow"))
+    , mxRulerWeld(new weld::CustomWeld(rBuilder, "csvruler", *mxRuler))
+    , mxGridWeld(new weld::CustomWeld(rBuilder, "csvgrid", *mxGrid))
 {
+    mxScroll->set_user_managed_scrolling();
+    Size aSize(mxScroll->get_approximate_digit_width() * 67,
+               mxScroll->get_text_height() * 10);
+    // this needs to be larger than the ScCsvGrid initial size to get it
+    // to stretch to fit, see ScCsvGrid::SetDrawingArea
+    mxScroll->set_size_request(aSize.Width(), aSize.Height());
+
     mbFixedMode = false;
     mnFixedWidth = 1;
 
-    maHScroll->EnableRTL( false ); // RTL
-    maHScroll->SetLineSize( 1 );
-    maVScroll->SetLineSize( 1 );
-
     Link<ScCsvControl&,void> aLink = LINK( this, ScCsvTableBox, CsvCmdHdl );
-    SetCmdHdl( aLink );
-    maRuler->SetCmdHdl( aLink );
-    maGrid->SetCmdHdl( aLink );
+    mxRuler->SetCmdHdl( aLink );
+    mxGrid->SetCmdHdl( aLink );
 
-    Link<ScrollBar*,void> aLink2 = LINK( this, ScCsvTableBox, ScrollHdl );
-    maHScroll->SetScrollHdl( aLink2 );
-    maVScroll->SetScrollHdl( aLink2 );
+    mxScroll->connect_hadjustment_changed(LINK(this, ScCsvTableBox, 
HScrollHdl));
+    mxScroll->connect_vadjustment_changed(LINK(this, ScCsvTableBox, 
VScrollHdl));
 
-    aLink2 = LINK( this, ScCsvTableBox, ScrollEndHdl );
-    maHScroll->SetEndScrollHdl( aLink2 );
-    maVScroll->SetEndScrollHdl( aLink2 );
+    maEndScrollIdle.SetPriority(TaskPriority::LOWEST);
+    maEndScrollIdle.SetInvokeHandler(LINK(this,ScCsvTableBox,ScrollEndHdl));
 
     InitControls();
 }
 
 ScCsvTableBox::~ScCsvTableBox()
 {
-    disposeOnce();
-}
-
-void ScCsvTableBox::dispose()
-{
-    maRuler.disposeAndClear();
-    maGrid.disposeAndClear();
-    maHScroll.disposeAndClear();
-    maVScroll.disposeAndClear();
-    maScrollBox.disposeAndClear();
-    ScCsvControl::dispose();
-}
-
-VCL_BUILDER_FACTORY_ARGS(ScCsvTableBox, WB_BORDER)
-
-Size ScCsvTableBox::GetOptimalSize() const
-{
-    Size aDefault(LogicToPixel(Size(243, 82), MapMode(MapUnit::MapAppFont)));
-    return aDefault;
 }
 
 // common table box handling --------------------------------------------------
@@ -85,18 +65,18 @@ void ScCsvTableBox::SetSeparatorsMode()
     if( mbFixedMode )
     {
         // rescue data for fixed width mode
-        mnFixedWidth = GetPosCount();
-        maFixColStates = maGrid->GetColumnStates();
+        mnFixedWidth = mxGrid->GetPosCount();
+        maFixColStates = mxGrid->GetColumnStates();
         // switch to separators mode
         mbFixedMode = false;
         // reset and reinitialize controls
-        DisableRepaint();
-        Execute( CSVCMD_SETLINEOFFSET, 0 );
-        Execute( CSVCMD_SETPOSCOUNT, 1 );
-        Execute( CSVCMD_NEWCELLTEXTS );
-        maGrid->SetColumnStates( maSepColStates );
+        mxGrid->DisableRepaint();
+        mxGrid->Execute( CSVCMD_SETLINEOFFSET, 0 );
+        mxGrid->Execute( CSVCMD_SETPOSCOUNT, 1 );
+        mxGrid->Execute( CSVCMD_NEWCELLTEXTS );
+        mxGrid->SetColumnStates( maSepColStates );
         InitControls();
-        EnableRepaint();
+        mxGrid->EnableRepaint();
     }
 }
 
@@ -105,94 +85,81 @@ void ScCsvTableBox::SetFixedWidthMode()
     if( !mbFixedMode )
     {
         // rescue data for separators mode
-        maSepColStates = maGrid->GetColumnStates();
+        maSepColStates = mxGrid->GetColumnStates();
         // switch to fixed width mode
         mbFixedMode = true;
         // reset and reinitialize controls
-        DisableRepaint();
-        Execute( CSVCMD_SETLINEOFFSET, 0 );
-        Execute( CSVCMD_SETPOSCOUNT, mnFixedWidth );
-        maGrid->SetSplits( maRuler->GetSplits() );
-        maGrid->SetColumnStates( maFixColStates );
+        mxGrid->DisableRepaint();
+        mxGrid->Execute( CSVCMD_SETLINEOFFSET, 0 );
+        mxGrid->Execute( CSVCMD_SETPOSCOUNT, mnFixedWidth );
+        mxGrid->SetSplits( mxRuler->GetSplits() );
+        mxGrid->SetColumnStates( maFixColStates );
         InitControls();
-        EnableRepaint();
+        mxGrid->EnableRepaint();
     }
 }
 
 void ScCsvTableBox::Init()
 {
-    maGrid->Init();
+    mxGrid->Init();
 }
 
 void ScCsvTableBox::InitControls()
 {
-    maGrid->UpdateLayoutData();
-
-    long nScrollBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
-    Size aWinSize = CalcOutputSize( GetSizePixel() );
-    long nDataWidth = aWinSize.Width() - nScrollBarSize;
-    long nDataHeight = aWinSize.Height() - nScrollBarSize;
+    mxGrid->UpdateLayoutData();
 
-    maData.mnWinWidth = nDataWidth;
-    maData.mnWinHeight = nDataHeight;
-
-    if( mbFixedMode )
-    {
-        // ruler sets height internally
-        maRuler->setPosSizePixel( 0, 0, nDataWidth, 0 );
-        sal_Int32 nY = maRuler->GetSizePixel().Height();
-        maData.mnWinHeight -= nY;
-        maGrid->setPosSizePixel( 0, nY, nDataWidth, maData.mnWinHeight );
-    }
+    mxGrid->Show();
+    if (mbFixedMode)
+        mxRuler->Show();
     else
-        maGrid->setPosSizePixel( 0, 0, nDataWidth, nDataHeight );
-    maGrid->Show();
-    maRuler->Show( mbFixedMode );
+        mxRuler->Hide();
+
+    Size aWinSize = mxGrid->GetOutputSizePixel();
+    maData.mnWinWidth = aWinSize.Width();
+    maData.mnWinHeight = aWinSize.Height();
 
     // scrollbars always visible
-    maHScroll->setPosSizePixel( 0, nDataHeight, nDataWidth, nScrollBarSize );
     InitHScrollBar();
-    maHScroll->Show();
 
     // scrollbars always visible
-    maVScroll->setPosSizePixel( nDataWidth, 0, nScrollBarSize, nDataHeight );
     InitVScrollBar();
-    maVScroll->Show();
-
-    bool bScrBox = maHScroll->IsVisible() && maVScroll->IsVisible();
-    if( bScrBox )
-        maScrollBox->setPosSizePixel( nDataWidth, nDataHeight, nScrollBarSize, 
nScrollBarSize );
-    maScrollBox->Show( bScrBox );
 
     // let the controls self-adjust to visible area
-    Execute( CSVCMD_SETPOSOFFSET, GetFirstVisPos() );
-    Execute( CSVCMD_SETLINEOFFSET, GetFirstVisLine() );
+    mxGrid->Execute( CSVCMD_SETPOSOFFSET, mxGrid->GetFirstVisPos() );
+    mxGrid->Execute( CSVCMD_SETLINEOFFSET, mxGrid->GetFirstVisLine() );
 }
 
 void ScCsvTableBox::InitHScrollBar()
 {
-    maHScroll->SetRange( Range( 0, GetPosCount() + 2 ) );
-    maHScroll->SetVisibleSize( GetVisPosCount() );
-    maHScroll->SetPageSize( GetVisPosCount() * 3 / 4 );
-    maHScroll->SetThumbPos( GetFirstVisPos() );
+    int nLower = 0;
+    int nValue = mxGrid->GetFirstVisPos();
+    int nUpper = mxGrid->GetPosCount() + 2;
+    int nPageSize = mxGrid->GetVisPosCount();
+
+    // Undo scrollbar RTL
+    if (AllSettings::GetLayoutRTL())
+        nValue = nUpper - (nValue - nLower + nPageSize);
+
+    mxScroll->hadjustment_configure(nValue, nLower, nUpper,
+                                    1, mxGrid->GetVisPosCount() * 3 / 4,
+                                    nPageSize);
 }
 
 void ScCsvTableBox::InitVScrollBar()
 {
-    maVScroll->SetRange( Range( 0, GetLineCount() + 1 ) );
-    maVScroll->SetVisibleSize( GetVisLineCount() );
-    maVScroll->SetPageSize( GetVisLineCount() - 2 );
-    maVScroll->SetThumbPos( GetFirstVisLine() );
+    mxScroll->vadjustment_configure(mxGrid->GetFirstVisLine(), 0, 
mxGrid->GetLineCount() + 1,
+                                    1, mxGrid->GetVisLineCount() - 2,
+                                    mxGrid->GetVisLineCount());
 }
 
 void ScCsvTableBox::MakePosVisible( sal_Int32 nPos )
 {
-    if( (0 <= nPos) && (nPos < GetPosCount()) )
+    if( (0 <= nPos) && (nPos < mxGrid->GetPosCount()) )
     {
-        if( nPos - CSV_SCROLL_DIST + 1 <= GetFirstVisPos() )
-            Execute( CSVCMD_SETPOSOFFSET, nPos - CSV_SCROLL_DIST );
-        else if( nPos + CSV_SCROLL_DIST >= GetLastVisPos() )
-            Execute( CSVCMD_SETPOSOFFSET, nPos - GetVisPosCount() + 
CSV_SCROLL_DIST );
+        if( nPos - CSV_SCROLL_DIST + 1 <= mxGrid->GetFirstVisPos() )
+            mxGrid->Execute( CSVCMD_SETPOSOFFSET, nPos - CSV_SCROLL_DIST );
+        else if( nPos + CSV_SCROLL_DIST >= mxGrid->GetLastVisPos() )
+            mxGrid->Execute( CSVCMD_SETPOSOFFSET, nPos - 
mxGrid->GetVisPosCount() + CSV_SCROLL_DIST );
     }
 }
 
@@ -204,53 +171,40 @@ void ScCsvTableBox::SetUniStrings(
 {
     // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES
     // -> will be dynamic sometime
-    DisableRepaint();
-    sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES;
+    mxGrid->DisableRepaint();
+    sal_Int32 nEndLine = mxGrid->GetFirstVisLine() + CSV_PREVIEW_LINES;
     const OUString* pString = pTextLines;
-    for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, 
++pString )
+    for( sal_Int32 nLine = mxGrid->GetFirstVisLine(); nLine < nEndLine; 
++nLine, ++pString )
     {
         if( mbFixedMode )
-            maGrid->ImplSetTextLineFix( nLine, *pString );
+            mxGrid->ImplSetTextLineFix( nLine, *pString );
         else
-            maGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, 
bMergeSep, bRemoveSpace );
+            mxGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, 
bMergeSep, bRemoveSpace );
     }
-    EnableRepaint();
+    mxGrid->EnableRepaint();
 }
 
 // column settings ------------------------------------------------------------
 
-void ScCsvTableBox::InitTypes( const ListBox& rListBox )
+void ScCsvTableBox::InitTypes(const weld::ComboBox& rListBox)
 {
-    const sal_Int32 nTypeCount = rListBox.GetEntryCount();
+    const sal_Int32 nTypeCount = rListBox.get_count();
     std::vector<OUString> aTypeNames( nTypeCount );
     for( sal_Int32 nIndex = 0; nIndex < nTypeCount; ++nIndex )
-        aTypeNames[ nIndex ] = rListBox.GetEntry( nIndex );
-    maGrid->SetTypeNames( aTypeNames );
+        aTypeNames[ nIndex ] = rListBox.get_text( nIndex );
+    mxGrid->SetTypeNames( aTypeNames );
 }
 
 void ScCsvTableBox::FillColumnData( ScAsciiOptions& rOptions ) const
 {
     if( mbFixedMode )
-        maGrid->FillColumnDataFix( rOptions );
+        mxGrid->FillColumnDataFix( rOptions );
     else
-        maGrid->FillColumnDataSep( rOptions );
+        mxGrid->FillColumnDataSep( rOptions );
 }
 
 // event handling -------------------------------------------------------------
 
-void ScCsvTableBox::Resize()
-{
-    ScCsvControl::Resize();
-    InitControls();
-}
-
-void ScCsvTableBox::DataChanged( const DataChangedEvent& rDCEvt )
-{
-    if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && 
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
-        InitControls();
-    ScCsvControl::DataChanged( rDCEvt );
-}
-
 IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl&, rCtrl, void )
 {
     const ScCsvCmd& rCmd = rCtrl.GetCmd();
@@ -262,10 +216,10 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl&, 
rCtrl, void )
     switch( eType )
     {
         case CSVCMD_REPAINT:
-            if( !IsNoRepaint() )
+            if( !mxGrid->IsNoRepaint() )
             {
-                maGrid->ImplRedraw();
-                maRuler->ImplRedraw();
+                mxGrid->Invalidate();
+                mxRuler->Invalidate();
                 InitHScrollBar();
                 InitVScrollBar();
             }
@@ -276,57 +230,57 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl&, 
rCtrl, void )
 
         case CSVCMD_NEWCELLTEXTS:
             if( mbFixedMode )
-                Execute( CSVCMD_UPDATECELLTEXTS );
+                mxGrid->Execute( CSVCMD_UPDATECELLTEXTS );
             else
             {
-                DisableRepaint();
-                ScCsvColStateVec aStates( maGrid->GetColumnStates() );
-                sal_Int32 nPos = GetFirstVisPos();
-                Execute( CSVCMD_SETPOSCOUNT, 1 );
-                Execute( CSVCMD_UPDATECELLTEXTS );
-                Execute( CSVCMD_SETPOSOFFSET, nPos );
-                maGrid->SetColumnStates( aStates );
-                EnableRepaint();
+                mxGrid->DisableRepaint();
+                ScCsvColStateVec aStates( mxGrid->GetColumnStates() );
+                sal_Int32 nPos = mxGrid->GetFirstVisPos();
+                mxGrid->Execute( CSVCMD_SETPOSCOUNT, 1 );
+                mxGrid->Execute( CSVCMD_UPDATECELLTEXTS );
+                mxGrid->Execute( CSVCMD_SETPOSOFFSET, nPos );
+                mxGrid->SetColumnStates( aStates );
+                mxGrid->EnableRepaint();
             }
         break;
         case CSVCMD_UPDATECELLTEXTS:
             maUpdateTextHdl.Call( *this );
         break;
         case CSVCMD_SETCOLUMNTYPE:
-            maGrid->SetSelColumnType( nParam1 );
+            mxGrid->SetSelColumnType( nParam1 );
         break;
         case CSVCMD_EXPORTCOLUMNTYPE:
             maColTypeHdl.Call( *this );
         break;
         case CSVCMD_SETFIRSTIMPORTLINE:
-            maGrid->SetFirstImportedLine( nParam1 );
+            mxGrid->SetFirstImportedLine( nParam1 );
         break;
 
         case CSVCMD_INSERTSPLIT:
             OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::InsertSplit - 
invalid call" );
-            if( maRuler->GetSplitCount() + 1 < 
sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) )
+            if( mxRuler->GetSplitCount() + 1 < 
sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) )
             {
-                maRuler->InsertSplit( nParam1 );
-                maGrid->InsertSplit( nParam1 );
+                mxRuler->InsertSplit( nParam1 );
+                mxGrid->InsertSplit( nParam1 );
             }
         break;
         case CSVCMD_REMOVESPLIT:
             OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::RemoveSplit - 
invalid call" );
-            maRuler->RemoveSplit( nParam1 );
-            maGrid->RemoveSplit( nParam1 );
+            mxRuler->RemoveSplit( nParam1 );
+            mxGrid->RemoveSplit( nParam1 );
         break;
         case CSVCMD_TOGGLESPLIT:
-            Execute( maRuler->HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT : 
CSVCMD_INSERTSPLIT, nParam1 );
+            mxGrid->Execute( mxRuler->HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT 
: CSVCMD_INSERTSPLIT, nParam1 );
         break;
         case CSVCMD_MOVESPLIT:
             OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::MoveSplit - 
invalid call" );
-            maRuler->MoveSplit( nParam1, nParam2 );
-            maGrid->MoveSplit( nParam1, nParam2 );
+            mxRuler->MoveSplit( nParam1, nParam2 );
+            mxGrid->MoveSplit( nParam1, nParam2 );
         break;
         case CSVCMD_REMOVEALLSPLITS:
             OSL_ENSURE( mbFixedMode, 
"ScCsvTableBox::CsvCmdHdl::RemoveAllSplits - invalid call" );
-            maRuler->RemoveAllSplits();
-            maGrid->RemoveAllSplits();
+            mxRuler->RemoveAllSplits();
+            mxGrid->RemoveAllSplits();
         break;
         default:
             bFound = false;
@@ -339,39 +293,39 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl&, 
rCtrl, void )
     {
         case CSVCMD_SETPOSCOUNT:
             maData.mnPosCount = std::max( nParam1, sal_Int32( 1 ) );
-            ImplSetPosOffset( GetFirstVisPos() );
+            ImplSetPosOffset( mxGrid->GetFirstVisPos() );
         break;
         case CSVCMD_SETPOSOFFSET:
             ImplSetPosOffset( nParam1 );
         break;
         case CSVCMD_SETHDRWIDTH:
             maData.mnHdrWidth = std::max( nParam1, sal_Int32( 0 ) );
-            ImplSetPosOffset( GetFirstVisPos() );
+            ImplSetPosOffset( mxGrid->GetFirstVisPos() );
         break;
         case CSVCMD_SETCHARWIDTH:
             maData.mnCharWidth = std::max( nParam1, sal_Int32( 1 ) );
-            ImplSetPosOffset( GetFirstVisPos() );
+            ImplSetPosOffset( mxGrid->GetFirstVisPos() );
         break;
         case CSVCMD_SETLINECOUNT:
             maData.mnLineCount = std::max( nParam1, sal_Int32( 1 ) );
-            ImplSetLineOffset( GetFirstVisLine() );
+            ImplSetLineOffset( mxGrid->GetFirstVisLine() );
         break;
         case CSVCMD_SETLINEOFFSET:
             ImplSetLineOffset( nParam1 );
         break;
         case CSVCMD_SETHDRHEIGHT:
             maData.mnHdrHeight = std::max( nParam1, sal_Int32( 0 ) );
-            ImplSetLineOffset( GetFirstVisLine() );
+            ImplSetLineOffset( mxGrid->GetFirstVisLine() );
         break;
         case CSVCMD_SETLINEHEIGHT:
             maData.mnLineHeight = std::max( nParam1, sal_Int32( 1 ) );
-            ImplSetLineOffset( GetFirstVisLine() );
+            ImplSetLineOffset( mxGrid->GetFirstVisLine() );
         break;
         case CSVCMD_MOVERULERCURSOR:
-            maData.mnPosCursor = IsVisibleSplitPos( nParam1 ) ? nParam1 : 
CSV_POS_INVALID;
+            maData.mnPosCursor = mxGrid->IsVisibleSplitPos( nParam1 ) ? 
nParam1 : CSV_POS_INVALID;
         break;
         case CSVCMD_MOVEGRIDCURSOR:
-            maData.mnColCursor = ((0 <= nParam1) && (nParam1 < GetPosCount())) 
? nParam1 : CSV_POS_INVALID;
+            maData.mnColCursor = ((0 <= nParam1) && (nParam1 < 
mxGrid->GetPosCount())) ? nParam1 : CSV_POS_INVALID;
         break;
         default:
         {
@@ -381,47 +335,39 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl&, 
rCtrl, void )
 
     if( maData != aOldData )
     {
-        DisableRepaint();
-        maRuler->ApplyLayout( aOldData );
-        maGrid->ApplyLayout( aOldData );
-        EnableRepaint();
+        mxGrid->DisableRepaint();
+        mxRuler->ApplyLayout( aOldData );
+        mxGrid->ApplyLayout( aOldData );
+        mxGrid->EnableRepaint();
     }
 }
 
-IMPL_LINK( ScCsvTableBox, ScrollHdl, ScrollBar*, pScrollBar, void )
+IMPL_LINK(ScCsvTableBox, HScrollHdl, weld::ScrolledWindow&, rScroll, void)
 {
-    OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollHdl - missing sender" );
-
-    if( pScrollBar == maHScroll.get() )
-        Execute( CSVCMD_SETPOSOFFSET, pScrollBar->GetThumbPos() );
-    else if( pScrollBar == maVScroll.get() )
-        Execute( CSVCMD_SETLINEOFFSET, pScrollBar->GetThumbPos() );
-}
+    int nLower = 0;
+    int nValue = rScroll.hadjustment_get_value();
+    int nUpper = mxGrid->GetPosCount() + 2;
+    int nPageSize = mxGrid->GetVisPosCount();
 
-IMPL_LINK( ScCsvTableBox, ScrollEndHdl, ScrollBar*, pScrollBar, void )
-{
-    OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollEndHdl - missing sender" );
+    // Undo scrollbar RTL
+    if (AllSettings::GetLayoutRTL())
+        nValue = nUpper - (nValue - nLower + nPageSize);
 
-    if( pScrollBar == maHScroll.get() )
-    {
-        if( GetRulerCursorPos() != CSV_POS_INVALID )
-            Execute( CSVCMD_MOVERULERCURSOR, maRuler->GetNoScrollPos( 
GetRulerCursorPos() ) );
-        if( GetGridCursorPos() != CSV_POS_INVALID )
-            Execute( CSVCMD_MOVEGRIDCURSOR, maGrid->GetNoScrollCol( 
GetGridCursorPos() ) );
-    }
+    mxGrid->Execute(CSVCMD_SETPOSOFFSET, nValue);
+    maEndScrollIdle.Start();
 }
 
-// accessibility --------------------------------------------------------------
-
-css::uno::Reference< css::accessibility::XAccessible > 
ScCsvTableBox::CreateAccessible()
+IMPL_LINK(ScCsvTableBox, VScrollHdl, weld::ScrolledWindow&, rScroll, void)
 {
-    // do not use the ScCsvControl mechanism, return default accessible object
-    return Control::CreateAccessible();
+    mxGrid->Execute(CSVCMD_SETLINEOFFSET, rScroll.vadjustment_get_value());
 }
 
-rtl::Reference<ScAccessibleCsvControl> ScCsvTableBox::ImplCreateAccessible()
+IMPL_LINK_NOARG(ScCsvTableBox, ScrollEndHdl, Timer*, void)
 {
-    return rtl::Reference<ScAccessibleCsvControl>();    // not used, see 
CreateAccessible()
+    if( mxGrid->GetRulerCursorPos() != CSV_POS_INVALID )
+        mxGrid->Execute( CSVCMD_MOVERULERCURSOR, mxRuler->GetNoScrollPos( 
mxGrid->GetRulerCursorPos() ) );
+    if( mxGrid->GetGridCursorPos() != CSV_POS_INVALID )
+        mxGrid->Execute( CSVCMD_MOVEGRIDCURSOR, mxGrid->GetNoScrollCol( 
mxGrid->GetGridCursorPos() ) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index c3fa2fdc0651..96f69f03139c 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -91,7 +91,7 @@ CSVImportOptionsIndex getSkipEmptyCellsIndex( 
ScImportAsciiCall eCall )
 }
 }
 
-static void lcl_FillCombo( ComboBox& rCombo, const OUString& rList, 
sal_Unicode cSelect )
+static void lcl_FillCombo(weld::ComboBox& rCombo, const OUString& rList, 
sal_Unicode cSelect)
 {
     OUString aStr;
     if (!rList.isEmpty())
@@ -100,7 +100,7 @@ static void lcl_FillCombo( ComboBox& rCombo, const 
OUString& rList, sal_Unicode
         do
         {
             const OUString sEntry {rList.getToken(0, '\t', nIdx)};
-            rCombo.InsertEntry( sEntry );
+            rCombo.append_text(sEntry);
             if (nIdx>0 && static_cast<sal_Unicode>(rList.getToken(0, '\t', 
nIdx).toInt32()) == cSelect)
                 aStr = sEntry;
         }
@@ -112,14 +112,14 @@ static void lcl_FillCombo( ComboBox& rCombo, const 
OUString& rList, sal_Unicode
         if (aStr.isEmpty())
             aStr = OUString(cSelect);         // Ascii
 
-        rCombo.SetText(aStr);
+        rCombo.set_entry_text(aStr);
     }
 }
 
-static sal_Unicode lcl_CharFromCombo( const ComboBox& rCombo, const OUString& 
rList )
+static sal_Unicode lcl_CharFromCombo(const weld::ComboBox& rCombo, const 
OUString& rList)
 {
     sal_Unicode c = 0;
-    OUString aStr = rCombo.GetText();
+    OUString aStr = rCombo.get_active_text();
     if ( !aStr.isEmpty() && !rList.isEmpty() )
     {
         sal_Int32 nIdx {0};
@@ -284,55 +284,50 @@ static void lcl_SaveSeparators(
 
 static constexpr OUStringLiteral gaTextSepList(SCSTR_TEXTSEP);
 
-ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& 
aDatName,
-                                    SvStream* pInStream, ScImportAsciiCall 
eCall ) :
-        ModalDialog (pParent, "TextImportCsvDialog",
-            "modules/scalc/ui/textimportcsv.ui"),
-        mpDatStream  ( pInStream ),
-        mnStreamPos( pInStream ? pInStream->Tell() : 0 ),
-
-        mnRowPosCount(0),
-
-        mcTextSep   ( ScAsciiOptions::cDefaultTextSep ),
-        meCall(eCall),
-        mbDetectSpaceSep(eCall != SC_TEXTTOCOLUMNS)
+ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, const OUString& 
aDatName,
+                                   SvStream* pInStream, ScImportAsciiCall 
eCall)
+    : GenericDialogController(pParent, "modules/scalc/ui/textimportcsv.ui", 
"TextImportCsvDialog")
+    , mpDatStream(pInStream)
+    , mnStreamPos(pInStream ? pInStream->Tell() : 0)
+    , mnRowPosCount(0)
+    , mcTextSep(ScAsciiOptions::cDefaultTextSep)
+    , meCall(eCall)
+    , mbDetectSpaceSep(eCall != SC_TEXTTOCOLUMNS)
+    , mxFtCharSet(m_xBuilder->weld_label("textcharset"))
+    , mxLbCharSet(new TextEncodingBox(m_xBuilder->weld_combo_box("charset")))
+    , mxFtCustomLang(m_xBuilder->weld_label("textlanguage"))
+    , mxLbCustomLang(new LanguageBox(m_xBuilder->weld_combo_box("language")))
+    , mxFtRow(m_xBuilder->weld_label("textfromrow"))
+    , mxNfRow(m_xBuilder->weld_spin_button("fromrow"))
+    , mxRbFixed(m_xBuilder->weld_radio_button("tofixedwidth"))
+    , mxRbSeparated(m_xBuilder->weld_radio_button("toseparatedby"))
+    , mxCkbTab(m_xBuilder->weld_check_button("tab"))
+    , mxCkbSemicolon(m_xBuilder->weld_check_button("semicolon"))
+    , mxCkbComma(m_xBuilder->weld_check_button("comma"))
+    , mxCkbRemoveSpace(m_xBuilder->weld_check_button("removespace"))
+    , mxCkbSpace(m_xBuilder->weld_check_button("space"))
+    , mxCkbOther(m_xBuilder->weld_check_button("other"))
+    , mxEdOther(m_xBuilder->weld_entry("inputother"))
+    , mxCkbAsOnce(m_xBuilder->weld_check_button("mergedelimiters"))
+    , mxFtTextSep(m_xBuilder->weld_label("texttextdelimiter"))
+    , mxCbTextSep(m_xBuilder->weld_combo_box("textdelimiter"))
+    , mxCkbQuotedAsText(m_xBuilder->weld_check_button("quotedfieldastext"))
+    , mxCkbDetectNumber(m_xBuilder->weld_check_button("detectspecialnumbers"))
+    , mxCkbSkipEmptyCells(m_xBuilder->weld_check_button("skipemptycells"))
+    , mxFtType(m_xBuilder->weld_label("textcolumntype"))
+    , mxLbType(m_xBuilder->weld_combo_box("columntype"))
+    , mxAltTitle(m_xBuilder->weld_label("textalttitle"))
+    , mxTableBox(new ScCsvTableBox(*m_xBuilder))
 {
-    get(pFtCharSet, "textcharset");
-    get(pLbCharSet, "charset");
-    pLbCharSet->SetStyle(pLbCharSet->GetStyle() | WB_SORT);
-    get(pFtCustomLang, "textlanguage");
-    get(pLbCustomLang, "language");
-    pLbCustomLang->SetStyle(pLbCustomLang->GetStyle() | WB_SORT);
-    get(pFtRow, "textfromrow");
-    get(pNfRow, "fromrow");
-    get(pRbFixed, "tofixedwidth");
-    get(pRbSeparated, "toseparatedby");
-    get(pCkbTab, "tab");
-    get(pCkbSemicolon, "semicolon");
-    get(pCkbComma, "comma");
-    get(pCkbSpace, "space");
-    get(pCkbRemoveSpace, "removespace");
-    get(pCkbOther, "other");
-    get(pEdOther, "inputother");
-    get(pCkbAsOnce, "mergedelimiters");
-    get(pFtTextSep, "texttextdelimiter");
-    get(pCbTextSep, "textdelimiter");
-    get(pCkbQuotedAsText, "quotedfieldastext");
-    get(pCkbDetectNumber, "detectspecialnumbers");
-    get(pCkbSkipEmptyCells, "skipemptycells");
-    get(pFtType, "textcolumntype");
-    get(pLbType, "columntype");
-    get(mpTableBox, "scrolledwindowcolumntype");
-
-    OUString aName = GetText();
+    OUString aName = m_xDialog->get_title();
     switch (meCall)
     {
         case SC_TEXTTOCOLUMNS:
-            SetText( get<FixedText>("textalttitle")->GetText() );
+            m_xDialog->set_title(mxAltTitle->get_label());
             break;
         case SC_IMPORTFILE:
             aName += " - [" + aDatName + "]";
-            SetText( aName );

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to