diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-06-04 14:23:34 +0200 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-06-04 14:23:34 +0200 |
commit | 9047cf03f401f5cfc26739aba28b69c0a9576a19 (patch) | |
tree | c2cd1ce9a53886aa915c4fcceb061763bd37db55 /reportdesign | |
parent | a6f95be55769fc3f4e0ec9152b28e4a3c4b9606d (diff) | |
parent | 4f7454a8da771afac145bb02c7682978b275c950 (diff) |
CWS-TOOLING: integrate CWS dba33f
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/core/api/Section.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlGroup.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/AddField.cxx | 57 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 49 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/ColumnInfo.hxx | 57 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx | 1 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/GroupsSorting.hxx | 1 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/ReportController.hxx | 5 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/ReportControllerObserver.hxx | 5 | ||||
-rw-r--r-- | reportdesign/source/ui/report/FormattedFieldBeautifier.cxx | 50 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 35 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportControllerObserver.cxx | 24 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionWindow.cxx | 19 |
13 files changed, 223 insertions, 86 deletions
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 130d54632f29..65040676e6d6 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -456,7 +456,7 @@ uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefiniti uno::Reference< report::XGroup > xGroup = m_xGroup; if ( !xRet.is() && xGroup.is() ) { - uno::Reference< report::XGroups> xGroups(xGroup->getParent(),uno::UNO_QUERY); + uno::Reference< report::XGroups> xGroups(xGroup->getGroups()); if ( xGroups.is() ) xRet = xGroups->getReportDefinition(); } diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index e6c001a9ce62..26d1b7f61252 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -142,9 +142,9 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport sInterval = sInterval.getToken(0,')',nIndex); m_xGroup->setGroupInterval(sInterval.toInt32()); } - else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:YEAR"))) + else if ( sFormula == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:YEAR"))) nGroupOn = report::GroupOn::YEAR; - else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH"))) + else if ( sFormula == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH"))) { nGroupOn = report::GroupOn::MONTH; } diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index dc6681bbd1e6..11de48113cee 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -47,6 +47,8 @@ #include "CondFormat.hrc" #include "ModuleHelper.hxx" #include "uistrings.hrc" +#include "ColumnInfo.hxx" + #include <comphelper/property.hxx> #include <svtools/imgdef.hxx> @@ -66,6 +68,7 @@ using namespace beans; using namespace lang; using namespace container; using namespace ::svx; + class OAddFieldWindowListBox : public SvTreeListBox { OAddFieldWindow* m_pTabWin; @@ -226,6 +229,15 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent //----------------------------------------------------------------------- OAddFieldWindow::~OAddFieldWindow() { + if ( m_pListBox.get() ) + { + SvLBoxTreeList* pModel = m_pListBox->GetModel(); + ULONG nCount = pModel->GetEntryCount(); + for(ULONG i = 0; i< nCount;++i) + { + delete static_cast<ColumnInfo*>(pModel->GetEntry(i)->GetUserData()); + } + } if (m_pChangeListener.is()) m_pChangeListener->dispose(); if ( m_pContainerListener.is() ) @@ -281,7 +293,24 @@ namespace const ::rtl::OUString* pEntries = _rEntries.getConstArray(); sal_Int32 nEntries = _rEntries.getLength(); for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) - _rListBox.InsertEntry( *pEntries ); + _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries) ); + } + void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns ) + { + uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames(); + const ::rtl::OUString* pEntries = aEntries.getConstArray(); + sal_Int32 nEntries = aEntries.getLength(); + for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + { + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) + xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; + if ( sLabel.getLength() ) + _rListBox.InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + else + _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + } } } @@ -328,7 +357,7 @@ void OAddFieldWindow::Update() m_xColumns = dbtools::getFieldsByCommandDescriptor( xCon, GetCommandType(), GetCommand(), m_xHoldAlive ); if ( m_xColumns.is() ) { - lcl_addToList( *m_pListBox, m_xColumns->getElementNames() ); + lcl_addToList( *m_pListBox, m_xColumns ); uno::Reference< container::XContainer> xContainer(m_xColumns,uno::UNO_QUERY); if ( xContainer.is() ) m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer); @@ -426,10 +455,11 @@ void OAddFieldWindow::fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessD _rDescriptor[ ::svx::daEscapeProcessing ] <<= GetEscapeProcessing(); _rDescriptor[ ::svx::daConnection ] <<= getConnection(); - ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected ); - _rDescriptor[ ::svx::daColumnName ] <<= sColumnName; - if ( m_xColumns->hasByName( sColumnName ) ) - _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(sColumnName); + ColumnInfo* pInfo = static_cast<ColumnInfo*>(_pSelected->GetUserData()); + // ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected ); + _rDescriptor[ ::svx::daColumnName ] <<= pInfo->sColumnName; + if ( m_xColumns->hasByName( pInfo->sColumnName ) ) + _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(pInfo->sColumnName); } } // ----------------------------------------------------------------------------- @@ -438,8 +468,17 @@ void OAddFieldWindow::_elementInserted( const container::ContainerEvent& _rEvent if ( m_pListBox.get() ) { ::rtl::OUString sName; - if ( _rEvent.Accessor >>= sName ) - m_pListBox->InsertEntry(sName); + if ( (_rEvent.Accessor >>= sName) && m_xColumns->hasByName(sName) ) + { + uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(sName),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) + xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; + if ( sLabel.getLength() ) + m_pListBox->InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(sName,sLabel) ); + else + m_pListBox->InsertEntry( sName,NULL,FALSE,LIST_APPEND,new ColumnInfo(sName,sLabel) ); + } } } // ----------------------------------------------------------------------------- @@ -449,7 +488,7 @@ void OAddFieldWindow::_elementRemoved( const container::ContainerEvent& /*_rEven { m_pListBox->Clear(); if ( m_xColumns.is() ) - lcl_addToList( *m_pListBox, m_xColumns->getElementNames() ); + lcl_addToList( *m_pListBox, m_xColumns ); } } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 7e83adbb4e49..d4ea5fa17a48 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -49,6 +49,7 @@ #include "UndoActions.hxx" #include "uistrings.hrc" #include "ReportController.hxx" +#include "ColumnInfo.hxx" #include <cppuhelper/implbase1.hxx> #include <comphelper/property.hxx> @@ -70,6 +71,25 @@ using namespace ::com::sun::star; using namespace svt; using namespace ::comphelper; + void lcl_addToList_throw( ComboBoxControl& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns ) + { + uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames(); + const ::rtl::OUString* pEntries = aEntries.getConstArray(); + sal_Int32 nEntries = aEntries.getLength(); + for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + { + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),uno::UNO_QUERY_THROW); + ::rtl::OUString sLabel; + if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) + xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; + o_aColumnList.push_back( ColumnInfo(*pEntries,sLabel) ); + if ( sLabel.getLength() ) + _rListBox.InsertEntry( sLabel ); + else + _rListBox.InsertEntry( *pEntries ); + } + } + typedef ::svt::EditBrowseBox OFieldExpressionControl_Base; typedef ::cppu::WeakImplHelper1< container::XContainerListener > TContainerListenerBase; class OFieldExpressionControl : public TContainerListenerBase @@ -77,6 +97,7 @@ class OFieldExpressionControl : public TContainerListenerBase { ::osl::Mutex m_aMutex; ::std::vector<sal_Int32> m_aGroupPositions; + ::std::vector<ColumnInfo> m_aColumnInfo; ::svt::ComboBoxControl* m_pComboCell; sal_Int32 m_nDataPos; sal_Int32 m_nCurrentPos; @@ -332,13 +353,7 @@ void OFieldExpressionControl::fillColumns(const uno::Reference< container::XName { m_pComboCell->Clear(); if ( _xColumns.is() ) - { - uno::Sequence< ::rtl::OUString> aColumnNames = _xColumns->getElementNames(); - const ::rtl::OUString* pIter = aColumnNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aColumnNames.getLength(); - for(;pIter != pEnd;++pIter) - m_pComboCell->InsertEntry(*pIter); - } // if ( _xColumns.is() ) + lcl_addToList_throw(*m_pComboCell,m_aColumnInfo,_xColumns); } //------------------------------------------------------------------------------ void OFieldExpressionControl::lateInit() @@ -477,7 +492,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) sExpression = m_pComboCell->GetText(); else { - sExpression = m_pComboCell->GetEntry(nPos); + sExpression = m_aColumnInfo[nPos].sColumnName; } xGroup->setExpression( sExpression ); @@ -516,7 +531,18 @@ String OFieldExpressionControl::GetCellText( long nRow, USHORT /*nColId*/ ) cons try { uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]); - sText = xGroup->getExpression(); + ::rtl::OUString sExpression = xGroup->getExpression(); + + for(::std::vector<ColumnInfo>::const_iterator aIter = m_aColumnInfo.begin(); aIter != m_aColumnInfo.end();++aIter) + { + if ( aIter->sColumnName == sExpression ) + { + if ( aIter->sLabel.getLength() ) + sExpression = aIter->sLabel; + break; + } + } + sText = sExpression; } catch(uno::Exception&) { @@ -1308,10 +1334,7 @@ void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _r // ----------------------------------------------------------------------------- void OGroupsSortingDialog::fillColumns() { - m_xColumns.clear(); - uno::Reference< report::XReportDefinition> xReport = m_pController->getReportDefinition(); - if ( xReport->getCommand().getLength() ) - m_xColumns = dbtools::getFieldsByCommandDescriptor(m_pController->getConnection(),xReport->getCommandType(),xReport->getCommand(),m_xHoldAlive); + m_xColumns = m_pController->getColumns(); m_pFieldExpression->fillColumns(m_xColumns); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/ui/inc/ColumnInfo.hxx b/reportdesign/source/ui/inc/ColumnInfo.hxx new file mode 100644 index 000000000000..392a141e6382 --- /dev/null +++ b/reportdesign/source/ui/inc/ColumnInfo.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AddField.cxx,v $ + * $Revision: 1.5 $ + * + * 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 RPTUI_COLUMNINFO_HXX +#define RPTUI_COLUMNINFO_HXX + +#include <rtl/ustring.hxx> + +namespace rptui +{ + struct ColumnInfo + { + ::rtl::OUString sColumnName; + ::rtl::OUString sLabel; + bool bColumn; + ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel) + : sColumnName(i_sColumnName) + , sLabel(i_sLabel) + , bColumn(true) + { + } + ColumnInfo(const ::rtl::OUString& i_sColumnName) + : sColumnName(i_sColumnName) + , bColumn(false) + { + } + }; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_COLUMNINFO_HXX diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx index dc0fc1eb61fd..84119777a160 100644 --- a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx +++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx @@ -33,7 +33,6 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/report/XReportComponent.hpp> -#include <com/sun/star/report/XFormattedField.hpp> /** === end UNO includes === **/ //#include <boost/noncopyable.hpp> diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx index efed98b7da00..6c2838b4ac08 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -102,7 +102,6 @@ class OGroupsSortingDialog : public FloatingWindow ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive; sal_Bool m_bReadOnly; private: DECL_LINK( OnControlFocusLost, Control* ); diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 761e07c13773..6694c81c999b 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -114,6 +114,8 @@ namespace rptui ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier + mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive; + mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; ::com::sun::star::awt::Size m_aVisualAreaSize; ::boost::shared_ptr<rptui::OReportModel> @@ -472,6 +474,9 @@ namespace rptui ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const; + ::rtl::OUString getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const; + private: virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager ); virtual void impl_initialize( ); diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx index f83cf406ea9d..5f7868c9fa14 100644 --- a/reportdesign/source/ui/inc/ReportControllerObserver.hxx +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -65,11 +65,6 @@ namespace rptui // do not allow copy OXReportControllerObserver(const OXReportControllerObserver&); OXReportControllerObserver& operator=(const OXReportControllerObserver&); - -// protected: - - void switchListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, sal_Bool _bStartListening); - virtual ~OXReportControllerObserver(); // UNO Object must have private destructor! public: OXReportControllerObserver(const OReportController& _rController); diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx index 2ce896a66afe..e44325dec05f 100644 --- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -88,39 +88,41 @@ namespace rptui void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< uno::XInterface >& _rxComponent ) { ::rtl::OUString sDataField; - uno::Reference< report::XReportComponent > xComponent; + uno::Reference< report::XReportComponent > xComponent( _rxComponent, uno::UNO_QUERY ); try { - // is it a formatted field? - uno::Reference< report::XFormattedField > xFormattedField( _rxComponent, uno::UNO_QUERY ); - if ( xFormattedField.is() ) + uno::Reference< report::XReportControlModel > xControlModel( xComponent, uno::UNO_QUERY ); + if ( xControlModel.is() ) { - sDataField = xFormattedField->getDataField(); - xComponent.set( xFormattedField.get() ); - } - else - { - // perhaps an image control? - uno::Reference< report::XImageControl > xImageControl( _rxComponent, uno::UNO_QUERY ); - if ( xImageControl.is() ) + sDataField = xControlModel->getDataField(); + + if ( sDataField.getLength() ) { - sDataField = xImageControl->getDataField(); - xComponent.set( xImageControl.get() ); + ReportFormula aFormula( sDataField ); + bool bSet = true; + if ( aFormula.getType() == ReportFormula::Field ) + { + const ::rtl::OUString sColumnName = aFormula.getFieldName(); + ::rtl::OUString sLabel = m_rReportController.getColumnLabel_throw(sColumnName); + if ( sLabel.getLength() ) + { + ::rtl::OUStringBuffer aBuffer; + aBuffer.appendAscii( "=" ); + aBuffer.append( sLabel ); + sDataField = aBuffer.makeStringAndClear(); + bSet = false; + } + } + if ( bSet ) + sDataField = aFormula.getEqualUndecoratedContent(); } } - if ( !xComponent.is() ) - return; - - if ( sDataField.getLength() ) - { - ReportFormula aFormula( sDataField ); - sDataField = aFormula.getEqualUndecoratedContent(); - } - setPlaceholderText( getVclWindowPeer( xComponent ), sDataField ); + if ( xComponent.is() ) + setPlaceholderText( getVclWindowPeer( xComponent ), sDataField ); } - catch (uno::Exception e) + catch (uno::Exception) { DBG_UNHANDLED_EXCEPTION(); } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 0b058d558f79..a5280b7d93a3 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -350,6 +350,8 @@ void OReportController::disposing() try { + m_xHoldAlive.clear(); + m_xColumns.clear(); ::comphelper::disposeComponent( m_xRowSet ); ::comphelper::disposeComponent( m_xRowSetMediator ); ::comphelper::disposeComponent( m_xFormatter ); @@ -2302,6 +2304,8 @@ void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEven || evt.PropertyName.equals( PROPERTY_FILTER ) ) { + m_xColumns.clear(); + m_xHoldAlive.clear(); InvalidateFeature(SID_FM_ADD_FIELD); if ( !getDesignView()->isAddFieldVisible() && isUiVisible() ) getDesignView()->toggleAddField(); @@ -3556,6 +3560,10 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) aPos.Y += xShapeProp->getHeight(); aPos.X += nShapeWidth; } + ::rtl::OUString sLabel; + if ( xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) + xField->getPropertyValue(PROPERTY_LABEL) >>= sLabel; + if (pSectionViews[0] != pSectionViews[1] && nOBJID == OBJ_DLG_FORMATTEDFIELD) // we want this nice feature only at FORMATTEDFIELD { @@ -3563,6 +3571,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) // pSectionViews[1].position.x = pSectionViews[0].position.x uno::Reference< report::XReportComponent> xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW); uno::Reference< report::XReportComponent> xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW); + if ( sLabel.getLength() ) + xShapePropTextField->setName(sLabel); awt::Point aPosLabel = xShapePropLabel->getPosition(); awt::Point aPosTextField = xShapePropTextField->getPosition(); aPosTextField.X = aPosLabel.X; @@ -3581,7 +3591,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) xShapePropLabel->setPosition(aPosLabel); } OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl[0]); - uno::Reference< report::XReportComponent> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW); + uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW); xShapeProp->setName(xShapeProp->getName() + sDefaultName ); for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) // insert controls @@ -4367,3 +4377,26 @@ embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepres { return embed::EmbedMapUnits::ONE_100TH_MM; } +// ----------------------------------------------------------------------------- +uno::Reference< container::XNameAccess > OReportController::getColumns() const +{ + if ( !m_xColumns.is() && m_xReportDefinition.is() && m_xReportDefinition->getCommand().getLength() ) + { + m_xColumns = dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition->getCommandType(),m_xReportDefinition->getCommand(),m_xHoldAlive); + } + return m_xColumns; +} +// ----------------------------------------------------------------------------- +::rtl::OUString OReportController::getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const +{ + ::rtl::OUString sLabel; + uno::Reference< container::XNameAccess > xColumns = getColumns(); + if ( xColumns.is() && xColumns->hasByName(i_sColumnName) ) + { + uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(i_sColumnName),uno::UNO_QUERY_THROW); + if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) + xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; + } + return sLabel; +} +// ----------------------------------------------------------------------------- diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx index d698074b5590..7c0f3a572be8 100644 --- a/reportdesign/source/ui/report/ReportControllerObserver.cxx +++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx @@ -180,30 +180,6 @@ public: return 0L; } - // ----------------------------------------------------------------------------- - void OXReportControllerObserver::switchListening(const uno::Reference< uno::XInterface >& _rxObject, sal_Bool _bStartListening) - { - try - { - uno::Reference< beans::XPropertySet > xProps( _rxObject, uno::UNO_QUERY ); - if ( xProps.is() ) - { - if ( _bStartListening ) - { - xProps->addPropertyChangeListener( ::rtl::OUString(), this ); - } - else - { - xProps->removePropertyChangeListener( ::rtl::OUString(), this ); - } - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - // XEventListener void SAL_CALL OXReportControllerObserver::disposing(const lang::EventObject& e) throw( uno::RuntimeException ) { diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index d0bbb2fd27a6..26ce8c13c2a6 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -29,7 +29,6 @@ #include "ReportWindow.hxx" #include "ReportRuler.hxx" #include "rptui_slotid.hrc" -#include <svtools/colorcfg.hxx> #include "ReportController.hxx" #include "SectionView.hxx" #include "RptDef.hxx" @@ -38,13 +37,16 @@ #include "uistrings.hrc" #include "helpids.hrc" #include "RptResId.hrc" +#include "StartMarker.hxx" +#include "EndMarker.hxx" +#include "ViewsWindow.hxx" + +#include <svtools/colorcfg.hxx> #include <boost/bind.hpp> #include <functional> #include <algorithm> #include <vcl/svapp.hxx> -#include "StartMarker.hxx" -#include "EndMarker.hxx" -#include "ViewsWindow.hxx" +#include <connectivity/dbtools.hxx> namespace rptui { @@ -192,8 +194,15 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ; if ( bRet ) { + ::rtl::OUString sExpression = _xGroup->getExpression(); + ::rtl::OUString sLabel = getViewsWindow()->getView()->getReportView()->getController().getColumnLabel_throw(sExpression); + if ( sLabel.getLength() ) + { + sExpression = sLabel; + } + String sTitle = String(ModuleRes(_nResId)); - sTitle.SearchAndReplace('#',_xGroup->getExpression()); + sTitle.SearchAndReplace('#',sExpression); m_aStartMarker.setTitle(sTitle); m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); } // if ( _pIsSectionOn(&aGroupHelper) ) |