summaryrefslogtreecommitdiff
path: root/chart2/source/view/main
diff options
context:
space:
mode:
authorQuan Nguyen <quannguyenvan1701@gmail.com>2021-02-15 07:49:33 +0700
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-18 09:49:06 +0100
commit62dff2844b0bf1d1bcb8eb4d6db529ef4a31bee4 (patch)
tree69d3149e3d8fc514ac0792edfc835c92404ed1f5 /chart2/source/view/main
parentad4d715ca69d6f09fb2d8a713c79edb999ad2316 (diff)
tdf#92768 Add rendering support for hiding title object in chart2
Change-Id: Ice6335d52d53dcbaa8711f9669597bf5321ecd7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110889 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.cxx2
-rw-r--r--chart2/source/view/main/VTitle.cxx15
-rw-r--r--chart2/source/view/main/VTitle.hxx2
3 files changed, 18 insertions, 1 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index c88144137721..93bf35672123 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2131,7 +2131,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, rModel ) );
OUString aCompleteString = TitleHelper::getCompleteString(xTitle);
- if (aCompleteString.isEmpty())
+ if (aCompleteString.isEmpty() || !VTitle::isVisible(xTitle))
return apVTitle;
//create title
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index f0befe954659..ad2e857101fb 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -97,6 +97,21 @@ void VTitle::changePosition( const awt::Point& rPos )
}
}
+bool VTitle::isVisible(const uno::Reference< XTitle >& xTitle) {
+ if (!xTitle.is()) {
+ return false;
+ }
+ bool bShow = true;
+ try {
+ uno::Reference< beans::XPropertySet > xTitleProps(xTitle, uno::UNO_QUERY_THROW);
+ xTitleProps->getPropertyValue("Visible") >>= bShow;
+ } catch (const uno::Exception &) {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return bShow;
+}
+
+
void VTitle::createShapes(
const awt::Point& rPos
, const awt::Size& rReferenceSize
diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx
index 6d330076dedf..cdfd0a89cdc4 100644
--- a/chart2/source/view/main/VTitle.hxx
+++ b/chart2/source/view/main/VTitle.hxx
@@ -51,6 +51,8 @@ public:
css::awt::Size getUnrotatedSize() const;
css::awt::Size getFinalSize() const;
void changePosition( const css::awt::Point& rPos );
+ static bool isVisible(
+ const css::uno::Reference< css::chart2::XTitle > & xTitle);
private:
css::uno::Reference< css::drawing::XShapes > m_xTarget;