From 00a6c3c148e4c0e867816b4c361abb19d9ece7eb Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sat, 28 Jan 2012 20:52:10 +0100 Subject: replace obsolete "master" branch with README that points at new repo --- reportdesign/source/ui/misc/ColorListener.cxx | 104 -- reportdesign/source/ui/misc/FunctionHelper.cxx | 255 ----- reportdesign/source/ui/misc/RptUndo.cxx | 413 -------- reportdesign/source/ui/misc/UITools.cxx | 1072 -------------------- reportdesign/source/ui/misc/rptuiservices.cxx | 79 -- .../source/ui/misc/statusbarcontroller.cxx | 233 ----- reportdesign/source/ui/misc/toolboxcontroller.cxx | 362 ------- 7 files changed, 2518 deletions(-) delete mode 100644 reportdesign/source/ui/misc/ColorListener.cxx delete mode 100644 reportdesign/source/ui/misc/FunctionHelper.cxx delete mode 100644 reportdesign/source/ui/misc/RptUndo.cxx delete mode 100644 reportdesign/source/ui/misc/UITools.cxx delete mode 100644 reportdesign/source/ui/misc/rptuiservices.cxx delete mode 100644 reportdesign/source/ui/misc/statusbarcontroller.cxx delete mode 100644 reportdesign/source/ui/misc/toolboxcontroller.cxx (limited to 'reportdesign/source/ui/misc') diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx deleted file mode 100644 index 4707a00de..000000000 --- a/reportdesign/source/ui/misc/ColorListener.cxx +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_rptui.hxx" -#include "ColorListener.hxx" -#include -#include "uistrings.hrc" - -#define BORDERCOLORCHANGE 191 -//===================================================================== -namespace rptui -{ -//===================================================================== - DBG_NAME( rpt_OColorListener ) -OColorListener::OColorListener(Window* _pParent ,const ::rtl::OUString& _sColorEntry) -: Window(_pParent) -,m_sColorEntry(_sColorEntry) -,m_nColor(COL_LIGHTBLUE) -,m_bCollapsed(sal_False) -,m_bMarked(sal_False) -{ - DBG_CTOR( rpt_OColorListener,NULL); - StartListening(m_aExtendedColorConfig); - m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor(); - m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor; -} -// ----------------------------------------------------------------------------- -OColorListener::~OColorListener() -{ - DBG_DTOR( rpt_OColorListener,NULL); - EndListening(m_aExtendedColorConfig); -} -// ----------------------------------------------------------------------- -void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) -{ - if (rHint.ISA(SfxSimpleHint) - && (static_cast< SfxSimpleHint const & >(rHint).GetId() - == SFX_HINT_COLORS_CHANGED)) - { - m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor(); - m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor; - Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE); - } -} -//----------------------------------------------------------------------------- -void OColorListener::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - ImplInitSettings(); - Invalidate(); - } -} -// ----------------------------------------------------------------------------- -void OColorListener::setCollapsed(sal_Bool _bCollapsed) -{ - if ( m_bCollapsed != _bCollapsed ) - { - m_bCollapsed = _bCollapsed; - if ( m_aCollapsedLink.IsSet() ) - m_aCollapsedLink.Call(this); - } -} -// ----------------------------------------------------------------------------- -void OColorListener::setMarked(sal_Bool _bMark) -{ - if ( m_bMarked != _bMark) - { - m_bMarked = _bMark; - Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE); - } -} -// ======================================================================= -} -// ======================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx deleted file mode 100644 index 8a8acdfc6..000000000 --- a/reportdesign/source/ui/misc/FunctionHelper.cxx +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "precompiled_rptui.hxx" -#include "FunctionHelper.hxx" -#include - -// ============================================================================= -namespace rptui -{ -// ============================================================================= - using namespace ::com::sun::star; - -FunctionManager::FunctionManager(const uno::Reference< report::meta::XFunctionManager>& _xMgr) -: m_xMgr(_xMgr) -{ -} -FunctionManager::~FunctionManager() -{ -} -sal_Unicode FunctionManager::getSingleToken(const formula::IFunctionManager::EToken _eToken) const -{ - switch(_eToken) - { - case eOk: - return sal_Unicode('('); - case eClose: - return sal_Unicode(')'); - case eSep: - return sal_Unicode(';'); - case eArrayOpen: - return sal_Unicode('{'); - case eArrayClose: - return sal_Unicode('}'); - } - return 0; -} -// ----------------------------------------------------------------------------- -sal_uInt32 FunctionManager::getCount() const -{ - return m_xMgr->getCount(); -} -// ----------------------------------------------------------------------------- -const formula::IFunctionCategory* FunctionManager::getCategory(sal_uInt32 _nPos) const -{ - if ( _nPos >= m_aCategoryIndex.size() ) - { - uno::Reference< report::meta::XFunctionCategory> xCategory = m_xMgr->getCategory(_nPos); - ::boost::shared_ptr< FunctionCategory > pCategory(new FunctionCategory(this,_nPos + 1,xCategory)); - m_aCategoryIndex.push_back( m_aCategories.insert(TCategoriesMap::value_type(xCategory->getName(),pCategory)).first ); - } - return m_aCategoryIndex[_nPos]->second.get(); -} -// ----------------------------------------------------------------------------- -const formula::IFunctionDescription* FunctionManager::getFunctionByName(const ::rtl::OUString& _sFunctionName) const -{ - const formula::IFunctionDescription* pDesc = NULL; - try - { - pDesc = get(m_xMgr->getFunctionByName(_sFunctionName)).get(); - } - catch(uno::Exception&) - { - } - return pDesc; -} -// ----------------------------------------------------------------------------- -void FunctionManager::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& /*_rLastRUFunctions*/) const -{ -} -// ----------------------------------------------------------------------------- -::boost::shared_ptr< FunctionDescription > FunctionManager::get(const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription) const -{ - ::boost::shared_ptr< FunctionDescription > pDesc; - if ( _xFunctionDescription.is() ) - { - const ::rtl::OUString sFunctionName = _xFunctionDescription->getName(); - TFunctionsMap::const_iterator aFunctionFind = m_aFunctions.find(sFunctionName); - if ( aFunctionFind == m_aFunctions.end() ) - { - const uno::Reference< report::meta::XFunctionCategory> xCategory = _xFunctionDescription->getCategory(); - const ::rtl::OUString sCategoryName = xCategory->getName(); - TCategoriesMap::iterator aCategoryFind = m_aCategories.find(sCategoryName); - if ( aCategoryFind == m_aCategories.end() ) - { - aCategoryFind = m_aCategories.insert(TCategoriesMap::value_type(sCategoryName,::boost::shared_ptr< FunctionCategory > (new FunctionCategory(this,xCategory->getNumber() + 1,xCategory)))).first; - m_aCategoryIndex.push_back( aCategoryFind ); - } - aFunctionFind = m_aFunctions.insert(TFunctionsMap::value_type(sFunctionName,::boost::shared_ptr(new FunctionDescription(aCategoryFind->second.get(),_xFunctionDescription)))).first; - } - pDesc = aFunctionFind->second; - } - return pDesc; -} -// ----------------------------------------------------------------------------- -FunctionCategory::FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const uno::Reference< report::meta::XFunctionCategory>& _xCategory) -: m_xCategory(_xCategory) -,m_nFunctionCount(_xCategory->getCount()) -, m_nNumber(_nPos) -,m_pFunctionManager(_pFMgr) -{ -} -// ----------------------------------------------------------------------------- -sal_uInt32 FunctionCategory::getCount() const -{ - return m_nFunctionCount; -} -// ----------------------------------------------------------------------------- -const formula::IFunctionDescription* FunctionCategory::getFunction(sal_uInt32 _nPos) const -{ - if ( _nPos >= m_aFunctions.size() && _nPos < m_nFunctionCount ) - { - uno::Reference< report::meta::XFunctionDescription> xFunctionDescription = m_xCategory->getFunction(_nPos); - ::boost::shared_ptr< FunctionDescription > pFunction = m_pFunctionManager->get(xFunctionDescription); - m_aFunctions.push_back( pFunction ); - } - return m_aFunctions[_nPos].get(); -} -// ----------------------------------------------------------------------------- -sal_uInt32 FunctionCategory::getNumber() const -{ - return m_nNumber; -} -// ----------------------------------------------------------------------------- -const formula::IFunctionManager* FunctionCategory::getFunctionManager() const -{ - return m_pFunctionManager; -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionCategory::getName() const -{ - return m_xCategory->getName(); -} -// ----------------------------------------------------------------------------- -FunctionDescription::FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription) -: m_xFunctionDescription(_xFunctionDescription) -, m_pFunctionCategory(_pFunctionCategory) -{ - m_aParameter = m_xFunctionDescription->getArguments(); -} -::rtl::OUString FunctionDescription::getFunctionName() const -{ - return m_xFunctionDescription->getName(); -} -// ----------------------------------------------------------------------------- -const formula::IFunctionCategory* FunctionDescription::getCategory() const -{ - return m_pFunctionCategory; -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionDescription::getDescription() const -{ - return m_xFunctionDescription->getDescription(); -} -// ----------------------------------------------------------------------------- -xub_StrLen FunctionDescription::getSuppressedArgumentCount() const -{ - return static_cast(m_aParameter.getLength()); -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionDescription::getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const -{ - ::rtl::OUString sFormula; - try - { - const ::rtl::OUString *pArguments = _aArguments.empty() ? 0 : &_aArguments[0]; - sFormula = m_xFunctionDescription->createFormula(uno::Sequence< ::rtl::OUString >(pArguments, _aArguments.size())); - } - catch(const uno::Exception&) - { - OSL_FAIL("Exception caught!"); - } - return sFormula; -} -// ----------------------------------------------------------------------------- -void FunctionDescription::fillVisibleArgumentMapping(::std::vector& _rArguments) const -{ - const sal_Int32 nCount = m_aParameter.getLength(); - for(sal_uInt16 i = 0;i < nCount; ++i) - { - _rArguments.push_back(i); - } -} -// ----------------------------------------------------------------------------- -void FunctionDescription::initArgumentInfo() const -{ -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionDescription::getSignature() const -{ - return m_xFunctionDescription->getSignature(); -} -// ----------------------------------------------------------------------------- -rtl::OString FunctionDescription::getHelpId() const -{ - return rtl::OString(); -} -// ----------------------------------------------------------------------------- -sal_uInt32 FunctionDescription::getParameterCount() const -{ - return m_aParameter.getLength(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionDescription::getParameterName(sal_uInt32 _nPos) const -{ - if ( _nPos < static_cast(m_aParameter.getLength()) ) - return m_aParameter[_nPos].Name; - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString FunctionDescription::getParameterDescription(sal_uInt32 _nPos) const -{ - if ( _nPos < static_cast(m_aParameter.getLength()) ) - return m_aParameter[_nPos].Description; - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -bool FunctionDescription::isParameterOptional(sal_uInt32 _nPos) const -{ - if ( _nPos < static_cast(m_aParameter.getLength()) ) - return m_aParameter[_nPos].IsOptional; - return false; -} -// ----------------------------------------------------------------------------- -// ============================================================================= -} // rptui -// ============================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx deleted file mode 100644 index 462e4e64f..000000000 --- a/reportdesign/source/ui/misc/RptUndo.cxx +++ /dev/null @@ -1,413 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_rptui.hxx" - -#include "RptUndo.hxx" -#include "uistrings.hrc" -#include "rptui_slotid.hrc" -#include "UITools.hxx" -#include "UndoEnv.hxx" - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace rptui -{ - using namespace ::com::sun::star; - using namespace uno; - using namespace lang; - using namespace script; - using namespace beans; - using namespace awt; - using namespace util; - using namespace container; - using namespace report; - -//---------------------------------------------------------------------------- -namespace -{ - void lcl_collectElements(const uno::Reference< report::XSection >& _xSection,::std::vector< uno::Reference< drawing::XShape> >& _rControls) - { - if ( _xSection.is() ) - { - sal_Int32 nCount = _xSection->getCount(); - _rControls.reserve(nCount); - while ( nCount ) - { - uno::Reference< drawing::XShape> xShape(_xSection->getByIndex(nCount-1),uno::UNO_QUERY); - _rControls.push_back(xShape); - _xSection->remove(xShape); - --nCount; - } - } - } - //---------------------------------------------------------------------------- - void lcl_insertElements(const uno::Reference< report::XSection >& _xSection,const ::std::vector< uno::Reference< drawing::XShape> >& _aControls) - { - if ( _xSection.is() ) - { - ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aIter = _aControls.rbegin(); - ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aEnd = _aControls.rend(); - for (; aIter != aEnd; ++aIter) - { - try - { - const awt::Point aPos = (*aIter)->getPosition(); - const awt::Size aSize = (*aIter)->getSize(); - _xSection->add(*aIter); - (*aIter)->setPosition( aPos ); - (*aIter)->setSize( aSize ); - } - catch(const uno::Exception&) - { - OSL_FAIL("lcl_insertElements:Exception caught!"); - } - } - } - } - //---------------------------------------------------------------------------- - void lcl_setValues(const uno::Reference< report::XSection >& _xSection,const ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >& _aValues) - { - if ( _xSection.is() ) - { - ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >::const_iterator aIter = _aValues.begin(); - ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >::const_iterator aEnd = _aValues.end(); - for (; aIter != aEnd; ++aIter) - { - try - { - _xSection->setPropertyValue(aIter->first,aIter->second); - } - catch(const uno::Exception&) - { - OSL_FAIL("lcl_setValues:Exception caught!"); - } - } - } - } -} -//---------------------------------------------------------------------------- -TYPEINIT1( OSectionUndo, OCommentUndoAction ); -DBG_NAME(rpt_OSectionUndo) -//---------------------------------------------------------------------------- -OSectionUndo::OSectionUndo(OReportModel& _rMod - ,sal_uInt16 _nSlot - ,Action _eAction - ,sal_uInt16 nCommentID) -: OCommentUndoAction(_rMod,nCommentID) -,m_eAction(_eAction) -,m_nSlot(_nSlot) -,m_bInserted(false) -{ - DBG_CTOR(rpt_OSectionUndo,NULL); -} -// ----------------------------------------------------------------------------- -OSectionUndo::~OSectionUndo() -{ - if ( !m_bInserted ) - { - OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); - ::std::vector< uno::Reference< drawing::XShape> >::iterator aEnd = m_aControls.end(); - for (::std::vector< uno::Reference< drawing::XShape> >::iterator aIter = m_aControls.begin(); aIter != aEnd; ++aIter) - { - uno::Reference< drawing::XShape> xShape = *aIter; - rEnv.RemoveElement(xShape); - -#if OSL_DEBUG_LEVEL > 0 - SvxShape* pShape = SvxShape::getImplementation( xShape ); - SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL; - OSL_ENSURE( pShape && pShape->HasSdrObjectOwnership() && pObject && !pObject->IsInserted(), - "OSectionUndo::~OSectionUndo: inconsistency in the shape/object ownership!" ); -#endif - try - { - comphelper::disposeComponent(xShape); - } - catch(uno::Exception) - { - OSL_FAIL("Exception caught!"); - } - } - } - DBG_DTOR(rpt_OSectionUndo,NULL); -} -// ----------------------------------------------------------------------------- -void OSectionUndo::collectControls(const uno::Reference< report::XSection >& _xSection) -{ - m_aControls.clear(); - try - { - // copy all properties for restoring - uno::Reference< beans::XPropertySetInfo> xInfo = _xSection->getPropertySetInfo(); - uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); - const beans::Property* pIter = aSeq.getConstArray(); - const beans::Property* pEnd = pIter + aSeq.getLength(); - for(;pIter != pEnd;++pIter) - { - if ( 0 == (pIter->Attributes & beans::PropertyAttribute::READONLY) ) - m_aValues.push_back(::std::pair< ::rtl::OUString ,uno::Any>(pIter->Name,_xSection->getPropertyValue(pIter->Name))); - } - lcl_collectElements(_xSection,m_aControls); - } - catch(uno::Exception&) - { - } -} -//---------------------------------------------------------------------------- -void OSectionUndo::Undo() -{ - try - { - switch ( m_eAction ) - { - case Inserted: - implReRemove(); - break; - - case Removed: - implReInsert(); - break; - } - } - catch( const Exception& ) - { - OSL_FAIL( "OSectionUndo::Undo: caught an exception!" ); - } -} -//---------------------------------------------------------------------------- -void OSectionUndo::Redo() -{ - try - { - switch ( m_eAction ) - { - case Inserted: - implReInsert(); - break; - - case Removed: - implReRemove(); - break; - } - } - catch( const Exception& ) - { - OSL_FAIL( "OSectionUndo::Redo: caught an exception!" ); - } -} -//---------------------------------------------------------------------------- -TYPEINIT1( OReportSectionUndo, OSectionUndo ); -//---------------------------------------------------------------------------- -OReportSectionUndo::OReportSectionUndo(OReportModel& _rMod,sal_uInt16 _nSlot - ,::std::mem_fun_t< uno::Reference< report::XSection > - ,OReportHelper> _pMemberFunction - ,const uno::Reference< report::XReportDefinition >& _xReport - ,Action _eAction - ,sal_uInt16 nCommentID) -: OSectionUndo(_rMod,_nSlot,_eAction,nCommentID) -,m_aReportHelper(_xReport) -,m_pMemberFunction(_pMemberFunction) -{ - if( m_eAction == Removed ) - collectControls(m_pMemberFunction(&m_aReportHelper)); -} -// ----------------------------------------------------------------------------- -OReportSectionUndo::~OReportSectionUndo() -{ -} -//---------------------------------------------------------------------------- -void OReportSectionUndo::implReInsert( ) -{ - const uno::Sequence< beans::PropertyValue > aArgs; - m_pController->executeChecked(m_nSlot,aArgs); - uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aReportHelper); - lcl_insertElements(xSection,m_aControls); - lcl_setValues(xSection,m_aValues); - m_bInserted = true; -} -//---------------------------------------------------------------------------- -void OReportSectionUndo::implReRemove( ) -{ - if( m_eAction == Removed ) - collectControls(m_pMemberFunction(&m_aReportHelper)); - const uno::Sequence< beans::PropertyValue > aArgs; - m_pController->executeChecked(m_nSlot,aArgs); - m_bInserted = false; -} -//---------------------------------------------------------------------------- -TYPEINIT1( OGroupSectionUndo, OSectionUndo ); -//---------------------------------------------------------------------------- -OGroupSectionUndo::OGroupSectionUndo(OReportModel& _rMod,sal_uInt16 _nSlot - ,::std::mem_fun_t< uno::Reference< report::XSection > - ,OGroupHelper> _pMemberFunction - ,const uno::Reference< report::XGroup >& _xGroup - ,Action _eAction - ,sal_uInt16 nCommentID) -: OSectionUndo(_rMod,_nSlot,_eAction,nCommentID) -,m_aGroupHelper(_xGroup) -,m_pMemberFunction(_pMemberFunction) -{ - if( m_eAction == Removed ) - { - uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aGroupHelper); - if ( xSection.is() ) - m_sName = xSection->getName(); - collectControls(xSection); - } -} -//---------------------------------------------------------------------------- -String OGroupSectionUndo::GetComment() const -{ - if ( !m_sName.getLength() ) - { - try - { - uno::Reference< report::XSection > xSection = const_cast(this)->m_pMemberFunction(&const_cast(this)->m_aGroupHelper); - - if ( xSection.is() ) - m_sName = xSection->getName(); - } - catch(uno::Exception&) - {} - } - return m_strComment + m_sName; -} -//---------------------------------------------------------------------------- -void OGroupSectionUndo::implReInsert( ) -{ - uno::Sequence< beans::PropertyValue > aArgs(2); - - aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? PROPERTY_HEADERON : PROPERTY_FOOTERON; - aArgs[0].Value <<= sal_True; - aArgs[1].Name = PROPERTY_GROUP; - aArgs[1].Value <<= m_aGroupHelper.getGroup(); - m_pController->executeChecked(m_nSlot,aArgs); - - uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aGroupHelper); - lcl_insertElements(xSection,m_aControls); - lcl_setValues(xSection,m_aValues); - m_bInserted = true; -} -//---------------------------------------------------------------------------- -void OGroupSectionUndo::implReRemove( ) -{ - if( m_eAction == Removed ) - collectControls(m_pMemberFunction(&m_aGroupHelper)); - - uno::Sequence< beans::PropertyValue > aArgs(2); - - aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? PROPERTY_HEADERON : PROPERTY_FOOTERON; - aArgs[0].Value <<= sal_False; - aArgs[1].Name = PROPERTY_GROUP; - aArgs[1].Value <<= m_aGroupHelper.getGroup(); - - m_pController->executeChecked(m_nSlot,aArgs); - m_bInserted = false; -} -//---------------------------------------------------------------------------- -TYPEINIT1( OGroupUndo, OCommentUndoAction ); -//---------------------------------------------------------------------------- -OGroupUndo::OGroupUndo(OReportModel& _rMod - ,sal_uInt16 nCommentID - ,Action _eAction - ,const uno::Reference< report::XGroup>& _xGroup - ,const uno::Reference< report::XReportDefinition >& _xReportDefinition) -: OCommentUndoAction(_rMod,nCommentID) -,m_xGroup(_xGroup) -,m_xReportDefinition(_xReportDefinition) -,m_eAction(_eAction) -{ - m_nLastPosition = getPositionInIndexAccess(m_xReportDefinition->getGroups().get(),m_xGroup); -} -//---------------------------------------------------------------------------- -void OGroupUndo::implReInsert( ) -{ - try - { - m_xReportDefinition->getGroups()->insertByIndex(m_nLastPosition,uno::makeAny(m_xGroup)); - } - catch(uno::Exception&) - { - OSL_FAIL("Exception catched while undoing remove group"); - } -} -//---------------------------------------------------------------------------- -void OGroupUndo::implReRemove( ) -{ - try - { - m_xReportDefinition->getGroups()->removeByIndex(m_nLastPosition); - } - catch(uno::Exception&) - { - OSL_FAIL("Exception catched while redoing remove group"); - } -} -//---------------------------------------------------------------------------- -void OGroupUndo::Undo() -{ - switch ( m_eAction ) - { - case Inserted: - implReRemove(); - break; - - case Removed: - implReInsert(); - break; - } - -} -//---------------------------------------------------------------------------- -void OGroupUndo::Redo() -{ - switch ( m_eAction ) - { - case Inserted: - implReInsert(); - break; - - case Removed: - implReRemove(); - break; - } -} -//---------------------------------------------------------------------------- -//============================================================================ -} // rptui -//============================================================================ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx deleted file mode 100644 index 64ba56ee0..000000000 --- a/reportdesign/source/ui/misc/UITools.cxx +++ /dev/null @@ -1,1072 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_rptui.hxx" - - -#include -#include -#include "SectionView.hxx" -#include "UITools.hxx" -#include "Formula.hxx" -#include "FunctionHelper.hxx" -#include "reportformula.hxx" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include // XColorTable -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "dlgpage.hxx" -#include -#include "rptui_slotid.hrc" -#include "uistrings.hrc" -#include "RptObject.hxx" -#include "ModuleHelper.hxx" -#include "RptDef.hxx" -#include "RptResId.hrc" -#include "ReportDefinition.hxx" -#include "RptModel.hxx" - -#define ITEMID_FONT 10 -#define ITEMID_FONTHEIGHT 11 -#define ITEMID_LANGUAGE 12 - -#define ITEMID_POSTURE 13 -#define ITEMID_WEIGHT 14 -#define ITEMID_SHADOWED 15 -#define ITEMID_WORDLINEMODE 16 -#define ITEMID_CONTOUR 17 -#define ITEMID_CROSSEDOUT 18 -#define ITEMID_UNDERLINE 19 - -#define ITEMID_COLOR 20 -#define ITEMID_KERNING 21 -#define ITEMID_CASEMAP 22 - -#define ITEMID_ESCAPEMENT 23 -#define ITEMID_FONTLIST 24 -#define ITEMID_AUTOKERN 25 -#define ITEMID_COLOR_TABLE 26 -#define ITEMID_BLINK 27 -#define ITEMID_EMPHASISMARK 28 -#define ITEMID_TWOLINES 29 -#define ITEMID_CHARROTATE 30 -#define ITEMID_CHARSCALE_W 31 -#define ITEMID_CHARRELIEF 32 -#define ITEMID_CHARHIDDEN 33 -#define ITEMID_BRUSH 34 -#define ITEMID_HORJUSTIFY 35 -#define ITEMID_VERJUSTIFY 36 -#define ITEMID_FONT_ASIAN 37 -#define ITEMID_FONTHEIGHT_ASIAN 38 -#define ITEMID_LANGUAGE_ASIAN 39 -#define ITEMID_POSTURE_ASIAN 40 -#define ITEMID_WEIGHT_ASIAN 41 -#define ITEMID_FONT_COMPLEX 42 -#define ITEMID_FONTHEIGHT_COMPLEX 43 -#define ITEMID_LANGUAGE_COMPLEX 44 -#define ITEMID_POSTURE_COMPLEX 45 -#define ITEMID_WEIGHT_COMPLEX 46 - -#define WESTERN 0 -#define ASIAN 1 -#define COMPLEX 2 - -namespace rptui -{ -using namespace ::com::sun::star; -using namespace formula; -// ----------------------------------------------------------------------------- -void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos) -{ - OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF"); - if ( _xGroup->getHeaderOn() && !_xGroup->getHeader()->getName().getLength() ) - { - ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPHEADER)); - sName += ::rtl::OUString::valueOf(_nPos); - _xGroup->getHeader()->setName(sName); - } - - if ( _xGroup->getFooterOn() && !_xGroup->getFooter()->getName().getLength() ) - { - ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPFOOTER)); - sName += ::rtl::OUString::valueOf(_nPos); - _xGroup->getFooter()->setName(sName); - } -} -// ----------------------------------------------------------------------------- -::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener(const uno::Reference< report::XReportDefinition >& _xReportDefinition,::comphelper::OPropertyChangeListener* _pListener) -{ - ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> pRet = NULL; - if ( _xReportDefinition.is() ) - { - uno::Reference xPageStyle(getUsedStyle(_xReportDefinition),uno::UNO_QUERY); - if ( xPageStyle.is() ) - { - pRet = new comphelper::OPropertyChangeMultiplexer(_pListener,xPageStyle); - pRet->addProperty(PROPERTY_LEFTMARGIN); - pRet->addProperty(PROPERTY_RIGHTMARGIN); - pRet->addProperty(PROPERTY_PAPERSIZE); - pRet->addProperty(PROPERTY_BACKCOLOR); - } - } - return pRet; -} - -// ----------------------------------------------------------------------------- -namespace -{ - // ------------------------------------------------------------------------- - Font lcl_getReportControlFont( const uno::Reference& _rxReportControlFormat, awt::FontDescriptor& _out_rControlFont ,sal_uInt16 _nWichFont) - { - if ( !_rxReportControlFormat.is() ) - throw uno::RuntimeException(); - - switch(_nWichFont) - { - case WESTERN: - _out_rControlFont = _rxReportControlFormat->getFontDescriptor(); - break; - case ASIAN: - _out_rControlFont = _rxReportControlFormat->getFontDescriptorAsian(); - break; - case COMPLEX: - _out_rControlFont = _rxReportControlFormat->getFontDescriptorComplex(); - break; - - } - - Font aDefaultFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); - return VCLUnoHelper::CreateFont( _out_rControlFont, aDefaultFont ); - } - - // ------------------------------------------------------------------------- - Font lcl_getReportControlFont( const uno::Reference& _rxReportControlFormat,sal_uInt16 _nWhich ) - { - awt::FontDescriptor aAwtFont; - return lcl_getReportControlFont( _rxReportControlFormat, aAwtFont, _nWhich ); - } - // ------------------------------------------------------------------------- - const Font lcl_setFont(const uno::Reference& _rxReportControlFormat, - SfxItemSet& _rItemSet,sal_uInt16 _nWhich,sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nLanguage,sal_uInt16 _nPosture, sal_uInt16 _nWeight) - { - // fill it - awt::FontDescriptor aControlFont; - const Font aFont( lcl_getReportControlFont( _rxReportControlFormat, aControlFont,_nWhich ) ); - - SvxFontItem aFontItem(_nFont); - aFontItem.PutValue( uno::makeAny( aControlFont ) ); - _rItemSet.Put(aFontItem); - - _rItemSet.Put(SvxFontHeightItem(OutputDevice::LogicToLogic(Size(0, (sal_Int32)aFont.GetHeight()), MAP_POINT, MAP_TWIP).Height(),100,_nFontHeight)); - lang::Locale aLocale; - switch(_nWhich) - { - default: - aLocale = _rxReportControlFormat->getCharLocale(); - break; - case ASIAN: - aLocale = _rxReportControlFormat->getCharLocaleAsian(); - break; - case COMPLEX: - aLocale = _rxReportControlFormat->getCharLocaleComplex(); - break; - } - - _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguageWithFallback(aLocale),_nLanguage)); - - _rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture)); - _rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight)); - return aFont; - } - - void lcl_fillShapeToItems( const uno::Reference& _xShape,SfxItemSet& _rItemSet ) - { - uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); - SvxUnoPropertyMapProvider aMap; - const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries(); - PropertyEntryVector_t::const_iterator aIt = aPropVector.begin(); - while( aIt != aPropVector.end() ) - { - if ( xInfo->hasPropertyByName(aIt->sName) ) - { - const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID); - if ( pItem ) - { - ::std::auto_ptr pClone(pItem->Clone()); - pClone->PutValue(_xShape->getPropertyValue(aIt->sName), aIt->nMemberId); - _rItemSet.Put(*pClone, aIt->nWID); - } - } - ++aIt; - } - } - - void lcl_fillItemsToShape( const uno::Reference& _xShape,const SfxItemSet& _rItemSet ) - { - const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); - SvxUnoPropertyMapProvider aMap; - const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries(); - PropertyEntryVector_t::const_iterator aIt = aPropVector.begin(); - while( aIt != aPropVector.end() ) - { - if ( SFX_ITEM_SET == _rItemSet.GetItemState(aIt->nWID) && xInfo->hasPropertyByName(aIt->sName) ) - { - const beans::Property aProp = xInfo->getPropertyByName( aIt->sName ); - if ( ( aIt->nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY ) - { - const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID); - if ( pItem ) - { - uno::Any aValue; - pItem->QueryValue(aValue,aIt->nMemberId); - try - { - _xShape->setPropertyValue(aIt->sName, aValue); - } - catch(uno::Exception&) - { // shapes have a bug so we ignore this one. - } - } - } - } - ++aIt; - } - } - // ------------------------------------------------------------------------- - void lcl_CharPropertiesToItems( const uno::Reference& _rxReportControlFormat, - SfxItemSet& _rItemSet ) - { - if ( !_rxReportControlFormat.is() ) - throw lang::NullPointerException(); - - uno::Reference< beans::XPropertySet > xSet(_rxReportControlFormat,uno::UNO_QUERY_THROW); - - // fill it - const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) ); - - _rItemSet.Put(SvxShadowedItem(_rxReportControlFormat->getCharShadowed(),ITEMID_SHADOWED)); - _rItemSet.Put(SvxWordLineModeItem(aFont.IsWordLineMode(),ITEMID_WORDLINEMODE)); - _rItemSet.Put(SvxContourItem(_rxReportControlFormat->getCharContoured(),ITEMID_CONTOUR)); - _rItemSet.Put(SvxAutoKernItem(_rxReportControlFormat->getCharAutoKerning(),ITEMID_AUTOKERN)); - _rItemSet.Put(SvxCrossedOutItem(aFont.GetStrikeout(),ITEMID_CROSSEDOUT)); - _rItemSet.Put(SvxCaseMapItem(static_cast(_rxReportControlFormat->getCharCaseMap()),ITEMID_CASEMAP)); - - _rItemSet.Put(SvxEscapementItem(_rxReportControlFormat->getCharEscapement(),_rxReportControlFormat->getCharEscapementHeight(),ITEMID_ESCAPEMENT)); - _rItemSet.Put(SvxBlinkItem(_rxReportControlFormat->getCharFlash(),ITEMID_BLINK)); - _rItemSet.Put(SvxCharHiddenItem(_rxReportControlFormat->getCharHidden(),ITEMID_CHARHIDDEN)); - _rItemSet.Put(SvxTwoLinesItem(_rxReportControlFormat->getCharCombineIsOn(),_rxReportControlFormat->getCharCombinePrefix().toChar(),_rxReportControlFormat->getCharCombineSuffix().toChar(),ITEMID_TWOLINES)); - SvxUnderlineItem aUnderLineItem(aFont.GetUnderline(),ITEMID_UNDERLINE); - aUnderLineItem.SetColor(_rxReportControlFormat->getCharUnderlineColor()); - _rItemSet.Put(aUnderLineItem); - _rItemSet.Put(SvxKerningItem(_rxReportControlFormat->getCharKerning(),ITEMID_KERNING)); - _rItemSet.Put(SvxEmphasisMarkItem(static_cast(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK)); - _rItemSet.Put(SvxCharReliefItem(static_cast(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF)); - _rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR)); - _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE)); - _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W)); - - SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY); - aHorJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_PARAADJUST),MID_HORJUST_ADJUST); - _rItemSet.Put(aHorJustifyItem); - SvxVerJustifyItem aVerJustifyItem(ITEMID_VERJUSTIFY); - aVerJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_VERTICALALIGN),MID_HORJUST_ADJUST); - _rItemSet.Put(aVerJustifyItem); - - uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY); - if ( !xShape.is() ) - _rItemSet.Put(SvxBrushItem(::Color(_rxReportControlFormat->getControlBackground()),ITEMID_BRUSH)); - - lcl_setFont(_rxReportControlFormat, _rItemSet,ASIAN,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_LANGUAGE_ASIAN,ITEMID_POSTURE_ASIAN,ITEMID_WEIGHT_ASIAN ); - lcl_setFont(_rxReportControlFormat, _rItemSet,COMPLEX,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_LANGUAGE_COMPLEX,ITEMID_POSTURE_COMPLEX,ITEMID_WEIGHT_COMPLEX ); - } - - // ------------------------------------------------------------------------- - void lcl_pushBack( uno::Sequence< beans::NamedValue >& _out_rProperties, const ::rtl::OUString& _sName, const uno::Any& _rValue ) - { - sal_Int32 nLen( _out_rProperties.getLength() ); - _out_rProperties.realloc( nLen + 1 ); - _out_rProperties[ nLen ] = beans::NamedValue( _sName, _rValue ); - } - - // ------------------------------------------------------------------------- - void lcl_initAwtFont( const Font& _rOriginalFont, const SfxItemSet& _rItemSet, awt::FontDescriptor& _out_rAwtFont, - sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nPosture, sal_uInt16 _nWeight) - { - Font aNewFont( _rOriginalFont ); - const SfxPoolItem* pItem( NULL ); - if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFont,sal_True,&pItem) && pItem->ISA(SvxFontItem)) - { - const SvxFontItem* pFontItem = static_cast(pItem); - aNewFont.SetName( pFontItem->GetFamilyName()); - aNewFont.SetStyleName(pFontItem->GetStyleName()); - aNewFont.SetFamily(pFontItem->GetFamily()); - aNewFont.SetPitch(pFontItem->GetPitch()); - aNewFont.SetCharSet(pFontItem->GetCharSet()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFontHeight,sal_True,&pItem) && pItem->ISA(SvxFontHeightItem)) - { - const SvxFontHeightItem* pFontItem = static_cast(pItem); - aNewFont.SetHeight(OutputDevice::LogicToLogic(Size(0, pFontItem->GetHeight()), MAP_TWIP, MAP_POINT).Height()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nPosture,sal_True,&pItem) && pItem->ISA(SvxPostureItem)) - { - const SvxPostureItem* pFontItem = static_cast(pItem); - aNewFont.SetItalic(pFontItem->GetPosture()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nWeight,sal_True,&pItem) && pItem->ISA(SvxWeightItem)) - { - const SvxWeightItem* pFontItem = static_cast(pItem); - aNewFont.SetWeight(pFontItem->GetWeight()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_WORDLINEMODE,sal_True,&pItem) && pItem->ISA(SvxWordLineModeItem)) - { - const SvxWordLineModeItem* pFontItem = static_cast(pItem); - aNewFont.SetWordLineMode(pFontItem->GetValue()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CROSSEDOUT,sal_True,&pItem) && pItem->ISA(SvxCrossedOutItem)) - { - const SvxCrossedOutItem* pFontItem = static_cast(pItem); - aNewFont.SetStrikeout(pFontItem->GetStrikeout()); - } - - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARROTATE,sal_True,&pItem) && pItem->ISA(SvxCharRotateItem)) - { - const SvxCharRotateItem* pRotateItem = static_cast(pItem); - aNewFont.SetOrientation(pRotateItem->GetValue()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARSCALE_W,sal_True,&pItem) && pItem->ISA(SvxCharScaleWidthItem)) - { - const SvxCharScaleWidthItem* pCharItem = static_cast(pItem); - aNewFont.SetWidthType(VCLUnoHelper::ConvertFontWidth(pCharItem->GetValue())); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem)) - { - const SvxUnderlineItem* pFontItem = static_cast(pItem); - aNewFont.SetUnderline(pFontItem->GetLineStyle()); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem)) - { - const SvxColorItem* pFontItem = static_cast(pItem); - aNewFont.SetColor(pFontItem->GetValue().GetColor()); - } - - _out_rAwtFont = VCLUnoHelper::CreateFontDescriptor( aNewFont ); - } - - // ------------------------------------------------------------------------- - void lcl_itemsToCharProperties( const Font& _rOriginalControlFont,const Font& _rOriginalControlFontAsian,const Font& _rOriginalControlFontComplex, const SfxItemSet& _rItemSet, uno::Sequence< beans::NamedValue >& _out_rProperties ) - { - const SfxPoolItem* pItem( NULL ); - - // create an AWT font - awt::FontDescriptor aAwtFont; - lcl_initAwtFont( _rOriginalControlFont, _rItemSet, aAwtFont,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_POSTURE, ITEMID_WEIGHT); - lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Font")), uno::makeAny( aAwtFont ) ); - lcl_initAwtFont( _rOriginalControlFontAsian, _rItemSet, aAwtFont,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_POSTURE_ASIAN, ITEMID_WEIGHT_ASIAN); - lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontAsian")), uno::makeAny( aAwtFont ) ); - lcl_initAwtFont( _rOriginalControlFontComplex, _rItemSet, aAwtFont,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_POSTURE_COMPLEX, ITEMID_WEIGHT_COMPLEX); - lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontComplex")), uno::makeAny( aAwtFont ) ); - - // properties which cannot be represented in an AWT font need to be preserved directly - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_SHADOWED,sal_True,&pItem) && pItem->ISA(SvxShadowedItem)) - { - const SvxShadowedItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARSHADOWED, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CONTOUR,sal_True,&pItem) && pItem->ISA(SvxContourItem)) - { - const SvxContourItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCONTOURED, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem)) - { - const SvxUnderlineItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARUNDERLINECOLOR, uno::makeAny( pFontItem->GetColor().GetColor() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem)) - { - const SvxHorJustifyItem* pJustifyItem = static_cast(pItem); - uno::Any aValue; - pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST); - lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, aValue ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem)) - { - const SvxVerJustifyItem* pJustifyItem = static_cast(pItem); - uno::Any aValue; - pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST); - lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, aValue ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem)) - { - const SvxCharReliefItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARRELIEF, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEnumValue() ) ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARHIDDEN,sal_True,&pItem) && pItem->ISA(SvxCharHiddenItem)) - { - const SvxCharHiddenItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARHIDDEN, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_AUTOKERN,sal_True,&pItem) && pItem->ISA(SvxAutoKernItem)) - { - const SvxAutoKernItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARAUTOKERNING, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BRUSH,sal_True,&pItem) && pItem->ISA(SvxBrushItem)) - { - const SvxBrushItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CONTROLBACKGROUND, uno::makeAny( pFontItem->GetColor().GetColor() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BLINK,sal_True,&pItem) && pItem->ISA(SvxBlinkItem)) - { - const SvxBlinkItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARFLASH, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_EMPHASISMARK,sal_True,&pItem) && pItem->ISA(SvxEmphasisMarkItem)) - { - const SvxEmphasisMarkItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHAREMPHASIS, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEmphasisMark() ) ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_TWOLINES,sal_True,&pItem) && pItem->ISA(SvxTwoLinesItem)) - { - const SvxTwoLinesItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEISON, uno::makeAny( pFontItem->GetValue() ) ); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEPREFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetStartBracket() ) ) ); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINESUFFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetEndBracket() ) ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem)) - { - const SvxColorItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCOLOR, uno::makeAny( pFontItem->GetValue().GetColor() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_KERNING,sal_True,&pItem) && pItem->ISA(SvxKerningItem)) - { - const SvxKerningItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARKERNING, uno::makeAny( pFontItem->GetValue() ) ); - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem)) - { - const SvxCaseMapItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetValue() ) ); - } - struct Items { - sal_uInt16 nWhich; - ::rtl::OUString sPropertyName; - }; - const Items pItems[] = { {ITEMID_LANGUAGE,PROPERTY_CHARLOCALE} - ,{ITEMID_LANGUAGE_ASIAN,PROPERTY_CHARLOCALEASIAN} - ,{ITEMID_LANGUAGE_COMPLEX,PROPERTY_CHARLOCALECOMPLEX} - }; - for(size_t k = 0; k < SAL_N_ELEMENTS(pItems);++k) - { - if ( SFX_ITEM_SET == _rItemSet.GetItemState( pItems[k].nWhich,sal_True,&pItem) && pItem->ISA(SvxLanguageItem)) - { - const SvxLanguageItem* pFontItem = static_cast(pItem); - lang::Locale aCharLocale; - MsLangId::convertLanguageToLocale( pFontItem->GetLanguage(), aCharLocale ); - lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) ); - } - } - if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,sal_True,&pItem) && pItem->ISA(SvxEscapementItem)) - { - const SvxEscapementItem* pFontItem = static_cast(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENT, uno::makeAny( pFontItem->GetEsc() ) ); - lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENTHEIGHT, uno::makeAny( (sal_Int8)pFontItem->GetProp() ) ); - } - } - - // ------------------------------------------------------------------------- - template< class ATTRIBUTE_TYPE > - void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName, - const uno::Reference& _rxReportControlFormat, - void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) ) - { - ATTRIBUTE_TYPE aAttributeValue = ATTRIBUTE_TYPE(); - if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) ) - (_rxReportControlFormat.get()->*pSetter)( aAttributeValue ); - } - - // ------------------------------------------------------------------------- - void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName, - const uno::Reference& _rxReportControlFormat, - void (SAL_CALL report::XReportControlFormat::*pSetter)( const ::rtl::OUString& ) ) - { - ::rtl::OUString aAttributeValue; - if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) ) - (_rxReportControlFormat.get()->*pSetter)( aAttributeValue ); - } - - // ------------------------------------------------------------------------- - void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName, - const uno::Reference& _rxReportControlFormat, - void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) ) - { - lang::Locale aAttributeValue; - if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) ) - (_rxReportControlFormat.get()->*pSetter)( aAttributeValue ); - } -} - -// ----------------------------------------------------------------------------- -bool openCharDialog( const uno::Reference& _rxReportControlFormat, - const uno::Reference< awt::XWindow>& _rxParentWindow, uno::Sequence< beans::NamedValue >& _out_rNewValues ) -{ - OSL_PRECOND( _rxReportControlFormat.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" ); - if ( !_rxReportControlFormat.is() || !_rxParentWindow.is() ) - return false; - - _out_rNewValues = uno::Sequence< beans::NamedValue >(); - - // ------------ - // UNO->ItemSet - static SfxItemInfo aItemInfos[] = - { - { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_FONTLIST, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE }, - { SID_COLOR_TABLE, SFX_ITEM_POOLABLE }, - { SID_ATTR_FLASH, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE }, - { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE }, - { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE }, - { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE }, - - // Asian - { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE }, - // Complex - { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE }, - { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE } - }; - Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow ); - ::std::auto_ptr pFontList(new FontList( pParent )); - ::std::auto_ptr pColorTable( new XColorTable( SvtPathOptions().GetPalettePath() )); - SfxPoolItem* pDefaults[] = - { - new SvxFontItem(ITEMID_FONT), - new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT), - new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE), - new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE), - new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT), - - new SvxShadowedItem(sal_False,ITEMID_SHADOWED), - new SvxWordLineModeItem(sal_False,ITEMID_WORDLINEMODE), - new SvxContourItem(sal_False,ITEMID_CONTOUR), - new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT), - new SvxUnderlineItem(UNDERLINE_NONE,ITEMID_UNDERLINE), - - new SvxColorItem(ITEMID_COLOR), - new SvxKerningItem(0,ITEMID_KERNING), - new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED,ITEMID_CASEMAP), - new SvxEscapementItem(ITEMID_ESCAPEMENT), - new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST), - new SvxAutoKernItem(sal_False,ITEMID_AUTOKERN), - new SvxColorTableItem(pColorTable.get(),ITEMID_COLOR_TABLE), - new SvxBlinkItem(sal_False,ITEMID_BLINK), - new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK), - new SvxTwoLinesItem(sal_True,0,0,ITEMID_TWOLINES), - new SvxCharRotateItem(0,sal_False,ITEMID_CHARROTATE), - new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W), - new SvxCharReliefItem(RELIEF_NONE,ITEMID_CHARRELIEF), - new SvxCharHiddenItem(sal_False,ITEMID_CHARHIDDEN), - new SvxBrushItem(ITEMID_BRUSH), - new SvxHorJustifyItem(ITEMID_HORJUSTIFY), - new SvxVerJustifyItem(ITEMID_VERJUSTIFY), -// Asian - new SvxFontItem(ITEMID_FONT_ASIAN), - new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN), - new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN), - new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN), - new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN), -// Complex - new SvxFontItem(ITEMID_FONT_COMPLEX), - new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX), - new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX), - new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX), - new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX) - - }; - - OSL_ASSERT((SAL_N_ELEMENTS(pDefaults)) == (SAL_N_ELEMENTS(aItemInfos))); - - static sal_uInt16 pRanges[] = - { - ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, - 0 - }; - - SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) ); - // not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why - pPool->FreezeIdRanges(); // the same - bool bSuccess = false; - try - { - ::std::auto_ptr pDescriptor( new SfxItemSet( *pPool, pRanges ) ); - lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor ); - - { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR); - uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY ); - if ( xShape.is() ) - aDlg.RemoveTabPage( RID_PAGE_BACKGROUND ); - bSuccess = ( RET_OK == aDlg.Execute() ); - if ( bSuccess ) - { - lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ), - lcl_getReportControlFont( _rxReportControlFormat,ASIAN ), - lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues ); - } - } - } - catch(uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) - delete pDefaults[i]; - - return bSuccess; -} -// ----------------------------------------------------------------------------- -bool openAreaDialog( const uno::Reference& _xShape,const uno::Reference< awt::XWindow>& _rxParentWindow ) -{ - OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openAreaDialog: invalid parameters!" ); - if ( !_xShape.is() || !_rxParentWindow.is() ) - return false; - - ::boost::shared_ptr pModel = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition()); - - Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow ); - - bool bSuccess = false; - try - { - SfxItemPool& rItemPool = pModel->GetItemPool(); - ::std::auto_ptr pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) ); - - lcl_fillShapeToItems(_xShape,*pDescriptor); - - { // want the dialog to be destroyed before our set - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ::std::auto_ptr pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get() )); - // #i74099# by default, the dialog deletes the current color table if a different one is loaded - // (see SwDrawShell::ExecDrawDlg) - const SvxColorTableItem* pColorItem = static_cast( pDescriptor->GetItem(SID_COLOR_TABLE) ); - if (pColorItem && pColorItem->GetColorTable() == &XColorTable::GetStdColorTable()) - pDialog->DontDeleteColorTable(); - bSuccess = ( RET_OK == pDialog->Execute() ); - if ( bSuccess ) - { - lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet()); - } - } - - } - catch(uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return bSuccess; -} - -// ----------------------------------------------------------------------------- -void applyCharacterSettings( const uno::Reference< report::XReportControlFormat >& _rxReportControlFormat, const uno::Sequence< beans::NamedValue >& _rSettings ) -{ - ::comphelper::NamedValueCollection aSettings( _rSettings ); - - try - { - awt::FontDescriptor aAwtFont; - if ( aSettings.get( "Font" ) >>= aAwtFont ) - { - ::rtl::OUString sTemp = aAwtFont.Name; - aAwtFont.Name = ::rtl::OUString(); // hack to - _rxReportControlFormat->setFontDescriptor( aAwtFont ); - _rxReportControlFormat->setCharFontName( sTemp ); - } - if ( aSettings.get( "FontAsian" ) >>= aAwtFont ) - { - ::rtl::OUString sTemp = aAwtFont.Name; - aAwtFont.Name = ::rtl::OUString(); // hack to - _rxReportControlFormat->setFontDescriptorAsian( aAwtFont ); - _rxReportControlFormat->setCharFontNameAsian( sTemp ); - } - if ( aSettings.get( "FontComplex" ) >>= aAwtFont ) - { - ::rtl::OUString sTemp = aAwtFont.Name; - aAwtFont.Name = ::rtl::OUString(); // hack to - _rxReportControlFormat->setFontDescriptorComplex( aAwtFont ); - _rxReportControlFormat->setCharFontNameComplex( sTemp ); - } - - lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor ); - lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust ); - lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning ); - lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharColor ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -// ----------------------------------------------------------------------------- -void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t _rMemFunc) -{ - OSL_ENSURE(_pWindow,"Window can not be null!"); - SystemWindow* pSystemWindow = _pWindow ? _pWindow->GetSystemWindow() : NULL; - if ( pSystemWindow ) - { - _rMemFunc( pSystemWindow->GetTaskPaneList(), _pToRegister ); - } -} -// ----------------------------------------------------------------------------- -SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, bool _bAllObjects, SdrObject* _pIgnore, sal_Int16 _nIgnoreType) -{ - SdrObject* pOverlappedObj = NULL; - SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS); - SdrObject* pObjIter = NULL; - - while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL ) - { - if ( _pIgnore != pObjIter - && (_bAllObjects || !_rView.IsObjMarked(pObjIter)) - && (dynamic_cast(pObjIter) != NULL || dynamic_cast(pObjIter) != NULL)) - { - if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE) - { - continue; - } - - if (dynamic_cast(pObjIter) != NULL || dynamic_cast(pObjIter) != NULL) - { - Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect()); - if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) ) - pOverlappedObj = pObjIter; - } - } - } - return pOverlappedObj; -} -// ----------------------------------------------------------------------------- -bool checkArrayForOccurrence(SdrObject* _pObjToCheck, SdrUnoObj* _pIgnore[], int _nListLength) -{ - for(int i=0;i<_nListLength;i++) - { - SdrObject *pIgnore = _pIgnore[i]; - if (pIgnore == _pObjToCheck) - { - return true; - } - } - return false; -} - -SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength) -{ - SdrObject* pOverlappedObj = NULL; - SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS); - SdrObject* pObjIter = NULL; - - while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL ) - { - if (checkArrayForOccurrence(pObjIter, _pIgnoreList, _nIgnoreListLength)) - { - continue; - } - - if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter)) - && (dynamic_cast(pObjIter) != NULL || dynamic_cast(pObjIter) != NULL) ) - { - Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect()); - if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) ) - pOverlappedObj = pObjIter; - } - } - return pOverlappedObj; -} - -//---------------------------------------------------------------------------- -SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects) -{ - SdrObject* pOverlappedObj = NULL; - if (dynamic_cast(_pObj) != NULL || dynamic_cast(_pObj) != NULL) // this doesn't need to be done for shapes - { - Rectangle aRect = _pObj->GetCurrentBoundRect(); - pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj); - } - return pOverlappedObj; -} - -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > getParameterNames( const uno::Reference< sdbc::XRowSet >& _rxRowSet ) -{ - uno::Sequence< ::rtl::OUString > aNames; - - try - { - uno::Reference< sdb::XParametersSupplier > xSuppParams( _rxRowSet, uno::UNO_QUERY_THROW ); - uno::Reference< container::XIndexAccess > xParams( xSuppParams->getParameters() ); - if ( xParams.is() ) - { - sal_Int32 count( xParams->getCount() ); - aNames.realloc( count ); - - uno::Reference< beans::XPropertySet > xParam; - ::rtl::OUString sParamName; - for ( sal_Int32 i=0; igetByIndex(i), uno::UNO_QUERY_THROW ); - OSL_VERIFY( xParam->getPropertyValue( PROPERTY_NAME ) >>= sParamName ); - aNames[i] = sParamName; - } - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return aNames; -} -// ----------------------------------------------------------------------------- -Rectangle getRectangleFromControl(SdrObject* _pControl) -{ - if (_pControl) - { - uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY); - if (xComponent.is()) - { - Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize())); - aRect.setHeight(aRect.getHeight() + 1); - aRect.setWidth(aRect.getWidth() + 1); - return aRect; - } - } - return Rectangle(); -} -// ----------------------------------------------------------------------------- -// check overlapping -void correctOverlapping(SdrObject* _pControl,OReportSection& _aReportSection,bool _bInsert) -{ - OSectionView& rSectionView = _aReportSection.getSectionView(); - uno::Reference< report::XReportComponent> xComponent(_pControl->getUnoShape(),uno::UNO_QUERY); - Rectangle aRect = getRectangleFromControl(_pControl); - - bool bOverlapping = true; - while ( bOverlapping ) - { - SdrObject* pOverlappedObj = isOver(aRect,*_aReportSection.getPage(),rSectionView,true, _pControl); - bOverlapping = pOverlappedObj != NULL; - if ( bOverlapping ) - { - const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect(); - aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top()); - xComponent->setPositionY(aRect.Top()); - } - } - if ( !bOverlapping && _bInsert ) // now insert objects - rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(),SDRINSERT_ADDMARK); -} -// ----------------------------------------------------------------------------- -void setZoomFactor(const Fraction& _aZoom,Window& _rWindow) -{ - MapMode aMapMode( _rWindow.GetMapMode() ); - aMapMode.SetScaleX(_aZoom); - aMapMode.SetScaleY(_aZoom); - _rWindow.SetMapMode(aMapMode); -} -// ----------------------------------------------------------------------------- -bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula - , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext - , const uno::Reference< awt::XWindow>& _xInspectorWindow - , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet - ) -{ - OSL_PRECOND( _xInspectorWindow.is(), "openDialogFormula_nothrow: invalid parameters!" ); - if ( !_xInspectorWindow.is() ) - return false; - bool bSuccess = false; - ::dbtools::SQLExceptionInfo aErrorInfo; - uno::Reference< awt::XWindow > xInspectorWindow; - uno::Reference< lang::XMultiComponentFactory > xFactory; - uno::Reference xServiceFactory; - try - { - xFactory = _xContext->getServiceManager(); - xServiceFactory.set(xFactory,uno::UNO_QUERY); - Window* pParent = VCLUnoHelper::GetWindow( _xInspectorWindow ); - - uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFunctionManager")),_xContext),uno::UNO_QUERY); - if ( xMgr.is() ) - { - ::boost::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) ); - ReportFormula aFormula( _in_out_rFormula ); - FormulaDialog aDlg(pParent,xServiceFactory,pFormulaManager,aFormula.getUndecoratedContent(),_xRowSet); - bSuccess = aDlg.Execute() == RET_OK; - if ( bSuccess ) - { - String sFormula = aDlg.getCurrentFormula(); - xub_StrLen nIndex = 0; - if ( sFormula.GetChar(0) == '=' ) - nIndex = 1; - _in_out_rFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFormula.Copy(nIndex); - } - } - } - catch (sdb::SQLContext& e) { aErrorInfo = e; } - catch (sdbc::SQLWarning& e) { aErrorInfo = e; } - catch (sdbc::SQLException& e) { aErrorInfo = e; } - catch( const uno::Exception& ) - { - OSL_FAIL( "GeometryHandler::impl_dialogFilter_nothrow: caught an exception!" ); - } - - if ( aErrorInfo.isValid() ) - ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory ); - - return bSuccess; -} -// ----------------------------------------------------------------------------- -} // namespace rptui -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/rptuiservices.cxx b/reportdesign/source/ui/misc/rptuiservices.cxx deleted file mode 100644 index 636615099..000000000 --- a/reportdesign/source/ui/misc/rptuiservices.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_rptui.hxx" -#include -#include -#include -#include "ReportController.hxx" -#include "toolboxcontroller.hxx" -#include "statusbarcontroller.hxx" -#include "DefaultInspection.hxx" -#include "ReportComponentHandler.hxx" -#include "GeometryHandler.hxx" -#include "DataProviderHandler.hxx" - -/********************************************************************************************/ - -using namespace ::rptui; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//*************************************************************************************** -// -// registry functions -namespace -{ - -cppu::ImplementationEntry entries[] = { - { &OReportController::create, &OReportController::getImplementationName_Static, &OReportController::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OToolboxController::create, &OToolboxController::getImplementationName_Static, &OToolboxController::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OStatusbarController::create, &OStatusbarController::getImplementationName_Static, &OStatusbarController::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &DefaultComponentInspectorModel::create, &DefaultComponentInspectorModel::getImplementationName_Static, &DefaultComponentInspectorModel::getSupportedServiceNames_static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &ReportComponentHandler::create, &ReportComponentHandler::getImplementationName_Static, &ReportComponentHandler::getSupportedServiceNames_static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &GeometryHandler::create, &GeometryHandler::getImplementationName_Static, &GeometryHandler::getSupportedServiceNames_static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &DataProviderHandler::create, &DataProviderHandler::getImplementationName_Static, &DataProviderHandler::getSupportedServiceNames_static, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL rptui_component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx deleted file mode 100644 index ed4fbad17..000000000 --- a/reportdesign/source/ui/misc/statusbarcontroller.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_rptui.hxx" -#include "statusbarcontroller.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace rptui -{ - using namespace svt; - using namespace com::sun::star::uno; - using namespace com::sun::star::beans; - using namespace com::sun::star::lang; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::util; - -::rtl::OUString SAL_CALL OStatusbarController::getImplementationName() throw( RuntimeException ) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString OStatusbarController::getImplementationName_Static() throw( RuntimeException ) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.StatusbarController")); -} -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString> OStatusbarController::getSupportedServiceNames_Static(void) throw( RuntimeException ) -{ - Sequence< ::rtl::OUString> aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StatusbarController")); - return aSupported; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OStatusbarController::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -//------------------------------------------------------------------------- -Sequence< ::rtl::OUString> SAL_CALL OStatusbarController::getSupportedServiceNames() throw(RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -// ------------------------------------------------------------------------- -Reference< XInterface > OStatusbarController::create(Reference< XComponentContext > const & xContext) -{ - return *(new OStatusbarController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))); -} -IMPLEMENT_FORWARD_XINTERFACE2(OStatusbarController, ::svt::StatusbarController,OStatusbarController_BASE) - -OStatusbarController::OStatusbarController(const Reference< XMultiServiceFactory >& _rxORB) -: m_nSlotId(0) -,m_nId(1) -{ - m_xServiceManager = _rxORB; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) -{ - StatusbarController::initialize(_rArguments); - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - StatusBar* pStatusBar = static_cast(VCLUnoHelper::GetWindow(m_xParentWindow)); - if ( pStatusBar ) - { - const sal_uInt16 nCount = pStatusBar->GetItemCount(); - for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) - { - const sal_uInt16 nItemId = pStatusBar->GetItemId(nPos); - if ( pStatusBar->GetItemCommand(nItemId) == String(m_aCommandURL) ) - { - m_nId = nItemId; - break; - } - } - if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:ZoomSlider")) ) - { - m_pController = TStatusbarHelper::createFromQuery(new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:Zoom")) ) - { - m_pController = TStatusbarHelper::createFromQuery(new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar)); - } - - if ( m_pController.is() ) - { - m_pController->initialize(_rArguments); - m_pController->update(); - } - - addStatusListener(m_aCommandURL); - update(); - } -} -// XStatusListener -void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEvent)throw ( RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - if ( m_pController.is() ) - { - if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:ZoomSlider")) ) - { - Sequence< PropertyValue > aSeq; - if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 2 ) - { - SvxZoomSliderItem aZoomSlider(100,20,400); - aZoomSlider.PutValue(_aEvent.State); - static_cast(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider); - } - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:Zoom")) ) - { - Sequence< PropertyValue > aSeq; - if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 3 ) - { - SvxZoomItem aZoom; - aZoom.PutValue(_aEvent.State); - static_cast(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom); - } - } - } -} - -// XStatusbarController -::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) -{ - return m_pController.is() && m_pController.getRef()->mouseButtonDown(_aEvent); -} - -::sal_Bool SAL_CALL OStatusbarController::mouseMove( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) -{ - return m_pController.is() && m_pController.getRef()->mouseMove(_aEvent); -} - -::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) -{ - return m_pController.is() && m_pController.getRef()->mouseButtonUp(_aEvent); -} - -void SAL_CALL OStatusbarController::command( - const ::com::sun::star::awt::Point& aPos, - ::sal_Int32 nCommand, - ::sal_Bool bMouseEvent, - const ::com::sun::star::uno::Any& aData ) -throw (::com::sun::star::uno::RuntimeException) -{ - if ( m_pController.is() ) - m_pController.getRef()->command( aPos, nCommand, bMouseEvent, aData ); -} - -void SAL_CALL OStatusbarController::paint( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, - const ::com::sun::star::awt::Rectangle& rOutputRectangle, - ::sal_Int32 nItemId, - ::sal_Int32 nStyle ) -throw (::com::sun::star::uno::RuntimeException) -{ - if ( m_pController.is() ) - m_pController.getRef()->paint( xGraphics, rOutputRectangle, nItemId, nStyle ); -} - -void SAL_CALL OStatusbarController::click() throw (::com::sun::star::uno::RuntimeException) -{ - if ( m_pController.is() ) - m_pController.getRef()->click(); -} - -void SAL_CALL OStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException) -{ - if ( m_pController.is() ) - m_pController.getRef()->doubleClick(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStatusbarController::update() throw ( RuntimeException ) -{ - ::svt::StatusbarController::update(); - Reference< XUpdatable > xUp(m_pController.getRef(),UNO_QUERY); - if ( xUp.is() ) - xUp->update(); -} -// ----------------------------------------------------------------------------- -// XComponent -void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - Reference< XComponent > xComp( m_pController.getRef(), UNO_QUERY ); - ::comphelper::disposeComponent(xComp); - m_pController.dispose(); - svt::StatusbarController::dispose(); -} -// ============================================================================= -} // rptui -// ============================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx deleted file mode 100644 index 8c2784858..000000000 --- a/reportdesign/source/ui/misc/toolboxcontroller.cxx +++ /dev/null @@ -1,362 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_rptui.hxx" -#include "toolboxcontroller.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define ITEMID_COLOR 1 -#define ITEMID_BRUSH 2 -#define ITEMID_FONT 3 -#define ITEMID_FONTHEIGHT 4 -#include -#include -#include -#include -#include - -#include - -#include - -namespace rptui -{ - using namespace svt; - using namespace com::sun::star; - using namespace com::sun::star::uno; - using namespace com::sun::star::beans; - using namespace com::sun::star::lang; - using namespace frame; - using namespace util; - using namespace ui; - -::rtl::OUString SAL_CALL OToolboxController::getImplementationName() throw( RuntimeException ) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString OToolboxController::getImplementationName_Static() throw( RuntimeException ) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.ReportToolboxController")); -} -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString> OToolboxController::getSupportedServiceNames_Static(void) throw( RuntimeException ) -{ - Sequence< ::rtl::OUString> aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportToolboxController")); - return aSupported; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -//------------------------------------------------------------------------- -Sequence< ::rtl::OUString> SAL_CALL OToolboxController::getSupportedServiceNames() throw(RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -// ------------------------------------------------------------------------- -Reference< XInterface > OToolboxController::create(Reference< XComponentContext > const & xContext) -{ - return *(new OToolboxController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))); -} -// ----------------------------------------------------------------------------- -DBG_NAME(rpt_OToolboxController) -OToolboxController::OToolboxController(const Reference< XMultiServiceFactory >& _rxORB) - : m_pToolbarController(NULL) - ,m_nToolBoxId(1) - ,m_nSlotId(0) -{ - DBG_CTOR(rpt_OToolboxController,NULL); - osl_incrementInterlockedCount(&m_refCount); - m_xServiceManager = _rxORB; - osl_decrementInterlockedCount(&m_refCount); - -} -// ----------------------------------------------------------------------------- -OToolboxController::~OToolboxController() -{ - DBG_DTOR(rpt_OToolboxController,NULL); -} -// ----------------------------------------------------------------------------- -// XInterface -Any SAL_CALL OToolboxController::queryInterface( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn = ToolboxController::queryInterface(_rType); - if (!aReturn.hasValue()) - aReturn = TToolboxController_BASE::queryInterface(_rType); - return aReturn; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::acquire() throw () -{ - ToolboxController::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::release() throw () -{ - ToolboxController::release(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) -{ - ToolboxController::initialize(_rArguments); - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - ToolBox* pToolBox = static_cast(VCLUnoHelper::GetWindow(getParent())); - if ( pToolBox ) - { - const sal_uInt16 nCount = pToolBox->GetItemCount(); - for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) - { - const sal_uInt16 nItemId = pToolBox->GetItemId(nPos); - if ( pToolBox->GetItemCommand(nItemId) == String(m_aCommandURL) ) - { - m_nToolBoxId = nItemId; - break; - } - } - if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:BasicShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BasicShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_BASIC,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:SymbolShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SymbolShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_SYMBOL,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:ArrowShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:ArrowShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_ARROW,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:FlowChartShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FlowChartShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_FLOWCHART,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:CalloutShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CalloutShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_CALLOUT,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:StarShapes")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:StarShapes")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_STAR,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:CharFontName")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CharFontName")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontNameToolBoxControl/*SvxStyleToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_FONT,m_nToolBoxId,*pToolBox)); - } - else if ( m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:FontColor")) || m_aCommandURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:Color")) ) - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontColor")),sal_True)); - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Color")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontColorExtToolBoxControl/*SvxFontColorToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox)); - } - else - { - m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BackgroundColor")),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxColorToolBoxControl(m_nSlotId = SID_BACKGROUND_COLOR,m_nToolBoxId,*pToolBox)); - } - - TCommandState::iterator aIter = m_aStates.begin(); - for (; aIter != m_aStates.end(); ++aIter) - addStatusListener(aIter->first); - - if ( m_pToolbarController.is() ) - m_pToolbarController->initialize(_rArguments); - // check if paste special is allowed, when not don't add DROPDOWN - pToolBox->SetItemBits(m_nToolBoxId,pToolBox->GetItemBits(m_nToolBoxId) | TIB_DROPDOWN); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete ); - if ( aFind != m_aStates.end() ) - { - aFind->second = Event.IsEnabled; - if ( m_pToolbarController.is() ) - { - // All other status events will be processed here - sal_Bool bSetCheckmark = sal_False; - sal_Bool bCheckmark = sal_False; - //m_pToolbarController->GetToolBox().Enable(Event.IsEnabled); - ToolBox& rTb = m_pToolbarController->GetToolBox(); - for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); i++ ) - { - sal_uInt16 nId = rTb.GetItemId( i ); - if ( nId == 0 ) - continue; - - rtl::OUString aCmd = rTb.GetItemCommand( nId ); - if ( aCmd == Event.FeatureURL.Complete ) - { - // Enable/disable item - rTb.EnableItem( nId, Event.IsEnabled ); - - // Checkmark - if ( Event.State >>= bCheckmark ) - bSetCheckmark = sal_True; - - if ( bSetCheckmark ) - rTb.CheckItem( nId, bCheckmark ); - else - { - rtl::OUString aItemText; - - if ( Event.State >>= aItemText ) - rTb.SetItemText( nId, aItemText ); - } - } - } - - switch(m_nSlotId) - { - case SID_ATTR_CHAR_COLOR2: - case SID_BACKGROUND_COLOR: - { - util::Color nColor(COL_TRANSPARENT); - Event.State >>= nColor; - ::Color aGcc3WorkaroundTemporary( nColor); - SvxColorItem aColorItem(aGcc3WorkaroundTemporary,1); - if ( SID_ATTR_CHAR_COLOR2 == m_nSlotId ) - static_cast(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem); - else - static_cast(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem); - } - break; - case SID_ATTR_CHAR_FONT: - { - SvxFontItem aItem(ITEMID_FONT); - aItem.PutValue(Event.State); - static_cast(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_AVAILABLE : SFX_ITEM_DISABLED,&aItem); - } - break; - } - } - } -} -// ----------------------------------------------------------------------------- -Reference< awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException) -{ - // execute the menu - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - Reference< awt::XWindow > xRet; - if ( m_pToolbarController.is() ) - xRet = m_pToolbarController.getRef()->createPopupWindow(); - - return xRet; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OToolboxController::opensSubToolbar() throw (uno::RuntimeException) -{ - return m_nSlotId == SID_DRAWTBX_CS_BASIC; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OToolboxController::getSubToolbarName() throw (uno::RuntimeException) -{ - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY); - if ( xSub.is() ) - return xSub->getSubToolbarName(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::functionSelected( const ::rtl::OUString& rCommand ) throw (uno::RuntimeException) -{ - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY); - if ( xSub.is() ) - { - xSub->functionSelected(m_aCommandURL = rCommand); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OToolboxController::updateImage( ) throw (uno::RuntimeException) -{ - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY); - if ( xSub.is() ) - xSub->updateImage(); -} -// ----------------------------------------------------------------------------- -uno::Reference< awt::XWindow > SAL_CALL OToolboxController::createItemWindow( const uno::Reference< awt::XWindow >& _xParent) -throw (uno::RuntimeException) -{ - uno::Reference< awt::XWindow > xWindow; - if ( m_pToolbarController.is() ) - { - switch(m_nSlotId) - { - case SID_ATTR_CHAR_FONT: - xWindow = VCLUnoHelper::GetInterface(static_cast(m_pToolbarController.get())->CreateItemWindow(VCLUnoHelper::GetWindow(_xParent))); - break; - default: - ; - } - } - return xWindow; -} -// ----------------------------------------------------------------------------- -//.......................................................................... -} // rptui -//.......................................................................... - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3