diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-02-11 07:55:30 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-02-11 07:55:30 +0100 |
commit | 55aca7c428f0e9ee71a42d773d7df9036b4c8210 (patch) | |
tree | b878ae289c8a4dbea20bd71d38ade6eb018a12d2 /reportdesign | |
parent | 66a73b89dffcc55836e4da5f0d9450d89d692a07 (diff) | |
parent | df47580367cd8a021233ef23ab9b0e1d65b54d83 (diff) |
automated merge from dba33e
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/report/FormattedFieldBeautifier.cxx | 50 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 35 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionWindow.cxx | 19 |
11 files changed, 223 insertions, 57 deletions
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 14118e0baaad..8fa311c5d6ed 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -459,7 +459,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 741adba34974..48c5d8fe6255 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -145,9 +145,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 6beebfcb30c8..b0e284b6960d 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -50,6 +50,8 @@ #include "CondFormat.hrc" #include "ModuleHelper.hxx" #include "uistrings.hrc" +#include "ColumnInfo.hxx" + #include <comphelper/property.hxx> #include <svtools/imgdef.hxx> @@ -69,6 +71,7 @@ using namespace beans; using namespace lang; using namespace container; using namespace ::svx; + class OAddFieldWindowListBox : public SvTreeListBox { OAddFieldWindow* m_pTabWin; @@ -229,6 +232,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 pModel->GetEntry(i)->GetUserData(); + } + } if (m_pChangeListener.is()) m_pChangeListener->dispose(); if ( m_pContainerListener.is() ) @@ -284,7 +296,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) ); + } } } @@ -331,7 +360,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); @@ -429,10 +458,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); } } // ----------------------------------------------------------------------------- @@ -441,8 +471,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) ); + } } } // ----------------------------------------------------------------------------- @@ -452,7 +491,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 2f20d75c3fa4..5af42bf61a0d 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -52,6 +52,7 @@ #include "UndoActions.hxx" #include "uistrings.hrc" #include "ReportController.hxx" +#include "ColumnInfo.hxx" #include <cppuhelper/implbase1.hxx> #include <comphelper/property.hxx> @@ -73,6 +74,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 @@ -80,6 +100,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; @@ -335,13 +356,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() @@ -480,7 +495,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) sExpression = m_pComboCell->GetText(); else { - sExpression = m_pComboCell->GetEntry(nPos); + sExpression = m_aColumnInfo[nPos].sColumnName; } xGroup->setExpression( sExpression ); @@ -519,7 +534,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&) { @@ -1311,10 +1337,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 5c835d983ff3..46599b76ace6 100644 --- a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx +++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx @@ -36,7 +36,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 fc26581ba37d..441121d7a471 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -105,7 +105,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 03ccda9d2209..28b64f2adf02 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -116,6 +116,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> @@ -474,6 +476,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/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx index b0c5922556ab..0e5b0ebb45a9 100644 --- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -91,39 +91,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 817f88adf3cb..556f94818c70 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -354,6 +354,8 @@ void OReportController::disposing() try { + m_xHoldAlive.clear(); + m_xColumns.clear(); ::comphelper::disposeComponent( m_xRowSet ); ::comphelper::disposeComponent( m_xRowSetMediator ); ::comphelper::disposeComponent( m_xFormatter ); @@ -2303,6 +2305,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 ( !m_pMyOwnView->isAddFieldVisible() && isUiVisible() ) m_pMyOwnView->toggleAddField(); @@ -3567,6 +3571,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 { @@ -3574,6 +3582,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; @@ -3592,7 +3602,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 @@ -4378,3 +4388,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/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index a781a9f654d7..686a6515854a 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -32,7 +32,6 @@ #include "ReportWindow.hxx" #include "ReportRuler.hxx" #include "rptui_slotid.hrc" -#include <svtools/colorcfg.hxx> #include "ReportController.hxx" #include "SectionView.hxx" #include "RptDef.hxx" @@ -41,13 +40,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 { @@ -195,8 +197,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) ) |