2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-17 12:30:48 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-05-22 16:50:14 +00:00
|
|
|
|
|
|
|
#include "tp_Wizard_TitlesAndObjects.hxx"
|
2017-10-23 22:44:16 +02:00
|
|
|
#include <res_Titles.hxx>
|
|
|
|
#include <res_LegendPosition.hxx>
|
|
|
|
#include <ChartModelHelper.hxx>
|
|
|
|
#include <AxisHelper.hxx>
|
|
|
|
#include <ControllerLockGuard.hxx>
|
2018-11-25 00:53:41 +01:00
|
|
|
#include <com/sun/star/frame/XModel.hpp>
|
2007-05-22 16:50:14 +00:00
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::chart2;
|
|
|
|
|
2018-10-15 14:14:30 +01:00
|
|
|
TitlesAndObjectsTabPage::TitlesAndObjectsTabPage(TabPageParent pParent,
|
|
|
|
const uno::Reference< XChartDocument >& xChartModel,
|
|
|
|
const uno::Reference< uno::XComponentContext >& xContext )
|
|
|
|
: OWizardPage(pParent, "modules/schart/ui/wizelementspage.ui", "WizElementsPage")
|
|
|
|
, m_xTitleResources(new TitleResources(*m_xBuilder, false))
|
|
|
|
, m_xLegendPositionResources(new LegendPositionResources(*m_xBuilder, xContext))
|
|
|
|
, m_xChartModel(xChartModel)
|
|
|
|
, m_xCC(xContext)
|
|
|
|
, m_bCommitToModel(true)
|
|
|
|
, m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
|
|
|
|
, m_xCB_Grid_X(m_xBuilder->weld_check_button("x"))
|
|
|
|
, m_xCB_Grid_Y(m_xBuilder->weld_check_button("y"))
|
|
|
|
, m_xCB_Grid_Z(m_xBuilder->weld_check_button("z"))
|
2007-05-22 16:50:14 +00:00
|
|
|
{
|
2018-10-15 14:14:30 +01:00
|
|
|
m_xTitleResources->connect_changed( LINK( this, TitlesAndObjectsTabPage, ChangeEditHdl ));
|
2013-12-09 15:35:32 +00:00
|
|
|
m_xLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
|
2007-05-22 16:50:14 +00:00
|
|
|
|
2018-10-15 14:14:30 +01:00
|
|
|
m_xCB_Grid_X->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
|
|
|
|
m_xCB_Grid_Y->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
|
|
|
|
m_xCB_Grid_Z->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
|
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-03-09 14:29:30 +02:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:50:14 +00:00
|
|
|
void TitlesAndObjectsTabPage::initializePage()
|
|
|
|
{
|
|
|
|
m_bCommitToModel = false;
|
|
|
|
|
|
|
|
//init titles
|
|
|
|
{
|
|
|
|
TitleDialogData aTitleInput;
|
|
|
|
aTitleInput.readFromModel( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
|
2013-12-09 15:35:32 +00:00
|
|
|
m_xTitleResources->writeToResources( aTitleInput );
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//init legend
|
|
|
|
{
|
2013-12-09 15:35:32 +00:00
|
|
|
m_xLegendPositionResources->writeToResources( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//init grid checkboxes
|
|
|
|
{
|
|
|
|
uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel );
|
|
|
|
uno::Sequence< sal_Bool > aPossibilityList;
|
|
|
|
uno::Sequence< sal_Bool > aExistenceList;
|
2014-04-15 15:17:13 +02:00
|
|
|
AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, false );
|
|
|
|
AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, false );
|
2018-10-15 14:14:30 +01:00
|
|
|
m_xCB_Grid_X->set_sensitive( aPossibilityList[0] );
|
|
|
|
m_xCB_Grid_Y->set_sensitive( aPossibilityList[1] );
|
|
|
|
m_xCB_Grid_Z->set_sensitive( aPossibilityList[2] );
|
|
|
|
m_xCB_Grid_X->set_active( aExistenceList[0] );
|
|
|
|
m_xCB_Grid_Y->set_active( aExistenceList[1] );
|
|
|
|
m_xCB_Grid_Z->set_active( aExistenceList[2] );
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_bCommitToModel = true;
|
|
|
|
}
|
|
|
|
|
2014-03-25 14:20:18 +02:00
|
|
|
bool TitlesAndObjectsTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
|
2007-05-22 16:50:14 +00:00
|
|
|
{
|
2018-10-15 14:14:30 +01:00
|
|
|
if( m_xTitleResources->get_value_changed_from_saved() ) //titles may have changed in the meanwhile
|
2007-05-22 16:50:14 +00:00
|
|
|
commitToModel();
|
2014-03-25 14:20:18 +02:00
|
|
|
return true;//return false if this page should not be left
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TitlesAndObjectsTabPage::commitToModel()
|
|
|
|
{
|
|
|
|
m_aTimerTriggeredControllerLock.startTimer();
|
|
|
|
uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
|
|
|
|
|
2013-10-15 07:55:26 +02:00
|
|
|
ControllerLockGuardUNO aLockedControllers( xModel );
|
2007-05-22 16:50:14 +00:00
|
|
|
|
|
|
|
//commit title changes to model
|
|
|
|
{
|
|
|
|
TitleDialogData aTitleOutput;
|
2013-12-09 15:35:32 +00:00
|
|
|
m_xTitleResources->readFromResources( aTitleOutput );
|
2011-01-16 23:14:20 +01:00
|
|
|
aTitleOutput.writeDifferenceToModel( xModel, m_xCC );
|
2018-10-15 14:14:30 +01:00
|
|
|
m_xTitleResources->save_value();
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//commit legend changes to model
|
|
|
|
{
|
2013-12-09 15:35:32 +00:00
|
|
|
m_xLegendPositionResources->writeToModel( xModel );
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//commit grid changes to model
|
|
|
|
{
|
|
|
|
uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
|
|
|
|
uno::Sequence< sal_Bool > aOldExistenceList;
|
2014-04-15 15:17:13 +02:00
|
|
|
AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, false );
|
2007-05-22 16:50:14 +00:00
|
|
|
uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
|
2018-10-15 14:14:30 +01:00
|
|
|
aNewExistenceList[0] = m_xCB_Grid_X->get_active();
|
|
|
|
aNewExistenceList[1] = m_xCB_Grid_Y->get_active();
|
|
|
|
aNewExistenceList[2] = m_xCB_Grid_Z->get_active();
|
2007-05-22 16:50:14 +00:00
|
|
|
AxisHelper::changeVisibilityOfGrids( xDiagram
|
2017-08-01 08:40:47 +02:00
|
|
|
, aOldExistenceList, aNewExistenceList );
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-15 14:14:30 +01:00
|
|
|
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeCheckBoxHdl, weld::ToggleButton&, void)
|
2015-09-11 13:27:40 +02:00
|
|
|
{
|
2015-11-10 10:11:17 +01:00
|
|
|
ChangeHdl(nullptr);
|
2015-09-11 13:27:40 +02:00
|
|
|
}
|
2018-10-15 14:14:30 +01:00
|
|
|
|
|
|
|
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeEditHdl, weld::Entry&, void)
|
2015-10-15 08:13:49 +02:00
|
|
|
{
|
2015-11-10 10:11:17 +01:00
|
|
|
ChangeHdl(nullptr);
|
2015-10-15 08:13:49 +02:00
|
|
|
}
|
2018-10-15 14:14:30 +01:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeHdl, LinkParamNone*, void)
|
2007-05-22 16:50:14 +00:00
|
|
|
{
|
|
|
|
if( m_bCommitToModel )
|
|
|
|
commitToModel();
|
|
|
|
}
|
|
|
|
|
2008-03-06 18:18:01 +00:00
|
|
|
bool TitlesAndObjectsTabPage::canAdvance() const
|
2007-05-22 16:50:14 +00:00
|
|
|
{
|
2008-03-06 18:18:01 +00:00
|
|
|
return false;
|
2007-05-22 16:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|