diff options
-rw-r--r-- | include/sfx2/dinfdlg.hxx | 19 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 115 | ||||
-rw-r--r-- | vcl/jsdialog/enabled.cxx | 6 |
3 files changed, 90 insertions, 50 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index fc7ebbfd4f2d..7cbf5433eaa7 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -274,11 +274,28 @@ public: ~CustomPropertiesTimeField(); }; +class DurationDialog_Impl : public weld::GenericDialogController +{ + std::unique_ptr<weld::CheckButton> m_xNegativeCB; + std::unique_ptr<weld::SpinButton> m_xYearNF; + std::unique_ptr<weld::SpinButton> m_xMonthNF; + std::unique_ptr<weld::SpinButton> m_xDayNF; + std::unique_ptr<weld::SpinButton> m_xHourNF; + std::unique_ptr<weld::SpinButton> m_xMinuteNF; + std::unique_ptr<weld::SpinButton> m_xSecondNF; + std::unique_ptr<weld::SpinButton> m_xMSecondNF; + +public: + DurationDialog_Impl(weld::Widget* pParent, const css::util::Duration& rDuration); + css::util::Duration GetDuration() const; +}; + class CustomPropertiesDurationField { css::util::Duration m_aDuration; std::unique_ptr<weld::Entry> m_xEntry; std::unique_ptr<weld::Button> m_xEditButton; + std::shared_ptr<DurationDialog_Impl> m_xDurationDialog; DECL_LINK(ClickHdl, weld::Button&, void); public: @@ -289,6 +306,8 @@ public: const css::util::Duration& GetDuration() const { return m_aDuration; } void set_visible(bool bVisible); + + ~CustomPropertiesDurationField(); }; class CustomPropertiesYesNoButton diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index eec2e4ca980d..3dd14c423af7 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -38,6 +38,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/file.hxx> +#include <comphelper/lok.hxx> #include <memory> @@ -708,6 +709,8 @@ SfxDocumentPage::SfxDocumentPage(weld::Container* pPage, weld::DialogController* ImplCheckPasswordState(); m_xChangePassBtn->connect_clicked( LINK( this, SfxDocumentPage, ChangePassHdl ) ); m_xSignatureBtn->connect_clicked( LINK( this, SfxDocumentPage, SignatureHdl ) ); + if (comphelper::LibreOfficeKit::isActive()) + m_xSignatureBtn->hide(); m_xDeleteBtn->connect_clicked( LINK( this, SfxDocumentPage, DeleteHdl ) ); m_xImagePreferredDpiCheckButton->connect_toggled(LINK(this, SfxDocumentPage, ImagePreferredDPICheckBoxClicked)); @@ -983,26 +986,36 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_xShowTypeFT->set_label( aDescription ); // determine location - aURL.SetSmartURL( aFile); - if ( aURL.GetProtocol() == INetProtocol::File ) + // online we don't know file location so we just set it as the name + if (comphelper::LibreOfficeKit::isActive()) { - INetURLObject aPath( aURL ); - aPath.setFinalSlash(); - aPath.removeSegment(); - // we know it's a folder -> don't need the final slash, but it's better for WB_PATHELLIPSIS - aPath.removeFinalSlash(); - OUString aText( aPath.PathToFileName() ); //! (pb) MaxLen? - m_xFileValEd->set_label(aText); - OUString aURLStr; - osl::FileBase::getFileURLFromSystemPath(aText, aURLStr); - m_xFileValEd->set_uri(aURLStr); + m_xFileValEd->set_label(aName); + m_xFileValEd->set_uri(aName); } - else if (aURL.GetProtocol() != INetProtocol::PrivSoffice) + else { - m_xFileValEd->set_label(aURL.GetPartBeforeLastName()); - m_xFileValEd->set_uri(m_xFileValEd->get_label()); + aURL.SetSmartURL( aFile); + if ( aURL.GetProtocol() == INetProtocol::File ) + { + INetURLObject aPath( aURL ); + aPath.setFinalSlash(); + aPath.removeSegment(); + // we know it's a folder -> don't need the final slash, but it's better for WB_PATHELLIPSIS + aPath.removeFinalSlash(); + OUString aText( aPath.PathToFileName() ); //! (pb) MaxLen? + m_xFileValEd->set_label(aText); + OUString aURLStr; + osl::FileBase::getFileURLFromSystemPath(aText, aURLStr); + m_xFileValEd->set_uri(aURLStr); + } + else if (aURL.GetProtocol() != INetProtocol::PrivSoffice) + { + m_xFileValEd->set_label(aURL.GetPartBeforeLastName()); + m_xFileValEd->set_uri(m_xFileValEd->get_label()); + } } + // handle access data bool bUseUserData = rInfoItem.IsUseUserData(); const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); @@ -1156,12 +1169,21 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxIte // Property Pages AddTabPage("general", SfxDocumentPage::Create, nullptr); AddTabPage("description", SfxDocumentDescPage::Create, nullptr); - AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); + + if (!comphelper::LibreOfficeKit::isActive()) + AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); + else + RemoveTabPage("customprops"); + if (rInfoItem.isCmisDocument()) AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr); else RemoveTabPage("cmisprops"); - AddTabPage("security", SfxSecurityPage::Create, nullptr); + // Disable security page for online as not fully asynced yet + if (!comphelper::LibreOfficeKit::isActive()) + AddTabPage("security", SfxSecurityPage::Create, nullptr); + else + RemoveTabPage("security"); } void SfxDocumentInfoDialog::PageCreated(const OString& rId, SfxTabPage &rPage) @@ -1191,25 +1213,6 @@ CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton() { } -namespace { - -class DurationDialog_Impl : public weld::GenericDialogController -{ - std::unique_ptr<weld::CheckButton> m_xNegativeCB; - std::unique_ptr<weld::SpinButton> m_xYearNF; - std::unique_ptr<weld::SpinButton> m_xMonthNF; - std::unique_ptr<weld::SpinButton> m_xDayNF; - std::unique_ptr<weld::SpinButton> m_xHourNF; - std::unique_ptr<weld::SpinButton> m_xMinuteNF; - std::unique_ptr<weld::SpinButton> m_xSecondNF; - std::unique_ptr<weld::SpinButton> m_xMSecondNF; - -public: - DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration); - util::Duration GetDuration() const; -}; - -} DurationDialog_Impl::DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration) : GenericDialogController(pParent, "sfx/ui/editdurationdialog.ui", "EditDurationDialog") @@ -1277,9 +1280,20 @@ void CustomPropertiesDurationField::SetDuration( const util::Duration& rDuration IMPL_LINK(CustomPropertiesDurationField, ClickHdl, weld::Button&, rButton, void) { - DurationDialog_Impl aDurationDlg(&rButton, GetDuration()); - if (aDurationDlg.run() == RET_OK) - SetDuration(aDurationDlg.GetDuration()); + m_xDurationDialog = std::make_shared<DurationDialog_Impl>(&rButton, GetDuration()); + weld::DialogController::runAsync(m_xDurationDialog, [&](sal_Int32 response) + { + if (response == RET_OK) + { + SetDuration(m_xDurationDialog->GetDuration()); + } + }); +} + +CustomPropertiesDurationField::~CustomPropertiesDurationField() +{ + if (m_xDurationDialog) + m_xDurationDialog->response(RET_CANCEL); } namespace @@ -1524,16 +1538,19 @@ void CustomPropertiesWindow::CreateNewLine() m_aCustomPropertiesLines.emplace_back( pNewLine ); - // for ui-testing. Distinguish the elements in the lines - sal_uInt16 nSize = m_aCustomPropertiesLines.size(); - pNewLine->m_xNameBox->set_buildable_name( - pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xTypeBox->set_buildable_name( - pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xValueEdit->set_buildable_name( - pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xRemoveButton->set_buildable_name( - pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize)); + // this breaks online's jsdialogbuilder + if (!comphelper::LibreOfficeKit::isActive()){ + // for ui-testing. Distinguish the elements in the lines + sal_uInt16 nSize = m_aCustomPropertiesLines.size(); + pNewLine->m_xNameBox->set_buildable_name( + pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xTypeBox->set_buildable_name( + pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xValueEdit->set_buildable_name( + pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xRemoveButton->set_buildable_name( + pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize)); + } pNewLine->DoTypeHdl(*pNewLine->m_xTypeBox); } diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 6cad5ecad14e..6923056183af 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -65,7 +65,11 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"modules/swriter/ui/contentcontroldlg.ui" || rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui" || rUIFile == u"modules/swriter/ui/splittable.ui" - || rUIFile == u"cui/ui/splitcellsdialog.ui") + || rUIFile == u"cui/ui/splitcellsdialog.ui" + || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" + || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/cmisinfopage.ui" + || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" + || rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui") { return true; } |