User: ihi Date: 2007-11-20 19:08:27+0000 Modified: dba/reportdesign/source/ui/dlg/Navigator.cxx
Log: INTEGRATION: CWS reportdesign01 (1.3.20); FILE MERGED 2007/10/11 07:45:16 oj 1.3.20.3: #i77604# handle scope 2007/10/09 08:27:17 oj 1.3.20.2: #i77604# impl add function 2007/10/05 11:51:07 oj 1.3.20.1: #i77604# impl method to add functions more simpler File Changes: Directory: /dba/reportdesign/source/ui/dlg/ =========================================== File [changed]: Navigator.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/dlg/Navigator.cxx?r1=1.3&r2=1.4 Delta lines: +51 -32 --------------------- --- Navigator.cxx 2007-08-03 10:00:48+0000 1.3 +++ Navigator.cxx 2007-11-20 19:08:24+0000 1.4 @@ -140,10 +140,12 @@ return nId; } // ----------------------------------------------------------------------------- -::rtl::OUString lcl_getName(const uno::Reference< report::XReportComponent>& _xElement) +::rtl::OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElement) { OSL_ENSURE(_xElement.is(),"Found report element which is NULL!"); - ::rtl::OUStringBuffer sName = _xElement->getName(); + ::rtl::OUString sTempName; + _xElement->getPropertyValue(PROPERTY_NAME) >>= sTempName; + ::rtl::OUStringBuffer sName = sTempName; uno::Reference< report::XFixedText> xFixedText(_xElement,uno::UNO_QUERY); uno::Reference< report::XReportControlModel> xReportModel(_xElement,uno::UNO_QUERY); if ( xFixedText.is() ) @@ -151,7 +153,7 @@ sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : "))); sName.append(xFixedText->getLabel()); } - else if ( xReportModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) ) + else if ( xReportModel.is() && _xElement->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) ) { ReportFormula aFormula( xReportModel->getDataField() ); if ( aFormula.isValid() ) @@ -226,7 +228,6 @@ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ); // OSelectionChangeListener - virtual void _selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException); virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException); // OPropertyChangeListener @@ -244,6 +245,8 @@ DECL_LINK(OnEntrySelDesel, NavigatorTree*); DECL_LINK( OnDropActionTimer, void* ); + virtual void _selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException); + // ITraverseReport virtual void traverseReport(const uno::Reference< report::XReportDefinition>& _xReport); virtual void traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions); @@ -594,7 +597,7 @@ { uno::Reference< report::XReportComponent> xElement(_xSection->getByIndex(i),uno::UNO_QUERY); OSL_ENSURE(xElement.is(),"Found report element which is NULL!"); - insertEntry(lcl_getName(xElement),pSection,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xElement)); + insertEntry(lcl_getName(xElement.get()),pSection,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xElement)); uno::Reference< report::XReportDefinition> xSubReport(xElement,uno::UNO_QUERY); if ( xSubReport.is() ) { @@ -767,9 +770,9 @@ else { uno::Reference< report::XReportComponent> xElement(xProp,uno::UNO_QUERY); - if ( xElement.is() ) - sName = lcl_getName(xElement); - insertEntry(sName,pEntry,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xProp)); + if ( xProp.is() ) + sName = lcl_getName(xProp); + insertEntry(sName,pEntry,(!xElement.is() ? USHORT(SID_RPT_NEW_FUNCTION) : lcl_getImageId(xElement)),LIST_APPEND,new UserData(this,xProp)); } if ( !IsExpanded(pEntry) ) Expand(pEntry); @@ -844,6 +847,10 @@ m_pListener->addProperty(PROPERTY_NAME); else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) ) m_pListener->addProperty(PROPERTY_EXPRESSION); + if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) ) + m_pListener->addProperty(PROPERTY_DATAFIELD); + if ( xInfo->hasPropertyByName(PROPERTY_LABEL) ) + m_pListener->addProperty(PROPERTY_LABEL); if ( xInfo->hasPropertyByName(PROPERTY_HEADERON) ) m_pListener->addProperty(PROPERTY_HEADERON); if ( xInfo->hasPropertyByName(PROPERTY_FOOTERON) ) @@ -872,6 +879,8 @@ SvLBoxEntry* pEntry = m_pTree->find(_rEvent.Source); OSL_ENSURE(pEntry,"No entry could be found! Why not!"); const bool bFooterOn = (PROPERTY_FOOTERON == _rEvent.PropertyName); + try + { if ( bFooterOn || PROPERTY_HEADERON == _rEvent.PropertyName ) { sal_Int32 nPos = 1; @@ -895,12 +904,20 @@ //else // m_pTree->removeEntry(m_pTree->GetEntry(pEntry,nPos)); } - else if ( PROPERTY_NAME == _rEvent.PropertyName || PROPERTY_EXPRESSION == _rEvent.PropertyName) + else if ( PROPERTY_EXPRESSION == _rEvent.PropertyName) { ::rtl::OUString sNewName; _rEvent.NewValue >>= sNewName; m_pTree->SetEntryText(pEntry,sNewName); } + else if ( PROPERTY_DATAFIELD == _rEvent.PropertyName || PROPERTY_LABEL == _rEvent.PropertyName || PROPERTY_NAME == _rEvent.PropertyName ) + { + uno::Reference<beans::XPropertySet> xProp(_rEvent.Source,uno::UNO_QUERY); + m_pTree->SetEntryText(pEntry,lcl_getName(xProp)); + } + } + catch(uno::Exception) + {} } // ----------------------------------------------------------------------------- void NavigatorTree::UserData::_elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException) @@ -946,6 +963,8 @@ reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get()); aVisitor.start(m_xReport); m_pNavigatorTree->Expand(m_pNavigatorTree->find(m_xReport)); + lang::EventObject aEvent(*m_pController); + m_pNavigatorTree->_selectionChanged(aEvent); } //------------------------------------------------------------------------ ONavigatorImpl::~ONavigatorImpl() --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
