diff options
Diffstat (limited to 'dbaccess/source/ui/querydesign/querycontroller.cxx')
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 86 |
1 files changed, 27 insertions, 59 deletions
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index c4d0b3cbf1e6..ca88cc47ca43 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -90,6 +90,7 @@ extern "C" void SAL_CALL createRegistryInfo_OQueryControl() { static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OQueryController > aAutoRegistration; } + namespace dbaui { using namespace ::com::sun::star::uno; @@ -100,12 +101,10 @@ namespace dbaui class OViewController : public OQueryController { - //------------------------------------------------------------------------------ virtual OUString SAL_CALL getImplementationName() throw( RuntimeException ) { return getImplementationName_Static(); } - //------------------------------------------------------------------------- virtual Sequence< OUString> SAL_CALL getSupportedServiceNames() throw(RuntimeException) { return getSupportedServiceNames_Static(); @@ -130,6 +129,7 @@ namespace dbaui } }; } + extern "C" void SAL_CALL createRegistryInfo_OViewControl() { static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OViewController > aAutoRegistration; @@ -141,7 +141,6 @@ namespace dbaui #if OSL_DEBUG_LEVEL > 1 namespace { - // ----------------------------------------------------------------------------- void insertParseTree(SvTreeListBox* _pBox,::connectivity::OSQLParseNode* _pNode,SvTreeListEntry* _pParent = NULL) { OUString rString; @@ -151,7 +150,6 @@ namespace dbaui rString = "RULE_ID: " + OUString::number( (sal_Int32)_pNode->getRuleID() ) + "(" + OSQLParser::RuleIDToStr(_pNode->getRuleID()) + ")"; - _pParent = _pBox->InsertEntry(rString,_pParent); // determine how much subtrees this node has @@ -223,7 +221,6 @@ namespace dbaui namespace { - // ----------------------------------------------------------------------------- String lcl_getObjectResourceString( sal_uInt16 _nResId, sal_Int32 _nCommandType ) { String sMessageText = String( ModuleRes( _nResId ) ); @@ -301,36 +298,34 @@ namespace } } -//------------------------------------------------------------------------------ OUString SAL_CALL OQueryController::getImplementationName() throw( RuntimeException ) { return getImplementationName_Static(); } -//------------------------------------------------------------------------------ OUString OQueryController::getImplementationName_Static() throw( RuntimeException ) { return OUString("org.openoffice.comp.dbu.OQueryDesign"); } -//------------------------------------------------------------------------------ + Sequence< OUString> OQueryController::getSupportedServiceNames_Static(void) throw( RuntimeException ) { Sequence< OUString> aSupported(1); aSupported.getArray()[0] = "com.sun.star.sdb.QueryDesign"; return aSupported; } -//------------------------------------------------------------------------- + Sequence< OUString> SAL_CALL OQueryController::getSupportedServiceNames() throw(RuntimeException) { return getSupportedServiceNames_Static(); } -// ------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OQueryController::Create(const Reference<XMultiServiceFactory >& _rxFactory) { return *(new OQueryController(comphelper::getComponentContext(_rxFactory))); } + DBG_NAME(OQueryController); -// ----------------------------------------------------------------------------- OQueryController::OQueryController(const Reference< XComponentContext >& _rM) :OJoinController(_rM) ,OQueryController_PBase( getBroadcastHelper() ) @@ -357,7 +352,6 @@ OQueryController::OQueryController(const Reference< XComponentContext >& _rM) &m_bEscapeProcessing, ::getCppuType( &m_bEscapeProcessing ) ); } -// ----------------------------------------------------------------------------- OQueryController::~OQueryController() { DBG_DTOR(OQueryController,NULL); @@ -373,26 +367,22 @@ OQueryController::~OQueryController() IMPLEMENT_FORWARD_XINTERFACE2( OQueryController, OJoinController, OQueryController_PBase ) IMPLEMENT_FORWARD_XTYPEPROVIDER2( OQueryController, OJoinController, OQueryController_PBase ) -//------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL OQueryController::getPropertySetInfo() throw(RuntimeException) { Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); return xInfo; } -//------------------------------------------------------------------------- sal_Bool SAL_CALL OQueryController::convertFastPropertyValue( Any& o_rConvertedValue, Any& o_rOldValue, sal_Int32 i_nHandle, const Any& i_rValue ) throw (IllegalArgumentException) { return OPropertyContainer::convertFastPropertyValue( o_rConvertedValue, o_rOldValue, i_nHandle, i_rValue ); } -//------------------------------------------------------------------------- void SAL_CALL OQueryController::setFastPropertyValue_NoBroadcast( sal_Int32 i_nHandle, const Any& i_rValue ) throw ( Exception ) { OPropertyContainer::setFastPropertyValue_NoBroadcast( i_nHandle, i_rValue ); } -//------------------------------------------------------------------------- void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const { switch ( i_nHandle ) @@ -424,13 +414,11 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i } } -//------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper& OQueryController::getInfoHelper() { return *const_cast< OQueryController* >( this )->getArrayHelper(); } -//-------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OQueryController::createArrayHelper( ) const { Sequence< Property > aProps; @@ -455,7 +443,6 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i return new ::cppu::OPropertyArrayHelper(aProps); } -// ----------------------------------------------------------------------------- void OQueryController::deleteIterator() { if(m_pSqlIterator) @@ -466,7 +453,7 @@ void OQueryController::deleteIterator() m_pSqlIterator = NULL; } } -// ----------------------------------------------------------------------------- + void OQueryController::disposing() { OQueryController_PBase::disposing(); @@ -482,12 +469,12 @@ void OQueryController::disposing() OJoinController::disposing(); OQueryController_PBase::disposing(); } -// ----------------------------------------------------------------------------- + void OQueryController::clearFields() { OTableFields().swap(m_vTableFieldDesc); } -// ----------------------------------------------------------------------------- + FeatureState OQueryController::GetState(sal_uInt16 _nId) const { FeatureState aReturn; @@ -580,7 +567,7 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) const } return aReturn; } -// ----------------------------------------------------------------------------- + void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs) { switch(_nId) @@ -829,7 +816,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& InvalidateFeature(_nId); } -// ----------------------------------------------------------------------------- void OQueryController::impl_showAutoSQLViewError( const ::com::sun::star::uno::Any& _rErrorDetails ) { SQLContext aErrorContext; @@ -840,7 +826,6 @@ void OQueryController::impl_showAutoSQLViewError( const ::com::sun::star::uno::A showError( aErrorContext ); } -// ----------------------------------------------------------------------------- bool OQueryController::impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInfo ) { OSL_PRECOND( getContainer(), "OQueryController::impl_setViewMode: illegal call!" ); @@ -870,7 +855,6 @@ bool OQueryController::impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInf return bSuccess; } -// ----------------------------------------------------------------------------- void OQueryController::impl_initialize() { OJoinController::impl_initialize(); @@ -952,7 +936,6 @@ void OQueryController::impl_initialize() m_bGraphicalDesign = false; } - // ......................................................................... // . initial design bool bForceInitialDesign = false; Sequence< PropertyValue > aCurrentQueryDesignProps; @@ -1088,13 +1071,11 @@ void OQueryController::impl_initialize() } } -// ----------------------------------------------------------------------------- void OQueryController::onLoadedMenu(const Reference< ::com::sun::star::frame::XLayoutManager >& /*_xLayoutManager*/) { ensureToolbars( *this, m_bGraphicalDesign ); } -// ----------------------------------------------------------------------------- OUString OQueryController::getPrivateTitle( ) const { OUString sName = m_sName; @@ -1111,7 +1092,7 @@ OUString OQueryController::getPrivateTitle( ) const } return sName; } -// ----------------------------------------------------------------------------- + void OQueryController::setQueryComposer() { if(isConnected()) @@ -1136,7 +1117,7 @@ void OQueryController::setQueryComposer() } } } -// ----------------------------------------------------------------------------- + sal_Bool OQueryController::Construct(Window* pParent) { // TODO: we have to check if we should create the text- or the design- view @@ -1146,12 +1127,11 @@ sal_Bool OQueryController::Construct(Window* pParent) return OJoinController::Construct(pParent); } -// ----------------------------------------------------------------------------- OJoinDesignView* OQueryController::getJoinView() { return getContainer()->getDesignView(); } -// ----------------------------------------------------------------------------- + void OQueryController::describeSupportedFeatures() { OJoinController::describeSupportedFeatures(); @@ -1174,7 +1154,7 @@ void OQueryController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:DBMakeDisjunct", ID_EDIT_QUERY_DESIGN ); #endif } -// ----------------------------------------------------------------------------- + void OQueryController::impl_onModifyChanged() { OJoinController::impl_onModifyChanged(); @@ -1182,7 +1162,7 @@ void OQueryController::impl_onModifyChanged() InvalidateFeature(ID_BROWSER_SAVEASDOC); InvalidateFeature(ID_BROWSER_QUERY_EXECUTE); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryController::disposing( const EventObject& Source ) throw(RuntimeException) { SolarMutexGuard aGuard; @@ -1202,7 +1182,7 @@ void SAL_CALL OQueryController::disposing( const EventObject& Source ) throw(Run OJoinController::disposing(Source); } -// ----------------------------------------------------------------------------- + void OQueryController::reconnect(sal_Bool _bUI) { deleteIterator(); @@ -1226,7 +1206,6 @@ void OQueryController::reconnect(sal_Bool _bUI) } } -// ----------------------------------------------------------------------------- void OQueryController::saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includingCriteria ) const { saveTableWindows( o_rViewSettings ); @@ -1252,7 +1231,7 @@ void OQueryController::saveViewSettings( ::comphelper::NamedValueCollection& o_r o_rViewSettings.put( "SplitterPosition", m_nSplitPos ); o_rViewSettings.put( "VisibleRows", m_nVisibleRows ); } -// ----------------------------------------------------------------------------- + void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollection& o_rViewSettings ) { loadTableWindows( o_rViewSettings ); @@ -1261,7 +1240,7 @@ void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollectio m_nVisibleRows = o_rViewSettings.getOrDefault( "VisibleRows", m_nVisibleRows ); m_aFieldInformation = o_rViewSettings.getOrDefault( "Fields", m_aFieldInformation ); } -// ----------------------------------------------------------------------------- + void OQueryController::execute_QueryPropDlg() { QueryPropertiesDialog aQueryPropDlg( @@ -1275,7 +1254,7 @@ void OQueryController::execute_QueryPropDlg() InvalidateFeature( SID_QUERY_LIMIT, 0, sal_True ); } } -// ----------------------------------------------------------------------------- + sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const { if ( _nColPos < m_aFieldInformation.getLength() ) @@ -1286,7 +1265,7 @@ sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const } return 0; } -// ----------------------------------------------------------------------------- + Reference<XNameAccess> OQueryController::getObjectContainer() const { Reference< XNameAccess > xElements; @@ -1313,7 +1292,6 @@ Reference<XNameAccess> OQueryController::getObjectContainer() const return xElements; } -// ----------------------------------------------------------------------------- void OQueryController::executeQuery() { // we don't need to check the connection here because we already check the composer @@ -1399,7 +1377,7 @@ void OQueryController::executeQuery() } } } -// ----------------------------------------------------------------------------- + sal_Bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sal_Bool _bSaveAs) { OSL_ENSURE( !editingCommand(), "OQueryController::askForNewName: not to be called when designing an independent statement!" ); @@ -1447,7 +1425,7 @@ sal_Bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElement } return bRet; } -// ----------------------------------------------------------------------------- + bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) { OSL_ENSURE(isEditable(),"Slot ID_BROWSER_SAVEDOC should not be enabled!"); @@ -1629,7 +1607,6 @@ bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) return bSuccess; } -//----------------------------------------------------------------------------- namespace { struct CommentStrip @@ -1639,6 +1616,7 @@ struct CommentStrip CommentStrip( const OUString& rComment, bool bLastOnLine ) : maComment( rComment), mbLastOnLine( bLastOnLine) {} }; + } /** Obtain all comments in a query. @@ -1713,7 +1691,6 @@ static ::std::vector< CommentStrip > getComment( const OUString& rQuery ) } return aRet; } -//------------------------------------------------------------------------------ /** Concat/insert comments that were previously obtained with getComment(). @@ -1772,7 +1749,7 @@ static OUString concatComment( const OUString& rQuery, const ::std::vector< Comm } return aBuf.makeStringAndClear(); } -// ----------------------------------------------------------------------------- + OUString OQueryController::translateStatement( bool _bFireStatementChange ) { // now set the properties @@ -1817,7 +1794,7 @@ OUString OQueryController::translateStatement( bool _bFireStatementChange ) return sTranslatedStmt; } -// ----------------------------------------------------------------------------- + short OQueryController::saveModified() { SolarMutexGuard aSolarGuard; @@ -1845,7 +1822,7 @@ short OQueryController::saveModified() } return nRet; } -// ----------------------------------------------------------------------------- + void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings ) { bool bValid = false; @@ -1969,7 +1946,6 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings getContainer()->setNoneVisbleRow(m_nVisibleRows); } -// ----------------------------------------------------------------------------- void OQueryController::reset() { impl_reset(); @@ -1977,7 +1953,6 @@ void OQueryController::reset() ClearUndoManager(); } -// ----------------------------------------------------------------------------- void OQueryController::setStatement_fireEvent( const OUString& _rNewStatement, bool _bFireStatementChange ) { Any aOldValue = makeAny( m_sStatement ); @@ -1989,7 +1964,6 @@ void OQueryController::setStatement_fireEvent( const OUString& _rNewStatement, b fire( &nHandle, &aNewValue, &aOldValue, 1, sal_False ); } -// ----------------------------------------------------------------------------- void OQueryController::setEscapeProcessing_fireEvent( const sal_Bool _bEscapeProcessing ) { if ( _bEscapeProcessing == m_bEscapeProcessing ) @@ -2003,20 +1977,17 @@ void OQueryController::setEscapeProcessing_fireEvent( const sal_Bool _bEscapePro fire( &nHandle, &aNewValue, &aOldValue, 1, sal_False ); } -// ----------------------------------------------------------------------------- IMPL_LINK( OQueryController, OnExecuteAddTable, void*, /*pNotInterestedIn*/ ) { Execute( ID_BROWSER_ADDTABLE,Sequence<PropertyValue>() ); return 0L; } -// ----------------------------------------------------------------------------- bool OQueryController::allowViews() const { return true; } -// ----------------------------------------------------------------------------- bool OQueryController::allowQueries() const { OSL_ENSURE( getSdbMetaData().isConnected(), "OQueryController::allowQueries: illegal call!" ); @@ -2029,7 +2000,6 @@ bool OQueryController::allowQueries() const return !bCreatingView; } -// ----------------------------------------------------------------------------- Any SAL_CALL OQueryController::getViewData() throw( RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); @@ -2041,14 +2011,12 @@ Any SAL_CALL OQueryController::getViewData() throw( RuntimeException ) return makeAny( aViewSettings.getPropertyValues() ); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryController::restoreViewData(const Any& /*Data*/) throw( RuntimeException ) { // TODO } -// ----------------------------------------------------------------------------- } // namespace dbaui -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |