summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-06-04 18:49:45 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-06-18 15:27:57 +0200
commit6b8c90a370c197190491c1075a4e1a3f2967d48b (patch)
tree2ebd652f57037808fe85c30f2e010a89ac3ed026 /vcl/unx
parenta2318dcff64e67b32e80ba3561ab25fb2f10cfab (diff)
Start folding KDE5FilePicker2 into KDE5FilePicker
Change-Id: I1004ccba52fb23549dd85c20068da5c62d7bc964
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/kde5/KDE5FilePicker.cxx44
-rw-r--r--vcl/unx/kde5/KDE5FilePicker.hxx118
-rw-r--r--vcl/unx/kde5/KDE5FilePicker2.cxx103
-rw-r--r--vcl/unx/kde5/KDE5FilePicker2.hxx133
4 files changed, 163 insertions, 235 deletions
diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index bda9de9b9ae3..bfbe56304d0d 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -34,32 +34,6 @@
// KDE5FilePicker
-KDE5FilePicker::KDE5FilePicker(QObject* parent)
- : QObject(parent)
- , _dialog(new QFileDialog(nullptr, {}, QDir::homePath()))
- , _extraControls(new QWidget)
- , _layout(new QGridLayout(_extraControls))
- , _winId(0)
- , allowRemoteUrls(false)
-{
- _dialog->setSupportedSchemes({
- QStringLiteral("file"),
- QStringLiteral("ftp"),
- QStringLiteral("http"),
- QStringLiteral("https"),
- QStringLiteral("webdav"),
- QStringLiteral("webdavs"),
- QStringLiteral("smb"),
- });
-
- setMultiSelectionMode(false);
-
- connect(_dialog, &QFileDialog::filterSelected, this, &KDE5FilePicker::filterChanged);
- connect(_dialog, &QFileDialog::fileSelected, this, &KDE5FilePicker::selectionChanged);
-
- qApp->installEventFilter(this);
-}
-
void KDE5FilePicker::enableFolderMode()
{
_dialog->setOption(QFileDialog::ShowDirsOnly, true);
@@ -72,9 +46,9 @@ KDE5FilePicker::~KDE5FilePicker()
delete _dialog;
}
-void KDE5FilePicker::setTitle(const QString& title) { _dialog->setWindowTitle(title); }
+//void KDE5FilePicker::setTitle(const QString& title) { _dialog->setWindowTitle(title); }
-bool KDE5FilePicker::execute()
+/*bool KDE5FilePicker::execute()
{
if (!_filters.isEmpty())
_dialog->setNameFilters(_filters);
@@ -133,7 +107,7 @@ QString KDE5FilePicker::getCurrentFilter() const
return filter;
}
-void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/, bool value)
+void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, bool value)
{
if (_customWidgets.contains(controlId))
{
@@ -145,7 +119,7 @@ void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/,
qWarning() << "set value on unknown control" << controlId;
}
-bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/) const
+bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) const
{
bool ret = false;
if (_customWidgets.contains(controlId))
@@ -193,9 +167,9 @@ QString KDE5FilePicker::getLabel(sal_Int16 controlId) const
qWarning() << "get label on unknown control" << controlId;
return label;
-}
+}*/
-void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool hidden)
+/*void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool hidden)
{
auto resString = label;
resString.replace('~', '&');
@@ -207,9 +181,9 @@ void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool
_layout->addWidget(widget);
}
_customWidgets.insert(controlId, widget);
-}
+}*/
-void KDE5FilePicker::initialize(bool saveDialog)
+/*void KDE5FilePicker::initialize(bool saveDialog)
{
//default is opening
QFileDialog::AcceptMode operationMode
@@ -222,7 +196,7 @@ void KDE5FilePicker::initialize(bool saveDialog)
_dialog->setConfirmOverwrite(true);
_dialog->setFileMode(QFileDialog::AnyFile);
}
-}
+}*/
void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; }
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index d999f7bf7a09..ea18b3298ed4 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -19,21 +19,43 @@
#pragma once
+#include <cppuhelper/compbase.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <osl/conditn.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <functional>
+
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QHash>
-#include <sal/types.h>
-
class QFileDialog;
-class QWidget;
class QGridLayout;
+class QWidget;
+
+typedef ::cppu::WeakComponentImplHelper<css::ui::dialogs::XFilePicker3,
+ css::ui::dialogs::XFilePickerControlAccess
+ // TODO css::ui::dialogs::XFilePreview
+ ,
+ css::lang::XInitialization, css::lang::XServiceInfo>
+ KDE5FilePicker_Base;
-class KDE5FilePicker : public QObject
+class KDE5FilePicker : public QObject, public KDE5FilePicker_Base
{
Q_OBJECT
protected:
+ css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener;
+ osl::Mutex _helperMutex;
+
//the dialog to display
QFileDialog* _dialog;
@@ -58,53 +80,89 @@ protected:
bool allowRemoteUrls;
public:
- explicit KDE5FilePicker(QObject* parent = nullptr);
- ~KDE5FilePicker() override;
+ explicit KDE5FilePicker(const css::uno::Reference<css::uno::XComponentContext>&);
+ virtual ~KDE5FilePicker() override;
void enableFolderMode();
+ // XFilePickerNotifier
+ virtual void SAL_CALL addFilePickerListener(
+ const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
+ virtual void SAL_CALL removeFilePickerListener(
+ const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
+
// XExecutableDialog functions
- void setTitle(const QString& rTitle);
- bool execute();
+ virtual void SAL_CALL setTitle(const OUString& rTitle) override;
+ virtual sal_Int16 SAL_CALL execute() override;
// XFilePicker functions
- void setMultiSelectionMode(bool bMode);
- void setDefaultName(const QString& rName);
- void setDisplayDirectory(const QString& rDirectory);
- QString getDisplayDirectory() const;
+ virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
+ virtual void SAL_CALL setDefaultName(const OUString& rName) override;
+ virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override;
+ virtual OUString SAL_CALL getDisplayDirectory() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override;
// XFilterManager functions
- void appendFilter(const QString& rTitle, const QString& rFilter);
- void setCurrentFilter(const QString& rTitle);
- QString getCurrentFilter() const;
+ virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override;
+ virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override;
+ virtual OUString SAL_CALL getCurrentFilter() override;
+
+ // XFilterGroupManager functions
+ virtual void SAL_CALL
+ appendFilterGroup(const OUString& rGroupTitle,
+ const css::uno::Sequence<css::beans::StringPair>& rFilters) override;
// XFilePickerControlAccess functions
- void setValue(sal_Int16 nControlId, sal_Int16 nControlAction, bool rValue);
- bool getValue(sal_Int16 nControlId, sal_Int16 nControlAction) const;
- void enableControl(sal_Int16 nControlId, bool bEnable);
- void setLabel(sal_Int16 nControlId, const QString& rLabel);
- QString getLabel(sal_Int16 nControlId) const;
+ virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction,
+ const css::uno::Any& rValue) override;
+ virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId,
+ sal_Int16 nControlAction) override;
+ virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override;
+ virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override;
+ virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
+
+ /* TODO XFilePreview
+
+ virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( );
+ virtual sal_Int32 SAL_CALL getTargetColorDepth( );
+ virtual sal_Int32 SAL_CALL getAvailableWidth( );
+ virtual sal_Int32 SAL_CALL getAvailableHeight( );
+ virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage );
+ virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState );
+ virtual sal_Bool SAL_CALL getShowState( );
+ */
// XFilePicker2 functions
- QList<QUrl> getSelectedFiles() const;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override;
+
+ void setWinId(sal_uIntPtr winId);
// XInitialization
- void initialize(bool saveDialog);
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
- //add a custom control widget to the file dialog
- void addCheckBox(sal_Int16 nControlId, const QString& label, bool hidden);
+ // XCancellable
+ virtual void SAL_CALL cancel() override;
- void setWinId(sal_uIntPtr winId);
+ // XEventListener
+ virtual void disposing(const css::lang::EventObject& rEvent);
+ using cppu::WeakComponentImplHelperBase::disposing;
-private:
- Q_DISABLE_COPY(KDE5FilePicker)
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
-protected:
- bool eventFilter(QObject* watched, QEvent* event) override;
+private:
+ //add a custom control widget to the file dialog
+ void addCustomControl(sal_Int16 controlId);
-Q_SIGNALS:
+ // emit XFilePickerListener controlStateChanged event
void filterChanged();
+ // emit XFilePickerListener fileSelectionChanged event
void selectionChanged();
+
+protected:
+ bool eventFilter(QObject* watched, QEvent* event) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index b2bafcdda95b..12a29c8d4d29 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "KDE5FilePicker2.hxx"
+#include "KDE5FilePicker.hxx"
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -40,6 +40,16 @@
#include <unx/geninst.h>
+#include <QtCore/QDebug>
+#include <QtCore/QUrl>
+#include <QtGui/QClipboard>
+#include <QtGui/QWindow>
+#include <QtWidgets/QCheckBox>
+#include <QtWidgets/QFileDialog>
+#include <QtWidgets/QGridLayout>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QApplication>
+
#include <strings.hrc>
using namespace ::com::sun::star;
@@ -60,51 +70,70 @@ uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
uno::Sequence<OUString> aRet(3);
aRet[0] = "com.sun.star.ui.dialogs.FilePicker";
aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker";
- aRet[2] = "com.sun.star.ui.dialogs.KDE5FilePicker2";
+ aRet[2] = "com.sun.star.ui.dialogs.KDE5FilePicker";
return aRet;
}
}
-// KDE5FilePicker2
+// KDE5FilePicker
-KDE5FilePicker2::KDE5FilePicker2(const uno::Reference<uno::XComponentContext>&)
- : KDE5FilePicker2_Base(_helperMutex)
+KDE5FilePicker::KDE5FilePicker(const uno::Reference<uno::XComponentContext>&)
+ : KDE5FilePicker_Base(_helperMutex)
+ , _dialog(new QFileDialog(nullptr, {}, QDir::homePath()))
+ , _extraControls(new QWidget)
+ , _layout(new QGridLayout(_extraControls))
+ , _winId(0)
+ , allowRemoteUrls(false)
{
+ _dialog->setSupportedSchemes({
+ QStringLiteral("file"),
+ QStringLiteral("ftp"),
+ QStringLiteral("http"),
+ QStringLiteral("https"),
+ QStringLiteral("webdav"),
+ QStringLiteral("webdavs"),
+ QStringLiteral("smb"),
+ });
+
setMultiSelectionMode(false);
-}
-KDE5FilePicker2::~KDE5FilePicker2() = default;
+ connect(_dialog, &QFileDialog::filterSelected, this, &KDE5FilePicker::filterChanged);
+ connect(_dialog, &QFileDialog::fileSelected, this, &KDE5FilePicker::selectionChanged);
+
+ qApp->installEventFilter(this);
+ setMultiSelectionMode(false);
+}
void SAL_CALL
-KDE5FilePicker2::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)
+KDE5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)
{
SolarMutexGuard aGuard;
m_xListener = xListener;
}
-void SAL_CALL KDE5FilePicker2::removeFilePickerListener(const uno::Reference<XFilePickerListener>&)
+void SAL_CALL KDE5FilePicker::removeFilePickerListener(const uno::Reference<XFilePickerListener>&)
{
SolarMutexGuard aGuard;
m_xListener.clear();
}
-void SAL_CALL KDE5FilePicker2::setTitle(const OUString& title) {}
+void SAL_CALL KDE5FilePicker::setTitle(const OUString& title) {}
-sal_Int16 SAL_CALL KDE5FilePicker2::execute() { return 0; }
+sal_Int16 SAL_CALL KDE5FilePicker::execute() { return 0; }
-void SAL_CALL KDE5FilePicker2::setMultiSelectionMode(sal_Bool multiSelect) {}
+void SAL_CALL KDE5FilePicker::setMultiSelectionMode(sal_Bool multiSelect) {}
-void SAL_CALL KDE5FilePicker2::setDefaultName(const OUString& name) {}
+void SAL_CALL KDE5FilePicker::setDefaultName(const OUString& name) {}
-void SAL_CALL KDE5FilePicker2::setDisplayDirectory(const OUString& dir) {}
+void SAL_CALL KDE5FilePicker::setDisplayDirectory(const OUString& dir) {}
-OUString SAL_CALL KDE5FilePicker2::getDisplayDirectory()
+OUString SAL_CALL KDE5FilePicker::getDisplayDirectory()
{
OUString dir;
return dir;
}
-uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getFiles()
+uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getFiles()
{
uno::Sequence<OUString> seq = getSelectedFiles();
if (seq.getLength() > 1)
@@ -112,24 +141,24 @@ uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getFiles()
return seq;
}
-uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getSelectedFiles()
+uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSelectedFiles()
{
uno::Sequence<OUString> seq;
return seq;
}
-void SAL_CALL KDE5FilePicker2::appendFilter(const OUString& title, const OUString& filter) {}
+void SAL_CALL KDE5FilePicker::appendFilter(const OUString& title, const OUString& filter) {}
-void SAL_CALL KDE5FilePicker2::setCurrentFilter(const OUString& title) {}
+void SAL_CALL KDE5FilePicker::setCurrentFilter(const OUString& title) {}
-OUString SAL_CALL KDE5FilePicker2::getCurrentFilter()
+OUString SAL_CALL KDE5FilePicker::getCurrentFilter()
{
OUString filter;
return filter;
}
-void SAL_CALL KDE5FilePicker2::appendFilterGroup(const OUString& /*rGroupTitle*/,
- const uno::Sequence<beans::StringPair>& filters)
+void SAL_CALL KDE5FilePicker::appendFilterGroup(const OUString& /*rGroupTitle*/,
+ const uno::Sequence<beans::StringPair>& filters)
{
const sal_uInt16 length = filters.getLength();
for (sal_uInt16 i = 0; i < length; ++i)
@@ -139,12 +168,12 @@ void SAL_CALL KDE5FilePicker2::appendFilterGroup(const OUString& /*rGroupTitle*/
}
}
-void SAL_CALL KDE5FilePicker2::setValue(sal_Int16 controlId, sal_Int16 nControlAction,
- const uno::Any& value)
+void SAL_CALL KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction,
+ const uno::Any& value)
{
}
-uno::Any SAL_CALL KDE5FilePicker2::getValue(sal_Int16 controlId, sal_Int16 nControlAction)
+uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction)
{
if (CHECKBOX_AUTOEXTENSION == controlId)
// We ignore this one and rely on QFileDialog to provide the function.
@@ -159,17 +188,17 @@ uno::Any SAL_CALL KDE5FilePicker2::getValue(sal_Int16 controlId, sal_Int16 nCont
return uno::Any(value);
}
-void SAL_CALL KDE5FilePicker2::enableControl(sal_Int16 controlId, sal_Bool enable) {}
+void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) {}
-void SAL_CALL KDE5FilePicker2::setLabel(sal_Int16 controlId, const OUString& label) {}
+void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) {}
-OUString SAL_CALL KDE5FilePicker2::getLabel(sal_Int16 controlId)
+OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId)
{
OUString label;
return label;
}
-void KDE5FilePicker2::addCustomControl(sal_Int16 controlId)
+void KDE5FilePicker::addCustomControl(sal_Int16 controlId)
{
const char* resId = nullptr;
@@ -252,7 +281,7 @@ void KDE5FilePicker2::addCustomControl(sal_Int16 controlId)
}
}
-void SAL_CALL KDE5FilePicker2::initialize(const uno::Sequence<uno::Any>& args)
+void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
{
// parameter checking
uno::Any arg;
@@ -359,12 +388,12 @@ void SAL_CALL KDE5FilePicker2::initialize(const uno::Sequence<uno::Any>& args)
setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN));
}
-void SAL_CALL KDE5FilePicker2::cancel()
+void SAL_CALL KDE5FilePicker::cancel()
{
// TODO
}
-void KDE5FilePicker2::disposing(const lang::EventObject& rEvent)
+void KDE5FilePicker::disposing(const lang::EventObject& rEvent)
{
uno::Reference<XFilePickerListener> xFilePickerListener(rEvent.Source, uno::UNO_QUERY);
@@ -374,22 +403,22 @@ void KDE5FilePicker2::disposing(const lang::EventObject& rEvent)
}
}
-OUString SAL_CALL KDE5FilePicker2::getImplementationName()
+OUString SAL_CALL KDE5FilePicker::getImplementationName()
{
return OUString(FILE_PICKER_IMPL_NAME);
}
-sal_Bool SAL_CALL KDE5FilePicker2::supportsService(const OUString& ServiceName)
+sal_Bool SAL_CALL KDE5FilePicker::supportsService(const OUString& ServiceName)
{
return cppu::supportsService(this, ServiceName);
}
-uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getSupportedServiceNames()
+uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSupportedServiceNames()
{
return FilePicker_getSupportedServiceNames();
}
-void KDE5FilePicker2::filterChanged()
+void KDE5FilePicker::filterChanged()
{
FilePickerEvent aEvent;
aEvent.ElementId = LISTBOX_FILTER;
@@ -398,7 +427,7 @@ void KDE5FilePicker2::filterChanged()
m_xListener->controlStateChanged(aEvent);
}
-void KDE5FilePicker2::selectionChanged()
+void KDE5FilePicker::selectionChanged()
{
FilePickerEvent aEvent;
OSL_TRACE("file selection changed");
diff --git a/vcl/unx/kde5/KDE5FilePicker2.hxx b/vcl/unx/kde5/KDE5FilePicker2.hxx
deleted file mode 100644
index 0271d8900a0d..000000000000
--- a/vcl/unx/kde5/KDE5FilePicker2.hxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <cppuhelper/compbase.hxx>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
-#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <osl/conditn.hxx>
-#include <osl/mutex.hxx>
-
-#include <rtl/ustrbuf.hxx>
-
-#include <functional>
-
-typedef ::cppu::WeakComponentImplHelper<css::ui::dialogs::XFilePicker3,
- css::ui::dialogs::XFilePickerControlAccess
- // TODO css::ui::dialogs::XFilePreview
- ,
- css::lang::XInitialization, css::lang::XServiceInfo>
- KDE5FilePicker2_Base;
-
-class KDE5FilePicker2 : public KDE5FilePicker2_Base
-{
-protected:
- css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener;
-
- osl::Mutex _helperMutex;
-
-public:
- explicit KDE5FilePicker2(const css::uno::Reference<css::uno::XComponentContext>&);
- virtual ~KDE5FilePicker2() override;
-
- // XFilePickerNotifier
- virtual void SAL_CALL addFilePickerListener(
- const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
- virtual void SAL_CALL removeFilePickerListener(
- const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
-
- // XExecutableDialog functions
- virtual void SAL_CALL setTitle(const OUString& rTitle) override;
- virtual sal_Int16 SAL_CALL execute() override;
-
- // XFilePicker functions
- virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
- virtual void SAL_CALL setDefaultName(const OUString& rName) override;
- virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override;
- virtual OUString SAL_CALL getDisplayDirectory() override;
- virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override;
-
- // XFilterManager functions
- virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override;
- virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override;
- virtual OUString SAL_CALL getCurrentFilter() override;
-
- // XFilterGroupManager functions
- virtual void SAL_CALL
- appendFilterGroup(const OUString& rGroupTitle,
- const css::uno::Sequence<css::beans::StringPair>& rFilters) override;
-
- // XFilePickerControlAccess functions
- virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction,
- const css::uno::Any& rValue) override;
- virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId,
- sal_Int16 nControlAction) override;
- virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override;
- virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override;
- virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
-
- /* TODO XFilePreview
-
- virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( );
- virtual sal_Int32 SAL_CALL getTargetColorDepth( );
- virtual sal_Int32 SAL_CALL getAvailableWidth( );
- virtual sal_Int32 SAL_CALL getAvailableHeight( );
- virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage );
- virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState );
- virtual sal_Bool SAL_CALL getShowState( );
- */
-
- // XFilePicker2 functions
- virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override;
-
- // XInitialization
- virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
-
- // XCancellable
- virtual void SAL_CALL cancel() override;
-
- // XEventListener
- virtual void disposing(const css::lang::EventObject& rEvent);
- using cppu::WeakComponentImplHelperBase::disposing;
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
- virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
-
-private:
- KDE5FilePicker2(const KDE5FilePicker2&) = delete;
- KDE5FilePicker2& operator=(const KDE5FilePicker2&) = delete;
-
- //add a custom control widget to the file dialog
- void addCustomControl(sal_Int16 controlId);
-
- // emit XFilePickerListener controlStateChanged event
- void filterChanged();
- // emit XFilePickerListener fileSelectionChanged event
- void selectionChanged();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */