summaryrefslogtreecommitdiff
path: root/chart2/source/view/main
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-22 12:22:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-22 19:58:38 +0000
commit6f59baf135f42f9c281148184b1b1f16e3902442 (patch)
treea852f1c3d1ac40af472671f3aa798b9b05ae162e /chart2/source/view/main
parentf6da444a9e2b239d8905d6cdb845c7be8d8ce66f (diff)
use more concrete type in chart2
Change-Id: If67a4f0fe75554e14c3030c68374607b76d5b840 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149336 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view/main')
-rw-r--r--chart2/source/view/main/ChartView.cxx5
-rw-r--r--chart2/source/view/main/ExplicitValueProvider.cxx8
-rw-r--r--chart2/source/view/main/VTitle.cxx14
-rw-r--r--chart2/source/view/main/VTitle.hxx3
4 files changed, 23 insertions, 7 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index db742930ce29..fdc75aa155e0 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1072,7 +1072,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
nXDistance = 450; // 1/100 mm
}
- uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, rModel ) );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( eType, rModel ) );
OUString aCompleteString = TitleHelper::getCompleteString(xTitle);
if (aCompleteString.isEmpty() || !VTitle::isVisible(xTitle))
return apVTitle;
@@ -1109,8 +1109,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
rbAutoPosition = true;
awt::Point aNewPosition(0,0);
chart2::RelativePosition aRelativePosition;
- uno::Reference<beans::XPropertySet> xProp(xTitle, uno::UNO_QUERY);
- if (xProp.is() && (xProp->getPropertyValue("RelativePosition") >>= aRelativePosition))
+ if (xTitle.is() && (xTitle->getPropertyValue("RelativePosition") >>= aRelativePosition))
{
rbAutoPosition = false;
diff --git a/chart2/source/view/main/ExplicitValueProvider.cxx b/chart2/source/view/main/ExplicitValueProvider.cxx
index fc1307fe8820..3479bd3f703b 100644
--- a/chart2/source/view/main/ExplicitValueProvider.cxx
+++ b/chart2/source/view/main/ExplicitValueProvider.cxx
@@ -120,13 +120,13 @@ awt::Rectangle ExplicitValueProvider::AddSubtractAxisTitleSizes(
awt::Rectangle aRet(rPositionAndSize);
//add axis title sizes to the diagram size
- uno::Reference<chart2::XTitle> xTitle_Height(
+ rtl::Reference<::chart::Title> xTitle_Height(
TitleHelper::getTitle(TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, rModel));
- uno::Reference<chart2::XTitle> xTitle_Width(
+ rtl::Reference<::chart::Title> xTitle_Width(
TitleHelper::getTitle(TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, rModel));
- uno::Reference<chart2::XTitle> xSecondTitle_Height(
+ rtl::Reference<::chart::Title> xSecondTitle_Height(
TitleHelper::getTitle(TitleHelper::SECONDARY_X_AXIS_TITLE, rModel));
- uno::Reference<chart2::XTitle> xSecondTitle_Width(
+ rtl::Reference<::chart::Title> xSecondTitle_Width(
TitleHelper::getTitle(TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel));
if (xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is()
|| xSecondTitle_Width.is())
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index ddc97dde6406..e820e75f9c8b 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -20,6 +20,7 @@
#include "VTitle.hxx"
#include <CommonConverters.hxx>
#include <ShapeFactory.hxx>
+#include <Title.hxx>
#include <com/sun/star/chart2/XTitle.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <utility>
@@ -91,6 +92,19 @@ void VTitle::changePosition( const awt::Point& rPos )
}
}
+bool VTitle::isVisible(const rtl::Reference< Title >& xTitle) {
+ if (!xTitle.is()) {
+ return false;
+ }
+ bool bShow = true;
+ try {
+ xTitle->getPropertyValue("Visible") >>= bShow;
+ } catch (const uno::Exception &) {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return bShow;
+}
+
bool VTitle::isVisible(const uno::Reference< XTitle >& xTitle) {
if (!xTitle.is()) {
return false;
diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx
index 3db5461f3c5b..a0c999dae957 100644
--- a/chart2/source/view/main/VTitle.hxx
+++ b/chart2/source/view/main/VTitle.hxx
@@ -34,6 +34,7 @@ class SvxShapeText;
namespace chart
{
+class Title;
class VTitle final
{
@@ -55,6 +56,8 @@ public:
void changePosition( const css::awt::Point& rPos );
static bool isVisible(
const css::uno::Reference< css::chart2::XTitle > & xTitle);
+ static bool isVisible(
+ const rtl::Reference< ::chart::Title > & xTitle);
private:
rtl::Reference<SvxShapeGroupAnyD> m_xTarget;