summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 16:42:14 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 16:42:14 +0000
commit4ebe93a6eea331710e2a61a4f1295744290eea6b (patch)
tree1f025e3ebd78fdfc00e5d78886423ff2ae2e5afe
parente3e5ae79a49c93209990b954527a28c9c6064a69 (diff)
INTEGRATION: CWS insight01 (1.58.36); FILE MERGED
2004/07/21 09:53:11 oj 1.58.36.9: RESYNC: (1.67-1.70); FILE MERGED 2004/07/06 09:24:48 oj 1.58.36.8: RESYNC: (1.66-1.67); FILE MERGED 2004/06/30 08:14:24 oj 1.58.36.7: #i30305# break inserted 2004/06/04 13:51:04 oj 1.58.36.6: hide ds edit field 2004/06/02 08:46:56 oj 1.58.36.5: merge 2004/05/28 19:43:06 oj 1.58.36.4: RESYNC: (1.58-1.66); FILE MERGED 2004/04/29 06:03:57 oj 1.58.36.3: conver file url in system path 2004/03/05 07:38:40 oj 1.58.36.2: #111090# changes for the new prop dialogs 2004/02/23 14:38:23 oj 1.58.36.1: #111075# allow the selection of a database file
-rw-r--r--extensions/source/propctrlr/formcontroller.cxx99
1 files changed, 91 insertions, 8 deletions
diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx
index 362d5e4f91a7..2bbd2fae2bb3 100644
--- a/extensions/source/propctrlr/formcontroller.cxx
+++ b/extensions/source/propctrlr/formcontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: formcontroller.cxx,v $
*
- * $Revision: 1.72 $
+ * $Revision: 1.73 $
*
- * last change: $Author: kz $ $Date: 2004-07-30 16:47:33 $
+ * last change: $Author: hr $ $Date: 2004-08-02 17:42:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,6 +105,9 @@
#ifndef _SFXITEMSET_HXX
#include <svtools/itemset.hxx>
#endif
+#ifndef SVTOOLS_FILENOTATION_HXX_
+#include <svtools/filenotation.hxx>
+#endif
#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
#include <svtools/pathoptions.hxx>
#endif
@@ -227,6 +230,9 @@
#ifndef _BASEDLGS_HXX
#include <sfx2/basedlgs.hxx>
#endif
+#ifndef _SFX_DOCFILT_HACK_HXX
+#include <sfx2/docfilt.hxx>
+#endif
#ifndef _SV_WRKWIN_HXX
#include <vcl/wrkwin.hxx>
#endif
@@ -697,6 +703,16 @@ class EventsNameReplace_Impl:
sReturn = aHelper.getStringAddressFromCellListSource( xSource );
}
break;
+ case PROPERTY_ID_DATASOURCE:
+ {
+ rValue >>= sReturn;
+ if ( sReturn.getLength() )
+ {
+ ::svt::OFileNotation aTransformer(sReturn);
+ sReturn = aTransformer.get(::svt::OFileNotation::N_SYSTEM);
+ }
+ }
+ break;
}
}
catch (Exception&)
@@ -1176,9 +1192,8 @@ class EventsNameReplace_Impl:
//------------------------------------------------------------------------
void OPropertyBrowserController::connectRowset()
{
- // if we have a previous connection, dispose it
- if ( haveRowsetConnection() )
- cleanupRowsetConnection();
+ // if we have an own previous connection, dispose it
+ cleanupRowsetConnection();
SQLExceptionInfo aErrorInfo;
try
@@ -1270,7 +1285,7 @@ class EventsNameReplace_Impl:
if ( _bInit )
aProperty.sValue = GetPropertyValue(PROPERTY_COMMAND);
- if ( _bConnect )
+ if ( _bConnect)
connectRowset();
////////////////////////////////////////////////////////////
@@ -1306,6 +1321,15 @@ class EventsNameReplace_Impl:
DBG_ERROR("OPropertyBrowserController::SetCursorSource : caught an exception !")
}
}
+ //------------------------------------------------------------------------
+ sal_Bool OPropertyBrowserController::haveRowsetConnection( ) const
+ {
+ Reference< XConnection > xConnection = m_xRowsetConnection;
+ Reference< XPropertySet > xProps( getRowSet( ), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConnection;
+ return xConnection.is();
+ }
//------------------------------------------------------------------------
void OPropertyBrowserController::SetListSource(sal_Bool bInit)
@@ -2030,6 +2054,11 @@ class EventsNameReplace_Impl:
|| ( nControlType == CONTROL_TYPE_DIALOG && !bIsVisibleForDialogs )
)
continue;
+ if ( nPropId == PROPERTY_ID_DATASOURCE )
+ {
+ if ( m_xPropValueAccess.is() && ::dbtools::getActiveConnectionFromParent(m_xPropValueAccess).is() )
+ continue;
+ }
pProperty = new OLineDescriptor();
@@ -2574,16 +2603,26 @@ class EventsNameReplace_Impl:
// DataSource
case PROPERTY_ID_DATASOURCE:
{
+ pProperty->nUniqueButtonId = UID_PROP_DLG_ATTR_DATASOURCE;
+ // if the form already belong to a Database, don't set this property
+ Reference< XInterface > xInter;
+ m_aIntrospectee >>= xInter;
+
pProperty->eControlType = BCT_COMBOBOX;
+ if ( xInter.is() && ::dbtools::getActiveConnectionFromParent(xInter).is() )
+ {
+ nPropertyUIFlags = nPropertyUIFlags & ~(PROP_FLAG_FORM_VISIBLE | PROP_FLAG_DIALOG_VISIBLE);
+ getPropertyBox()->EnablePropertyLine( PROPERTY_DATASOURCE, sal_False );
+ }
+
Reference< XNameAccess > xDatabaseContext(m_xORB->createInstance(SERVICE_DATABASE_CONTEXT), UNO_QUERY);
if (xDatabaseContext.is())
{
Sequence< ::rtl::OUString > aDatasources = xDatabaseContext->getElementNames();
const ::rtl::OUString* pBegin = aDatasources.getConstArray();
const ::rtl::OUString* pEnd = pBegin + aDatasources.getLength();
- for (; pBegin != pEnd;++pBegin)
- pProperty->aListValues.push_back(*pBegin);
+ pProperty->aListValues.insert(pProperty->aListValues.begin(),pBegin,pEnd);
}
}
break;
@@ -2790,6 +2829,39 @@ class EventsNameReplace_Impl:
OnImageURLClicked( aName, aVal, pData );
break;
+ //////////////////////////////////////////////////////////////////////
+ // Bei Datenquelle auch Cursor-/ListSource fuellen
+ case PROPERTY_ID_DATASOURCE:
+ {
+ String aUserVal=aVal;
+
+ ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK);
+
+ INetURLObject aParser( aVal );
+ if ( INET_PROT_FILE == aParser.GetProtocol() )
+ // set the initial directory only for file-URLs. Everything else
+ // is considered to be potentially expensive
+ // 106126 - 2002/12/10 - fs@openoffice.org
+ aFileDlg.SetDisplayDirectory( aVal );
+
+ static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)");
+ const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType);
+ OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
+ if ( pFilter )
+ {
+ aFileDlg.AddFilter(pFilter->GetFilterName(),pFilter->GetDefaultExtension());
+ }
+
+ if (0 == aFileDlg.Execute())
+ {
+ String aDataSource = aFileDlg.GetPath();
+ Commit( aName, aDataSource, pData );
+ }
+ }
+ break;
+
+ //////////////////////////////////////////////////////////////////////
+ // Color
case PROPERTY_ID_BACKGROUNDCOLOR:
case PROPERTY_ID_FILLCOLOR:
case PROPERTY_ID_SYMBOLCOLOR:
@@ -3068,7 +3140,18 @@ class EventsNameReplace_Impl:
sal_Bool bFlag= !(aProp.Attributes & PropertyAttribute::MAYBEVOID) && !aValue.hasValue();
if (!bFlag)
+ {
+ ::rtl::OUString sDataSource;
+ aValue >>= sDataSource;
+ Reference< XNameAccess > xDatabaseContext(m_xORB->createInstance(SERVICE_DATABASE_CONTEXT), UNO_QUERY);
+ if ( !xDatabaseContext.is() || !xDatabaseContext->hasByName(sDataSource) )
+ {
+ ::svt::OFileNotation aTransformer(sDataSource);
+ sDataSource = aTransformer.get(::svt::OFileNotation::N_URL);
+ aValue <<= sDataSource;
+ }
m_xPropValueAccess->setPropertyValue(rName, aValue );
+ }
if (m_xPropStateAccess.is()&& !aValue.hasValue())
{