diff options
Diffstat (limited to 'reportdesign')
46 files changed, 1048 insertions, 458 deletions
diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index 2223cf443051..ec9a5c4f5248 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -33,7 +33,7 @@ #include "dllapi.h" #include <com/sun/star/report/XReportDefinition.hpp> -#include <cppuhelper/compbase11.hxx> +#include <cppuhelper/compbase12.hxx> #include <cppuhelper/basemutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -41,13 +41,15 @@ #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XModule.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> #include <cppuhelper/propertysetmixin.hxx> #include <comphelper/uno3.hxx> #include <comphelper/embeddedobjectcontainer.hxx> #include <svx/unomod.hxx> -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/frame/XModule.hpp> + #include "ReportHelperDefines.hxx" #include <boost/shared_ptr.hpp> @@ -63,7 +65,7 @@ namespace comphelper namespace reportdesign { class OReportComponentProperties; - typedef ::cppu::WeakComponentImplHelper11< com::sun::star::report::XReportDefinition + typedef ::cppu::WeakComponentImplHelper12< com::sun::star::report::XReportDefinition ,com::sun::star::document::XEventBroadcaster ,com::sun::star::lang::XServiceInfo ,com::sun::star::frame::XModule @@ -73,6 +75,7 @@ namespace reportdesign ,::com::sun::star::frame::XTitleChangeBroadcaster ,::com::sun::star::frame::XUntitledNumbers ,::com::sun::star::document::XDocumentPropertiesSupplier + ,::com::sun::star::datatransfer::XTransferable ,SvxUnoDrawMSFactory> ReportDefinitionBase; typedef ::cppu::PropertySetMixin<com::sun::star::report::XReportDefinition> ReportDefinitionPropertySet; @@ -145,6 +148,17 @@ namespace reportdesign ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper_throw(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUntitledNumbers > impl_getUntitledHelper_throw(); + + /** loads the report definition from the given storage + @precond + our mutex is locked + @throws + */ + void impl_loadFromStorage_nolck_throw( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments + ); + protected: virtual ~OReportDefinition(); @@ -359,6 +373,11 @@ namespace reportdesign // XDocumentPropertiesSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > SAL_CALL getDocumentProperties( ) throw (::com::sun::star::uno::RuntimeException); + // XTransferable + virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::uno::RuntimeException); + // comphelper::IEmbeddedHelper virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const; virtual ::comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const; @@ -366,19 +385,6 @@ namespace reportdesign virtual bool isEnableSetModified() const; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const; - - private: - /** loads the report definition from the given storage - - @precond - our mutex is locked - @throws - */ - void impl_loadFromStorage_nolck_throw( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments - ); - }; // ============================================================================= } // namespace reportdesign diff --git a/reportdesign/inc/ReportHelperDefines.hxx b/reportdesign/inc/ReportHelperDefines.hxx index 939c98115b9f..6be7ae969300 100644 --- a/reportdesign/inc/ReportHelperDefines.hxx +++ b/reportdesign/inc/ReportHelperDefines.hxx @@ -143,8 +143,8 @@ virtual void SAL_CALL setCharRotation( ::sal_Int16 _charrotation ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::sal_Int16 SAL_CALL getCharScaleWidth() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual void SAL_CALL setCharScaleWidth( ::sal_Int16 _charscalewidth ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ - virtual ::sal_Int16 SAL_CALL getParaVertAlignment() throw (::com::sun::star::uno::RuntimeException);\ - virtual void SAL_CALL setParaVertAlignment( ::sal_Int16 _paravertalignment ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);\ + virtual ::com::sun::star::style::VerticalAlignment SAL_CALL getVerticalAlign() throw (::com::sun::star::beans::UnknownPropertyException,::com::sun::star::uno::RuntimeException);\ + virtual void SAL_CALL setVerticalAlign( ::com::sun::star::style::VerticalAlignment _paravertalignment ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::rtl::OUString SAL_CALL getHyperLinkURL() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual void SAL_CALL setHyperLinkURL( const ::rtl::OUString& _hyperlinkurl ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::rtl::OUString SAL_CALL getHyperLinkTarget() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ diff --git a/reportdesign/inc/RptDef.hxx b/reportdesign/inc/RptDef.hxx index 9b30bef5ade3..31aaa2062305 100644 --- a/reportdesign/inc/RptDef.hxx +++ b/reportdesign/inc/RptDef.hxx @@ -37,6 +37,7 @@ #include <comphelper/stl_types.hxx> #include <comphelper/uno3.hxx> #include <svx/fmglob.hxx> +#include <boost/shared_ptr.hpp> FORWARD_DECLARE_INTERFACE(report,XReportComponent) @@ -81,13 +82,22 @@ namespace ControlModification static const ::sal_Int32 HEIGHT_GREATEST = (sal_Int32)10; } +class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any > +{ +public: + virtual ~AnyConverter(){} + virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const + { + return lhs; + } +}; /** returns teh object type depending on the service name @param _xComponent the report component */ REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent); - -DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString , TPropertyNamePair); -/** returns teh property name map for the givern property id +typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter; +DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair); +/** returns the property name map for the givern property id @param _nObjectId the object id */ REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId); diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 87778659ea23..8415fd128e1d 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -125,6 +125,7 @@ public: void EndListening(sal_Bool bRemoveListener = sal_True); // PropertyChangeListener virtual void _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); + virtual void initializeOle() {} sal_Bool supportsService( const ::rtl::OUString& _sServiceName ) const; @@ -193,6 +194,7 @@ class REPORTDESIGN_DLLPUBLIC OOle2Obj: public SdrOle2Obj , public OObjectBase friend class DlgEdFactory; UINT16 m_nType; + bool m_bOnlyOnce; void impl_createDataProvider_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel); public: static OOle2Obj* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,UINT16 _nType ) @@ -227,6 +229,7 @@ public: virtual UINT32 GetObjInventor() const; // Clone() soll eine komplette Kopie des Objektes erzeugen. virtual SdrObject* Clone() const; + virtual void initializeOle(); void initializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel); }; diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc index c87ae1a9c216..c9cc382ca253 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -229,11 +229,12 @@ #define RID_STR_AREA (RID_STRING_START + 153) #define RID_STR_INSERT (RID_STRING_START + 154) #define RID_STR_UNDO_SHRINK (RID_STRING_START + 155) - #define RID_STR_F_COUNTER (RID_STRING_START + 156) #define RID_STR_F_ACCUMULATION (RID_STRING_START + 157) #define RID_STR_F_MINIMUM (RID_STRING_START + 158) #define RID_STR_F_MAXIMUM (RID_STRING_START + 159) +#define RID_STR_VERTICALALIGN (RID_STRING_START + 160) +#define RID_STR_PARAADJUST (RID_STRING_START + 161) // #define RID_STR_ (RID_STRING_START + 130) @@ -287,6 +288,8 @@ #define RID_STR_REPORTPRINTOPTION_CONST (RID_UNTYPED_START + 4) #define RID_STR_SECTIONPAGEBREAK_CONST (RID_UNTYPED_START + 5) #define RID_STR_TYPE_CONST (RID_UNTYPED_START + 6) +#define RID_STR_VERTICAL_ALIGN_CONST (RID_UNTYPED_START + 7) +#define RID_STR_PARAADJUST_CONST (RID_UNTYPED_START + 8) // toolbox lists --------------------------------------------------------------------- diff --git a/reportdesign/inc/helpids.hrc b/reportdesign/inc/helpids.hrc index 6026634499a1..b60f66823623 100644 --- a/reportdesign/inc/helpids.hrc +++ b/reportdesign/inc/helpids.hrc @@ -81,11 +81,11 @@ // free #define HID_RPT_PROP_PRINTREPEATEDVALUES (HID_RPT_START + 44) #define HID_RPT_PROP_CONDITIONALPRINTEXPRESSION (HID_RPT_START + 45) -// free +#define HID_RPT_PROP_VERTICALALIGN (HID_RPT_START + 46) #define HID_RPT_PROP_STARTNEWCOLUMN (HID_RPT_START + 47) #define HID_RPT_PROP_STARTNEWPAGE (HID_RPT_START + 48) #define HID_RPT_PROP_RESETPAGENUMBER (HID_RPT_START + 49) -// free +#define HID_RPT_PROP_PARAADJUST (HID_RPT_START + 50) #define HID_RPT_PROP_MINHEIGHTNEWPAGE (HID_RPT_START + 51) #define HID_RPT_PROP_PRINTWHENGROUPCHANGE (HID_RPT_START + 52) #define HID_RPT_PROP_CHARTTYPE (HID_RPT_START + 53) diff --git a/reportdesign/source/core/api/ReportComponent.cxx b/reportdesign/source/core/api/ReportComponent.cxx index 8b9b498fe72d..c90407c156de 100644 --- a/reportdesign/source/core/api/ReportComponent.cxx +++ b/reportdesign/source/core/api/ReportComponent.cxx @@ -41,7 +41,7 @@ #include "ReportControlModel.hxx" #include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/text/ParagraphVertAlign.hpp> -// #include <svx/unoshape.hxx> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <svx/unolingu.hxx> #include <svtools/syslocale.hxx> #include <svtools/lingucfg.hxx> @@ -73,14 +73,14 @@ void lcl_getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont,Langu rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, _eCTL, DEFAULTFONT_FLAGS_ONLYONE ) ; } OFormatProperties::OFormatProperties() - :nAlign(0) + :nAlign(style::ParagraphAdjust_LEFT) ,nFontEmphasisMark(0) ,nFontRelief(0) ,nTextColor(0) ,nTextLineColor(0) ,nCharUnderlineColor(0xFFFFFFFF) ,nBackgroundColor(COL_TRANSPARENT) - ,aVerticalAlignment(text::ParagraphVertAlign::TOP) + ,aVerticalAlignment( style::VerticalAlignment_TOP ) ,nCharEscapement(0) ,nCharCaseMap(0) ,nCharKerning(0) @@ -114,7 +114,6 @@ OFormatProperties::OFormatProperties() } aFontDescriptor.Weight = awt::FontWeight::NORMAL; aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL; - // aCharLocale = SvtSysLocale().GetLocaleData().getLocale(); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index c85e754eb63c..d6b22a007409 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -39,26 +39,35 @@ #include <com/sun/star/style/GraphicLocation.hpp> #include <com/sun/star/xml/AttributeData.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <comphelper/namecontainer.hxx> #include <comphelper/broadcasthelper.hxx> +#include <comphelper/documentconstants.hxx> +#include <comphelper/genericpropertyset.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <comphelper/mimeconfighelper.hxx> +#include <comphelper/namecontainer.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/numberedcollection.hxx> +#include <comphelper/propertystatecontainer.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/property.hxx> +#include <comphelper/propertysetinfo.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/seqstream.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/uno3.hxx> #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> #include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> #include <vos/mutex.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/propertystatecontainer.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/proparrhlp.hxx> #include <com/sun/star/beans/XMultiPropertyStates.hpp> #include <com/sun/star/document/EventObject.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/style/XStyle.hpp> -#include <comphelper/documentconstants.hxx> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/EmbedMapUnits.hpp> #include <com/sun/star/embed/EntryInitModes.hpp> +#include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -71,6 +80,8 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> #include "corestrings.hrc" #include "Groups.hxx" #include "RptDef.hxx" @@ -81,14 +92,10 @@ #include "Tools.hxx" #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <unotools/streamwrap.hxx> #include <connectivity/CommonTools.hxx> -#include <comphelper/numberedcollection.hxx> +#include <connectivity/dbconversion.hxx> #include <framework/titlehelper.hxx> -#include <comphelper/property.hxx> -#include <comphelper/propertysetinfo.hxx> -#include <comphelper/genericpropertyset.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <comphelper/namecontainer.hxx> #include <connectivity/dbtools.hxx> #include <com/sun/star/task/XStatusIndicator.hpp> #include "Functions.hxx" @@ -104,6 +111,8 @@ #include "Shape.hxx" #include "ReportHelperImpl.hxx" #include <svtools/itempool.hxx> +#include <svtools/moduleoptions.hxx> +#include <osl/thread.hxx> #include <svx/paperinf.hxx> #include <svx/svdlayer.hxx> @@ -494,6 +503,75 @@ uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Seque aRet[i] = getPropertyDefault(*pIter); return aRet; } +namespace +{ + class FactoryLoader : public ::osl::Thread + { + ::rtl::OUString m_sMimeType; + uno::Reference< uno::XComponentContext > m_xContext; + public: + FactoryLoader(const ::rtl::OUString& _sMimeType,uno::Reference< uno::XComponentContext > const & _xContext) + :m_sMimeType(_sMimeType) + ,m_xContext(_xContext) + {} + + protected: + virtual ~FactoryLoader(){} + + /// Working method which should be overridden. + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + }; + + void SAL_CALL FactoryLoader::run() + { + try + { + uno::Reference<frame::XComponentLoader> xFrameLoad( m_xContext->getServiceManager()->createInstanceWithContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) + ,m_xContext) + ,uno::UNO_QUERY); + ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); + sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; + uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); + xFrameLoad.set( xFrame,uno::UNO_QUERY); + + if ( xFrameLoad.is() ) + { + uno::Sequence < beans::PropertyValue > aArgs( 3); + sal_Int32 nLen = 0; + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); + aArgs[nLen++].Value <<= sal_False; + + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); + aArgs[nLen++].Value <<= sal_True; + + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); + aArgs[nLen++].Value <<= sal_True; + + uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); + ::comphelper::MimeConfigurationHelper aHelper(xFac); + SvtModuleOptions aModuleOptions; + uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL( + aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(m_sMimeType) )), + ::rtl::OUString(), // empty frame name + 0, + aArgs + ),uno::UNO_QUERY); + ::comphelper::disposeComponent(xModel); + } + } + catch(uno::Exception& ex) + { + (void)ex; + OSL_ASSERT(0); + } + } + void SAL_CALL FactoryLoader::onTerminated() + { + delete this; + } +} // ----------------------------------------------------------------------------- struct OReportDefinitionImpl { @@ -555,6 +633,9 @@ struct OReportDefinitionImpl ,m_aDocEventListeners(_aMutex) ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT) ,m_sIdentifier(SERVICE_REPORTDEFINITION) + // default visual area is 8 x 7 cm + ,m_aVisualAreaSize( 8000, 7000 ) + ,m_nAspect(embed::Aspects::MSOLE_CONTENT) ,m_nGroupKeepTogether(0) ,m_nPageHeaderOption(0) ,m_nPageFooterOption(0) @@ -672,6 +753,22 @@ void OReportDefinition::init() { try { + static bool s_bFirstTime = sal_True; + if ( s_bFirstTime ) + { + s_bFirstTime = false; + const uno::Sequence< ::rtl::OUString > aMimeTypes = getAvailableMimeTypes(); + const ::rtl::OUString* pIter = aMimeTypes.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aMimeTypes.getLength(); + for ( ; pIter != pEnd; ++pIter ) + { + FactoryLoader* pCreatorThread = new FactoryLoader(*pIter,m_aProps->m_xContext); + pCreatorThread->createSuspended(); + pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal); + pCreatorThread->resume(); + } // for ( ; pIter != pEnd; ++pIter ) + } + m_pImpl->m_pReportModel.reset(new OReportModel(this)); m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges(); m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM ); @@ -1491,6 +1588,24 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS bErr = sal_True; sErrFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml")); } + } // if ( !bErr ) + + uno::Any aImage; + uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY); + if ( xCurrentController.is() ) + { + xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize); + aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data; + } + if ( aImage.hasValue() ) + { + ::rtl::OUString sObject1(RTL_CONSTASCII_USTRINGPARAM("report")); + ::rtl::OUString sPng(RTL_CONSTASCII_USTRINGPARAM("image/png")); + + uno::Sequence<sal_Int8> aSeq; + aImage >>= aSeq; + uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq ); + m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng); } if ( !bErr ) @@ -1788,23 +1903,44 @@ void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aVisualAreaSize = _aSize; + //if( nAspect == embed::Aspects::MSOLE_CONTENT ) + { + bool bChanged = + (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width || + m_pImpl->m_aVisualAreaSize.Height != _aSize.Height); + m_pImpl->m_aVisualAreaSize = _aSize; + if( bChanged ) + setModified( sal_True ); + } m_pImpl->m_nAspect = _nAspect; } // ----------------------------------------------------------------------------- -awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); return m_pImpl->m_aVisualAreaSize; } // ----------------------------------------------------------------------------- -embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - embed::VisualRepresentation aVisualRepresentation; - return aVisualRepresentation; + embed::VisualRepresentation aResult; + ::rtl::OUString sImageName(RTL_CONSTASCII_USTRINGPARAM("report")); + ::rtl::OUString sMimeType; + uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType); + if ( xStream.is() ) + { + uno::Sequence<sal_Int8> aSeq; + xStream->readBytes(aSeq,xStream->available()); + xStream->closeInput(); + aResult.Data <<= aSeq; + aResult.Flavor.MimeType = sMimeType; + aResult.Flavor.DataType = ::getCppuType( &aSeq ); + } + + return aResult; } // ----------------------------------------------------------------------------- ::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException) @@ -1829,6 +1965,9 @@ void SAL_CALL OReportDefinition::setModified( ::sal_Bool _bModified ) throw (bea if ( m_pImpl->m_bModified != _bModified ) { m_pImpl->m_bModified = _bModified; + if ( m_pImpl->m_pReportModel->IsChanged() != _bModified ) + m_pImpl->m_pReportModel->SetChanged(_bModified); + lang::EventObject aEvent(*this); aGuard.clear(); m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent); @@ -2205,6 +2344,9 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co { uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection )); xDataProvider->setRowLimit(10); + uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY); + if ( xChild.is() ) + xChild->setParent(*this); return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY); } else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 ) @@ -2318,36 +2460,28 @@ class OStylesHelper : public ::cppu::BaseMutex, public TStylesBASE OStylesHelper(const OStylesHelper&); void operator =(const OStylesHelper&); protected: - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual ~OStylesHelper(){} public: OStylesHelper(const uno::Type _aType = ::getCppuType(static_cast< uno::Reference< container::XElementAccess >* >(NULL))); // XNameContainer - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException); - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException); // XNameReplace - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException); // container::XElementAccess - uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException); - sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException); + virtual uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException); // container::XIndexAccess - sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException); - uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException); + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); - // container::XNameAccess - uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); - uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException); - sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException); + // container::XNameAccess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException); }; OStylesHelper::OStylesHelper(const uno::Type _aType) @@ -2411,8 +2545,6 @@ sal_Bool SAL_CALL OStylesHelper::hasByName( const ::rtl::OUString& aName ) throw ::osl::MutexGuard aGuard(m_aMutex); return m_aElements.find(aName) != m_aElements.end(); } -// TODO: VirtualFunctionFinder: This is virtual function! -// // ----------------------------------------------------------------------------- // XNameContainer void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException) @@ -2425,8 +2557,6 @@ void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const u throw lang::IllegalArgumentException(); m_aElementsPos.push_back(m_aElements.insert(TStyleElements::value_type(aName,aElement)).first); - // TODO: VirtualFunctionFinder: This is virtual function! - // } // ----------------------------------------------------------------------------- void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException) @@ -2438,8 +2568,6 @@ void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw( m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind)); m_aElements.erase(aFind); } -// TODO: VirtualFunctionFinder: This is virtual function! -// // ----------------------------------------------------------------------------- // XNameReplace void SAL_CALL OStylesHelper::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException) @@ -2723,6 +2851,47 @@ uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const { return m_aProps->m_xContext; } +// ----------------------------------------------------------------------------- +uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException) +{ + uno::Any aResult; + if( isDataFlavorSupported( aFlavor ) ) + { + try + { + aResult <<= getPreferredVisualRepresentation(0).Data; + } + catch( uno::Exception & ex ) + { + DBG_UNHANDLED_EXCEPTION(); + (void)ex; + } + } + else + { + throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this )); + } + + return aResult; +} +// ----------------------------------------------------------------------------- +uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException) +{ + uno::Sequence< datatransfer::DataFlavor > aRet(1); + + aRet[0] = datatransfer::DataFlavor( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PNG")), + ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) ); + + return aRet; +} +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException) +{ + return aFlavor.MimeType.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"))); +} +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // ============================================================================= }// namespace reportdesign // ============================================================================= diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index e17bd9d2f11a..03c5307e8f25 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -33,9 +33,11 @@ #include <comphelper/documentconstants.hxx> #include <comphelper/storagehelper.hxx> #include <connectivity/dbtools.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/mimeconfighelper.hxx> +#include <comphelper/property.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#include <comphelper/sequence.hxx> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -46,16 +48,18 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XJob.hpp> -#ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC -#include "corestrings.hrc" -#endif + #include <tools/debug.hxx> +#include <tools/urlobj.hxx> #include <svtools/useroptions.hxx> #include <unotools/tempfile.hxx> #include <unotools/sharedunocomponent.hxx> -#include <comphelper/mimeconfighelper.hxx> + #include "Tools.hxx" -#include <comphelper/property.hxx> +#include "corestrings.hrc" +#include "core_resource.hrc" +#include "core_resource.hxx" + #include <connectivity/CommonTools.hxx> #include <rtl/ustrbuf.hxx> #include <sfx2/docfilt.hxx> @@ -72,6 +76,7 @@ OReportEngineJFree::OReportEngineJFree( const uno::Reference< uno::XComponentCon :ReportEngineBase(m_aMutex) ,ReportEnginePropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) ,m_xContext(context) +,m_nMaxRows(0) { DBG_CTOR( rpt_OReportEngineJFree,NULL); } @@ -197,18 +202,29 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task } m_xReport->storeToStorage(xTemp,aEmpty); // store to temp file because it may contain information which aren't in the database yet. - uno::Sequence< beans::NamedValue > aConvertedProperties(7); + uno::Sequence< beans::NamedValue > aConvertedProperties(8); sal_Int32 nPos = 0; aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStorage")); aConvertedProperties[nPos++].Value <<= xTemp; aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStorage")); - + ::rtl::OUString sFileURL; String sName = m_xReport->getCaption(); if ( !sName.Len() ) sName = m_xReport->getName(); - ::utl::TempFile aFile(sName,sal_False,&sExt); - uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(aFile.GetURL(),embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); + { + ::utl::TempFile aTestFile(sName,sal_False,&sExt); + if ( !aTestFile.IsValid() ) + { + sName = RPT_RESSTRING(RID_STR_REPORT,m_xContext->getServiceManager()); + ::utl::TempFile aFile(sName,sal_False,&sExt); + sFileURL = aFile.GetURL(); + } + else + sFileURL = aTestFile.GetURL(); + } + + uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); utl::DisposableComponent aOut(xOut); xStorageProp.set(xOut,uno::UNO_QUERY); if ( xStorageProp.is() ) @@ -224,6 +240,9 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task aConvertedProperties[nPos].Name = PROPERTY_ACTIVECONNECTION; aConvertedProperties[nPos++].Value <<= m_xActiveConnection; + aConvertedProperties[nPos].Name = PROPERTY_MAXROWS; + aConvertedProperties[nPos++].Value <<= m_nMaxRows; + // some meta data SvtUserOptions aUserOpts; ::rtl::OUStringBuffer sAuthor(aUserOpts.GetFirstName()); @@ -246,7 +265,7 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task if ( xStorageProp.is() ) { //xStorageProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))) >>= sOutputName; - sOutputName = aFile.GetURL(); + sOutputName = sFileURL; } } @@ -293,7 +312,7 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ,m_xContext) ,uno::UNO_QUERY); - ::rtl::OUString sTarget = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")); + ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); xFrameLoad.set( xFrame,uno::UNO_QUERY); @@ -316,7 +335,7 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive } uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); - ::comphelper::MimeConfigurationHelper aHelper(xFac); + /*::comphelper::MimeConfigurationHelper aHelper(xFac);*/ xModel.set( xFrameLoad->loadComponentFromURL( sOutputName, ::rtl::OUString(), // empty frame name @@ -394,6 +413,17 @@ void SAL_CALL OReportEngineJFree::setActiveConnection( const uno::Reference< sdb throw lang::IllegalArgumentException(); set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_xActiveConnection); } +// ----------------------------------------------------------------------------- +::sal_Int32 SAL_CALL OReportEngineJFree::getMaxRows() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + return m_nMaxRows; +} +// ----------------------------------------------------------------------------- +void SAL_CALL OReportEngineJFree::setMaxRows( ::sal_Int32 _MaxRows ) throw (uno::RuntimeException) +{ + set(PROPERTY_MAXROWS,_MaxRows,m_nMaxRows); +} // ============================================================================= } // namespace reportdesign // ============================================================================= diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx index 2e0bd0bff730..a11dd61e8ed6 100644 --- a/reportdesign/source/core/inc/ReportControlModel.hxx +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -74,7 +74,7 @@ namespace reportdesign ::rtl::OUString sHyperLinkName; ::rtl::OUString sVisitedCharStyleName; ::rtl::OUString sUnvisitedCharStyleName; - short aVerticalAlignment; + com::sun::star::style::VerticalAlignment aVerticalAlignment; ::sal_Int16 nCharEscapement; ::sal_Int16 nCharCaseMap; ::sal_Int16 nCharKerning; diff --git a/reportdesign/source/core/inc/ReportEngineJFree.hxx b/reportdesign/source/core/inc/ReportEngineJFree.hxx index c65a1ee7b7ae..9e95c0c2c593 100644 --- a/reportdesign/source/core/inc/ReportEngineJFree.hxx +++ b/reportdesign/source/core/inc/ReportEngineJFree.hxx @@ -57,6 +57,7 @@ namespace reportdesign ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReport; ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator> m_StatusIndicator; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection; + ::sal_Int32 m_nMaxRows; private: OReportEngineJFree(const OReportEngineJFree&); OReportEngineJFree& operator=(const OReportEngineJFree&); @@ -116,6 +117,8 @@ namespace reportdesign virtual void SAL_CALL setActiveConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _activeconnection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator() throw (::com::sun::star::uno::RuntimeException) ; virtual void SAL_CALL setStatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& _statusindicator ) throw (::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Int32 SAL_CALL getMaxRows() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMaxRows( ::sal_Int32 _MaxRows ) throw (::com::sun::star::uno::RuntimeException); // Methods virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentModel( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ; virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentAlive( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _frame ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ; diff --git a/reportdesign/source/core/inc/ReportHelperImpl.hxx b/reportdesign/source/core/inc/ReportHelperImpl.hxx index 14e9bc02b801..ebf8c566133d 100644 --- a/reportdesign/source/core/inc/ReportHelperImpl.hxx +++ b/reportdesign/source/core/inc/ReportHelperImpl.hxx @@ -234,13 +234,13 @@ void SAL_CALL clazz::setCharScaleWidth(::sal_Int16 the_value) throw (uno::Runtim float newValue = the_value; \ set(PROPERTY_CHARSCALEWIDTH,newValue,varName.aFontDescriptor.CharacterWidth); \ } \ -::sal_Int16 SAL_CALL clazz::getParaAdjust() throw (beans::UnknownPropertyException,uno::RuntimeException) \ +sal_Int16 SAL_CALL clazz::getParaAdjust() throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ ::osl::MutexGuard aGuard(m_aMutex); \ return varName.nAlign; \ } \ \ -void SAL_CALL clazz::setParaAdjust( ::sal_Int16 _align ) throw (beans::UnknownPropertyException,uno::RuntimeException) \ +void SAL_CALL clazz::setParaAdjust( sal_Int16 _align ) throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ set(PROPERTY_PARAADJUST,_align,varName.nAlign); \ } \ @@ -320,16 +320,14 @@ void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 _textlinecolor ) throw ( set(PROPERTY_CHARUNDERLINECOLOR,_textlinecolor,varName.nTextLineColor); \ } \ \ -short SAL_CALL clazz::getParaVertAlignment() throw (uno::RuntimeException) \ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign() throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ ::osl::MutexGuard aGuard(m_aMutex); \ return varName.aVerticalAlignment; \ } \ \ -void SAL_CALL clazz::setParaVertAlignment( short _verticalalign ) throw (lang::IllegalArgumentException,uno::RuntimeException) \ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign ) throw (lang::IllegalArgumentException,beans::UnknownPropertyException,uno::RuntimeException) \ { \ - if ( _verticalalign < text::ParagraphVertAlign::AUTOMATIC || _verticalalign > text::ParagraphVertAlign::BOTTOM ) \ - throw lang::IllegalArgumentException(); \ set(PROPERTY_VERTICALALIGN,_verticalalign,varName.aVerticalAlignment); \ } \ \ @@ -801,11 +799,11 @@ void SAL_CALL clazz::setCharLocaleComplex( const ::com::sun::star::lang::Locale& #define NO_REPORTCONTROLFORMAT_IMPL(clazz) \ -::sal_Int16 SAL_CALL clazz::getParaAdjust() throw (uno::RuntimeException, beans::UnknownPropertyException)\ +sal_Int16 SAL_CALL clazz::getParaAdjust() throw (uno::RuntimeException, beans::UnknownPropertyException)\ {\ throw beans::UnknownPropertyException();\ }\ -void SAL_CALL clazz::setParaAdjust(::sal_Int16 /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException)\ +void SAL_CALL clazz::setParaAdjust(sal_Int16 /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException)\ {\ throw beans::UnknownPropertyException();\ }\ @@ -1030,16 +1028,14 @@ void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 /*_textlinecolor*/ ) thr throw beans::UnknownPropertyException();\ }\ \ -short SAL_CALL clazz::getParaVertAlignment() throw (uno::RuntimeException)\ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign() throw (beans::UnknownPropertyException,uno::RuntimeException)\ {\ ::osl::MutexGuard aGuard(m_aMutex);\ return m_aProps.aFormatProperties.aVerticalAlignment;\ }\ \ -void SAL_CALL clazz::setParaVertAlignment( short _verticalalign ) throw (lang::IllegalArgumentException,uno::RuntimeException)\ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign ) throw (lang::IllegalArgumentException,beans::UnknownPropertyException,uno::RuntimeException)\ {\ - if ( _verticalalign < text::ParagraphVertAlign::AUTOMATIC || _verticalalign > text::ParagraphVertAlign::BOTTOM )\ - throw lang::IllegalArgumentException();\ set(PROPERTY_VERTICALALIGN,_verticalalign,m_aProps.aFormatProperties.aVerticalAlignment);\ }\ \ diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index f549582019b2..232408c308fb 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -103,9 +103,12 @@ namespace reportdesign if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { ::com::sun::star::awt::Size aOldSize = _pShape->m_aProps.aComponent.m_xShape->getSize(); - _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width; - _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height; - _pShape->m_aProps.aComponent.m_xShape->setSize(aSize); + if ( aOldSize.Height != aSize.Height || aOldSize.Width != aSize.Width ) + { + _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width; + _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height; + _pShape->m_aProps.aComponent.m_xShape->setSize(aSize); + } } _pShape->set(PROPERTY_WIDTH,aSize.Width,_pShape->m_aProps.aComponent.m_nWidth); _pShape->set(PROPERTY_HEIGHT,aSize.Height,_pShape->m_aProps.aComponent.m_nHeight); @@ -136,9 +139,12 @@ namespace reportdesign if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { aOldPos = _pShape->m_aProps.aComponent.m_xShape->getPosition(); - _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; - _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; - _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); + if ( aOldPos.X != aPosition.X || aOldPos.Y != aPosition.Y ) + { + _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; + _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; + _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); + } } _pShape->set(PROPERTY_POSITIONX,aPosition.X,aOldPos.X); _pShape->set(PROPERTY_POSITIONY,aPosition.Y,aOldPos.Y); diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx index f5ec06d1e683..7f71d101e91b 100644 --- a/reportdesign/source/core/sdr/PropertyForward.cxx +++ b/reportdesign/source/core/sdr/PropertyForward.cxx @@ -33,6 +33,7 @@ #include <comphelper/property.hxx> #include <com/sun/star/sdbcx/XAppend.hpp> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include "corestrings.hrc" //........................................................................ @@ -71,12 +72,12 @@ OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource TPropertyNamePair::iterator aEnd = m_aNameMap.end(); for (; aIter != aEnd; ++aIter) { - Any aValue = _xDest->getPropertyValue(aIter->second); Property aProp = m_xSourceInfo->getPropertyByName(aIter->first); if (0 == (aProp.Attributes & PropertyAttribute::READONLY)) { + Any aValue = _xDest->getPropertyValue(aIter->second.first); if ( 0 != (aProp.Attributes & PropertyAttribute::MAYBEVOID) || aValue.hasValue() ) - _xSource->setPropertyValue(aIter->first,aValue); + _xSource->setPropertyValue(aIter->first,aIter->second.second->operator()(aIter->second.first,aValue)); } } } @@ -86,13 +87,14 @@ OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource TPropertyNamePair::iterator aIter = m_aNameMap.begin(); TPropertyNamePair::iterator aEnd = m_aNameMap.end(); for (; aIter != aEnd; ++aIter) - _xDest->setPropertyValue(aIter->second,_xSource->getPropertyValue(aIter->first)); + _xDest->setPropertyValue(aIter->second.first,aIter->second.second->operator()(aIter->second.first,_xSource->getPropertyValue(aIter->first))); } startListening(); } - catch(Exception&) + catch(Exception& e) { - OSL_ENSURE(sal_False, "OPropertyMediator::OPropertyMediator: caught an exception!"); + DBG_UNHANDLED_EXCEPTION(); + (void)e; } } // if ( m_xDest.is() && m_xSource.is() ) osl_decrementInterlockedCount(&m_refCount); @@ -125,7 +127,7 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt TPropertyNamePair::iterator aFind = m_aNameMap.find(evt.PropertyName); ::rtl::OUString sPropName; if ( aFind != m_aNameMap.end() ) - sPropName = aFind->second; + sPropName = aFind->second.first; else { aFind = ::std::find_if( @@ -133,14 +135,14 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt m_aNameMap.end(), ::std::compose1( ::std::bind2nd(::std::equal_to< ::rtl::OUString >(), evt.PropertyName), - ::std::select2nd<TPropertyNamePair::value_type>() + ::std::compose1(::std::select1st<TPropertyConverter>(),::std::select2nd<TPropertyNamePair::value_type>()) ) ); if ( aFind != m_aNameMap.end() ) sPropName = aFind->first; } if ( sPropName.getLength() && xPropInfo->hasPropertyByName(sPropName) ) - xProp->setPropertyValue(sPropName,evt.NewValue); + xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); else if ( evt.PropertyName == PROPERTY_CHARFONTNAME || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME || evt.PropertyName == PROPERTY_CHARSTRIKEOUT diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index b5974a226341..3036872518b6 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/awt/XUnoControlContainer.hpp> #include <com/sun/star/awt/XVclContainerPeer.hpp> #include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> @@ -67,6 +68,8 @@ #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/report/XFormattedField.hpp> #include <comphelper/genericpropertyset.hxx> #include <comphelper/processfactory.hxx> @@ -74,6 +77,7 @@ #include <tools/diagnose_ex.h> #include "PropertyForward.hxx" #include <connectivity/dbtools.hxx> +#include <connectivity/dbconversion.hxx> #include "UndoActions.hxx" #include "UndoEnv.hxx" #include <algorithm> @@ -179,6 +183,63 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon return pNewObj; } // ----------------------------------------------------------------------------- +namespace +{ + class ParaAdjust : public AnyConverter + { + public: + virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& _sPropertyName,const ::com::sun::star::uno::Any& lhs) const + { + uno::Any aRet; + if ( _sPropertyName.equalsAscii(PROPERTY_PARAADJUST) ) + { + sal_Int16 nTextAlign = 0; + lhs >>= nTextAlign; + switch(nTextAlign) + { + case awt::TextAlign::LEFT: + nTextAlign = style::ParagraphAdjust_LEFT; + break; + case awt::TextAlign::CENTER: + nTextAlign = style::ParagraphAdjust_CENTER; + break; + case awt::TextAlign::RIGHT: + nTextAlign = style::ParagraphAdjust_RIGHT; + break; + default: + OSL_ENSURE(0,"Illegal text alignment value!"); + break; + } // switch(nTextAlign) + aRet <<= (style::ParagraphAdjust)nTextAlign; + } + else + { + sal_Int16 nTextAlign = 0; + sal_Int16 eParagraphAdjust = 0; + lhs >>= eParagraphAdjust; + switch(eParagraphAdjust) + { + case style::ParagraphAdjust_LEFT: + case style::ParagraphAdjust_BLOCK: + nTextAlign = awt::TextAlign::LEFT; + break; + case style::ParagraphAdjust_CENTER: + nTextAlign = awt::TextAlign::CENTER; + break; + case style::ParagraphAdjust_RIGHT: + nTextAlign = awt::TextAlign::RIGHT; + break; + default: + OSL_ENSURE(0,"Illegal text alignment value!"); + break; + } // switch(eParagraphAdjust) + aRet <<= nTextAlign; + } + return aRet; + } + }; +} +// ----------------------------------------------------------------------------- const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { switch(_nObjectId) @@ -188,30 +249,54 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,PROPERTY_BACKGROUNDCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,PROPERTY_BORDER)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,PROPERTY_BORDERCOLOR)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); } return s_aNameMap; } case OBJ_DLG_FIXEDTEXT: + { + static TPropertyNamePair s_aNameMap; + if ( s_aNameMap.empty() ) + { + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); + + ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust))); + } + return s_aNameMap; + } case OBJ_DLG_FORMATTEDFIELD: { static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,PROPERTY_TEXTCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,PROPERTY_BACKGROUNDCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,PROPERTY_TEXTLINECOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,PROPERTY_FONTRELIEF)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,PROPERTY_FONTHEIGHT)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,PROPERTY_FONTSTRIKEOUT)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,PROPERTY_FONTEMPHASISMARK)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,PROPERTY_BORDER)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,PROPERTY_BORDERCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); + //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter))); + ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust))); } return s_aNameMap; } @@ -221,8 +306,9 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),PROPERTY_CONTROLBACKGROUND)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter))); } return s_aNameMap; } @@ -424,8 +510,7 @@ OCustomShape::OCustomShape(const uno::Reference< report::XReportComponent>& _xCo ,OObjectBase(_xComponent) { DBG_CTOR( rpt_OCustomShape, NULL); - // start listening - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) ); m_bIsListening = sal_True; } //---------------------------------------------------------------------------- @@ -441,7 +526,6 @@ OCustomShape::OCustomShape(const ::rtl::OUString& _sComponentName) OCustomShape::~OCustomShape() { DBG_DTOR( rpt_OCustomShape, NULL); - //mxUnoShape = uno::WeakReference< uno::XInterface >(); } // ----------------------------------------------------------------------------- UINT16 OCustomShape::GetObjIdentifier() const @@ -588,7 +672,10 @@ OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xCompon ,m_nObjectType(_nObjectType) { DBG_CTOR( rpt_OUnoObject, NULL); - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); + + if ( rModelName.getLength() ) + impl_initializeModel_nothrow(); if ( rModelName.getLength() ) impl_initializeModel_nothrow(); @@ -597,7 +684,6 @@ OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xCompon OUnoObject::~OUnoObject() { DBG_DTOR( rpt_OUnoObject, NULL); - //mxUnoShape = uno::WeakReference< uno::XInterface >(); } // ----------------------------------------------------------------------------- void OUnoObject::impl_initializeModel_nothrow() @@ -926,22 +1012,19 @@ OOle2Obj::OOle2Obj(const uno::Reference< report::XReportComponent>& _xComponent, :SdrOle2Obj() ,OObjectBase(_xComponent) ,m_nType(_nType) + ,m_bOnlyOnce(true) { DBG_CTOR( rpt_OOle2Obj, NULL); - // start listening - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); m_bIsListening = sal_True; - //uno::Reference< embed::XEmbeddedObject > xEmbed(_xComponent,uno::UNO_QUERY); - //OSL_ENSURE(xEmbed.is(),"This is no embedded object!"); - - //SetObjRef(xEmbed); } //---------------------------------------------------------------------------- OOle2Obj::OOle2Obj(const ::rtl::OUString& _sComponentName,UINT16 _nType) :SdrOle2Obj() ,OObjectBase(_sComponentName) ,m_nType(_nType) + ,m_bOnlyOnce(true) { DBG_CTOR( rpt_OOle2Obj, NULL); m_bIsListening = sal_True; @@ -1123,17 +1206,42 @@ SdrObject* OOle2Obj::Clone() const // ----------------------------------------------------------------------------- void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel) { - uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); - uno::Reference< chart2::data::XDataReceiver > xReceiver; - uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); - if( xCompSupp.is()) - xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); - OSL_ASSERT( xReceiver.is()); - if( xReceiver.is() ) + try + { + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + uno::Reference< chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + OSL_ASSERT( xReceiver.is()); + if( xReceiver.is() ) + { + uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY); + uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); + xReceiver->attachDataProvider( xDataProvider.get() ); + } // if( xReceiver.is() ) + } + catch(uno::Exception) { - uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY); - uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); - xReceiver->attachDataProvider( xDataProvider.get() ); + } +} +// ----------------------------------------------------------------------------- +void OOle2Obj::initializeOle() +{ + if ( m_bOnlyOnce ) + { + m_bOnlyOnce = false; + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); + + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); + if( xCompSupp.is() ) + { + uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY ); + if ( xChartProps.is() ) + xChartProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900))); + } } } // ----------------------------------------------------------------------------- @@ -1155,8 +1263,8 @@ void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel) if ( !lcl_getDataProvider(xObj).is() ) impl_createDataProvider_nothrow(_xModel); - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( _xModel, uno::UNO_QUERY ); - xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); + OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); uno::Sequence< beans::PropertyValue > aArgs( 4 ); aArgs[0] = beans::PropertyValue( diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx index 1db6b8e95c98..4d302a491a06 100644 --- a/reportdesign/source/core/sdr/RptPage.cxx +++ b/reportdesign/source/core/sdr/RptPage.cxx @@ -187,6 +187,7 @@ void OReportPage::removeTempObject(SdrObject *_pToRemoveObj) { SdrObject* pObject = RemoveObject(i); (void)pObject; + break; // delete pObject; } } @@ -195,6 +196,7 @@ void OReportPage::removeTempObject(SdrObject *_pToRemoveObj) void OReportPage::resetSpecialMode() { + const sal_Bool bChanged = rModel.IsChanged(); ::std::vector<SdrObject*>::iterator aIter = m_aTemporaryObjectList.begin(); ::std::vector<SdrObject*>::iterator aEnd = m_aTemporaryObjectList.end(); @@ -202,6 +204,8 @@ void OReportPage::resetSpecialMode() { removeTempObject(*aIter); } + m_aTemporaryObjectList.clear(); + rModel.SetChanged(bChanged); m_bSpecialInsertMode = false; } diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx index 4fd0fbad8dd7..7c2bb2bd98e5 100644 --- a/reportdesign/source/core/sdr/UndoActions.cxx +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -446,9 +446,6 @@ Reference< XPropertySet> OUndoPropertyReportSectionAction::getObject() { return m_pMemberFunction(&m_aReportHelper).get(); } - - - //============================================================================ } // rptui //============================================================================ diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index add9ea18b7a8..63a76c047195 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -323,7 +323,7 @@ ORptExport::ORptExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt1 UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA )); m_xParaPropMapper = new OSpecialHanldeXMLExportPropertyMapper( xPropMapper); - //m_xParaPropMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); + // m_xParaPropMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); ::rtl::OUString sFamily( GetXMLToken(XML_PARAGRAPH) ); ::rtl::OUString aPrefix( String( 'P' ) ); @@ -948,6 +948,10 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection) AddAttribute(XML_NAMESPACE_FORM, XML_IMAGE_DATA,sTargetLocation); } bExportData = sal_True; + ::rtl::OUStringBuffer sValue;
+ const SvXMLEnumMapEntry* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
+ if ( SvXMLUnitConverter::convertEnum( sValue, xImage->getScaleMode(),aXML_ImageScaleEnumMap ) )
+ AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, sValue.makeStringAndClear() ); } else if ( xReportDefinition.is() ) { @@ -1268,37 +1272,37 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted } else { - sal_Int32 nTextAlignIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); - if ( nTextAlignIndex != -1 ) - { - ::std::vector< XMLPropertyState >::iterator aIter = aPropertyStates.begin(); - ::std::vector< XMLPropertyState >::iterator aEnd = aPropertyStates.end(); - for (; aIter != aEnd; ++aIter) - { - if ( aIter->mnIndex == nTextAlignIndex ) - { - sal_Int16 nTextAlign = 0; - aIter->maValue >>= nTextAlign; - switch(nTextAlign) - { - case awt::TextAlign::LEFT: - nTextAlign = style::ParagraphAdjust_LEFT; - break; - case awt::TextAlign::CENTER: - nTextAlign = style::ParagraphAdjust_CENTER; - break; - case awt::TextAlign::RIGHT: - nTextAlign = style::ParagraphAdjust_RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - aIter->maValue <<= nTextAlign; - break; - } - } - } + //sal_Int32 nTextAlignIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); + //if ( nTextAlignIndex != -1 ) + //{ + // ::std::vector< XMLPropertyState >::iterator aIter = aPropertyStates.begin(); + // ::std::vector< XMLPropertyState >::iterator aEnd = aPropertyStates.end(); + // for (; aIter != aEnd; ++aIter) + // { + // if ( aIter->mnIndex == nTextAlignIndex ) + // { + // sal_Int16 nTextAlign = 0; + // aIter->maValue >>= nTextAlign; + // switch(nTextAlign) + // { + // case awt::TextAlign::LEFT: + // nTextAlign = style::ParagraphAdjust_LEFT; + // break; + // case awt::TextAlign::CENTER: + // nTextAlign = style::ParagraphAdjust_CENTER; + // break; + // case awt::TextAlign::RIGHT: + // nTextAlign = style::ParagraphAdjust_RIGHT; + // break; + // default: + // OSL_ENSURE(0,"Illegal text alignment value!"); + // break; + // } + // aIter->maValue <<= nTextAlign; + // break; + // } + // } + //} const Reference<XFormattedField> xFormattedField(_xProp,uno::UNO_QUERY); if ( (_xParentFormattedField.is() || xFormattedField.is()) && !aPropertyStates.empty() ) { diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx index f4a394263234..73df0a049241 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx @@ -88,9 +88,11 @@ void lcl_correctCellAddress(const ::rtl::OUString & _sName, const uno::Reference ExportDocumentHandler::ExportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) : m_xContext(context) ,m_nCurrentCellIndex(0) + ,m_nColumnCount(0) ,m_bTableRowsStarted(false) ,m_bFirstRowExported(false) ,m_bExportChar(false) + ,m_bCountColumnHeader(false) { } // ----------------------------------------------------------------------------- @@ -189,6 +191,17 @@ void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName pList->AddAttribute(lcl_createAttribute(XML_NP_OFFICE,XML_MIMETYPE),MIMETYPE_OASIS_OPENDOCUMENT_CHART); m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_REPORT),xNewAttribs); + + const ::rtl::OUString sTableCalc = lcl_createAttribute(XML_NP_TABLE,XML_CALCULATION_SETTINGS); + m_xDelegatee->startElement(sTableCalc,NULL); + pList = new SvXMLAttributeList(); + uno::Reference< xml::sax::XAttributeList > xNullAttr = pList; + pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1900-01-01"))); + + const ::rtl::OUString sNullDate = lcl_createAttribute(XML_NP_TABLE,XML_NULL_DATE); + m_xDelegatee->startElement(sNullDate,xNullAttr); + m_xDelegatee->endElement(sNullDate); + m_xDelegatee->endElement(sTableCalc); bExport = false; } else if ( _sName.equalsAscii("table:table") ) @@ -196,6 +209,14 @@ void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName m_xDelegatee->startElement(lcl_createAttribute(XML_NP_RPT,XML_DETAIL),NULL); lcl_exportPrettyPrinting(m_xDelegatee); } + else if ( _sName.equalsAscii("table:table-header-rows") ) + { + m_bCountColumnHeader = true; + } + else if ( m_bCountColumnHeader && _sName.equalsAscii("table:table-cell") ) + { + ++m_nColumnCount; + } else if ( _sName.equalsAscii("table:table-rows") ) { m_xDelegatee->startElement(_sName,xAttribs); @@ -249,6 +270,10 @@ void SAL_CALL ExportDocumentHandler::endElement(const ::rtl::OUString & _sName) lcl_exportPrettyPrinting(m_xDelegatee); sNewName = lcl_createAttribute(XML_NP_RPT,XML_DETAIL); } + else if ( _sName.equalsAscii("table:table-header-rows") ) + { + m_bCountColumnHeader = false; + } else if ( _sName.equalsAscii("table:table-rows") ) m_bTableRowsStarted = false; else if ( m_bTableRowsStarted && m_bFirstRowExported && (_sName.equalsAscii("table:table-row") || _sName.equalsAscii("table:table-cell")) ) @@ -360,8 +385,26 @@ void ExportDocumentHandler::exportTableRows() uno::Reference< xml::sax::XAttributeList > xCellAtt = pCellAtt; pCellAtt->AddAttribute(sValueType,s_sString); + bool bRemoveString = true; ::rtl::OUString sFormula; const sal_Int32 nCount = m_aColumns.getLength(); + if ( m_nColumnCount > nCount ) + { + const sal_Int32 nEmptyCellCount = m_nColumnCount - nCount; + for(sal_Int32 i = 0; i < nEmptyCellCount ; ++i) + { + m_xDelegatee->startElement(sCell,xCellAtt); + if ( bRemoveString ) + { + bRemoveString = false; + pCellAtt->RemoveAttribute(sValueType); + pCellAtt->AddAttribute(sValueType,s_sFloat); + } // if ( i == 0 ) + m_xDelegatee->startElement(sP,NULL); + m_xDelegatee->endElement(sP); + m_xDelegatee->endElement(sCell); + } + } for(sal_Int32 i = 0; i < nCount ; ++i) { sFormula = s_sFieldPrefix; @@ -372,8 +415,9 @@ void ExportDocumentHandler::exportTableRows() pList->AddAttribute(sFormulaAttrib,sFormula); m_xDelegatee->startElement(sCell,xCellAtt); - if ( i == 0 ) + if ( bRemoveString ) { + bRemoveString = false; pCellAtt->RemoveAttribute(sValueType); pCellAtt->AddAttribute(sValueType,s_sFloat); } diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx index 33cad946997a..3da9f99ca9d1 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx @@ -96,9 +96,11 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aColumns; sal_Int32 m_nCurrentCellIndex; + sal_Int32 m_nColumnCount; bool m_bTableRowsStarted; bool m_bFirstRowExported; bool m_bExportChar; + bool m_bCountColumnHeader; }; // ----------------------------------------------------------------------------- } // namespace rptxml diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index 1b81d87a1119..d0e75499ace0 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/awt/ImagePosition.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <xmloff/prstylei.hxx> #include "xmlstrings.hrc" #include "xmlEnums.hxx" @@ -59,7 +60,7 @@ #include <com/sun/star/report/XReportControlFormat.hpp> #include <com/sun/star/form/ListSourceType.hpp> #include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> #include <xmloff/EnumPropertyHdl.hxx> #define XML_RPT_ALGINMENT (XML_DB_TYPES_START+1) @@ -85,21 +86,22 @@ OPropertyHandlerFactory::~OPropertyHandlerFactory() const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const { const XMLPropertyHandler* pHandler = NULL; + sal_Int32 nType = _nType; + nType &= MID_FLAG_MASK; - switch(_nType) + switch(nType) { case XML_RPT_ALGINMENT: { static SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] = { - { XML_TOP, drawing::TextVerticalAdjust_TOP }, - { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER }, - { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM }, - { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK }, + { XML_TOP, style::VerticalAlignment_TOP }, + { XML_MIDDLE, style::VerticalAlignment_MIDDLE }, + { XML_BOTTOM, style::VerticalAlignment_BOTTOM }, { XML_TOKEN_INVALID, 0 } }; - pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) ); + pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::style::VerticalAlignment*)0) ); } break; case (XML_SD_TYPES_START+34): @@ -110,6 +112,8 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 if ( !pHandler ) pHandler = OControlPropertyHandlerFactory::GetPropertyHandler(_nType); + else + PutHdlCache(nType, pHandler); return pHandler; } // ----------------------------------------------------------------------------- @@ -134,13 +138,13 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ MAP_CONST_C( PROPERTY_CONTROLBACKGROUND, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + MAP_CONST_C( PROPERTY_VERTICALALIGN, STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ), MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUND, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -159,7 +163,8 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), + MAP_CONST_C( PROPERTY_VERTICALALIGN, + STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -231,26 +236,6 @@ const SvXMLEnumMapEntry* OXMLHelper::GetForceNewPageOptions() return s_aXML_EnumMap; } // ----------------------------------------------------------------------------- -//// ----------------------------------------------------------------------------- -//const SvXMLEnumMapEntry* OXMLHelper::GetGroupOnOptions() -//{ -// static SvXMLEnumMapEntry s_aXML_EnumMap[] = -// { -// // { XML_DEFAULT ,report::GroupOn::DEFAULT }, // default -// { XML_PREFIX_CHARACTERS ,report::GroupOn::PREFIX_CHARACTERS }, -// { XML_YEAR ,report::GroupOn::YEAR }, -// { XML_QUARTAL , report::GroupOn::QUARTAL }, -// { XML_MONTH , report::GroupOn::MONTH }, -// { XML_WEEK , report::GroupOn::WEEK }, -// { XML_DAY , report::GroupOn::DAY }, -// { XML_HOUR , report::GroupOn::HOUR }, -// { XML_MINUTE , report::GroupOn::MINUTE }, -// { XML_INTERVAL , report::GroupOn::INTERVAL }, -// { XML_TOKEN_INVALID, 0 } -// }; -// return s_aXML_EnumMap; -//} -// ----------------------------------------------------------------------------- const SvXMLEnumMapEntry* OXMLHelper::GetKeepTogetherOptions() { static SvXMLEnumMapEntry s_aXML_EnumMap[] = @@ -352,33 +337,10 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sSty xProp->getPropertyValue(PROPERTY_FONTTYPE) >>= aFont.Type; uno::Reference<report::XReportControlFormat> xReportControlModel(_xProp,uno::UNO_QUERY); if ( xReportControlModel.is() && aFont.Name.getLength() ) - try - { - xReportControlModel->setFontDescriptor(aFont); - } - catch(beans::UnknownPropertyException){} - - if ( xReportControlModel.is() ) { try { - sal_Int16 nTextAlign = xReportControlModel->getParaAdjust(); - switch(nTextAlign) - { - case style::ParagraphAdjust_LEFT: - nTextAlign = awt::TextAlign::LEFT; - break; - case style::ParagraphAdjust_CENTER: - nTextAlign = awt::TextAlign::CENTER; - break; - case style::ParagraphAdjust_RIGHT: - nTextAlign = awt::TextAlign::RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - xReportControlModel->setParaAdjust(nTextAlign); + xReportControlModel->setFontDescriptor(aFont); } catch(beans::UnknownPropertyException){} } @@ -442,5 +404,18 @@ SvXMLTokenMap* OXMLHelper::GetSubDocumentElemTokenMap() return new SvXMLTokenMap( aElemTokenMap ); } // ----------------------------------------------------------------------------- +const SvXMLEnumMapEntry* OXMLHelper::GetImageScaleOptions()
+{
+ static SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ {
+ // { XML_NONE, awt::ImageScaleMode::None }, // default
+ { XML_ISOTROPIC, awt::ImageScaleMode::Isotropic },
+ { XML_ANISOTROPIC, awt::ImageScaleMode::Anisotropic },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return s_aXML_EnumMap;
+}
+// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- } // rptxml // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlHelper.hxx b/reportdesign/source/filter/xml/xmlHelper.hxx index cfb0df81a213..909ae9defeda 100644 --- a/reportdesign/source/filter/xml/xmlHelper.hxx +++ b/reportdesign/source/filter/xml/xmlHelper.hxx @@ -39,8 +39,7 @@ #include <memory> -#define CTF_RPT_NUMBERFORMAT (XML_DB_CTF_START + 1) -#define CTF_RPT_PARAVERTALIGNMENT (XML_DB_CTF_START + 2) +#define CTF_RPT_NUMBERFORMAT (XML_DB_CTF_START + 1) #define XML_STYLE_FAMILY_REPORT_ID 700 #define XML_STYLE_FAMILY_REPORT_NAME "report-element" @@ -76,6 +75,7 @@ namespace rptxml static const SvXMLEnumMapEntry* GetForceNewPageOptions(); static const SvXMLEnumMapEntry* GetKeepTogetherOptions(); static const SvXMLEnumMapEntry* GetCommandTypeOptions(); + static const SvXMLEnumMapEntry* GetImageScaleOptions(); static const XMLPropertyMapEntry* GetTableStyleProps(); static const XMLPropertyMapEntry* GetColumnStyleProps(); diff --git a/reportdesign/source/filter/xml/xmlImage.cxx b/reportdesign/source/filter/xml/xmlImage.cxx index 33c0b58646b2..b1341a35c365 100644 --- a/reportdesign/source/filter/xml/xmlImage.cxx +++ b/reportdesign/source/filter/xml/xmlImage.cxx @@ -33,10 +33,12 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/nmspmap.hxx> +#include <xmloff/xmluconv.hxx> #include "xmlEnums.hxx" #include "xmlComponent.hxx" #include "xmlReportElement.hxx" #include "xmlControlProperty.hxx" +#include "xmlHelper.hxx" #include <tools/debug.hxx> #include <svtools/pathoptions.hxx> @@ -90,7 +92,19 @@ OXMLImage::OXMLImage( ORptFilter& rImport, _xComponent->setPreserveIRI(s_sTRUE == sValue); break; case XML_TOK_SCALE: - _xComponent->setScaleMode(s_sTRUE == sValue ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ); + {
+ sal_uInt16 nRet = awt::ImageScaleMode::None;
+ if ( s_sTRUE == sValue )
+ {
+ nRet = awt::ImageScaleMode::Anisotropic;
+ }
+ else
+ {
+ const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
+ SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
+ }
+ _xComponent->setScaleMode( nRet );
+ } break; case XML_TOK_DATA_FORMULA: _xComponent->setDataField(ORptFilter::convertFormula(sValue)); diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index 32944bc81998..ea1095258261 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -58,7 +58,8 @@ using namespace ::xmloff::token; ::rtl::OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,const xmloff::token::XMLTokenEnum& _eAttribute); ImportDocumentHandler::ImportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) : - m_xContext(context) + m_xContext(context) + ,m_bOnlyOnce(true) { } // ----------------------------------------------------------------------------- @@ -167,7 +168,6 @@ void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName break; } } - m_xDatabaseDataProvider->execute(); } catch(uno::Exception&) { @@ -224,10 +224,52 @@ void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName bExport = false; else if ( _sName.equalsAscii("chart:plot-area")) { + sal_Bool bHasCategories = sal_True; + const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0; + ::std::auto_ptr<SvXMLTokenMap> pMasterElemTokenMap( OXMLHelper::GetSubDocumentElemTokenMap()); + for(sal_Int16 i = 0; i < nLength; ++i) + { + ::rtl::OUString sLocalName; + const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i ); + const sal_Int32 nColonPos = sAttrName.indexOf( sal_Unicode(':') ); + if( -1L == nColonPos ) + sLocalName = sAttrName; + else + sLocalName = sAttrName.copy( nColonPos + 1L ); + if ( sLocalName.equalsAscii("data-source-has-labels") ) + { + const rtl::OUString sValue = _xAttrList->getValueByIndex( i ); + bHasCategories = sValue.equalsAscii("both"); + break; + } + } // for(sal_Int16 i = 0; i < nLength; ++i) + beans::PropertyValue* pArgIter = m_aArguments.getArray(); + beans::PropertyValue* pArgEnd = pArgIter + m_aArguments.getLength(); + for(;pArgIter != pArgEnd;++pArgIter) + { + if ( pArgIter->Name.equalsAscii("HasCategories") ) + { + pArgIter->Value <<= bHasCategories; + break; + } + } // for(;pArgIter != pArgEnd;++pArgIter) + + if ( m_bOnlyOnce ) + { + try + { + m_xDatabaseDataProvider->createDataSource(m_aArguments); + m_bOnlyOnce = false; + } + catch(uno::Exception) + {} + } // if ( m_bOnlyOnce ) + SvXMLAttributeList* pList = new SvXMLAttributeList(); xNewAttribs = pList; pList->AppendAttributeList(_xAttrList); pList->AddAttribute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("table:cell-range-address")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("local-table.$A$1:.$Z$65536"))); + } if ( bExport ) @@ -239,7 +281,9 @@ void SAL_CALL ImportDocumentHandler::endElement(const ::rtl::OUString & _sName) bool bExport = true; ::rtl::OUString sNewName = _sName; if ( _sName.equalsAscii("office:report") ) + { sNewName = lcl_createAttribute(XML_NP_OFFICE,XML_CHART); + } else if ( _sName.equalsAscii("rpt:master-detail-fields") ) { if ( !m_aMasterFields.empty() ) @@ -302,7 +346,9 @@ void SAL_CALL ImportDocumentHandler::initialize( const uno::Sequence< uno::Any > uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW); xReceiver->attachDataProvider(m_xDatabaseDataProvider.get()); - } + } // if ( !m_xDatabaseDataProvider.is() ) + + m_aArguments = m_xDatabaseDataProvider->detectArguments(NULL); uno::Reference< reflection::XProxyFactory > xProxyFactory( m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory")),m_xContext), diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx index 8a8b126828fa..068fac8cb5f9 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx @@ -90,6 +90,7 @@ private: ::osl::Mutex m_aMutex; ::std::vector< ::rtl::OUString> m_aMasterFields; ::std::vector< ::rtl::OUString> m_aDetailFields; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aArguments; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xDelegatee; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxy; @@ -99,6 +100,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; ::std::auto_ptr<SvXMLTokenMap> m_pReportElemTokenMap; + bool m_bOnlyOnce; }; // ----------------------------------------------------------------------------- } // namespace rptxml diff --git a/reportdesign/source/filter/xml/xmlPropertyHandler.cxx b/reportdesign/source/filter/xml/xmlPropertyHandler.cxx index a11965caf4be..33f04d81af30 100644 --- a/reportdesign/source/filter/xml/xmlPropertyHandler.cxx +++ b/reportdesign/source/filter/xml/xmlPropertyHandler.cxx @@ -48,12 +48,10 @@ DBG_NAME( rpt_OXMLRptPropHdlFactory ) OXMLRptPropHdlFactory::OXMLRptPropHdlFactory() { DBG_CTOR( rpt_OXMLRptPropHdlFactory,NULL); - } // ----------------------------------------------------------------------------- OXMLRptPropHdlFactory::~OXMLRptPropHdlFactory() { - DBG_DTOR( rpt_OXMLRptPropHdlFactory,NULL); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 80c2c2d885f6..51307c956c65 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -566,8 +566,8 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { MAP_LEN( "OldFormat" ), 1, &::getCppuType((const sal_Bool*)0), beans::PropertyAttribute::BOUND, 0 }, { MAP_LEN( "StreamName"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN("PrivateData"), 0, &::getCppuType( (uno::Reference<XInterface> *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "BaseURI"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamRelPath"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "BaseURI"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "StreamRelPath"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; ::comphelper::MediaDescriptor aDescriptor(rDescriptor); diff --git a/reportdesign/source/inc/stringconstants.hrc b/reportdesign/source/inc/stringconstants.hrc index c9f4c520c863..69482ef4b869 100644 --- a/reportdesign/source/inc/stringconstants.hrc +++ b/reportdesign/source/inc/stringconstants.hrc @@ -160,6 +160,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FONTFAMILY); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTHEIGHT); DECLARE_CONSTASCII_USTRING(PROPERTY_CHARFONTHEIGHT); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTKERNING); +DECLARE_CONSTASCII_USTRING(PROPERTY_FONT); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTNAME); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTORIENTATION); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTPITCH); @@ -281,6 +282,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_CHARKERNING ); DECLARE_CONSTASCII_USTRING(PROPERTY_ORDER ); DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFILTER ); +DECLARE_CONSTASCII_USTRING(PROPERTY_MAXROWS ); //============================================================ //= service names diff --git a/reportdesign/source/inc/uistrings.hrc b/reportdesign/source/inc/uistrings.hrc index 07d5f492ba89..356088a19b5f 100644 --- a/reportdesign/source/inc/uistrings.hrc +++ b/reportdesign/source/inc/uistrings.hrc @@ -73,7 +73,6 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FILLGRADIENTNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLHATCHNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLBITMAPNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLSTYLE ); - DECLARE_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT ); } diff --git a/reportdesign/source/shared/stringconstants.cxx b/reportdesign/source/shared/stringconstants.cxx index f0486bf9c92c..e4123f21e3e8 100644 --- a/reportdesign/source/shared/stringconstants.cxx +++ b/reportdesign/source/shared/stringconstants.cxx @@ -113,7 +113,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTDESCRIPTORCOMPLEX , "FontDescriptorCom IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLTEXTEMPHASISMARK , "ControlTextEmphasis"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARRELIEF , "CharRelief"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARCOLOR , "CharColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VERTICALALIGN , "ParaVertAlignment"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VERTICALALIGN , "VerticalAlign"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGEPOSITION , "ImagePosition"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGEURL , "ImageURL"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARUNDERLINECOLOR , "CharUnderlineColor"); @@ -154,6 +154,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTFAMILY, "CharFontFamily"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARFONTHEIGHT, "CharHeight"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTHEIGHT, "FontHeight"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTKERNING, "FontKerning"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT, "FontDescriptor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTNAME, "FontName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTORIENTATION, "CharRotation"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTPITCH, "CharFontPitch"); @@ -273,5 +274,6 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HYPERLINKNAME , "HyperLinkName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VISITEDCHARSTYLENAME, "VisitedCharStyleName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_UNVISITEDCHARSTYLENAME, "UnvisitedCharStyleName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ORDER, "Order"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ORDER, "Order"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXROWS, "MaxRows"); diff --git a/reportdesign/source/shared/uistrings.cxx b/reportdesign/source/shared/uistrings.cxx index ceee0aea34f0..21d80cb19ad4 100644 --- a/reportdesign/source/shared/uistrings.cxx +++ b/reportdesign/source/shared/uistrings.cxx @@ -70,4 +70,3 @@ namespace rptui IMPLEMENT_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT , "TextBoxBoundContent"); } - diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index afc53270754a..034ff5f9c7b5 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -401,7 +401,6 @@ void OAddFieldWindow::Resize() // Help text Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() ); m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize ); - } // ----------------------------------------------------------------------------- uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 43e17fcff67e..d84da255e9e3 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -49,7 +49,8 @@ #include <com/sun/star/report/XReportEngine.hpp> #include <com/sun/star/report/XSection.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> -#include <cppuhelper/implbase4.hxx> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <cppuhelper/implbase5.hxx> #include <svtools/transfer.hxx> #include <svtools/lstner.hxx> #include <svx/svdedtv.hxx> @@ -81,10 +82,11 @@ namespace rptui class OSectionWindow; typedef ::dbaui::OSingleDocumentController OReportController_BASE; - typedef ::cppu::ImplHelper4 < ::com::sun::star::container::XContainerListener + typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener , ::com::sun::star::beans::XPropertyChangeListener , ::com::sun::star::view::XSelectionSupplier , ::com::sun::star::util::XModeSelector + , ::com::sun::star::embed::XVisualObject > OReportController_Listener; class OReportController : public OReportController_BASE @@ -114,6 +116,7 @@ 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 + ::com::sun::star::awt::Size m_aVisualAreaSize; ::boost::shared_ptr<rptui::OReportModel> m_aReportModel; @@ -123,6 +126,7 @@ namespace rptui sal_Int32 m_nSplitPos; /// the position of the splitter sal_Int32 m_nPageNum; /// the page number from the restoreView call sal_Int32 m_nSelectionCount; + ::sal_Int64 m_nAspect; sal_Int16 m_nZoomValue; SvxZoomType m_eZoomType; sal_Bool m_bShowRuler; @@ -133,6 +137,7 @@ namespace rptui sal_Bool m_bHelplinesMove; bool m_bChartEnabled; bool m_bChartEnabledAsked; + bool m_bInGeneratePreview; /** creates a formatted field in the given section with the given formula as data field * @@ -409,6 +414,12 @@ namespace rptui virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException) ; virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) ; + // XVisualObject + virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + /** returns the current position of the splitter * diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx index 7d11bf0d0fa8..87468d61e303 100644 --- a/reportdesign/source/ui/inc/ReportControllerObserver.hxx +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -73,8 +73,7 @@ namespace rptui 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! - + virtual ~OXReportControllerObserver(); // UNO Object must have private destructor! public: OXReportControllerObserver(const OReportController& _rController); diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index a3f20f9523df..e07dce364c59 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -137,10 +137,10 @@ namespace rptui #define PROPERTY_ID_DEEPTRAVERSING 25 #define PROPERTY_ID_PREEVALUATED 26 - #define PROPERTY_ID_BACKCOLOR 29 - #define PROPERTY_ID_CONTROLBACKGROUND 30 #define PROPERTY_ID_BACKTRANSPARENT 27 #define PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT 28 + #define PROPERTY_ID_BACKCOLOR 29 + #define PROPERTY_ID_CONTROLBACKGROUND 30 #define PROPERTY_ID_FORMULALIST 31 #define PROPERTY_ID_SCOPE 32 @@ -152,6 +152,11 @@ namespace rptui #define PROPERTY_ID_AREA 38 #define PROPERTY_ID_MIMETYPE 39 + #define PROPERTY_ID_FONT 40 + #define PROPERTY_ID_PARAADJUST 41 + #define PROPERTY_ID_VERTICALALIGN 42 + + //............................................................................ } // namespace rptui //............................................................................ diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 66a922daeed9..3a9ebf033e03 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -163,9 +163,10 @@ void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface m_xReportComponent.set( xNameCont->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReportComponent" ) ) ), uno::UNO_QUERY ); if ( m_xDataProvider.is() ) { + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); TPropertyNamePair aPropertyMediation; - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, PROPERTY_MASTERFIELDS ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, PROPERTY_DETAILFIELDS ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, TPropertyConverter(PROPERTY_MASTERFIELDS,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, TPropertyConverter(PROPERTY_DETAILFIELDS,aNoConverter) ) ); m_xMasterDetails = new OPropertyMediator( m_xDataProvider.get(), m_xReportComponent.get(), aPropertyMediation,sal_True ); } @@ -488,7 +489,8 @@ void SAL_CALL DataProviderHandler::actuatingPropertyChanged(const ::rtl::OUStrin xReceiver->setArguments( aArgs ); if ( !bModified ) xReport->setModified(sal_False); - } + } // if ( NewValue != OldValue ) + m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit); } // if ( ActuatingPropertyName == PROPERTY_COMMAND ) else if ( ActuatingPropertyName == PROPERTY_TITLE ) { diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 95b7cdc3fcea..c2d9f067ff75 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -61,10 +61,11 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/inspection/XNumericControl.hpp> -#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> @@ -651,7 +652,7 @@ void SAL_CALL GeometryHandler::setPropertyValue(const ::rtl::OUString & Property } } break; - case PROPERTY_ID_CHARFONTNAME: + case PROPERTY_ID_FONT: { const uno::Reference< report::XReportControlFormat > xReportControlFormat( m_xReportComponent,uno::UNO_QUERY_THROW ); uno::Sequence< beans::NamedValue > aFontSettings; @@ -825,7 +826,7 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const case PROPERTY_ID_CONTROLBACKGROUND: aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::ColorListBox, sal_False ); break; - case PROPERTY_ID_CHARFONTNAME: + case PROPERTY_ID_FONT: aOut.PrimaryButtonId = UID_RPT_RPT_PROP_DLG_FONT_TYPE; aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True ); aOut.HasPrimaryButton = sal_True; @@ -835,6 +836,12 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True ); aOut.HasPrimaryButton = sal_True; break; + case PROPERTY_ID_VERTICALALIGN: + implCreateListLikeControl(_xControlFactory,aOut,RID_STR_VERTICAL_ALIGN_CONST,sal_False,sal_True); + break; + case PROPERTY_ID_PARAADJUST: + implCreateListLikeControl(_xControlFactory,aOut,RID_STR_PARAADJUST_CONST,sal_False,sal_True); + break; default: { aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory); @@ -1051,8 +1058,9 @@ uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString aPropertyValue <<= nPosX; } break; - case PROPERTY_ID_CHARFONTNAME: - return m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONTNAME, _rControlValue); + case PROPERTY_ID_FONT: + aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONT, _rControlValue); + break; case PROPERTY_ID_SCOPE: case PROPERTY_ID_FORMULALIST: case PROPERTY_ID_AREA: @@ -1072,6 +1080,28 @@ uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString case PROPERTY_ID_MIMETYPE: aPropertyValue = _rControlValue; break; + case PROPERTY_ID_VERTICALALIGN: + { + ::rtl::OUString sValue; + _rControlValue >>= sValue; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList); + ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue); + if ( aFind != aList.end() ) + aPropertyValue <<= static_cast<style::VerticalAlignment>(aFind - aList.begin()); + } + break; + case PROPERTY_ID_PARAADJUST: + { + ::rtl::OUString sValue; + _rControlValue >>= sValue; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList); + ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue); + if ( aFind != aList.end() ) + aPropertyValue <<= static_cast<sal_Int16>(aFind - aList.begin()); + } + break; default: return m_xFormComponentHandler->convertToPropertyValue(PropertyName, _rControlValue); } @@ -1158,8 +1188,8 @@ uno::Any SAL_CALL GeometryHandler::convertToControlValue(const ::rtl::OUString & lcl_convertFormulaTo(aPropertyValue,aControlValue); } break; - case PROPERTY_ID_CHARFONTNAME: - aControlValue = m_xFormComponentHandler->convertToControlValue(PROPERTY_FONTNAME, aPropertyValue, _rControlValueType); + case PROPERTY_ID_FONT: + aControlValue = m_xFormComponentHandler->convertToControlValue(PROPERTY_FONT, aPropertyValue, _rControlValueType); break; case PROPERTY_ID_POSITIONX: { @@ -1189,6 +1219,26 @@ uno::Any SAL_CALL GeometryHandler::convertToControlValue(const ::rtl::OUString & aControlValue <<= aList[m_nDataFieldType]; } break; + case PROPERTY_ID_VERTICALALIGN: + { + style::VerticalAlignment nParagraphVertAlign = style::VerticalAlignment_TOP; + aPropertyValue >>= nParagraphVertAlign; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList); + if ( static_cast<sal_Int16>(nParagraphVertAlign) < static_cast<sal_Int16>(aList.size()) ) + aControlValue <<= aList[nParagraphVertAlign]; + } + break; + case PROPERTY_ID_PARAADJUST: + { + sal_Int16 nParagraphAdjust = style::ParagraphAdjust_LEFT; + aPropertyValue >>= nParagraphAdjust; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList); + if ( nParagraphAdjust < static_cast<sal_Int16>(aList.size()) ) + aControlValue <<= aList[nParagraphAdjust]; + } + break; case PROPERTY_ID_BACKCOLOR: case PROPERTY_ID_CONTROLBACKGROUND: { @@ -1249,13 +1299,15 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie ,PROPERTY_INITIALFORMULA ,PROPERTY_PRESERVEIRI ,PROPERTY_DATAFIELD - ,PROPERTY_CHARFONTNAME + ,PROPERTY_FONT ,PROPERTY_BACKCOLOR ,PROPERTY_BACKTRANSPARENT ,PROPERTY_CONTROLBACKGROUND ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT ,PROPERTY_LABEL ,PROPERTY_MIMETYPE + ,PROPERTY_VERTICALALIGN + ,PROPERTY_PARAADJUST }; const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo(); const uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); @@ -1346,7 +1398,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr } return eResult; } - else if ( PropertyName.equalsAscii(PROPERTY_CHARFONTNAME) ) + else if ( PropertyName.equalsAscii(PROPERTY_FONT) ) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); diff --git a/reportdesign/source/ui/inspection/inspection.src b/reportdesign/source/ui/inspection/inspection.src index c13eb2a141c9..42d62ba94b37 100644 --- a/reportdesign/source/ui/inspection/inspection.src +++ b/reportdesign/source/ui/inspection/inspection.src @@ -336,6 +336,48 @@ String RID_STR_MIMETYPE { Text [ en-US ] = "Report Output Format" ; }; +String RID_STR_VERTICALALIGN +{ + Text [ en-US ] = "Vert. Alignment" ; +}; +Resource RID_STR_VERTICAL_ALIGN_CONST +{ + String 1 + { + Text [ en-US ] = "Top"; + }; + String 2 + { + Text [ en-US ] = "Middle"; + }; + String 3 + { + Text [ en-US ] = "Bottom"; + }; +}; +String RID_STR_PARAADJUST +{ + Text [ en-US ] = "Horz. Alignment" ; +}; +Resource RID_STR_PARAADJUST_CONST +{ + String 1 + { + Text [ en-US ] = "Left"; + }; + String 2 + { + Text [ en-US ] = "Right"; + }; + String 3 + { + Text [ en-US ] = "Block"; + }; + String 4 + { + Text [ en-US ] = "Center"; + }; +}; String RID_STR_F_COUNTER { Text [ en-US ] = "Counter" ; @@ -352,3 +394,4 @@ String RID_STR_F_MAXIMUM { Text [ en-US ] = "Maximum" ; }; + diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index 8c4e9a8aac00..82a19c2e1b1a 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -131,7 +131,6 @@ namespace rptui // this ensures that we have our resource file loaded sal_uInt16 nPos = 1; - static OPropertyInfoImpl aPropertyInfos[] = { /* @@ -156,7 +155,7 @@ namespace rptui ,DEF_INFO_1( POSITIONY, POSITIONY, RPT_POSITIONY, COMPOSEABLE ) ,DEF_INFO_1( WIDTH, WIDTH, RPT_WIDTH, COMPOSEABLE ) ,DEF_INFO_1( HEIGHT, HEIGHT, RPT_HEIGHT, COMPOSEABLE ) - ,DEF_INFO_1( CHARFONTNAME, FONT, RPT_FONT, COMPOSEABLE ) + ,DEF_INFO_1( FONT, FONT, RPT_FONT, COMPOSEABLE ) ,DEF_INFO_1( PREEVALUATED, PREEVALUATED, PREEVALUATED, COMPOSEABLE ) ,DEF_INFO_1( DEEPTRAVERSING, DEEPTRAVERSING, DEEPTRAVERSING, COMPOSEABLE ) ,DEF_INFO_1( FORMULA, FORMULA, FORMULA, COMPOSEABLE ) @@ -177,6 +176,8 @@ namespace rptui ,DEF_INFO_2( DETAILFIELDS, DETAILFIELDS, DETAILFIELDS, COMPOSEABLE,DATA_PROPERTY) ,DEF_INFO_1( AREA, AREA, AREA, COMPOSEABLE ) ,DEF_INFO_2( MIMETYPE, MIMETYPE, MIMETYPE, COMPOSEABLE,DATA_PROPERTY ) + ,DEF_INFO_1( PARAADJUST, PARAADJUST, PARAADJUST, COMPOSEABLE ) + ,DEF_INFO_1( VERTICALALIGN, VERTICALALIGN, VERTICALALIGN, COMPOSEABLE ) }; s_pPropertyInfos = aPropertyInfos; @@ -298,13 +299,15 @@ namespace rptui ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HideInactiveSelection")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubmitAction")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputRequired")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VerticalAlign")), + PROPERTY_ALIGN, PROPERTY_EMPTY_IS_NULL, PROPERTY_FILTERPROPOSAL ,PROPERTY_POSITIONX ,PROPERTY_POSITIONY ,PROPERTY_WIDTH ,PROPERTY_HEIGHT - ,PROPERTY_FONTNAME + ,PROPERTY_FONT ,PROPERTY_LABEL ,PROPERTY_LINECOLOR ,PROPERTY_BORDER @@ -317,6 +320,7 @@ namespace rptui ,PROPERTY_SCOPE ,PROPERTY_TYPE ,PROPERTY_DATASOURCENAME + ,PROPERTY_VERTICALALIGN }; beans::Property* pPropsIter = aProps.getArray(); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index faa4a22c8fc0..7bbdb87cc48d 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -99,7 +99,7 @@ #include <com/sun/star/report/XGroups.hpp> #include <com/sun/star/awt/TextAlign.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/report/XShape.hpp> #include <com/sun/star/report/Function.hpp> #include <com/sun/star/sdb/XParametersSupplier.hpp> @@ -166,101 +166,6 @@ namespace rptui using namespace ::com::sun::star; using namespace formula; // ----------------------------------------------------------------------------- -SvxCellHorJustify lcl_MapHorizontalAlignment(const sal_Int16 _nAlign) -{ - SvxCellHorJustify eRet = SVX_HOR_JUSTIFY_STANDARD; - switch(_nAlign) - { - case awt::TextAlign::LEFT: - eRet = SVX_HOR_JUSTIFY_LEFT; - break; - case awt::TextAlign::CENTER: - eRet = SVX_HOR_JUSTIFY_CENTER; - break; - case awt::TextAlign::RIGHT: - eRet = SVX_HOR_JUSTIFY_RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return eRet; -} -// ----------------------------------------------------------------------------- -sal_Int16 lcl_MapHorizontalAlignment(const SvxCellHorJustify _eAlign) -{ - sal_Int16 nRet = awt::TextAlign::LEFT; - switch(_eAlign) - { - case SVX_HOR_JUSTIFY_LEFT: - nRet = awt::TextAlign::LEFT; - break; - case SVX_HOR_JUSTIFY_CENTER: - nRet = awt::TextAlign::CENTER; - break; - case SVX_HOR_JUSTIFY_RIGHT: - nRet = awt::TextAlign::RIGHT; - break; - case SVX_HOR_JUSTIFY_BLOCK: - case SVX_HOR_JUSTIFY_REPEAT: - nRet = awt::TextAlign::CENTER; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return nRet; -} -// ----------------------------------------------------------------------------- -SvxCellVerJustify lcl_MapVerticalAlignment(const sal_Int16 _nAlign) -{ - SvxCellVerJustify eRet = SVX_VER_JUSTIFY_STANDARD; - switch(_nAlign) - { - case text::ParagraphVertAlign::AUTOMATIC: - case text::ParagraphVertAlign::BASELINE: - eRet = SVX_VER_JUSTIFY_STANDARD; - break; - case text::ParagraphVertAlign::TOP: - eRet = SVX_VER_JUSTIFY_TOP; - break; - case text::ParagraphVertAlign::CENTER: - eRet = SVX_VER_JUSTIFY_CENTER; - break; - case text::ParagraphVertAlign::BOTTOM: - eRet = SVX_VER_JUSTIFY_BOTTOM; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return eRet; -} -// ----------------------------------------------------------------------------- -sal_Int16 lcl_MapVerticalAlignment(const SvxCellVerJustify _eAlign) -{ - sal_Int16 nRet = text::ParagraphVertAlign::TOP; - switch(_eAlign) - { - case SVX_VER_JUSTIFY_STANDARD: - nRet = text::ParagraphVertAlign::AUTOMATIC; - break; - case SVX_VER_JUSTIFY_TOP: - nRet = text::ParagraphVertAlign::TOP; - break; - case SVX_VER_JUSTIFY_CENTER: - nRet = text::ParagraphVertAlign::CENTER; - break; - case SVX_VER_JUSTIFY_BOTTOM: - nRet = text::ParagraphVertAlign::BOTTOM; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return nRet; -} -// ----------------------------------------------------------------------------- void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos) { OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF"); @@ -355,8 +260,9 @@ namespace case COMPLEX: aLocale = _rxReportControlFormat->getCharLocaleComplex(); break; - } - _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguage(aLocale),_nLanguage)); + } // switch(_nWhich) + + _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguageWithFallback(aLocale),_nLanguage)); _rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture)); _rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight)); @@ -425,6 +331,8 @@ namespace if ( !_rxReportControlFormat.is() ) throw lang::NullPointerException(); + uno::Reference< beans::XPropertySet > xSet(_rxReportControlFormat,uno::UNO_QUERY_THROW); + // fill it const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) ); @@ -450,9 +358,13 @@ namespace _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE)); _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W)); - _rItemSet.Put(SvxHorJustifyItem(lcl_MapHorizontalAlignment(_rxReportControlFormat->getParaAdjust()),ITEMID_HORJUSTIFY)); + SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY); + aHorJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_PARAADJUST),MID_HORJUST_ADJUST); + _rItemSet.Put(aHorJustifyItem); //_rItemSet.Put(SfxInt32Item(ITEMID_DEGREES,_rxReportControlFormat->getCharRotation())); - _rItemSet.Put(SvxVerJustifyItem(lcl_MapVerticalAlignment(_rxReportControlFormat->getParaVertAlignment()),ITEMID_VERJUSTIFY)); + SvxVerJustifyItem aVerJustifyItem(ITEMID_VERJUSTIFY); + aVerJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_VERTICALALIGN),0); + _rItemSet.Put(aVerJustifyItem); //_rItemSet.Put(SfxInt32Item(ITEMID_IDENT,_rxReportControlFormat->getCharRotation())); uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY); @@ -569,12 +481,16 @@ namespace if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem)) { const SvxHorJustifyItem* pJustifyItem = static_cast<const SvxHorJustifyItem*>(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, uno::makeAny( lcl_MapHorizontalAlignment( static_cast< SvxCellHorJustify >( pJustifyItem->GetEnumValue() ) ) ) ); + uno::Any aValue; + pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST); + lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, aValue ); } if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem)) { const SvxVerJustifyItem* pJustifyItem = static_cast<const SvxVerJustifyItem*>(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, uno::makeAny( lcl_MapVerticalAlignment( static_cast< SvxCellVerJustify >( pJustifyItem->GetEnumValue() ) ) ) ); + uno::Any aValue; + pJustifyItem->QueryValue(aValue,0); + lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, aValue ); } if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem)) { @@ -724,7 +640,8 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE }, - { SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, + //{ SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, + { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE }, { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE }, { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE }, @@ -798,19 +715,17 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep 0 }; - bool bSuccess = false; - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) ); // not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same - + bool bSuccess = false; try { - - SfxItemSet aDescriptor( *pPool, pRanges ); - lcl_CharPropertiesToItems( _rxReportControlFormat, aDescriptor ); + ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) ); + lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor ); { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(pParent, &aDescriptor, RID_PAGEDIALOG_CHAR); + ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR); uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY ); if ( xShape.is() ) aDlg.RemoveTabPage( RID_PAGE_BACKGROUND ); @@ -829,7 +744,6 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep } SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) delete pDefaults[i]; @@ -856,16 +770,16 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R try { SfxItemPool& rItemPool = pModel->GetItemPool(); - SfxItemSet aDescriptor( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ); + ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) ); - lcl_fillShapeToItems(_xShape, aDescriptor); + lcl_fillShapeToItems(_xShape,*pDescriptor); { // want the dialog to be destroyed before our set SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent, &aDescriptor, pModel.get(), RID_SVXDLG_AREA )); + ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get(),RID_SVXDLG_AREA )); // #i74099# by default, the dialog deletes the current color table if a different one is loaded // (see SwDrawShell::ExecDrawDlg) - const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( aDescriptor.GetItem(SID_COLOR_TABLE) ); + const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( pDescriptor->GetItem(SID_COLOR_TABLE) ); if (pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable()) pDialog->DontDeleteColorTable(); bSuccess = ( RET_OK == pDialog->Execute() ); @@ -874,6 +788,7 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet()); } } + } catch(uno::Exception&) { @@ -917,7 +832,7 @@ void applyCharacterSettings( const uno::Reference< report::XReportControlFormat lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor ); lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust ); - lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setParaVertAlignment ); + lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning ); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 89939759abbd..777af6dd83fa 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -62,6 +62,7 @@ #include "reportformula.hxx" #include <comphelper/documentconstants.hxx> +#include <comphelper/mediadescriptor.hxx> #include <comphelper/property.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/types.hxx> @@ -71,11 +72,13 @@ #include <com/sun/star/style/GraphicLocation.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/report/XImageControl.hpp> @@ -89,6 +92,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/EmbedMapUnits.hpp> #include <comphelper/streamsection.hxx> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontUnderline.hpp> @@ -160,6 +164,8 @@ #include <ReportControllerObserver.hxx> +#define MAX_ROWS_FOR_PREVIEW 50 + using namespace ::com::sun::star; using namespace uno; using namespace io; @@ -306,6 +312,7 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon ,m_bHelplinesMove(sal_True) ,m_bChartEnabled(false) ,m_bChartEnabledAsked(false) +,m_bInGeneratePreview(false) { // new Observer m_pReportControllerObserver = new OXReportControllerObserver(*this); @@ -850,6 +857,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const case SID_ATTR_PARA_ADJUST_LEFT: case SID_ATTR_PARA_ADJUST_CENTER: case SID_ATTR_PARA_ADJUST_RIGHT: + case SID_ATTR_PARA_ADJUST_BLOCK: impl_fillState_nothrow(PROPERTY_PARAADJUST,aReturn); if ( aReturn.bEnabled ) { @@ -858,15 +866,19 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const { switch(nParaAdjust) { - case awt::TextAlign::LEFT: + case style::ParagraphAdjust_LEFT: aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_LEFT; break; - case awt::TextAlign::CENTER: - aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER; - break; - case awt::TextAlign::RIGHT: + case style::ParagraphAdjust_RIGHT: aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_RIGHT; break; + case style::ParagraphAdjust_BLOCK: + case style::ParagraphAdjust_STRETCH: + aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_BLOCK; + break; + case style::ParagraphAdjust_CENTER: + aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER; + break; } } // if ( aReturn.aValue >>= nParaAdjust ) aReturn.aValue.clear(); @@ -1505,25 +1517,30 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_ATTR_PARA_ADJUST_LEFT: case SID_ATTR_PARA_ADJUST_CENTER: case SID_ATTR_PARA_ADJUST_RIGHT: + case SID_ATTR_PARA_ADJUST_BLOCK: { - sal_Int16 nValue = awt::TextAlign::LEFT; + sal_Int16 eParagraphAdjust = style::ParagraphAdjust_LEFT; switch(_nId) { case SID_ATTR_PARA_ADJUST_LEFT: - nValue = awt::TextAlign::LEFT; + eParagraphAdjust = style::ParagraphAdjust_LEFT; break; case SID_ATTR_PARA_ADJUST_CENTER: - nValue = awt::TextAlign::CENTER; + eParagraphAdjust = style::ParagraphAdjust_CENTER; break; case SID_ATTR_PARA_ADJUST_RIGHT: - nValue = awt::TextAlign::RIGHT; + eParagraphAdjust = style::ParagraphAdjust_RIGHT; + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + eParagraphAdjust = style::ParagraphAdjust_BLOCK; break; } // switch(_nId) - impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::makeAny(nValue),aArgs); + impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::makeAny(eParagraphAdjust),aArgs); InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT); InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER); InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT); + InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK); } break; case SID_CHAR_DLG: @@ -1686,7 +1703,11 @@ void OReportController::impl_initialize( ) m_xFormatter.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY); m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY)); - if ( !m_xReportDefinition->getCommand().getLength() && getConnection().is()) + ::comphelper::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() ); + ::rtl::OUString sHierarchicalDocumentName; + sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),sHierarchicalDocumentName); + + if ( !sHierarchicalDocumentName.getLength() && getConnection().is() ) { uno::Reference<sdbcx::XTablesSupplier> xTablesSup(getConnection(),uno::UNO_QUERY_THROW); uno::Reference<container::XNameAccess> xTables = xTablesSup->getTables(); @@ -1866,6 +1887,8 @@ void OReportController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT, CommandGroup::FORMAT ); @@ -2418,26 +2441,24 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ SID_ATTR_METRIC,SID_ATTR_METRIC, 0 }; - - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE,RPTUI_ID_METRIC, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE,RPTUI_ID_METRIC, aItemInfos, pDefaults) ); pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same try { - SfxItemSet aDescriptor(*pPool, pRanges); - + ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); // fill it if ( _xSection.is() ) - aDescriptor.Put(SvxBrushItem(::Color(_xSection->getBackColor()),ITEMID_BRUSH)); + pDescriptor->Put(SvxBrushItem(::Color(_xSection->getBackColor()),ITEMID_BRUSH)); else { - aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE)))); - aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN) + pDescriptor->Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE)))); + pDescriptor->Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN) ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,0,RPTUI_ID_LRSPACE)); - aDescriptor.Put(SvxULSpaceItem(static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN)) + pDescriptor->Put(SvxULSpaceItem(static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN)) ,static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE)); - aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<UINT16>(eUserMetric))); + pDescriptor->Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<UINT16>(eUserMetric))); uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition)); if ( xPageStyle.is() ) @@ -2448,13 +2469,13 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT); aPageItem.SetLandscape(getStyleProperty<sal_Bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE)); aPageItem.SetNumType((SvxNumType)getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)); - aDescriptor.Put(aPageItem); - aDescriptor.Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH)); + pDescriptor->Put(aPageItem); + pDescriptor->Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH)); } } { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(getView(), &aDescriptor, _xSection.is() ? RID_PAGEDIALOG_BACKGROUND : RID_PAGEDIALOG_PAGE); + ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is() ? RID_PAGEDIALOG_BACKGROUND : RID_PAGEDIALOG_PAGE); if (RET_OK == aDlg.Execute()) { // ------------ @@ -2516,11 +2537,11 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ { DBG_UNHANDLED_EXCEPTION(); } - SfxItemPool::Free(pPool); for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) delete pDefaults[i]; + } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel) throw( uno::RuntimeException ) @@ -2895,6 +2916,7 @@ uno::Reference<frame::XModel> OReportController::executeReport() } else { + m_bInGeneratePreview = true; try { WaitObject aWait(getView()); // cursor @@ -2943,7 +2965,8 @@ uno::Reference<frame::XModel> OReportController::executeReport() { const String suSQLContext = String( ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT ) ); aInfo.prepend(suSQLContext); - } + } // if (aInfo.isValid()) + m_bInGeneratePreview = false; } if (aInfo.isValid()) @@ -2975,11 +2998,12 @@ uno::Reference< sdbc::XRowSet > OReportController::getRowSet() xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::makeAny( getConnection() ) ); xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( sal_True ) ); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); TPropertyNamePair aPropertyMediation; - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND, PROPERTY_COMMAND ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE, PROPERTY_COMMANDTYPE ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING, PROPERTY_ESCAPEPROCESSING ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_FILTER, PROPERTY_FILTER ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING, TPropertyConverter(PROPERTY_ESCAPEPROCESSING,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) ) ); m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition.get(), xRowSetProp, aPropertyMediation ); m_xRowSet = xRowSet; @@ -4221,21 +4245,18 @@ void OReportController::openZoomDialog() SID_ATTR_ZOOM,SID_ATTR_ZOOM, 0 }; - - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults) ); pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same - try { - SfxItemSet aDescriptor(*pPool, pRanges); - + ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); // fill it SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); aZoomItem.SetValueSet(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_WHOLEPAGE|SVX_ZOOM_ENABLE_PAGEWIDTH); - aDescriptor.Put(aZoomItem); + pDescriptor->Put(aZoomItem); - ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, aDescriptor, RID_SVXDLG_ZOOM) ); + ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get(), RID_SVXDLG_ZOOM) ); pDlg->SetLimits( 20, 400 ); bool bCancel = ( RET_CANCEL == pDlg->Execute() ); @@ -4254,7 +4275,6 @@ void OReportController::openZoomDialog() { DBG_UNHANDLED_EXCEPTION(); } - SfxItemPool::Free(pPool); for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) @@ -4262,3 +4282,70 @@ void OReportController::openZoomDialog() } // if(pFact) } // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// XVisualObject +void SAL_CALL OReportController::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + //if( nAspect == embed::Aspects::MSOLE_CONTENT ) + { + bool bChanged = + (m_aVisualAreaSize.Width != _aSize.Width || + m_aVisualAreaSize.Height != _aSize.Height); + m_aVisualAreaSize = _aSize; + if( bChanged ) + setModified( sal_True ); + } + m_nAspect = _nAspect; +} +// ----------------------------------------------------------------------------- +awt::Size SAL_CALL OReportController::getVisualAreaSize( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + return m_aVisualAreaSize; +} +// ----------------------------------------------------------------------------- +embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( getMutex() ); + embed::VisualRepresentation aResult; + if ( !m_bInGeneratePreview ) + { + m_bInGeneratePreview = true; + try + { + if ( !m_xReportEngine.is() ) + m_xReportEngine.set(getORB()->createInstance(SERVICE_REPORTENGINE),uno::UNO_QUERY_THROW); + const sal_Int32 nOldMaxRows = m_xReportEngine->getMaxRows(); + m_xReportEngine->setMaxRows(MAX_ROWS_FOR_PREVIEW); + m_xReportEngine->setReportDefinition(m_xReportDefinition); + m_xReportEngine->setActiveConnection(getConnection()); + try + { + Reference<embed::XVisualObject> xTransfer(m_xReportEngine->createDocumentModel(),UNO_QUERY); + if ( xTransfer.is() ) + { + xTransfer->setVisualAreaSize(m_nAspect,m_aVisualAreaSize); + aResult = xTransfer->getPreferredVisualRepresentation( _nAspect ); + } // if ( xTransfer.is() ) + } + catch( uno::Exception & ex ) + { + (void)ex; + } + m_xReportEngine->setMaxRows(nOldMaxRows); + } + catch( uno::Exception & ex ) + { + (void)ex; + } + m_bInGeneratePreview = false; + } + return aResult; +} +// ----------------------------------------------------------------------------- +::sal_Int32 SAL_CALL OReportController::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException) +{ + return embed::EmbedMapUnits::ONE_100TH_MM; +} diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 42ceaaea5eba..aebf42bfaa00 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1104,7 +1104,9 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _ // pNewObj->Move(Size(_aRect.Left(), _aRect.Top())); pNewObj->Move(Size(0, aNewPos.Y())); + BOOL bChanged = rView.GetModel()->IsChanged(); rReportSection.getPage()->InsertObject(pNewObj); + rView.GetModel()->SetChanged(bChanged); m_aBegDragTempList.push_back(pNewObj); Rectangle aRect = pNewObj->GetLogicRect(); @@ -1120,16 +1122,7 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _ // ----------------------------------------------------------------------------- bool OViewsWindow::isObjectInMyTempList(SdrObject *_pObj) { - ::std::vector<SdrObject*>::iterator aIter = m_aBegDragTempList.begin(); - ::std::vector<SdrObject*>::iterator aEnd = m_aBegDragTempList.end(); - for (; aIter != aEnd; ++aIter) - { - if (*aIter == _pObj) - { - return true; - } - } - return false; + return ::std::find(m_aBegDragTempList.begin(),m_aBegDragTempList.end(),_pObj) != m_aBegDragTempList.end(); } // ----------------------------------------------------------------------------- @@ -1552,7 +1545,6 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bo const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height(); aRealMousePos.Y() -= nSectionHeight; } - #if 0 #if OSL_DEBUG_LEVEL > 0 // TEST TEST TEST TEST diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 3b8dd3616ee5..111cc936ace3 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -446,6 +446,7 @@ void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> // ----------------------------------------------------------------------------- uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj) { + _pObj->initializeOle(); return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent()); } //---------------------------------------------------------------------------- diff --git a/reportdesign/uiconfig/dbreport/menubar/menubar.xml b/reportdesign/uiconfig/dbreport/menubar/menubar.xml index a8c8d2e0d871..8fa04f47ba7f 100644 --- a/reportdesign/uiconfig/dbreport/menubar/menubar.xml +++ b/reportdesign/uiconfig/dbreport/menubar/menubar.xml @@ -37,7 +37,6 @@ <menu:menuitem menu:id=".uno:SelectAllLabels"/> <menu:menuitem menu:id=".uno:SelectAllEdits"/> <menu:menuitem menu:id=".uno:SelectReport"/> - <menu:menuitem menu:id=".uno:SelectObject"/> </menu:menupopup> </menu:menu> <menu:menuseparator/> @@ -47,6 +46,74 @@ <menu:menuitem menu:id=".uno:ReportHeaderFooter"/> <menu:menuitem menu:id=".uno:ColumnHeaderFooter"/> <menu:menuseparator/> + + <menu:menu menu:id=".uno:EditShapeMenu"> + <menu:menupopup> + <!-- + <menu:menu menu:id=".uno:ArrangeMenu"> + <menu:menupopup> +--> + <menu:menuitem menu:id=".uno:BringToFront"/> + <menu:menuitem menu:id=".uno:ObjectBackOne"/> + <menu:menuitem menu:id=".uno:ObjectForwardOne"/> + <menu:menuitem menu:id=".uno:SendToBack"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SetObjectToForeground"/> + <menu:menuitem menu:id=".uno:SetObjectToBackground"/> + <!-- + </menu:menupopup> + </menu:menu> +--> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:EditControlMenu"> + <menu:menupopup> + <menu:menu menu:id=".uno:ObjectAlign" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:ObjectAlignLeft"/> + <menu:menuitem menu:id=".uno:AlignCenter"/> + <menu:menuitem menu:id=".uno:ObjectAlignRight"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:AlignUp"/> + <menu:menuitem menu:id=".uno:AlignMiddle"/> + <menu:menuitem menu:id=".uno:AlignDown"/> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:ObjectResize" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SmallestWidth"/> + <menu:menuitem menu:id=".uno:GreatestWidth"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SmallestHeight"/> + <menu:menuitem menu:id=".uno:GreatestHeight"/> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:SectionAlignmentMenu" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SectionAlignLeft"/> + <menu:menuitem menu:id=".uno:SectionAlignRight"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SectionAlignTop"/> + <menu:menuitem menu:id=".uno:SectionAlignBottom"/> + </menu:menupopup> + </menu:menu> + + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:SectionShrinkMenu" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SectionShrink"/> + <menu:menuitem menu:id=".uno:SectionShrinkTop"/> + <menu:menuitem menu:id=".uno:SectionShrinkBottom"/> + </menu:menupopup> + </menu:menu> + + + <menu:menuseparator/> <menu:menuitem menu:id=".uno:ExecuteReport"/> </menu:menupopup> </menu:menu> @@ -85,6 +152,10 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:ReportControlMenu" > <menu:menupopup> + <menu:menuitem menu:id=".uno:SelectObject"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ControlProperties"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:Label" /> <menu:menuitem menu:id=".uno:Edit" /> <menu:menuitem menu:id=".uno:ImageControl" /> @@ -304,23 +375,6 @@ <menu:menuitem menu:id=".uno:GreatestHeight"/> </menu:menupopup> </menu:menu> - <menu:menu menu:id=".uno:SectionAlignmentMenu" > - <menu:menupopup> - <menu:menuitem menu:id=".uno:SectionAlignLeft"/> - <menu:menuitem menu:id=".uno:SectionAlignRight"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:SectionAlignTop"/> - <menu:menuitem menu:id=".uno:SectionAlignBottom"/> - </menu:menupopup> - </menu:menu> - <menu:menuseparator/> - <menu:menu menu:id=".uno:SectionShrinkMenu" > - <menu:menupopup> - <menu:menuitem menu:id=".uno:SectionShrink"/> - <menu:menuitem menu:id=".uno:SectionShrinkTop"/> - <menu:menuitem menu:id=".uno:SectionShrinkBottom"/> - </menu:menupopup> - </menu:menu> <menu:menuseparator/> <menu:menuitem menu:id=".uno:Distribution"/> </menu:menupopup> diff --git a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml index c4fe386324a7..2fc8494938d4 100644 --- a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml +++ b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml @@ -14,6 +14,7 @@ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio" /> <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio" /> <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:style="radio" /> + <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="helpid:10031" toolbar:text="" toolbar:style="radio" /> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:FontColor" toolbar:style="dropdown" /> <toolbar:toolbaritem xlink:href=".uno:BackgroundColor" toolbar:style="dropdown" /> diff --git a/reportdesign/util/hidother.src b/reportdesign/util/hidother.src index f0b1e8d5aa72..15cc051a5193 100644 --- a/reportdesign/util/hidother.src +++ b/reportdesign/util/hidother.src @@ -165,8 +165,10 @@ hidspecial HID_RPT_PROP_AREA { HelpId = HID_RPT_PROP_AREA; }; hidspecial UID_RPT_RPT_PROP_DLG_AREA { HelpId = UID_RPT_RPT_PROP_DLG_AREA; }; hidspecial UID_RPT_PROP_FORMULA { HelpId = UID_RPT_PROP_FORMULA; }; -hidspecial HID_RPT_GROUPSORT_MOVE_UP { HelpId = HID_RPT_GROUPSORT_MOVE_UP; }; -hidspecial HID_RPT_GROUPSORT_MOVE_DOWN { HelpId = HID_RPT_GROUPSORT_MOVE_DOWN; }; -hidspecial HID_RPT_GROUPSORT_DELETE { HelpId = HID_RPT_GROUPSORT_DELETE; }; -hidspecial HID_RPT_PROP_MIMETYPE { HelpId = HID_RPT_PROP_MIMETYPE; }; +hidspecial HID_RPT_GROUPSORT_MOVE_UP { HelpId = HID_RPT_GROUPSORT_MOVE_UP; }; +hidspecial HID_RPT_GROUPSORT_MOVE_DOWN { HelpId = HID_RPT_GROUPSORT_MOVE_DOWN; }; +hidspecial HID_RPT_GROUPSORT_DELETE { HelpId = HID_RPT_GROUPSORT_DELETE; }; +hidspecial HID_RPT_PROP_MIMETYPE { HelpId = HID_RPT_PROP_MIMETYPE; }; +hidspecial HID_RPT_PROP_VERTICALALIGN { HelpId = HID_RPT_PROP_VERTICALALIGN; }; +hidspecial HID_RPT_PROP_PARAADJUST { HelpId = HID_RPT_PROP_PARAADJUST; }; |