weld fpicker cluster

Change-Id: I6566263809ff0032388a0b56571f0cf7428058d7
Reviewed-on: https://gerrit.libreoffice.org/81334
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-10-29 13:58:47 +01:00
parent 93a641d291
commit 09e3d45cdc
60 changed files with 4012 additions and 3589 deletions
+2 -2
View File
@@ -228,8 +228,8 @@ LibPage::LibPage(weld::Container* pParent, OrganizeDialog* pDialog)
m_xBasicsBox->connect_changed( LINK( this, LibPage, BasicSelectHdl ) );
m_xLibBox->connect_editing_started( LINK( this, LibPage, EditingEntryHdl ) );
m_xLibBox->connect_editing_done( LINK( this, LibPage, EditedEntryHdl ) );
m_xLibBox->connect_editing(LINK(this, LibPage, EditingEntryHdl),
LINK(this, LibPage, EditedEntryHdl));
FillListBox();
m_xBasicsBox->set_active(0);
+2 -2
View File
@@ -557,8 +557,8 @@ ObjectPage::ObjectPage(weld::Container* pParent, const OString &rName, BrowseMod
m_xDropTarget.reset(new SbTreeListBoxDropTarget(*m_xBasicBox));
m_xBasicBox->connect_editing_started( LINK( this, ObjectPage, EditingEntryHdl ) );
m_xBasicBox->connect_editing_done( LINK( this, ObjectPage, EditedEntryHdl ) );
m_xBasicBox->connect_editing(LINK(this, ObjectPage, EditingEntryHdl),
LINK(this, ObjectPage, EditedEntryHdl));
m_xBasicBox->SetMode( nMode );
m_xBasicBox->ScanAllEntries();
+3 -6
View File
@@ -320,13 +320,10 @@ public:
float get_approximate_digit_width() const { return m_xControl->get_approximate_digit_width(); }
int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
int get_iter_index_in_parent(const weld::TreeIter& rIter) const { return m_xControl->get_iter_index_in_parent(rIter); }
void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink)
void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink)
{
m_xControl->connect_editing_started(rLink);
}
void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink)
{
m_xControl->connect_editing_done(rLink);
m_xControl->connect_editing(rStartLink, rEndLink);
}
void make_sorted() { m_xControl->make_sorted(); };
@@ -137,7 +137,7 @@ void CommandCategoryListBox::Init(
}
// Separate the "All commands"category from the actual categories
m_xControl->append_separator();
m_xControl->append_separator("");
typedef std::pair<OUString, sal_Int16> str_id;
std::vector<str_id> aCategories;
@@ -180,7 +180,7 @@ void CommandCategoryListBox::Init(
}
// Separate regular commands from styles and macros
m_xControl->append_separator();
m_xControl->append_separator("");
// Add macros category
m_aGroupInfo.push_back(
+1 -1
View File
@@ -667,7 +667,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
m_xIconStyleLB->append_text(entryForAuto);
// separate auto and other icon themes
m_xIconStyleLB->append_separator();
m_xIconStyleLB->append_separator("");
for (auto const& installIconTheme : mInstalledIconThemes)
m_xIconStyleLB->append_text(installIconTheme.GetDisplayName());
+2 -2
View File
@@ -98,8 +98,8 @@ namespace dbaui
m_xActions->connect_clicked(LINK(this, DbaIndexDialog, OnIndexAction));
m_xIndexList->connect_changed(LINK(this, DbaIndexDialog, OnIndexSelected));
m_xIndexList->connect_editing_started(LINK(this, DbaIndexDialog, OnEntryEditing));
m_xIndexList->connect_editing_done(LINK(this, DbaIndexDialog, OnEntryEdited));
m_xIndexList->connect_editing(LINK(this, DbaIndexDialog, OnEntryEditing),
LINK(this, DbaIndexDialog, OnEntryEdited));
m_xFields->SetSizePixel(Size(nWidth, 100));
m_xFields->Init(_rFieldNames, ::dbtools::getBooleanDataSourceSetting( m_xConnection, "AddIndexAppendix" ));
-2
View File
@@ -52,8 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\
fpicker/source/office/fpinteraction \
fpicker/source/office/fpsmartcontent \
fpicker/source/office/fps_office \
fpicker/source/office/iconview \
fpicker/source/office/iconviewimpl \
fpicker/source/office/iodlg \
fpicker/source/office/iodlgimp \
fpicker/source/office/OfficeControlAccess \
+1
View File
@@ -10,6 +10,7 @@
$(eval $(call gb_UIConfig_UIConfig,fps))
$(eval $(call gb_UIConfig_add_uifiles,fps,\
fpicker/uiconfig/ui/breadcrumb \
fpicker/uiconfig/ui/explorerfiledialog \
fpicker/uiconfig/ui/foldernamedialog \
fpicker/uiconfig/ui/remotefilesdialog \
-2
View File
@@ -11,8 +11,6 @@
#define INCLUDED_FPICKER_INC_BITMAPS_HRC
#define RID_BMP_FOLDER_OPEN "res/folderop.png"
#define BMP_FILEDLG_BTN_UP "res/fp010.png"
#define BMP_FILEDLG_CREATEFOLDER "fpicker/res/fp014.png"
#define BMP_FILEDLG_PLACE_LOCAL "fpicker/res/fp015.png"
#define BMP_FILEDLG_PLACE_REMOTE "fpicker/res/fp016.png"
#define RID_BMP_FOLDER "svtools/res/folder.png"
-1
View File
@@ -30,7 +30,6 @@
#define STR_BUTTONSELECT NC_("STR_BUTTONSELECT", "~Select")
#define STR_PREVIEW NC_("STR_PREVIEW", "File Preview")
#define STR_DEFAULT_DIRECTORY NC_("STR_DEFAULT_DIRECTORY", "My Documents")
#define STR_PLACES_TITLE NC_("STR_PLACES_TITLE", "Places")
#define RID_FILEOPEN_NOTEXISTENTFILE NC_("RID_FILEOPEN_NOTEXISTENTFILE", "The file $name$ does not exist.\nMake sure you have entered the correct file name.")
#define STR_SVT_NEW_FOLDER NC_("STR_SVT_NEW_FOLDER", "Folder")
#define STR_SVT_NOREMOVABLEDEVICE NC_("STR_SVT_NOREMOVABLEDEVICE", "No removable storage device detected.\nMake sure it is plugged in properly and try again.")
+142 -152
View File
@@ -101,22 +101,19 @@ namespace svt
{ "VersionListLabel", LISTBOX_VERSION_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }
};
static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions );
static ControlDescIterator s_pControls = aDescriptions;
static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount;
struct ControlDescriptionLookup
{
bool operator()( const ControlDescription& _rDesc1, const ControlDescription& _rDesc2 )
bool operator()( const ControlDescription& rDesc1, const ControlDescription& rDesc2 )
{
return strcmp(_rDesc1.pControlName, _rDesc2.pControlName) < 0;
return strcmp(rDesc1.pControlName, rDesc2.pControlName) < 0;
}
};
struct ControlProperty
{
const sal_Char* pPropertyName;
@@ -125,7 +122,6 @@ namespace svt
typedef const ControlProperty* ControlPropertyIterator;
static const ControlProperty aProperties[] = {
{ "Text", PropFlags::Text },
{ "Enabled", PropFlags::Enabled },
@@ -137,7 +133,6 @@ namespace svt
{ "Checked", PropFlags::Checked }
};
static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties );
static ControlPropertyIterator s_pProperties = aProperties;
@@ -166,38 +161,48 @@ namespace svt
}
}
OControlAccess::OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView )
:m_pFilePickerController( _pController )
,m_pFileView( _pFileView )
OControlAccess::OControlAccess(IFilePickerController* pController, SvtFileView* pFileView)
: m_pFilePickerController(pController)
, m_pFileView(pFileView)
{
DBG_ASSERT( m_pFilePickerController, "OControlAccess::OControlAccess: invalid control locator!" );
}
bool OControlAccess::IsFileViewWidget(weld::Widget const * pControl) const
{
if (!pControl)
return false;
if (!m_pFileView)
return false;
return pControl == m_pFileView->identifier();
}
void OControlAccess::setHelpURL( vcl::Window* _pControl, const OUString& sHelpURL, bool _bFileView )
void OControlAccess::setHelpURL(weld::Widget* pControl, const OUString& sHelpURL)
{
OUString sHelpID( sHelpURL );
INetURLObject aHID( sHelpURL );
if ( aHID.GetProtocol() == INetProtocol::Hid )
if (aHID.GetProtocol() == INetProtocol::Hid)
sHelpID = aHID.GetURLPath();
// URLs should always be UTF8 encoded and escaped
OString sID( OUStringToOString( sHelpID, RTL_TEXTENCODING_UTF8 ) );
if ( _bFileView )
if (IsFileViewWidget(pControl))
{
// the file view "overrides" the SetHelpId
static_cast< SvtFileView* >( _pControl )->SetHelpId( sID );
m_pFileView->set_help_id(sID);
}
else
_pControl->SetHelpId( sID );
pControl->set_help_id(sID);
}
OUString OControlAccess::getHelpURL( vcl::Window const * _pControl, bool _bFileView )
OUString OControlAccess::getHelpURL(weld::Widget const * pControl) const
{
OString aHelpId = pControl->get_help_id();
if (IsFileViewWidget(pControl))
{
OString aHelpId = _pControl->GetHelpId();
if ( _bFileView )
// the file view "overrides" the SetHelpId
aHelpId = static_cast< SvtFileView const * >( _pControl )->GetHelpId( );
aHelpId = m_pFileView->get_help_id();
}
OUString sHelpURL;
OUString aTmp( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ) );
@@ -208,17 +213,16 @@ namespace svt
return sHelpURL;
}
Any OControlAccess::getControlProperty( const OUString& _rControlName, const OUString& _rControlProperty )
Any OControlAccess::getControlProperty( const OUString& rControlName, const OUString& rControlProperty )
{
// look up the control
sal_Int16 nControlId = -1;
PropFlags nPropertyMask = PropFlags::NONE;
Control* pControl = implGetControl( _rControlName, &nControlId, &nPropertyMask );
weld::Widget* pControl = implGetControl( rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid
// look up the property
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
if ( aPropDesc == s_pPropertiesEnd )
// it's a completely unknown property
lcl_throwIllegalArgumentException();
@@ -230,12 +234,11 @@ namespace svt
return implGetControlProperty( pControl, aPropDesc->nPropertyId );
}
Control* OControlAccess::implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const
weld::Widget* OControlAccess::implGetControl( const OUString& rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const
{
Control* pControl = nullptr;
weld::Widget* pControl = nullptr;
ControlDescription tmpDesc;
OString aControlName = OUStringToOString( _rControlName, RTL_TEXTENCODING_UTF8 );
OString aControlName = OUStringToOString( rControlName, RTL_TEXTENCODING_UTF8 );
tmpDesc.pControlName = aControlName.getStr();
// translate the name into an id
@@ -259,24 +262,22 @@ namespace svt
return pControl;
}
void OControlAccess::setControlProperty( const OUString& _rControlName, const OUString& _rControlProperty, const css::uno::Any& _rValue )
void OControlAccess::setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue )
{
// look up the control
sal_Int16 nControlId = -1;
Control* pControl = implGetControl( _rControlName, &nControlId );
weld::Widget* pControl = implGetControl( rControlName, &nControlId );
// will throw an IllegalArgumentException if the name is not valid
// look up the property
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
if ( aPropDesc == s_pPropertiesEnd )
lcl_throwIllegalArgumentException();
// set the property
implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, _rValue, false );
implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, rValue, false );
}
Sequence< OUString > OControlAccess::getSupportedControls( ) const
{
Sequence< OUString > aControls( s_nControlCount );
@@ -293,12 +294,11 @@ namespace svt
return aControls;
}
Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& _rControlName )
Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& rControlName )
{
sal_Int16 nControlId = -1;
PropFlags nPropertyMask = PropFlags::NONE;
implGetControl( _rControlName, &nControlId, &nPropertyMask );
implGetControl( rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid
// fill in the property names
@@ -313,26 +313,24 @@ namespace svt
return aProps;
}
bool OControlAccess::isControlSupported( const OUString& _rControlName )
bool OControlAccess::isControlSupported( const OUString& rControlName )
{
ControlDescription tmpDesc;
OString aControlName = OUStringToOString(_rControlName, RTL_TEXTENCODING_UTF8);
OString aControlName = OUStringToOString(rControlName, RTL_TEXTENCODING_UTF8);
tmpDesc.pControlName = aControlName.getStr();
return ::std::binary_search( s_pControls, s_pControlsEnd, tmpDesc, ControlDescriptionLookup() );
}
bool OControlAccess::isControlPropertySupported( const OUString& _rControlName, const OUString& _rControlProperty )
bool OControlAccess::isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty )
{
// look up the control
sal_Int16 nControlId = -1;
PropFlags nPropertyMask = PropFlags::NONE;
implGetControl( _rControlName, &nControlId, &nPropertyMask );
implGetControl( rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid
// look up the property
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
if ( aPropDesc == s_pPropertiesEnd )
// it's a property which is completely unknown
return false;
@@ -340,21 +338,20 @@ namespace svt
return bool( aPropDesc->nPropertyId & nPropertyMask );
}
void OControlAccess::setValue( sal_Int16 _nControlId, sal_Int16 _nControlAction, const Any& _rValue )
void OControlAccess::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const Any& rValue )
{
Control* pControl = m_pFilePickerController->getControl( _nControlId );
weld::Widget* pControl = m_pFilePickerController->getControl( nControlId );
DBG_ASSERT( pControl, "OControlAccess::SetValue: don't have this control in the current mode!" );
if ( pControl )
{
PropFlags nPropertyId = PropFlags::Unknown;
if ( ControlActions::SET_HELP_URL == _nControlAction )
if ( ControlActions::SET_HELP_URL == nControlAction )
{
nPropertyId = PropFlags::HelpUrl;
}
else
{
switch ( _nControlId )
switch ( nControlId )
{
case CHECKBOX_AUTOEXTENSION:
case CHECKBOX_PASSWORD:
@@ -374,41 +371,41 @@ namespace svt
case LISTBOX_TEMPLATE:
case LISTBOX_IMAGE_TEMPLATE:
case LISTBOX_IMAGE_ANCHOR:
if ( ControlActions::SET_SELECT_ITEM == _nControlAction )
if ( ControlActions::SET_SELECT_ITEM == nControlAction )
{
nPropertyId = PropFlags::SelectedItemIndex;
}
else
{
DBG_ASSERT( WindowType::LISTBOX == pControl->GetType(), "OControlAccess::SetValue: implGetControl returned nonsense!" );
implDoListboxAction( static_cast< ListBox* >( pControl ), _nControlAction, _rValue );
weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::SetValue: implGetControl returned nonsense!");
implDoListboxAction(pComboBox, nControlAction, rValue);
}
break;
}
}
if ( PropFlags::Unknown != nPropertyId )
implSetControlProperty( _nControlId, pControl, nPropertyId, _rValue );
implSetControlProperty( nControlId, pControl, nPropertyId, rValue );
}
}
Any OControlAccess::getValue( sal_Int16 _nControlId, sal_Int16 _nControlAction ) const
Any OControlAccess::getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) const
{
Any aRet;
Control* pControl = m_pFilePickerController->getControl( _nControlId );
weld::Widget* pControl = m_pFilePickerController->getControl( nControlId );
DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
if ( pControl )
{
PropFlags nPropertyId = PropFlags::Unknown;
if ( ControlActions::SET_HELP_URL == _nControlAction )
if ( ControlActions::SET_HELP_URL == nControlAction )
{
nPropertyId = PropFlags::HelpUrl;
}
else
{
switch ( _nControlId )
switch ( nControlId )
{
case CHECKBOX_AUTOEXTENSION:
case CHECKBOX_PASSWORD:
@@ -422,7 +419,7 @@ namespace svt
break;
case LISTBOX_FILTER:
if ( ControlActions::GET_SELECTED_ITEM == _nControlAction )
if ( ControlActions::GET_SELECTED_ITEM == nControlAction )
{
aRet <<= m_pFilePickerController->getCurFilter();
}
@@ -436,7 +433,7 @@ namespace svt
case LISTBOX_TEMPLATE:
case LISTBOX_IMAGE_TEMPLATE:
case LISTBOX_IMAGE_ANCHOR:
switch ( _nControlAction )
switch ( nControlAction )
{
case ControlActions::GET_SELECTED_ITEM:
nPropertyId = PropFlags::SelectedItem;
@@ -462,57 +459,47 @@ namespace svt
return aRet;
}
void OControlAccess::setLabel( sal_Int16 nId, const OUString &rLabel )
{
Control* pControl = m_pFilePickerController->getControl( nId, true );
DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
if ( pControl )
pControl->SetText( rLabel );
weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true));
assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!");
pControl->set_label(rLabel);
}
OUString OControlAccess::getLabel( sal_Int16 nId ) const
{
OUString sLabel;
Control* pControl = m_pFilePickerController->getControl( nId, true );
DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
if ( pControl )
sLabel = pControl->GetText();
return sLabel;
weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true));
assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!");
return pControl->get_label();
}
void OControlAccess::enableControl( sal_Int16 _nId, bool _bEnable )
void OControlAccess::enableControl(sal_Int16 nId, bool bEnable)
{
m_pFilePickerController->enableControl( _nId, _bEnable );
m_pFilePickerController->enableControl(nId, bEnable);
}
void OControlAccess::implDoListboxAction( ListBox* _pListbox, sal_Int16 _nControlAction, const Any& _rValue )
void OControlAccess::implDoListboxAction(weld::ComboBox* pListbox, sal_Int16 nControlAction, const Any& rValue)
{
switch ( _nControlAction )
switch ( nControlAction )
{
case ControlActions::ADD_ITEM:
{
OUString aEntry;
_rValue >>= aEntry;
rValue >>= aEntry;
if ( !aEntry.isEmpty() )
_pListbox->InsertEntry( aEntry );
pListbox->append_text( aEntry );
}
break;
case ControlActions::ADD_ITEMS:
{
Sequence < OUString > aTemplateList;
_rValue >>= aTemplateList;
rValue >>= aTemplateList;
if ( aTemplateList.hasElements() )
{
for ( long i=0; i < aTemplateList.getLength(); i++ )
_pListbox->InsertEntry( aTemplateList[i] );
pListbox->append_text( aTemplateList[i] );
}
}
break;
@@ -520,13 +507,13 @@ namespace svt
case ControlActions::DELETE_ITEM:
{
sal_Int32 nPos = 0;
if ( _rValue >>= nPos )
_pListbox->RemoveEntry( nPos );
if ( rValue >>= nPos )
pListbox->remove( nPos );
}
break;
case ControlActions::DELETE_ITEMS:
_pListbox->Clear();
pListbox->clear();
break;
default:
@@ -534,16 +521,15 @@ namespace svt
}
}
void OControlAccess::implSetControlProperty( sal_Int16 _nControlId, Control* _pControl, PropFlags _nProperty, const Any& _rValue, bool _bIgnoreIllegalArgument )
void OControlAccess::implSetControlProperty( sal_Int16 nControlId, weld::Widget* pControl, PropFlags _nProperty, const Any& rValue, bool _bIgnoreIllegalArgument )
{
if ( !_pControl )
_pControl = m_pFilePickerController->getControl( _nControlId );
DBG_ASSERT( _pControl, "OControlAccess::implSetControlProperty: invalid argument, this will crash!" );
if ( !_pControl )
if ( !pControl )
pControl = m_pFilePickerController->getControl( nControlId );
DBG_ASSERT( pControl, "OControlAccess::implSetControlProperty: invalid argument, this will crash!" );
if ( !pControl )
return;
DBG_ASSERT( _pControl == m_pFilePickerController->getControl( _nControlId ),
DBG_ASSERT( pControl == m_pFilePickerController->getControl( nControlId ),
"OControlAccess::implSetControlProperty: inconsistent parameters!" );
switch ( _nProperty )
@@ -551,9 +537,11 @@ namespace svt
case PropFlags::Text:
{
OUString sText;
if ( _rValue >>= sText )
if (rValue >>= sText)
{
_pControl->SetText( sText );
weld::Label* pLabel = dynamic_cast<weld::Label*>(pControl);
assert(pLabel);
pLabel->set_label(sText);
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -565,9 +553,9 @@ namespace svt
case PropFlags::Enabled:
{
bool bEnabled = false;
if ( _rValue >>= bEnabled )
if ( rValue >>= bEnabled )
{
m_pFilePickerController->enableControl( _nControlId, bEnabled );
m_pFilePickerController->enableControl( nControlId, bEnabled );
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -579,9 +567,9 @@ namespace svt
case PropFlags::Visible:
{
bool bVisible = false;
if ( _rValue >>= bVisible )
if ( rValue >>= bVisible )
{
_pControl->Show( bVisible );
pControl->set_visible( bVisible );
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -593,9 +581,9 @@ namespace svt
case PropFlags::HelpUrl:
{
OUString sHelpURL;
if ( _rValue >>= sHelpURL )
if ( rValue >>= sHelpURL )
{
setHelpURL( _pControl, sHelpURL, m_pFileView == _pControl );
setHelpURL(pControl, sHelpURL);
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -606,19 +594,19 @@ namespace svt
case PropFlags::ListItems:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" );
weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");
Sequence< OUString > aItems;
if ( _rValue >>= aItems )
if ( rValue >>= aItems )
{
// remove all previous items
static_cast< ListBox* >( _pControl )->Clear();
pComboBox->clear();
// add the new ones
for ( auto const & item : std::as_const(aItems) )
for (auto const & item : std::as_const(aItems))
{
static_cast< ListBox* >( _pControl )->InsertEntry( item );
pComboBox->append_text(item);
}
}
@@ -631,13 +619,13 @@ namespace svt
case PropFlags::SelectedItem:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" );
weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");
OUString sSelected;
if ( _rValue >>= sSelected )
if ( rValue >>= sSelected )
{
static_cast< ListBox* >( _pControl )->SelectEntry( sSelected );
pComboBox->set_active_text(sSelected);
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -648,13 +636,13 @@ namespace svt
case PropFlags::SelectedItemIndex:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" );
weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");
sal_Int32 nPos = 0;
if ( _rValue >>= nPos )
if ( rValue >>= nPos )
{
static_cast< ListBox* >( _pControl )->SelectEntryPos( nPos );
pComboBox->set_active(nPos);
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -665,13 +653,13 @@ namespace svt
case PropFlags::Checked:
{
DBG_ASSERT( WindowType::CHECKBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" );
weld::ToggleButton* pToggleButton = dynamic_cast<weld::ToggleButton*>(pControl);
assert(pToggleButton && "OControlAccess::implSetControlProperty: invalid control/property combination!");
bool bChecked = false;
if ( _rValue >>= bChecked )
if ( rValue >>= bChecked )
{
static_cast< CheckBox* >( _pControl )->Check( bChecked );
pToggleButton->set_active(bChecked);
}
else if ( !_bIgnoreIllegalArgument )
{
@@ -685,76 +673,80 @@ namespace svt
}
}
Any OControlAccess::implGetControlProperty( Control const * _pControl, PropFlags _nProperty ) const
Any OControlAccess::implGetControlProperty( weld::Widget const * pControl, PropFlags _nProperty ) const
{
DBG_ASSERT( _pControl, "OControlAccess::implGetControlProperty: invalid argument, this will crash!" );
assert(pControl && "OControlAccess::implGetControlProperty: invalid argument, this will crash!");
Any aReturn;
switch ( _nProperty )
{
case PropFlags::Text:
aReturn <<= _pControl->GetText();
{
const weld::Label* pLabel = dynamic_cast<const weld::Label*>(pControl);
assert(pLabel);
aReturn <<= pLabel->get_label();
break;
}
case PropFlags::Enabled:
aReturn <<= _pControl->IsEnabled();
aReturn <<= pControl->get_sensitive();
break;
case PropFlags::Visible:
aReturn <<= _pControl->IsVisible();
aReturn <<= pControl->get_visible();
break;
case PropFlags::HelpUrl:
aReturn <<= getHelpURL( _pControl, m_pFileView == _pControl );
aReturn <<= getHelpURL(pControl);
break;
case PropFlags::ListItems:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" );
const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");
Sequence< OUString > aItems( static_cast< ListBox const * >( _pControl )->GetEntryCount() );
Sequence< OUString > aItems(pComboBox->get_count());
OUString* pItems = aItems.getArray();
for ( sal_Int32 i=0; i<static_cast< ListBox const * >( _pControl )->GetEntryCount(); ++i )
*pItems++ = static_cast< ListBox const * >( _pControl )->GetEntry( i );
for (sal_Int32 i = 0; i < pComboBox->get_count(); ++i)
*pItems++ = pComboBox->get_text(i);
aReturn <<= aItems;
}
break;
}
case PropFlags::SelectedItem:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" );
const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");
sal_Int32 nSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
sal_Int32 nSelected = pComboBox->get_active();
OUString sSelected;
if ( LISTBOX_ENTRY_NOTFOUND != nSelected )
sSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntry();
if (nSelected != -1)
sSelected = pComboBox->get_active_text();
aReturn <<= sSelected;
}
break;
}
case PropFlags::SelectedItemIndex:
{
DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" );
const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");
sal_Int32 nSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
if ( LISTBOX_ENTRY_NOTFOUND != nSelected )
aReturn <<= static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
sal_Int32 nSelected = pComboBox->get_active();
if (nSelected != -1)
aReturn <<= nSelected;
else
aReturn <<= sal_Int32(-1);
}
break;
}
case PropFlags::Checked:
DBG_ASSERT( WindowType::CHECKBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" );
{
const weld::ToggleButton* pToggleButton = dynamic_cast<const weld::ToggleButton*>(pControl);
assert(pToggleButton && "OControlAccess::implGetControlProperty: invalid control/property combination!");
aReturn <<= static_cast< CheckBox const * >( _pControl )->IsChecked( );
aReturn <<= pToggleButton->get_active();
break;
}
default:
OSL_FAIL( "OControlAccess::implGetControlProperty: invalid property id!" );
@@ -762,8 +754,6 @@ namespace svt
return aReturn;
}
} // namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+30 -29
View File
@@ -25,7 +25,6 @@
#include "pickercallbacks.hxx"
#include <o3tl/typed_flags_set.hxx>
enum class PropFlags {
Unknown = -1, // used as an error sentinel
NONE = 0x0000,
@@ -62,66 +61,68 @@ namespace svt
class OControlAccess
{
IFilePickerController* m_pFilePickerController;
VclPtr<SvtFileView> m_pFileView;
SvtFileView* m_pFileView;
public:
OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
OControlAccess( IFilePickerController* pController, SvtFileView* pFileView );
// XControlAccess implementation
void setControlProperty( const OUString& _rControlName, const OUString& _rControlProperty, const css::uno::Any& _rValue );
css::uno::Any getControlProperty( const OUString& _rControlName, const OUString& _rControlProperty );
void setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue );
css::uno::Any getControlProperty( const OUString& rControlName, const OUString& rControlProperty );
// XControlInformation implementation
css::uno::Sequence< OUString > getSupportedControls( ) const;
css::uno::Sequence< OUString > getSupportedControlProperties( const OUString& _rControlName );
static bool isControlSupported( const OUString& _rControlName );
bool isControlPropertySupported( const OUString& _rControlName, const OUString& _rControlProperty );
css::uno::Sequence< OUString > getSupportedControlProperties( const OUString& rControlName );
static bool isControlSupported( const OUString& rControlName );
bool isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty );
// XFilePickerControlAccess
void setValue( sal_Int16 _nId, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue );
css::uno::Any getValue( sal_Int16 _nId, sal_Int16 _nCtrlAction ) const;
void setLabel( sal_Int16 _nId, const OUString& _rValue );
OUString getLabel( sal_Int16 _nId ) const;
void enableControl( sal_Int16 _nId, bool _bEnable );
void setValue( sal_Int16 nId, sal_Int16 nCtrlAction, const css::uno::Any& rValue );
css::uno::Any getValue( sal_Int16 nId, sal_Int16 nCtrlAction ) const;
void setLabel( sal_Int16 nId, const OUString& rValue );
OUString getLabel( sal_Int16 nId ) const;
void enableControl( sal_Int16 nId, bool bEnable );
static void setHelpURL( vcl::Window* _pControl, const OUString& _rURL, bool _bFileView );
static OUString getHelpURL( vcl::Window const * _pControl, bool _bFileView );
void setHelpURL(weld::Widget* pControl, const OUString& rURL);
OUString getHelpURL(weld::Widget const* pControl) const;
private:
/** implements the various methods for setting properties on controls
@param _nControlId
@param nControlId
the id of the control
@param _pControl
the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
@param _nProperty
@param pControl
the affected control. Must be the same as referred by <arg>nControlId</arg>, or NULL.
@param nProperty
the property to set
See PropFlags::*
@param _rValue
@param rValue
the value to set
@param _bIgnoreIllegalArgument
@param bIgnoreIllegalArgument
if <FALSE/>, an exception will be thrown if the given value is of improper type
*/
void implSetControlProperty(
sal_Int16 _nControlId,
Control* _pControl, PropFlags _nProperty, const css::uno::Any& _rValue,
bool _bIgnoreIllegalArgument = true );
sal_Int16 nControlId,
weld::Widget* pControl, PropFlags nProperty, const css::uno::Any& rValue,
bool bIgnoreIllegalArgument = true );
Control* implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask = nullptr ) const;
weld::Widget* implGetControl( const OUString& rControlName, sal_Int16* pId, PropFlags* pPropertyMask = nullptr ) const;
/** implements the various methods for retrieving properties from controls
@param _pControl
@param pControl
the affected control
@PRECOND not <NULL/>
@param _nProperty
@param nProperty
the property to retrieve
See PropFlags::*
@return
*/
css::uno::Any implGetControlProperty( Control const * _pControl, PropFlags _nProperty ) const;
css::uno::Any implGetControlProperty( weld::Widget const * pControl, PropFlags nProperty ) const;
static void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue );
bool IsFileViewWidget(weld::Widget const * pControl) const;
static void implDoListboxAction(weld::ComboBox* pListbox, sal_Int16 nCtrlAction, const css::uno::Any& rValue);
};
+53 -76
View File
@@ -149,28 +149,28 @@ void SvtFilePicker::prepareExecute()
if ( !m_aDefaultName.isEmpty() )
{
aPath.insertName( m_aDefaultName );
getDialog()->SetHasFilename( true );
m_xDlg->SetHasFilename( true );
}
getDialog()->SetPath( aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
m_xDlg->SetPath( aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
isFileSet = true;
}
if ( !isFileSet && !m_aDefaultName.isEmpty() )
{
getDialog()->SetPath( m_aDefaultName );
getDialog()->SetHasFilename( true );
m_xDlg->SetPath( m_aDefaultName );
m_xDlg->SetHasFilename( true );
}
}
else
{
// set the default standard dir
INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
}
// set the control values and set the control labels, too
if ( m_pElemList && !m_pElemList->empty() )
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
for (auto const& elem : *m_pElemList)
{
@@ -193,17 +193,19 @@ void SvtFilePicker::prepareExecute()
UnoFilterList aSubFilters;
elem.getSubFilters( aSubFilters );
getDialog()->AddFilterGroup( elem.getTitle(), aSubFilters );
m_xDlg->AddFilterGroup( elem.getTitle(), aSubFilters );
}
else
{
// it's a single filter
getDialog()->AddFilter( elem.getTitle(), elem.getFilter() );
m_xDlg->AddFilter( elem.getTitle(), elem.getFilter() );
}
}
}
// set the default filter
if ( !m_aCurrentFilter.isEmpty() )
getDialog()->SetCurFilter( m_aCurrentFilter );
m_xDlg->SetCurFilter( m_aCurrentFilter );
}
@@ -413,30 +415,28 @@ SvtFilePicker::~SvtFilePicker()
{
}
sal_Int16 SvtFilePicker::implExecutePicker( )
{
getDialog()->SetFileCallback( this );
m_xDlg->SetFileCallback( this );
prepareExecute();
getDialog()->EnableAutocompletion();
m_xDlg->EnableAutocompletion();
// now we are ready to execute the dialog
sal_Int16 nRet = getDialog()->Execute();
sal_Int16 nRet = m_xDlg->run();
// the execution of the dialog yields, so it is possible the at this point the window or the dialog is closed
if ( getDialog() )
getDialog()->SetFileCallback( nullptr );
if (m_xDlg)
m_xDlg->SetFileCallback( nullptr );
return nRet;
}
VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( weld::Window* pParent )
{
PickerFlags nBits = getPickerFlags();
VclPtrInstance<SvtFileDialog> dialog( _pParent, nBits );
auto dialog = std::make_unique<SvtFileDialog>(pParent, nBits);
// Set StandardDir if present
if ( !m_aStandardDir.isEmpty())
@@ -475,38 +475,31 @@ void SAL_CALL SvtFilePicker::setTitle( const OUString& _rTitle )
OCommonPicker::setTitle( _rTitle );
}
sal_Int16 SAL_CALL SvtFilePicker::execute( )
{
return OCommonPicker::execute();
}
// XAsynchronousExecutableDialog functions
void SAL_CALL SvtFilePicker::setDialogTitle( const OUString& _rTitle )
{
setTitle( _rTitle );
}
void SAL_CALL SvtFilePicker::startExecuteModal( const Reference< css::ui::dialogs::XDialogClosedListener >& xListener )
{
m_xDlgClosedListener = xListener;
prepareDialog();
prepareExecute();
SvtFileDialog_Base* pDialog = getDialog();
pDialog->EnableAutocompletion();
pDialog->StartExecuteAsync([this](sal_Int32 nResult){
m_xDlg->EnableAutocompletion();
if (!m_xDlg->PrepareExecute())
return;
weld::DialogController::runAsync(m_xDlg, [this](sal_Int32 nResult){
DialogClosedHdl(nResult);
});
}
// XFilePicker functions
void SAL_CALL SvtFilePicker::setMultiSelectionMode( sal_Bool bMode )
{
checkAlive();
@@ -536,15 +529,15 @@ OUString SAL_CALL SvtFilePicker::getDisplayDirectory()
checkAlive();
SolarMutexGuard aGuard;
if ( getDialog() )
if (m_xDlg)
{
OUString aPath = getDialog()->GetPath();
OUString aPath = m_xDlg->GetPath();
if( m_aOldHideDirectory == aPath )
return m_aOldDisplayDirectory;
m_aOldHideDirectory = aPath;
if( !getDialog()->ContentIsFolder( aPath ) )
if( !m_xDlg->ContentIsFolder( aPath ) )
{
INetURLObject aFolder( aPath );
aFolder.CutLastName();
@@ -562,13 +555,13 @@ Sequence< OUString > SAL_CALL SvtFilePicker::getSelectedFiles()
checkAlive();
SolarMutexGuard aGuard;
if ( ! getDialog() )
if (!m_xDlg)
{
Sequence< OUString > aEmpty;
return aEmpty;
}
return comphelper::containerToSequence(getDialog()->GetPathList());
return comphelper::containerToSequence(m_xDlg->GetPathList());
}
Sequence< OUString > SAL_CALL SvtFilePicker::getFiles()
@@ -590,9 +583,9 @@ void SAL_CALL SvtFilePicker::setValue( sal_Int16 nElementID,
checkAlive();
SolarMutexGuard aGuard;
if ( getDialog() )
if (m_xDlg)
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
aAccess.setValue( nElementID, nControlAction, rValue );
}
else
@@ -632,9 +625,9 @@ Any SAL_CALL SvtFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAc
Any aAny;
// execute() called?
if ( getDialog() )
if (m_xDlg)
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
aAny = aAccess.getValue( nElementID, nControlAction );
}
else if ( m_pElemList )
@@ -660,9 +653,9 @@ void SAL_CALL SvtFilePicker::setLabel( sal_Int16 nLabelID, const OUString& rValu
checkAlive();
SolarMutexGuard aGuard;
if ( getDialog() )
if (m_xDlg)
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
aAccess.setLabel( nLabelID, rValue );
}
else
@@ -698,9 +691,9 @@ OUString SAL_CALL SvtFilePicker::getLabel( sal_Int16 nLabelID )
SolarMutexGuard aGuard;
OUString aLabel;
if ( getDialog() )
if (m_xDlg)
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
aLabel = aAccess.getLabel( nLabelID );
}
else if ( m_pElemList )
@@ -725,9 +718,9 @@ void SAL_CALL SvtFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnab
checkAlive();
SolarMutexGuard aGuard;
if ( getDialog() )
if (m_xDlg)
{
::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
aAccess.enableControl( nElementID, bEnable );
}
else
@@ -776,10 +769,7 @@ void SAL_CALL SvtFilePicker::removeFilePickerListener( const Reference< XFilePic
m_xListener.clear();
}
// XFilePreview functions
Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats()
{
checkAlive();
@@ -792,21 +782,11 @@ Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats()
return aFormats;
}
sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth()
{
checkAlive();
SolarMutexGuard aGuard;
sal_Int32 nDepth = 0;
if ( getDialog() )
nDepth = getDialog()->getTargetColorDepth();
return nDepth;
return 0;
}
sal_Int32 SAL_CALL SvtFilePicker::getAvailableWidth()
{
checkAlive();
@@ -814,13 +794,12 @@ sal_Int32 SAL_CALL SvtFilePicker::getAvailableWidth()
SolarMutexGuard aGuard;
sal_Int32 nWidth = 0;
if ( getDialog() )
nWidth = getDialog()->getAvailableWidth();
if (m_xDlg)
nWidth = m_xDlg->getAvailableWidth();
return nWidth;
}
sal_Int32 SAL_CALL SvtFilePicker::getAvailableHeight()
{
checkAlive();
@@ -828,23 +807,21 @@ sal_Int32 SAL_CALL SvtFilePicker::getAvailableHeight()
SolarMutexGuard aGuard;
sal_Int32 nHeight = 0;
if ( getDialog() )
nHeight = getDialog()->getAvailableHeight();
if (m_xDlg)
nHeight = m_xDlg->getAvailableHeight();
return nHeight;
}
void SAL_CALL SvtFilePicker::setImage( sal_Int16 /*aImageFormat*/, const Any& rImage )
void SAL_CALL SvtFilePicker::setImage(sal_Int16 /*aImageFormat*/, const Any& rImage)
{
checkAlive();
SolarMutexGuard aGuard;
if ( getDialog() )
getDialog()->setImage( rImage );
if (m_xDlg)
m_xDlg->setImage(rImage);
}
sal_Bool SAL_CALL SvtFilePicker::setShowState( sal_Bool )
{
checkAlive();
@@ -852,7 +829,7 @@ sal_Bool SAL_CALL SvtFilePicker::setShowState( sal_Bool )
SolarMutexGuard aGuard;
bool bRet = false;
if ( getDialog() )
if (m_xDlg)
{
// #97633 for the system filedialog it's
// useful to make the preview switchable
@@ -880,8 +857,8 @@ sal_Bool SAL_CALL SvtFilePicker::getShowState()
SolarMutexGuard aGuard;
bool bRet = false;
if ( getDialog() )
bRet = getDialog()->getShowState();
if (m_xDlg)
bRet = m_xDlg->getShowState();
return bRet;
}
@@ -946,8 +923,8 @@ void SAL_CALL SvtFilePicker::setCurrentFilter( const OUString& aTitle )
m_aCurrentFilter = aTitle;
if ( getDialog() )
getDialog()->SetCurFilter( aTitle );
if (m_xDlg)
m_xDlg->SetCurFilter( aTitle );
}
@@ -956,7 +933,7 @@ OUString SAL_CALL SvtFilePicker::getCurrentFilter()
checkAlive();
SolarMutexGuard aGuard;
OUString aFilter = getDialog() ? getDialog()->GetCurFilter() :
OUString aFilter = m_xDlg ? m_xDlg->GetCurFilter() :
m_aCurrentFilter;
return aFilter;
}
@@ -1091,11 +1068,11 @@ SvtRemoteFilePicker::SvtRemoteFilePicker()
{
}
VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld::Window* pParent)
{
PickerFlags nBits = getPickerFlags();
VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits);
auto dialog = std::make_unique<RemoteFilesDialog>(pParent, nBits);
// Set StandardDir if present
if ( !m_aStandardDir.isEmpty())
+2 -2
View File
@@ -203,7 +203,7 @@ protected:
// OCommonPicker overridables
virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
virtual sal_Int16 implExecutePicker( ) override;
virtual bool implHandleInitializationArgument(
const OUString& _rName,
@@ -231,7 +231,7 @@ class SvtRemoteFilePicker : public SvtFilePicker
public:
SvtRemoteFilePicker();
virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
// disambiguate XInterface
+15 -15
View File
@@ -59,16 +59,18 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< css::ui::dial
m_xListener = xListener;
prepareDialog();
prepareExecute();
SvtFileDialog_Base* pDialog = getDialog();
pDialog->EnableAutocompletion();
pDialog->StartExecuteAsync([this](sal_Int32 nResult){
m_xDlg->EnableAutocompletion();
if (!m_xDlg->PrepareExecute())
return;
weld::DialogController::runAsync(m_xDlg, [this](sal_Int32 nResult){
DialogClosedHdl(nResult);
});
}
VclPtr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( weld::Window* pParent )
{
return VclPtr<SvtFileDialog>::Create( _pParent, PickerFlags::PathDialog );
return std::make_unique<SvtFileDialog>(pParent, PickerFlags::PathDialog);
}
sal_Int16 SvtFolderPicker::implExecutePicker( )
@@ -76,22 +78,20 @@ sal_Int16 SvtFolderPicker::implExecutePicker( )
prepareExecute();
// now we are ready to execute the dialog
getDialog()->EnableAutocompletion( false );
sal_Int16 nRet = getDialog()->Execute();
return nRet;
m_xDlg->EnableAutocompletion( false );
return m_xDlg->run();
}
void SvtFolderPicker::prepareExecute()
{
// set the default directory
if ( !m_aDisplayDirectory.isEmpty() )
getDialog()->SetPath( m_aDisplayDirectory );
m_xDlg->SetPath( m_aDisplayDirectory );
else
{
// set the default standard dir
INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE) );
m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE) );
}
}
@@ -113,10 +113,10 @@ void SAL_CALL SvtFolderPicker::setDisplayDirectory( const OUString& aDirectory )
OUString SAL_CALL SvtFolderPicker::getDisplayDirectory()
{
if ( ! getDialog() )
if (!m_xDlg)
return m_aDisplayDirectory;
std::vector<OUString> aPathList(getDialog()->GetPathList());
std::vector<OUString> aPathList(m_xDlg->GetPathList());
if(!aPathList.empty())
return aPathList[0];
@@ -126,10 +126,10 @@ OUString SAL_CALL SvtFolderPicker::getDisplayDirectory()
OUString SAL_CALL SvtFolderPicker::getDirectory()
{
if ( ! getDialog() )
if (!m_xDlg)
return m_aDisplayDirectory;
std::vector<OUString> aPathList(getDialog()->GetPathList());
std::vector<OUString> aPathList(m_xDlg->GetPathList());
if(!aPathList.empty())
return aPathList[0];
+1 -1
View File
@@ -93,7 +93,7 @@ protected:
// OCommonPicker overridables
virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
virtual sal_Int16 implExecutePicker( ) override;
};
+41 -134
View File
@@ -14,96 +14,36 @@
#include <vcl/event.hxx>
#include <bitmaps.hlst>
#define COLUMN_NAME 1
PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle ) :
SvHeaderTabListBox( pParent, WB_TABSTOP | WB_NOINITIALSELECTION ),
mpHeaderBar( nullptr ),
mpParent( pParent )
PlacesListBox::PlacesListBox(std::unique_ptr<weld::TreeView> xControl,
std::unique_ptr<weld::Button> xAdd,
std::unique_ptr<weld::Button> xDel,
SvtFileDialog* pFileDlg)
: maPlaces( )
, mpDlg(pFileDlg)
, mxImpl(std::move(xControl))
, mxAddBtn(std::move(xAdd))
, mxDelBtn(std::move(xDel))
, mnNbEditables(0)
, mbUpdated( false )
, mbSelectionChanged( false )
{
Size aBoxSize = pParent->GetSizePixel( );
mpHeaderBar = VclPtr<HeaderBar>::Create( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( 600, 16 ) );
Size aSize(mxImpl->get_approximate_digit_width() * 18,
mxImpl->get_height_rows(9));
mxImpl->set_size_request(aSize.Width(), aSize.Height());
long aTabPositions[] = { 20, 600 };
SetTabs( SAL_N_ELEMENTS(aTabPositions), aTabPositions, MapUnit::MapPixel );
mpHeaderBar->InsertItem( COLUMN_NAME, rTitle, 600, HeaderBarItemBits::LEFT );
Size aHeadSize = mpHeaderBar->GetSizePixel();
SetPosSizePixel( Point( 0, aHeadSize.getHeight() ),
Size( aBoxSize.getWidth(), aBoxSize.getHeight() - aHeadSize.getHeight() ) );
InitHeaderBar( mpHeaderBar );
Show( );
mpHeaderBar->Show();
}
PlacesListBox_Impl::~PlacesListBox_Impl( )
{
disposeOnce();
}
void PlacesListBox_Impl::dispose()
{
mpHeaderBar.disposeAndClear();
mpParent.clear();
SvHeaderTabListBox::dispose();
}
void PlacesListBox_Impl::MouseButtonUp( const MouseEvent& rMEvt )
{
SvHeaderTabListBox::MouseButtonUp( rMEvt );
mpParent->updateView( );
}
PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits ) :
Control( pParent, nBits ),
maPlaces( ),
mpDlg( pFileDlg ),
mpImpl( nullptr ),
mpAddBtn( ),
mpDelBtn( ),
mnNbEditables( 0 ),
mbUpdated( false ),
mbSelectionChanged( false )
{
mpImpl = VclPtr<PlacesListBox_Impl>::Create( this, rTitle );
mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;
mpAddBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpAddBtn->SetText( "+" );
mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpAddBtn->Show();
mpDelBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpDelBtn->SetText( "-" );
mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpDelBtn->Show();
mxImpl->connect_changed( LINK( this, PlacesListBox, Selection ) );
mxImpl->connect_row_activated( LINK( this, PlacesListBox, DoubleClick ) ) ;
}
PlacesListBox::~PlacesListBox( )
{
disposeOnce();
}
void PlacesListBox::dispose()
{
mpImpl.disposeAndClear();
mpAddBtn.disposeAndClear();
mpDelBtn.disposeAndClear();
mpDlg.clear();
Control::dispose();
}
void PlacesListBox::AppendPlace( const PlacePtr& pPlace )
{
maPlaces.push_back( pPlace );
mpImpl->InsertEntry( pPlace->GetName( ),
getEntryIcon( pPlace ), getEntryIcon( pPlace ) );
mxImpl->append_text(pPlace->GetName());
mxImpl->set_image(maPlaces.size() - 1, getEntryIcon(pPlace));
if(pPlace->IsEditable()) {
++mnNbEditables;
@@ -111,7 +51,6 @@ void PlacesListBox::AppendPlace( const PlacePtr& pPlace )
}
}
bool PlacesListBox::IsUpdated() {
if(mbUpdated) {
mbUpdated = false;
@@ -120,7 +59,6 @@ bool PlacesListBox::IsUpdated() {
return false;
}
void PlacesListBox::RemovePlace( sal_uInt16 nPos )
{
if ( nPos < maPlaces.size() )
@@ -130,88 +68,61 @@ void PlacesListBox::RemovePlace( sal_uInt16 nPos )
mbUpdated = true;
}
maPlaces.erase( maPlaces.begin() + nPos );
SvTreeListEntry* pEntry = mpImpl->GetEntry( nPos );
mpImpl->RemoveEntry( pEntry );
mxImpl->remove(nPos);
}
}
void PlacesListBox::RemoveSelectedPlace() {
RemovePlace(mpImpl->GetCurrRow());
RemovePlace(mxImpl->get_cursor_index());
}
void PlacesListBox::SetAddHdl( const Link<Button*,void>& rHdl )
void PlacesListBox::SetAddHdl( const Link<weld::Button&,void>& rHdl )
{
mpAddBtn->SetClickHdl( rHdl );
mxAddBtn->connect_clicked( rHdl );
}
void PlacesListBox::SetDelHdl( const Link<Button*,void>& rHdl )
void PlacesListBox::SetDelHdl( const Link<weld::Button&,void>& rHdl )
{
mpDelBtn->SetClickHdl( rHdl );
mxDelBtn->connect_clicked( rHdl );
}
void PlacesListBox::SetDelEnabled( bool enabled )
{
mpDelBtn->Enable( enabled );
mxDelBtn->set_sensitive( enabled );
}
void PlacesListBox::SetSizePixel( const Size& rNewSize )
OUString PlacesListBox::getEntryIcon( const PlacePtr& pPlace )
{
Control::SetSizePixel( rNewSize );
Size aListSize( rNewSize );
aListSize.AdjustHeight( -(26 + 18) );
mpImpl->SetSizePixel( aListSize );
sal_Int32 nBtnY = rNewSize.Height() - 26;
mpAddBtn->SetPosPixel( Point( 3, nBtnY ) );
mpDelBtn->SetPosPixel( Point( 6 + 24, nBtnY ) );
}
bool PlacesListBox::EventNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
if( rCode.GetCode() == KEY_RETURN )
{
mbSelectionChanged = true;
updateView();
return true;
}
}
return Control::EventNotify(rNEvt);
}
Image PlacesListBox::getEntryIcon( const PlacePtr& pPlace )
{
Image theImage = SvtFileDialog::GetButtonImage( BMP_FILEDLG_PLACE_LOCAL );
OUString theImage = BMP_FILEDLG_PLACE_LOCAL;
if ( !pPlace->IsLocal( ) )
theImage = SvtFileDialog::GetButtonImage( BMP_FILEDLG_PLACE_REMOTE );
theImage = BMP_FILEDLG_PLACE_REMOTE;
return theImage;
}
IMPL_LINK_NOARG( PlacesListBox, Selection, SvTreeListBox*, void )
IMPL_LINK_NOARG( PlacesListBox, Selection, weld::TreeView&, void )
{
sal_uInt32 nSelected = mpImpl->GetCurrRow();
sal_uInt32 nSelected = mxImpl->get_cursor_index();
PlacePtr pPlace = maPlaces[nSelected];
mbSelectionChanged = true;
if(pPlace->IsEditable())
if (pPlace->IsEditable())
mpDlg->RemovablePlaceSelected();
else
mpDlg->RemovablePlaceSelected(false);
updateView();
}
IMPL_LINK_NOARG( PlacesListBox, DoubleClick, SvTreeListBox*, bool )
IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool )
{
sal_uInt16 nSelected = mpImpl->GetCurrRow();
sal_uInt16 nSelected = mxImpl->get_cursor_index();
PlacePtr pPlace = maPlaces[nSelected];
if ( pPlace->IsEditable() && !pPlace->IsLocal( ) )
{
PlaceEditDialog aDlg(mpDlg->GetFrameWeld(), pPlace);
PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
short aRetCode = aDlg.run();
switch(aRetCode) {
switch (aRetCode)
{
case RET_OK :
{
pPlace->SetName ( aDlg.GetServerName() );
@@ -228,18 +139,14 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, SvTreeListBox*, bool )
break;
};
}
return false;
return true;
}
void PlacesListBox::updateView( )
{
if ( mbSelectionChanged )
{
mbSelectionChanged = false;
sal_uInt32 nSelected = mpImpl->GetCurrRow();
sal_uInt32 nSelected = mxImpl->get_cursor_index();
PlacePtr pPlace = maPlaces[nSelected];
mpDlg->OpenURL_Impl( pPlace->GetUrl( ) );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+25 -37
View File
@@ -12,46 +12,35 @@
#include "iodlg.hxx"
#include <svtools/place.hxx>
#include <vcl/svtabbx.hxx>
#include <vcl/weld.hxx>
#include <memory>
#include <vector>
typedef std::shared_ptr< Place > PlacePtr;
typedef std::shared_ptr<Place> PlacePtr;
class PlacesListBox;
class PlacesListBox_Impl : public SvHeaderTabListBox
{
private:
VclPtr<HeaderBar> mpHeaderBar;
VclPtr<PlacesListBox> mpParent;
public:
PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle );
virtual ~PlacesListBox_Impl( ) override;
virtual void dispose() override;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
};
/** ListBox to handle Places.
*/
class PlacesListBox : public Control
class PlacesListBox
{
private:
std::vector< PlacePtr > maPlaces;
VclPtr<SvtFileDialog> mpDlg;
VclPtr<PlacesListBox_Impl> mpImpl;
VclPtr<PushButton> mpAddBtn;
VclPtr<PushButton> mpDelBtn;
private:
std::vector<PlacePtr> maPlaces;
SvtFileDialog* mpDlg;
std::unique_ptr<weld::TreeView> mxImpl;
std::unique_ptr<weld::Button> mxAddBtn;
std::unique_ptr<weld::Button> mxDelBtn;
sal_Int32 mnNbEditables;
bool mbUpdated;
bool mbSelectionChanged;
public:
PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits );
virtual ~PlacesListBox( ) override;
virtual void dispose() override;
public:
PlacesListBox(std::unique_ptr<weld::TreeView> xTreeView,
std::unique_ptr<weld::Button> xAddBtn,
std::unique_ptr<weld::Button> xDelBtn,
SvtFileDialog* pFileDlg);
~PlacesListBox();
void AppendPlace( const PlacePtr& pPlace );
void RemovePlace( sal_uInt16 nPos );
@@ -60,24 +49,23 @@ class PlacesListBox : public Control
bool IsUpdated();
const std::vector<PlacePtr>& GetPlaces() const { return maPlaces;}
void SetAddHdl( const Link<Button*,void>& rHdl );
void SetDelHdl( const Link<Button*,void>& rHdl );
void SetAddHdl( const Link<weld::Button&,void>& rHdl );
void SetDelHdl( const Link<weld::Button&,void>& rHdl );
void SetDelEnabled( bool enabled );
void SetSizePixel( const Size& rNewSize ) override;
void updateView( );
const VclPtr<PushButton>& GetAddButton() const { return mpAddBtn; }
const VclPtr<PushButton>& GetDeleteButton() const { return mpDelBtn; }
const VclPtr<PlacesListBox_Impl>& GetPlacesListBox() const { return mpImpl; }
void set_help_id(const OString& rHelpId) { mxImpl->set_help_id(rHelpId); }
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
const weld::Button& GetAddButton() const { return *mxAddBtn; }
const weld::Button& GetDeleteButton() const { return *mxDelBtn; }
weld::TreeView& GetPlacesListBox() { return *mxImpl; }
private:
private:
static Image getEntryIcon( const PlacePtr& pPlace );
static OUString getEntryIcon(const PlacePtr& pPlace);
DECL_LINK( Selection, SvTreeListBox*, void );
DECL_LINK( DoubleClick, SvTreeListBox*, bool );
DECL_LINK( Selection, weld::TreeView&, void );
DECL_LINK( DoubleClick, weld::TreeView&, bool );
};
#endif
File diff suppressed because it is too large Load Diff
+37 -41
View File
@@ -52,18 +52,13 @@ enum SvtRemoteDlgType
typedef std::shared_ptr< Place > ServicePtr;
class FileViewContainer;
class RemoteFilesDialog : public SvtFileDialog_Base
{
public:
RemoteFilesDialog( vcl::Window* pParent, PickerFlags nBits );
RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits );
virtual ~RemoteFilesDialog() override;
virtual void dispose() override;
virtual void Resize() override;
virtual short Execute() override;
void Show();
virtual short run() override;
// SvtFileDialog_Base
@@ -97,7 +92,6 @@ public:
virtual void EnableAutocompletion( bool = true) override;
virtual sal_Int32 getTargetColorDepth() override;
virtual sal_Int32 getAvailableWidth() override;
virtual sal_Int32 getAvailableHeight() override;
@@ -105,7 +99,7 @@ public:
virtual bool getShowState() override;
virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
virtual void enableControl( sal_Int16 nControlId, bool bEnable ) override;
virtual OUString getCurFilter( ) const override;
@@ -123,31 +117,33 @@ private:
int m_nWidth;
int m_nHeight;
bool m_bIsInExecute;
OUString m_sPath;
OUString m_sStdDir;
OUString m_sRootLabel;
OUString m_sLastServiceUrl;
unsigned int m_nCurrentFilter;
int m_nCurrentFilter;
::rtl::Reference< ::svt::AsyncPickerAction > m_pCurrentAsyncAction;
css::uno::Sequence< OUString > m_aBlackList;
VclPtr< PushButton > m_pOk_btn;
VclPtr< CancelButton > m_pCancel_btn;
VclPtr< MenuButton > m_pAddService_btn;
VclPtr< ListBox > m_pServices_lb;
VclPtr< Breadcrumb > m_pPath;
VclPtr< PushButton > m_pNewFolder;
VclPtr< PushButton > m_pListView_btn;
VclPtr< PushButton > m_pIconView_btn;
VclPtr< Splitter > m_pSplitter;
VclPtr< FolderTree > m_pTreeView;
VclPtr< SvtFileView > m_pFileView;
VclPtr< FileViewContainer > m_pContainer;
VclPtr< ListBox > m_pFilter_lb;
VclPtr< AutocompleteEdit > m_pName_ed;
VclPtr<PopupMenu> m_pAddMenu;
std::unique_ptr<weld::Button> m_xOk_btn;
std::unique_ptr<weld::Button> m_xCancel_btn;
std::unique_ptr<weld::Toolbar> m_xAddService_bar;
std::unique_ptr<weld::Menu> m_xAddService_menu;
std::unique_ptr<weld::ComboBox> m_xServices_lb;
std::unique_ptr<weld::Container> m_xPathContainer;
std::unique_ptr<Breadcrumb> m_xPath;
std::unique_ptr<weld::Button> m_xNewFolder;
std::unique_ptr<weld::ToggleButton> m_xListView_btn;
std::unique_ptr<weld::ToggleButton> m_xIconView_btn;
std::unique_ptr<FolderTree> m_xTreeView;
std::unique_ptr<SvtFileView> m_xFileView;
std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<weld::ComboBox> m_xFilter_lb;
std::unique_ptr<AutocompleteEdit> m_xName_ed;
std::vector< ServicePtr > m_aServices;
std::vector< std::pair< OUString, OUString > > m_aFilters;
@@ -166,33 +162,33 @@ private:
void EnableControls();
void DisableControls();
void SavePassword( const OUString& rURL, const OUString& rUser
, const OUString& rPassword, bool bPersistent );
void SavePassword(const OUString& rURL, const OUString& rUser,
const OUString& rPassword, bool bPersistent);
DECL_LINK ( AddServiceHdl, Button*, void );
DECL_LINK ( SelectServiceHdl, ListBox&, void );
DECL_LINK ( EditServiceMenuHdl, MenuButton *, void );
DECL_LINK ( AddServiceHdl, const OString&, void );
DECL_LINK ( SelectServiceHdl, weld::ComboBox&, void );
DECL_LINK ( EditServiceMenuHdl, const OString&, void );
DECL_LINK( DoubleClickHdl, SvTreeListBox*, bool );
DECL_LINK( SelectHdl, SvTreeListBox*, void );
DECL_LINK( DoubleClickHdl, SvtFileView*, bool );
DECL_LINK( SelectHdl, SvtFileView*, void );
DECL_LINK( FileNameGetFocusHdl, Control&, void );
DECL_LINK( FileNameModifyHdl, Edit&, void );
DECL_LINK( FileNameGetFocusHdl, weld::Widget&, void );
DECL_LINK( FileNameModifyHdl, weld::Entry&, void );
DECL_LINK( SplitHdl, Splitter*, void );
DECL_LINK( SelectFilterHdl, ListBox&, void );
DECL_LINK( SelectFilterHdl, weld::ComboBox&, void );
DECL_LINK( TreeSelectHdl, SvTreeListBox*, void );
DECL_LINK( TreeSelectHdl, weld::TreeView&, void );
DECL_LINK( SelectBreadcrumbHdl, Breadcrumb *, void );
DECL_LINK( NewFolderHdl, Button*, void );
DECL_LINK( IconViewHdl, Button*, void );
DECL_LINK( ListViewHdl, Button*, void );
DECL_LINK( NewFolderHdl, weld::Button&, void );
DECL_LINK( IconViewHdl, weld::Button&, void );
DECL_LINK( ListViewHdl, weld::Button&, void );
DECL_LINK( OkHdl, Button*, void );
DECL_LINK( CancelHdl, Button*, void );
DECL_LINK( OkHdl, weld::Button&, void );
DECL_LINK( CancelHdl, weld::Button&, void );
};
#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
+2 -3
View File
@@ -24,7 +24,6 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.h>
#include <salhelper/simplereferenceobject.hxx>
#include <vcl/vclptr.hxx>
class SvtFileView;
class SvtFileDialog_Base;
@@ -47,8 +46,8 @@ namespace svt
private:
Action m_eAction;
VclPtr<SvtFileView> m_pView;
VclPtr<SvtFileDialog_Base> m_pDialog;
SvtFileView* m_pView;
SvtFileDialog_Base* m_pDialog;
OUString m_sURL;
OUString m_sFileName;
bool m_bRunning;
+25 -18
View File
@@ -11,11 +11,20 @@
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
AutocompleteEdit::AutocompleteEdit( vcl::Window* pParent )
: Edit( pParent )
, m_nCurrent( 0 )
AutocompleteEdit::AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry)
: m_xEntry(std::move(xEntry))
, m_nCurrent(0)
{
SetAutocompleteHdl(LINK(this, AutocompleteEdit, AutoCompleteHdl_Impl));
m_xEntry->connect_changed(LINK(this, AutocompleteEdit, ChangedHdl));
m_aChangedIdle.SetInvokeHandler(LINK(this, AutocompleteEdit, TryAutoComplete));
m_aChangedIdle.SetDebugName("fpicker::AutocompleteEdit m_aChangedIdle");
}
IMPL_LINK_NOARG(AutocompleteEdit, ChangedHdl, weld::Entry&, void)
{
m_aChangeHdl.Call(*m_xEntry);
m_aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set
}
void AutocompleteEdit::AddEntry( const OUString& rEntry )
@@ -29,18 +38,16 @@ void AutocompleteEdit::ClearEntries()
m_aMatching.clear();
}
IMPL_LINK_NOARG(AutocompleteEdit, AutoCompleteHdl_Impl, Edit&, void)
IMPL_LINK_NOARG(AutocompleteEdit, TryAutoComplete, Timer *, void)
{
if( Application::AnyInput( VclInputFlags::KEYBOARD ) )
OUString aCurText = m_xEntry->get_text();
int nStartPos, nEndPos;
m_xEntry->get_selection_bounds(nStartPos, nEndPos);
if (std::max(nStartPos, nEndPos) != aCurText.getLength())
return;
OUString aCurText = GetText();
Selection aSelection( GetSelection() );
if( aSelection.Max() != aCurText.getLength() )
return;
sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min());
auto nLen = std::min(nStartPos, nEndPos);
aCurText = aCurText.copy( 0, nLen );
if( aCurText.isEmpty() )
return;
@@ -50,11 +57,9 @@ IMPL_LINK_NOARG(AutocompleteEdit, AutoCompleteHdl_Impl, Edit&, void)
if( Match( aCurText ) )
{
m_nCurrent = 0;
SetText( m_aMatching[0] );
sal_uInt16 nNewLen = m_aMatching[0].getLength();
Selection aSel( nLen, nNewLen );
SetSelection( aSel );
m_xEntry->set_text(m_aMatching[0]);
auto nNewLen = m_aMatching[0].getLength();
m_xEntry->select_region(nLen, nNewLen);
}
}
}
@@ -77,6 +82,7 @@ bool AutocompleteEdit::Match( const OUString& rText )
return bRet;
}
#if 0
bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
@@ -103,5 +109,6 @@ bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt )
return Edit::PreNotify( rNEvt );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+21 -5
View File
@@ -10,22 +10,38 @@
#ifndef INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
#define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
#include <vcl/edit.hxx>
#include <vcl/idle.hxx>
#include <vcl/weld.hxx>
#include <vector>
class AutocompleteEdit : public Edit
class AutocompleteEdit
{
private:
std::unique_ptr<weld::Entry> m_xEntry;
std::vector< OUString > m_aEntries;
std::vector< OUString > m_aMatching;
std::vector< OUString >::size_type m_nCurrent;
Idle m_aChangedIdle;
Link<weld::Entry&, void> m_aChangeHdl;
DECL_LINK(ChangedHdl, weld::Entry&, void);
DECL_LINK(TryAutoComplete, Timer*, void);
DECL_LINK(AutoCompleteHdl_Impl, Edit&, void);
bool Match( const OUString& rText );
bool PreNotify( NotifyEvent& rNEvt ) override;
public:
AutocompleteEdit( vcl::Window* pParent );
AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry);
void show() { m_xEntry->show(); }
void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
OUString get_text() const { return m_xEntry->get_text(); }
void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
void grab_focus() { m_xEntry->grab_focus(); }
void select_region(int nStartPos, int nEndPos) { m_xEntry->select_region(nStartPos, nEndPos); }
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aChangeHdl = rLink; }
void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xEntry->connect_focus_in(rLink); }
void AddEntry( const OUString& rEntry );
void ClearEntries();
+67 -101
View File
@@ -8,76 +8,39 @@
*/
#include <tools/urlobj.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/svapp.hxx>
#include "breadcrumb.hxx"
class CustomLink : public FixedHyperlink
{
public:
CustomLink( vcl::Window* pParent, WinBits nWinStyle )
: FixedHyperlink( pParent, nWinStyle )
{
vcl::Font aFont = GetControlFont( );
aFont.SetUnderline( LINESTYLE_NONE );
SetControlFont( aFont );
}
protected:
virtual void MouseMove( const MouseEvent& rMEvt ) override
{
// changes the style if the control is enabled
if ( !rMEvt.IsLeaveWindow() && IsEnabled() )
{
vcl::Font aFont = GetControlFont( );
aFont.SetUnderline( LINESTYLE_SINGLE );
SetControlFont( aFont );
}
else
{
vcl::Font aFont = GetControlFont( );
aFont.SetUnderline( LINESTYLE_NONE );
SetControlFont( aFont );
}
FixedHyperlink::MouseMove( rMEvt );
}
};
Breadcrumb::Breadcrumb( vcl::Window* pParent ) : VclHBox( pParent )
Breadcrumb::Breadcrumb(weld::Container* pParent)
: m_pParent(pParent)
, m_nMaxWidth(m_pParent->get_preferred_size().Width())
{
m_pParent->connect_size_allocate(LINK(this, Breadcrumb, SizeAllocHdl));
m_eMode = SvtBreadcrumbMode::ONLY_CURRENT_PATH;
set_spacing( SPACING );
appendField(); // root
}
IMPL_LINK(Breadcrumb, SizeAllocHdl, const Size&, rSize, void)
{
m_nMaxWidth = rSize.Width();
}
Breadcrumb::~Breadcrumb()
{
disposeOnce();
}
void Breadcrumb::dispose()
{
for( std::vector<VclPtr<FixedHyperlink>>::size_type i = 0; i < m_aLinks.size(); i++ )
{
m_aSeparators[i].disposeAndClear();
m_aLinks[i].disposeAndClear();
}
VclHBox::dispose();
m_pParent->connect_size_allocate(Link<const Size&, void>());
}
void Breadcrumb::EnableFields( bool bEnable )
{
VclHBox::Enable( bEnable );
if( bEnable )
{
INetURLObject aURL( m_aCurrentURL );
int nSegments = aURL.getSegmentCount();
m_aLinks[nSegments]->Enable( false );
m_aSegments[nSegments]->m_xLink->set_sensitive(false);
}
}
void Breadcrumb::SetClickHdl( const Link<Breadcrumb*,void>& rLink )
void Breadcrumb::connect_clicked( const Link<Breadcrumb*,void>& rLink )
{
m_aClickHdl = rLink;
}
@@ -92,13 +55,13 @@ void Breadcrumb::SetRootName( const OUString& rURL )
m_sRootName = rURL;
// we changed root - clear all fields
for( std::vector<VclPtr<FixedHyperlink>>::size_type i = 1; i < m_aLinks.size(); i++ )
for (size_t i = 1; i < m_aSegments.size(); ++i)
{
m_aLinks[i]->SetText( "" );
m_aSegments[i]->m_xLink->set_label("");
m_aLinks[i]->Hide();
m_aSeparators[i]->Hide();
m_aLinks[i]->Enable();
m_aSegments[i]->m_xLink->hide();
m_aSegments[i]->m_xSeparator->hide();
m_aSegments[i]->m_xLink->set_sensitive(true);
}
}
@@ -130,16 +93,16 @@ void Breadcrumb::SetURL( const OUString& rURL )
bool bClear = ( m_eMode == SvtBreadcrumbMode::ONLY_CURRENT_PATH );
// root field
m_aLinks[0]->SetText( m_sRootName );
m_aLinks[0]->Enable();
m_aLinks[0]->SetURL( sRootPath );
m_aSegments[0]->m_xLink->set_label( m_sRootName );
m_aSegments[0]->m_xLink->set_sensitive(true);
m_aSegments[0]->m_xLink->set_uri(sRootPath);
m_aUris[m_aSegments[0]->m_xLink.get()] = sRootPath;
// fill the other fields
for( unsigned int i = 1; i < static_cast<unsigned int>(nSegments) + 1; i++ )
{
if( i >= m_aLinks.size() )
if( i >= m_aSegments.size() )
appendField();
unsigned int nEnd = sPath.indexOf( '/', nPos + 1 );
@@ -147,37 +110,33 @@ void Breadcrumb::SetURL( const OUString& rURL )
if( m_eMode == SvtBreadcrumbMode::ALL_VISITED )
{
if( m_aLinks[i]->GetText() != sLabel )
if( m_aSegments[i]->m_xLink->get_label() != sLabel )
bClear = true;
}
m_aLinks[i]->SetText( sLabel );
m_aLinks[i]->SetURL( sRootPath + sPath.copy( 0, nEnd ) );
m_aLinks[i]->Hide();
m_aLinks[i]->Enable();
m_aSegments[i]->m_xLink->set_label( sLabel );
m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.copy(0, nEnd);
m_aSegments[i]->m_xLink->hide();
m_aSegments[i]->m_xLink->set_sensitive(true);
m_aSeparators[i]->Hide();
m_aSegments[i]->m_xSeparator->hide();
nPos = nEnd;
}
// clear unused fields
for( std::vector<VclPtr<FixedHyperlink>>::size_type i = nSegments + 1; i < m_aLinks.size(); i++ )
for (size_t i = nSegments + 1; i < m_aSegments.size(); i++ )
{
if( bClear )
m_aLinks[i]->SetText( "" );
m_aSegments[i]->m_xLink->set_label( "" );
m_aLinks[i]->Hide();
m_aSeparators[i]->Hide();
m_aLinks[i]->Enable();
m_aSegments[i]->m_xLink->hide();
m_aSegments[i]->m_xSeparator->hide();
m_aSegments[i]->m_xLink->set_sensitive(true);
}
// show fields
Resize();
unsigned int nMaxWidth = GetSizePixel().Width();
unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width();
unsigned int nSeparatorWidth = m_aSegments[0]->m_xSeparator->get_preferred_size().Width();
unsigned int nCurrentWidth = 0;
unsigned int nLastVisible = nSegments;
@@ -195,9 +154,9 @@ void Breadcrumb::SetURL( const OUString& rURL )
{
unsigned int nIndex = nSegments - i;
if( showField( nIndex, nMaxWidth - nCurrentWidth ) )
if( showField( nIndex, m_nMaxWidth - nCurrentWidth ) )
{
nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width()
nCurrentWidth += m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
+ nSeparatorWidth + 2*SPACING;
}
else
@@ -205,27 +164,27 @@ void Breadcrumb::SetURL( const OUString& rURL )
// label is too long
if( nSegments != 0 )
{
m_aLinks[0]->SetText( "..." );
m_aLinks[0]->Enable( false );
m_aSegments[0]->m_xLink->set_label("...");
m_aSegments[0]->m_xLink->set_sensitive(false);
}
bLeft = false;
}
}
if( nSegments + i == static_cast<int>(m_aLinks.size()) )
if( nSegments + i == static_cast<int>(m_aSegments.size()) )
bRight = false;
if( i != 0 && bRight )
{
unsigned int nIndex = nSegments + i;
if( m_aLinks[nIndex]->GetText().isEmpty() )
if( m_aSegments[nIndex]->m_xLink->get_label().isEmpty() )
{
bRight = false;
}
else if( showField( nIndex, nMaxWidth - nCurrentWidth ) )
else if( showField( nIndex, m_nMaxWidth - nCurrentWidth ) )
{
nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width()
nCurrentWidth += m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
+ nSeparatorWidth + 3*SPACING;
nLastVisible = nIndex;
}
@@ -239,10 +198,10 @@ void Breadcrumb::SetURL( const OUString& rURL )
}
// current dir should be inactive
m_aLinks[nSegments]->Enable( false );
m_aSegments[nSegments]->m_xLink->set_sensitive(false);
// hide last separator
m_aSeparators[nLastVisible]->Hide();
m_aSegments[nLastVisible]->m_xSeparator->hide();
}
void Breadcrumb::SetMode( SvtBreadcrumbMode eMode )
@@ -252,30 +211,29 @@ void Breadcrumb::SetMode( SvtBreadcrumbMode eMode )
void Breadcrumb::appendField()
{
m_aLinks.push_back( VclPtr< CustomLink >::Create( this, WB_TABSTOP ) );
m_aLinks[m_aLinks.size() - 1]->Hide();
m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );
m_aSeparators.push_back( VclPtr< FixedText >::Create( this ) );
m_aSeparators[m_aLinks.size() - 1]->SetText( ">" );
m_aSeparators[m_aLinks.size() - 1]->Hide();
m_aSegments.emplace_back(std::make_unique<BreadcrumbPath>(m_pParent));
size_t nIndex = m_aSegments.size() - 1;
m_aSegments[nIndex]->m_xLink->hide();
m_aSegments[nIndex]->m_xLink->connect_clicked( LINK( this, Breadcrumb, ClickLinkHdl ) );
m_aSegments[nIndex]->m_xSeparator->set_label( ">" );
m_aSegments[nIndex]->m_xSeparator->hide();
}
bool Breadcrumb::showField( unsigned int nIndex, unsigned int nWidthMax )
{
m_aLinks[nIndex]->Show();
m_aSeparators[nIndex]->Show();
m_aSegments[nIndex]->m_xLink->show();
m_aSegments[nIndex]->m_xSeparator->show();
unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width();
unsigned int nWidth = m_aLinks[nIndex]->GetSizePixel().Width()
unsigned int nSeparatorWidth = m_aSegments[0]->m_xSeparator->get_preferred_size().Width();
unsigned int nWidth = m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
+ nSeparatorWidth + 3*SPACING;
if( nWidth > nWidthMax )
{
if( nIndex != 0 )
{
m_aLinks[nIndex]->Hide();
m_aSeparators[nIndex]->Hide();
m_aSegments[nIndex]->m_xLink->hide();
m_aSegments[nIndex]->m_xSeparator->hide();
}
return false;
@@ -284,10 +242,18 @@ bool Breadcrumb::showField( unsigned int nIndex, unsigned int nWidthMax )
return true;
}
IMPL_LINK( Breadcrumb, ClickLinkHdl, FixedHyperlink&, rLink, void )
IMPL_LINK( Breadcrumb, ClickLinkHdl, weld::LinkButton&, rLink, void )
{
m_sClickedURL = rLink.GetURL();
m_sClickedURL = m_aUris[&rLink];
m_aClickHdl.Call( this );
}
BreadcrumbPath::BreadcrumbPath(weld::Container* pContainer)
: m_xBuilder(Application::CreateBuilder(pContainer, "fps/ui/breadcrumb.ui"))
, m_xContainer(m_xBuilder->weld_container("container"))
, m_xLink(m_xBuilder->weld_link_button("link"))
, m_xSeparator(m_xBuilder->weld_label("label"))
{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+24 -16
View File
@@ -10,12 +10,10 @@
#ifndef INCLUDED_SVTOOLS_BREADCRUMB_HXX
#define INCLUDED_SVTOOLS_BREADCRUMB_HXX
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>
#include <map>
#include <vector>
class FixedHyperlink;
#define SPACING 6
enum SvtBreadcrumbMode
@@ -24,13 +22,23 @@ enum SvtBreadcrumbMode
ALL_VISITED = 1
};
class CustomLink;
class Breadcrumb : public VclHBox
struct BreadcrumbPath
{
private:
std::vector< VclPtr< CustomLink > > m_aLinks;
std::vector< VclPtr< FixedText > > m_aSeparators;
BreadcrumbPath(weld::Container* pParent);
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<weld::LinkButton> m_xLink;
std::unique_ptr<weld::Label> m_xSeparator;
};
class Breadcrumb
{
private:
weld::Container* m_pParent;
int m_nMaxWidth;
std::vector<std::unique_ptr<BreadcrumbPath>> m_aSegments;
std::map<weld::LinkButton*, OUString> m_aUris;
OUString m_sRootName;
OUString m_sClickedURL;
@@ -43,16 +51,16 @@ class Breadcrumb : public VclHBox
void appendField();
bool showField( unsigned int nIndex, unsigned int nWidthMax );
DECL_LINK( ClickLinkHdl, FixedHyperlink&, void );
DECL_LINK(SizeAllocHdl, const Size&, void);
DECL_LINK(ClickLinkHdl, weld::LinkButton&, void);
public:
Breadcrumb( vcl::Window* pParent );
virtual ~Breadcrumb() override;
public:
Breadcrumb(weld::Container* pParent);
~Breadcrumb();
void dispose() override;
void EnableFields( bool bEnable );
void SetClickHdl( const Link<Breadcrumb*,void>& rLink );
void connect_clicked( const Link<Breadcrumb*,void>& rLink );
const OUString& GetHdlURL() const;
void SetRootName( const OUString& rURL );
+47 -56
View File
@@ -52,7 +52,6 @@ namespace svt
OCommonPicker::OCommonPicker()
:OCommonPicker_Base( m_aMutex )
,OPropertyContainer( GetBroadcastHelper() )
,m_pDlg( nullptr )
,m_nCancelEvent( nullptr )
,m_bExecuting( false )
{
@@ -105,7 +104,7 @@ namespace svt
{
// set the title
if ( !m_aTitle.isEmpty() )
m_pDlg->SetText( m_aTitle );
m_xDlg->set_title(m_aTitle);
}
}
@@ -121,11 +120,11 @@ namespace svt
{
::osl::MutexGuard aOwnGuard( m_aMutex );
if ( m_bExecuting && m_pDlg )
m_pDlg->EndDialog();
if ( m_bExecuting && m_xDlg )
m_xDlg->response(RET_CANCEL);
}
m_pDlg.disposeAndClear();
m_xDlg.reset();
m_xWindow = nullptr;
m_xDialogParent = nullptr;
}
@@ -137,9 +136,7 @@ namespace svt
disposeComponent( m_xParentListenerAdapter );
}
// XEventListener
void SAL_CALL OCommonPicker::disposing( const EventObject& _rSource )
{
SolarMutexGuard aGuard;
@@ -150,11 +147,16 @@ namespace svt
{
stopWindowListening();
if ( !bDialogDying ) // it's the parent which is dying -> delete the dialog
m_pDlg.disposeAndClear();
else
m_pDlg.clear();
SAL_WARN_IF(bDialogDying && m_bExecuting, "fpicker.office", "unexpected disposing before response" );
// it's the parent which is dying -> delete the dialog
{
::osl::MutexGuard aOwnGuard(m_aMutex);
if (m_bExecuting && m_xDlg)
m_xDlg->response(RET_CANCEL);
}
m_xDlg.reset();
m_xWindow = nullptr;
m_xDialogParent = nullptr;
}
@@ -164,9 +166,7 @@ namespace svt
}
}
// property set related methods
::cppu::IPropertyArrayHelper* OCommonPicker::createArrayHelper( ) const
{
Sequence< Property > aProps;
@@ -174,50 +174,51 @@ namespace svt
return new cppu::OPropertyArrayHelper( aProps );
}
::cppu::IPropertyArrayHelper& SAL_CALL OCommonPicker::getInfoHelper()
{
return *getArrayHelper();
}
Reference< XPropertySetInfo > SAL_CALL OCommonPicker::getPropertySetInfo( )
{
return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
}
void SAL_CALL OCommonPicker::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
void SAL_CALL OCommonPicker::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue)
{
OPropertyContainer::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, rValue);
// if the HelpURL changed, forward this to the dialog
if ( PROPERTY_ID_HELPURL == _nHandle )
if ( m_pDlg )
OControlAccess::setHelpURL( m_pDlg, m_sHelpURL, false );
if (PROPERTY_ID_HELPURL == nHandle && m_xDlg)
{
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
aAccess.setHelpURL(m_xDlg->getDialog(), m_sHelpURL);
}
}
bool OCommonPicker::createPicker()
{
if ( !m_pDlg )
if ( !m_xDlg )
{
m_pDlg.reset( implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ) );
SAL_WARN_IF( !m_pDlg, "fpicker.office", "OCommonPicker::createPicker: invalid dialog returned!" );
m_xDlg = implCreateDialog(Application::GetFrameWeld(m_xDialogParent));
SAL_WARN_IF( !m_xDlg, "fpicker.office", "OCommonPicker::createPicker: invalid dialog returned!" );
if ( m_pDlg )
if ( m_xDlg )
{
weld::Dialog* pDlg = m_xDlg->getDialog();
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
// synchronize the help id of the dialog without help URL property
if ( !m_sHelpURL.isEmpty() )
{ // somebody already set the help URL while we had no dialog yet
OControlAccess::setHelpURL( m_pDlg, m_sHelpURL, false );
aAccess.setHelpURL(pDlg, m_sHelpURL);
}
else
{
m_sHelpURL = OControlAccess::getHelpURL( m_pDlg, false );
m_sHelpURL = aAccess.getHelpURL(pDlg);
}
m_xWindow = VCLUnoHelper::GetInterface( m_pDlg );
m_xWindow = pDlg->GetXWindow();
// add as event listener to the window
OSL_ENSURE( m_xWindow.is(), "OCommonPicker::createFileDialog: invalid window component!" );
@@ -227,10 +228,14 @@ namespace svt
// the adapter will add itself as listener, and forward notifications
}
VclPtr<vcl::Window> xVclDialog(VCLUnoHelper::GetWindow(m_xWindow));
if (xVclDialog) // this block is quite possibly unnecessary by now
{
// _and_ add as event listener to the parent - in case the parent is destroyed
// before we are disposed, our disposal would access dead VCL windows then...
m_xDialogParent = VCLUnoHelper::GetInterface( m_pDlg->GetParent() );
OSL_ENSURE( m_xDialogParent.is() || !m_pDlg->GetParent(), "OCommonPicker::createFileDialog: invalid window component (the parent this time)!" );
m_xDialogParent = VCLUnoHelper::GetInterface(xVclDialog->GetParent());
OSL_ENSURE(m_xDialogParent.is() || !xVclDialog->GetParent(), "OCommonPicker::createFileDialog: invalid window component (the parent this time)!");
}
if ( m_xDialogParent.is() )
{
m_xParentListenerAdapter = new OWeakEventListenerAdapter( this, m_xDialogParent );
@@ -239,12 +244,10 @@ namespace svt
}
}
return nullptr != m_pDlg;
return nullptr != m_xDlg;
}
// XControlAccess functions
void SAL_CALL OCommonPicker::setControlProperty( const OUString& aControlName, const OUString& aControlProperty, const Any& aValue )
{
checkAlive();
@@ -252,12 +255,11 @@ namespace svt
SolarMutexGuard aGuard;
if ( createPicker() )
{
::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
aAccess.setControlProperty( aControlName, aControlProperty, aValue );
}
}
Any SAL_CALL OCommonPicker::getControlProperty( const OUString& aControlName, const OUString& aControlProperty )
{
checkAlive();
@@ -265,16 +267,14 @@ namespace svt
SolarMutexGuard aGuard;
if ( createPicker() )
{
::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
return aAccess.getControlProperty( aControlName, aControlProperty );
}
return Any();
}
// XControlInformation functions
Sequence< OUString > SAL_CALL OCommonPicker::getSupportedControls( )
{
checkAlive();
@@ -282,14 +282,13 @@ namespace svt
SolarMutexGuard aGuard;
if ( createPicker() )
{
::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
return aAccess.getSupportedControls( );
}
return Sequence< OUString >();
}
sal_Bool SAL_CALL OCommonPicker::isControlSupported( const OUString& aControlName )
{
checkAlive();
@@ -303,7 +302,6 @@ namespace svt
return false;
}
Sequence< OUString > SAL_CALL OCommonPicker::getSupportedControlProperties( const OUString& aControlName )
{
checkAlive();
@@ -311,14 +309,13 @@ namespace svt
SolarMutexGuard aGuard;
if ( createPicker() )
{
::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
return aAccess.getSupportedControlProperties( aControlName );
}
return Sequence< OUString >();
}
sal_Bool SAL_CALL OCommonPicker::isControlPropertySupported( const OUString& aControlName, const OUString& aControlProperty )
{
checkAlive();
@@ -326,7 +323,7 @@ namespace svt
SolarMutexGuard aGuard;
if ( createPicker() )
{
::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
return aAccess.isControlPropertySupported( aControlName, aControlProperty );
}
@@ -387,11 +384,10 @@ namespace svt
m_nCancelEvent = Application::PostUserEvent( LINK( this, OCommonPicker, OnCancelPicker ) );
}
IMPL_LINK_NOARG(OCommonPicker, OnCancelPicker, void*, void)
{
// By definition, the solar mutex is locked when we arrive here. Note that this
// is important, as for instance the consistency of m_pDlg depends on this mutex.
// is important, as for instance the consistency of m_xDlg depends on this mutex.
::osl::MutexGuard aGuard( m_aMutex );
m_nCancelEvent = nullptr;
@@ -401,14 +397,12 @@ namespace svt
// being executed at this time.
return;
OSL_ENSURE( getDialog(), "OCommonPicker::OnCancelPicker: executing, but no dialog!" );
if ( getDialog() )
getDialog()->EndDialog();
OSL_ENSURE( m_xDlg, "OCommonPicker::OnCancelPicker: executing, but no dialog!" );
if (m_xDlg)
m_xDlg->response(RET_CANCEL);
}
// XInitialization functions
void SAL_CALL OCommonPicker::initialize( const Sequence< Any >& _rArguments )
{
checkAlive();
@@ -462,7 +456,6 @@ namespace svt
}
}
bool OCommonPicker::implHandleInitializationArgument( const OUString& _rName, const Any& _rValue )
{
bool bKnown = true;
@@ -470,15 +463,13 @@ namespace svt
{
m_xDialogParent.clear();
OSL_VERIFY( _rValue >>= m_xDialogParent );
OSL_ENSURE( VCLUnoHelper::GetWindow( m_xDialogParent ), "OCommonPicker::implHandleInitializationArgument: invalid parent window given!" );
OSL_ENSURE( m_xDialogParent.is(), "OCommonPicker::implHandleInitializationArgument: invalid parent window given!" );
}
else
bKnown = false;
return bKnown;
}
} // namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+3 -5
View File
@@ -31,10 +31,9 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/uno3.hxx>
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>
class SvtFileDialog_Base;
namespace vcl { class Window; }
namespace weld { class Window; }
struct ImplSVEvent;
namespace svt
@@ -61,7 +60,6 @@ namespace svt
css::uno::Reference< css::awt::XWindow > m_xWindow;
// </properties>
VclPtr<SvtFileDialog_Base> m_pDlg;
ImplSVEvent * m_nCancelEvent;
bool m_bExecuting;
@@ -75,7 +73,7 @@ namespace svt
OUString m_aDisplayDirectory;
protected:
SvtFileDialog_Base* getDialog() { return m_pDlg; }
std::shared_ptr<SvtFileDialog_Base> m_xDlg;
const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; }
::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; }
@@ -89,7 +87,7 @@ namespace svt
// overridables
// will be called with locked SolarMutex
virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) = 0;
virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) = 0;
virtual sal_Int16 implExecutePicker( ) = 0;
// do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
+4 -2
View File
@@ -45,9 +45,11 @@ namespace svt
public:
OUString maType;
OUString maTargetURL;
OUString maDisplayText;
OUString maDisplayName;
OUString maDisplaySize;
OUString maDisplayDate;
DateTime maModDate;
Image maImage;
OUString maImage;
sal_Int64 maSize;
bool mbIsFolder;
bool mbIsVolume;
File diff suppressed because it is too large Load Diff
+25 -28
View File
@@ -22,6 +22,8 @@
#include <memory>
#include <com/sun/star/uno/Sequence.h>
#include <vcl/ctrl.hxx>
#include <vcl/errinf.hxx>
#include <vcl/weld.hxx>
#include <rtl/ustring.hxx>
namespace com :: sun :: star :: ucb { class XContent; }
@@ -29,10 +31,7 @@ namespace com :: sun :: star :: ucb { class XContent; }
// class SvtFileView -----------------------------------------------------
class SvtFileView_Impl;
class SvTreeListEntry;
class HeaderBar;
struct SvtContentEntry;
class SvTreeListBox;
/// the result of an action in the FileView
enum FileViewResult
@@ -62,38 +61,39 @@ struct FileViewAsyncAction
}
};
class SvtFileView : public Control
class SvtFileView
{
private:
std::unique_ptr<SvtFileView_Impl> mpImpl;
css::uno::Sequence< OUString > mpBlackList;
css::uno::Sequence<OUString> maBlackList;
DECL_LINK( HeaderSelect_Impl, HeaderBar*, void );
DECL_LINK( HeaderEndDrag_Impl, HeaderBar*, void );
protected:
virtual void GetFocus() override;
DECL_LINK(HeaderSelect_Impl, int, void);
public:
SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection, bool bShowType = true );
virtual ~SvtFileView() override;
virtual void dispose() override;
virtual Size GetOptimalSize() const override;
SvtFileView(weld::Window* pTopLevel,
std::unique_ptr<weld::TreeView> xTreeView,
std::unique_ptr<weld::IconView> xIconView,
bool bOnlyFolder, bool bMultiSelection, bool bShowType = true);
virtual ~SvtFileView();
void SetViewMode( FileViewMode eMode );
const OUString& GetViewURL() const;
static OUString GetURL( SvTreeListEntry const * pEntry );
OUString GetURL(const weld::TreeIter& rEntry) const;
OUString GetCurrentURL() const;
bool GetParentURL( OUString& _rParentURL ) const;
void CreatedFolder( const OUString& rUrl, const OUString& rNewFolder );
void SetHelpId( const OString& rHelpId );
const OString& GetHelpId( ) const;
void SetSizePixel( const Size& rNewSize ) override;
virtual void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override;
void set_help_id(const OString& rHelpId);
OString get_help_id() const;
void grab_focus();
bool has_focus() const;
OUString get_selected_text() const;
weld::Widget* identifier() const; // just to uniquely identify this widget
/** initialize the view with the content of a folder given by URL, and apply an immediate filter
@@ -153,14 +153,14 @@ public:
void SetNoSelection();
void SetSelectHdl( const Link<SvTreeListBox*,void>& rHdl );
void SetDoubleClickHdl( const Link<SvTreeListBox*,bool>& rHdl );
void SetSelectHdl( const Link<SvtFileView*,void>& rHdl );
void SetDoubleClickHdl( const Link<SvtFileView*,bool>& rHdl );
void SetOpenDoneHdl( const Link<SvtFileView*,void>& rHdl );
sal_uLong GetSelectionCount() const;
SvTreeListEntry* FirstSelected() const;
SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const;
void EnableAutoResize();
SvtContentEntry* FirstSelected() const;
void selected_foreach(const std::function<bool(weld::TreeIter&)>& func);
void EnableDelete( bool bEnable );
@@ -171,9 +171,6 @@ public:
void EndInplaceEditing();
::std::vector< SvtContentEntry > GetContent();
protected:
virtual void StateChanged( StateChangedType nStateChange ) override;
};
// struct SvtContentEntry ------------------------------------------------
+58 -52
View File
@@ -11,9 +11,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <vcl/dialog.hxx>
#include <vcl/treelistentry.hxx>
#include <vcl/ptrstyle.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
#include "contentenumeration.hxx"
#include "foldertree.hxx"
@@ -21,44 +19,51 @@
using namespace ::com::sun::star::task;
FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits )
: SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP )
FolderTree::FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel)
: m_xTreeView(std::move(xTreeView))
, m_pTopLevel(pTopLevel)
{
m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 24,
m_xTreeView->get_height_rows(7));
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);
m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
Image aFolderImage(StockImage::Yes, RID_BMP_FOLDER);
Image aFolderExpandedImage(StockImage::Yes, RID_BMP_FOLDER_OPEN);
SetDefaultCollapsedEntryBmp( aFolderImage );
SetDefaultExpandedEntryBmp( aFolderExpandedImage );
m_xTreeView->connect_expanding(LINK(this, FolderTree, RequestingChildrenHdl));
}
void FolderTree::RequestingChildren( SvTreeListEntry* pEntry )
IMPL_LINK(FolderTree, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool)
{
EnableChildPointerOverwrite( true );
SetPointer( PointerStyle::Wait );
Invalidate(InvalidateFlags::Update);
weld::WaitObject aWait(m_pTopLevel);
FillTreeEntry( pEntry );
FillTreeEntry(rEntry);
SetPointer( PointerStyle::Arrow );
EnableChildPointerOverwrite( false );
return true;
}
void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
void FolderTree::InsertRootEntry(const OUString& rId, const OUString& rRootLabel)
{
if( !pEntry )
return;
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
OUString sFolderImage(RID_BMP_FOLDER);
m_xTreeView->insert(nullptr, -1, &rRootLabel, &rId, nullptr, nullptr,
&sFolderImage, true, xEntry.get());
m_xTreeView->set_cursor(*xEntry);
}
OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() );
void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry)
{
OUString sURL = m_xTreeView->get_id(rEntry);
OUString sFolderImage(RID_BMP_FOLDER);
if( pURL && m_sLastUpdatedDir != *pURL )
if (m_sLastUpdatedDir != sURL)
{
while (SvTreeListEntry* pChild = FirstChild(pEntry))
while (m_xTreeView->iter_has_child(rEntry))
{
GetModel()->Remove(pChild);
std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(&rEntry));
m_xTreeView->iter_children(*xChild);
m_xTreeView->remove(*xChild);
}
::std::vector< std::unique_ptr<SortingData_Impl> > aContent;
@@ -67,22 +72,19 @@ void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
xContentEnumerator(new FileViewContentEnumerator(
m_xEnv, aContent, m_aMutex));
FolderDescriptor aFolder( *pURL );
FolderDescriptor aFolder(sURL);
EnumerationResult eResult =
xContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList );
if ( EnumerationResult::SUCCESS == eResult )
if (EnumerationResult::SUCCESS == eResult)
{
for(const auto & i : aContent)
{
if( i->mbIsFolder )
{
SvTreeListEntry* pNewEntry = InsertEntry( i->GetTitle(), pEntry, true );
OUString* sData = new OUString( i->maTargetURL );
pNewEntry->SetUserData( static_cast< void* >( sData ) );
}
if (!i->mbIsFolder)
continue;
m_xTreeView->insert(&rEntry, -1, &i->GetTitle(), &i->maTargetURL,
nullptr, nullptr, &sFolderImage, true, nullptr);
}
}
}
@@ -96,27 +98,30 @@ void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders )
{
SetTreePath( rUrl );
SetTreePath(rUrl);
SvTreeListEntry* pParent = GetCurEntry();
std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator());
bool bParent = m_xTreeView->get_cursor(xParent.get());
if( !(pParent && !IsExpanded( pParent )) )
if (!bParent || m_xTreeView->get_row_expanded(*xParent))
return;
while (SvTreeListEntry* pChild = FirstChild(pParent))
OUString sFolderImage(RID_BMP_FOLDER);
while (m_xTreeView->iter_has_child(*xParent))
{
GetModel()->Remove(pChild);
std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(xParent.get()));
m_xTreeView->iter_children(*xChild);
m_xTreeView->remove(*xChild);
}
for (auto const& folder : rFolders)
{
SvTreeListEntry* pNewEntry = InsertEntry( folder.first, pParent, true );
OUString* sData = new OUString( folder.second );
pNewEntry->SetUserData( static_cast< void* >( sData ) );
m_xTreeView->insert(xParent.get(), -1, &folder.first, &folder.second,
nullptr, nullptr, &sFolderImage, true, nullptr);
}
m_sLastUpdatedDir = rUrl;
Expand( pParent );
m_xTreeView->expand_row(*xParent);
}
void FolderTree::SetTreePath( OUString const & sUrl )
@@ -126,14 +131,15 @@ void FolderTree::SetTreePath( OUString const & sUrl )
OUString sPath = aUrl.GetURLPath( INetURLObject::DecodeMechanism::WithCharset );
SvTreeListEntry* pEntry = First();
bool end = false;
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
bool bEntry = m_xTreeView->get_iter_first(*xEntry);
bool bEnd = false;
while( pEntry && !end )
while (bEntry && !bEnd)
{
if( pEntry->GetUserData() )
if (!m_xTreeView->get_id(*xEntry).isEmpty())
{
OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
OUString sNodeUrl = m_xTreeView->get_id(*xEntry);
INetURLObject aUrlObj( sNodeUrl );
aUrlObj.setFinalSlash();
@@ -142,19 +148,19 @@ void FolderTree::SetTreePath( OUString const & sUrl )
if( sPath == sNodeUrl )
{
Select( pEntry );
end = true;
m_xTreeView->select(*xEntry);
bEnd = true;
}
else if( sPath.startsWith( sNodeUrl ) )
{
if( !IsExpanded( pEntry ) )
Expand( pEntry );
if (!m_xTreeView->get_row_expanded(*xEntry))
m_xTreeView->expand_row(*xEntry);
pEntry = FirstChild( pEntry );
bEntry = m_xTreeView->iter_children(*xEntry);
}
else
{
pEntry = pEntry->NextSibling();
bEntry = m_xTreeView->iter_next_sibling(*xEntry);
}
}
else
+15 -11
View File
@@ -11,35 +11,39 @@
#define INCLUDED_SVTOOLS_FOLDERTREE_HXX
#include <com/sun/star/uno/Sequence.hxx>
#include <tools/wintypes.hxx>
#include <vcl/treelistbox.hxx>
#include <vcl/weld.hxx>
namespace com :: sun :: star :: ucb { class XCommandEnvironment; }
class SvTreeListEntry;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using namespace ::svt;
class FolderTree : public SvTreeListBox
class FolderTree
{
private:
std::unique_ptr<weld::TreeView> m_xTreeView;
weld::Window* m_pTopLevel;
Reference< XCommandEnvironment > m_xEnv;
::osl::Mutex m_aMutex;
Sequence< OUString > m_aBlackList;
OUString m_sLastUpdatedDir;
DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
public:
FolderTree( vcl::Window* pParent, WinBits nBits );
FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel);
virtual void RequestingChildren( SvTreeListEntry* pEntry ) override;
void clear() { m_xTreeView->clear(); }
void FillTreeEntry( SvTreeListEntry* pEntry );
void FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders );
void SetTreePath( OUString const & sUrl );
void SetBlackList( const css::uno::Sequence< OUString >& rBlackList );
void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
void InsertRootEntry(const OUString& rId, const OUString& rRootLabel);
void FillTreeEntry(const weld::TreeIter& rEntry);
void FillTreeEntry(const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders);
void SetTreePath(OUString const & sUrl);
void SetBlackList(const css::uno::Sequence< OUString >& rBlackList);
};
#endif
+6 -5
View File
@@ -19,7 +19,7 @@
#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX
#define INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX
#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -57,14 +57,16 @@ namespace o3tl {
// SvtFileDialog_Base
class SvtFileDialog_Base : public Dialog, public ::svt::IFilePickerController
class SvtFileDialog_Base : public weld::GenericDialogController, public ::svt::IFilePickerController
{
public:
SvtFileDialog_Base( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription )
: Dialog(pParent, rID, rUIXMLDescription)
SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID)
: weld::GenericDialogController(pParent, rUIXMLDescription, rID)
{
}
virtual bool PrepareExecute() { return true ; }
virtual SvtFileView* GetView() = 0;
virtual void SetHasFilename( bool bHasFilename ) = 0;
@@ -94,7 +96,6 @@ public:
virtual void EnableAutocompletion( bool _bEnable = true ) = 0;
virtual sal_Int32 getTargetColorDepth() = 0;
virtual sal_Int32 getAvailableWidth() = 0;
virtual sal_Int32 getAvailableHeight() = 0;
File diff suppressed because it is too large Load Diff
+54 -69
View File
@@ -44,9 +44,8 @@
class SvTabListBox;
class SvtFileView;
class SvtFileDialogFilter_Impl;
class SvtURLBox;
class SvtExpFileDlg_Impl;
class CustomContainer;
class URLBox;
enum class AdjustFilterFlags {
NONE = 0x0000,
@@ -62,25 +61,24 @@ namespace o3tl {
class SvtFileDialog final : public SvtFileDialog_Base
{
private:
VclPtr<CheckBox> _pCbReadOnly;
VclPtr<CheckBox> _pCbLinkBox;
VclPtr<CheckBox> _pCbPreviewBox;
VclPtr<CheckBox> _pCbSelection;
VclPtr<PushButton> _pPbPlay;
VclPtr<vcl::Window> _pPrevWin;
VclPtr<FixedBitmap> _pPrevBmp;
VclPtr<CustomContainer> _pContainer;
VclPtr<SvtFileView> _pFileView;
VclPtr<Splitter> _pSplitter;
::svt::IFilePickerListener* _pFileNotifier;
std::unique_ptr<SvtExpFileDlg_Impl> pImpl;
PickerFlags _nPickerFlags;
bool _bIsInExecute : 1;
std::unique_ptr<weld::CheckButton> m_xCbReadOnly;
std::unique_ptr<weld::CheckButton> m_xCbLinkBox;
std::unique_ptr<weld::CheckButton> m_xCbPreviewBox;
std::unique_ptr<weld::CheckButton> m_xCbSelection;
std::unique_ptr<weld::Button> m_xPbPlay;
std::unique_ptr<weld::Widget> m_xPreviewFrame;
std::unique_ptr<weld::Image> m_xPrevBmp;
std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<SvtFileView> m_xFileView;
::svt::IFilePickerListener* m_pFileNotifier;
std::unique_ptr<SvtExpFileDlg_Impl> m_xImpl;
Size m_aPreviewSize;
PickerFlags m_nPickerFlags;
bool m_bIsInExecute : 1;
::svt::SmartContent m_aContent;
::std::set< VclPtr<Control> >
m_aDisabledControls;
::std::set<weld::Widget*> m_aDisabledControls;
::utl::OConfigurationNode m_aConfiguration;
::rtl::Reference< ::svt::AsyncPickerAction >
@@ -88,26 +86,26 @@ private:
bool m_bInExecuteAsync;
bool m_bHasFilename;
css::uno::Reference < css::uno::XComponentContext >
m_context;
m_xContext;
DECL_LINK( FilterSelectHdl_Impl, ListBox&, void );
DECL_LINK( FilterSelectHdl_Impl, weld::ComboBox&, void );
DECL_LINK( FilterSelectTimerHdl_Impl, Timer*, void );
DECL_LINK( NewFolderHdl_Impl, Button*, void );
DECL_LINK( OpenUrlHdl_Impl, SvtURLBox*, void );
DECL_LINK( OpenClickHdl_Impl, Button*, void );
DECL_LINK( CancelHdl_Impl, Button*, void );
DECL_LINK( FileNameGetFocusHdl_Impl, Control&, void );
DECL_LINK( FileNameModifiedHdl_Impl, Edit&, void );
DECL_LINK( NewFolderHdl_Impl, weld::Button&, void );
DECL_LINK( OpenUrlHdl_Impl, weld::ComboBox&, bool );
DECL_LINK( OpenClickHdl_Impl, weld::Button&, void );
DECL_LINK( CancelHdl_Impl, weld::Button&, void );
DECL_LINK( FileNameGetFocusHdl_Impl, weld::Widget&, void );
DECL_LINK( FileNameModifiedHdl_Impl, weld::ComboBox&, void );
DECL_LINK( URLBoxModifiedHdl_Impl, SvtURLBox*, void );
DECL_LINK( ConnectToServerPressed_Hdl, Button*, void );
DECL_LINK( URLBoxModifiedHdl_Impl, weld::ComboBox&, bool );
DECL_LINK( ConnectToServerPressed_Hdl, weld::Button&, void );
DECL_LINK( AddPlacePressed_Hdl, Button*, void );
DECL_LINK( RemovePlacePressed_Hdl, Button*, void );
DECL_LINK( Split_Hdl, Splitter*, void );
DECL_LINK( AddPlacePressed_Hdl, weld::Button&, void );
DECL_LINK( RemovePlacePressed_Hdl, weld::Button&, void );
DECL_LINK( PreviewSizeAllocHdl, const Size&, void);
void OpenHdl_Impl(void const * pVoid);
void Init_Impl( PickerFlags nBits );
/** find a filter with the given wildcard
@param _rFilter
the wildcard pattern to look for in the filter list
@@ -126,24 +124,20 @@ private:
void OpenMultiSelection_Impl();
void AddControls_Impl( );
DECL_LINK( SelectHdl_Impl, SvTreeListBox*, void );
DECL_LINK( DblClickHdl_Impl, SvTreeListBox*, bool);
DECL_LINK( EntrySelectHdl_Impl, ComboBox&, void);
DECL_LINK( OpenDoneHdl_Impl, SvtFileView*, void );
DECL_LINK( AutoExtensionHdl_Impl, Button*, void);
DECL_LINK( ClickHdl_Impl, Button*, void );
DECL_LINK( PlayButtonHdl_Impl, Button*, void);
DECL_LINK(SelectHdl_Impl, SvtFileView*, void);
DECL_LINK(DblClickHdl_Impl, SvtFileView*, bool);
DECL_LINK(EntrySelectHdl_Impl, weld::ComboBox&, void);
DECL_LINK(OpenDoneHdl_Impl, SvtFileView*, void);
DECL_LINK(AutoExtensionHdl_Impl, weld::Button&, void);
DECL_LINK(ClickHdl_Impl, weld::Button&, void);
DECL_LINK(PlayButtonHdl_Impl, weld::Button&, void);
DECL_LINK(SizeAllocHdl, const Size&, void);
// removes a filter with wildcards from the path and returns it
static bool IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilter );
void implUpdateImages( );
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
OUString _aPath;
OUString _aDefExt;
OUString m_aPath;
OUString m_aDefExt;
/** enables or disables the complete UI of the file picker, with only offering a
cancel button
@@ -158,19 +152,17 @@ private:
/** enables or disables a control
You are strongly encouraged to prefer this method over pControl->Enable( _bEnable ). See
You are strongly encouraged to prefer this method over pControl->Enable( bEnable ). See
<member>EnableUI</member> for details.
*/
void EnableControl( Control* _pControl, bool _bEnable );
bool PrepareExecute();
void EnableControl(weld::Widget* pControl, bool bEnable);
virtual bool PrepareExecute() override;
public:
SvtFileDialog( vcl::Window* _pParent, PickerFlags nBits );
SvtFileDialog( weld::Window* pParent, PickerFlags nBits );
virtual ~SvtFileDialog() override;
virtual void dispose() override;
virtual short Execute() override;
virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
virtual short run() override;
void FileSelect();
void FilterSelect() override;
@@ -193,9 +185,6 @@ public:
sal_uInt16 GetFilterCount() const;
const OUString& GetFilterName( sal_uInt16 nPos ) const;
virtual void Resize() override;
virtual void DataChanged( const DataChangedEvent& _rDCEvt ) override;
void PrevLevel_Impl();
void OpenURL_Impl( const OUString& rURL );
@@ -205,9 +194,8 @@ public:
void UpdateControls( const OUString& rURL ) override;
void EnableAutocompletion( bool _bEnable = true ) override;
void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) override { _pFileNotifier = pNotifier; }
void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) override { m_pFileNotifier = pNotifier; }
sal_Int32 getTargetColorDepth() override;
sal_Int32 getAvailableWidth() override;
sal_Int32 getAvailableHeight() override;
void setImage( const css::uno::Any& rImage ) override;
@@ -232,8 +220,6 @@ public:
inline void EraseDefaultExt( sal_Int32 _nIndex = 0 );
inline const OUString& GetDefaultExt() const;
static Image GetButtonImage(const OUString& rButtonId);
bool ContentIsFolder( const OUString& rURL ) override { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); }
bool ContentHasParentFolder( const OUString& rURL );
bool ContentCanMakeFolder( const OUString& rURL );
@@ -242,7 +228,7 @@ public:
private:
SvtFileDialogFilter_Impl* implAddFilter( const OUString& _rFilter, const OUString& _rType );
/** updates _pUserFilter with a new filter
/** updates m_xUserFilter with a new filter
<p>No checks for necessity are made.</p>
*/
void createNewUserFilter( const OUString& _rNewFilter );
@@ -250,7 +236,7 @@ private:
AdjustFilterFlags adjustFilter( const OUString& _rFilter );
// IFilePickerController, needed by OControlAccess
virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const override;
virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
virtual void enableControl( sal_Int16 _nControlId, bool _bEnable ) override;
virtual OUString getCurFilter( ) const override;
@@ -286,7 +272,7 @@ private:
inline void SvtFileDialog::SetPath( const OUString& rNewURL )
{
_aPath = rNewURL;
m_aPath = rNewURL;
}
@@ -298,32 +284,31 @@ inline void SvtFileDialog::SetHasFilename( bool bHasFilename )
inline const OUString& SvtFileDialog::GetPath()
{
return _aPath;
return m_aPath;
}
inline void SvtFileDialog::SetDefaultExt( const OUString& rExt )
{
_aDefExt = rExt;
m_aDefExt = rExt;
}
inline void SvtFileDialog::EraseDefaultExt( sal_Int32 _nIndex )
{
_aDefExt = _aDefExt.copy( 0, _nIndex );
m_aDefExt = m_aDefExt.copy( 0, _nIndex );
}
inline const OUString& SvtFileDialog::GetDefaultExt() const
{
return _aDefExt;
return m_aDefExt;
}
inline SvtFileView* SvtFileDialog::GetView()
{
return _pFileView;
return m_xFileView.get();
}
#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+52 -134
View File
@@ -34,78 +34,37 @@ using namespace ::com::sun::star::lang;
using namespace ::utl;
SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType )
:m_aName( rName )
,m_aType( rType )
: m_aName( rName )
, m_aType( rType )
{
m_aType = m_aType.toAsciiLowerCase();
}
SvtFileDialogFilter_Impl::~SvtFileDialogFilter_Impl()
{
}
// SvtFileDialogFilterList_Impl
//= SvtFileDialogURLSelector
SvtFileDialogURLSelector::SvtFileDialogURLSelector(vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, const OUString& rButtonId)
:MenuButton ( _pParent, nBits )
,m_pDlg ( _pDlg )
,m_pMenu ( VclPtr<PopupMenu>::Create() )
{
SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
SetModeImage(SvtFileDialog::GetButtonImage(rButtonId));
SetDelayMenu(true);
SetDropDown(PushButtonDropdownStyle::Toolbox);
}
SvtFileDialogURLSelector::~SvtFileDialogURLSelector()
{
disposeOnce();
}
void SvtFileDialogURLSelector::dispose()
{
m_pMenu.disposeAndClear();
m_pDlg.clear();
MenuButton::dispose();
}
void SvtFileDialogURLSelector::Activate()
{
m_pMenu->Clear();
FillURLMenu( m_pMenu );
SetPopupMenu( m_pMenu );
}
//= SvtUpButton_Impl
SvtUpButton_Impl::SvtUpButton_Impl( vcl::Window *pParent, SvtFileDialog* pDlg, WinBits nBits )
:SvtFileDialogURLSelector( pParent, pDlg, nBits, BMP_FILEDLG_BTN_UP )
SvtUpButton_Impl::SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
std::unique_ptr<weld::Menu> xMenu,
SvtFileDialog* pDlg)
: m_xToolbar(std::move(xToolbar))
, m_xMenu(std::move(xMenu))
, m_pDlg(pDlg)
{
m_xToolbar->set_item_menu("up_btn", m_xMenu.get());
m_xToolbar->connect_clicked(LINK(this, SvtUpButton_Impl, ClickHdl));
m_xMenu->connect_activate(LINK(this, SvtUpButton_Impl, SelectHdl));
}
SvtUpButton_Impl::~SvtUpButton_Impl()
void SvtUpButton_Impl::FillURLMenu()
{
}
void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
{
SvtFileView* pBox = GetDialogParent()->GetView();
SvtFileView* pBox = m_pDlg->GetView();
sal_uInt16 nItemId = 1;
_aURLs.clear();
aURLs.clear();
m_xMenu->clear();
// determine parent levels
INetURLObject aObject( pBox->GetViewURL() );
@@ -114,7 +73,7 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
::svtools::VolumeInfo aVolInfo( true /* volume */, false /* remote */,
false /* removable */, false /* floppy */,
false /* compact disk */ );
Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo ) );
OUString aVolumeImage( SvFileInformationManager::GetFolderImageId( aVolInfo ) );
while ( nCount >= 1 )
{
@@ -122,98 +81,61 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
OUString aParentURL(aObject.GetMainURL(INetURLObject::DecodeMechanism::NONE));
OUString aTitle;
if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.isEmpty())
if (nCount == 1) // adjust the title of the top level entry (the workspace)
aTitle = SvlResId(STR_SVT_MIMETYPE_CNT_FSYSBOX);
else if (!m_pDlg->ContentGetTitle(aParentURL, aTitle) || aTitle.isEmpty())
aTitle = aObject.getName();
Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
? SvFileInformationManager::GetImage( aObject ) : aVolumeImage;
OUString aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
? SvFileInformationManager::GetImageId( aObject ) : aVolumeImage;
_pMenu->InsertItem( nItemId++, aTitle, aImage );
_aURLs.push_back(aParentURL);
m_xMenu->append(OUString::number(nItemId), aTitle, aImage);
aURLs.push_back(aParentURL);
if ( nCount == 1 )
{
// adjust the title of the top level entry (the workspace)
_pMenu->SetItemText(--nItemId, SvlResId(STR_SVT_MIMETYPE_CNT_FSYSBOX));
}
++nItemId;
--nCount;
}
}
void SvtUpButton_Impl::Select()
IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void)
{
sal_uInt16 nId = GetCurItemId();
if ( nId )
sal_uInt32 nId = rId.toUInt32();
if (nId)
{
--nId;
assert( nId <= _aURLs.size() && "SvtUpButton_Impl: wrong index" );
assert( nId <= aURLs.size() && "SvtUpButton_Impl: wrong index" );
GetDialogParent()->OpenURL_Impl(_aURLs[nId]);
m_pDlg->OpenURL_Impl(aURLs[nId]);
}
}
void SvtUpButton_Impl::Click()
IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OString&, void)
{
GetDialogParent()->PrevLevel_Impl();
}
Size SvtUpButton_Impl::GetOptimalSize() const
{
return LogicToPixel(Size(12, 12), MapMode(MapUnit::MapAppFont));
m_pDlg->PrevLevel_Impl();
}
// SvtExpFileDlg_Impl
SvtExpFileDlg_Impl::SvtExpFileDlg_Impl() :
_pCurFilter ( nullptr ),
_pFtFileName ( nullptr ),
_pEdFileName ( nullptr ),
_pFtFileVersion ( nullptr ),
_pLbFileVersion ( nullptr ),
_pFtTemplates ( nullptr ),
_pLbTemplates ( nullptr ),
_pFtImageTemplates ( nullptr ),
_pLbImageTemplates ( nullptr ),
_pFtImageAnchor ( nullptr ),
_pLbImageAnchor ( nullptr ),
_pFtFileType ( nullptr ),
_pLbFilter ( nullptr ),
_pBtnFileOpen ( nullptr ),
_pBtnCancel ( nullptr ),
_pBtnHelp ( nullptr ),
_pBtnUp ( nullptr ),
_pBtnNewFolder ( nullptr ),
_pCbPassword ( nullptr ),
_pCbGPGEncrypt ( nullptr ),
_pEdCurrentPath ( nullptr ),
_pCbAutoExtension ( nullptr ),
_pCbOptions ( nullptr ),
_pPlaces ( nullptr ),
_pBtnConnectToServer( nullptr ),
_eMode ( FILEDLG_MODE_OPEN ),
_eDlgType ( FILEDLG_TYPE_FILEDLG ),
_nStyle ( PickerFlags::NONE ),
_bDoubleClick ( false ),
m_bNeedDelayedFilterExecute ( false ),
_bMultiSelection ( false )
SvtExpFileDlg_Impl::SvtExpFileDlg_Impl()
: m_pCurFilter( nullptr )
, m_eMode( FILEDLG_MODE_OPEN )
, m_eDlgType( FILEDLG_TYPE_FILEDLG )
, m_nStyle( PickerFlags::NONE )
, m_bDoubleClick( false )
, m_bNeedDelayedFilterExecute ( false )
, m_bMultiSelection( false )
{
}
SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
{
_pBtnUp.disposeAndClear();
_pUserFilter.reset();
_pPlaces.disposeAndClear();
}
void SvtExpFileDlg_Impl::SetStandardDir( const OUString& _rDir )
{
_aStdDir = _rDir;
if ( _aStdDir.isEmpty() )
_aStdDir = "file:///";
m_aStdDir = _rDir;
if (m_aStdDir.isEmpty())
m_aStdDir = "file:///";
}
namespace {
@@ -230,29 +152,25 @@ void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl const * pFilter,
|| ( rDisplayName == lcl_DecoratedFilter( pFilter->GetName() ) ),
"SvtExpFileDlg_Impl::SetCurFilter: arguments are inconsistent!" );
_pCurFilter = pFilter;
m_pCurFilter = pFilter;
m_sCurrentFilterDisplayName = rDisplayName;
}
void SvtExpFileDlg_Impl::InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc )
void SvtExpFileDlg_Impl::InsertFilterListEntry(const SvtFileDialogFilter_Impl* pFilterDesc)
{
OUString sName = _pFilterDesc->GetName();
if ( _pFilterDesc->isGroupSeparator() )
sName = "------------------------------------------";
// insert and set user data
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pFilterDesc)));
OUString sName = pFilterDesc->GetName();
if (pFilterDesc->isGroupSeparator())
m_xLbFilter->append_separator(sId);
else
sName = _pFilterDesc->GetName();
// insert an set user data
const sal_Int32 nPos = _pLbFilter->InsertEntry( sName );
_pLbFilter->SetEntryData( nPos, const_cast< void* >( static_cast< const void* >( _pFilterDesc ) ) );
m_xLbFilter->append(sId, sName);
}
void SvtExpFileDlg_Impl::InitFilterList( )
{
// clear the current list
_pLbFilter->Clear();
m_xLbFilter->clear();
// reinit it
sal_uInt16 nPos = m_aFilter.size();
+99 -127
View File
@@ -76,179 +76,151 @@ enum SvtFileDlgType
FILEDLG_TYPE_PATHDLG
};
class SvtFileDialogURLSelector : public MenuButton
{
public:
virtual ~SvtFileDialogURLSelector() override;
virtual void dispose() override;
private:
VclPtr<SvtFileDialog> m_pDlg;
VclPtr<PopupMenu> m_pMenu;
protected:
SvtFileDialog* GetDialogParent() { return m_pDlg; }
virtual void FillURLMenu( PopupMenu* _pMenu ) = 0;
SvtFileDialogURLSelector(vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, const OUString& rButtonId);
virtual void Activate() override;
};
class SvtUpButton_Impl : public SvtFileDialogURLSelector
class SvtUpButton_Impl
{
private:
std::vector<OUString> _aURLs;
std::unique_ptr<weld::Toolbar> m_xToolbar;
std::unique_ptr<weld::Menu> m_xMenu;
SvtFileDialog* m_pDlg;
std::vector<OUString> aURLs;
public:
SvtUpButton_Impl( vcl::Window* pParent, SvtFileDialog* pDlg, WinBits nBits );
virtual ~SvtUpButton_Impl() override;
SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
std::unique_ptr<weld::Menu> xMenu,
SvtFileDialog* pDlg);
protected:
virtual void FillURLMenu( PopupMenu* _pMenu ) override;
virtual void Select() override;
virtual void Click() override;
virtual Size GetOptimalSize() const override;
void set_help_id(const OString& rHelpId) { m_xToolbar->set_help_id(rHelpId); }
void show() { m_xToolbar->show(); }
void FillURLMenu();
weld::Widget* getWidget() { return m_xToolbar.get(); }
private:
DECL_LINK(SelectHdl, const OString&, void);
DECL_LINK(ClickHdl, const OString&, void);
};
class SvtURLBox;
class URLBox;
class SvtExpFileDlg_Impl
{
private:
const SvtFileDialogFilter_Impl* _pCurFilter;
OUString m_sCurrentFilterDisplayName; // may differ from _pCurFilter->GetName in case it is a cached entry
const SvtFileDialogFilter_Impl* m_pCurFilter;
OUString m_sCurrentFilterDisplayName; // may differ from m_pCurFilter->GetName in case it is a cached entry
css::uno::Sequence< OUString > _aBlackList;
css::uno::Sequence< OUString > m_aBlackList;
public:
SvtFileDialogFilterList_Impl m_aFilter;
std::unique_ptr<SvtFileDialogFilter_Impl> _pUserFilter;
std::unique_ptr<SvtFileDialogFilter_Impl> m_xUserFilter;
VclPtr<FixedText> _pFtFileName;
VclPtr<SvtURLBox> _pEdFileName;
std::unique_ptr<weld::Label> m_xFtFileName;
std::unique_ptr<URLBox> m_xEdFileName;
VclPtr<FixedText> _pFtFileVersion;
VclPtr<ListBox> _pLbFileVersion;
std::unique_ptr<weld::Label> m_xFtFileVersion;
std::unique_ptr<weld::ComboBox> m_xLbFileVersion;
VclPtr<FixedText> _pFtTemplates;
VclPtr<ListBox> _pLbTemplates;
std::unique_ptr<weld::Label> m_xFtTemplates;
std::unique_ptr<weld::ComboBox> m_xLbTemplates;
VclPtr<FixedText> _pFtImageTemplates;
VclPtr<ListBox> _pLbImageTemplates;
std::unique_ptr<weld::Label> m_xFtImageTemplates;
std::unique_ptr<weld::ComboBox> m_xLbImageTemplates;
VclPtr<FixedText> _pFtImageAnchor;
VclPtr<ListBox> _pLbImageAnchor;
std::unique_ptr<weld::Label> m_xFtImageAnchor;
std::unique_ptr<weld::ComboBox> m_xLbImageAnchor;
VclPtr<FixedText> _pFtFileType;
VclPtr<ListBox> _pLbFilter;
VclPtr<PushButton> _pBtnFileOpen;
VclPtr<PushButton> _pBtnCancel;
VclPtr<HelpButton> _pBtnHelp;
VclPtr<SvtUpButton_Impl> _pBtnUp;
VclPtr<PushButton> _pBtnNewFolder;
VclPtr<CheckBox> _pCbPassword;
VclPtr<CheckBox> _pCbGPGEncrypt;
VclPtr<SvtURLBox> _pEdCurrentPath;
VclPtr<CheckBox> _pCbAutoExtension;
VclPtr<CheckBox> _pCbOptions;
std::unique_ptr<weld::Label> m_xFtFileType;
std::unique_ptr<weld::ComboBox> m_xLbFilter;
std::unique_ptr<weld::Button> m_xBtnFileOpen;
std::unique_ptr<weld::Button> m_xBtnCancel;
std::unique_ptr<weld::Button> m_xBtnHelp;
std::unique_ptr<SvtUpButton_Impl> m_xBtnUp;
std::unique_ptr<weld::Button> m_xBtnNewFolder;
std::unique_ptr<weld::CheckButton> m_xCbPassword;
std::unique_ptr<weld::CheckButton> m_xCbGPGEncrypt;
std::unique_ptr<URLBox> m_xEdCurrentPath;
std::unique_ptr<weld::CheckButton> m_xCbAutoExtension;
std::unique_ptr<weld::CheckButton> m_xCbOptions;
VclPtr<PlacesListBox> _pPlaces;
VclPtr<PushButton> _pBtnConnectToServer;
std::unique_ptr<PlacesListBox> m_xPlaces;
std::unique_ptr<weld::Button> m_xBtnConnectToServer;
SvtFileDlgMode _eMode;
SvtFileDlgType _eDlgType;
PickerFlags _nStyle;
SvtFileDlgMode m_eMode;
SvtFileDlgType m_eDlgType;
PickerFlags m_nStyle;
OUString _aStdDir;
OUString m_aStdDir;
// delay filter when traveling the filterbox
Timer _aFilterTimer;
Idle m_aFilterIdle;
// shows OpenHdl_Imp() if the open was triggered by a double click
bool _bDoubleClick;
bool m_bDoubleClick;
bool m_bNeedDelayedFilterExecute;
// MultiSelection?
bool _bMultiSelection;
bool m_bMultiSelection;
// remember sizes
OUString _aIniKey;
OUString m_aIniKey;
explicit SvtExpFileDlg_Impl();
~SvtExpFileDlg_Impl();
void SetBlackList( const css::uno::Sequence< OUString >& rBlackList ) { m_aBlackList = rBlackList; }
const css::uno::Sequence< OUString >& GetBlackList() const { return m_aBlackList; }
void SetStandardDir( const OUString& rDir );
const OUString& GetStandardDir() const { return m_aStdDir; }
void SetBlackList( const css::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; }
const css::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; }
void SetStandardDir( const OUString& _rDir );
const OUString& GetStandardDir() const { return _aStdDir; }
void DisableFilterBoxAutoWidth() { _pLbFilter->EnableDDAutoWidth( false ); }
// access to the filter listbox only as Control* - we want to maintain the entries/userdata ourself
Control* GetFilterListControl() { return _pLbFilter; }
const Control* GetFilterListControl() const { return _pLbFilter; }
inline void SetFilterListSelectHdl( const Link<ListBox&,void>& _rHandler );
// access to the filter listbox only as weld::Widget* - we want to maintain the entries/userdata ourself
weld::Widget* GetFilterListControl() { return m_xLbFilter.get(); }
const weld::Widget* GetFilterListControl() const { return m_xLbFilter.get(); }
void SetFilterListSelectHdl(const Link<weld::ComboBox&, void>& rHandler)
{
m_xLbFilter->connect_changed(rHandler);
}
// inits the listbox for the filters from the filter list (_pFilter)
void InitFilterList( );
inline bool HasFilterListEntry( const OUString& _rFilterName );
inline void SelectFilterListEntry( const OUString& _rFilterName );
inline void SetNoFilterListSelection( );
bool HasFilterListEntry( const OUString& rFilterName )
{
return m_xLbFilter->find_text(rFilterName) != -1;
}
void SelectFilterListEntry( const OUString& rFilterName )
{
m_xLbFilter->set_active_text(rFilterName);
}
void SetNoFilterListSelection( )
{
m_xLbFilter->set_active(-1);
}
void InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
// _pFilterDesc must already have been added to _pFilter
inline SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& /* [out] */ _rDisplayName ) const;
inline bool IsFilterListTravelSelect() const;
SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& rDisplayName ) const
{
rDisplayName = m_xLbFilter->get_active_text();
return reinterpret_cast<SvtFileDialogFilter_Impl*>(m_xLbFilter->get_active_id().toInt64());
}
// access to the current filter via methods only - need to care for consistency between m_pCurFilter and m_sCurrentFilterDisplayName
const SvtFileDialogFilter_Impl* GetCurFilter( ) const
{
return m_pCurFilter;
}
// access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const;
inline const OUString& GetCurFilterDisplayName() const;
void SetCurFilter( SvtFileDialogFilter_Impl const * _pFilter, const OUString& _rDisplayName );
};
inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link<ListBox&,void>& _rHandler )
{
_pLbFilter->SetSelectHdl( _rHandler );
}
inline bool SvtExpFileDlg_Impl::HasFilterListEntry( const OUString& _rFilterName )
{
return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
}
inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const OUString& _rFilterName )
{
_pLbFilter->SelectEntry( _rFilterName );
}
inline void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
{
_pLbFilter->SetNoSelection( );
}
inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( OUString& _rDisplayName ) const
{
_rDisplayName = _pLbFilter->GetSelectedEntry();
return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetSelectedEntryData () );
}
inline bool SvtExpFileDlg_Impl::IsFilterListTravelSelect() const
{
return _pLbFilter->IsTravelSelect();
}
inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
{
return _pCurFilter;
}
inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
{
const OUString& GetCurFilterDisplayName() const
{
return m_sCurrentFilterDisplayName;
}
}
void SetCurFilter( SvtFileDialogFilter_Impl const * _pFilter, const OUString& rDisplayName );
};
#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+4 -10
View File
@@ -23,35 +23,29 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>
class Control;
namespace weld { class Widget; }
namespace svt
{
class IFilePickerController
{
public:
virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const = 0;
virtual void enableControl( sal_Int16 _nControlId, bool _bEnable ) = 0;
virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const = 0;
virtual void enableControl( sal_Int16 nControlId, bool bEnable ) = 0;
virtual OUString getCurFilter( ) const = 0;
protected:
~IFilePickerController() {}
};
class IFilePickerListener
{
public:
virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) = 0;
virtual void notify( sal_Int16 nEventId, sal_Int16 nControlId ) = 0;
protected:
~IFilePickerListener() {}
};
} // namespace svt
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="fps">
<requires lib="gtk+" version="3.18"/>
<object class="GtkGrid" id="container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLinkButton" id="link">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>
+438 -66
View File
@@ -1,8 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="fps">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-add</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-remove</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">fpicker/res/fp014.png</property>
</object>
<object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore3">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name text2 -->
<column type="gchararray"/>
<!-- column-name text3 -->
<column type="gchararray"/>
<!-- column-name text1 -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="ExplorerFileDialog">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -10,6 +60,9 @@
<property name="border_width">6</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -55,11 +108,17 @@
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="svtlo-SvtURLBox" id="current_path">
<object class="GtkComboBoxText" id="current_path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="max_width_chars">40</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -75,6 +134,7 @@
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="explorerfiledialog|connect_to_server|tooltip_text">Connect To Server</property>
<property name="valign">center</property>
<child internal-child="accessible">
<object class="AtkObject" id="connect_to_server-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="explorerfiledialog|connect_to_server-atkobject">Connect To Server</property>
@@ -88,12 +148,38 @@
</packing>
</child>
<child>
<object class="GtkBox" id="up">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="propagate_natural_width">True</property>
<property name="propagate_natural_height">True</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="GtkToolbar" id="up_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuToolButton" id="up_btn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="icon_name">res/fp010.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -110,6 +196,9 @@
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="explorerfiledialog|new_folder|tooltip_text">Create New Folder</property>
<property name="valign">center</property>
<property name="image">image4</property>
<property name="always_show_image">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="new_folder-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="explorerfiledialog|new_folder-atkobject">Create New Folder</property>
@@ -137,7 +226,260 @@
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="places">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_clickable">False</property>
<property name="search_column">1</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="explorerfiledialog|places">Places</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext6"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderer11"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="add">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image1</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="del">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image2</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="fileview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore3</property>
<property name="search_column">1</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="explorerfiledialog|name">Name</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderer1"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="explorerfiledialog|type">Type</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderer5"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="explorerfiledialog|size">Size</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderer2"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="explorerfiledialog|date">Date modified</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderer3"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkIconView" id="iconview">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<child>
<object class="GtkCellRendererPixbuf" id="icon"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="text"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
@@ -238,7 +580,6 @@
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkLabel" id="file_name_label">
<property name="visible">True</property>
@@ -258,6 +599,7 @@
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">shared</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -279,19 +621,7 @@
</packing>
</child>
<child>
<object class="svtlo-SvtURLBox" id="file_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="max_width_chars">40</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="shared">
<object class="GtkComboBoxText" id="shared">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
@@ -301,7 +631,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="file_type">
<object class="GtkComboBoxText" id="file_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -311,6 +641,24 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="file_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -323,46 +671,6 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkCheckButton" id="link">
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_preview">
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="readonly">
<property name="label" translatable="yes" context="explorerfiledialog|readonly">_Read-only</property>
@@ -465,6 +773,46 @@
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkCheckButton" id="link">
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_preview">
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -499,11 +847,31 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkDrawingArea" id="preview">
<property name="width_request">200</property>
<object class="GtkScrolledWindow" id="previewframe">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="valign">start</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="propagate_natural_width">True</property>
<property name="propagate_natural_height">True</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="preview">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
@@ -527,4 +895,8 @@
</object>
</child>
</object>
<object class="GtkMenu" id="up_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</interface>
+273 -40
View File
@@ -12,33 +12,44 @@
<property name="can_focus">False</property>
<property name="icon_name">svx/res/gallist.png</property>
</object>
<object class="GtkMenu" id="service_edit_menu">
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="edit_service">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|edit_service">_Edit service</property>
<property name="use_underline">True</property>
<property name="icon_name">fpicker/res/fp014.png</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="delete_service">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|delete_service">_Delete service</property>
<property name="use_underline">True</property>
<object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
</child>
<child>
<object class="GtkMenuItem" id="change_password">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|change_password">_Change password</property>
<property name="use_underline">True</property>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
</child>
<object class="GtkTreeStore" id="liststore3">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name text2 -->
<column type="gchararray"/>
<!-- column-name text3 -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="RemoteFilesDialog">
<property name="can_focus">False</property>
@@ -151,6 +162,7 @@
<object class="GtkComboBoxText" id="services_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
@@ -162,14 +174,38 @@
</packing>
</child>
<child>
<object class="GtkMenuButton" id="add_service_btn">
<property name="label" translatable="yes" context="remotefilesdialog|add_service_btn">Add service</property>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popup">service_edit_menu</property>
<property name="valign">center</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="propagate_natural_width">True</property>
<property name="propagate_natural_height">True</property>
<child>
<placeholder/>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar" id="add_service_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuToolButton" id="add_service_btn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|add_service_btn">Add service</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -207,13 +243,14 @@
</packing>
</child>
<child>
<object class="GtkButton" id="list_view">
<object class="GtkToggleButton" id="list_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="remotefilesdialog|list_view|tooltip_text">List view</property>
<property name="image">image2</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -222,7 +259,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="icon_view">
<object class="GtkToggleButton" id="icon_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -246,6 +283,8 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="remotefilesdialog|new_folder|tooltip_text">Create New Folder</property>
<property name="margin_left">6</property>
<property name="image">image3</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -262,15 +301,182 @@
</child>
<child>
<object class="GtkBox" id="container">
<property name="width_request">555</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="foldertree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<property name="resizable">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext6"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderer11"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="fileview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore3</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection2"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="remotefilesdialog|name">Name</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderer1"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="remotefilesdialog|size">Size</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderer2"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="resizable">True</property>
<property name="spacing">6</property>
<property name="title" translatable="yes" context="remotefilesdialog|date">Date modified</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderer3"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkIconView" id="iconview">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<property name="pixbuf_column">0</property>
<property name="text_column">1</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
@@ -304,6 +510,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|nameLabel">File name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">filename</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -324,13 +532,10 @@
</packing>
</child>
<child>
<object class="GtkBox" id="filename_container">
<object class="GtkEntry" id="filename">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -349,8 +554,36 @@
<action-widgets>
<action-widget response="-11">help</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="101">open</action-widget>
<action-widget response="102">save</action-widget>
<action-widget response="-5">open</action-widget>
<action-widget response="-5">save</action-widget>
</action-widgets>
</object>
<object class="GtkMenu" id="service_edit_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="edit_service">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|edit_service">_Edit service</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="delete_service">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|delete_service">_Delete service</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="change_password">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="remotefilesdialog|change_password">_Change password</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>
+1
View File
@@ -124,6 +124,7 @@ public:
SVT_DLLPUBLIC static OUString GetFileImageId( const INetURLObject& rURL );
SVT_DLLPUBLIC static Image GetFileImage( const INetURLObject& rURL );
SVT_DLLPUBLIC static Image GetImageNoDefault(const INetURLObject& rURL, bool bBig = false, Size const & rPreferredSize = Size());
SVT_DLLPUBLIC static OUString GetFolderImageId( const svtools::VolumeInfo& rInfo );
SVT_DLLPUBLIC static Image GetFolderImage( const svtools::VolumeInfo& rInfo );
SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject );
+9 -1
View File
@@ -98,9 +98,12 @@ class SVT_DLLPUBLIC URLBox
rtl::Reference< MatchContext_Impl > pCtx;
std::unique_ptr<SvtURLBox_Impl> pImpl;
INetProtocol eSmartProtocol;
bool bOnlyDirectories : 1;
bool bHistoryDisabled : 1;
bool bNoSelection : 1;
Link<weld::ComboBox&, void> aChangeHdl;
Link<weld::Widget&, void> aFocusInHdl;
Link<weld::Widget&, void> aFocusOutHdl;
std::unique_ptr<weld::ComboBox> m_xWidget;
@@ -122,16 +125,21 @@ public:
void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; }
void trigger_changed() { aChangeHdl.Call(*m_xWidget); }
void connect_focus_in(const Link<weld::Widget&, void>& rLink) { aFocusInHdl = rLink; }
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; }
void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
int find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); }
OUString get_active_text() const { return m_xWidget->get_active_text(); }
void grab_focus() { m_xWidget->grab_focus(); }
void set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); }
void EnableAutocomplete() { m_xWidget->set_entry_completion(true); }
void set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); }
void select_entry_region(int nStartPos, int nEndPos) { m_xWidget->select_entry_region(nStartPos, nEndPos); }
void EnableAutocomplete(bool bEnable = true) { m_xWidget->set_entry_completion(bEnable); }
void SetBaseURL( const OUString& rURL );
const OUString& GetBaseURL() const { return aBaseURL; }
void SetOnlyDirectories( bool bDir );
void SetNoURLSelection( bool bSet );
void SetSmartProtocol( INetProtocol eProt );
INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
OUString GetURL();
-11
View File
@@ -103,22 +103,11 @@
#define STR_FURTHER_OBJECT NC_("STR_FURTHER_OBJECT", "Further objects")
#define STR_UNKNOWN_SOURCE NC_("STR_UNKNOWN_SOURCE", "Unknown source")
#define STR_SVT_FILEVIEW_COLUMN_TITLE NC_("STR_SVT_FILEVIEW_COLUMN_TITLE", "Name")
#define STR_SVT_FILEVIEW_COLUMN_SIZE NC_("STR_SVT_FILEVIEW_COLUMN_SIZE", "Size")
#define STR_SVT_FILEVIEW_COLUMN_DATE NC_("STR_SVT_FILEVIEW_COLUMN_DATE", "Date modified")
#define STR_SVT_FILEVIEW_COLUMN_TYPE NC_("STR_SVT_FILEVIEW_COLUMN_TYPE", "Type")
#define STR_SVT_BYTES NC_("STR_SVT_BYTES", "Bytes")
#define STR_SVT_KB NC_("STR_SVT_KB", "KB")
#define STR_SVT_MB NC_("STR_SVT_MB", "MB")
#define STR_SVT_GB NC_("STR_SVT_GB", "GB")
// descriptions of accessible objects
#define STR_SVT_ACC_DESC_TABLISTBOX NC_("STR_SVT_ACC_DESC_TABLISTBOX", "Row: %1, Column: %2")
#define STR_SVT_ACC_DESC_FILEVIEW NC_("STR_SVT_ACC_DESC_FILEVIEW", ", Type: %1, URL: %2")
#define STR_SVT_ACC_DESC_FOLDER NC_("STR_SVT_ACC_DESC_FOLDER", "Folder")
#define STR_SVT_ACC_DESC_FILE NC_("STR_SVT_ACC_DESC_FILE", "File")
#define STR_SVT_ACC_EMPTY_FIELD NC_("STR_SVT_ACC_EMPTY_FIELD", "Empty Field")
/*
* resources for CollatorResource / CollatorResourceData resp.
*/
+1
View File
@@ -188,6 +188,7 @@ class VCL_DLLPUBLIC SvTreeListBox
friend class SvImpLBox;
friend class IconViewImpl;
friend class TreeControlPeer;
friend class SalInstanceIconView;
friend class SalInstanceTreeView;
friend class SalInstanceEntryTreeView;
+85 -10
View File
@@ -27,6 +27,7 @@
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <assert.h>
#include <memory>
#include <vector>
@@ -599,8 +600,8 @@ public:
{
insert(-1, rStr, &rId, nullptr, &rImage);
}
virtual void insert_separator(int pos) = 0;
void append_separator() { insert_separator(-1); }
virtual void insert_separator(int pos, const OUString& rId) = 0;
void append_separator(const OUString& rId) { insert_separator(-1, rId); }
virtual int get_count() const = 0;
virtual void make_sorted() = 0;
@@ -911,16 +912,15 @@ public:
void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
// return true to allow editing, false to disallow
virtual void connect_editing_started(const Link<const TreeIter&, bool>& rLink)
{
m_aEditingStartedHdl = rLink;
}
// rStartLink returns true to allow editing, false to disallow
// rEndLink returns true to accept the edit, false to reject
virtual void
connect_editing_done(const Link<const std::pair<const TreeIter&, OUString>&, bool>& rLink)
connect_editing(const Link<const TreeIter&, bool>& rStartLink,
const Link<const std::pair<const TreeIter&, OUString>&, bool>& rEndLink)
{
m_aEditingDoneHdl = rLink;
assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
m_aEditingStartedHdl = rStartLink;
m_aEditingDoneHdl = rEndLink;
}
virtual void start_editing(const weld::TreeIter& rEntry) = 0;
@@ -993,6 +993,77 @@ public:
using Widget::set_sensitive;
};
class VCL_DLLPUBLIC IconView : virtual public Container
{
private:
OUString m_sSavedValue;
protected:
Link<IconView&, void> m_aSelectionChangeHdl;
Link<IconView&, bool> m_aItemActivatedHdl;
void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
public:
virtual void insert(int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, TreeIter* pRet)
= 0;
void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
{
insert(-1, &rStr, &rId, &rImage, nullptr);
}
void connect_selection_changed(const Link<IconView&, void>& rLink)
{
m_aSelectionChangeHdl = rLink;
}
/* A row is "activated" when the user double clicks a treeview row. It may
also be emitted when a row is selected and Space or Enter is pressed.
a return of "true" means the activation has been handled, a "false" propagates
the activation to the default handler which expands/collapses the row, if possible.
*/
void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
virtual OUString get_selected_id() const = 0;
virtual void clear() = 0;
virtual int count_selected_items() const = 0;
virtual OUString get_selected_text() const = 0;
//by index
virtual void select(int pos) = 0;
virtual void unselect(int pos) = 0;
//via iter
virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
virtual bool get_selected(TreeIter* pIter) const = 0;
virtual bool get_cursor(TreeIter* pIter) const = 0;
virtual void set_cursor(const TreeIter& rIter) = 0;
virtual bool get_iter_first(TreeIter& rIter) const = 0;
virtual OUString get_id(const TreeIter& rIter) const = 0;
virtual void scroll_to_item(const TreeIter& rIter) = 0;
// call func on each selected element until func returns true or we run out of elements
virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
//all of them
void select_all() { unselect(-1); }
void unselect_all() { select(-1); }
// return the number of toplevel nodes
virtual int n_children() const = 0;
void save_value() { m_sSavedValue = get_selected_text(); }
OUString const& get_saved_value() const { return m_sSavedValue; }
bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
};
class VCL_DLLPUBLIC Button : virtual public Container
{
protected:
@@ -1334,6 +1405,7 @@ class VCL_DLLPUBLIC Image : virtual public Widget
public:
virtual void set_from_icon_name(const OUString& rIconName) = 0;
virtual void set_image(VirtualDevice* pDevice) = 0;
virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
};
class VCL_DLLPUBLIC Calendar : virtual public Widget
@@ -1846,6 +1918,7 @@ public:
virtual bool get_item_sensitive(const OString& rIdent) const = 0;
virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
virtual bool get_item_active(const OString& rIdent) const = 0;
virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;
virtual void insert_separator(int pos, const OUString& rId) = 0;
@@ -1927,6 +2000,8 @@ public:
= 0;
virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<IconView> weld_icon_view(const OString& id, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<Label> weld_label(const OString& id, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<TextView> weld_text_view(const OString& id, bool bTakeOwnership = false)
= 0;
+4 -4
View File
@@ -4982,10 +4982,6 @@ fpicker/source/office/fileview.cxx
fpicker/source/office/fileview.hxx
fpicker/source/office/foldertree.cxx
fpicker/source/office/foldertree.hxx
fpicker/source/office/iconview.cxx
fpicker/source/office/iconview.hxx
fpicker/source/office/iconviewimpl.cxx
fpicker/source/office/iconviewimpl.hxx
fpicker/source/office/fpdialogbase.hxx
fpicker/source/office/fpinteraction.cxx
fpicker/source/office/fpinteraction.hxx
@@ -17253,6 +17249,8 @@ vcl/inc/headless/svpprn.hxx
vcl/inc/headless/svpvd.hxx
vcl/inc/helpwin.hxx
vcl/inc/hyperlabel.hxx
vcl/inc/iconview.hxx
vcl/inc/iconviewimpl.hxx
vcl/inc/image.h
vcl/inc/impanmvw.hxx
vcl/inc/impdel.hxx
@@ -17915,6 +17913,8 @@ vcl/source/salmain/salmain.cxx
vcl/source/toolkit/group.cxx
vcl/source/toolkit/morebtn.cxx
vcl/source/treelist/headbar.cxx
vcl/source/treelist/iconview.cxx
vcl/source/treelist/iconviewimpl.cxx
vcl/source/treelist/imap.cxx
vcl/source/treelist/imap2.cxx
vcl/source/treelist/imap3.cxx
+4 -5
View File
@@ -1,7 +1,6 @@
fpicker/uiconfig/ui/explorerfiledialog.ui://svtlo-SvtURLBox[@id='current_path'] no-labelled-by
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkLabel[@id='shared_label'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkComboBox[@id='shared'] no-labelled-by
fpicker/uiconfig/ui/breadcrumb.ui://GtkLabel[@id='label'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkCheckButton[@id='link'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkCheckButton[@id='cb_preview'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkDrawingArea[@id='preview'] no-labelled-by
fpicker/uiconfig/ui/remotefilesdialog.ui://GtkLabel[@id='nameLabel'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkButton[@id='add'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkButton[@id='del'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkMenuToolButton[@id='up_btn'] button-no-label
+33 -6
View File
@@ -126,6 +126,8 @@ class MatchContext_Impl: public salhelper::Thread
svtools::AsynchronLink aLink;
OUString const aText;
URLBox* pBox;
bool const bOnlyDirectories;
bool const bNoSelection;
osl::Mutex mutex_;
bool stopped_;
@@ -482,6 +484,8 @@ MatchContext_Impl::MatchContext_Impl(URLBox* pBoxP, const OUString& rText)
, aLink( LINK( this, MatchContext_Impl, Select_Impl ) )
, aText( rText )
, pBox( pBoxP )
, bOnlyDirectories( pBoxP->bOnlyDirectories )
, bNoSelection( pBoxP->bNoSelection )
, stopped_(false)
, commandId_(0)
{
@@ -587,7 +591,7 @@ IMPL_LINK_NOARG( MatchContext_Impl, Select_Impl, void*, void )
pBox->append_text(completion);
}
pBox->EnableAutocomplete();
pBox->EnableAutocomplete(!bNoSelection);
// transfer string lists to listbox and forget them
pBox->pImpl->aURLs = aURLs;
@@ -682,7 +686,10 @@ void MatchContext_Impl::ReadFolder( const OUString& rURL,
try
{
uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS );
ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS;
if ( bOnlyDirectories )
eInclude = INCLUDE_FOLDERS_ONLY;
uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );
uno::Reference < XAnyCompareFactory > xCompare;
uno::Reference < XSortedDynamicResultSetFactory > xSRSFac =
@@ -1240,6 +1247,10 @@ void MatchContext_Impl::doExecute()
}
}
if ( bOnlyDirectories )
// don't scan history picklist if only directories are allowed, picklist contains only files
return;
bool bFull = false;
INetURLObject aCurObj;
@@ -1957,9 +1968,11 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
OUString aCurText = m_xWidget->get_active_text();
int nStartPos, nEndPos;
m_xWidget->get_entry_selection_bounds(nStartPos, nEndPos);
if (nEndPos != aCurText.getLength())
if (std::max(nStartPos, nEndPos) != aCurText.getLength())
return;
aCurText = aCurText.copy(0, nStartPos);
auto nLen = std::min(nStartPos, nEndPos);
aCurText = aCurText.copy( 0, nLen );
if (!aCurText.isEmpty())
{
if (pCtx.is())
@@ -1977,7 +1990,9 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
URLBox::URLBox(std::unique_ptr<weld::ComboBox> pWidget)
: eSmartProtocol(INetProtocol::NotValid)
, bHistoryDisabled(false)
, bOnlyDirectories( false )
, bHistoryDisabled( false )
, bNoSelection( false )
, m_xWidget(std::move(pWidget))
{
//don't grow to fix mega-long urls
@@ -2085,11 +2100,11 @@ IMPL_LINK_NOARG(URLBox, ChangedHdl, weld::ComboBox&, void)
IMPL_LINK_NOARG(URLBox, FocusInHdl, weld::Widget&, void)
{
(void)this; // loplugin:staticmethod
#ifndef UNX
// pb: don't select automatically on unix #93251#
m_xWidget->select_entry_region(0, -1);
#endif
aFocusInHdl.Call(*m_xWidget);
}
IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void)
@@ -2103,6 +2118,18 @@ IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void)
aFocusOutHdl.Call(*m_xWidget);
}
void URLBox::SetOnlyDirectories( bool bDir )
{
bOnlyDirectories = bDir;
if ( bOnlyDirectories )
m_xWidget->clear();
}
void URLBox::SetNoURLSelection( bool bSet )
{
bNoSelection = bSet;
}
OUString URLBox::GetURL()
{
// wait for end of autocompletion
+17
View File
@@ -788,6 +788,23 @@ Image SvFileInformationManager::GetImageNoDefault(const INetURLObject& rObject,
return GetImageFromList_Impl(nImage, bBig, rPreferredSize);
}
OUString SvFileInformationManager::GetFolderImageId( const svtools::VolumeInfo& rInfo )
{
SvImageId nImage = SvImageId::Folder;
DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" );
if ( rInfo.m_bIsRemote )
nImage = SvImageId::NetworkDevice;
else if ( rInfo.m_bIsCompactDisc )
nImage = SvImageId::CDRomDevice;
else if ( rInfo.m_bIsRemoveable || rInfo.m_bIsFloppy )
nImage = SvImageId::RemoveableDevice;
else if ( rInfo.m_bIsVolume )
nImage = SvImageId::FixedDevice;
return GetImageNameFromList_Impl(nImage, false/*bBig*/);
}
Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo )
{
SvImageId nImage = SvImageId::Folder;
+1 -1
View File
@@ -451,7 +451,7 @@ static void lcl_InsertVectors(weld::ComboBox& rBox,
rBox.append_text(rItem);
for(const auto& rItem : rNext)
rBox.append_text(rItem);
rBox.append_separator();
rBox.append_separator("");
//now insert all strings sorted
const auto nStartPos = rBox.get_count();
+2
View File
@@ -243,6 +243,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/outdev/nativecontrols \
vcl/source/outdev/map \
vcl/source/treelist/headbar \
vcl/source/treelist/iconview \
vcl/source/treelist/iconviewimpl \
vcl/source/treelist/imap \
vcl/source/treelist/imap2 \
vcl/source/treelist/imap3 \
@@ -31,8 +31,6 @@ public:
virtual tools::Rectangle GetFocusRect( SvTreeListEntry*, long nEntryPos ) override;
void ClearAll();
void PaintEntry( SvTreeListEntry&, long nX, long nY, vcl::RenderContext& rRenderContext);
};
+24
View File
@@ -17,16 +17,40 @@
class LclHeaderTabListBox : public SvHeaderTabListBox
{
private:
Link<SvTreeListEntry*, bool> m_aEditingEntryHdl;
Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl;
public:
LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle)
: SvHeaderTabListBox(pParent, nWinStyle)
{
}
void SetEditingEntryHdl(const Link<SvTreeListEntry*, bool>& rLink)
{
m_aEditingEntryHdl = rLink;
}
void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
{
m_aEditedEntryHdl = rLink;
}
virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
{
return GetDragDropMode();
}
virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
{
return m_aEditingEntryHdl.Call(pEntry);
}
virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
{
return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
}
};
class LclTabListBox : public SvTabListBox
+290 -15
View File
@@ -20,6 +20,7 @@
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <officecfg/Office/Common.hxx>
#include <iconview.hxx>
#include <salframe.hxx>
#include <salinst.hxx>
#include <salvd.hxx>
@@ -914,6 +915,10 @@ public:
auto nInsertPos = pos == -1 ? MENU_APPEND : pos;
m_xMenu->InsertSeparator(rId.toUtf8(), nInsertPos);
}
PopupMenu* getMenu() const
{
return m_xMenu.get();
}
virtual ~SalInstanceMenu() override
{
m_xMenu->SetSelectHdl(Link<::Menu*, bool>());
@@ -933,6 +938,7 @@ class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolba
private:
VclPtr<ToolBox> m_xToolBox;
std::map<sal_uInt16, VclPtr<vcl::Window>> m_aFloats;
std::map<sal_uInt16, VclPtr<PopupMenu>> m_aMenus;
DECL_LINK(ClickHdl, ToolBox*, void);
DECL_LINK(DropdownClick, ToolBox*, void);
@@ -963,13 +969,25 @@ public:
if (m_xToolBox->GetItemBits(nItemId) & ToolBoxItemBits::DROPDOWN)
{
auto pFloat = m_aFloats[nItemId];
if (!pFloat)
return;
if (pFloat)
{
if (bActive)
vcl::Window::GetDockingManager()->StartPopupMode(m_xToolBox, pFloat, FloatWinPopupFlags::GrabFocus);
else
vcl::Window::GetDockingManager()->EndPopupMode(pFloat);
}
auto pPopup = m_aMenus[nItemId];
if (pPopup)
{
if (bActive)
{
tools::Rectangle aRect = m_xToolBox->GetItemRect(nItemId);
pPopup->Execute(m_xToolBox, aRect, PopupMenuFlags::ExecuteDown);
}
else
pPopup->EndExecute();
}
}
}
virtual bool get_item_active(const OString& rIdent) const override
@@ -985,7 +1003,20 @@ public:
if (pFloat)
pFloat->EnableDocking();
m_aFloats[m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))] = pFloat;
sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
m_aFloats[nId] = pFloat;
m_aMenus[nId] = nullptr;
}
virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override
{
SalInstanceMenu* pInstanceMenu = dynamic_cast<SalInstanceMenu*>(pMenu);
PopupMenu* pPopup = pInstanceMenu? pInstanceMenu->getMenu() : nullptr;
sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
m_aMenus[nId] = pPopup;
m_aFloats[nId] = nullptr;
}
virtual void insert_separator(int pos, const OUString& /*rId*/) override
@@ -2961,6 +2992,11 @@ public:
{
m_xImage->SetImage(createImage(*pDevice));
}
virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
m_xImage->SetImage(::Image(rImage));
}
};
class SalInstanceCalendar : public SalInstanceWidget, public virtual weld::Calendar
@@ -3330,6 +3366,8 @@ public:
pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
}
pHeaderBox->SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
pHeaderBox->SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
}
else
{
@@ -3884,16 +3922,11 @@ public:
return ::get_text_emphasis(pEntry, col);
}
virtual void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink) override
virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink) override
{
m_xTreeView->EnableInplaceEditing(true);
weld::TreeView::connect_editing_started(rLink);
}
virtual void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink) override
{
m_xTreeView->EnableInplaceEditing(true);
weld::TreeView::connect_editing_done(rLink);
m_xTreeView->EnableInplaceEditing(rStartLink.IsSet() || rEndLink.IsSet());
weld::TreeView::connect_editing(rStartLink, rEndLink);
}
virtual void start_editing(const weld::TreeIter& rIter) override
@@ -4633,6 +4666,242 @@ IMPL_LINK(SalInstanceTreeView, EditedEntryHdl, IterString, rIterString, bool)
return signal_editing_done(std::pair<const weld::TreeIter&, OUString>(SalInstanceTreeIter(rIterString.first), rIterString.second));
}
class SalInstanceIconView : public SalInstanceContainer, public virtual weld::IconView
{
private:
// owner for UserData
std::vector<std::unique_ptr<OUString>> m_aUserData;
VclPtr<::IconView> m_xIconView;
DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
public:
SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: SalInstanceContainer(pIconView, pBuilder, bTakeOwnership)
, m_xIconView(pIconView)
{
m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
}
virtual void freeze() override
{
SalInstanceWidget::freeze();
m_xIconView->SetUpdateMode(false);
}
virtual void thaw() override
{
m_xIconView->SetUpdateMode(true);
SalInstanceWidget::thaw();
}
virtual void insert(int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, weld::TreeIter* pRet) override
{
disable_notify_events();
auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
void* pUserData;
if (pId)
{
m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
pUserData = m_aUserData.back().get();
}
else
pUserData = nullptr;
SvTreeListEntry* pEntry = new SvTreeListEntry;
if (pIconName)
{
Image aImage(createImage(*pIconName));
pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
}
else
{
Image aDummy;
pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
}
if (pStr)
pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
pEntry->SetUserData(pUserData);
m_xIconView->Insert(pEntry, nullptr, nInsertPos);
if (pRet)
{
SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
pVclRetIter->iter = pEntry;
}
enable_notify_events();
}
virtual OUString get_selected_id() const override
{
assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
{
if (const OUString* pStr = static_cast<const OUString*>(pEntry->GetUserData()))
return *pStr;
}
return OUString();
}
virtual OUString get_selected_text() const override
{
assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
return m_xIconView->GetEntryText(pEntry);
return OUString();
}
virtual int count_selected_items() const override
{
return m_xIconView->GetSelectionCount();
}
virtual void select(int pos) override
{
assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
if (pos == -1 || (pos == 0 && n_children() == 0))
m_xIconView->SelectAll(false);
else
{
SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
m_xIconView->Select(pEntry, true);
m_xIconView->MakeVisible(pEntry);
}
enable_notify_events();
}
virtual void unselect(int pos) override
{
assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
if (pos == -1)
m_xIconView->SelectAll(true);
else
{
SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
m_xIconView->Select(pEntry, false);
}
enable_notify_events();
}
virtual int n_children() const override
{
return m_xIconView->GetModel()->GetChildList(nullptr).size();
}
virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig) const override
{
return std::unique_ptr<weld::TreeIter>(new SalInstanceTreeIter(static_cast<const SalInstanceTreeIter*>(pOrig)));
}
virtual bool get_selected(weld::TreeIter* pIter) const override
{
SvTreeListEntry* pEntry = m_xIconView->FirstSelected();
auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
if (pVclIter)
pVclIter->iter = pEntry;
return pEntry != nullptr;
}
virtual bool get_cursor(weld::TreeIter* pIter) const override
{
SvTreeListEntry* pEntry = m_xIconView->GetCurEntry();
auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
if (pVclIter)
pVclIter->iter = pEntry;
return pEntry != nullptr;
}
virtual void set_cursor(const weld::TreeIter& rIter) override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
disable_notify_events();
m_xIconView->SetCurEntry(rVclIter.iter);
enable_notify_events();
}
virtual bool get_iter_first(weld::TreeIter& rIter) const override
{
SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
rVclIter.iter = m_xIconView->GetEntry(0);
return rVclIter.iter != nullptr;
}
virtual void scroll_to_item(const weld::TreeIter& rIter) override
{
assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
m_xIconView->MakeVisible(rVclIter.iter);
enable_notify_events();
}
virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
{
SalInstanceTreeIter aVclIter(m_xIconView->FirstSelected());
while (aVclIter.iter)
{
if (func(aVclIter))
return;
aVclIter.iter = m_xIconView->NextSelected(aVclIter.iter);
}
}
virtual OUString get_id(const weld::TreeIter& rIter) const override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
const OUString* pStr = static_cast<const OUString*>(rVclIter.iter->GetUserData());
if (pStr)
return *pStr;
return OUString();
}
virtual void clear() override
{
disable_notify_events();
m_xIconView->Clear();
m_aUserData.clear();
enable_notify_events();
}
virtual ~SalInstanceIconView() override
{
m_xIconView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
m_xIconView->SetSelectHdl(Link<SvTreeListBox*, void>());
m_xIconView->SetDeselectHdl(Link<SvTreeListBox*, void>());
}
};
IMPL_LINK_NOARG(SalInstanceIconView, SelectHdl, SvTreeListBox*, void)
{
if (notify_events_disabled())
return;
signal_selection_changed();
}
IMPL_LINK_NOARG(SalInstanceIconView, DeSelectHdl, SvTreeListBox*, void)
{
if (notify_events_disabled())
return;
if (m_xIconView->GetSelectionMode() == SelectionMode::Single)
return;
signal_selection_changed();
}
IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
{
if (notify_events_disabled())
return false;
return !signal_item_activated();
}
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
{
private:
@@ -5472,7 +5741,7 @@ public:
}
}
virtual void insert_separator(int pos) override
virtual void insert_separator(int pos, const OUString& /*rId*/) override
{
auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos;
m_xComboBox->AddSeparator(nInsertPos - 1);
@@ -5588,7 +5857,7 @@ public:
}
}
virtual void insert_separator(int pos) override
virtual void insert_separator(int pos, const OUString& /*rId*/) override
{
auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos;
m_xComboBox->AddSeparator(nInsertPos - 1);
@@ -5667,7 +5936,7 @@ public:
rEntry.AddEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener));
}
virtual void insert_separator(int /*pos*/) override
virtual void insert_separator(int /*pos*/, const OUString& /*rId*/) override
{
assert(false);
}
@@ -6036,6 +6305,12 @@ public:
return pTreeView ? std::make_unique<SalInstanceTreeView>(pTreeView, this, bTakeOwnership) : nullptr;
}
virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, bool bTakeOwnership) override
{
IconView* pIconView = m_xBuilder->get<IconView>(id);
return pIconView ? std::make_unique<SalInstanceIconView>(pIconView, this, bTakeOwnership) : nullptr;
}
virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool bTakeOwnership) override
{
Control* pLabel = m_xBuilder->get<Control>(id);
@@ -19,12 +19,11 @@
#include <vcl/treelistentry.hxx>
#include <vcl/viewdataentry.hxx>
#include "fileview.hxx"
#include "iconview.hxx"
#include "iconviewimpl.hxx"
#include <iconview.hxx>
#include <iconviewimpl.hxx>
IconView::IconView( vcl::Window* pParent, WinBits nBits )
: SvTreeListBox( pParent, nBits )
: SvTreeListBox( pParent, nBits )
{
nColumns = 1;
mbCenterAndClipText = true;
@@ -74,14 +73,6 @@ tools::Rectangle IconView::GetFocusRect( SvTreeListEntry*, long nEntryPos )
return aRect;
}
void IconView::ClearAll()
{
for ( sal_uLong i = 0; i < GetEntryCount(); ++i )
delete static_cast<SvtContentEntry*>(GetEntry(i)->GetUserData());
Clear();
}
void IconView::PaintEntry(SvTreeListEntry& rEntry, long nX, long nY,
vcl::RenderContext& rRenderContext)
{
@@ -19,8 +19,8 @@
#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include "iconview.hxx"
#include "iconviewimpl.hxx"
#include <iconview.hxx>
#include <iconviewimpl.hxx>
IconViewImpl::IconViewImpl( SvTreeListBox* pTreeListBox, SvTreeList* pTreeList, WinBits nWinStyle )
: SvImpLBox( pTreeListBox, pTreeList, nWinStyle )
+24
View File
@@ -48,6 +48,7 @@
#include <vcl/slider.hxx>
#include <vcl/weld.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <iconview.hxx>
#include <svdata.hxx>
#include <bitmaps.hlst>
#include <messagedialog.hxx>
@@ -2040,6 +2041,29 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
xWindow = xBox;
}
}
else if (name == "GtkIconView")
{
assert(rMap.find(OString("model")) != rMap.end() && "GtkIconView must have a model");
//window we want to apply the packing props for this GtkIconView to
VclPtr<vcl::Window> xWindowForPackingProps;
extractModel(id, rMap);
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_HIDESELECTION;
//IconView manages its own scrolling,
vcl::Window *pRealParent = prepareWidgetOwnScrolling(pParent, nWinStyle);
if (pRealParent != pParent)
nWinStyle |= WB_BORDER;
VclPtr<IconView> xBox = VclPtr<IconView>::Create(pRealParent, nWinStyle);
xWindowForPackingProps = xBox;
xWindow = xBox;
xBox->SetNoAutoCurEntry(true);
xBox->SetQuickSearch(true);
if (pRealParent != pParent)
cleanupWidgetOwnScrolling(pParent, xWindowForPackingProps, rMap);
}
else if (name == "GtkTreeView")
{
if (!m_bLegacy)
+470 -20
View File
@@ -1907,6 +1907,21 @@ private:
bool signal_button(GdkEventButton* pEvent)
{
Point aPos(pEvent->x, pEvent->y);
if (SwapForRTL())
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
{
//if handled for context menu, stop processing
CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true);
if (signal_popup_menu(aCEvt))
return true;
}
if (!m_aMousePressHdl.IsSet() && !m_aMouseReleaseHdl.IsSet())
return false;
SalEvent nEventType = SalEvent::NONE;
switch (pEvent->type)
{
@@ -1954,19 +1969,6 @@ private:
return false;
}
Point aPos(pEvent->x, pEvent->y);
if (SwapForRTL())
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
{
//if handled for context menu, stop processing
CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true);
if (signal_popup_menu(aCEvt))
return true;
}
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
MouseEvent aMEvt(aPos, m_nLastMouseClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
@@ -3111,6 +3113,11 @@ public:
m_aMap.clear();
}
GtkMenu* getMenu() const
{
return m_pMenu;
}
virtual ~MenuHelper()
{
for (auto& a : m_aMap)
@@ -3305,12 +3312,13 @@ namespace
int getButtonPriority(const OString &rType)
{
static const size_t N_TYPES = 6;
static const size_t N_TYPES = 7;
static const ButtonOrder aDiscardCancelSave[N_TYPES] =
{
{ "/discard", 0 },
{ "/cancel", 1 },
{ "/no", 2 },
{ "/open", 3 },
{ "/save", 3 },
{ "/yes", 3 },
{ "/ok", 3 }
@@ -3318,6 +3326,7 @@ namespace
static const ButtonOrder aSaveDiscardCancel[N_TYPES] =
{
{ "/open", 0 },
{ "/save", 0 },
{ "/yes", 0 },
{ "/ok", 0 },
@@ -6555,6 +6564,8 @@ public:
}
}
void set_menu(weld::Menu* pMenu);
virtual ~GtkInstanceMenuButton() override
{
if (m_pMenuHack)
@@ -6785,6 +6796,14 @@ public:
}
};
void GtkInstanceMenuButton::set_menu(weld::Menu* pMenu)
{
GtkInstanceMenu* pPopoverWidget = dynamic_cast<GtkInstanceMenu*>(pMenu);
m_pPopover = nullptr;
GtkWidget* pMenuWidget = GTK_WIDGET(pPopoverWidget ? pPopoverWidget->getMenu() : nullptr);
gtk_menu_button_set_popup(m_pMenuButton, pMenuWidget);
}
class GtkInstanceToolbar : public GtkInstanceWidget, public virtual weld::Toolbar
{
private:
@@ -6916,6 +6935,11 @@ public:
m_aMenuButtonMap[rIdent]->set_popover(pPopover);
}
virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override
{
m_aMenuButtonMap[rIdent]->set_menu(pMenu);
}
virtual ~GtkInstanceToolbar() override
{
for (auto& a : m_aMap)
@@ -7136,13 +7160,26 @@ public:
virtual void set_image(VirtualDevice* pDevice) override
{
if (gtk_check_version(3, 20, 0) == nullptr)
{
if (pDevice)
gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
else
{
GdkPixbuf* pixbuf = getPixbuf(*pDevice);
gtk_image_set_from_surface(m_pImage, nullptr);
return;
}
GdkPixbuf* pixbuf = pDevice ? getPixbuf(*pDevice) : nullptr;
gtk_image_set_from_pixbuf(m_pImage, pixbuf);
if (pixbuf)
g_object_unref(pixbuf);
}
virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
{
GdkPixbuf* pixbuf = getPixbuf(rImage);
gtk_image_set_from_pixbuf(m_pImage, pixbuf);
if (pixbuf)
g_object_unref(pixbuf);
}
};
@@ -8032,6 +8069,15 @@ private:
pThis->signal_cell_edited(pCell, path, pNewText);
}
static void restoreNonEditable(GObject* pCell)
{
if (g_object_get_data(pCell, "g-lo-RestoreNonEditable"))
{
g_object_set(pCell, "editable", false, "editable-set", false, nullptr);
g_object_set_data(pCell, "g-lo-RestoreNonEditable", reinterpret_cast<gpointer>(false));
}
}
void signal_cell_edited(GtkCellRendererText* pCell, const gchar *path, const gchar* pNewText)
{
GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
@@ -8047,6 +8093,13 @@ private:
void* pData = g_object_get_data(G_OBJECT(pCell), "g-lo-CellIndex");
set(aGtkIter.iter, reinterpret_cast<sal_IntPtr>(pData), sText);
}
restoreNonEditable(G_OBJECT(pCell));
}
static void signalCellEditingCanceled(GtkCellRenderer* pCell, gpointer /*widget*/)
{
restoreNonEditable(G_OBJECT(pCell));
}
void signal_column_clicked(GtkTreeViewColumn* pClickedColumn)
@@ -8202,6 +8255,7 @@ public:
m_aWeightMap[nIndex] = -1;
m_aSensitiveMap[nIndex] = -1;
g_signal_connect(G_OBJECT(pCellRenderer), "editing-started", G_CALLBACK(signalCellEditingStarted), this);
g_signal_connect(G_OBJECT(pCellRenderer), "editing-canceled", G_CALLBACK(signalCellEditingCanceled), this);
g_signal_connect(G_OBJECT(pCellRenderer), "edited", G_CALLBACK(signalCellEdited), this);
}
else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer))
@@ -9228,7 +9282,6 @@ public:
if (!gtk_tree_view_row_expanded(m_pTreeView, path))
gtk_tree_view_expand_to_path(m_pTreeView, path);
gtk_tree_path_free(path);
}
virtual void collapse_row(const weld::TreeIter& rIter) override
@@ -9525,6 +9578,27 @@ public:
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
// allow editing of cells which are not usually editable, so we can have double click
// do its usual row-activate but if we explicitly want to edit (remote files dialog)
// we can still do that
GList *pRenderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(pColumn));
for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
{
GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data);
if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
{
gboolean is_editable(false);
g_object_get(pCellRenderer, "editable", &is_editable, nullptr);
if (!is_editable)
{
g_object_set(pCellRenderer, "editable", true, "editable-set", true, nullptr);
g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-RestoreNonEditable", reinterpret_cast<gpointer>(true));
break;
}
}
}
g_list_free(pRenderers);
gtk_tree_view_set_cursor(m_pTreeView, path, pColumn, true);
gtk_tree_path_free(path);
@@ -9614,6 +9688,373 @@ IMPL_LINK_NOARG(GtkInstanceTreeView, async_stop_cell_editing, void*, void)
end_editing();
}
class GtkInstanceIconView : public GtkInstanceContainer, public virtual weld::IconView
{
private:
GtkIconView* m_pIconView;
GtkTreeStore* m_pTreeStore;
std::vector<int> m_aViewColToModelCol;
std::vector<int> m_aModelColToViewCol;
gint m_nTextCol;
gint m_nImageCol;
gint m_nIdCol;
gulong m_nSelectionChangedSignalId;
gulong m_nItemActivatedSignalId;
ImplSVEvent* m_pSelectionChangeEvent;
DECL_LINK(async_signal_selection_changed, void*, void);
void launch_signal_selection_changed()
{
//tdf#117991 selection change is sent before the focus change, and focus change
//is what will cause a spinbutton that currently has the focus to set its contents
//as the spin button value. So any LibreOffice callbacks on
//signal-change would happen before the spinbutton value-change occurs.
//To avoid this, send the signal-change to LibreOffice to occur after focus-change
//has been processed
if (m_pSelectionChangeEvent)
Application::RemoveUserEvent(m_pSelectionChangeEvent);
m_pSelectionChangeEvent = Application::PostUserEvent(LINK(this, GtkInstanceIconView, async_signal_selection_changed));
}
static void signalSelectionChanged(GtkIconView*, gpointer widget)
{
GtkInstanceIconView* pThis = static_cast<GtkInstanceIconView*>(widget);
pThis->launch_signal_selection_changed();
}
void handle_item_activated()
{
if (signal_item_activated())
return;
}
static void signalItemActivated(GtkIconView*, GtkTreePath*, gpointer widget)
{
GtkInstanceIconView* pThis = static_cast<GtkInstanceIconView*>(widget);
SolarMutexGuard aGuard;
pThis->handle_item_activated();
}
void insert_item(GtkTreeIter& iter, int pos, const OUString* pId, const OUString* pText, const OUString* pIconName)
{
gtk_tree_store_insert_with_values(m_pTreeStore, &iter, nullptr, pos,
m_nTextCol, !pText ? nullptr : OUStringToOString(*pText, RTL_TEXTENCODING_UTF8).getStr(),
m_nIdCol, !pId ? nullptr : OUStringToOString(*pId, RTL_TEXTENCODING_UTF8).getStr(),
-1);
if (pIconName)
{
GdkPixbuf* pixbuf = getPixbuf(*pIconName);
gtk_tree_store_set(m_pTreeStore, &iter, m_nImageCol, pixbuf, -1);
if (pixbuf)
g_object_unref(pixbuf);
}
}
OUString get(const GtkTreeIter& iter, int col) const
{
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
gchar* pStr;
gtk_tree_model_get(pModel, const_cast<GtkTreeIter*>(&iter), col, &pStr, -1);
OUString sRet(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
g_free(pStr);
return sRet;
}
bool get_selected_iterator(GtkTreeIter* pIter) const
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
bool bRet = false;
{
GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore);
GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
for (GList* pItem = g_list_first(pList); pItem; pItem = g_list_next(pItem))
{
if (pIter)
{
GtkTreePath* path = static_cast<GtkTreePath*>(pItem->data);
gtk_tree_model_get_iter(pModel, pIter, path);
}
bRet = true;
break;
}
g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
}
return bRet;
}
public:
GtkInstanceIconView(GtkIconView* pIconView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pIconView), pBuilder, bTakeOwnership)
, m_pIconView(pIconView)
, m_pTreeStore(GTK_TREE_STORE(gtk_icon_view_get_model(m_pIconView)))
, m_nTextCol(gtk_icon_view_get_text_column(m_pIconView))
, m_nImageCol(gtk_icon_view_get_pixbuf_column(m_pIconView))
, m_nSelectionChangedSignalId(g_signal_connect(pIconView, "selection-changed",
G_CALLBACK(signalSelectionChanged), this))
, m_nItemActivatedSignalId(g_signal_connect(pIconView, "item-activated", G_CALLBACK(signalItemActivated), this))
, m_pSelectionChangeEvent(nullptr)
{
m_nIdCol = m_nTextCol + 1;
}
virtual void insert(int pos, const OUString* pText, const OUString* pId, const OUString* pIconName, weld::TreeIter* pRet) override
{
disable_notify_events();
GtkTreeIter iter;
insert_item(iter, pos, pId, pText, pIconName);
if (pRet)
{
GtkInstanceTreeIter* pGtkRetIter = static_cast<GtkInstanceTreeIter*>(pRet);
pGtkRetIter->iter = iter;
}
enable_notify_events();
}
virtual OUString get_selected_id() const override
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
GtkTreeIter iter;
if (get_selected_iterator(&iter))
return get(iter, m_nIdCol);
return OUString();
}
virtual void clear() override
{
disable_notify_events();
gtk_tree_store_clear(m_pTreeStore);
enable_notify_events();
}
virtual void freeze() override
{
disable_notify_events();
g_object_ref(m_pTreeStore);
GtkInstanceContainer::freeze();
gtk_icon_view_set_model(m_pIconView, nullptr);
enable_notify_events();
}
virtual void thaw() override
{
disable_notify_events();
gtk_icon_view_set_model(m_pIconView, GTK_TREE_MODEL(m_pTreeStore));
GtkInstanceContainer::thaw();
g_object_unref(m_pTreeStore);
enable_notify_events();
}
virtual Size get_size_request() const override
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
if (GTK_IS_SCROLLED_WINDOW(pParent))
{
return Size(gtk_scrolled_window_get_min_content_width(GTK_SCROLLED_WINDOW(pParent)),
gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(pParent)));
}
int nWidth, nHeight;
gtk_widget_get_size_request(m_pWidget, &nWidth, &nHeight);
return Size(nWidth, nHeight);
}
virtual Size get_preferred_size() const override
{
Size aRet(-1, -1);
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
if (GTK_IS_SCROLLED_WINDOW(pParent))
{
aRet = Size(gtk_scrolled_window_get_min_content_width(GTK_SCROLLED_WINDOW(pParent)),
gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(pParent)));
}
GtkRequisition size;
gtk_widget_get_preferred_size(m_pWidget, nullptr, &size);
if (aRet.Width() == -1)
aRet.setWidth(size.width);
if (aRet.Height() == -1)
aRet.setHeight(size.height);
return aRet;
}
virtual void show() override
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
if (GTK_IS_SCROLLED_WINDOW(pParent))
gtk_widget_show(pParent);
gtk_widget_show(m_pWidget);
}
virtual void hide() override
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
if (GTK_IS_SCROLLED_WINDOW(pParent))
gtk_widget_hide(pParent);
gtk_widget_hide(m_pWidget);
}
virtual OUString get_selected_text() const override
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
GtkTreeIter iter;
if (get_selected_iterator(&iter))
return get(iter, m_nTextCol);
return OUString();
}
virtual int count_selected_items() const override
{
GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
int nRet = g_list_length(pList);
g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
return nRet;
}
virtual void select(int pos) override
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
disable_notify_events();
if (pos == -1 || (pos == 0 && n_children() == 0))
{
gtk_icon_view_unselect_all(m_pIconView);
}
else
{
GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
gtk_icon_view_select_path(m_pIconView, path);
gtk_icon_view_scroll_to_path(m_pIconView, path, false, 0, 0);
gtk_tree_path_free(path);
}
enable_notify_events();
}
virtual void unselect(int pos) override
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
disable_notify_events();
if (pos == -1 || (pos == 0 && n_children() == 0))
{
gtk_icon_view_select_all(m_pIconView);
}
else
{
GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
gtk_icon_view_select_path(m_pIconView, path);
gtk_tree_path_free(path);
}
enable_notify_events();
}
virtual bool get_selected(weld::TreeIter* pIter) const override
{
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
return get_selected_iterator(pGtkIter ? &pGtkIter->iter : nullptr);
}
virtual bool get_cursor(weld::TreeIter* pIter) const override
{
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
GtkTreePath* path;
gtk_icon_view_get_cursor(m_pIconView, &path, nullptr);
if (pGtkIter && path)
{
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
gtk_tree_model_get_iter(pModel, &pGtkIter->iter, path);
}
return path != nullptr;
}
virtual void set_cursor(const weld::TreeIter& rIter) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
gtk_icon_view_set_cursor(m_pIconView, path, nullptr, false);
gtk_tree_path_free(path);
}
virtual bool get_iter_first(weld::TreeIter& rIter) const override
{
GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
return gtk_tree_model_get_iter_first(pModel, &rGtkIter.iter);
}
virtual void scroll_to_item(const weld::TreeIter& rIter) override
{
assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
disable_notify_events();
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
gtk_icon_view_scroll_to_path(m_pIconView, path, false, 0, 0);
gtk_tree_path_free(path);
enable_notify_events();
}
virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig) const override
{
return std::unique_ptr<weld::TreeIter>(new GtkInstanceTreeIter(static_cast<const GtkInstanceTreeIter*>(pOrig)));
}
virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
{
GtkInstanceTreeIter aGtkIter(nullptr);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
for (GList* pItem = g_list_first(pList); pItem; pItem = g_list_next(pItem))
{
GtkTreePath* path = static_cast<GtkTreePath*>(pItem->data);
gtk_tree_model_get_iter(pModel, &aGtkIter.iter, path);
if (func(aGtkIter))
break;
}
g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
}
virtual int n_children() const override
{
return gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_pTreeStore), nullptr);
}
virtual OUString get_id(const weld::TreeIter& rIter) const override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
return get(rGtkIter.iter, m_nIdCol);
}
virtual void disable_notify_events() override
{
g_signal_handler_block(m_pIconView, m_nSelectionChangedSignalId);
g_signal_handler_block(m_pIconView, m_nItemActivatedSignalId);
GtkInstanceContainer::disable_notify_events();
}
virtual void enable_notify_events() override
{
GtkInstanceContainer::enable_notify_events();
g_signal_handler_unblock(m_pIconView, m_nItemActivatedSignalId);
g_signal_handler_unblock(m_pIconView, m_nSelectionChangedSignalId);
}
virtual ~GtkInstanceIconView() override
{
if (m_pSelectionChangeEvent)
Application::RemoveUserEvent(m_pSelectionChangeEvent);
g_signal_handler_disconnect(m_pIconView, m_nItemActivatedSignalId);
g_signal_handler_disconnect(m_pIconView, m_nSelectionChangedSignalId);
}
};
IMPL_LINK_NOARG(GtkInstanceIconView, async_signal_selection_changed, void*, void)
{
m_pSelectionChangeEvent = nullptr;
signal_selection_changed();
}
class GtkInstanceSpinButton : public GtkInstanceEntry, public virtual weld::SpinButton
{
private:
@@ -11118,7 +11559,7 @@ public:
bodge_wayland_menu_not_appearing();
}
virtual void insert_separator(int pos) override
virtual void insert_separator(int pos, const OUString& rId) override
{
disable_notify_events();
GtkTreeIter iter;
@@ -11126,7 +11567,7 @@ public:
m_aSeparatorRows.push_back(pos);
if (!gtk_combo_box_get_row_separator_func(m_pComboBox))
gtk_combo_box_set_row_separator_func(m_pComboBox, separatorFunction, this, nullptr);
insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, nullptr, "", nullptr, nullptr);
insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, &rId, "", nullptr, nullptr);
enable_notify_events();
bodge_wayland_menu_not_appearing();
}
@@ -11491,7 +11932,7 @@ public:
m_nEntryInsertTextSignalId = g_signal_connect(pWidget, "insert-text", G_CALLBACK(signalEntryInsertText), this);
}
virtual void insert_separator(int /*pos*/) override
virtual void insert_separator(int /*pos*/, const OUString& /*rId*/) override
{
assert(false);
}
@@ -12262,6 +12703,15 @@ public:
return std::make_unique<GtkInstanceTreeView>(pTreeView, this, bTakeOwnership);
}
virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, bool bTakeOwnership) override
{
GtkIconView* pIconView = GTK_ICON_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
if (!pIconView)
return nullptr;
auto_add_parentless_widgets_to_container(GTK_WIDGET(pIconView));
return std::make_unique<GtkInstanceIconView>(pIconView, this, bTakeOwnership);
}
virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
{
GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, containerid.getStr()));