[Libreoffice-bugs] [Bug 117162] REPORTBUILDER - Chart isn't shown in report
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Sun Dec 8 12:51:18 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=117162
Julien Nabet <serval2412 at yahoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lionel at mamane.lu
--- Comment #7 from Julien Nabet <serval2412 at yahoo.fr> ---
Lionel:
noticing
warn:legacy.osl:151246:151246:embeddedobj/source/commonembedding/persistence.cxx:209:
Consider implementing interface XInitialization to avoid duplicate
construction, I tried to implement this.
+ warn:legacy.osl:152196:152196:chart2/source/model/filter/XMLFilter.cxx:574:
Exception caught!
I noticed this was due to:
301
m_xDatabaseDataProvider.set(m_xModel->getDataProvider(),uno::UNO_QUERY_THROW);
302 if ( !m_xDatabaseDataProvider->getActiveConnection().is() )
303 throw uno::Exception("no active connection", nullptr);
See
https://opengrok.libreoffice.org/xref/core/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx?r=f13c6ad5#303
I could confirm this when moving this block some lines after in following "if"
"if ( !sCommand.isEmpty() )"
Indeed, when creating a report with just by default chart, it doesn't create a
command (since there's no SQL). However, when reopening the report, instead of
1 graph, I had 3.
So I thought about implementing "XInitialization" and retrieving the
connection.
Here's the beginning:
diff --git a/reportdesign/inc/ReportDefinition.hxx
b/reportdesign/inc/ReportDefinition.hxx
index 436550c9aa3f..1e4d9d663d4b 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -32,6 +32,7 @@
#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/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -65,6 +66,7 @@ namespace reportdesign
,
css::document::XDocumentEventBroadcaster
,
css::lang::XServiceInfo
, css::frame::XModule
+ ,
css::lang::XInitialization
, css::lang::XUnoTunnel
,
css::util::XNumberFormatsSupplier
, css::frame::XTitle
@@ -171,6 +173,10 @@ namespace reportdesign
/** this function is called upon disposing the component
*/
virtual void SAL_CALL disposing() override;
+
+ // css::lang::XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence<
css::uno::Any >& aArguments ) override;
+
public:
explicit OReportDefinition(css::uno::Reference<
css::uno::XComponentContext > const & _xContext);
explicit OReportDefinition(css::uno::Reference<
css::uno::XComponentContext > const & _xContext
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx
b/reportdesign/source/core/api/ReportDefinition.cxx
index 296419e4f2db..aed2ec364a83 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -587,6 +587,17 @@ OReportDefinition::~OReportDefinition()
dispose();
}
}
+void SAL_CALL OReportDefinition::initialize( const uno::Sequence< uno::Any >&
rArguments )
+{
+ fprintf(stderr, "TODO OReportDefinition::initialize\n");
+ uno::Reference<sdbc::XConnection>
xCon(getContext()->getValueByName("ActiveConnection") ,uno::UNO_QUERY);
+ setActiveConnection(xCon);
+ ::comphelper::NamedValueCollection aArguments( rArguments );
+ uno::Sequence< beans::PropertyValue > aProps;
+ aArguments >>= aProps;
+
+ attachResource("", aProps);
+}
The pb is I don't know how to retrieve connection in brand new
"OReportDefinition::initialize" method.
Any idea?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20191208/528afb24/attachment.html>
More information about the Libreoffice-bugs
mailing list