tdf#92768 Support hiding title objects
Change-Id: I879fc3d81a8fe8ca2f928305f5dc7fd9ebcfd294 Reviewed-on: https://gerrit.libreoffice.org/24564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
parent
dc464bdb08
commit
0ab7ad3bb0
@ -116,7 +116,14 @@ void setLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel, boo
|
|||||||
|
|
||||||
bool isTitleVisisble(const css::uno::Reference<css::frame::XModel>& xModel, TitleHelper::eTitleType eTitle)
|
bool isTitleVisisble(const css::uno::Reference<css::frame::XModel>& xModel, TitleHelper::eTitleType eTitle)
|
||||||
{
|
{
|
||||||
return TitleHelper::getTitle(eTitle, xModel).is();
|
css::uno::Reference<css::uno::XInterface> xTitle = TitleHelper::getTitle(eTitle, xModel);
|
||||||
|
if (!xTitle.is())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
css::uno::Reference<css::beans::XPropertySet> xPropSet(xTitle, css::uno::UNO_QUERY_THROW);
|
||||||
|
css::uno::Any aAny = xPropSet->getPropertyValue("Visible");
|
||||||
|
bool bVisible = aAny.get<bool>();
|
||||||
|
return bVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType)
|
bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType)
|
||||||
@ -581,11 +588,11 @@ void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bV
|
|||||||
if (bVisible)
|
if (bVisible)
|
||||||
{
|
{
|
||||||
OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle;
|
OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle;
|
||||||
TitleHelper::createTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext());
|
TitleHelper::createOrShowTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TitleHelper::removeTitle(eTitle, mxModel);
|
TitleHelper::hideTitle(eTitle, mxModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +66,21 @@ public:
|
|||||||
, const css::uno::Reference< css::frame::XModel >& xModel
|
, const css::uno::Reference< css::frame::XModel >& xModel
|
||||||
, const css::uno::Reference< css::uno::XComponentContext > & xContext
|
, const css::uno::Reference< css::uno::XComponentContext > & xContext
|
||||||
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
|
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
|
||||||
|
static css::uno::Reference<
|
||||||
|
css::chart2::XTitle >
|
||||||
|
createOrShowTitle( eTitleType nTitleIndex
|
||||||
|
, const OUString& rTitleText
|
||||||
|
, const css::uno::Reference< css::frame::XModel >& xModel
|
||||||
|
, const css::uno::Reference< css::uno::XComponentContext > & xContext
|
||||||
|
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
|
||||||
|
|
||||||
static void removeTitle( eTitleType nTitleIndex
|
static void removeTitle( eTitleType nTitleIndex
|
||||||
, const css::uno::Reference< css::frame::XModel >& xModel );
|
, const css::uno::Reference< css::frame::XModel >& xModel );
|
||||||
|
|
||||||
|
static void hideTitle( eTitleType nTitleIndex
|
||||||
|
, const css::uno::Reference< css::frame::XModel >& xModel );
|
||||||
|
|
||||||
|
|
||||||
static OUString getCompleteString( const css::uno::Reference< css::chart2::XTitle >& xTitle );
|
static OUString getCompleteString( const css::uno::Reference< css::chart2::XTitle >& xTitle );
|
||||||
static void setCompleteString( const OUString& rNewText
|
static void setCompleteString( const OUString& rNewText
|
||||||
, const css::uno::Reference< css::chart2::XTitle >& xTitle
|
, const css::uno::Reference< css::chart2::XTitle >& xTitle
|
||||||
|
@ -170,6 +170,26 @@ uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIn
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uno::Reference< XTitle > TitleHelper::createOrShowTitle(
|
||||||
|
TitleHelper::eTitleType eTitleType
|
||||||
|
, const OUString& rTitleText
|
||||||
|
, const uno::Reference< frame::XModel >& xModel
|
||||||
|
, const uno::Reference< uno::XComponentContext > & xContext
|
||||||
|
, ReferenceSizeProvider * pRefSizeProvider )
|
||||||
|
{
|
||||||
|
uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( eTitleType, xModel ) );
|
||||||
|
if( xTitled.is())
|
||||||
|
{
|
||||||
|
css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW);
|
||||||
|
xProps->setPropertyValue("Visible",css::uno::makeAny(true));
|
||||||
|
return xTitled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return createTitle(eTitleType, rTitleText, xModel, xContext, pRefSizeProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uno::Reference< XTitle > TitleHelper::createTitle(
|
uno::Reference< XTitle > TitleHelper::createTitle(
|
||||||
TitleHelper::eTitleType eTitleType
|
TitleHelper::eTitleType eTitleType
|
||||||
, const OUString& rTitleText
|
, const OUString& rTitleText
|
||||||
@ -373,6 +393,17 @@ void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TitleHelper::hideTitle( TitleHelper::eTitleType nTitleIndex
|
||||||
|
, const css::uno::Reference< css::frame::XModel >& xModel )
|
||||||
|
{
|
||||||
|
uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( nTitleIndex, xModel ) );
|
||||||
|
if( xTitled.is())
|
||||||
|
{
|
||||||
|
css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW);
|
||||||
|
xProps->setPropertyValue("Visible",css::uno::makeAny(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TitleHelper::getTitleType( eTitleType& rType
|
bool TitleHelper::getTitleType( eTitleType& rType
|
||||||
, const css::uno::Reference< css::chart2::XTitle >& xTitle
|
, const css::uno::Reference< css::chart2::XTitle >& xTitle
|
||||||
, ChartModel& rModel )
|
, ChartModel& rModel )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user