summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx4
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx122
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx39
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx2
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx12
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx340
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx4
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx36
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hrc2
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx5
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src19
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx2
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx12
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx23
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx11
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx3
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx1
-rw-r--r--dbaccess/source/ui/inc/exsrcbrw.hxx2
-rwxr-xr-xdbaccess/source/ui/inc/singledoccontroller.hxx93
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx6
-rwxr-xr-xdbaccess/source/ui/misc/dbaundomanager.cxx395
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx672
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx1
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx3
-rw-r--r--dbaccess/source/ui/misc/makefile.mk75
-rwxr-xr-x[-rw-r--r--]dbaccess/source/ui/misc/singledoccontroller.cxx697
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryViewSwitch.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx8
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx2
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx29
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx26
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx11
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx15
37 files changed, 1726 insertions, 970 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 595d9b412851..f624853c8852 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -482,10 +482,6 @@ sal_Bool OApplicationController::Construct(Window* _pParent)
return sal_False;
}
- DBG_ASSERT( getView(), "OApplicationController::Construct: have no view!" );
- if ( getView() )
- getView()->enableSeparator( );
-
// now that we have a view we can create the clipboard listener
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
m_aSystemClipboard.StartClipboardListening( );
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 6a2161b1c291..103267154da0 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -737,6 +737,26 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
+ {
+ const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY );
+ const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY );
+ if ( xAnalyzer.is() )
+ {
+ const Reference< XIndexAccess > xOrderColumns( xAnalyzer->getOrderColumns(), UNO_SET_THROW );
+ const sal_Int32 nOrderColumns( xOrderColumns->getCount() );
+ for ( sal_Int32 c=0; c<nOrderColumns; ++c )
+ {
+ const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
+ ::rtl::OUString sColumnName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName);
+ ::rtl::OUString sTableName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName);
+ (void)sColumnName;
+ (void)sTableName;
+ }
+ }
+ }
+
Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY );
if ( xWarnings.is() )
{
@@ -807,7 +827,8 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent)
m_xColumnsSupplier.set(m_xRowSet,UNO_QUERY);
m_xLoadable.set(m_xRowSet,UNO_QUERY);
- if (!InitializeForm(m_xRowSet))
+ Reference< XPropertySet > xFormProperties( m_xRowSet, UNO_QUERY );
+ if ( !InitializeForm( xFormProperties ) )
return sal_False;
m_xGridModel = CreateGridModel();
@@ -1205,34 +1226,16 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
- // the filter or the sort criterias have changed ? -> update our parser
- if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND))
- {
- // if (m_xParser.is())
- //DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" );
- }
- else if (evt.PropertyName.equals(PROPERTY_FILTER))
+ if (evt.PropertyName.equals(PROPERTY_FILTER))
{
- // if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue))
- //{
- // DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
- //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE))
{
- //if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue))
- //{
- // DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
- //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
else if (evt.PropertyName.equals(PROPERTY_ORDER))
{
- //if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue))
- //{
- // DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" );
- //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
@@ -1871,25 +1874,50 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi
setCurrentColumnPosition(nPos);
}
+
//------------------------------------------------------------------------------
Reference< XSingleSelectQueryComposer > SbaXDataBrowserController::createParser_nothrow()
{
- Reference< XSingleSelectQueryComposer > xRet;
+ Reference< XSingleSelectQueryComposer > xComposer;
try
{
- Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY_THROW);
- const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY_THROW);
- xRet.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY_THROW);
- xRet->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND)));
- xRet->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER)));
- xRet->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE)));
- xRet->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER)));
+ const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
+ const Reference< XMultiServiceFactory > xFactory(
+ xRowSetProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY_THROW );
+ xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW );
+
+ ::rtl::OUString sActiveCommand;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sActiveCommand );
+ if ( sActiveCommand.getLength() > 0 )
+ {
+ xComposer->setElementaryQuery( sActiveCommand );
+ }
+ else
+ {
+ ::rtl::OUString sCommand;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
+ sal_Int32 nCommandType = CommandType::COMMAND;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= nCommandType );
+ xComposer->setCommand( sCommand, nCommandType );
+ }
+
+ ::rtl::OUString sFilter;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_FILTER ) >>= sFilter );
+ xComposer->setFilter( sFilter );
+
+ ::rtl::OUString sHavingClause;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_HAVING_CLAUSE ) >>= sHavingClause );
+ xComposer->setHavingClause( sHavingClause );
+
+ ::rtl::OUString sOrder;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ORDER ) >>= sOrder );
+ xComposer->setOrder( sOrder );
}
- catch(Exception&)
+ catch ( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
- return xRet;
+ return xComposer;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
@@ -1911,12 +1939,8 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
{
DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
String aFilter;
- if(!aDlg.Execute())
- {
- //m_xParser->setFilter(sOldVal);
- //m_xParser->setHavingClause(sOldHaving);
- return; // if so we don't need to actualize the grid
- }
+ if ( !aDlg.Execute() )
+ return; // if so we don't need to update the grid
aDlg.BuildWherePart();
}
else
@@ -1925,7 +1949,6 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
String aOrder;
if(!aDlg.Execute())
{
- //m_xParser->setOrder(sOldVal);
return; // if so we don't need to actualize the grid
}
aDlg.BuildOrderPart();
@@ -2707,22 +2730,7 @@ void SbaXDataBrowserController::initializeParser() const
{ // (only if the statement isn't native)
// (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
-/*
- const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY);
- if ( xFactory.is() )
- m_xParser.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
-*/
}
-/*
- // initialize the parser with the current sql-statement of the form
- if ( m_xParser.is() )
- {
- m_xParser->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND)));
- m_xParser->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER)));
- m_xParser->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE)));
- m_xParser->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER)));
- }
-*/
}
catch(Exception&)
{
@@ -2758,16 +2766,6 @@ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( R
// change as a reaction on that event. as we have no chance to be notified of this change (which is
// the one we're interested in) we give them time to do what they want to before invalidating our
// bound-field-dependent slots ....
- /*
- try
- {
- ::comphelper::disposeComponent(m_xParser);
- }
- catch(Exception&)
- {
- OSL_ENSURE(0,"Exception thrown by dispose");
- }
- */
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 382aac477727..8112250ad23e 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -44,9 +44,6 @@
#ifndef _SFXIMGMGR_HXX
#include <sfx2/imgmgr.hxx>
#endif
-#ifndef _SV_FIXED_HXX
-#include <vcl/fixed.hxx>
-#endif
#ifndef DBAUI_ICONTROLLER_HXX
#include "IController.hxx"
#endif
@@ -103,11 +100,12 @@ namespace dbaui
:Window(pParent,nStyle)
,m_xServiceFactory(_rFactory)
,m_rController( _rController )
- ,m_pSeparator( NULL )
+ ,m_aSeparator( this )
{
DBG_CTOR(ODataView,NULL);
m_rController.acquire();
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
+ m_aSeparator.Show();
}
// -------------------------------------------------------------------------
@@ -120,30 +118,10 @@ namespace dbaui
{
DBG_DTOR(ODataView,NULL);
- enableSeparator( sal_False );
m_rController.release();
}
// -------------------------------------------------------------------------
- void ODataView::enableSeparator( const sal_Bool _bEnable )
- {
- if ( _bEnable == isSeparatorEnabled() )
- // nothing to do
- return;
-
- if ( _bEnable )
- {
- m_pSeparator = new FixedLine( this );
- m_pSeparator->Show( );
- }
- else
- {
- ::std::auto_ptr<FixedLine> aTemp(m_pSeparator);
- m_pSeparator = NULL;
- }
- Resize();
- }
- // -------------------------------------------------------------------------
void ODataView::resizeDocumentView( Rectangle& /*_rPlayground*/ )
{
}
@@ -167,15 +145,10 @@ namespace dbaui
{
Rectangle aPlayground( _rPlayground );
- // position thew separator
- if ( m_pSeparator )
- {
- Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
-
- m_pSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
-
- aPlayground.Top() += aSeparatorSize.Height() + 1;
- }
+ // position the separator
+ const Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
+ m_aSeparator.SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
+ aPlayground.Top() += aSeparatorSize.Height() + 1;
// position the controls of the document's view
resizeDocumentView( aPlayground );
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 41200c7625ec..ba40583141ab 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -145,7 +145,7 @@ Reference< XRowSet > SbaExternalSourceBrowser::CreateForm()
}
//------------------------------------------------------------------------------
-sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XRowSet > & /*xForm*/)
+sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XPropertySet > & /*i_formProperties*/)
{
return sal_True;
}
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index b81b073a56bf..0c0190318c72 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -704,6 +704,18 @@ void OGenericUnoController::InvalidateFeature_Impl()
// -----------------------------------------------------------------------
void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Reference< XStatusListener >& _xListener, sal_Bool _bForceBroadcast )
{
+#if OSL_DEBUG_LEVEL > 0
+ if ( _nId != -1 )
+ {
+ SupportedFeatures::iterator aFeaturePos = ::std::find_if(
+ m_aSupportedFeatures.begin(),
+ m_aSupportedFeatures.end(),
+ ::std::bind2nd( CompareFeatureById(), _nId )
+ );
+ OSL_ENSURE( aFeaturePos != m_aSupportedFeatures.end(), "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" );
+ }
+#endif
+
FeatureListener aListener;
aListener.nId = _nId;
aListener.xListener = _xListener;
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index c65055c582fc..d15fb125f234 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -419,8 +420,146 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
return sal_True;
}
-// -------------------------------------------------------------------------
-sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm)
+// ---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ // -----------------------------------------------------------------------------------------------------------------
+ struct SelectValueByName : public ::std::unary_function< ::rtl::OUString, Any >
+ {
+ const Any& operator()( ::rtl::OUString const& i_name ) const
+ {
+ return m_rCollection.get( i_name );
+ }
+
+ SelectValueByName( ::comphelper::NamedValueCollection const& i_collection )
+ :m_rCollection( i_collection )
+ {
+ }
+
+ ::comphelper::NamedValueCollection const& m_rCollection;
+ };
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
+{
+ try
+ {
+ Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
+ sal_Bool bEscapeProcessing = sal_False;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
+ if ( !bEscapeProcessing )
+ // don't touch or interpret anything if escape processing is disabled
+ return;
+
+ Reference< XSingleSelectQueryComposer > xComposer( createParser_nothrow() );
+ if ( !xComposer.is() )
+ // can't do anything. Already reported via assertion in createParser_nothrow.
+ return;
+
+ // the tables participating in the statement
+ const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableNames( xSuppTables->getTables(), UNO_QUERY_THROW );
+
+ // the columns participating in the statement
+ const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xColumnNames( xSuppColumns->getColumns(), UNO_QUERY_THROW );
+
+ // .............................................................................................................
+ // check if the order columns apply to tables which really exist in the statement
+ const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW );
+ const sal_Int32 nOrderColumns( xOrderColumns->getCount() );
+ bool invalidColumn = false;
+ for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c )
+ {
+ const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
+ ::rtl::OUString sTableName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName );
+ ::rtl::OUString sColumnName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName );
+
+ if ( sTableName.getLength() == 0 )
+ {
+ if ( !xColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
+ else
+ {
+ if ( !xTableNames->hasByName( sTableName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+
+ const Reference< XColumnsSupplier > xSuppTableColumns( xTableNames->getByName( sTableName ), UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableColumnNames( xSuppTableColumns->getColumns(), UNO_QUERY_THROW );
+ if ( !xTableColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
+ }
+
+ if ( invalidColumn )
+ {
+ // reset the complete order statement at both the row set and the parser
+ const ::rtl::OUString sEmptyOrder;
+ xRowSetProps->setPropertyValue( PROPERTY_ORDER, makeAny( sEmptyOrder ) );
+ xComposer->setOrder( sEmptyOrder );
+ }
+
+ // .............................................................................................................
+ // check if the columns participating in the filter refer to existing tables
+ // TODO: there's no API at all for this. The method which comes nearest to what we need is
+ // "getStructuredFilter", but it returns pure column names only. That is, for a statement like
+ // "SELECT * FROM <table> WHERE <other_table>.<column> = <value>", it will return "<column>". But
+ // there's no API at all to retrieve the information about "<other_table>" - which is what would
+ // be needed here.
+ // That'd be a chance to replace getStructuredFilter with something more reasonable. This method
+ // has at least one other problem: For a clause like "<column> != <value>", it will return "<column>"
+ // as column name, "NOT_EQUAL" as operator, and "!= <value>" as value, effectively duplicating the
+ // information about the operator, and beding all clients to manually remove the "!=" from the value
+ // string.
+ // So, what really would be handy, is some
+ // XNormalizedFilter getNormalizedFilter();
+ // with
+ // interface XDisjunctiveFilterExpression
+ // {
+ // XConjunctiveFilterTerm getTerm( int index );
+ // }
+ // interface XConjunctiveFilterTerm
+ // {
+ // ComparisonPredicate getPredicate( int index );
+ // }
+ // struct ComparisonPredicate
+ // {
+ // XComparisonOperand Lhs;
+ // SQLFilterOperator Operator;
+ // XComparisonOperand Rhs;
+ // }
+ // interface XComparisonOperand
+ // {
+ // SQLFilterOperand Type;
+ // XPropertySet getColumn();
+ // string getLiteral();
+ // ...
+ // }
+ // enum SQLFilterOperand { Column, Literal, ... }
+ //
+ // ... or something like this ....
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_formProperties )
{
if(!m_pCurrentlyDisplayed)
return sal_True;
@@ -428,50 +567,46 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star:
// this method set all format settings from the orignal table or query
try
{
- // we send all properties at once, maybe the implementation is clever enough to handle one big PropertiesChanged
- // more effective than many small PropertyChanged ;)
- Sequence< ::rtl::OUString> aProperties(3);
- Sequence< Any> aValues(3);
-
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
- OSL_ENSURE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
- OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
+ ENSURE_OR_RETURN_FALSE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
+ ENSURE_OR_RETURN_FALSE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
+
+ Reference< XPropertySetInfo > xPSI( pData->xObjectProperties->getPropertySetInfo(), UNO_SET_THROW );
+
+ ::comphelper::NamedValueCollection aPropertyValues;
- if ( pData->xObjectProperties.is() )
+ const ::rtl::OUString aTransferProperties[] =
{
- sal_Int32 nPos = 0;
- // is the filter intially applied ?
- aProperties.getArray()[nPos] = PROPERTY_APPLYFILTER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_APPLYFILTER);
+ PROPERTY_APPLYFILTER,
+ PROPERTY_FILTER,
+ PROPERTY_HAVING_CLAUSE,
+ PROPERTY_ORDER
+ };
+ for ( size_t i=0; i < sizeof( aTransferProperties ) / sizeof( aTransferProperties[0] ); ++i )
+ {
+ if ( !xPSI->hasPropertyByName( aTransferProperties[i] ) )
+ continue;
+ aPropertyValues.put( aTransferProperties[i], pData->xObjectProperties->getPropertyValue( aTransferProperties[i] ) );
+ }
- // the initial filter
- aProperties.getArray()[nPos] = PROPERTY_FILTER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_FILTER);
+ const ::std::vector< ::rtl::OUString > aNames( aPropertyValues.getNames() );
+ Sequence< ::rtl::OUString > aPropNames( aNames.size() );
+ ::std::copy( aNames.begin(), aNames.end(), aPropNames.getArray() );
- if ( pData->xObjectProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_HAVING_CLAUSE) )
- {
- aProperties.realloc(aProperties.getLength()+1);
- aValues.realloc(aValues.getLength()+1);
- // the initial having clause
- aProperties.getArray()[nPos] = PROPERTY_HAVING_CLAUSE;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_HAVING_CLAUSE);
- }
+ Sequence< Any > aPropValues( aNames.size() );
+ ::std::transform( aNames.begin(), aNames.end(), aPropValues.getArray(), SelectValueByName( aPropertyValues ) );
- // the initial ordering
- aProperties.getArray()[nPos] = PROPERTY_ORDER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_ORDER);
+ Reference< XMultiPropertySet > xFormMultiSet( i_formProperties, UNO_QUERY_THROW );
+ xFormMultiSet->setPropertyValues( aPropNames, aPropValues );
- Reference< XMultiPropertySet > xFormMultiSet(_rxForm, UNO_QUERY);
- xFormMultiSet->setPropertyValues(aProperties, aValues);
- }
+ impl_sanitizeRowSetClauses_nothrow();
}
- catch(Exception&)
+ catch ( const Exception& )
{
- DBG_ERROR("SbaTableQueryBrowser::InitializeForm : something went wrong !");
+ DBG_UNHANDLED_EXCEPTION();
return sal_False;
}
-
return sal_True;
}
@@ -601,6 +736,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
::std::vector< NamedValue > aInitialValues;
::std::vector< ::rtl::OUString > aCopyProperties;
+ Any aDefault;
switch(nType)
{
@@ -617,6 +753,8 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TriState" ) ),
makeAny( sal_Bool( ColumnValue::NO_NULLS != nNullable ) )
) );
+ if ( ColumnValue::NO_NULLS == nNullable )
+ aDefault <<= (sal_Int16)STATE_NOCHECK;
}
break;
@@ -658,18 +796,17 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW );
// calculate the default
- Any aDefault;
if ( xGridColPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) )
- aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT );
-
- // default value
- if ( nType == DataType::BIT || nType == DataType::BOOLEAN )
{
- if ( aDefault.hasValue() )
- aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK;
- else
- aDefault <<= ((sal_Int16)STATE_DONTKNOW);
-
+ aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT );
+ // default value
+ if ( nType == DataType::BIT || nType == DataType::BOOLEAN )
+ {
+ if ( aDefault.hasValue() )
+ aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK;
+ else
+ aDefault <<= ((sal_Int16)STATE_DONTKNOW);
+ }
}
if ( aDefault.hasValue() )
@@ -2293,77 +2430,82 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r
sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand,
const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection)
{
- Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY);
- if(xProp.is())
+ try
{
- Reference< ::com::sun::star::form::XLoadable > xLoadable(xProp,UNO_QUERY);
- try
+ Reference<XPropertySet> xProp( getRowSet(), UNO_QUERY_THROW );
+ Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW );
+ // the values allowing the RowSet to re-execute
+ xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName));
+ if(_rxConnection.is())
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) );
+
+ // set this _before_ setting the connection, else the rowset would rebuild it ...
+ xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType));
+ xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand));
+ xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing));
+ if ( m_bPreview )
{
- // the values allowing the RowSet to re-execute
- xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName));
- if(_rxConnection.is())
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) );
-
- // set this _before_ setting the connection, else the rowset would rebuild it ...
- xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType));
- xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand));
- xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing));
- if ( m_bPreview )
- {
- xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
- }
+ xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
+ }
- // the formatter depends on the data source we're working on, so rebuild it here ...
- initFormatter();
+ // the formatter depends on the data source we're working on, so rebuild it here ...
+ initFormatter();
- // switch the grid to design mode while loading
- getBrowserView()->getGridControl()->setDesignMode(sal_True);
- InitializeForm(getRowSet());
+ // switch the grid to design mode while loading
+ getBrowserView()->getGridControl()->setDesignMode(sal_True);
+ InitializeForm( xProp );
- sal_Bool bSuccess = sal_True;
+ sal_Bool bSuccess = sal_True;
+ {
{
- {
- Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY);
- // first we have to clear the grid
- clearGridColumns(xColContainer);
- }
- FormErrorHelper aHelper(this);
- // load the form
- bSuccess = reloadForm(xLoadable);
-
- // initialize the model
- InitializeGridModel(getFormComponent());
-
- if ( m_bPreview )
- initializePreviewMode();
-
- LoadFinished(sal_True);
+ Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY);
+ // first we have to clear the grid
+ clearGridColumns(xColContainer);
}
+ FormErrorHelper aHelper(this);
+ // load the form
+ bSuccess = reloadForm(xLoadable);
- InvalidateAll();
- return bSuccess;
- }
- catch( const SQLException& e )
- {
- Any aException( ::cppu::getCaughtException() );
- showError( SQLExceptionInfo( aException ) );
- }
- catch( const WrappedTargetException& e )
- {
- SQLException aSql;
- if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
- showError( SQLExceptionInfo( e.TargetException ) );
- else
+ // initialize the model
+ InitializeGridModel(getFormComponent());
+
+ Any aVal = xProp->getPropertyValue(PROPERTY_ISNEW);
+ if (aVal.hasValue() && ::comphelper::getBOOL(aVal))
{
- DBG_UNHANDLED_EXCEPTION();
+ // then set the default values and the parameters given from the parent
+ Reference< XReset> xReset(xProp, UNO_QUERY);
+ xReset->reset();
}
+
+ if ( m_bPreview )
+ initializePreviewMode();
+
+ LoadFinished(sal_True);
}
- catch(Exception&)
+
+ InvalidateAll();
+ return bSuccess;
+ }
+ catch( const SQLException& e )
+ {
+ Any aException( ::cppu::getCaughtException() );
+ showError( SQLExceptionInfo( aException ) );
+ }
+ catch( const WrappedTargetException& e )
+ {
+ SQLException aSql;
+ if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
+ showError( SQLExceptionInfo( e.TargetException ) );
+ else
{
DBG_UNHANDLED_EXCEPTION();
}
}
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
InvalidateAll();
return sal_False;
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 89cdc855a0cd..69ed6bcd84f0 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -126,11 +126,11 @@ IMPL_LINK(OSqlEdit, OnUndoActionTimer, void*, EMPTYARG)
if(aText != m_strOrigText)
{
OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- SfxUndoManager* pUndoMgr = rController.getUndoMgr();
+ SfxUndoManager& rUndoMgr = rController.GetUndoManager();
OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( this );
pUndoAct->SetOriginalText( m_strOrigText );
- pUndoMgr->AddUndoAction( pUndoAct );
+ rUndoMgr.AddUndoAction( pUndoAct );
rController.InvalidateFeature(SID_UNDO);
rController.InvalidateFeature(SID_REDO);
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index a2e82e50757d..1516c735f009 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -97,9 +97,12 @@ namespace dbaui
,m_pPrimaryKeySupport(NULL)
,m_pBooleanComparisonModeLabel( NULL )
,m_pBooleanComparisonMode( NULL )
+ ,m_pMaxRowScanLabel( NULL )
+ ,m_pMaxRowScan( NULL )
,m_aControlDependencies()
,m_aBooleanSettings()
,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
+ ,m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) )
{
impl_initBooleanSettings();
@@ -164,6 +167,21 @@ namespace dbaui
m_pBooleanComparisonModeLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) );
m_pBooleanComparisonMode->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) );
}
+ // create the controls for the max row scan
+ if ( m_bHasMaxRowScan )
+ {
+ m_pMaxRowScanLabel = new FixedText( this, ModuleRes( FT_MAXROWSCAN ) );
+ m_pMaxRowScan = new NumericField( this, ModuleRes( NF_MAXROWSCAN ) );
+ m_pMaxRowScan->SetModifyHdl(getControlModifiedLink());
+ m_pMaxRowScan->SetUseThousandSep(sal_False);
+
+ Point aLabelPos( m_pMaxRowScanLabel->GetPosPixel() );
+ Point aControlPos( m_pMaxRowScan->GetPosPixel() );
+ long nMoveUp = aControlPos.Y() - aPos.Y();
+
+ m_pMaxRowScanLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) );
+ m_pMaxRowScan->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) );
+ }
FreeResource();
}
@@ -190,6 +208,8 @@ namespace dbaui
DELETEZ( m_pPrimaryKeySupport );
DELETEZ( m_pBooleanComparisonModeLabel );
DELETEZ( m_pBooleanComparisonMode );
+ DELETEZ( m_pMaxRowScanLabel );
+ DELETEZ( m_pMaxRowScan );
}
// -----------------------------------------------------------------------
@@ -230,6 +250,10 @@ namespace dbaui
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) );
}
+ if ( m_bHasMaxRowScan )
+ {
+ _rControlList.push_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) );
+ }
}
// -----------------------------------------------------------------------
@@ -248,6 +272,8 @@ namespace dbaui
if ( m_bHasBooleanComparisonMode )
_rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) );
+ if ( m_bHasMaxRowScan )
+ _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan));
}
// -----------------------------------------------------------------------
@@ -306,6 +332,12 @@ namespace dbaui
m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) );
}
+ if ( m_bHasMaxRowScan )
+ {
+ SFX_ITEMSET_GET(_rSet, pMaxRowScan, SfxInt32Item, DSID_MAX_ROW_SCAN, sal_True);
+ m_pMaxRowScan->SetValue(pMaxRowScan->GetValue());
+ }
+
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
}
@@ -334,6 +366,10 @@ namespace dbaui
bChangedSomething = sal_True;
}
}
+ if ( m_bHasMaxRowScan )
+ {
+ fillInt32(_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething);
+ }
return bChangedSomething;
}
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc
index 8abc5d8810d2..193fdf5f3853 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hrc
+++ b/dbaccess/source/ui/dlg/advancedsettings.hrc
@@ -69,7 +69,9 @@
#define FT_AUTOINCREMENTVALUE 1
#define FT_RETRIEVE_AUTO 2
#define FT_BOOLEANCOMPARISON 3
+#define FT_MAXROWSCAN 4
#define LB_BOOLEANCOMPARISON 1
+#define NF_MAXROWSCAN 1
#endif // DBAUI_ADVANCEDSETTINGS_HRC
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 7e58f260f4e6..07620496b11f 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -37,6 +37,7 @@
#include <svtools/dialogcontrolling.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
#include <vector>
@@ -76,12 +77,16 @@ namespace dbaui
FixedText* m_pBooleanComparisonModeLabel;
ListBox* m_pBooleanComparisonMode;
+ FixedText* m_pMaxRowScanLabel;
+ NumericField* m_pMaxRowScan;
+
::svt::ControlDependencyManager
m_aControlDependencies;
BooleanSettingDescs m_aBooleanSettings;
bool m_bHasBooleanComparisonMode;
+ bool m_bHasMaxRowScan;
public:
virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs );
diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src
index 7a94c0dafb4c..9a2dc467d586 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.src
+++ b/dbaccess/source/ui/dlg/advancedsettings.src
@@ -249,6 +249,24 @@
WORKAROUND \
}; \
+#define AUTO_MAXROWSCAN(AUTO_Y) \
+ FixedText FT_MAXROWSCAN \
+ { \
+ Pos = MAP_APPFONT ( START_X , AUTO_Y + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) ; \
+ Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ); \
+ Text [ en-US ] = "Rows to scan column types"; \
+ }; \
+ NumericField NF_MAXROWSCAN \
+ { \
+ Pos = MAP_APPFONT ( START_X + 100, AUTO_Y ) ; \
+ Size = MAP_APPFONT ( 60 , EDIT_HEIGHT ) ; \
+ TabStop = TRUE ; \
+ NoThousandSep = TRUE; \
+ Border = TRUE; \
+ HelpId = HID_DSADMIN_MAXROWSCAN; \
+ }; \
+
+
//-------------------------------------------------------------------------
TabPage PAGE_GENERATED_VALUES
@@ -334,6 +352,7 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL
AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS )
AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS )
AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
+ AUTO_MAXROWSCAN( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
};
//-------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 1d5bb1cb167c..1c1b945854ed 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -410,6 +410,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
*pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True);
*pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String());
*pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
+ *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100);
// create the pool
static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
@@ -472,6 +473,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
{0,0},
{0,0},
{0,0},
+ {0,0},
{0,0}
};
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index 41ee2458fa2f..8ff5fe99b727 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -27,26 +27,14 @@
#ifndef DBAUI_JOINCONTROLLER_HXX
#define DBAUI_JOINCONTROLLER_HXX
-#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
#include "singledoccontroller.hxx"
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef DBAUI_JOINTABLEVIEW_HXX
#include "JoinTableView.hxx"
-#endif
-#ifndef DBAUI_JOINDESIGNVIEW_HXX
#include "JoinDesignView.hxx"
-#endif
#include "TableConnectionData.hxx"
#include "TableWindowData.hxx"
-#ifndef _MEMORY_
#include <memory>
-#endif
#include <boost/shared_ptr.hpp>
namespace comphelper
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index 3651c5632504..a1f1b8158c65 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -27,36 +27,16 @@
#ifndef DBUI_TABLECONTROLLER_HXX
#define DBUI_TABLECONTROLLER_HXX
-#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
#include "singledoccontroller.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectOutputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
-#endif
-#ifndef DBAUI_TYPEINFO_HXX
#include "TypeInfo.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
class FixedText;
namespace dbaui
@@ -129,9 +109,6 @@ namespace dbaui
virtual void impl_onModifyChanged();
- // const ::connectivity::OSQLParseNode* getParseTree() const { return m_aSqlIterator.getParseTree();}
- // need for undo's and redo's
- SfxUndoManager* getUndoMgr();
inline ::std::vector< ::boost::shared_ptr<OTableRow> >* getRows() { return &m_vRowList; }
/// returns the postion of the the first empty row
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index 962bc75bb7f9..23bae743b15a 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -254,7 +254,8 @@ namespace dbaui
// (probably this needs not to be overloaded, but you may return anything you want as long as it
// supports the ::com::sun::star::form::DatabaseForm service. For instance you may want to create an adapter here which
// is synchronized with a foreign ::com::sun::star::form::DatabaseForm you got elsewhere)
- virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm) = 0;
+ virtual sal_Bool InitializeForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties ) = 0;
// called immediately after a successfull CreateForm
// do any initialization (data source etc.) here. the form should be fully functional after that.
// return sal_False if you didn't succeed (don't throw exceptions, they won't be caught)
@@ -325,8 +326,11 @@ namespace dbaui
/// loads or reloads the form
virtual sal_Bool reloadForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable);
- virtual sal_Bool preReloadForm(){ return sal_False; }
- virtual void postReloadForm(){}
+ virtual sal_Bool preReloadForm(){ return sal_False; }
+ virtual void postReloadForm(){}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
+ createParser_nothrow();
private:
void setCurrentModified( sal_Bool _bSet );
@@ -346,7 +350,6 @@ namespace dbaui
void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel);
void impl_checkForCannotSelectUnfiltered( const ::dbtools::SQLExceptionInfo& _rError );
- ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > createParser_nothrow();
// time to check the CUT/COPY/PASTE-slot-states
DECL_LINK( OnInvalidateClipboard, AutoTimer* );
diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index cb08be7812d5..6b87bee2a61a 100644
--- a/dbaccess/source/ui/inc/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -92,6 +92,7 @@ typedef sal_Int32 ItemID;
#define DSID_ESCAPE_DATETIME 57
#define DSID_NAMED_PIPE 58
#define DSID_PRIMARY_KEY_SUPPORT 59
+#define DSID_MAX_ROW_SCAN 60
// don't forget to adjust DSID_LAST_ITEM_ID below!
@@ -99,7 +100,7 @@ typedef sal_Int32 ItemID;
//= item range. Adjust this if you introduce new items above
#define DSID_FIRST_ITEM_ID DSID_NAME
-#define DSID_LAST_ITEM_ID DSID_PRIMARY_KEY_SUPPORT
+#define DSID_LAST_ITEM_ID DSID_MAX_ROW_SCAN
#endif // _DBAUI_DATASOURCEITEMS_HXX_
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 551ba4fe40b7..87a93244cd3f 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -132,6 +132,7 @@ namespace dbaui
|| has( DSID_IGNORECURRENCY )
|| has( DSID_ESCAPE_DATETIME )
|| has( DSID_PRIMARY_KEY_SUPPORT )
+ || has( DSID_MAX_ROW_SCAN )
;
}
diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx
index d58cf65f6959..5fbdfed65953 100644
--- a/dbaccess/source/ui/inc/exsrcbrw.hxx
+++ b/dbaccess/source/ui/inc/exsrcbrw.hxx
@@ -96,7 +96,7 @@ namespace dbaui
~SbaExternalSourceBrowser();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > CreateForm();
- virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm);
+ virtual sal_Bool InitializeForm( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties );
virtual sal_Bool LoadForm();
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
new file mode 100755
index 000000000000..c738bd94e81c
--- /dev/null
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
+#define DBAUI_SINGLEDOCCONTROLLER_HXX
+
+#include "dbsubcomponentcontroller.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+
+class SfxUndoAction;
+class SfxUndoManager;
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= OSingleDocumentController
+ //==================================================================================================================
+ struct OSingleDocumentController_Data;
+ typedef ::cppu::ImplInheritanceHelper1 < DBSubComponentController
+ , ::com::sun::star::document::XUndoManagerSupplier
+ > OSingleDocumentController_Base;
+ class OSingleDocumentController : public OSingleDocumentController_Base
+ {
+ protected:
+ OSingleDocumentController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB );
+ virtual ~OSingleDocumentController();
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ public:
+ /// need for undo's and redo's
+ SfxUndoManager& GetUndoManager() const;
+
+ /// complete clears the Undo/Redo stacks
+ void ClearUndoManager();
+
+ /** addUndoActionAndInvalidate adds an undo action to the undoManager,
+ additionally invalidates the UNDO and REDO slot
+ @param pAction the undo action to add
+ */
+ void addUndoActionAndInvalidate( SfxUndoAction* pAction );
+
+ // OGenericUnoController
+ virtual FeatureState GetState( sal_uInt16 nId ) const;
+ virtual void Execute( sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs );
+
+ // XUndoManagerSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL getUndoManager( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+
+ private:
+ ::std::auto_ptr< OSingleDocumentController_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
+
+#endif // DBAUI_SINGLEDOCCONTROLLER_HXX
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 0448cef602e6..67e74bb862f7 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -265,7 +265,7 @@ namespace dbaui
protected:
// SbaXDataBrowserController overridables
- virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm);
+ virtual sal_Bool InitializeForm( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties );
virtual sal_Bool InitializeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid);
virtual sal_Bool preReloadForm();
@@ -531,6 +531,10 @@ namespace dbaui
of the load process
*/
void initializePreviewMode();
+
+ /** checks whether the Order/Filter clauses set at our row set are valid, removes them if not so
+ */
+ void impl_sanitizeRowSetClauses_nothrow();
};
// .........................................................................
diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx b/dbaccess/source/ui/misc/dbaundomanager.cxx
new file mode 100755
index 000000000000..1e60a027a693
--- /dev/null
+++ b/dbaccess/source/ui/misc/dbaundomanager.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "dbaundomanager.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <svl/undo.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <framework/undomanagerhelper.hxx>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::document::UndoContextNotClosedException;
+ using ::com::sun::star::document::UndoFailedException;
+ using ::com::sun::star::document::EmptyUndoStackException;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::document::XUndoAction;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::document::XUndoManagerListener;
+ using ::com::sun::star::util::NotLockedException;
+ using ::com::sun::star::lang::NoSupportException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= UndoManager_Impl
+ //==================================================================================================================
+ struct UndoManager_Impl : public ::framework::IUndoManagerImplementation
+ {
+ UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :rAntiImpl( i_antiImpl )
+ ,rParent( i_parent )
+ ,rMutex( i_mutex )
+ ,bDisposed( false )
+ ,aUndoManager()
+ ,aUndoHelper( *this )
+ {
+ }
+
+ virtual ~UndoManager_Impl()
+ {
+ }
+
+ UndoManager& rAntiImpl;
+ ::cppu::OWeakObject& rParent;
+ ::osl::Mutex& rMutex;
+ bool bDisposed;
+ SfxUndoManager aUndoManager;
+ ::framework::UndoManagerHelper aUndoHelper;
+
+ // IUndoManagerImplementation
+ virtual ::svl::IUndoManager& getImplUndoManager();
+ virtual Reference< XUndoManager > getThis();
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::svl::IUndoManager& UndoManager_Impl::getImplUndoManager()
+ {
+ return aUndoManager;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XUndoManager > UndoManager_Impl::getThis()
+ {
+ return static_cast< XUndoManager* >( &rAntiImpl );
+ }
+
+ //==============================================================================================================
+ //= OslMutexFacade
+ //==============================================================================================================
+ class OslMutexFacade : public ::framework::IMutex
+ {
+ public:
+ OslMutexFacade( ::osl::Mutex& i_mutex )
+ :m_rMutex( i_mutex )
+ {
+ }
+
+ virtual void acquire();
+ virtual void release();
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ void OslMutexFacade::acquire()
+ {
+ m_rMutex.acquire();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void OslMutexFacade::release()
+ {
+ m_rMutex.release();
+ }
+
+ //==============================================================================================================
+ //= UndoManagerMethodGuard
+ //==============================================================================================================
+ /** guard for public UNO methods of the UndoManager
+ */
+ class UndoManagerMethodGuard : public ::framework::IMutexGuard
+ {
+ public:
+ UndoManagerMethodGuard( UndoManager_Impl& i_impl )
+ :m_aGuard( i_impl.rMutex )
+ ,m_aMutexFacade( i_impl.rMutex )
+ {
+ // throw if the instance is already disposed
+ if ( i_impl.bDisposed )
+ throw DisposedException( ::rtl::OUString(), i_impl.getThis() );
+ }
+ virtual ~UndoManagerMethodGuard()
+ {
+ }
+
+ // IMutexGuard
+ virtual ::framework::IMutex& getGuardedMutex();
+
+ // IGuard
+ virtual void clear();
+ virtual void reset();
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ OslMutexFacade m_aMutexFacade;
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex()
+ {
+ return m_aMutexFacade;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::clear()
+ {
+ m_aGuard.clear();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::reset()
+ {
+ m_aGuard.reset();
+ }
+
+ //==================================================================================================================
+ //= UndoManager
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_pImpl( new UndoManager_Impl( *this, i_parent, i_mutex ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::~UndoManager()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SfxUndoManager& UndoManager::GetSfxUndoManager() const
+ {
+ return m_pImpl->aUndoManager;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::acquire( ) throw ()
+ {
+ m_pImpl->rParent.acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::release( ) throw ()
+ {
+ m_pImpl->rParent.release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UndoManager::disposing()
+ {
+ {
+ ::osl::MutexGuard aGuard( m_pImpl->rMutex );
+ m_pImpl->bDisposed = true;
+ }
+ m_pImpl->aUndoHelper.disposing();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.enterUndoContext( i_title, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterHiddenUndoContext( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.enterHiddenUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::leaveUndoContext( ) throw (InvalidStateException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.leaveUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (IllegalArgumentException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.addUndoAction( i_action, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::undo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // (all our UndoActions work directly on VCL code, usually, so ...)
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.undo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::redo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // (all our UndoActions work directly on VCL code, usually, so ...)
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.redo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isUndoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isUndoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isRedoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isRedoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentUndoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getCurrentUndoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentRedoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getCurrentRedoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllUndoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getAllUndoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllRedoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getAllRedoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clear( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.clear( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clearRedo( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.clearRedo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::reset( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.reset( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.addUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.removeUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::lock( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.lock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::unlock( ) throw (NotLockedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.unlock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isLocked( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isLocked();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL UndoManager::getParent( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return *&m_pImpl->rParent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
+ {
+ (void)i_parent;
+ throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
+ }
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
new file mode 100644
index 000000000000..eb1b34710ff8
--- /dev/null
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -0,0 +1,672 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+
+#include "browserids.hxx"
+#include "commontypes.hxx"
+#include "dataview.hxx"
+#include "dbu_misc.hrc"
+#include "dbustrings.hrc"
+#include "moduledbu.hxx"
+#include "dbsubcomponentcontroller.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::sdbc::XDataSource;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::frame::XFrame;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::sdb::XOfficeDatabaseDocument;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::sdbc::XDatabaseMetaData;
+ using ::com::sun::star::sdb::XDocumentDataSource;
+ using ::com::sun::star::document::XEmbeddedScripts;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::frame::XUntitledNumbers;
+ using ::com::sun::star::beans::PropertyVetoException;
+ /** === end UNO using === **/
+
+ class DataSourceHolder
+ {
+ public:
+ DataSourceHolder()
+ {
+ }
+
+ DataSourceHolder( const Reference< XDataSource >& _rxDataSource )
+ {
+ m_xDataSource = _rxDataSource;
+ Reference< XDocumentDataSource > xDocDS( m_xDataSource, UNO_QUERY );
+ if ( xDocDS.is() )
+ m_xDocument = xDocDS->getDatabaseDocument();
+
+ m_xDataSourceProps.set( m_xDataSource, UNO_QUERY );
+ }
+
+ const Reference< XDataSource >& getDataSource() const { return m_xDataSource; }
+ const Reference< XPropertySet >& getDataSourceProps() const { return m_xDataSourceProps; }
+ const Reference< XOfficeDatabaseDocument > getDatabaseDocument() const { return m_xDocument; }
+
+ bool is() const { return m_xDataSource.is(); }
+
+ void clear()
+ {
+ m_xDataSource.clear();
+ m_xDocument.clear();
+ }
+
+ private:
+ Reference< XDataSource > m_xDataSource;
+ Reference< XPropertySet > m_xDataSourceProps;
+ Reference< XOfficeDatabaseDocument > m_xDocument;
+ };
+
+ struct DBSubComponentController_Impl
+ {
+ private:
+ ::boost::optional< bool > m_aDocScriptSupport;
+
+ public:
+ OModuleClient m_aModuleClient;
+ ::dbtools::SQLExceptionInfo m_aCurrentError;
+
+ ::cppu::OInterfaceContainerHelper
+ m_aModifyListeners;
+
+ // <properties>
+ SharedConnection m_xConnection;
+ ::dbtools::DatabaseMetaData m_aSdbMetaData;
+ // </properties>
+ ::rtl::OUString m_sDataSourceName; // the data source we're working for
+ DataSourceHolder m_aDataSource;
+ Reference< XModel > m_xDocument;
+ Reference< XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
+ sal_Int32 m_nDocStartNumber;
+ sal_Bool m_bSuspended; // is true when the controller was already suspended
+ sal_Bool m_bEditable; // is the control readonly or not
+ sal_Bool m_bModified; // is the data modified
+ bool m_bNotAttached;
+
+ DBSubComponentController_Impl( ::osl::Mutex& i_rMutex )
+ :m_aDocScriptSupport()
+ ,m_aModifyListeners( i_rMutex )
+ ,m_nDocStartNumber(0)
+ ,m_bSuspended( sal_False )
+ ,m_bEditable(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bNotAttached(true)
+ {
+ }
+
+ bool documentHasScriptSupport() const
+ {
+ OSL_PRECOND( !!m_aDocScriptSupport,
+ "DBSubComponentController_Impl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
+ return !!m_aDocScriptSupport && *m_aDocScriptSupport;
+ }
+
+ void setDocumentScriptSupport( const bool _bSupport )
+ {
+ OSL_PRECOND( !m_aDocScriptSupport,
+ "DBSubComponentController_Impl::setDocumentScriptSupport: already initialized!" );
+ m_aDocScriptSupport = ::boost::optional< bool >( _bSupport );
+ }
+ };
+
+ //====================================================================
+ //= DBSubComponentController
+ //====================================================================
+ //--------------------------------------------------------------------
+ DBSubComponentController::DBSubComponentController(const Reference< XMultiServiceFactory >& _rxORB)
+ :DBSubComponentController_Base( _rxORB )
+ ,m_pImpl( new DBSubComponentController_Impl( getMutex() ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DBSubComponentController::~DBSubComponentController()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::impl_initialize()
+ {
+ OGenericUnoController::impl_initialize();
+
+ const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+
+ Reference< XConnection > xConnection;
+ xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, xConnection );
+
+ if ( !xConnection.is() )
+ ::dbtools::isEmbeddedInDatabase( getModel(), xConnection );
+
+ if ( xConnection.is() )
+ initializeConnection( xConnection );
+
+ bool bShowError = true;
+ if ( !isConnected() )
+ {
+ reconnect( sal_False );
+ bShowError = false;
+ }
+ if ( !isConnected() )
+ {
+ if ( bShowError )
+ connectionLostMessage();
+ throw IllegalArgumentException();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL DBSubComponentController::queryInterface(const Type& _rType) throw (RuntimeException)
+ {
+ if ( _rType.equals( XScriptInvocationContext::static_type() ) )
+ {
+ if ( m_pImpl->documentHasScriptSupport() )
+ return makeAny( Reference< XScriptInvocationContext >( this ) );
+ return Any();
+ }
+
+ return DBSubComponentController_Base::queryInterface( _rType );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Type > SAL_CALL DBSubComponentController::getTypes( ) throw (RuntimeException)
+ {
+ Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
+ if ( !m_pImpl->documentHasScriptSupport() )
+ {
+ Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 );
+ ::std::remove_copy_if(
+ aTypes.getConstArray(),
+ aTypes.getConstArray() + aTypes.getLength(),
+ aStrippedTypes.getArray(),
+ ::std::bind2nd( ::std::equal_to< Type >(), XScriptInvocationContext::static_type() )
+ );
+ aTypes = aStrippedTypes;
+ }
+ return aTypes;
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::initializeConnection( const Reference< XConnection >& _rxForeignConn )
+ {
+ DBG_ASSERT( !isConnected(), "DBSubComponentController::initializeConnection: not to be called when already connected!" );
+ // usually this gets called from within initialize of derived classes ...
+ if ( isConnected() )
+ disconnect();
+
+ m_pImpl->m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership );
+ m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
+ startConnectionListening( m_pImpl->m_xConnection );
+
+ // get the data source the connection belongs to
+ try
+ {
+ // determine our data source
+ OSL_PRECOND( !m_pImpl->m_aDataSource.is(), "DBSubComponentController::initializeConnection: already a data source in this phase?" );
+ {
+ Reference< XChild > xConnAsChild( m_pImpl->m_xConnection, UNO_QUERY );
+ Reference< XDataSource > xDS;
+ if ( xConnAsChild.is() )
+ xDS = Reference< XDataSource >( xConnAsChild->getParent(), UNO_QUERY );
+
+ // (take the indirection through XDataSource to ensure we have a correct object ....)
+ m_pImpl->m_aDataSource = xDS;
+ }
+ OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "DBSubComponentController::initializeConnection: unable to obtain the data source object!" );
+
+ if ( m_pImpl->m_bNotAttached )
+ {
+ Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY );
+ m_pImpl->m_nDocStartNumber = 1;
+ if ( xUntitledProvider.is() )
+ m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
+ }
+
+ // determine the availability of script support in our document. Our own XScriptInvocationContext
+ // interface depends on this
+ m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() );
+
+ // get a number formatter
+ Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps(), UNO_SET_THROW );
+ xDataSourceProps->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->m_sDataSourceName;
+ DBG_ASSERT( m_pImpl->m_sDataSourceName.getLength(), "DBSubComponentController::initializeConnection: invalid data source name!" );
+ Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
+ if(xSupplier.is())
+ {
+ m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
+ ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")), UNO_QUERY);
+ m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+ }
+ OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::reconnect( sal_Bool _bUI )
+ {
+ OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!");
+
+ stopConnectionListening( m_pImpl->m_xConnection );
+ m_pImpl->m_aSdbMetaData.reset( NULL );
+ m_pImpl->m_xConnection.clear();
+
+ // reconnect
+ sal_Bool bReConnect = sal_True;
+ if ( _bUI )
+ {
+ QueryBox aQuery( getView(), ModuleRes(QUERY_CONNECTION_LOST) );
+ bReConnect = ( RET_YES == aQuery.Execute() );
+ }
+
+ // now really reconnect ...
+ if ( bReConnect )
+ {
+ m_pImpl->m_xConnection.reset( connect( m_pImpl->m_aDataSource.getDataSource(), NULL ), SharedConnection::TakeOwnership );
+ m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
+ }
+
+ // invalidate all slots
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::disconnect()
+ {
+ stopConnectionListening(m_pImpl->m_xConnection);
+ m_pImpl->m_aSdbMetaData.reset( NULL );
+ m_pImpl->m_xConnection.clear();
+
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::losingConnection()
+ {
+ // our connection was disposed so we need a new one
+ reconnect( sal_True );
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::disposing()
+ {
+ DBSubComponentController_Base::disposing();
+
+ disconnect();
+
+ attachFrame( Reference < XFrame >() );
+
+ m_pImpl->m_aDataSource.clear();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::disposing(const EventObject& _rSource) throw( RuntimeException )
+ {
+ if ( _rSource.Source == getConnection() )
+ {
+ if ( !m_pImpl->m_bSuspended // when already suspended then we don't have to reconnect
+ && !getBroadcastHelper().bInDispose
+ && !getBroadcastHelper().bDisposed
+ && isConnected()
+ )
+ {
+ losingConnection();
+ }
+ else
+ {
+ m_pImpl->m_xConnection.reset( m_pImpl->m_xConnection, SharedConnection::NoTakeOwnership );
+ // this prevents the "disposeComponent" call in disconnect
+ disconnect();
+ }
+ }
+ else
+ DBSubComponentController_Base::disposing( _rSource );
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::appendError( const ::rtl::OUString& _rErrorMessage, const ::dbtools::StandardSQLState _eSQLState,
+ const sal_Int32 _nErrorCode )
+ {
+ m_pImpl->m_aCurrentError.append( ::dbtools::SQLExceptionInfo::SQL_EXCEPTION, _rErrorMessage, getStandardSQLStateAscii( _eSQLState ),
+ _nErrorCode );
+ }
+ //--------------------------------------------------------------------
+ void DBSubComponentController::clearError()
+ {
+ m_pImpl->m_aCurrentError = ::dbtools::SQLExceptionInfo();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DBSubComponentController::hasError() const
+ {
+ return m_pImpl->m_aCurrentError.isValid();
+ }
+
+ //--------------------------------------------------------------------
+ const ::dbtools::SQLExceptionInfo& DBSubComponentController::getError() const
+ {
+ return m_pImpl->m_aCurrentError;
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::displayError()
+ {
+ showError( m_pImpl->m_aCurrentError );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool SAL_CALL DBSubComponentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
+ {
+ m_pImpl->m_bSuspended = bSuspend;
+ if ( !bSuspend && !isConnected() )
+ reconnect(sal_True);
+
+
+ return sal_True;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL DBSubComponentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException )
+ {
+ if ( !_rxModel.is() )
+ return sal_False;
+ if ( !DBSubComponentController_Base::attachModel( _rxModel ) )
+ return sal_False;
+
+ m_pImpl->m_bNotAttached = false;
+ if ( m_pImpl->m_nDocStartNumber == 1 )
+ releaseNumberForComponent();
+
+ Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
+ m_pImpl->m_nDocStartNumber = 1;
+ if ( xUntitledProvider.is() )
+ m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
+
+ return sal_True;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs)
+ {
+ if ( _nId == ID_BROWSER_CLOSE )
+ {
+ closeTask();
+ return;
+ }
+
+ DBSubComponentController_Base::Execute( _nId, _rArgs );
+ InvalidateFeature( _nId );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString DBSubComponentController::getDataSourceName() const
+ {
+ ::rtl::OUString sName;
+ Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps() );
+ if ( xDataSourceProps.is() )
+ xDataSourceProps->getPropertyValue(PROPERTY_NAME) >>= sName;
+ return sName;
+ }
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::connectionLostMessage() const
+ {
+ String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
+ Reference< XWindow > xWindow = getTopMostContainerWindow();
+ Window* pWin = NULL;
+ if ( xWindow.is() )
+ pWin = VCLUnoHelper::GetWindow(xWindow);
+ if ( !pWin )
+ pWin = getView()->Window::GetParent();
+
+ InfoBox(pWin, aMessage).Execute();
+ }
+ // -----------------------------------------------------------------------------
+ const Reference< XConnection >& DBSubComponentController::getConnection() const
+ {
+ return m_pImpl->m_xConnection;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isReadOnly() const
+ {
+ return !m_pImpl->m_bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isEditable() const
+ {
+ return m_pImpl->m_bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::setEditable(sal_Bool _bEditable)
+ {
+ m_pImpl->m_bEditable = _bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ const ::dbtools::DatabaseMetaData& DBSubComponentController::getSdbMetaData() const
+ {
+ return m_pImpl->m_aSdbMetaData;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isConnected() const
+ {
+ return m_pImpl->m_xConnection.is();
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XDatabaseMetaData > DBSubComponentController::getMetaData( ) const
+ {
+ Reference< XDatabaseMetaData > xMeta;
+ try
+ {
+ if ( isConnected() )
+ xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xMeta;
+ }
+
+ // -----------------------------------------------------------------------------
+ const Reference< XPropertySet >& DBSubComponentController::getDataSource() const
+ {
+ return m_pImpl->m_aDataSource.getDataSourceProps();
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::haveDataSource() const
+ {
+ return m_pImpl->m_aDataSource.is();
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XModel > DBSubComponentController::getDatabaseDocument() const
+ {
+ return Reference< XModel >( m_pImpl->m_aDataSource.getDatabaseDocument(), UNO_QUERY );
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XNumberFormatter > DBSubComponentController::getNumberFormatter() const
+ {
+ return m_pImpl->m_xFormatter;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XModel > DBSubComponentController::getPrivateModel() const
+ {
+ return getDatabaseDocument();
+ }
+ // -----------------------------------------------------------------------------
+ // XTitle
+ ::rtl::OUString SAL_CALL DBSubComponentController::getTitle()
+ throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ if ( m_bExternalTitle )
+ return impl_getTitleHelper_throw()->getTitle ();
+
+ ::rtl::OUStringBuffer sTitle;
+ Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
+ if ( xTitle.is() )
+ {
+ sTitle.append( xTitle->getTitle() );
+ sTitle.appendAscii(" : ");
+ }
+ sTitle.append( getPrivateTitle() );
+ return sTitle.makeStringAndClear();
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Int32 DBSubComponentController::getCurrentStartNumber() const
+ {
+ return m_pImpl->m_nDocStartNumber;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XEmbeddedScripts > SAL_CALL DBSubComponentController::getScriptContainer() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ if ( !m_pImpl->documentHasScriptSupport() )
+ return NULL;
+
+ return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.addInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DBSubComponentController::isModified( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ return impl_isModified();
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( getMutex() );
+
+ if ( m_pImpl->m_bModified == i_bModified )
+ return;
+
+ m_pImpl->m_bModified = i_bModified;
+ impl_onModifyChanged();
+
+ EventObject aEvent( *this );
+ aGuard.clear();
+ m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::impl_isModified() const
+ {
+ return m_pImpl->m_bModified;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::impl_onModifyChanged()
+ {
+ InvalidateFeature( ID_BROWSER_SAVEDOC );
+ if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
+ InvalidateFeature( ID_BROWSER_SAVEASDOC );
+ }
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
+
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 08b5ea49f2bd..052d013f47a4 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -93,6 +93,7 @@ namespace dbaui
{ DSID_IGNORECURRENCY, "IgnoreCurrency" },
{ DSID_ESCAPE_DATETIME, "EscapeDateTime" },
{ DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
+ { DSID_MAX_ROW_SCAN, "MaxRowScan" },
{ 0, NULL }
};
return s_aMappings;
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 4d3472e623b7..553050f961e9 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -114,9 +114,6 @@
#ifndef _SB_SBUNO_HXX
#include <basic/sbuno.hxx>
#endif
-#ifndef _SFX_MACROCONF_HXX
-#include <sfx2/macrconf.hxx>
-#endif
#ifndef _EHDL_HXX
#include <svtools/ehdl.hxx>
#endif
diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk
index 7f9bbed56023..534d90e3995c 100644
--- a/dbaccess/source/ui/misc/makefile.mk
+++ b/dbaccess/source/ui/misc/makefile.mk
@@ -25,8 +25,8 @@
#
#*************************************************************************
-PRJ=..$/..$/..
-PRJINC=$(PRJ)$/source
+PRJ=../../..
+PRJINC=$(PRJ)/source
PRJNAME=dbaccess
TARGET=uimisc
@@ -35,50 +35,53 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
+.INCLUDE : $(PRJ)/util/makefile.pmk
# --- Files -------------------------------------
# ... resource files ............................
SRS1NAME=$(TARGET)
-SRC1FILES = \
- dbumiscres.src \
+SRC1FILES = \
+ dbumiscres.src \
WizardPages.src
# ... object files ............................
-SLOFILES= \
- $(SLO)$/asyncmodaldialog.obj \
- $(SLO)$/imageprovider.obj \
- $(SLO)$/singledoccontroller.obj \
- $(SLO)$/datasourceconnector.obj \
- $(SLO)$/linkeddocuments.obj \
- $(SLO)$/indexcollection.obj \
- $(SLO)$/UITools.obj \
- $(SLO)$/WCPage.obj \
- $(SLO)$/WCopyTable.obj \
- $(SLO)$/WTypeSelect.obj \
- $(SLO)$/TokenWriter.obj \
- $(SLO)$/HtmlReader.obj \
- $(SLO)$/RtfReader.obj \
- $(SLO)$/propertysetitem.obj \
- $(SLO)$/databaseobjectview.obj \
- $(SLO)$/DExport.obj \
- $(SLO)$/uiservices.obj \
- $(SLO)$/RowSetDrop.obj \
- $(SLO)$/TableCopyHelper.obj \
- $(SLO)$/moduledbu.obj \
- $(SLO)$/WColumnSelect.obj \
- $(SLO)$/WExtendPages.obj \
- $(SLO)$/WNameMatch.obj \
- $(SLO)$/ToolBoxHelper.obj \
- $(SLO)$/stringlistitem.obj \
- $(SLO)$/charsets.obj \
- $(SLO)$/defaultobjectnamecheck.obj \
- $(SLO)$/dsmeta.obj \
- $(SLO)$/controllerframe.obj \
- $(SLO)$/propertystorage.obj
+SLOFILES= \
+ $(SLO)/asyncmodaldialog.obj \
+ $(SLO)/imageprovider.obj \
+ $(SLO)/singledoccontroller.obj \
+ $(SLO)/dbsubcomponentcontroller.obj \
+ $(SLO)/datasourceconnector.obj \
+ $(SLO)/linkeddocuments.obj \
+ $(SLO)/indexcollection.obj \
+ $(SLO)/UITools.obj \
+ $(SLO)/WCPage.obj \
+ $(SLO)/WCopyTable.obj \
+ $(SLO)/WTypeSelect.obj \
+ $(SLO)/TokenWriter.obj \
+ $(SLO)/HtmlReader.obj \
+ $(SLO)/RtfReader.obj \
+ $(SLO)/propertysetitem.obj \
+ $(SLO)/databaseobjectview.obj \
+ $(SLO)/DExport.obj \
+ $(SLO)/uiservices.obj \
+ $(SLO)/RowSetDrop.obj \
+ $(SLO)/TableCopyHelper.obj \
+ $(SLO)/moduledbu.obj \
+ $(SLO)/WColumnSelect.obj \
+ $(SLO)/WExtendPages.obj \
+ $(SLO)/WNameMatch.obj \
+ $(SLO)/ToolBoxHelper.obj \
+ $(SLO)/stringlistitem.obj \
+ $(SLO)/charsets.obj \
+ $(SLO)/defaultobjectnamecheck.obj \
+ $(SLO)/dsmeta.obj \
+ $(SLO)/controllerframe.obj \
+ $(SLO)/propertystorage.obj \
+ $(SLO)/dbaundomanager.obj \
+
# --- Targets ----------------------------------
.INCLUDE : target.mk
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 87ddfa1f197b..2e8c002a2097 100644..100755
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -1,5 +1,4 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -25,725 +24,177 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
+#include "dbaundomanager.hxx"
+#include "singledoccontroller.hxx"
#include "browserids.hxx"
-#include "commontypes.hxx"
-#include "dataview.hxx"
#include "dbu_misc.hrc"
#include "dbustrings.hrc"
#include "moduledbu.hxx"
-#include "singledoccontroller.hxx"
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
/** === begin UNO includes === **/
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdb/XDocumentDataSource.hpp>
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
/** === end UNO includes === **/
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <toolkit/unohlp.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
+#include <svl/undo.hxx>
+
+#include <boost/scoped_ptr.hpp>
-//........................................................................
+//......................................................................................................................
namespace dbaui
{
-//........................................................................
+//......................................................................................................................
/** === begin UNO using === **/
- using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::util::XNumberFormatter;
- using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
- using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::container::XChild;
- using ::com::sun::star::sdbc::XDataSource;
- using ::com::sun::star::util::XNumberFormatter;
- using ::com::sun::star::util::XNumberFormatsSupplier;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::sdbc::SQLException;
- using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::sdb::XOfficeDatabaseDocument;
- using ::com::sun::star::awt::XWindow;
- using ::com::sun::star::sdbc::XDatabaseMetaData;
- using ::com::sun::star::sdb::XDocumentDataSource;
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::frame::XUntitledNumbers;
- using ::com::sun::star::beans::PropertyVetoException;
+ using ::com::sun::star::lang::EventObject;
/** === end UNO using === **/
- class DataSourceHolder
+ //==================================================================================================================
+ //= OSingleDocumentController_Data
+ //==================================================================================================================
+ struct OSingleDocumentController_Data
{
- public:
- DataSourceHolder()
- {
- }
+ ::boost::scoped_ptr< UndoManager > m_pUndoManager;
- DataSourceHolder( const Reference< XDataSource >& _rxDataSource )
+ OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_pUndoManager( new UndoManager( i_parent, i_mutex ) )
{
- m_xDataSource = _rxDataSource;
- Reference< XDocumentDataSource > xDocDS( m_xDataSource, UNO_QUERY );
- if ( xDocDS.is() )
- m_xDocument = xDocDS->getDatabaseDocument();
-
- m_xDataSourceProps.set( m_xDataSource, UNO_QUERY );
}
-
- const Reference< XDataSource >& getDataSource() const { return m_xDataSource; }
- const Reference< XPropertySet >& getDataSourceProps() const { return m_xDataSourceProps; }
- const Reference< XOfficeDatabaseDocument > getDatabaseDocument() const { return m_xDocument; }
-
- bool is() const { return m_xDataSource.is(); }
-
- void clear()
- {
- m_xDataSource.clear();
- m_xDocument.clear();
- }
-
- private:
- Reference< XDataSource > m_xDataSource;
- Reference< XPropertySet > m_xDataSourceProps;
- Reference< XOfficeDatabaseDocument > m_xDocument;
};
- struct OSingleDocumentControllerImpl
- {
- private:
- ::boost::optional< bool > m_aDocScriptSupport;
-
- public:
- OModuleClient m_aModuleClient;
- ::dbtools::SQLExceptionInfo m_aCurrentError; // contains the current error which can be set through IEnvironment
-
- ::cppu::OInterfaceContainerHelper
- m_aModifyListeners;
-
- // <properties>
- SharedConnection m_xConnection;
- ::dbtools::DatabaseMetaData m_aSdbMetaData;
- // </properties>
- ::rtl::OUString m_sDataSourceName; // the data source we're working for
- DataSourceHolder m_aDataSource;
- Reference< XModel > m_xDocument;
- Reference< XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
- sal_Int32 m_nDocStartNumber;
- sal_Bool m_bSuspended; // is true when the controller was already suspended
- sal_Bool m_bEditable; // is the control readonly or not
- sal_Bool m_bModified; // is the data modified
- bool m_bNotAttached;
-
- OSingleDocumentControllerImpl( ::osl::Mutex& i_rMutex )
- :m_aDocScriptSupport()
- ,m_aModifyListeners( i_rMutex )
- ,m_nDocStartNumber(0)
- ,m_bSuspended( sal_False )
- ,m_bEditable(sal_True)
- ,m_bModified(sal_False)
- ,m_bNotAttached(true)
- {
- }
-
- bool documentHasScriptSupport() const
- {
- OSL_PRECOND( !!m_aDocScriptSupport,
- "OSingleDocumentControllerImpl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
- return !!m_aDocScriptSupport && *m_aDocScriptSupport;
- }
-
- void setDocumentScriptSupport( const bool _bSupport )
- {
- OSL_PRECOND( !m_aDocScriptSupport,
- "OSingleDocumentControllerImpl::setDocumentScriptSupport: already initialized!" );
- m_aDocScriptSupport = ::boost::optional< bool >( _bSupport );
- }
- };
-
- //====================================================================
+ //==================================================================================================================
//= OSingleDocumentController
- //====================================================================
- //--------------------------------------------------------------------
- OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB)
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ OSingleDocumentController::OSingleDocumentController( const Reference< XMultiServiceFactory >& _rxORB )
:OSingleDocumentController_Base( _rxORB )
- ,m_pImpl( new OSingleDocumentControllerImpl( getMutex() ) )
+ ,m_pData( new OSingleDocumentController_Data( *this, getMutex() ) )
{
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
OSingleDocumentController::~OSingleDocumentController()
{
}
- //--------------------------------------------------------------------
- void OSingleDocumentController::impl_initialize()
- {
- OGenericUnoController::impl_initialize();
-
- const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
-
- Reference< XConnection > xConnection;
- xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, xConnection );
-
- if ( !xConnection.is() )
- ::dbtools::isEmbeddedInDatabase( getModel(), xConnection );
-
- if ( xConnection.is() )
- initializeConnection( xConnection );
-
- bool bShowError = true;
- if ( !isConnected() )
- {
- reconnect( sal_False );
- bShowError = false;
- }
- if ( !isConnected() )
- {
- if ( bShowError )
- connectionLostMessage();
- throw IllegalArgumentException();
- }
- }
-
- //--------------------------------------------------------------------
- Any SAL_CALL OSingleDocumentController::queryInterface(const Type& _rType) throw (RuntimeException)
- {
- if ( _rType.equals( XScriptInvocationContext::static_type() ) )
- {
- if ( m_pImpl->documentHasScriptSupport() )
- return makeAny( Reference< XScriptInvocationContext >( this ) );
- return Any();
- }
-
- return OSingleDocumentController_Base::queryInterface( _rType );
- }
-
- //--------------------------------------------------------------------
- Sequence< Type > SAL_CALL OSingleDocumentController::getTypes( ) throw (RuntimeException)
- {
- Sequence< Type > aTypes( OSingleDocumentController_Base::getTypes() );
- if ( !m_pImpl->documentHasScriptSupport() )
- {
- Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 );
- ::std::remove_copy_if(
- aTypes.getConstArray(),
- aTypes.getConstArray() + aTypes.getLength(),
- aStrippedTypes.getArray(),
- ::std::bind2nd( ::std::equal_to< Type >(), XScriptInvocationContext::static_type() )
- );
- aTypes = aStrippedTypes;
- }
- return aTypes;
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::initializeConnection( const Reference< XConnection >& _rxForeignConn )
- {
- DBG_ASSERT( !isConnected(), "OSingleDocumentController::initializeConnection: not to be called when already connected!" );
- // usually this gets called from within initialize of derived classes ...
- if ( isConnected() )
- disconnect();
-
- m_pImpl->m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership );
- m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
- startConnectionListening( m_pImpl->m_xConnection );
-
- // get the data source the connection belongs to
- try
- {
- // determine our data source
- OSL_PRECOND( !m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: already a data source in this phase?" );
- {
- Reference< XChild > xConnAsChild( m_pImpl->m_xConnection, UNO_QUERY );
- Reference< XDataSource > xDS;
- if ( xConnAsChild.is() )
- xDS = Reference< XDataSource >( xConnAsChild->getParent(), UNO_QUERY );
-
- // (take the indirection through XDataSource to ensure we have a correct object ....)
- m_pImpl->m_aDataSource = xDS;
- }
- OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: unable to obtain the data source object!" );
-
- if ( m_pImpl->m_bNotAttached )
- {
- Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY );
- m_pImpl->m_nDocStartNumber = 1;
- if ( xUntitledProvider.is() )
- m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
- }
-
- // determine the availability of script support in our document. Our own XScriptInvocationContext
- // interface depends on this
- m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() );
-
- // get a number formatter
- Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps(), UNO_SET_THROW );
- xDataSourceProps->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->m_sDataSourceName;
- DBG_ASSERT( m_pImpl->m_sDataSourceName.getLength(), "OSingleDocumentController::initializeConnection: invalid data source name!" );
- Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
- if(xSupplier.is())
- {
- m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
- ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")), UNO_QUERY);
- m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
- }
- OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::reconnect( sal_Bool _bUI )
- {
- OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!");
-
- stopConnectionListening( m_pImpl->m_xConnection );
- m_pImpl->m_aSdbMetaData.reset( NULL );
- m_pImpl->m_xConnection.clear();
-
- // reconnect
- sal_Bool bReConnect = sal_True;
- if ( _bUI )
- {
- QueryBox aQuery( getView(), ModuleRes(QUERY_CONNECTION_LOST) );
- bReConnect = ( RET_YES == aQuery.Execute() );
- }
-
- // now really reconnect ...
- if ( bReConnect )
- {
- m_pImpl->m_xConnection.reset( connect( m_pImpl->m_aDataSource.getDataSource(), NULL ), SharedConnection::TakeOwnership );
- m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
- }
-
- // invalidate all slots
- InvalidateAll();
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::disconnect()
- {
- stopConnectionListening(m_pImpl->m_xConnection);
- m_pImpl->m_aSdbMetaData.reset( NULL );
- m_pImpl->m_xConnection.clear();
-
- InvalidateAll();
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::losingConnection()
- {
- // our connection was disposed so we need a new one
- reconnect( sal_True );
- }
-
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
void SAL_CALL OSingleDocumentController::disposing()
{
OSingleDocumentController_Base::disposing();
- m_aUndoManager.Clear();
-
- disconnect();
-
- attachFrame( Reference < XFrame >() );
-
- m_pImpl->m_aDataSource.clear();
- }
-
- //--------------------------------------------------------------------
- sal_Bool OSingleDocumentController::Construct(Window* _pParent)
- {
- DBG_ASSERT( getView(), "OSingleDocumentController::Construct: have no view!" );
- if ( getView() )
- getView()->enableSeparator( );
-
- return OSingleDocumentController_Base::Construct( _pParent );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::disposing(const EventObject& _rSource) throw( RuntimeException )
- {
- if ( _rSource.Source == getConnection() )
- {
- if ( !m_pImpl->m_bSuspended // when already suspended then we don't have to reconnect
- && !getBroadcastHelper().bInDispose
- && !getBroadcastHelper().bDisposed
- && isConnected()
- )
- {
- losingConnection();
- }
- else
- {
- m_pImpl->m_xConnection.reset( m_pImpl->m_xConnection, SharedConnection::NoTakeOwnership );
- // this prevents the "disposeComponent" call in disconnect
- disconnect();
- }
- }
- else
- OSingleDocumentController_Base::disposing( _rSource );
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::appendError( const ::rtl::OUString& _rErrorMessage, const ::dbtools::StandardSQLState _eSQLState,
- const sal_Int32 _nErrorCode )
- {
- m_pImpl->m_aCurrentError.append( ::dbtools::SQLExceptionInfo::SQL_EXCEPTION, _rErrorMessage, getStandardSQLStateAscii( _eSQLState ),
- _nErrorCode );
- }
- //--------------------------------------------------------------------
- void OSingleDocumentController::clearError()
- {
- m_pImpl->m_aCurrentError = ::dbtools::SQLExceptionInfo();
+ ClearUndoManager();
+ m_pData->m_pUndoManager->disposing();
}
- //--------------------------------------------------------------------
- sal_Bool OSingleDocumentController::hasError() const
+ // -----------------------------------------------------------------------------
+ void SAL_CALL OSingleDocumentController::disposing( const EventObject& i_event ) throw( RuntimeException )
{
- return m_pImpl->m_aCurrentError.isValid();
+ // simply disambiguate
+ OSingleDocumentController_Base::disposing( i_event );
}
- //--------------------------------------------------------------------
- const ::dbtools::SQLExceptionInfo& OSingleDocumentController::getError() const
+ // -----------------------------------------------------------------------------
+ void OSingleDocumentController::ClearUndoManager()
{
- return m_pImpl->m_aCurrentError;
+ GetUndoManager().Clear();
}
- //--------------------------------------------------------------------
- void OSingleDocumentController::displayError()
+ // -----------------------------------------------------------------------------
+ SfxUndoManager& OSingleDocumentController::GetUndoManager() const
{
- showError( m_pImpl->m_aCurrentError );
+ return m_pData->m_pUndoManager->GetSfxUndoManager();
}
- //--------------------------------------------------------------------
- sal_Bool SAL_CALL OSingleDocumentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
+ // -----------------------------------------------------------------------------
+ void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
{
- m_pImpl->m_bSuspended = bSuspend;
- if ( !bSuspend && !isConnected() )
- reconnect(sal_True);
+ // add undo action
+ GetUndoManager().AddUndoAction( _pAction );
+ // when we add an undo action the controller was modified
+ setModified( sal_True );
- return sal_True;
+ // now inform me that or states changed
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
}
// -----------------------------------------------------------------------------
- sal_Bool SAL_CALL OSingleDocumentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException )
+ Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( ) throw (RuntimeException)
{
- if ( !_rxModel.is() )
- return sal_False;
- if ( !OSingleDocumentController_Base::attachModel( _rxModel ) )
- return sal_False;
-
- m_pImpl->m_bNotAttached = false;
- if ( m_pImpl->m_nDocStartNumber == 1 )
- releaseNumberForComponent();
-
- Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
- m_pImpl->m_nDocStartNumber = 1;
- if ( xUntitledProvider.is() )
- m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
-
- return sal_True;
+ return m_pData->m_pUndoManager.get();
}
// -----------------------------------------------------------------------------
FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const
{
FeatureState aReturn;
- // (disabled automatically)
- aReturn.bEnabled = sal_True;
-
- switch (_nId)
+ switch ( _nId )
{
case ID_BROWSER_UNDO:
- aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetUndoActionCount() != 0;
+ aReturn.bEnabled = isEditable() && GetUndoManager().GetUndoActionCount() != 0;
if ( aReturn.bEnabled )
{
String sUndo(ModuleRes(STR_UNDO_COLON));
sUndo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
- sUndo += m_aUndoManager.GetUndoActionComment();
+ sUndo += GetUndoManager().GetUndoActionComment();
aReturn.sTitle = sUndo;
}
break;
+
case ID_BROWSER_REDO:
- aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetRedoActionCount() != 0;
+ aReturn.bEnabled = isEditable() && GetUndoManager().GetRedoActionCount() != 0;
if ( aReturn.bEnabled )
{
String sRedo(ModuleRes(STR_REDO_COLON));
sRedo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
- sRedo += m_aUndoManager.GetRedoActionComment();
+ sRedo += GetUndoManager().GetRedoActionComment();
aReturn.sTitle = sRedo;
}
break;
+
default:
aReturn = OSingleDocumentController_Base::GetState(_nId);
}
return aReturn;
}
// -----------------------------------------------------------------------------
- void OSingleDocumentController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs)
+ void OSingleDocumentController::Execute( sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs )
{
- switch(_nId)
+ switch ( _nId )
{
- case ID_BROWSER_CLOSE:
- closeTask();
- return;
case ID_BROWSER_UNDO:
- m_aUndoManager.Undo();
- InvalidateFeature(ID_BROWSER_REDO);
+ GetUndoManager().Undo();
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
break;
+
case ID_BROWSER_REDO:
- m_aUndoManager.Redo();
- InvalidateFeature(ID_BROWSER_UNDO);
+ GetUndoManager().Redo();
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
break;
+
default:
OSingleDocumentController_Base::Execute( _nId, _rArgs );
break;
}
InvalidateFeature(_nId);
}
- // -----------------------------------------------------------------------------
- SfxUndoManager* OSingleDocumentController::getUndoMgr()
- {
- return &m_aUndoManager;
- }
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
- {
- // add undo action
- m_aUndoManager.AddUndoAction(_pAction);
- // when we add an undo action the controller was modified
- setModified(sal_True);
- // now inform me that or states changed
- InvalidateFeature(ID_BROWSER_UNDO);
- InvalidateFeature(ID_BROWSER_REDO);
- }
-
- // -----------------------------------------------------------------------------
- ::rtl::OUString OSingleDocumentController::getDataSourceName() const
- {
- ::rtl::OUString sName;
- Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps() );
- if ( xDataSourceProps.is() )
- xDataSourceProps->getPropertyValue(PROPERTY_NAME) >>= sName;
- return sName;
- }
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::connectionLostMessage() const
- {
- String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
- Reference< XWindow > xWindow = getTopMostContainerWindow();
- Window* pWin = NULL;
- if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow);
- if ( !pWin )
- pWin = getView()->Window::GetParent();
-
- InfoBox(pWin, aMessage).Execute();
- }
- // -----------------------------------------------------------------------------
- const Reference< XConnection >& OSingleDocumentController::getConnection() const
- {
- return m_pImpl->m_xConnection;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isReadOnly() const
- {
- return !m_pImpl->m_bEditable;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isEditable() const
- {
- return m_pImpl->m_bEditable;
- }
-
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::setEditable(sal_Bool _bEditable)
- {
- m_pImpl->m_bEditable = _bEditable;
- }
-
- // -----------------------------------------------------------------------------
- const ::dbtools::DatabaseMetaData& OSingleDocumentController::getSdbMetaData() const
- {
- return m_pImpl->m_aSdbMetaData;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isConnected() const
- {
- return m_pImpl->m_xConnection.is();
- }
-
- // -----------------------------------------------------------------------------
- Reference< XDatabaseMetaData > OSingleDocumentController::getMetaData( ) const
- {
- Reference< XDatabaseMetaData > xMeta;
- try
- {
- if ( isConnected() )
- xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xMeta;
- }
-
- // -----------------------------------------------------------------------------
- const Reference< XPropertySet >& OSingleDocumentController::getDataSource() const
- {
- return m_pImpl->m_aDataSource.getDataSourceProps();
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::haveDataSource() const
- {
- return m_pImpl->m_aDataSource.is();
- }
-
- // -----------------------------------------------------------------------------
- Reference< XModel > OSingleDocumentController::getDatabaseDocument() const
- {
- return Reference< XModel >( m_pImpl->m_aDataSource.getDatabaseDocument(), UNO_QUERY );
- }
-
- // -----------------------------------------------------------------------------
- Reference< XNumberFormatter > OSingleDocumentController::getNumberFormatter() const
- {
- return m_pImpl->m_xFormatter;
- }
-
- // -----------------------------------------------------------------------------
- Reference< XModel > OSingleDocumentController::getPrivateModel() const
- {
- return getDatabaseDocument();
- }
- // -----------------------------------------------------------------------------
- // XTitle
- ::rtl::OUString SAL_CALL OSingleDocumentController::getTitle()
- throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- if ( m_bExternalTitle )
- return impl_getTitleHelper_throw()->getTitle ();
-
- ::rtl::OUStringBuffer sTitle;
- Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
- if ( xTitle.is() )
- {
- sTitle.append( xTitle->getTitle() );
- sTitle.appendAscii(" : ");
- }
- sTitle.append( getPrivateTitle() );
- // There can be only one view with the same object
- //const sal_Int32 nCurrentView = getCurrentStartNumber();
- //if ( nCurrentView > 1 )
- //{
- // sTitle.appendAscii(" : ");
- // sTitle.append(nCurrentView);
- //}
-
- return sTitle.makeStringAndClear();
- }
- // -----------------------------------------------------------------------------
- sal_Int32 OSingleDocumentController::getCurrentStartNumber() const
- {
- return m_pImpl->m_nDocStartNumber;
- }
-
- // -----------------------------------------------------------------------------
- Reference< XEmbeddedScripts > SAL_CALL OSingleDocumentController::getScriptContainer() throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- if ( !m_pImpl->documentHasScriptSupport() )
- return NULL;
-
- return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- m_pImpl->m_aModifyListeners.addInterface( i_Listener );
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
- }
-
- // -----------------------------------------------------------------------------
- ::sal_Bool SAL_CALL OSingleDocumentController::isModified( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- return impl_isModified();
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( getMutex() );
-
- if ( m_pImpl->m_bModified == i_bModified )
- return;
-
- m_pImpl->m_bModified = i_bModified;
- impl_onModifyChanged();
-
- EventObject aEvent( *this );
- aGuard.clear();
- m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::impl_isModified() const
- {
- return m_pImpl->m_bModified;
- }
-
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::impl_onModifyChanged()
- {
- InvalidateFeature( ID_BROWSER_SAVEDOC );
- if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
- InvalidateFeature( ID_BROWSER_SAVEASDOC );
- }
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 0eb7c09f29e9..576fa52c1a21 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -1957,7 +1957,7 @@ namespace
pJoinType = pNode->getChild(2);
}
- if (SQL_ISRULE(pJoinType,join_type) && SQL_ISTOKEN(pJoinType->getChild(0),INNER))
+ if (SQL_ISRULE(pJoinType,join_type) && (!pJoinType->count() || SQL_ISTOKEN(pJoinType->getChild(0),INNER)))
{
eJoinType = INNER_JOIN;
}
@@ -2177,7 +2177,7 @@ namespace
while ( false );
// Durch das Neuerzeugen wurden wieder Undo-Actions in den Manager gestellt
- rController.getUndoMgr()->Clear();
+ rController.ClearUndoManager();
_pSelectionBrw->Invalidate();
return eErrorCode;
}
@@ -3234,7 +3234,7 @@ void OQueryDesignView::initByFieldDescriptions( const Sequence< PropertyValue >&
InsertField( pField, sal_True, sal_False );
}
- rController.getUndoMgr()->Clear();
+ rController.ClearUndoManager();
m_pSelectionBox->Invalidate();
}
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index c083392a9613..16052816f07a 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -847,8 +847,8 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
// mein Parent brauche ich, da es vom Loeschen erfahren soll
OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
- SfxUndoManager* pUndoMgr = m_pView->getController().getUndoMgr();
- pUndoMgr->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
+ SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
+ rUndoMgr.EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
// Undo-Action anlegen
OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
@@ -861,7 +861,7 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName() );
m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
- pUndoMgr->LeaveListAction();
+ rUndoMgr.LeaveListAction();
if (m_lnkTabWinsChangeHandler.IsSet())
{
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index ec3b22899225..5943485a7bb5 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -299,7 +299,7 @@ bool OQueryViewSwitch::impl_postViewSwitch( const bool i_bGraphicalDesign, const
if ( pContainer )
pContainer->Resize();
- m_pDesignView->getController().getUndoMgr()->Clear();
+ m_pDesignView->getController().ClearUndoManager();
m_pDesignView->getController().InvalidateAll();
return i_bSuccess;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 66b6eec9465c..223c00cfbd2a 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1021,7 +1021,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
strOldCellContents = pEntry->GetField();
bListAction = sal_True;
if ( !m_bInUndoMode )
- rController.getUndoMgr()->EnterListAction(String(),String());
+ rController.GetUndoManager().EnterListAction(String(),String());
USHORT nPos = m_pFieldCell->GetEntryPos(aFieldName);
String aAliasName = pEntry->GetAlias();
@@ -1050,7 +1050,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
{
sNewValue = aFieldName;
if ( !m_bInUndoMode )
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().LeaveListAction();
bListAction = sal_False;
}
else
@@ -1282,7 +1282,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
}
if ( bListAction && !m_bInUndoMode )
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().LeaveListAction();
return pEntry != NULL && !bError;
}
@@ -2644,7 +2644,7 @@ void OSelectionBrowseBox::appendUndoAction(const String& _rOldValue,const String
if ( !_bListAction )
{
_bListAction = sal_True;
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->EnterListAction(String(),String());
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().EnterListAction(String(),String());
}
appendUndoAction(_rOldValue,_rNewValue,_nRow);
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 06b6804fa9be..2659580a91b4 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -685,9 +685,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
break;
case SID_BROWSER_CLEAR_QUERY:
{
- getUndoMgr()->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
+ GetUndoManager().EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
getContainer()->clear();
- getUndoMgr()->LeaveListAction();
+ GetUndoManager().LeaveListAction();
setStatement_fireEvent( ::rtl::OUString() );
if(m_bGraphicalDesign)
@@ -1037,7 +1037,7 @@ void OQueryController::impl_initialize()
}
}
- getUndoMgr()->Clear();
+ ClearUndoManager();
if ( ( m_bGraphicalDesign )
&& ( ( !m_sName.getLength() && !editingCommand() )
@@ -1789,7 +1789,7 @@ void OQueryController::reset()
{
impl_reset();
getContainer()->reset( NULL );
- getUndoMgr()->Clear();
+ ClearUndoManager();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 99fe03a7004d..66dbc066324c 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -494,7 +494,7 @@ IMPL_LINK( ORelationController, OnThreadFinished, void*, /*NOTINTERESTEDIN*/ )
{
getView()->initialize(); // show the windows and fill with our informations
getView()->Invalidate(INVALIDATE_NOERASE);
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
if(m_vTableData.empty())
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 0c9d0cc1a456..dfbc022d4f7d 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -375,7 +375,7 @@ void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin )
OSQLWarningBox aDlg( this, ModuleRes( STR_QUERY_REL_DELETE_WINDOW ), WB_YES_NO | WB_DEF_YES );
if ( m_bInRemove || aDlg.Execute() == RET_YES )
{
- m_pView->getController().getUndoMgr()->Clear();
+ m_pView->getController().ClearUndoManager();
OJoinTableView::RemoveTabWin( pTabWin );
m_pView->getController().InvalidateFeature(SID_RELATION_ADD_RELATION);
@@ -383,30 +383,7 @@ void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin )
m_pView->getController().InvalidateFeature(ID_BROWSER_REDO);
}
}
-// -----------------------------------------------------------------------------
-//namespace
-//{
-// class OReleationAskDialog : public ButtonDialog
-// {
-// FixedImage m_aInfoImage;
-// FixedText m_aTitle;
-// FixedText m_aMessage;
-// public:
-// OReleationDialog(Window* _pParent) : ButtonDialog(_pParent,WB_HORZ | WB_STDDIALOG)
-// ,m_aInfoImage(this)
-// ,m_aTitle(this,WB_WORDBREAK | WB_LEFT)
-// ,m_aMessage(this,WB_WORDBREAK | WB_LEFT)
-// {
-// m_aMessage.SetText(ModuleRes(STR_QUERY_REL_EDIT_RELATION));
-// m_aMessage.Show();
-//
-// // Changed as per BugID 79541 Branding/Configuration
-// String sDialogTitle( lcl_getProductName() );
-// SetText( sDialogTitle.AppendAscii( " Base" ) );
-// m_aTitle.Show();
-// }
-// };
-//}
+
// -----------------------------------------------------------------------------
void ORelationTableView::lookForUiActivities()
{
@@ -469,7 +446,7 @@ void ORelationTableView::_elementRemoved( const container::ContainerEvent& _rEve
OTableWindow* pTableWindow = GetTabWindow(sName);
if ( pTableWindow )
{
- m_pView->getController().getUndoMgr()->Clear();
+ m_pView->getController().ClearUndoManager();
OJoinTableView::RemoveTabWin( pTableWindow );
m_pView->getController().InvalidateFeature(SID_RELATION_ADD_RELATION);
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 4d3cdb6652a9..693c7dbf585a 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -263,9 +263,9 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow)
}
//------------------------------------------------------------------------------
-SfxUndoManager* OTableEditorCtrl::GetUndoManager() const
+SfxUndoManager& OTableEditorCtrl::GetUndoManager() const
{
- return GetView()->getController().getUndoMgr();
+ return GetView()->getController().GetUndoManager();
}
//------------------------------------------------------------------------------
@@ -388,7 +388,7 @@ OTableEditorCtrl::~OTableEditorCtrl()
DBG_DTOR(OTableEditorCtrl,NULL);
//////////////////////////////////////////////////////////////////////
// Undo-Manager zuruecksetzen
- GetUndoManager()->Clear();
+ GetUndoManager().Clear();
//////////////////////////////////////////////////////////////////////
// Moegliche Events aus Queue entfernen
@@ -683,7 +683,7 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
// Wenn FieldDescr existiert, wurde Feld geloescht und alter Inhalt wird wiederhergestellt
if (pActFieldDescr)
{
- GetUndoManager()->AddUndoAction(new OTableEditorTypeSelUndoAct(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
+ GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
SwitchType(TOTypeInfoSP());
pActFieldDescr = pActRow->GetActFieldDescr();
}
@@ -858,7 +858,7 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
default: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_ATTRIBUTE ) ); break;
}
- GetUndoManager()->EnterListAction( sActionDescription, String() );
+ GetUndoManager().EnterListAction( sActionDescription, String() );
if (!pActFieldDescr)
{
const OTypeInfoMap* pTypeInfoMap = GetView()->getController().getTypeInfo();
@@ -875,20 +875,20 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType) );
pActFieldDescr = pActRow->GetActFieldDescr();
pDescrWin->DisplayData( pActFieldDescr );
- GetUndoManager()->AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
+ GetUndoManager().AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
}
if( nColId != FIELD_TYPE )
- GetUndoManager()->AddUndoAction( new OTableDesignCellUndoAct(this, nRow, nColId) );
+ GetUndoManager().AddUndoAction( new OTableDesignCellUndoAct(this, nRow, nColId) );
else
{
- GetUndoManager()->AddUndoAction(new OTableEditorTypeSelUndoAct(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
+ GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
resetType();
}
SaveData(nRow,nColId);
// SaveData could create a undo action as well
- GetUndoManager()->LeaveListAction();
+ GetUndoManager().LeaveListAction();
RowModified(nRow);
CellControllerRef xController(Controller());
if(xController.Is())
@@ -1051,7 +1051,7 @@ void OTableEditorCtrl::InsertRows( long nRow )
//////////////////////////////////////////////////////////////////////
// Undo-Action erzeugen
- GetUndoManager()->AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) );
+ GetUndoManager().AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) );
GetView()->getController().setModified( sal_True );
InvalidateFeatures();
}
@@ -1063,7 +1063,7 @@ void OTableEditorCtrl::DeleteRows()
OSL_ENSURE(GetView()->getController().isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!");
//////////////////////////////////////////////////////////////////////
// Undo-Action erzeugen
- GetUndoManager()->AddUndoAction( new OTableEditorDelUndoAct(this) );
+ GetUndoManager().AddUndoAction( new OTableEditorDelUndoAct(this) );
//////////////////////////////////////////////////////////////////////
@@ -1111,7 +1111,7 @@ void OTableEditorCtrl::InsertNewRows( long nRow )
long nInsertRows = GetSelectRowCount();
if( !nInsertRows )
nInsertRows = 1;
- GetUndoManager()->AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) );
+ GetUndoManager().AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) );
//////////////////////////////////////////////////////////////////////
// Zahl der selektierten Zeilen werden neu eingefuegt
for( long i=nRow; i<(nRow+nInsertRows); i++ )
@@ -1889,7 +1889,7 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet )
}
}
- GetUndoManager()->AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) );
+ GetUndoManager().AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) );
//////////////////////////////////////////////////////////////////////
// Handle-Spalte invalidieren
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index 2a7a36f3a051..edf941cf1f39 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -148,7 +148,7 @@ namespace dbaui
virtual ~OTableEditorCtrl();
virtual BOOL CursorMoving(long nNewRow, USHORT nNewCol);
virtual void UpdateAll();
- SfxUndoManager* GetUndoManager() const;
+ SfxUndoManager& GetUndoManager() const;
void SetDescrWin( OTableFieldDescWin* pWin ){ pDescrWin = pWin; if (pDescrWin && pActRow) pDescrWin->DisplayData(pActRow->GetActFieldDescr()); }
BOOL SaveCurRow();
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index a848eb8de18c..fa8d1809b595 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -568,7 +568,7 @@ void OTableController::impl_initialize()
{
loadData(); // fill the column information form the table
getView()->initialize(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
}
catch( const Exception& )
@@ -666,11 +666,6 @@ void OTableController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT );
}
// -----------------------------------------------------------------------------
-SfxUndoManager* OTableController::getUndoMgr()
-{
- return &m_aUndoManager;
-}
-// -----------------------------------------------------------------------------
void OTableController::impl_onModifyChanged()
{
OSingleDocumentController::impl_onModifyChanged();
@@ -1521,7 +1516,7 @@ void OTableController::reSyncRows()
}
static_cast<OTableDesignView*>(getView())->reSync(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
}
// -----------------------------------------------------------------------------
@@ -1577,7 +1572,7 @@ void OTableController::reload()
{
loadData(); // fill the column information form the table
static_cast<OTableDesignView*>(getView())->reSync(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
static_cast<OTableDesignView*>(getView())->Invalidate();
}
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index be1cf5288b21..d3620aea4901 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1178,8 +1178,15 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
aSourceColTypes.reserve( nCount + 1 );
aSourceColTypes.push_back( -1 ); // just to avoid a everytime i-1 call
+ ::std::vector< sal_Int32 > aSourcePrec;
+ aSourcePrec.reserve( nCount + 1 );
+ aSourcePrec.push_back( -1 ); // just to avoid a everytime i-1 call
+
for ( sal_Int32 k=1; k <= nCount; ++k )
+ {
aSourceColTypes.push_back( xMeta->getColumnType( k ) );
+ aSourcePrec.push_back( xMeta->getPrecision( k ) );
+ }
// now create, fill and execute the prepared statement
Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW );
@@ -1291,7 +1298,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
case DataType::LONGVARBINARY:
case DataType::BINARY:
case DataType::VARBINARY:
- case DataType::BIT:
aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
break;
@@ -1307,6 +1313,13 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp );
break;
+ case DataType::BIT:
+ if ( aSourcePrec[nSourceColumn] > 1 )
+ {
+ aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
+ break;
+ }
+ // run through
case DataType::BOOLEAN:
aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean );
break;