diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-21 11:54:03 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-21 11:54:03 +0100 |
commit | ff323b9a64db6a9977b5cdf33cf7b58e6915b9b7 (patch) | |
tree | 4f5ed7f9a286ab7fc4c2a9ccafed9c7ecba434ea /extensions | |
parent | e2d9dd6fb86e50b45f2e7e838b5b0cd230bebef4 (diff) | |
parent | 4e40ca1e8ba821e164c32578aeee43673d0d4966 (diff) |
dba33e: merge to m70
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 32 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.hxx | 9 | ||||
-rw-r--r-- | extensions/source/propctrlr/propres.src | 5 | ||||
-rw-r--r-- | extensions/source/propctrlr/propresid.hrc | 3 | ||||
-rw-r--r-- | extensions/source/propctrlr/usercontrol.cxx | 58 | ||||
-rw-r--r-- | extensions/source/propctrlr/usercontrol.hxx | 3 |
6 files changed, 82 insertions, 28 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 440d5237f3b1..59d7bb702f83 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -33,6 +33,7 @@ #include "controltype.hxx" #include "propctrlr.hrc" +#include "extensio.hrc" #include "fontdialog.hxx" #include "formcomponenthandler.hxx" #include "formlinkdialog.hxx" @@ -2538,17 +2539,38 @@ namespace pcr Reference< XQueriesSupplier > xSupplyQueries( m_xRowSetConnection, UNO_QUERY ); Reference< XNameAccess > xQueryNames; if ( xSupplyQueries.is() ) + { xQueryNames = xSupplyQueries->getQueries(); - DBG_ASSERT( xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); - if ( !xQueryNames.is() ) + impl_fillQueryNames_throw(xQueryNames,_out_rNames); + } + } + //------------------------------------------------------------------------ + void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,::std::vector< ::rtl::OUString >& _out_rNames,const ::rtl::OUString& _sName ) const + { + DBG_ASSERT( _xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); + if ( !_xQueryNames.is() ) return; - Sequence< ::rtl::OUString> aQueryNames = xQueryNames->getElementNames(); + Sequence< ::rtl::OUString> aQueryNames = _xQueryNames->getElementNames(); sal_uInt32 nCount = aQueryNames.getLength(); const ::rtl::OUString* pQueryNames = aQueryNames.getConstArray(); + sal_Bool bAdd = _sName.getLength(); for ( sal_uInt32 i=0; i<nCount; i++, ++pQueryNames ) - _out_rNames.push_back( *pQueryNames ); + { + ::rtl::OUStringBuffer sTemp; + if ( bAdd ) + { + sTemp.append(_sName); + sTemp.appendAscii("/"); + } + sTemp.append(*pQueryNames); + Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(*pQueryNames),UNO_QUERY); + if ( xSubQueries.is() ) + impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); + else + _out_rNames.push_back( sTemp.makeStringAndClear() ); + } } //------------------------------------------------------------------------ @@ -2710,7 +2732,7 @@ namespace pcr SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter(); double dPreviewVal = OFormatSampleControl::getPreviewValue(pFormatter,nFormatKey); - SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, SID_ATTR_NUMBERFORMAT_INFO ); + SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, String( PcrRes( RID_STR_TEXT_FORMAT ) ), SID_ATTR_NUMBERFORMAT_INFO ); aCoreSet.Put( aFormatter ); // a tab dialog with a single page diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index 9b972896e856..d02a05c8e650 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -238,6 +238,15 @@ namespace pcr */ void impl_fillQueryNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const; + /** describes the UI for selecting a query name + + @precond + m_xRowSetConnection is not <NULL/> + */ + void impl_fillQueryNames_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xQueryNames + ,::std::vector< ::rtl::OUString >& _out_rNames + ,const ::rtl::OUString& _sName = ::rtl::OUString() ) const; + /** describes the UI for selecting a ListSource (for list-like form controls) @precond ->m_xRowSetConnection is not <NULL/> diff --git a/extensions/source/propctrlr/propres.src b/extensions/source/propctrlr/propres.src index 7ce673f8136f..6d2729f12625 100644 --- a/extensions/source/propctrlr/propres.src +++ b/extensions/source/propctrlr/propres.src @@ -64,3 +64,8 @@ String RID_EMBED_IMAGE_PLACEHOLDER { Text [ en-US ] = "<Embedded-Image>"; }; + +String RID_STR_TEXT_FORMAT +{ + Text [ en-US ] = "Text"; +}; diff --git a/extensions/source/propctrlr/propresid.hrc b/extensions/source/propctrlr/propresid.hrc index 338b0eebab88..9bbd490478a7 100644 --- a/extensions/source/propctrlr/propresid.hrc +++ b/extensions/source/propctrlr/propresid.hrc @@ -45,6 +45,7 @@ #define RID_STR_PROPPAGE_DEFAULT ( RID_PROPCONTROLLER_START + 1 ) #define RID_STR_PROPPAGE_DATA ( RID_PROPCONTROLLER_START + 2 ) #define RID_STR_HELP_SECTION_LABEL ( RID_PROPCONTROLLER_START + 3 ) -#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 5 ) +#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 4 ) +#define RID_STR_TEXT_FORMAT ( RID_PROPCONTROLLER_START + 5 ) #endif // EXTENSIONS_PROPRESID_HRC diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx index b27afa750fa6..b153369f3a6d 100644 --- a/extensions/source/propctrlr/usercontrol.cxx +++ b/extensions/source/propctrlr/usercontrol.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/util/Time.hpp> #include "modulepcr.hxx" #include "propresid.hrc" + //............................................................................ namespace pcr { @@ -118,39 +119,52 @@ namespace pcr getTypedControlWindow()->SetFormatKey( nFormatKey ); SvNumberFormatter* pNF = getTypedControlWindow()->GetFormatter(); - getTypedControlWindow()->SetValue( getPreviewValue(pNF,getTypedControlWindow()->GetFormatKey()) ); + const SvNumberformat* pEntry = pNF->GetEntry( nFormatKey ); + OSL_ENSURE( pEntry, "OFormatSampleControl::setValue: invalid format entry!" ); + + const bool bIsTextFormat = ( pEntry && pEntry->IsTextFormat() ); + if ( bIsTextFormat ) + getTypedControlWindow()->SetText( String( PcrRes( RID_STR_TEXT_FORMAT ) ) ); + else + getTypedControlWindow()->SetValue( pEntry ? getPreviewValue( *pEntry ) : 1234.56789 ); } else getTypedControlWindow()->SetText( String() ); } //------------------------------------------------------------------ + double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry ) + { + double nValue = 1234.56789; + switch ( i_rEntry.GetType() & ~NUMBERFORMAT_DEFINED ) + { + case NUMBERFORMAT_DATE: + { + Date aCurrentDate; + static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE); + } + break; + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_DATETIME: + { + Time aCurrentTime; + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); + } + break; + default: + break; + } + return nValue; + } + + //------------------------------------------------------------------ double OFormatSampleControl::getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey) { const SvNumberformat* pEntry = _pNF->GetEntry(_nFormatKey); DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); double nValue = 1234.56789; if ( pEntry ) - { - switch (pEntry->GetType() & ~NUMBERFORMAT_DEFINED) - { - case NUMBERFORMAT_DATE: - { - Date aCurrentDate; - static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE); - } - break; - case NUMBERFORMAT_TIME: - case NUMBERFORMAT_DATETIME: - { - Time aCurrentTime; - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); - } - break; - default: - break; - } - } + nValue = getPreviewValue( *pEntry ); return nValue; } //------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/usercontrol.hxx b/extensions/source/propctrlr/usercontrol.hxx index 0d9a0e5a85d7..3fca7e12324f 100644 --- a/extensions/source/propctrlr/usercontrol.hxx +++ b/extensions/source/propctrlr/usercontrol.hxx @@ -90,6 +90,9 @@ namespace pcr * \return current date or time or the value 1234.56789 */ static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey); + + private: + static double getPreviewValue( const SvNumberformat& i_rEntry ); }; //======================================================================== |