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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
index 2ed7ffa..9745dc3 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 747ed1b..902e292 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 239ad17..e10d8f8 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 6bbfa38..61dee39 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 5117773..e1f51bb 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 02cf139..16690af 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 418b565..632466e 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 0bced19..baf1888 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
css::awt::Rectangle ScAccessibleCsvControl::implGetBounds()
{
SolarMutexGuard aGuard;
ensureAlive();
return implGetControl().GetWindowExtentsRelative( nullptr );
}
tools::Rectangle ScAccessibleCsvControl::GetBoundingBox() const
{
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 caccf86..3c4b3ec 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 445bf57..d6790a7 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 f30a5d1..b5ec628 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 458d847..1275113 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();
}
mpPopup->SetMenuFlags( mpPopup->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
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();
}
// 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();
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();
}
mbTracking = false;
return true;
}
void ScCsvGrid::KeyInput( const KeyEvent& rKEvt )
bool ScCsvGrid::MouseMove( const MouseEvent& rMEvt )
{
if (!mbTracking)
return true;
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;
}
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 093b01d..2812f1a 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;
}
void ScCsvRuler::MouseMove( const MouseEvent& rMEvt )
bool ScCsvRuler::MouseButtonUp( const MouseEvent& )
{
mbTracking = false;
return true;
}
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 efa8a75..3ffc690 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();
mxGrid->UpdateLayoutData();
long nScrollBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
Size aWinSize = CalcOutputSize( GetSizePixel() );
long nDataWidth = aWinSize.Width() - nScrollBarSize;
long nDataHeight = aWinSize.Height() - nScrollBarSize;
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" );
int nLower = 0;
int nValue = rScroll.hadjustment_get_value();
int nUpper = mxGrid->GetPosCount() + 2;
int nPageSize = mxGrid->GetVisPosCount();
if( pScrollBar == maHScroll.get() )
Execute( CSVCMD_SETPOSOFFSET, pScrollBar->GetThumbPos() );
else if( pScrollBar == maVScroll.get() )
Execute( CSVCMD_SETLINEOFFSET, pScrollBar->GetThumbPos() );
// Undo scrollbar RTL
if (AllSettings::GetLayoutRTL())
nValue = nUpper - (nValue - nLower + nPageSize);
mxGrid->Execute(CSVCMD_SETPOSOFFSET, nValue);
maEndScrollIdle.Start();
}
IMPL_LINK( ScCsvTableBox, ScrollEndHdl, ScrollBar*, pScrollBar, void )
IMPL_LINK(ScCsvTableBox, VScrollHdl, weld::ScrolledWindow&, rScroll, void)
{
OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollEndHdl - missing sender" );
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_SETLINEOFFSET, rScroll.vadjustment_get_value());
}
// accessibility --------------------------------------------------------------
css::uno::Reference< css::accessibility::XAccessible > ScCsvTableBox::CreateAccessible()
IMPL_LINK_NOARG(ScCsvTableBox, ScrollEndHdl, Timer*, void)
{
// do not use the ScCsvControl mechanism, return default accessible object
return Control::CreateAccessible();
}
rtl::Reference<ScAccessibleCsvControl> ScCsvTableBox::ImplCreateAccessible()
{
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 c3fa2fd..96f69f0 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 );
m_xDialog->set_title(aName);
break;
default:
break;
@@ -360,22 +355,22 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
maFieldSeparators = sFieldSeparators;
if( bMergeDelimiters && !bIsTSV )
pCkbAsOnce->Check();
mxCkbAsOnce->set_active(true);
if (bQuotedFieldAsText)
pCkbQuotedAsText->Check();
mxCkbQuotedAsText->set_active(true);
if (bRemoveSpace)
pCkbRemoveSpace->Check();
mxCkbRemoveSpace->set_active(true);
if (bDetectSpecialNum)
pCkbDetectNumber->Check();
mxCkbDetectNumber->set_active(true);
if (bSkipEmptyCells)
pCkbSkipEmptyCells->Check();
if( bFixedWidth && !bIsTSV )
pRbFixed->Check();
if( nFromRow != 1 )
pNfRow->SetValue( nFromRow );
mxCkbSkipEmptyCells->set_active(true);
if (bFixedWidth && !bIsTSV)
mxRbFixed->set_active(true);
if (nFromRow != 1)
mxNfRow->set_value(nFromRow);
if ( bIsTSV )
pCkbTab->Check();
mxCkbTab->set_active(true);
else
SetSeparators(); // Set Separators in the dialog from maFieldSeparators (empty are not set)
@@ -426,34 +421,32 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
mnStreamPos = mpDatStream->Tell();
}
pNfRow->SetModifyHdl( LINK( this, ScImportAsciiDlg, FirstRowHdl ) );
mxNfRow->connect_value_changed( LINK( this, ScImportAsciiDlg, FirstRowHdl ) );
// *** Separator characters ***
lcl_FillCombo( *pCbTextSep, gaTextSepList, mcTextSep );
pCbTextSep->SetText( sTextSeparators );
lcl_FillCombo( *mxCbTextSep, gaTextSepList, mcTextSep );
mxCbTextSep->set_entry_text(sTextSeparators);
Link<Edit&,void> aSeparatorHdl = LINK( this, ScImportAsciiDlg, SeparatorEditHdl );
Link<Button*,void> aSeparatorClickHdl =LINK( this, ScImportAsciiDlg, SeparatorClickHdl );
pCbTextSep->SetSelectHdl( LINK( this, ScImportAsciiDlg, SeparatorComboBoxHdl ) );
pCbTextSep->SetModifyHdl( aSeparatorHdl );
pCkbTab->SetClickHdl( aSeparatorClickHdl );
pCkbSemicolon->SetClickHdl( aSeparatorClickHdl );
pCkbComma->SetClickHdl( aSeparatorClickHdl );
pCkbAsOnce->SetClickHdl( aSeparatorClickHdl );
pCkbQuotedAsText->SetClickHdl( aSeparatorClickHdl );
pCkbDetectNumber->SetClickHdl( aSeparatorClickHdl );
pCkbSkipEmptyCells->SetClickHdl( aSeparatorClickHdl );
pCkbSpace->SetClickHdl( aSeparatorClickHdl );
pCkbRemoveSpace->SetClickHdl( aSeparatorClickHdl );
pCkbOther->SetClickHdl( aSeparatorClickHdl );
pEdOther->SetModifyHdl( aSeparatorHdl );
Link<weld::Button&,void> aSeparatorClickHdl =LINK( this, ScImportAsciiDlg, SeparatorClickHdl );
mxCbTextSep->connect_changed( LINK( this, ScImportAsciiDlg, SeparatorComboBoxHdl ) );
mxCkbTab->connect_clicked( aSeparatorClickHdl );
mxCkbSemicolon->connect_clicked( aSeparatorClickHdl );
mxCkbComma->connect_clicked( aSeparatorClickHdl );
mxCkbAsOnce->connect_clicked( aSeparatorClickHdl );
mxCkbQuotedAsText->connect_clicked( aSeparatorClickHdl );
mxCkbDetectNumber->connect_clicked( aSeparatorClickHdl );
mxCkbSkipEmptyCells->connect_clicked( aSeparatorClickHdl );
mxCkbSpace->connect_clicked( aSeparatorClickHdl );
mxCkbRemoveSpace->connect_clicked( aSeparatorClickHdl );
mxCkbOther->connect_clicked( aSeparatorClickHdl );
mxEdOther->connect_changed(LINK(this, ScImportAsciiDlg, SeparatorEditHdl));
// *** text encoding ListBox ***
// all encodings allowed, including Unicode, but subsets are excluded
pLbCharSet->FillFromTextEncodingTable( true );
mxLbCharSet->FillFromTextEncodingTable( true );
// Insert one "SYSTEM" entry for compatibility in AsciiOptions and system
// independent document linkage.
pLbCharSet->InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, ScResId( SCSTR_CHARSET_USER ) );
mxLbCharSet->InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, ScResId( SCSTR_CHARSET_USER ) );
if ( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW )
{
rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
@@ -461,110 +454,79 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
// This gives a better chance that the file is going to be opened correctly.
if ( ( eSystemEncoding == RTL_TEXTENCODING_UNICODE ) && mpDatStream )
eSystemEncoding = RTL_TEXTENCODING_UTF8;
pLbCharSet->SelectTextEncoding( eSystemEncoding );
mxLbCharSet->SelectTextEncoding( eSystemEncoding );
}
else
{
pLbCharSet->SelectTextEncoding( ePreselectUnicode );
mxLbCharSet->SelectTextEncoding( ePreselectUnicode );
}
if( nCharSet >= 0 && ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW )
pLbCharSet->SelectEntryPos( static_cast<sal_uInt16>(nCharSet) );
if (nCharSet >= 0 && ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW)
mxLbCharSet->set_active(nCharSet);
SetSelectedCharSet();
pLbCharSet->SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
mxLbCharSet->connect_changed( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
pLbCustomLang->SetLanguageList(
mxLbCustomLang->SetLanguageList(
SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false, false);
pLbCustomLang->InsertLanguage(LANGUAGE_SYSTEM);
pLbCustomLang->SelectLanguage(static_cast<LanguageType>(nLanguage));
mxLbCustomLang->InsertLanguage(LANGUAGE_SYSTEM);
mxLbCustomLang->set_active_id(static_cast<LanguageType>(nLanguage));
// *** column type ListBox ***
OUString aColumnUser( ScResId( SCSTR_COLUMN_USER ) );
for (sal_Int32 nIdx {0}; nIdx>=0; )
{
pLbType->InsertEntry( aColumnUser.getToken( 0, ';', nIdx ) );
mxLbType->append_text(aColumnUser.getToken(0, ';', nIdx));
}
pLbType->SetSelectHdl( LINK( this, ScImportAsciiDlg, LbColTypeHdl ) );
pFtType->Disable();
pLbType->Disable();
mxLbType->connect_changed( LINK( this, ScImportAsciiDlg, LbColTypeHdl ) );
mxFtType->set_sensitive(false);
mxLbType->set_sensitive(false);
// *** table box preview ***
mpTableBox->Init();
mpTableBox->SetUpdateTextHdl( LINK( this, ScImportAsciiDlg, UpdateTextHdl ) );
mpTableBox->InitTypes( *pLbType );
mpTableBox->SetColTypeHdl( LINK( this, ScImportAsciiDlg, ColTypeHdl ) );
mxTableBox->Init();
mxTableBox->SetUpdateTextHdl( LINK( this, ScImportAsciiDlg, UpdateTextHdl ) );
mxTableBox->InitTypes( *mxLbType );
mxTableBox->SetColTypeHdl( LINK( this, ScImportAsciiDlg, ColTypeHdl ) );
pRbSeparated->SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
pRbFixed->SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
mxRbSeparated->connect_clicked( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
mxRbFixed->connect_clicked( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) );
SetupSeparatorCtrls();
RbSepFixHdl( pRbFixed );
RbSepFixHdl(*mxRbFixed);
UpdateVertical();
mpTableBox->Execute( CSVCMD_NEWCELLTEXTS );
mxTableBox->GetGrid().Execute( CSVCMD_NEWCELLTEXTS );
if (meCall == SC_TEXTTOCOLUMNS)
{
pFtCharSet->Disable();
pLbCharSet->Disable();
pFtCustomLang->Disable();
pLbCustomLang->SelectLanguage(LANGUAGE_SYSTEM);
pLbCustomLang->Disable();
pFtRow->Disable();
pNfRow->Disable();
mxFtCharSet->set_sensitive(false);
mxLbCharSet->set_sensitive(false);
mxFtCustomLang->set_sensitive(false);
mxLbCustomLang->set_active_id(LANGUAGE_SYSTEM);
mxLbCustomLang->set_sensitive(false);
mxFtRow->set_sensitive(false);
mxNfRow->set_sensitive(false);
// Quoted field as text option is not used for text-to-columns mode.
pCkbQuotedAsText->Check(false);
pCkbQuotedAsText->Disable();
mxCkbQuotedAsText->set_active(false);
mxCkbQuotedAsText->set_sensitive(false);
// Always detect special numbers for text-to-columns mode.
pCkbDetectNumber->Check();
pCkbDetectNumber->Disable();
mxCkbDetectNumber->set_active(true);
mxCkbDetectNumber->set_sensitive(false);
}
if (meCall == SC_IMPORTFILE)
{
//Empty cells in imported file are empty
pCkbSkipEmptyCells->Check(false);
pCkbSkipEmptyCells->Hide();
mxCkbSkipEmptyCells->set_active(false);
mxCkbSkipEmptyCells->hide();
}
}
ScImportAsciiDlg::~ScImportAsciiDlg()
{
disposeOnce();
}
void ScImportAsciiDlg::dispose()
{
mpRowPosArray.reset();
pFtCharSet.clear();
pLbCharSet.clear();
pFtCustomLang.clear();
pLbCustomLang.clear();
pFtRow.clear();
pNfRow.clear();
pRbFixed.clear();
pRbSeparated.clear();
pCkbTab.clear();
pCkbSemicolon.clear();
pCkbComma.clear();
pCkbSpace.clear();
pCkbRemoveSpace.clear();
pCkbOther.clear();
pEdOther.clear();
pCkbAsOnce.clear();
pFtTextSep.clear();
pCbTextSep.clear();
pCkbQuotedAsText.clear();
pCkbDetectNumber.clear();
pCkbSkipEmptyCells.clear();
pFtType.clear();
pLbType.clear();
mpTableBox.clear();
ModalDialog::dispose();
}
bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText, sal_Unicode& rcDetectSep )
@@ -573,7 +535,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText, sal_Unicode& r
return false;
bool bRet = true;
bool bFixed = pRbFixed->IsChecked();
bool bFixed = mxRbFixed->get_active();
if (!mpRowPosArray)
mpRowPosArray.reset( new sal_uLong[ASCIIDLG_MAXROWS + 2] );
@@ -635,32 +597,32 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
{
rOpt.SetCharSet( meCharSet );
rOpt.SetCharSetSystem( mbCharSetSystem );
rOpt.SetLanguage(pLbCustomLang->GetSelectedLanguage());
rOpt.SetFixedLen( pRbFixed->IsChecked() );
rOpt.SetStartRow( static_cast<long>(pNfRow->GetValue()) );
mpTableBox->FillColumnData( rOpt );
if( pRbSeparated->IsChecked() )
rOpt.SetLanguage(mxLbCustomLang->get_active_id());
rOpt.SetFixedLen( mxRbFixed->get_active() );
rOpt.SetStartRow( mxNfRow->get_value() );
mxTableBox->FillColumnData( rOpt );
if( mxRbSeparated->get_active() )
{
rOpt.SetFieldSeps( GetSeparators() );
rOpt.SetMergeSeps( pCkbAsOnce->IsChecked() );
rOpt.SetRemoveSpace( pCkbRemoveSpace->IsChecked() );
rOpt.SetTextSep( lcl_CharFromCombo( *pCbTextSep, gaTextSepList ) );
rOpt.SetMergeSeps( mxCkbAsOnce->get_active() );
rOpt.SetRemoveSpace( mxCkbRemoveSpace->get_active() );
rOpt.SetTextSep( lcl_CharFromCombo( *mxCbTextSep, gaTextSepList ) );
}
rOpt.SetQuotedAsText(pCkbQuotedAsText->IsChecked());
rOpt.SetDetectSpecialNumber(pCkbDetectNumber->IsChecked());
rOpt.SetSkipEmptyCells(pCkbSkipEmptyCells->IsChecked());
rOpt.SetQuotedAsText(mxCkbQuotedAsText->get_active());
rOpt.SetDetectSpecialNumber(mxCkbDetectNumber->get_active());
rOpt.SetSkipEmptyCells(mxCkbSkipEmptyCells->get_active());
}
void ScImportAsciiDlg::SaveParameters()
{
lcl_SaveSeparators( maFieldSeparators, pCbTextSep->GetText(), pCkbAsOnce->IsChecked(),
pCkbQuotedAsText->IsChecked(), pCkbDetectNumber->IsChecked(),
pRbFixed->IsChecked(),
static_cast<sal_Int32>(pNfRow->GetValue()),
pLbCharSet->GetSelectedEntryPos(),
static_cast<sal_uInt16>(pLbCustomLang->GetSelectedLanguage()),
pCkbSkipEmptyCells->IsChecked(), pCkbRemoveSpace->IsChecked(), meCall );
lcl_SaveSeparators( maFieldSeparators, mxCbTextSep->get_active_text(), mxCkbAsOnce->get_active(),
mxCkbQuotedAsText->get_active(), mxCkbDetectNumber->get_active(),
mxRbFixed->get_active(),
mxNfRow->get_value(),
mxLbCharSet->get_active(),
static_cast<sal_uInt16>(mxLbCustomLang->get_active_id()),
mxCkbSkipEmptyCells->get_active(), mxCkbRemoveSpace->get_active(), meCall );
}
void ScImportAsciiDlg::SetSeparators()
@@ -673,20 +635,20 @@ void ScImportAsciiDlg::SetSeparators()
{
switch( aSep[i] )
{
case '\t': pCkbTab->Check(); break;
case ';': pCkbSemicolon->Check(); break;
case ',': pCkbComma->Check(); break;
case ' ': pCkbSpace->Check(); break;
case '\t': mxCkbTab->set_active(true); break;
case ';': mxCkbSemicolon->set_active(true); break;
case ',': mxCkbComma->set_active(true); break;
case ' ': mxCkbSpace->set_active(true); break;
default:
pCkbOther->Check();
pEdOther->SetText( pEdOther->GetText() + OUStringChar(aSep[i]) );
mxCkbOther->set_active(true);
mxEdOther->set_text(mxEdOther->get_text() + OUStringChar(aSep[i]));
}
}
}
void ScImportAsciiDlg::SetSelectedCharSet()
{
meCharSet = pLbCharSet->GetSelectTextEncoding();
meCharSet = mxLbCharSet->GetSelectTextEncoding();
mbCharSetSystem = (meCharSet == RTL_TEXTENCODING_DONTKNOW);
if( mbCharSetSystem )
meCharSet = osl_getThreadTextEncoding();
@@ -695,32 +657,32 @@ void ScImportAsciiDlg::SetSelectedCharSet()
OUString ScImportAsciiDlg::GetSeparators() const
{
OUString aSepChars;
if( pCkbTab->IsChecked() )
if( mxCkbTab->get_active() )
aSepChars += "\t";
if( pCkbSemicolon->IsChecked() )
if( mxCkbSemicolon->get_active() )
aSepChars += ";";
if( pCkbComma->IsChecked() )
if( mxCkbComma->get_active() )
aSepChars += ",";
if( pCkbSpace->IsChecked() )
if( mxCkbSpace->get_active() )
aSepChars += " ";
if( pCkbOther->IsChecked() )
aSepChars += pEdOther->GetText();
if( mxCkbOther->get_active() )
aSepChars += mxEdOther->get_text();
return aSepChars;
}
void ScImportAsciiDlg::SetupSeparatorCtrls()
{
bool bEnable = pRbSeparated->IsChecked();
pCkbTab->Enable( bEnable );
pCkbSemicolon->Enable( bEnable );
pCkbComma->Enable( bEnable );
pCkbSpace->Enable( bEnable );
pCkbRemoveSpace->Enable( bEnable );
pCkbOther->Enable( bEnable );
pEdOther->Enable( bEnable );
pCkbAsOnce->Enable( bEnable );
pFtTextSep->Enable( bEnable );
pCbTextSep->Enable( bEnable );
bool bEnable = mxRbSeparated->get_active();
mxCkbTab->set_sensitive( bEnable );
mxCkbSemicolon->set_sensitive( bEnable );
mxCkbComma->set_sensitive( bEnable );
mxCkbSpace->set_sensitive( bEnable );
mxCkbRemoveSpace->set_sensitive( bEnable );
mxCkbOther->set_sensitive( bEnable );
mxEdOther->set_sensitive( bEnable );
mxCkbAsOnce->set_sensitive( bEnable );
mxFtTextSep->set_sensitive( bEnable );
mxCbTextSep->set_sensitive( bEnable );
}
void ScImportAsciiDlg::UpdateVertical()
@@ -730,86 +692,82 @@ void ScImportAsciiDlg::UpdateVertical()
mpDatStream->SetStreamCharSet(meCharSet);
}
IMPL_LINK( ScImportAsciiDlg, RbSepFixHdl, Button*, pButton, void )
IMPL_LINK(ScImportAsciiDlg, RbSepFixHdl, weld::Button&, rButton, void)
{
OSL_ENSURE( pButton, "ScImportAsciiDlg::RbSepFixHdl - missing sender" );
if( (pButton == pRbFixed) || (pButton == pRbSeparated) )
if (&rButton == mxRbFixed.get() || &rButton == mxRbSeparated.get())
{
SetPointer( PointerStyle::Wait );
if( pRbFixed->IsChecked() )
mpTableBox->SetFixedWidthMode();
weld::WaitObject aWaitObj(m_xDialog.get());
if( mxRbFixed->get_active() )
mxTableBox->SetFixedWidthMode();
else
mpTableBox->SetSeparatorsMode();
SetPointer( PointerStyle::Arrow );
mxTableBox->SetSeparatorsMode();
SetupSeparatorCtrls();
}
}
IMPL_LINK( ScImportAsciiDlg, SeparatorClickHdl, Button*, pCtrl, void )
{
SeparatorHdl(pCtrl);
}
IMPL_LINK( ScImportAsciiDlg, SeparatorComboBoxHdl, ComboBox&, rCtrl, void )
IMPL_LINK(ScImportAsciiDlg, SeparatorClickHdl, weld::Button&, rCtrl, void)
{
SeparatorHdl(&rCtrl);
}
IMPL_LINK( ScImportAsciiDlg, SeparatorEditHdl, Edit&, rEdit, void )
IMPL_LINK( ScImportAsciiDlg, SeparatorComboBoxHdl, weld::ComboBox&, rCtrl, void )
{
SeparatorHdl(&rCtrl);
}
IMPL_LINK( ScImportAsciiDlg, SeparatorEditHdl, weld::Entry&, rEdit, void )
{
SeparatorHdl(&rEdit);
}
void ScImportAsciiDlg::SeparatorHdl( const Control* pCtrl )
void ScImportAsciiDlg::SeparatorHdl(const weld::Widget* pCtrl)
{
OSL_ENSURE( pCtrl, "ScImportAsciiDlg::SeparatorHdl - missing sender" );
OSL_ENSURE( !pRbFixed->IsChecked(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" );
OSL_ENSURE( !mxRbFixed->get_active(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" );
/* #i41550# First update state of the controls. The GetSeparators()
function needs final state of the check boxes. */
if( (pCtrl == pCkbOther) && pCkbOther->IsChecked() )
pEdOther->GrabFocus();
else if( pCtrl == pEdOther )
pCkbOther->Check( !pEdOther->GetText().isEmpty() );
if (pCtrl == mxCkbOther.get() && mxCkbOther->get_active())
mxEdOther->grab_focus();
else if (pCtrl == mxEdOther.get())
mxCkbOther->set_active(!mxEdOther->get_text().isEmpty());
OUString aOldFldSeps( maFieldSeparators);
maFieldSeparators = GetSeparators();
sal_Unicode cOldSep = mcTextSep;
mcTextSep = lcl_CharFromCombo( *pCbTextSep, gaTextSepList );
mcTextSep = lcl_CharFromCombo( *mxCbTextSep, gaTextSepList );
// Any separator changed may result in completely different lines due to
// embedded line breaks.
if (cOldSep != mcTextSep || aOldFldSeps != maFieldSeparators)
UpdateVertical();
mpTableBox->Execute( CSVCMD_NEWCELLTEXTS );
mxTableBox->GetGrid().Execute( CSVCMD_NEWCELLTEXTS );
}
IMPL_LINK( ScImportAsciiDlg, CharSetHdl, ListBox&, rListBox, void )
IMPL_LINK_NOARG(ScImportAsciiDlg, CharSetHdl, weld::ComboBox&, void)
{
SvxTextEncodingBox* pCharSetBox = static_cast<SvxTextEncodingBox*>(&rListBox);
if( (pCharSetBox == pLbCharSet) && (pCharSetBox->GetSelectedEntryCount() == 1) )
if (mxLbCharSet->get_active() != -1)
{
SetPointer( PointerStyle::Wait );
weld::WaitObject aWaitObj(m_xDialog.get());
rtl_TextEncoding eOldCharSet = meCharSet;
SetSelectedCharSet();
// switching char-set invalidates 8bit -> String conversions
if (eOldCharSet != meCharSet)
UpdateVertical();
mpTableBox->Execute( CSVCMD_NEWCELLTEXTS );
SetPointer( PointerStyle::Arrow );
mxTableBox->GetGrid().Execute( CSVCMD_NEWCELLTEXTS );
}
}
IMPL_LINK( ScImportAsciiDlg, FirstRowHdl, Edit&, rEdit, void )
IMPL_LINK(ScImportAsciiDlg, FirstRowHdl, weld::SpinButton&, rNumField, void)
{
NumericField& rNumField = static_cast<NumericField&>(rEdit);
mpTableBox->Execute( CSVCMD_SETFIRSTIMPORTLINE, sal::static_int_cast<sal_Int32>( rNumField.GetValue() - 1 ) );
mxTableBox->GetGrid().Execute( CSVCMD_SETFIRSTIMPORTLINE, rNumField.get_value() - 1);
}
IMPL_LINK( ScImportAsciiDlg, LbColTypeHdl, ListBox&, rListBox, void )
IMPL_LINK(ScImportAsciiDlg, LbColTypeHdl, weld::ComboBox&, rListBox, void)
{
if( &rListBox == pLbType )
mpTableBox->Execute( CSVCMD_SETCOLUMNTYPE, rListBox.GetSelectedEntryPos() );
if (&rListBox == mxLbType.get())
mxTableBox->GetGrid().Execute(CSVCMD_SETCOLUMNTYPE, rListBox.get_active());
}
IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, ScCsvTableBox&, void)
@@ -818,10 +776,10 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, ScCsvTableBox&, void)
// when the dialog wasn't already presented to the user.
// As a side effect this has the benefit that the check is only done on the
// first set of visible lines.
sal_Unicode cDetectSep = (mbDetectSpaceSep && !pRbFixed->IsChecked() && !pCkbSpace->IsChecked() ? 0 : 0xffff);
sal_Unicode cDetectSep = (mbDetectSpaceSep && !mxRbFixed->get_active() && !mxCkbSpace->get_active() ? 0 : 0xffff);
sal_Int32 nBaseLine = mpTableBox->GetFirstVisLine();
sal_Int32 nRead = mpTableBox->GetVisLineCount();
sal_Int32 nBaseLine = mxTableBox->GetGrid().GetFirstVisLine();
sal_Int32 nRead = mxTableBox->GetGrid().GetVisLineCount();
// If mnRowPosCount==0, this is an initializing call, read ahead for row
// count and resulting scroll bar size and position to be able to scroll at
// all. When adding lines, read only the amount of next lines to be
@@ -847,33 +805,30 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, ScCsvTableBox&, void)
// GetLine()/ReadCsvLine() actually used it.
assert(maFieldSeparators.endsWith(" "));
// Preselect Space in UI.
pCkbSpace->Check();
mxCkbSpace->set_active(true);
}
}
mpTableBox->Execute( CSVCMD_SETLINECOUNT, mnRowPosCount);
bool bMergeSep = pCkbAsOnce->IsChecked();
bool bRemoveSpace = pCkbRemoveSpace->IsChecked();
mpTableBox->SetUniStrings( maPreviewLine, maFieldSeparators, mcTextSep, bMergeSep, bRemoveSpace );
mxTableBox->GetGrid().Execute( CSVCMD_SETLINECOUNT, mnRowPosCount);
bool bMergeSep = mxCkbAsOnce->get_active();
bool bRemoveSpace = mxCkbRemoveSpace->get_active();
mxTableBox->SetUniStrings( maPreviewLine, maFieldSeparators, mcTextSep, bMergeSep, bRemoveSpace );
}
IMPL_LINK( ScImportAsciiDlg, ColTypeHdl, ScCsvTableBox&, rTableBox, void )
{
sal_Int32 nType = rTableBox.GetSelColumnType();
sal_Int32 nTypeCount = pLbType->GetEntryCount();
sal_Int32 nTypeCount = mxLbType->get_count();
bool bEmpty = (nType == CSV_TYPE_MULTI);
bool bEnable = ((0 <= nType) && (nType < nTypeCount)) || bEmpty;
pFtType->Enable( bEnable );
pLbType->Enable( bEnable );
mxFtType->set_sensitive( bEnable );
mxLbType->set_sensitive( bEnable );
Link<ListBox&,void> aSelHdl = pLbType->GetSelectHdl();
pLbType->SetSelectHdl( Link<ListBox&,void>() );
if( bEmpty )
pLbType->SetNoSelection();
else if( bEnable )
pLbType->SelectEntryPos( static_cast< sal_uInt16 >( nType ) );
pLbType->SetSelectHdl( aSelHdl );
if (bEmpty)
mxLbType->set_active(-1);
else if (bEnable)
mxLbType->set_active(nType);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/AccessibleCsvControl.hxx b/sc/source/ui/inc/AccessibleCsvControl.hxx
index b01eae6..58e9035 100644
--- a/sc/source/ui/inc/AccessibleCsvControl.hxx
+++ b/sc/source/ui/inc/AccessibleCsvControl.hxx
@@ -21,13 +21,16 @@
#define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLECSVCONTROL_HXX
#include <memory>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <tools/gen.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/accessiblecomponenthelper.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <editeng/AccessibleStaticTextBase.hxx>
#include <comphelper/uno3.hxx>
#include <vcl/vclptr.hxx>
@@ -38,33 +41,19 @@ class ScCsvControl;
namespace utl { class AccessibleStateSetHelper; }
/** Accessible base class used for CSV controls. */
class ScAccessibleCsvControl : public ScAccessibleContextBase
class ScAccessibleCsvControl : public comphelper::OAccessibleComponentHelper
{
private:
VclPtr<ScCsvControl> mpControl; /// Pointer to the VCL control.
ScCsvControl* mpControl; /// Pointer to the VCL control.
public:
explicit ScAccessibleCsvControl(
const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
ScCsvControl& rControl,
sal_uInt16 nRole );
virtual ~ScAccessibleCsvControl() override;
explicit ScAccessibleCsvControl(ScCsvControl& rControl);
virtual ~ScAccessibleCsvControl() override;
using ScAccessibleContextBase::disposing;
virtual void SAL_CALL disposing() override;
virtual void SAL_CALL disposing() override;
/** Returns true, if the control is visible. */
virtual bool isVisible() override;
/** Returns true, if the control is showing. */
virtual bool isShowing() override;
// XAccessibleComponent ---------------------------------------------------
/** Returns the child at the specified point (cell returns NULL). */
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
/** Sets the focus to this control. */
virtual void SAL_CALL grabFocus() override;
virtual void SAL_CALL grabFocus( ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
// events -----------------------------------------------------------------
public:
@@ -85,38 +74,19 @@ public:
// helpers ----------------------------------------------------------------
protected:
/** Returns this object's current bounding box relative to the desktop. */
virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
/** Returns this object's current bounding box relative to the parent object. */
virtual tools::Rectangle GetBoundingBox() const override;
/** Returns whether the object is alive. Must be called with locked mutex. */
bool implIsAlive() const { return !rBHelper.bDisposed && !rBHelper.bInDispose && mpControl; }
/** @throws css::lang::DisposedException if the object is disposed/disposing or any pointer
is missing. Should be used with locked mutex! */
void ensureAlive() const;
virtual css::awt::Rectangle implGetBounds() override;
/** Returns the VCL control. Assumes a living object. */
ScCsvControl& implGetControl() const;
/** Returns the first child of rxParentObj, which has the role nRole.
@throws css::uno::RuntimeException
*/
static css::uno::Reference< css::accessibility::XAccessible > implGetChildByRole( const css::uno::Reference< css::accessibility::XAccessible >& rxParentObj, sal_uInt16 nRole );
/** Creates a StateSetHelper and fills it with DEFUNC, OPAQUE, ENABLED, SHOWING and VISIBLE. */
::utl::AccessibleStateSetHelper* implCreateStateSet();
/** Disposes the object. This is a helper called from destructors only. */
void implDispose();
/** Converts the control-relative position to an absolute screen position. */
Point implGetAbsPos( const Point& rPos ) const;
};
class ScCsvRuler;
typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleText > ScAccessibleCsvRulerImpl;
typedef ::cppu::ImplHelper2<css::accessibility::XAccessible,
css::accessibility::XAccessibleText> ScAccessibleCsvRulerImpl;
/** Accessible class representing the CSV ruler control. */
class ScAccessibleCsvRuler : public ScAccessibleCsvControl, public ScAccessibleCsvRulerImpl
@@ -129,6 +99,12 @@ public:
virtual ~ScAccessibleCsvRuler() override;
// XAccessibleComponent -----------------------------------------------------
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; }
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual sal_Int32 SAL_CALL getForeground( ) override;
@@ -142,6 +118,8 @@ public:
/** Throws an exception (the ruler does not have children). */
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 nIndex ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override { return css::accessibility::AccessibleRole::TEXT; }
/** Returns the relation to the grid control. */
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
@@ -199,24 +177,11 @@ public:
// XInterface -------------------------------------------------------------
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
virtual void SAL_CALL acquire() throw() override;
virtual void SAL_CALL release() throw() override;
// XServiceInfo -----------------------------------------------------------
/** Returns an identifier for the implementation of this object. */
virtual OUString SAL_CALL getImplementationName() override;
DECLARE_XINTERFACE()
// XTypeProvider ----------------------------------------------------------
/** Returns a sequence with all supported interface types. */
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
/** Returns an implementation ID. */
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
DECLARE_XTYPEPROVIDER()
// events -----------------------------------------------------------------
public:
@@ -225,10 +190,6 @@ public:
// helpers ----------------------------------------------------------------
private:
/** Returns this object's name. */
virtual OUString createAccessibleName() override;
/** Returns this object's description. */
virtual OUString createAccessibleDescription() override;
/** @throws css::lang::IndexOutOfBoundsException if the specified character position is invalid (outside 0..len-1). */
void ensureValidIndex( sal_Int32 nIndex ) const;
@@ -259,8 +220,10 @@ private:
};
class ScCsvGrid;
class ScAccessibleCsvCell;
typedef ::cppu::ImplHelper2<
typedef ::cppu::ImplHelper3<
css::accessibility::XAccessible,
css::accessibility::XAccessibleTable,
css::accessibility::XAccessibleSelection >
ScAccessibleCsvGridImpl;
@@ -269,7 +232,7 @@ typedef ::cppu::ImplHelper2<
class ScAccessibleCsvGrid : public ScAccessibleCsvControl, public ScAccessibleCsvGridImpl
{
protected:
typedef std::map< sal_Int32, rtl::Reference<ScAccessibleCsvControl> > XAccessibleSet;
typedef std::map< sal_Int32, rtl::Reference<ScAccessibleCsvCell> > XAccessibleSet;
private:
XAccessibleSet maAccessibleChildren;
@@ -277,18 +240,25 @@ private:
public:
explicit ScAccessibleCsvGrid( ScCsvGrid& rGrid );
virtual ~ScAccessibleCsvGrid() override;
using ScAccessibleContextBase::disposing;
virtual void SAL_CALL disposing() override;
// XAccessibleComponent ---------------------------------------------------
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; }
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
/** Returns the cell at the specified point. */
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual sal_Int32 SAL_CALL getForeground( ) override;
virtual sal_Int32 SAL_CALL getBackground( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override { return css::accessibility::AccessibleRole::TABLE; }
// XAccessibleContext -----------------------------------------------------
/** Returns the child count (count of cells in the table). */
@@ -395,11 +365,6 @@ public:
virtual void SAL_CALL release() throw() override;
// XServiceInfo -----------------------------------------------------------
/** Returns an identifier for the implementation of this object. */
virtual OUString SAL_CALL getImplementationName() override;
// XTypeProvider ----------------------------------------------------------
/** Returns a sequence with all supported interface types. */
@@ -421,10 +386,6 @@ public:
// helpers ----------------------------------------------------------------
private:
/** Returns this object's name. */
virtual OUString createAccessibleName() override;
/** Returns this object's description. */
virtual OUString createAccessibleDescription() override;
/** @throws css::lang::IndexOutOfBoundsException if nIndex is not a valid child index. */
void ensureValidIndex( sal_Int32 nIndex ) const;
@@ -460,13 +421,17 @@ private:
/** Returns the contents of the specified cell (including header). Indexes must be valid. */
OUString implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const;
/** Creates a new accessible object of the specified cell. Indexes must be valid. */
ScAccessibleCsvControl* implCreateCellObj( sal_Int32 nRow, sal_Int32 nColumn ) const;
ScAccessibleCsvCell* implCreateCellObj(sal_Int32 nRow, sal_Int32 nColumn);
css::uno::Reference<css::accessibility::XAccessible> getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn);
};
typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> ScAccessibleCsvCellImpl;
/** Accessible class representing a cell of the CSV grid control. */
class ScAccessibleCsvCell : public ScAccessibleCsvControl, public accessibility::AccessibleStaticTextBase
class ScAccessibleCsvCell : public ScAccessibleCsvControl
, public ScAccessibleCsvCellImpl
, public ::accessibility::AccessibleStaticTextBase
{
protected:
typedef ::std::unique_ptr< SvxEditSource > SvxEditSourcePtr;
@@ -481,10 +446,9 @@ public:
explicit ScAccessibleCsvCell(
ScCsvGrid& rGrid,
const OUString& rCellText,
sal_Int32 nRow, sal_Int32 nColumn );
sal_Int32 nRow, sal_Int32 nColumn);
virtual ~ScAccessibleCsvCell() override;
using ScAccessibleCsvControl::disposing;
virtual void SAL_CALL disposing() override;
// XAccessibleComponent ---------------------------------------------------
@@ -492,6 +456,14 @@ public:
/** Sets the focus to the column of this cell. */
virtual void SAL_CALL grabFocus() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; }
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override { return css::accessibility::AccessibleRole::TEXT; }
virtual sal_Int32 SAL_CALL getForeground( ) override;
virtual sal_Int32 SAL_CALL getBackground( ) override;
@@ -521,24 +493,7 @@ public:
DECLARE_XTYPEPROVIDER()
// XServiceInfo -----------------------------------------------------------
/** Returns an identifier for the implementation of this object. */
virtual OUString SAL_CALL getImplementationName() override;
// helpers ----------------------------------------------------------------
protected:
/** Returns this object's current bounding box relative to the desktop. */
virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
/** Returns this object's current bounding box relative to the parent object. */
virtual tools::Rectangle GetBoundingBox() const override;
private:
/** Returns this object's name. */
virtual OUString createAccessibleName() override;
/** Returns this object's description. */
virtual OUString createAccessibleDescription() override;
/** Returns the VCL grid control. Assumes a living object. */
ScCsvGrid& implGetGrid() const;
/** Returns the pixel position of the cell (rel. to parent), regardless of visibility. */
@@ -548,7 +503,7 @@ private:
/** Returns the pixel size of the cell, regardless of visibility. */
Size implGetRealSize() const;
/** Returns the bounding box of the cell relative in the table. */
tools::Rectangle implGetBoundingBox() const;
virtual css::awt::Rectangle implGetBounds() override;
/** Creates the edit source the text helper needs. */
::std::unique_ptr< SvxEditSource > implCreateEditSource();
diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx
index 8a5f77f..a7d7a97 100644
--- a/sc/source/ui/inc/csvcontrol.hxx
+++ b/sc/source/ui/inc/csvcontrol.hxx
@@ -26,8 +26,10 @@
#include "csvsplits.hxx"
#include <com/sun/star/uno/Reference.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <rtl/ref.hxx>
#include <vcl/customweld.hxx>
#include "AccessibleCsvControl.hxx"
class ScAccessibleCsvControl;
namespace com { namespace sun { namespace star { namespace accessibility {
class XAccessible;
} } } }
@@ -222,21 +224,21 @@ inline void ScCsvCmd::Set( ScCsvCmdType eType, sal_Int32 nParam1, sal_Int32 nPar
}
/** Base class for the CSV ruler and the data grid control. Implements command handling. */
class SC_DLLPUBLIC ScCsvControl : public Control
class SC_DLLPUBLIC ScCsvControl : public weld::CustomWidgetController
{
private:
Link<ScCsvControl&,void> maCmdHdl; /// External command handler.
ScCsvCmd maCmd; /// Data of last command.
const ScCsvLayoutData& mrData; /// Shared layout data.
rtl::Reference<ScAccessibleCsvControl> mxAccessible; /// Reference to the accessible implementation object.
bool mbValidGfx; /// Content of virtual devices valid?
protected:
rtl::Reference<ScAccessibleCsvControl> mxAccessible; /// Reference to the accessible implementation object.
public:
explicit ScCsvControl( ScCsvControl& rParent );
explicit ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& rData, WinBits nBits );
explicit ScCsvControl(const ScCsvLayoutData& rData);
virtual ~ScCsvControl() override;
virtual void dispose() override;
// event handling ---------------------------------------------------------
@@ -258,6 +260,8 @@ public:
/** Sends a table model changed event for a removed column to the accessibility object. */
void AccSendRemoveColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn );
ScAccessibleCsvControl* GetAccessible() { return mxAccessible.get(); }
// repaint helpers --------------------------------------------------------
/** Sets the graphic invalid (next Redraw() will not use cached graphic). */
@@ -369,17 +373,6 @@ public:
/** Returns direction code for the keys UP, DOWN, HOME, END, PAGE UP, PAGE DOWN.
@param bHomeEnd false = ignore HOME and END key. */
static ScMoveMode GetVertDirection( sal_uInt16 nCode, bool bHomeEnd );
// accessibility ----------------------------------------------------------
public:
/** Creates and returns the accessible object of this control. Do not overwrite in
derived classes, use ImplCreateAccessible() instead. */
virtual css::uno::Reference< css::accessibility::XAccessible >
CreateAccessible() override;
protected:
/** Derived classes create a new accessible object here. */
virtual rtl::Reference<ScAccessibleCsvControl> ImplCreateAccessible() = 0;
};
#endif
diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx
index 6416133..77f5c74 100644
--- a/sc/source/ui/inc/csvgrid.hxx
+++ b/sc/source/ui/inc/csvgrid.hxx
@@ -35,6 +35,7 @@ namespace svtools { class ColorConfig; }
class EditEngine;
class ScAsciiOptions;
class ScAccessibleCsvControl;
class ScCsvTableBox;
const sal_uInt32 CSV_COLUMN_INVALID = CSV_VEC_NOTFOUND;
@@ -60,9 +61,10 @@ class SC_DLLPUBLIC ScCsvGrid : public ScCsvControl, public utl::ConfigurationLis
private:
typedef ::std::unique_ptr< ScEditEngineDefaulter > ScEditEnginePtr;
ScCsvTableBox* mpTableBox; /// Grid Parent
VclPtr<VirtualDevice> mpBackgrDev; /// Grid background, headers, cell texts.
VclPtr<VirtualDevice> mpGridDev; /// Data grid with selection and cursor.
VclPtr<PopupMenu> mpPopup; /// Popup menu for column types.
std::unique_ptr<weld::Menu> mxPopup; /// Popup menu for column types.
::svtools::ColorConfig* mpColorConfig; /// Application color configuration.
Color maBackColor; /// Cell background color.
@@ -76,7 +78,7 @@ private:
Color maSelectColor; /// Header color of selected columns.
ScEditEnginePtr mpEditEngine; /// For drawing cell texts.
vcl::Font const maHeaderFont; /// Font for column and row headers.
vcl::Font maHeaderFont; /// Font for column and row headers.
vcl::Font maMonoFont; /// Monospace font for data cells.
Size maWinSize; /// Size of the control.
Size maEdEngSize; /// Paper size for edit engine.
@@ -89,12 +91,14 @@ private:
sal_Int32 mnFirstImpLine; /// First imported line (0-based).
sal_uInt32 mnRecentSelCol; /// Index of most recently selected column.
sal_uInt32 mnMTCurrCol; /// Current column of mouse tracking.
bool mbMTSelecting; /// Mouse tracking: true = select, false = deselect.
bool mbTracking; /// True if Mouse tracking
bool mbMTSelecting; /// Mouse tracking mode: true = select, false = deselect.
public:
explicit ScCsvGrid( ScCsvControl& rParent );
virtual ~ScCsvGrid() override;
virtual void dispose() override;
explicit ScCsvGrid(const ScCsvLayoutData& rData, std::unique_ptr<weld::Menu> xPopup, ScCsvTableBox* pTableBox);
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
ScCsvTableBox* GetTableBox() { return mpTableBox; }
virtual ~ScCsvGrid() override;
/** Finishes initialization. Must be called after constructing a new object. */
void Init();
@@ -247,12 +251,15 @@ protected:
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void Tracking( const TrackingEvent& rTEvt ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
virtual void Command( const CommandEvent& rCEvt ) override;
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseMove( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
virtual bool Command( const CommandEvent& rCEvt ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual tools::Rectangle GetFocusRect() override;
virtual void StyleUpdated() override;
virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
@@ -262,7 +269,7 @@ protected:
public:
/** Redraws the entire data grid. */
void ImplRedraw();
void ImplRedraw(vcl::RenderContext& rRenderContext);
/** Returns a pointer to the used edit engine. */
EditEngine* GetEditEngine();
@@ -302,13 +309,10 @@ private:
/** Inverts the cursor bar at the specified position in maGridDev. */
SAL_DLLPRIVATE void ImplInvertCursor( sal_Int32 nPos );
/** Draws directly tracking rectangle to the column with the specified index. */
SAL_DLLPRIVATE void ImplDrawTrackingRect( sal_uInt32 nColIndex );
// accessibility ----------------------------------------------------------
protected:
/** Creates a new accessible object. */
virtual rtl::Reference<ScAccessibleCsvControl> ImplCreateAccessible() override;
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
};
#endif
diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx
index fc7efc8..1d5f078 100644
--- a/sc/source/ui/inc/csvruler.hxx
+++ b/sc/source/ui/inc/csvruler.hxx
@@ -27,12 +27,15 @@
#include <vcl/virdev.hxx>
class ScAccessibleCsvControl;
class ScCsvTableBox;
/** A ruler control for the CSV import dialog. Supports setting and moving
splits (which divide lines of data into several columns). */
class SC_DLLPUBLIC ScCsvRuler : public ScCsvControl
{
private:
ScCsvTableBox* mpTableBox; /// Grid Parent
ScopedVclPtrInstance<VirtualDevice> maBackgrDev;/// Ruler background, scaling.
ScopedVclPtrInstance<VirtualDevice> maRulerDev; /// Ruler with splits and cursor.
@@ -50,22 +53,18 @@ private:
bool mbPosMTMoved; /// Tracking: Anytime moved to another position?
Size maWinSize; /// Size of the control.
tools::Rectangle maActiveRect; /// The active area of the ruler.
tools::Rectangle maActiveRect; /// The active area of the ruler.
sal_Int32 mnSplitSize; /// Size of a split circle.
bool mbTracking; /// If currently mouse tracking
public:
explicit ScCsvRuler( ScCsvControl& rParent );
virtual ~ScCsvRuler() override;
virtual void dispose() override;
explicit ScCsvRuler(ScCsvLayoutData& rData, ScCsvTableBox* pTableBox);
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
ScCsvTableBox* GetTableBox() { return mpTableBox; }
virtual ~ScCsvRuler() override;
// common ruler handling --------------------------------------------------
public:
/** Sets position and size of the ruler. The height is calculated internally. */
virtual void setPosSizePixel(
long nX, long nY,
long nWidth, long nHeight,
PosSizeFlags nFlags = PosSizeFlags::All ) override;
/** Apply current layout data to the ruler. */
void ApplyLayout( const ScCsvLayoutData& rOldData );
@@ -123,13 +122,15 @@ protected:
virtual void Resize() override;
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual void StyleUpdated() override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void MouseMove( const MouseEvent& rMEvt ) override;
virtual void Tracking( const TrackingEvent& rTEvt ) override;
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseMove( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
virtual tools::Rectangle GetFocusRect() override;
private:
/** Starts tracking at the specified position. */
@@ -146,7 +147,7 @@ protected:
public:
/** Redraws the entire ruler. */
void ImplRedraw();
void ImplRedraw(vcl::RenderContext& rRenderContext);
private:
/** Returns the width of the control. */
@@ -175,7 +176,7 @@ private:
// accessibility ----------------------------------------------------------
protected:
/** Creates a new accessible object. */
virtual rtl::Reference<ScAccessibleCsvControl> ImplCreateAccessible() override;
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
};
#endif
diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx
index 0f9d8ac..67506f1 100644
--- a/sc/source/ui/inc/csvtablebox.hxx
+++ b/sc/source/ui/inc/csvtablebox.hxx
@@ -20,15 +20,17 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_CSVTABLEBOX_HXX
#define INCLUDED_SC_SOURCE_UI_INC_CSVTABLEBOX_HXX
#include <vcl/scrbar.hxx>
#include <vcl/vclptr.hxx>
#include <vcl/idle.hxx>
#include <vcl/weld.hxx>
#include <scdllapi.h>
#include "csvcontrol.hxx"
#include "csvruler.hxx"
#include "csvgrid.hxx"
class ListBox;
class ScAsciiOptions;
namespace weld {
class ComboBox;
}
/* ============================================================================
Position: Positions between the characters (the dots in the ruler).
@@ -39,20 +41,22 @@ Column: The range between two splits.
/** The control in the CSV import dialog that contains a ruler and a data grid
to visualize and modify the current import settings. */
class SC_DLLPUBLIC ScCsvTableBox : public ScCsvControl
class SC_DLLPUBLIC ScCsvTableBox
{
private:
ScCsvLayoutData maData; /// Current layout data of the controls.
VclPtr<ScCsvRuler> maRuler; /// The ruler for fixed width mode.
VclPtr<ScCsvGrid> maGrid; /// Calc-like data table for fixed width mode.
VclPtr<ScrollBar> maHScroll; /// Horizontal scroll bar.
VclPtr<ScrollBar> maVScroll; /// Vertical scroll bar.
VclPtr<ScrollBarBox> maScrollBox; /// For the bottom right edge.
std::unique_ptr<ScCsvRuler> mxRuler; /// The ruler for fixed width mode.
std::unique_ptr<ScCsvGrid> mxGrid; /// Calc-like data table for fixed width mode.
std::unique_ptr<weld::ScrolledWindow> mxScroll; /// Scrolled Window
std::unique_ptr<weld::CustomWeld> mxRulerWeld; /// Connect the ruler to its drawingarea
std::unique_ptr<weld::CustomWeld> mxGridWeld; /// connect the grid to its drawingarea
Link<ScCsvTableBox&,void> maUpdateTextHdl; /// Updates all cell texts.
Link<ScCsvTableBox&,void> maColTypeHdl; /// Handler for exporting the column type.
Idle maEndScrollIdle; /// Called when horizontal scrolling has ended
ScCsvColStateVec maFixColStates; /// Column states in fixed width mode.
ScCsvColStateVec maSepColStates; /// Column states in separators mode.
@@ -61,12 +65,8 @@ private:
bool mbFixedMode; /// false = Separators, true = Fixed width.
public:
explicit ScCsvTableBox( vcl::Window* pParent, WinBits nBits );
virtual ~ScCsvTableBox() override;
virtual void dispose() override;
// workaround VS2013 bug in handling virtual bases
ScCsvTableBox( const ScCsvTableBox& ) = delete;
explicit ScCsvTableBox(weld::Builder& rBuilder);
~ScCsvTableBox();
/** Finishes initialization. Must be called after constructing a new object. */
void Init();
@@ -78,9 +78,13 @@ public:
/** Sets the control to fixed width mode. */
void SetFixedWidthMode();
private:
ScCsvRuler& GetRuler() { return *mxRuler; }
ScCsvGrid& GetGrid() { return *mxGrid; }
/** Initializes the children controls (pos/size, scroll bars, ...). */
SAL_DLLPRIVATE void InitControls();
private:
/** Initializes size and position data of horizontal scrollbar. */
SAL_DLLPRIVATE void InitHScrollBar();
/** Initializes size and position data of vertical scrollbar. */
@@ -88,10 +92,10 @@ private:
/** Calculates and sets valid position offset nearest to nPos. */
SAL_DLLPRIVATE void ImplSetPosOffset( sal_Int32 nPos )
{ maData.mnPosOffset = std::max( std::min( nPos, GetMaxPosOffset() ), sal_Int32( 0 ) ); }
{ maData.mnPosOffset = std::max( std::min( nPos, mxGrid->GetMaxPosOffset() ), sal_Int32( 0 ) ); }
/** Calculates and sets valid line offset nearest to nLine. */
SAL_DLLPRIVATE void ImplSetLineOffset( sal_Int32 nLine )
{ maData.mnLineOffset = std::max( std::min( nLine, GetMaxLineOffset() ), sal_Int32( 0 ) ); }
{ maData.mnLineOffset = std::max( std::min( nLine, mxGrid->GetMaxLineOffset() ), sal_Int32( 0 ) ); }
/** Moves controls (not cursors!) so that nPos becomes visible. */
SAL_DLLPRIVATE void MakePosVisible( sal_Int32 nPos );
@@ -105,9 +109,9 @@ public:
// column settings --------------------------------------------------------
public:
/** Reads UI strings for data types from the list box. */
void InitTypes( const ListBox& rListBox );
void InitTypes(const weld::ComboBox& rListBox);
/** Returns the data type of the selected columns. */
sal_Int32 GetSelColumnType() const { return maGrid->GetSelColumnType(); }
sal_Int32 GetSelColumnType() const { return mxGrid->GetSelColumnType(); }
/** Fills the options object with current column data. */
void FillColumnData( ScAsciiOptions& rOptions ) const;
@@ -119,25 +123,11 @@ public:
/** Sets a new handler for "column selection changed" events. */
void SetColTypeHdl( const Link<ScCsvTableBox&,void>& rHdl ) { maColTypeHdl = rHdl; }
protected:
virtual void Resize() override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual Size GetOptimalSize() const override;
private:
DECL_DLLPRIVATE_LINK( CsvCmdHdl, ScCsvControl&, void );
DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void );
DECL_DLLPRIVATE_LINK( ScrollEndHdl, ScrollBar*, void );
// accessibility ----------------------------------------------------------
public:
/** Creates and returns the accessible object of this control. */
virtual css::uno::Reference< css::accessibility::XAccessible >
CreateAccessible() override;
protected:
/** Creates a new accessible object. */
virtual rtl::Reference<ScAccessibleCsvControl> ImplCreateAccessible() override;
DECL_DLLPRIVATE_LINK( HScrollHdl, weld::ScrolledWindow&, void );
DECL_DLLPRIVATE_LINK( VScrollHdl, weld::ScrolledWindow&, void );
DECL_DLLPRIVATE_LINK( ScrollEndHdl, Timer*, void );
};
#endif
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx
index 765b0b9..f37e358 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -20,9 +20,10 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
#define INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
#include <vcl/dialog.hxx>
#include <svx/langbox.hxx>
#include <tools/stream.hxx>
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
#include "asciiopt.hxx"
@@ -34,9 +35,9 @@ class RadioButton;
class NumericField;
class ScCsvTableBox;
class SvxTextEncodingBox;
class TextEncodingBox;
class ScImportAsciiDlg : public ModalDialog
class ScImportAsciiDlg : public weld::GenericDialogController
{
SvStream* mpDatStream;
sal_uLong mnStreamPos;
@@ -45,41 +46,6 @@ class ScImportAsciiDlg : public ModalDialog
OUString maPreviewLine[ CSV_PREVIEW_LINES ];
VclPtr<FixedText> pFtCharSet;
VclPtr<SvxTextEncodingBox> pLbCharSet;
VclPtr<FixedText> pFtCustomLang;
VclPtr<SvxLanguageBox> pLbCustomLang;
VclPtr<FixedText> pFtRow;
VclPtr<NumericField> pNfRow;
VclPtr<RadioButton> pRbFixed;
VclPtr<RadioButton> pRbSeparated;
VclPtr<CheckBox> pCkbTab;
VclPtr<CheckBox> pCkbSemicolon;
VclPtr<CheckBox> pCkbComma;
VclPtr<CheckBox> pCkbRemoveSpace;
VclPtr<CheckBox> pCkbSpace;
VclPtr<CheckBox> pCkbOther;
VclPtr<Edit> pEdOther;
VclPtr<CheckBox> pCkbAsOnce;
VclPtr<FixedText> pFtTextSep;
VclPtr<ComboBox> pCbTextSep;
VclPtr<CheckBox> pCkbQuotedAsText;
VclPtr<CheckBox> pCkbDetectNumber;
VclPtr<CheckBox> pCkbSkipEmptyCells;
VclPtr<FixedText> pFtType;
VclPtr<ListBox> pLbType;
VclPtr<ScCsvTableBox> mpTableBox;
OUString maFieldSeparators; // selected field separators
sal_Unicode mcTextSep;
@@ -88,12 +54,44 @@ class ScImportAsciiDlg : public ModalDialog
ScImportAsciiCall const meCall; /// How the dialog is called (see asciiopt.hxx)
bool mbDetectSpaceSep; /// Whether to detect a possible space separator.
std::unique_ptr<weld::Label> mxFtCharSet;
std::unique_ptr<TextEncodingBox> mxLbCharSet;
std::unique_ptr<weld::Label> mxFtCustomLang;
std::unique_ptr<LanguageBox> mxLbCustomLang;
std::unique_ptr<weld::Label> mxFtRow;
std::unique_ptr<weld::SpinButton> mxNfRow;
std::unique_ptr<weld::RadioButton> mxRbFixed;
std::unique_ptr<weld::RadioButton> mxRbSeparated;
std::unique_ptr<weld::CheckButton> mxCkbTab;
std::unique_ptr<weld::CheckButton> mxCkbSemicolon;
std::unique_ptr<weld::CheckButton> mxCkbComma;
std::unique_ptr<weld::CheckButton> mxCkbRemoveSpace;
std::unique_ptr<weld::CheckButton> mxCkbSpace;
std::unique_ptr<weld::CheckButton> mxCkbOther;
std::unique_ptr<weld::Entry> mxEdOther;
std::unique_ptr<weld::CheckButton> mxCkbAsOnce;
std::unique_ptr<weld::Label> mxFtTextSep;
std::unique_ptr<weld::ComboBox> mxCbTextSep;
std::unique_ptr<weld::CheckButton> mxCkbQuotedAsText;
std::unique_ptr<weld::CheckButton> mxCkbDetectNumber;
std::unique_ptr<weld::CheckButton> mxCkbSkipEmptyCells;
std::unique_ptr<weld::Label> mxFtType;
std::unique_ptr<weld::ComboBox> mxLbType;
std::unique_ptr<weld::Label> mxAltTitle;
std::unique_ptr<ScCsvTableBox> mxTableBox;
public:
ScImportAsciiDlg(
vcl::Window* pParent, const OUString& aDatName,
weld::Window* pParent, const OUString& aDatName,
SvStream* pInStream, ScImportAsciiCall eCall );
virtual ~ScImportAsciiDlg() override;
virtual void dispose() override;
void GetOptions( ScAsciiOptions& rOpt );
void SaveParameters();
@@ -113,14 +111,14 @@ private:
void UpdateVertical();
inline bool Seek( sal_uLong nPos ); // synced to and from mnStreamPos
DECL_LINK( CharSetHdl, ListBox&, void );
DECL_LINK( FirstRowHdl, Edit&, void );
DECL_LINK( RbSepFixHdl, Button*, void );
DECL_LINK( SeparatorEditHdl, Edit&, void );
DECL_LINK( SeparatorClickHdl, Button*, void );
DECL_LINK( SeparatorComboBoxHdl, ComboBox&, void );
void SeparatorHdl(const Control*);
DECL_LINK( LbColTypeHdl, ListBox&, void );
DECL_LINK( CharSetHdl, weld::ComboBox&, void );
DECL_LINK( FirstRowHdl, weld::SpinButton&, void );
DECL_LINK( RbSepFixHdl, weld::Button&, void );
DECL_LINK( SeparatorEditHdl, weld::Entry&, void );
DECL_LINK( SeparatorClickHdl, weld::Button&, void );
DECL_LINK( SeparatorComboBoxHdl, weld::ComboBox&, void );
void SeparatorHdl(const weld::Widget*);
DECL_LINK( LbColTypeHdl, weld::ComboBox&, void );
DECL_LINK( UpdateTextHdl, ScCsvTableBox&, void );
DECL_LINK( ColTypeHdl, ScCsvTableBox&, void );
};
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index b6a42b8..20701fd 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -187,7 +187,8 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
if ( xInputStream.is() )
pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(nullptr, aPrivDatName, pInStream.get(), SC_IMPORTFILE));
ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(Application::GetFrameWeld(xDialogParent), aPrivDatName,
pInStream.get(), SC_IMPORTFILE));
if ( pDlg->Execute() == RET_OK )
{
ScAsciiOptions aOptions;
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index d697762..3e9cb3d 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -1016,7 +1016,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(
nullptr, OUString(), &aStream, SC_TEXTTOCOLUMNS));
pTabViewShell->GetFrameWeld(), OUString(), &aStream, SC_TEXTTOCOLUMNS));
if ( pDlg->Execute() == RET_OK )
{
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 5894acc..2cc61bc 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -345,7 +345,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
VclPtr<AbstractScImportAsciiDlg> pDlg(
pFact->CreateScImportAsciiDlg(pParent, OUString(), pStrm.get(), SC_PASTETEXT));
pFact->CreateScImportAsciiDlg(pParent ? pParent->GetFrameWeld() : nullptr, OUString(), pStrm.get(), SC_PASTETEXT));
bAllowDialogs = bAllowDialogs && !SC_MOD()->IsInExecuteDrop();
diff --git a/sc/uiconfig/scalc/ui/textimportcsv.ui b/sc/uiconfig/scalc/ui/textimportcsv.ui
index a756f58..948c533 100644
--- a/sc/uiconfig/scalc/ui/textimportcsv.ui
+++ b/sc/uiconfig/scalc/ui/textimportcsv.ui
@@ -2,7 +2,6 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">4294967295</property>
@@ -10,10 +9,23 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkDialog" id="TextImportCsvDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="textimportcsv|TextImportCsvDialog">Text Import</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
@@ -149,7 +161,7 @@
</packing>
</child>
<child>
<object class="svxlo-SvxTextEncodingBox" id="charset">
<object class="GtkComboBoxText" id="charset">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -159,7 +171,7 @@
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageBox" id="language">
<object class="GtkComboBoxText" id="language">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -256,7 +268,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">tofixedwidth</property>
</object>
<packing>
<property name="expand">False</property>
@@ -466,6 +477,7 @@
<object class="GtkEntry" id="comboboxtext-entry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<property name="width_chars">1</property>
</object>
</child>
</object>
@@ -639,7 +651,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="columntype">
<object class="GtkComboBoxText" id="columntype">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -657,11 +669,56 @@
</packing>
</child>
<child>
<object class="sclo-ScCsvTableBox" id="scrolledwindowcolumntype">
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hadjustment">adjustment2</property>
<property name="vadjustment">adjustment3</property>
<property name="hscrollbar_policy">always</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkDrawingArea" id="csvruler">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="csvgrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -723,4 +780,8 @@
<widget name="texttextdelimiter"/>
</widgets>
</object>
<object class="GtkMenu" id="popup">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</interface>
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr
index 1dd2ce6..6295b93 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -216,7 +216,6 @@ sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='nopages'] orphan-labe
sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='nocells'] orphan-label
sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='nosheets'] orphan-label
sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='noformula'] orphan-label
sc/uiconfig/scalc/ui/textimportcsv.ui://sclo-ScCsvTableBox[@id='scrolledwindowcolumntype'] no-labelled-by
sc/uiconfig/scalc/ui/textimportcsv.ui://GtkLabel[@id='textalttitle'] orphan-label
sc/uiconfig/scalc/ui/texttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label
sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkEntry[@id='min'] no-labelled-by