Kaydet (Commit) 884df9f6 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld OSaveAsDlg

Change-Id: I745cdca8b79308db27ccd4fd2c9d4b557e3f6fce
Reviewed-on: https://gerrit.libreoffice.org/68624Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7823ea5a
......@@ -2013,7 +2013,7 @@ void OApplicationController::renameEntry()
if ( xContainer.is() )
{
std::unique_ptr< IObjectNameCheck > pNameChecker;
VclPtr< OSaveAsDlg > aDialog;
std::unique_ptr<OSaveAsDlg> xDialog;
Reference<XRename> xRename;
const ElementType eType = getContainer()->getElementType();
......@@ -2046,9 +2046,8 @@ void OApplicationController::renameEntry()
}
}
pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) );
aDialog.reset( VclPtr<OSaveAsDlg>::Create(
getView(), getORB(), sName, sLabel, *pNameChecker, SADFlags::TitleRename ) );
xDialog.reset(new OSaveAsDlg(
getFrameWeld(), getORB(), sName, sLabel, *pNameChecker, SADFlags::TitleRename));
}
}
}
......@@ -2066,37 +2065,35 @@ void OApplicationController::renameEntry()
ensureConnection();
pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
aDialog.reset( VclPtr<OSaveAsDlg>::Create(
getView(), nCommandType, getORB(), getConnection(),
*aList.begin(), *pNameChecker, SADFlags::TitleRename ) );
xDialog.reset(new OSaveAsDlg(getFrameWeld(), nCommandType, getORB(), getConnection(),
*aList.begin(), *pNameChecker, SADFlags::TitleRename));
}
break;
default:
break;
}
if ( xRename.is() && aDialog.get() )
if (xRename.is() && xDialog)
{
bool bTryAgain = true;
while( bTryAgain )
{
if ( aDialog->Execute() == RET_OK )
if (xDialog->run() == RET_OK)
{
try
{
OUString sNewName;
if ( eType == E_TABLE )
{
OUString sName = aDialog->getName();
OUString sCatalog = aDialog->getCatalog();
OUString sSchema = aDialog->getSchema();
OUString sName = xDialog->getName();
OUString sCatalog = xDialog->getCatalog();
OUString sSchema = xDialog->getSchema();
sNewName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InDataManipulation );
}
else
sNewName = aDialog->getName();
sNewName = xDialog->getName();
OUString sOldName = *aList.begin();
if ( eType == E_FORM || eType == E_REPORT )
......
......@@ -680,18 +680,17 @@ bool OApplicationController::paste( ElementType _eType, const svx::ODataAccessDe
has a /table/ with that name) */
if ( bNeedAskForName )
{
ScopedVclPtrInstance<OSaveAsDlg> aAskForName(
getView(),
CommandType::QUERY,
getORB(),
getConnection(),
sTargetName,
aNameChecker,
SADFlags::AdditionalDescription | SADFlags::TitlePasteAs );
if ( RET_OK != aAskForName->Execute() )
OSaveAsDlg aAskForName(getFrameWeld(),
CommandType::QUERY,
getORB(),
getConnection(),
sTargetName,
aNameChecker,
SADFlags::AdditionalDescription | SADFlags::TitlePasteAs );
if ( RET_OK != aAskForName.run() )
// cancelled by the user
return false;
sTargetName = aAskForName->getName();
sTargetName = aAskForName.getName();
}
// create a new object
......
......@@ -64,6 +64,7 @@
#include <vcl/weld.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>
#include <vcl/waitobj.hxx>
#include <osl/mutex.hxx>
......@@ -108,12 +109,12 @@ void OApplicationController::convertToView(const OUString& _sName)
const OUString aDefaultName = ::dbaui::createDefaultName(xMeta, xTables, DBA_RES(STR_TBL_TITLE).getToken(0, ' '));
DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE );
ScopedVclPtrInstance< OSaveAsDlg > aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker, SADFlags::NONE );
if ( aDlg->Execute() == RET_OK )
OSaveAsDlg aDlg(getFrameWeld(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker, SADFlags::NONE);
if (aDlg.run() == RET_OK)
{
OUString sName = aDlg->getName();
OUString sCatalog = aDlg->getCatalog();
OUString sSchema = aDlg->getSchema();
OUString sName = aDlg.getName();
OUString sCatalog = aDlg.getCatalog();
OUString sSchema = aDlg.getSchema();
OUString sNewName(
::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InTableDefinitions ) );
Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
......@@ -591,7 +592,7 @@ void OApplicationController::onDocumentOpened( const OUString& _rName, const sal
bool OApplicationController::insertHierachyElement(ElementType _eType, const OUString& _sParentFolder, bool _bCollection, const Reference<XContent>& _xContent, bool _bMove)
{
Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY);
return dbaui::insertHierachyElement(getView()
return dbaui::insertHierachyElement(getFrameWeld()
,getORB()
,xNames
,_sParentFolder
......
......@@ -196,7 +196,7 @@ IMPL_LINK_NOARG(OCollectionView, NewFolder_Click, Button*, void)
try
{
Reference<XHierarchicalNameContainer> xNameContainer(m_xContent,UNO_QUERY);
if ( dbaui::insertHierachyElement(this,m_xContext,xNameContainer,OUString(),m_bCreateForm) )
if ( dbaui::insertHierachyElement(GetFrameWeld(),m_xContext,xNameContainer,OUString(),m_bCreateForm) )
m_pView->Initialize(m_xContent);
}
catch( const SQLException& )
......
......@@ -377,7 +377,7 @@ namespace dbaui
<TRUE/> if the insert opertions was successful, otherwise <FALSE/>.
*/
bool insertHierachyElement(
vcl::Window* _pParent,
weld::Window* pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const css::uno::Reference< css::container::XHierarchicalNameContainer>& _xNames,
const OUString& _sParentFolder,
......
......@@ -21,11 +21,11 @@
#define INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSAVE_HXX
#include <apitools.hxx>
#include <vcl/dialog.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <memory>
#include <o3tl/typed_flags_set.hxx>
#include <vcl/weld.hxx>
#include <memory>
namespace com { namespace sun { namespace star {
namespace sdbc {
......@@ -43,41 +43,37 @@ namespace o3tl {
template<> struct typed_flags<SADFlags> : is_typed_flags<SADFlags, 0x0301> {};
}
class Button;
class Edit;
namespace dbaui
{
class OSaveAsDlgImpl;
class IObjectNameCheck;
class OSaveAsDlg : public ModalDialog
class OSaveAsDlg : public weld::GenericDialogController
{
private:
std::unique_ptr<OSaveAsDlgImpl> m_pImpl;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
public:
OSaveAsDlg( vcl::Window * pParent, sal_Int32 _rType,
OSaveAsDlg( weld::Window * pParent, sal_Int32 _rType,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
const OUString& rDefault,
const IObjectNameCheck& _rObjectNameCheck,
SADFlags _nFlags);
OSaveAsDlg( vcl::Window* _pParent,
OSaveAsDlg( weld::Window* _pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const OUString& _rDefault,
const OUString& _sLabel,
const IObjectNameCheck& _rObjectNameCheck,
SADFlags _nFlags);
virtual ~OSaveAsDlg() override;
virtual void dispose() override;
const OUString& getName() const;
OUString getCatalog() const;
OUString getSchema() const;
private:
DECL_LINK(ButtonClickHdl, Button *, void);
DECL_LINK(EditModifyHdl, Edit&, void);
DECL_LINK(ButtonClickHdl, weld::Button&, void);
DECL_LINK(EditModifyHdl, weld::Entry&, void);
void implInitOnlyTitle(const OUString& _rLabel);
void implInit();
......
......@@ -1292,7 +1292,7 @@ Reference<XPropertySet> createView( const OUString& _rName, const Reference< XCo
return createView( _rName, _rxConnection, sCommand );
}
bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentContext >& _rxContext,
bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentContext >& _rxContext,
const Reference<XHierarchicalNameContainer>& _xNames,
const OUString& _sParentFolder,
bool _bForm,
......@@ -1337,18 +1337,17 @@ bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentCo
// here we have everything needed to create a new query object ...
HierarchicalNameCheck aNameChecker( _xNames.get(), _sParentFolder );
// ... ehm, except a new name
ScopedVclPtrInstance<OSaveAsDlg> aAskForName(
_pParent,
_rxContext,
sTargetName,
sLabel,
aNameChecker,
SADFlags::AdditionalDescription | SADFlags::TitlePasteAs );
if ( RET_OK != aAskForName->Execute() )
OSaveAsDlg aAskForName(pParent,
_rxContext,
sTargetName,
sLabel,
aNameChecker,
SADFlags::AdditionalDescription | SADFlags::TitlePasteAs);
if ( RET_OK != aAskForName.run() )
// cancelled by the user
return false;
sNewName = aAskForName->getName();
sNewName = aAskForName.getName();
}
}
else if ( xNameAccess->hasByName(sNewName) )
......
......@@ -1207,8 +1207,8 @@ bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements, b
}
DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
ScopedVclPtrInstance<OSaveAsDlg> aDlg(
getView(),
OSaveAsDlg aDlg(
getFrameWeld(),
m_nCommandType,
getORB(),
getConnection(),
......@@ -1216,14 +1216,14 @@ bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements, b
aNameChecker,
SADFlags::NONE );
bRet = ( aDlg->Execute() == RET_OK );
bRet = ( aDlg.run() == RET_OK );
if ( bRet )
{
m_sName = aDlg->getName();
m_sName = aDlg.getName();
if ( editingView() )
{
m_sUpdateCatalogName = aDlg->getCatalog();
m_sUpdateSchemaName = aDlg->getSchema();
m_sUpdateCatalogName = aDlg.getCatalog();
m_sUpdateSchemaName = aDlg.getSchema();
}
}
}
......
......@@ -301,13 +301,13 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
aDefaultName = ::dbtools::createUniqueName(xTables,aDefaultName);
DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::TABLE );
ScopedVclPtrInstance< OSaveAsDlg > aDlg( getView(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker, SADFlags::NONE );
if ( aDlg->Execute() != RET_OK )
OSaveAsDlg aDlg(getFrameWeld(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker, SADFlags::NONE);
if (aDlg.run() != RET_OK)
return false;
m_sName = aDlg->getName();
sCatalog = aDlg->getCatalog();
sSchema = aDlg->getSchema();
m_sName = aDlg.getName();
sCatalog = aDlg.getCatalog();
sSchema = aDlg.getSchema();
}
// did we get a name
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="SaveDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="savedialog|SaveDialog">Save As</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -81,10 +86,10 @@
<object class="GtkLabel" id="descriptionft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="savedialog|descriptionft">Please enter a name for the object to be created:</property>
<property name="wrap">True</property>
<property name="max_width_chars">52</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -96,10 +101,10 @@
<object class="GtkLabel" id="catalogft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="savedialog|catalogft">_Catalog:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">catalog</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -110,34 +115,23 @@
<object class="GtkLabel" id="schemaft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="savedialog|schemaft">_Schema:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">schema</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="dbulo-OSQLNameComboBox" id="schema">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="titleft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">title</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -145,10 +139,11 @@
</packing>
</child>
<child>
<object class="dbulo-OSQLNameEdit" id="title">
<object class="GtkEntry" id="title">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -156,16 +151,41 @@
</packing>
</child>
<child>
<object class="dbulo-OSQLNameComboBox" id="catalog">
<object class="GtkComboBoxText" id="catalog">
<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">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="schema">
<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">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -39,9 +39,6 @@
<glade-widget-class title="Condition Edit" name="rptuilo-ConditionField"
generic-name="ConditionEdit" parent="GtkEntry"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="OSQL NameEdit" name="dbulo-OSQLNameEdit"
generic-name="OSQLNameEdit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="VclComboBoxText" name="VclComboBoxText"
generic-name="ComboBoxText" parent="GtkComboBoxText"
......@@ -117,10 +114,6 @@
</properties>
</glade-widget-class>
<glade-widget-class title="OSQL NameComboBox" name="dbulo-OSQLNameComboBox"
generic-name="OSQLNameComboBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Font Preview" name="svxlo-SvxFontPrevWindow"
generic-name="Font Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment