Tag: cws_src680_hsqlcsv User: fs Date: 2006/12/17 23:53:00 Modified: dba/dbaccess/source/ui/browser/unodatbr.cxx
Log: RESYNC: (1.180-1.184); FILE MERGED File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: unodatbr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.176.20.2&r2=1.176.20.3 Delta lines: +56 -52 --------------------- --- unodatbr.cxx 11 Oct 2006 08:57:14 -0000 1.176.20.2 +++ unodatbr.cxx 18 Dec 2006 07:52:57 -0000 1.176.20.3 @@ -145,6 +145,9 @@ #ifndef _COM_SUN_STAR_FORM_XFORM_HPP_ #include <com/sun/star/form/XForm.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_VISUALEFFECT_HPP_ +#include <com/sun/star/awt/VisualEffect.hpp> +#endif #ifndef _COM_SUN_STAR_AWT_LINEENDFORMAT_HPP_ #include <com/sun/star/awt/LineEndFormat.hpp> #endif @@ -187,6 +190,9 @@ #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> #endif +#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ +#include <com/sun/star/beans/NamedValue.hpp> +#endif #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> #endif @@ -327,6 +333,7 @@ #include <memory> using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -538,10 +545,10 @@ { // create controls and set sizes - const long nFrameWidth = getBrowserView()->LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width(); m_pSplitter = new Splitter(getBrowserView(),WB_HSCROLL); - m_pSplitter->SetPosSizePixel( Point(0,0), Size(nFrameWidth,0) ); + m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) ); m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) ); m_pTreeView = new DBTreeView(getBrowserView(),m_xMultiServiceFacatory, WB_TABSTOP | WB_BORDER); @@ -553,7 +560,7 @@ m_pTreeView->SetHelpId(HID_CTL_TREEVIEW); // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide - m_pSplitter->SetSplitPosPixel( getBrowserView()->LogicToPixel( Size( 80, 0 ), MAP_APPFONT ).Width() ); + m_pSplitter->SetSplitPosPixel( getBrowserView()->LogicToPixel( ::Size( 80, 0 ), MAP_APPFONT ).Width() ); getBrowserView()->setSplitter(m_pSplitter); getBrowserView()->setTreeView(m_pTreeView); @@ -564,7 +571,6 @@ m_pTreeModel->SetCompareHdl(LINK(this, SbaTableQueryBrowser, OnTreeEntryCompare)); m_pTreeView->setModel(m_pTreeModel); m_pTreeView->setSelectHdl(LINK(this, SbaTableQueryBrowser, OnSelectEntry)); - m_pTreeView->getListBox()->SetDoubleClickHdl(LINK(this, SbaTableQueryBrowser, OnEntryDoubleClicked)); // TODO getBrowserView()->getVclControl()->GetDataWindow().SetUniqueId(UID_DATABROWSE_DATAWINDOW); @@ -656,7 +662,6 @@ { try { - Reference< ::com::sun::star::form::XGridColumnFactory > xColFactory(xGrid, UNO_QUERY); Reference< XNameContainer > xColContainer(xGrid, UNO_QUERY); clearGridColumns( xColContainer ); @@ -749,21 +754,27 @@ && ::cppu::any2bool(xColumn->getPropertyValue(PROPERTY_ISROWVERSION))) continue; - sal_Bool bIsFormatted = sal_False; sal_Bool bFormattedIsNumeric = sal_True; sal_Int32 nType = comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); + + ::std::vector< NamedValue > aInitialValues; + ::std::vector< ::rtl::OUString > aCopyProperties; + switch(nType) { case DataType::BIT: case DataType::BOOLEAN: aCurrentModelType = ::rtl::OUString::createFromAscii("CheckBox"); + aInitialValues.push_back( NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) ), makeAny( VisualEffect::FLAT ) ) ); sPropertyName = PROPERTY_DEFAULTSTATE; break; + case DataType::LONGVARCHAR: + aInitialValues.push_back( NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), makeAny( (sal_Bool)sal_True ) ) ); + // NO break! case DataType::BINARY: case DataType::VARBINARY: case DataType::LONGVARBINARY: - case DataType::LONGVARCHAR: aCurrentModelType = ::rtl::OUString::createFromAscii("TextField"); sPropertyName = PROPERTY_DEFAULTTEXT; break; @@ -771,32 +782,28 @@ case DataType::VARCHAR: case DataType::CHAR: bFormattedIsNumeric = sal_False; - // _NO_ break ! + // NO break! default: aCurrentModelType = ::rtl::OUString::createFromAscii("FormattedField"); - bIsFormatted = sal_True; sPropertyName = PROPERTY_EFFECTIVEDEFAULT; + + if ( xSupplier.is() ) + aInitialValues.push_back( NamedValue( ::rtl::OUString::createFromAscii( "FormatsSupplier" ), makeAny( xSupplier ) ) ); + aInitialValues.push_back( NamedValue( ::rtl::OUString::createFromAscii( "TreatAsNumber" ), makeAny( (sal_Bool)bFormattedIsNumeric ) ) ); + aCopyProperties.push_back( PROPERTY_FORMATKEY ); break; } + aInitialValues.push_back( NamedValue( PROPERTY_CONTROLSOURCE, makeAny( *pIter ) ) ); + aInitialValues.push_back( NamedValue( PROPERTY_LABEL, makeAny( *pIter ) ) ); + Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(aCurrentModelType); Reference< XPropertySetInfo > xColumnPropertyInfo = xCurrentCol->getPropertySetInfo(); - xCurrentCol->setPropertyValue(PROPERTY_CONTROLSOURCE, makeAny(*pIter)); - xCurrentCol->setPropertyValue(PROPERTY_LABEL, makeAny(*pIter)); - if (bIsFormatted) - { - if (xSupplier.is()) - xCurrentCol->setPropertyValue(::rtl::OUString::createFromAscii("FormatsSupplier"), makeAny(xSupplier)); - xCurrentCol->setPropertyValue(PROPERTY_FORMATKEY, xColumn->getPropertyValue(PROPERTY_FORMATKEY)); - xCurrentCol->setPropertyValue(::rtl::OUString::createFromAscii("TreatAsNumber"), ::cppu::bool2any(bFormattedIsNumeric)); - } - - if ( DataType::LONGVARCHAR == nType ) - xCurrentCol->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), makeAny( (sal_Bool)sal_True ) ); + // calculate the default Any aDefault; sal_Bool bDefault = xColumnPropertyInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT); - if(bDefault) + if ( bDefault ) aDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT); // default value @@ -809,26 +816,34 @@ } - if(aDefault.hasValue()) - xCurrentCol->setPropertyValue(sPropertyName, aDefault); + if ( aDefault.hasValue() ) + aInitialValues.push_back( NamedValue( sPropertyName, aDefault ) ); // transfer properties from the definition to the UNO-model : - // ... the hidden flag - xCurrentCol->setPropertyValue(PROPERTY_HIDDEN, xColumn->getPropertyValue(PROPERTY_HIDDEN)); + aCopyProperties.push_back( PROPERTY_HIDDEN ); + aCopyProperties.push_back( PROPERTY_WIDTH ); - // ... the initial colum width - xCurrentCol->setPropertyValue(PROPERTY_WIDTH, xColumn->getPropertyValue(PROPERTY_WIDTH)); + Any aDescription; aDescription <<= ::rtl::OUString(); + if ( xColumn->getPropertySetInfo()->hasPropertyByName( PROPERTY_HELPTEXT ) ) + aDescription <<= ::comphelper::getString( xColumn->getPropertyValue( PROPERTY_HELPTEXT ) ); + aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) ); // ... horizontal justify - xCurrentCol->setPropertyValue(PROPERTY_ALIGN, makeAny(sal_Int16(::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_ALIGN))))); - - // ... the 'comment' property as helptext (will usually be shown as header-tooltip) - - Any aDescription; aDescription <<= ::rtl::OUString(); - if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT)) - aDescription <<= comphelper::getString(xColumn->getPropertyValue(PROPERTY_HELPTEXT)); + aInitialValues.push_back( NamedValue( PROPERTY_ALIGN, makeAny( sal_Int16( ::comphelper::getINT32( xColumn->getPropertyValue( PROPERTY_ALIGN ) ) ) ) ) ); - xCurrentCol->setPropertyValue(PROPERTY_HELPTEXT, aDescription); + // now set all those values + for ( ::std::vector< NamedValue >::const_iterator property = aInitialValues.begin(); + property != aInitialValues.end(); + ++property + ) + { + xCurrentCol->setPropertyValue( property->Name, property->Value ); + } + for ( ::std::vector< ::rtl::OUString >::const_iterator copyPropertyName = aCopyProperties.begin(); + copyPropertyName != aCopyProperties.end(); + ++copyPropertyName + ) + xCurrentCol->setPropertyValue( *copyPropertyName, xColumn->getPropertyValue( *copyPropertyName ) ); xColContainer->insertByName(*pIter, makeAny(xCurrentCol)); } @@ -1129,6 +1144,8 @@ String sId; FilterByEntryDataId( const String& _rId ) : sId( _rId ) { } + virtual ~FilterByEntryDataId() {} + virtual bool includeEntry( SvLBoxEntry* _pEntry ) const; }; @@ -2259,19 +2276,6 @@ return bSuccess; } //------------------------------------------------------------------------------ -IMPL_LINK(SbaTableQueryBrowser, OnEntryDoubleClicked, SvLBoxEntry*, /*_pEntry*/) -{ - SvLBoxEntry* pSelected = m_pTreeView->getListBox()->FirstSelected(); - if (!pSelected) - { - DBG_ERROR("SbaTableQueryBrowser::OnEntryDoubleClicked: invalid selection!"); - return 0L; - } - - return 1L; -}; - -//------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect) { // extract the props @@ -2436,7 +2440,7 @@ Reference<XPropertySet> xRowSetProps(getRowSet(),UNO_QUERY); ::rtl::OUString aOldName; xRowSetProps->getPropertyValue(PROPERTY_COMMAND) >>= aOldName; - sal_Int32 nOldType; + sal_Int32 nOldType = 0; xRowSetProps->getPropertyValue(PROPERTY_COMMANDTYPE) >>= nOldType; Reference<XConnection> xOldConnection; ::cppu::extractInterface(xOldConnection,xRowSetProps->getPropertyValue(PROPERTY_ACTIVECONNECTION)); @@ -3471,7 +3475,7 @@ // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent ) { - Point aPosition; + ::Point aPosition; SvLBoxEntry* pEntry = NULL; SvLBoxEntry* pOldSelection = NULL; if (_rEvent.IsMouseEvent()) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
