2007-07-09 10:56:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* $RCSfile: ViewsWindow.cxx,v $
|
2008-08-19 09:18:37 +00:00
|
|
|
* $Revision: 1.11 $
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* 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.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* 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).
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:16:33 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#include "precompiled_reportdesign.hxx"
|
|
|
|
#include "ViewsWindow.hxx"
|
2007-08-03 11:46:04 +00:00
|
|
|
#include "ScrollHelper.hxx"
|
|
|
|
#include "UndoActions.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include "ReportWindow.hxx"
|
|
|
|
#include "DesignView.hxx"
|
|
|
|
#include <svtools/colorcfg.hxx>
|
|
|
|
#include "ReportController.hxx"
|
|
|
|
#include "UITools.hxx"
|
|
|
|
#include "RptDef.hxx"
|
|
|
|
#include "RptResId.hrc"
|
|
|
|
#include "SectionView.hxx"
|
|
|
|
#include "ReportSection.hxx"
|
|
|
|
#include "uistrings.hrc"
|
|
|
|
#include "rptui_slotid.hrc"
|
|
|
|
#include "dlgedclip.hxx"
|
2008-08-19 09:18:37 +00:00
|
|
|
#include "ColorChanger.hxx"
|
2007-08-02 13:41:16 +00:00
|
|
|
#include "RptObject.hxx"
|
|
|
|
#include "RptObject.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include "ModuleHelper.hxx"
|
2008-08-19 09:18:37 +00:00
|
|
|
#include "EndMarker.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#include <svx/unoshape.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
|
|
|
#include "helpids.hrc"
|
|
|
|
#include <svx/svdundo.hxx>
|
2007-08-03 11:46:04 +00:00
|
|
|
#include <toolkit/helper/convert.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <algorithm>
|
2008-08-19 09:18:37 +00:00
|
|
|
#include <numeric>
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
namespace rptui
|
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
#define DEFAUL_MOVE_SIZE 100
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::comphelper;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
bool lcl_getNewRectSize(const Rectangle& _aObjRect,long& _nXMov, long& _nYMov,SdrObject* _pObj,SdrView* _pView,sal_Int32 _nControlModification, bool _bBoundRects)
|
|
|
|
{
|
|
|
|
bool bMoveAllowed = _nXMov != 0 || _nYMov != 0;
|
|
|
|
if ( bMoveAllowed )
|
|
|
|
{
|
|
|
|
Rectangle aNewRect = _aObjRect;
|
|
|
|
SdrObject* pOverlappedObj = NULL;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
aNewRect = _aObjRect;
|
|
|
|
switch(_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::HEIGHT_GREATEST:
|
|
|
|
case ControlModification::WIDTH_GREATEST:
|
|
|
|
aNewRect.setWidth(_nXMov);
|
|
|
|
aNewRect.setHeight(_nYMov);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aNewRect.Move(_nXMov,_nYMov);
|
|
|
|
break;
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( dynamic_cast<OUnoObject*>(_pObj) )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
pOverlappedObj = isOver(aNewRect,*_pObj->GetPage(),*_pView,true,_pObj);
|
|
|
|
if ( pOverlappedObj && _pObj != pOverlappedObj )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
Rectangle aOverlappingRect = (_bBoundRects ? pOverlappedObj->GetCurrentBoundRect() : pOverlappedObj->GetSnapRect());
|
|
|
|
sal_Int32 nXTemp = _nXMov;
|
|
|
|
sal_Int32 nYTemp = _nYMov;
|
|
|
|
switch(_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::LEFT:
|
2007-08-02 13:41:16 +00:00
|
|
|
nXTemp += aOverlappingRect.Right() - aNewRect.Left();
|
2007-08-03 11:46:04 +00:00
|
|
|
bMoveAllowed = _nXMov != nXTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::RIGHT:
|
|
|
|
nXTemp += aOverlappingRect.Left() - aNewRect.Right();
|
|
|
|
bMoveAllowed = _nXMov != nXTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::TOP:
|
2007-08-02 13:41:16 +00:00
|
|
|
nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
|
2007-08-03 11:46:04 +00:00
|
|
|
bMoveAllowed = _nYMov != nYTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::BOTTOM:
|
|
|
|
nYTemp += aOverlappingRect.Top() - aNewRect.Bottom();
|
|
|
|
bMoveAllowed = _nYMov != nYTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::CENTER_HORIZONTAL:
|
|
|
|
if ( _aObjRect.Left() < aOverlappingRect.Left() )
|
|
|
|
nXTemp += aOverlappingRect.Left() - aNewRect.Left() - aNewRect.getWidth();
|
|
|
|
else
|
|
|
|
nXTemp += aOverlappingRect.Right() - aNewRect.Left();
|
|
|
|
bMoveAllowed = _nXMov != nXTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::CENTER_VERTICAL:
|
|
|
|
if ( _aObjRect.Top() < aOverlappingRect.Top() )
|
|
|
|
nYTemp += aOverlappingRect.Top() - aNewRect.Top() - aNewRect.getHeight();
|
|
|
|
else
|
|
|
|
nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
|
|
|
|
bMoveAllowed = _nYMov != nYTemp;
|
|
|
|
break;
|
|
|
|
case ControlModification::HEIGHT_GREATEST:
|
|
|
|
case ControlModification::WIDTH_GREATEST:
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
Rectangle aIntersectionRect = aNewRect.GetIntersection(aOverlappingRect);
|
|
|
|
if ( !aIntersectionRect.IsEmpty() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( _nControlModification == ControlModification::WIDTH_GREATEST )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( aNewRect.Left() < aIntersectionRect.Left() )
|
|
|
|
{
|
|
|
|
aNewRect.Right() = aIntersectionRect.Left();
|
|
|
|
}
|
|
|
|
else if ( aNewRect.Left() < aIntersectionRect.Right() )
|
|
|
|
{
|
|
|
|
aNewRect.Left() = aIntersectionRect.Right();
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
else if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( aNewRect.Top() < aIntersectionRect.Top() )
|
|
|
|
{
|
|
|
|
aNewRect.Bottom() = aIntersectionRect.Top();
|
|
|
|
}
|
|
|
|
else if ( aNewRect.Top() < aIntersectionRect.Bottom() )
|
|
|
|
{
|
|
|
|
aNewRect.Top() = aIntersectionRect.Bottom();
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
nYTemp = aNewRect.getHeight();
|
|
|
|
bMoveAllowed = _nYMov != nYTemp;
|
|
|
|
nXTemp = aNewRect.getWidth();
|
|
|
|
bMoveAllowed = bMoveAllowed && _nXMov != nXTemp;
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
_nXMov = nXTemp;
|
|
|
|
_nYMov = nYTemp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pOverlappedObj = NULL;
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( pOverlappedObj && bMoveAllowed );
|
|
|
|
}
|
|
|
|
return bMoveAllowed;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DBG_NAME( rpt_OViewsWindow );
|
2008-08-19 09:18:37 +00:00
|
|
|
OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow)
|
|
|
|
: Window( _pReportWindow,WB_DIALOGCONTROL)
|
2007-07-09 10:56:41 +00:00
|
|
|
,m_pParent(_pReportWindow)
|
|
|
|
,m_bInUnmark(sal_False)
|
|
|
|
{
|
|
|
|
DBG_CTOR( rpt_OViewsWindow,NULL);
|
2008-08-19 09:18:37 +00:00
|
|
|
SetPaintTransparent(TRUE);
|
2008-01-29 12:52:21 +00:00
|
|
|
SetUniqueId(UID_RPT_VIEWSWINDOW);
|
2007-07-09 10:56:41 +00:00
|
|
|
SetMapMode( MapMode( MAP_100TH_MM ) );
|
|
|
|
StartListening(m_aColorConfig);
|
|
|
|
ImplInitSettings();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OViewsWindow::~OViewsWindow()
|
|
|
|
{
|
|
|
|
EndListening(m_aColorConfig);
|
|
|
|
m_aSections.clear();
|
|
|
|
|
|
|
|
DBG_DTOR( rpt_OViewsWindow,NULL);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::initialize()
|
|
|
|
{
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet)
|
|
|
|
{
|
|
|
|
const uno::Reference< report::XSection> xSection = _rSectionWindow.getReportSection().getSection();
|
|
|
|
|
|
|
|
Size aSectionSize = _rSectionWindow.LogicToPixel( Size( 0,xSection->getHeight() ) );
|
|
|
|
aSectionSize.Width() = getView()->GetTotalWidth();
|
|
|
|
|
|
|
|
const sal_Int32 nMinHeight = _rSectionWindow.getStartMarker().getMinHeight();
|
|
|
|
if ( _rSectionWindow.getStartMarker().isCollapsed() || nMinHeight > aSectionSize.Height() )
|
|
|
|
{
|
|
|
|
aSectionSize.Height() = nMinHeight;
|
|
|
|
}
|
|
|
|
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
|
|
|
|
aSectionSize.Height() += (long)(rSettings.GetSplitSize() * (double)_rSectionWindow.GetMapMode().GetScaleY());
|
|
|
|
|
|
|
|
if ( _bSet )
|
|
|
|
_rSectionWindow.SetPosSizePixel(_rStartPoint,aSectionSize);
|
|
|
|
|
|
|
|
_rStartPoint.Y() += aSectionSize.Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
|
|
|
|
{
|
|
|
|
bool bSet = false;
|
|
|
|
Point aStartPoint;
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
|
|
|
{
|
|
|
|
const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
|
|
|
|
if ( pSectionWindow.get() == &_rSectionWindow )
|
|
|
|
{
|
|
|
|
aStartPoint = pSectionWindow->GetPosPixel();
|
|
|
|
bSet = true;
|
|
|
|
} // if ( pSectionWindow.get() == &_rSectionWindow )
|
|
|
|
|
|
|
|
if ( bSet )
|
|
|
|
{
|
|
|
|
impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet);
|
|
|
|
pSectionWindow->Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
|
|
|
|
pSectionWindow->getStartMarker().Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT );
|
|
|
|
}
|
|
|
|
} // for (;aIter != aEnd ; ++aIter,++nPos)
|
2008-12-01 12:31:27 +00:00
|
|
|
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
|
|
|
|
aStartWidth *= GetMapMode().GetScaleX();
|
2008-08-19 09:18:37 +00:00
|
|
|
Size aOut = GetOutputSizePixel();
|
2008-12-01 12:31:27 +00:00
|
|
|
aOut.Width() = aStartWidth;
|
2008-08-19 09:18:37 +00:00
|
|
|
aOut = PixelToLogic(aOut);
|
2008-12-01 12:31:27 +00:00
|
|
|
m_pParent->notifySizeChanged();
|
2008-08-19 09:18:37 +00:00
|
|
|
|
|
|
|
Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
|
|
|
|
Invalidate(aRect,INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Resize()
|
|
|
|
{
|
|
|
|
Window::Resize();
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( !m_aSections.empty() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
const Point aOffset(m_pParent->getThumbPos());
|
|
|
|
Point aStartPoint(0,-aOffset.Y());
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (USHORT nPos=0;aIter != aEnd ; ++aIter,++nPos)
|
|
|
|
{
|
|
|
|
const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
|
|
|
|
impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true);
|
|
|
|
} // for (;aIter != aEnd ; ++aIter)
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Paint( const Rectangle& rRect )
|
|
|
|
{
|
|
|
|
Window::Paint( rRect );
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
Size aOut = GetOutputSizePixel();
|
2008-12-01 12:31:27 +00:00
|
|
|
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
|
|
|
|
aStartWidth *= GetMapMode().GetScaleX();
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
aOut.Width() -= (long)aStartWidth;
|
2008-08-19 09:18:37 +00:00
|
|
|
aOut = PixelToLogic(aOut);
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
Rectangle aRect(PixelToLogic(Point(aStartWidth,0)),aOut);
|
2008-08-19 09:18:37 +00:00
|
|
|
Wallpaper aWall( m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor );
|
|
|
|
DrawWallpaper(aRect,aWall);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::ImplInitSettings()
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
// SetBackground( Wallpaper( COL_LIGHTBLUE ));
|
|
|
|
SetBackground( );
|
2007-07-09 10:56:41 +00:00
|
|
|
SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
|
|
|
|
SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
|
|
|
|
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
|
|
|
{
|
|
|
|
ImplInitSettings();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,USHORT _nPosition)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
|
|
|
|
m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
|
|
|
|
m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
Resize();
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::removeSection(USHORT _nPosition)
|
|
|
|
{
|
|
|
|
if ( _nPosition < m_aSections.size() )
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aPos = getIteratorAtPos(_nPosition);
|
|
|
|
TSectionsMap::iterator aNew = getIteratorAtPos(_nPosition == 0 ? _nPosition+1: _nPosition - 1);
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
m_pParent->getReportView()->UpdatePropertyBrowserDelayed((*aNew)->getReportSection().getSectionView());
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
m_aSections.erase(aPos);
|
|
|
|
Resize();
|
|
|
|
} // if ( _nPosition < m_aSections.size() )
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::showView(USHORT _nPos,BOOL _bShow)
|
|
|
|
{
|
|
|
|
if ( _nPos < m_aSections.size() )
|
2008-08-19 09:18:37 +00:00
|
|
|
m_aSections[_nPos]->setCollapsed(_bShow);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
void OViewsWindow::toggleGrid(BOOL _bVisible)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OReportSection::SetGridVisible,_1,_bVisible),TReportPairHelper()));
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OReportSection::Window::Invalidate,_1,INVALIDATE_NOERASE),TReportPairHelper()));
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
sal_Int32 OViewsWindow::getTotalHeight() const
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nHeight = 0;
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
2008-08-19 09:18:37 +00:00
|
|
|
for (;aIter != aEnd ; ++aIter)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
nHeight += (*aIter)->GetSizePixel().Height();
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
return nHeight;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
USHORT OViewsWindow::getSectionCount() const
|
|
|
|
{
|
|
|
|
return static_cast<USHORT>(m_aSections.size());
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType )
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().getSectionView().SetCurrentObj( eObj, ReportInventor );
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
m_sShapeType = _sShapeType;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
2007-08-02 13:41:16 +00:00
|
|
|
rtl::OUString OViewsWindow::GetInsertObjString() const
|
|
|
|
{
|
|
|
|
return m_sShapeType;
|
|
|
|
}
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::SetMode( DlgEdMode eNewMode )
|
|
|
|
{
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OReportSection::SetMode,_1,eNewMode),TReportPairHelper()));
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
BOOL OViewsWindow::HasSelection()
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
2008-08-19 09:18:37 +00:00
|
|
|
for (;aIter != aEnd && !(*aIter)->getReportSection().getSectionView().AreObjectsMarked(); ++aIter)
|
2007-07-09 10:56:41 +00:00
|
|
|
;
|
|
|
|
return aIter != aEnd;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Delete()
|
|
|
|
{
|
|
|
|
m_bInUnmark = sal_True;
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::mem_fn(&OReportSection::Delete),TReportPairHelper()));
|
|
|
|
m_bInUnmark = sal_False;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Copy()
|
|
|
|
{
|
|
|
|
uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
|
2008-08-19 09:18:37 +00:00
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OReportSection::Copy,_1,::boost::ref(aAllreadyCopiedObjects)),TReportPairHelper()));
|
|
|
|
|
|
|
|
//TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
//TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
//for (; aIter != aEnd; ++aIter)
|
|
|
|
// (*aIter)->getReportSection().Copy(aAllreadyCopiedObjects);
|
2007-07-09 10:56:41 +00:00
|
|
|
OReportExchange* pCopy = new OReportExchange(aAllreadyCopiedObjects);
|
|
|
|
uno::Reference< datatransfer::XTransferable> aEnsureDelete = pCopy;
|
|
|
|
pCopy->CopyToClipboard(this);
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Paste()
|
|
|
|
{
|
|
|
|
TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(this));
|
|
|
|
OReportExchange::TSectionElements aCopies = OReportExchange::extractCopies(aTransferData);
|
|
|
|
if ( aCopies.getLength() > 1 )
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper()));
|
|
|
|
else
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
|
2007-07-09 10:56:41 +00:00
|
|
|
if ( pMarkedSection )
|
2008-08-19 09:18:37 +00:00
|
|
|
pMarkedSection->getReportSection().Paste(aCopies,true);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pRet;
|
2007-07-09 10:56:41 +00:00
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
sal_uInt32 nCurrentPosition = 0;
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( (*aIter)->getStartMarker().isMarked() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
if (nsa == CURRENT)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*aIter);
|
2007-07-09 10:56:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ( nsa == PREVIOUS )
|
|
|
|
{
|
|
|
|
if (nCurrentPosition > 0)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*(--aIter));
|
2007-07-09 10:56:41 +00:00
|
|
|
if (pRet == NULL)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*m_aSections.begin());
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if we are out of bounds return the first one
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*m_aSections.begin());
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ( nsa == POST )
|
|
|
|
{
|
|
|
|
sal_uInt32 nSize = m_aSections.size();
|
|
|
|
if ((nCurrentPosition + 1) < nSize)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = *(++aIter);
|
2007-07-09 10:56:41 +00:00
|
|
|
if (pRet == NULL)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*(--aEnd));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if we are out of bounds return the last one
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*(--aEnd));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
} // ( (*aIter).second->isMarked() )
|
|
|
|
++nCurrentPosition;
|
2007-07-09 10:56:41 +00:00
|
|
|
} // for (; aIter != aEnd ; ++aIter)
|
|
|
|
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::markSection(const sal_uInt16 _nPos)
|
|
|
|
{
|
|
|
|
if ( _nPos < m_aSections.size() )
|
2008-08-19 09:18:37 +00:00
|
|
|
m_pParent->setMarked(m_aSections[_nPos]->getReportSection().getSection(),sal_True);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
BOOL OViewsWindow::IsPasteAllowed()
|
|
|
|
{
|
|
|
|
TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(this));
|
|
|
|
return aTransferData.HasFormat(OReportExchange::getDescriptorFormatId());
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
void OViewsWindow::SelectAll(const sal_uInt16 _nObjectType)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
m_bInUnmark = sal_True;
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
2008-08-19 09:18:37 +00:00
|
|
|
::std::compose1(::boost::bind(::boost::mem_fn(&OReportSection::SelectAll),_1,_nObjectType),TReportPairHelper()));
|
2007-07-09 10:56:41 +00:00
|
|
|
m_bInUnmark = sal_False;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::SectionHasFocus(OReportSection* /*_pSection*/,BOOL /*_bHasFocus*/)
|
|
|
|
{
|
|
|
|
/* LLA!: this function does nothing!
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (USHORT i = 0 ; aIter != aEnd ; ++aIter,++i)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( (*aIter).first.get() == _pSection )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView)
|
|
|
|
{
|
|
|
|
if ( !m_bInUnmark )
|
|
|
|
{
|
|
|
|
m_bInUnmark = sal_True;
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( &(*aIter)->getReportSection().getSectionView() != _pSectionView )
|
2008-06-16 12:47:21 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().deactivateOle();
|
|
|
|
(*aIter)->getReportSection().getSectionView().UnmarkAllObj();
|
2008-06-16 12:47:21 +00:00
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
} // for (; aIter != aEnd ; ++aIter)
|
|
|
|
m_bInUnmark = sal_False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> OViewsWindow::getReportSection(const uno::Reference< report::XSection >& _xSection)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(_xSection.is(),"Section is NULL!");
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pRet;
|
2007-07-09 10:56:41 +00:00
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( (*aIter)->getReportSection().getSection() == _xSection )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
pRet = (*aIter);
|
2007-07-09 10:56:41 +00:00
|
|
|
break;
|
2008-08-19 09:18:37 +00:00
|
|
|
} // if ( (*aIter)->getSection() == _xSection )
|
2007-07-09 10:56:41 +00:00
|
|
|
} // for (; aIter != aEnd ; ++aIter)
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void OViewsWindow::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
|
|
|
|
{
|
|
|
|
if (rHint.ISA(SfxSimpleHint)
|
|
|
|
&& (static_cast< SfxSimpleHint const & >(rHint).GetId()
|
|
|
|
== SFX_HINT_COLORS_CHANGED))
|
|
|
|
{
|
|
|
|
ImplInitSettings();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2007-07-09 10:56:41 +00:00
|
|
|
void OViewsWindow::MouseButtonDown( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( rMEvt.IsLeft() )
|
|
|
|
{
|
|
|
|
GrabFocus();
|
|
|
|
const uno::Sequence< beans::PropertyValue> aArgs;
|
2008-06-25 12:20:55 +00:00
|
|
|
getView()->getReportView()->getController().executeChecked(SID_SELECT_REPORT,aArgs);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
Window::MouseButtonDown(rMEvt);
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::showRuler(sal_Bool _bShow)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OStartMarker::showRuler,_1,_bShow),TStartMarkerHelper()));
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::bind(&OStartMarker::Window::Invalidate,_1,USHORT(INVALIDATE_NOERASE)),TStartMarkerHelper()));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::MouseButtonUp( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( rMEvt.IsLeft() )
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( (*aIter)->getReportSection().getSectionView().AreObjectsMarked() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().MouseButtonUp(rMEvt);
|
2007-07-09 10:56:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-01-29 12:52:21 +00:00
|
|
|
|
|
|
|
// remove special insert mode
|
|
|
|
for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().getPage()->resetSpecialMode();
|
2008-01-29 12:52:21 +00:00
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
sal_Bool OViewsWindow::handleKeyEvent(const KeyEvent& _rEvent)
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
//if ( (*aIter).getReportSection().getSectionView().->AreObjectsMarked() )
|
|
|
|
if ( (*aIter)->getStartMarker().isMarked() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
bRet = (*aIter)->getReportSection().handleKeyEvent(_rEvent);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
OViewsWindow::TSectionsMap::iterator OViewsWindow::getIteratorAtPos(USHORT _nPos)
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aRet = m_aSections.end();
|
|
|
|
if ( _nPos < m_aSections.size() )
|
|
|
|
aRet = m_aSections.begin() + _nPos;
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
|
|
|
|
{
|
|
|
|
OSL_ENSURE(_pSectionView != NULL,"SectionView is NULL!");
|
|
|
|
if ( _pSectionView )
|
2008-08-19 09:18:37 +00:00
|
|
|
setMarked(_pSectionView->getReportSection()->getSection(),_bMark);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( (*aIter)->getReportSection().getSection() != _xSection )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->setMarked(sal_False);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
else if ( (*aIter)->getStartMarker().isMarked() != _bMark )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->setMarked(_bMark);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,sal_Bool _bMark)
|
|
|
|
{
|
|
|
|
bool bFirst = true;
|
|
|
|
const uno::Reference< report::XReportComponent>* pIter = _aShapes.getConstArray();
|
2008-08-19 09:18:37 +00:00
|
|
|
const uno::Reference< report::XReportComponent>* pEnd = pIter + _aShapes.getLength();
|
2007-07-09 10:56:41 +00:00
|
|
|
for(;pIter != pEnd;++pIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const uno::Reference< report::XSection> xSection = (*pIter)->getSection();
|
2007-07-09 10:56:41 +00:00
|
|
|
if ( xSection.is() )
|
|
|
|
{
|
|
|
|
if ( bFirst )
|
|
|
|
{
|
|
|
|
bFirst = false;
|
|
|
|
m_pParent->setMarked(xSection,_bMark);
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pSectionWindow = getReportSection(xSection);
|
|
|
|
if ( pSectionWindow )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( *pIter );
|
|
|
|
SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
|
|
|
|
OSL_ENSURE( pObject, "OViewsWindow::setMarked: no SdrObject for the shape!" );
|
|
|
|
if ( pObject )
|
2008-08-19 09:18:37 +00:00
|
|
|
pSectionWindow->getReportSection().getSectionView().MarkObj( pObject, pSectionWindow->getReportSection().getSectionView().GetSdrPageView(), !_bMark );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::collectRectangles(TRectangleMap& _rSortRectangles, bool _bBoundRects)
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OSectionView& rView = (*aIter)->getReportSection().getSectionView();
|
|
|
|
if ( rView.AreObjectsMarked() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SortMarkedObjects();
|
|
|
|
const sal_uInt32 nCount = rView.GetMarkedObjectCount();
|
2007-07-09 10:56:41 +00:00
|
|
|
for (sal_uInt32 i=0; i < nCount; ++i)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrMark* pM = rView.GetSdrMarkByIndex(i);
|
2007-07-09 10:56:41 +00:00
|
|
|
SdrObject* pObj = pM->GetMarkedSdrObj();
|
|
|
|
Rectangle aObjRect(_bBoundRects ? pObj->GetCurrentBoundRect() : pObj->GetSnapRect());
|
2008-08-19 09:18:37 +00:00
|
|
|
_rSortRectangles.insert(TRectangleMap::value_type(aObjRect,TRectangleMap::mapped_type(pObj,&rView)));
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles,sal_Int32 _nControlModification,bool _bAlignAtSection, bool _bBoundRects,Rectangle& _rBound,Rectangle& _rResize)
|
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
bool bOnlyOnce = false;
|
2007-07-09 10:56:41 +00:00
|
|
|
TRectangleMap::const_iterator aRectIter = _rSortRectangles.begin();
|
|
|
|
TRectangleMap::const_iterator aRectEnd = _rSortRectangles.end();
|
|
|
|
for (;aRectIter != aRectEnd ; ++aRectIter)
|
|
|
|
{
|
|
|
|
Rectangle aObjRect = aRectIter->first;
|
|
|
|
if ( _rResize.IsEmpty() )
|
|
|
|
_rResize = aObjRect;
|
|
|
|
switch(_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::WIDTH_SMALLEST:
|
|
|
|
if ( _rResize.getWidth() > aObjRect.getWidth() )
|
|
|
|
_rResize = aObjRect;
|
|
|
|
break;
|
|
|
|
case ControlModification::HEIGHT_SMALLEST:
|
|
|
|
if ( _rResize.getHeight() > aObjRect.getHeight() )
|
|
|
|
_rResize = aObjRect;
|
|
|
|
break;
|
|
|
|
case ControlModification::WIDTH_GREATEST:
|
|
|
|
if ( _rResize.getWidth() < aObjRect.getWidth() )
|
|
|
|
_rResize = aObjRect;
|
|
|
|
break;
|
|
|
|
case ControlModification::HEIGHT_GREATEST:
|
|
|
|
if ( _rResize.getHeight() < aObjRect.getHeight() )
|
|
|
|
_rResize = aObjRect;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObjTransformInfoRec aInfo;
|
|
|
|
const SdrObject* pObj = aRectIter->second.first;
|
|
|
|
pObj->TakeObjInfo(aInfo);
|
|
|
|
BOOL bHasFixed = !aInfo.bMoveAllowed || pObj->IsMoveProtect();
|
|
|
|
if ( bHasFixed )
|
|
|
|
_rBound.Union(aObjRect);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( _bAlignAtSection || _rSortRectangles.size() == 1 )
|
|
|
|
{ // einzelnes Obj an der Seite ausrichten
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( ! bOnlyOnce )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
bOnlyOnce = true;
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection* pReportSection = aRectIter->second.second->getReportSection();
|
|
|
|
const uno::Reference< report::XSection> xSection = pReportSection->getSection();
|
2007-08-03 11:46:04 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
|
|
|
|
_rBound.Union(Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
|
|
|
|
getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
|
|
|
|
xSection->getHeight()));
|
|
|
|
}
|
|
|
|
catch(uno::Exception){}
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_bBoundRects)
|
|
|
|
_rBound.Union(aRectIter->second.second->GetMarkedObjBoundRect());
|
|
|
|
else
|
|
|
|
_rBound.Union(aRectIter->second.second->GetMarkedObjRect());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool _bBoundRects)
|
|
|
|
{
|
|
|
|
if ( _nControlModification == ControlModification::NONE )
|
|
|
|
return;
|
|
|
|
|
|
|
|
Point aRefPoint;
|
|
|
|
RectangleLess::CompareMode eCompareMode = RectangleLess::POS_LEFT;
|
|
|
|
switch (_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::TOP : eCompareMode = RectangleLess::POS_UPPER; break;
|
|
|
|
case ControlModification::BOTTOM: eCompareMode = RectangleLess::POS_DOWN; break;
|
|
|
|
case ControlModification::LEFT : eCompareMode = RectangleLess::POS_LEFT; break;
|
|
|
|
case ControlModification::RIGHT : eCompareMode = RectangleLess::POS_RIGHT; break;
|
|
|
|
case ControlModification::CENTER_HORIZONTAL :
|
|
|
|
case ControlModification::CENTER_VERTICAL :
|
|
|
|
{
|
|
|
|
eCompareMode = (ControlModification::CENTER_VERTICAL == _nControlModification) ? RectangleLess::POS_CENTER_VERTICAL : RectangleLess::POS_CENTER_HORIZONTAL;
|
2008-08-19 09:18:37 +00:00
|
|
|
uno::Reference<report::XSection> xSection = (*m_aSections.begin())->getReportSection().getSection();
|
2007-07-09 10:56:41 +00:00
|
|
|
uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
|
|
|
|
aRefPoint = Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
|
|
|
|
getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
|
|
|
|
xSection->getHeight()).Center();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
RectangleLess aCompare(eCompareMode,aRefPoint);
|
|
|
|
TRectangleMap aSortRectangles(aCompare);
|
|
|
|
collectRectangles(aSortRectangles,_bBoundRects);
|
|
|
|
|
|
|
|
Rectangle aBound;
|
|
|
|
Rectangle aResize;
|
|
|
|
collectBoundResizeRect(aSortRectangles,_nControlModification,_bAlignAtSection,_bBoundRects,aBound,aResize);
|
|
|
|
|
|
|
|
bool bMove = true;
|
|
|
|
|
|
|
|
::std::mem_fun_t<long&,Rectangle> aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Bottom);
|
|
|
|
::std::mem_fun_t<long&,Rectangle> aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Top);
|
|
|
|
TRectangleMap::iterator aRectIter = aSortRectangles.begin();
|
|
|
|
TRectangleMap::iterator aRectEnd = aSortRectangles.end();
|
|
|
|
for (;aRectIter != aRectEnd ; ++aRectIter)
|
|
|
|
{
|
|
|
|
Rectangle aObjRect = aRectIter->first;
|
|
|
|
SdrObject* pObj = aRectIter->second.first;
|
|
|
|
SdrView* pView = aRectIter->second.second;
|
|
|
|
Point aCenter(aBound.Center());
|
|
|
|
SdrObjTransformInfoRec aInfo;
|
|
|
|
pObj->TakeObjInfo(aInfo);
|
|
|
|
if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
|
|
|
|
{
|
|
|
|
long nXMov = 0;
|
|
|
|
long nYMov = 0;
|
|
|
|
long* pValue = &nXMov;
|
|
|
|
switch(_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::TOP :
|
|
|
|
aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Top);
|
|
|
|
aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Bottom);
|
|
|
|
pValue = &nYMov;
|
|
|
|
break;
|
|
|
|
case ControlModification::BOTTOM:
|
|
|
|
// defaults are already set
|
|
|
|
pValue = &nYMov;
|
|
|
|
break;
|
|
|
|
case ControlModification::CENTER_VERTICAL:
|
|
|
|
nYMov = aCenter.Y() - aObjRect.Center().Y();
|
|
|
|
pValue = &nYMov;
|
|
|
|
bMove = false;
|
|
|
|
break;
|
|
|
|
case ControlModification::RIGHT :
|
|
|
|
aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Right);
|
|
|
|
aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Left);
|
|
|
|
break;
|
|
|
|
case ControlModification::CENTER_HORIZONTAL:
|
|
|
|
nXMov = aCenter.X() - aObjRect.Center().X();
|
|
|
|
bMove = false;
|
|
|
|
break;
|
|
|
|
case ControlModification::LEFT :
|
|
|
|
aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Left);
|
|
|
|
aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Right);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bMove = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( bMove )
|
|
|
|
{
|
|
|
|
Rectangle aTest = aObjRect;
|
|
|
|
aGetFun(&aTest) = aGetFun(&aBound);
|
|
|
|
TRectangleMap::iterator aInterSectRectIter = aSortRectangles.begin();
|
|
|
|
for (; aInterSectRectIter != aRectIter; ++aInterSectRectIter)
|
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( pView == aInterSectRectIter->second.second && dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
SdrObject* pPreviousObj = aInterSectRectIter->second.first;
|
|
|
|
Rectangle aIntersectRect = aTest.GetIntersection(_bBoundRects ? pPreviousObj->GetCurrentBoundRect() : pPreviousObj->GetSnapRect());
|
|
|
|
if ( !aIntersectRect.IsEmpty() && (aIntersectRect.Left() != aIntersectRect.Right() && aIntersectRect.Top() != aIntersectRect.Bottom() ) )
|
|
|
|
{
|
|
|
|
*pValue = aRefFun(&aIntersectRect) - aGetFun(&aObjRect);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( aInterSectRectIter == aRectIter )
|
|
|
|
*pValue = aGetFun(&aBound) - aGetFun(&aObjRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification,_bBoundRects) )
|
|
|
|
{
|
|
|
|
const Size aSize(nXMov,nYMov);
|
|
|
|
pView->AddUndo(pView->GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,aSize));
|
|
|
|
pObj->Move(aSize);
|
|
|
|
aObjRect = (_bBoundRects ? pObj->GetCurrentBoundRect() : pObj->GetSnapRect());
|
|
|
|
}
|
|
|
|
|
|
|
|
// resizing control
|
|
|
|
if ( !aResize.IsEmpty() && aObjRect != aResize )
|
|
|
|
{
|
|
|
|
nXMov = aResize.getWidth();
|
|
|
|
nYMov = aResize.getHeight();
|
|
|
|
switch(_nControlModification)
|
|
|
|
{
|
|
|
|
case ControlModification::WIDTH_GREATEST:
|
|
|
|
case ControlModification::HEIGHT_GREATEST:
|
|
|
|
if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
|
|
|
|
nXMov = aObjRect.getWidth();
|
|
|
|
else if ( _nControlModification == ControlModification::WIDTH_GREATEST )
|
|
|
|
nYMov = aObjRect.getHeight();
|
|
|
|
lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification,_bBoundRects);
|
|
|
|
// run through
|
|
|
|
case ControlModification::WIDTH_SMALLEST:
|
|
|
|
case ControlModification::HEIGHT_SMALLEST:
|
|
|
|
pView->AddUndo( pView->GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
|
2007-08-02 13:41:16 +00:00
|
|
|
{
|
|
|
|
OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj);
|
|
|
|
OSL_ENSURE(pObjBase,"Where comes this object from?");
|
|
|
|
if ( pObjBase )
|
|
|
|
{
|
|
|
|
if ( _nControlModification == ControlModification::WIDTH_SMALLEST || _nControlModification == ControlModification::WIDTH_GREATEST )
|
2007-11-20 18:13:07 +00:00
|
|
|
pObjBase->getReportComponent()->setSize(awt::Size(nXMov,aObjRect.getHeight()));
|
2007-08-02 13:41:16 +00:00
|
|
|
//pObj->Resize(aObjRect.TopLeft(),Fraction(nXMov,aObjRect.getWidth()),Fraction(1,1));
|
|
|
|
else if ( _nControlModification == ControlModification::HEIGHT_GREATEST || _nControlModification == ControlModification::HEIGHT_SMALLEST )
|
2007-11-20 18:13:07 +00:00
|
|
|
pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getWidth(),nYMov));
|
2007-08-02 13:41:16 +00:00
|
|
|
//pObj->Resize(aObjRect.TopLeft(),Fraction(1,1),Fraction(nYMov,aObjRect.getHeight()));
|
|
|
|
}
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pView->AdjustMarkHdl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::createDefault()
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
|
|
|
|
if ( pMarkedSection )
|
|
|
|
pMarkedSection->getReportSection().createDefault(m_sShapeType);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::setGridSnap(BOOL bOn)
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().getSectionView().SetGridSnap(bOn);
|
|
|
|
(*aIter)->getReportSection().Invalidate();
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::setDragStripes(BOOL bOn)
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().getSectionView().SetDragStripes(bOn);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
BOOL OViewsWindow::isDragStripes() const
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
return !m_aSections.empty() && (*m_aSections.begin())->getReportSection().getSectionView().IsDragStripes();
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
USHORT OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) const
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
USHORT nPosition = 0;
|
|
|
|
for (; aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( _pSectionWindow == (*aIter).get() )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nPosition;
|
|
|
|
}
|
|
|
|
return nPosition;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const USHORT _nPos) const
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
::boost::shared_ptr<OSectionWindow> aReturn;
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
if ( _nPos < m_aSections.size() )
|
2008-08-19 09:18:37 +00:00
|
|
|
aReturn = m_aSections[_nPos];
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
enum SectionViewAction
|
|
|
|
{
|
|
|
|
eEndDragObj,
|
|
|
|
eEndAction,
|
2007-08-03 11:46:04 +00:00
|
|
|
eMoveAction,
|
|
|
|
eMarkAction,
|
|
|
|
eForceToAnotherPage,
|
|
|
|
eBreakAction
|
2007-07-09 10:56:41 +00:00
|
|
|
};
|
2008-01-29 12:52:21 +00:00
|
|
|
class ApplySectionViewAction : public ::std::unary_function< OViewsWindow::TSectionsMap::value_type, void >
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
SectionViewAction m_eAction;
|
|
|
|
sal_Bool m_bCopy;
|
|
|
|
Point m_aPoint;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplySectionViewAction( sal_Bool _bCopy ) : m_eAction( eEndDragObj ), m_bCopy( _bCopy ) { }
|
2007-08-03 11:46:04 +00:00
|
|
|
ApplySectionViewAction(SectionViewAction _eAction = eEndAction ) : m_eAction( _eAction ) { }
|
|
|
|
ApplySectionViewAction( const Point& _rPoint, SectionViewAction _eAction = eMoveAction ) : m_eAction( _eAction ), m_bCopy( sal_False ), m_aPoint( _rPoint ) { }
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
void operator() ( const OViewsWindow::TSectionsMap::value_type& _rhs )
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OSectionView& rView( _rhs->getReportSection().getSectionView() );
|
2007-07-09 10:56:41 +00:00
|
|
|
switch ( m_eAction )
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
case eEndDragObj:
|
|
|
|
rView.EndDragObj( m_bCopy );
|
|
|
|
break;
|
|
|
|
case eEndAction:
|
|
|
|
if ( rView.IsAction() )
|
|
|
|
rView.EndAction ( );
|
|
|
|
break;
|
|
|
|
case eMoveAction:
|
|
|
|
rView.MovAction ( m_aPoint );
|
|
|
|
break;
|
|
|
|
case eMarkAction:
|
|
|
|
rView.BegMarkObj ( m_aPoint );
|
|
|
|
break;
|
|
|
|
case eForceToAnotherPage:
|
|
|
|
rView.ForceMarkedToAnotherPage();
|
|
|
|
break;
|
|
|
|
case eBreakAction:
|
|
|
|
if ( rView.IsAction() )
|
|
|
|
rView.BrkAction ( );
|
|
|
|
break;
|
|
|
|
// default:
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::BrkAction()
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
EndDragObj_removeInvisibleObjects();
|
2007-08-03 11:46:04 +00:00
|
|
|
::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eBreakAction) );
|
|
|
|
}
|
2008-01-29 12:52:21 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _aRect, const OSectionView& _rSection)
|
2008-01-29 12:52:21 +00:00
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
Point aNewPos(0,0);
|
|
|
|
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
rReportSection.getPage()->setSpecialMode();
|
|
|
|
OSectionView& rView = rReportSection.getSectionView();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( &rView != &_rSection )
|
2008-01-29 12:52:21 +00:00
|
|
|
{
|
|
|
|
// SdrRectObj *pNewObj = new SdrRectObj(OBJ_RECT, _aRect);
|
|
|
|
// SdrObject *pNewObj = new SdrUnoObj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Temp Label")));
|
|
|
|
SdrObject *pNewObj = new SdrUnoObj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")));
|
|
|
|
if (pNewObj)
|
|
|
|
{
|
|
|
|
pNewObj->SetLogicRect(_aRect);
|
|
|
|
// pNewObj->SetSize(_aRect.GetSize());
|
|
|
|
// pNewObj->Move(Size(_aRect.Left(), _aRect.Top()));
|
|
|
|
|
|
|
|
pNewObj->Move(Size(0, aNewPos.Y()));
|
2008-08-19 09:18:37 +00:00
|
|
|
rReportSection.getPage()->InsertObject(pNewObj);
|
2008-01-29 12:52:21 +00:00
|
|
|
m_aBegDragTempList.push_back(pNewObj);
|
|
|
|
Rectangle aRect = pNewObj->GetLogicRect();
|
|
|
|
|
|
|
|
// pNewObj->SetText(String::CreateFromAscii("Drag helper"));
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.MarkObj( pNewObj, rView.GetSdrPageView() );
|
2008-01-29 12:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aNewPos.Y() -= nSectionHeight;
|
|
|
|
// aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
bool OViewsWindow::isObjectInMyTempList(SdrObject *_pObj)
|
|
|
|
{
|
|
|
|
::std::vector<SdrObject*>::iterator aIter = m_aBegDragTempList.begin();
|
|
|
|
::std::vector<SdrObject*>::iterator aEnd = m_aBegDragTempList.end();
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
|
|
|
if (*aIter == _pObj)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection)
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
OSL_TRACE("BegDragObj Clickpoint X:%d Y:%d\n", _aPnt.X(), _aPnt.Y() );
|
|
|
|
|
|
|
|
m_aBegDragTempList.clear();
|
|
|
|
|
|
|
|
// Calculate the absolute clickpoint in the views
|
|
|
|
Point aAbsolutePnt = _aPnt;
|
2007-08-03 11:46:04 +00:00
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
2008-01-29 12:52:21 +00:00
|
|
|
for (; aIter != aEnd; ++aIter)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
OSectionView* pView = &rReportSection.getSectionView();
|
2008-01-29 12:52:21 +00:00
|
|
|
if (pView == _pSection)
|
2007-08-03 11:46:04 +00:00
|
|
|
break;
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aAbsolutePnt.Y() += nSectionHeight;
|
|
|
|
}
|
|
|
|
m_aDragDelta = Point(SAL_MAX_INT32, SAL_MAX_INT32);
|
|
|
|
OSL_TRACE("BegDragObj Absolute X:%d Y:%d\n", aAbsolutePnt.X(), aAbsolutePnt.Y() );
|
2007-08-03 11:46:04 +00:00
|
|
|
|
2008-01-29 12:52:21 +00:00
|
|
|
// Create drag lines over all viewable Views
|
|
|
|
// Therefore we need to identify the marked objects
|
|
|
|
// and create temporary objects on all other views at the same position
|
|
|
|
// relative to its occurance.
|
|
|
|
|
|
|
|
OSL_TRACE("BegDragObj createInvisible Objects\n" );
|
|
|
|
int nViewCount = 0;
|
|
|
|
Point aNewObjPos(0,0);
|
2007-08-03 11:46:04 +00:00
|
|
|
for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
OSectionView& rView = rReportSection.getSectionView();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( rView.AreObjectsMarked() )
|
2008-01-29 12:52:21 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const sal_uInt32 nCount = rView.GetMarkedObjectCount();
|
2008-01-29 12:52:21 +00:00
|
|
|
for (sal_uInt32 i=0; i < nCount; ++i)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrMark* pM = rView.GetSdrMarkByIndex(i);
|
2008-01-29 12:52:21 +00:00
|
|
|
SdrObject* pObj = pM->GetMarkedSdrObj();
|
|
|
|
if (!isObjectInMyTempList(pObj))
|
|
|
|
{
|
|
|
|
Rectangle aRect( pObj->GetCurrentBoundRect() );
|
|
|
|
aRect.Move(0, aNewObjPos.Y());
|
|
|
|
OSL_TRACE("BegDragObj createInvisible X:%d Y:%d on View #%d\n", aRect.Left(), aRect.Top(), nViewCount );
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
BegDragObj_createInvisibleObjectAtPosition(aRect, rView);
|
2008-01-29 12:52:21 +00:00
|
|
|
|
|
|
|
// calculate the clickpoint
|
2008-06-16 12:47:21 +00:00
|
|
|
const sal_Int32 nDeltaX = abs(aRect.Left() - aAbsolutePnt.X());
|
|
|
|
const sal_Int32 nDeltaY = abs(aRect.Top() - aAbsolutePnt.Y());
|
2008-01-29 12:52:21 +00:00
|
|
|
if (m_aDragDelta.X() > nDeltaX)
|
|
|
|
m_aDragDelta.X() = nDeltaX;
|
|
|
|
if (m_aDragDelta.Y() > nDeltaY)
|
|
|
|
m_aDragDelta.Y() = nDeltaY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++nViewCount;
|
2008-08-19 09:18:37 +00:00
|
|
|
Rectangle aClipRect = rView.GetWorkArea();
|
2008-01-29 12:52:21 +00:00
|
|
|
aClipRect.Top() = -aNewObjPos.Y();
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SetWorkArea( aClipRect );
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aNewObjPos.Y() += nSectionHeight;
|
|
|
|
|
|
|
|
// don't subtract the height of the lines between the views
|
|
|
|
// aNewObjPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
Point aNewPos = aAbsolutePnt;
|
|
|
|
// for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
|
|
|
// {
|
2008-08-19 09:18:37 +00:00
|
|
|
// OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
// if ( &rReportSection.getSectionView() == _pSection )
|
2008-01-29 12:52:21 +00:00
|
|
|
// break;
|
2008-08-19 09:18:37 +00:00
|
|
|
// aNewPos.Y() += rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
const short nDrgLog = static_cast<short>(PixelToLogic(Size(3,0)).Width());
|
|
|
|
// long nLastSectionHeight = 0;
|
|
|
|
// bool bAdd = true;
|
|
|
|
nViewCount = 0;
|
|
|
|
for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
// if ( &rReportSection.getSectionView() == _pSection )
|
2008-01-29 12:52:21 +00:00
|
|
|
// {
|
|
|
|
// bAdd = false;
|
|
|
|
// aNewPos = _aPnt;
|
|
|
|
// }
|
|
|
|
// else if ( bAdd )
|
|
|
|
// {
|
2008-08-19 09:18:37 +00:00
|
|
|
// const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
// aNewPos.Y() += nSectionHeight;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// aNewPos.Y() -= nLastSectionHeight;
|
|
|
|
// }
|
|
|
|
|
|
|
|
//?
|
2007-08-03 11:46:04 +00:00
|
|
|
SdrHdl* pHdl = _pHdl;
|
|
|
|
if ( pHdl )
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( &rReportSection.getSectionView() != _pSection )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrHdlList& rHdlList = rReportSection.getSectionView().GetHdlList();
|
2007-08-03 11:46:04 +00:00
|
|
|
pHdl = rHdlList.GetHdl(_pHdl->GetKind());
|
|
|
|
}
|
|
|
|
}
|
2008-01-29 12:52:21 +00:00
|
|
|
OSL_TRACE("BegDragObj X:%d Y:%d on View#%d\n", aNewPos.X(), aNewPos.Y(), nViewCount++ );
|
2008-08-19 09:18:37 +00:00
|
|
|
rReportSection.getSectionView().BegDragObj(aNewPos, (OutputDevice*)NULL, pHdl, nDrgLog, NULL);
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aNewPos.Y() -= nSectionHeight;
|
|
|
|
// subtract the height between the views, because they are visible but not from interest here.
|
2008-08-19 09:18:37 +00:00
|
|
|
// aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2007-08-03 11:46:04 +00:00
|
|
|
void OViewsWindow::ForceMarkedToAnotherPage()
|
|
|
|
{
|
|
|
|
::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eForceToAnotherPage ) );
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
|
|
|
|
{
|
|
|
|
bool bAdd = true;
|
|
|
|
Point aNewPos = _aPnt;
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
2008-01-29 12:52:21 +00:00
|
|
|
long nLastSectionHeight = 0;
|
2007-08-03 11:46:04 +00:00
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
if ( &rReportSection.getSectionView() == _pSection )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
|
|
|
bAdd = false;
|
2008-01-29 12:52:21 +00:00
|
|
|
aNewPos = _aPnt; // 2,2
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
else if ( bAdd )
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
aNewPos.Y() += nSectionHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
aNewPos.Y() -= nLastSectionHeight;
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
rReportSection.getSectionView().BegMarkObj ( aNewPos );
|
|
|
|
nLastSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
// aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
//::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction( _aPnt , eMarkAction) );
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pSection,Point& _rPnt)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
OSectionView* pSection = NULL;
|
|
|
|
sal_Int32 nCount = 0;
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
const TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd ; ++aIter,++nCount)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
if ( &rReportSection.getSectionView() == _pSection)
|
2007-08-03 11:46:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
OSL_ENSURE(aIter != aEnd,"This can never happen!");
|
|
|
|
if ( _rPnt.Y() < 0 )
|
|
|
|
{
|
2008-06-16 12:47:21 +00:00
|
|
|
if ( nCount )
|
|
|
|
--aIter;
|
2007-08-03 11:46:04 +00:00
|
|
|
for (; nCount && (_rPnt.Y() < 0); --nCount)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
_rPnt.Y() += rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( (nCount -1) > 0 && (_rPnt.Y() < 0) )
|
|
|
|
--aIter;
|
|
|
|
}
|
|
|
|
if ( nCount == 0 )
|
2008-08-19 09:18:37 +00:00
|
|
|
pSection = &(*m_aSections.begin())->getReportSection().getSectionView();
|
2007-08-03 11:46:04 +00:00
|
|
|
else
|
2008-08-19 09:18:37 +00:00
|
|
|
pSection = &(*aIter)->getReportSection().getSectionView();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
const long nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( (_rPnt.Y() - nHeight) < 0 )
|
|
|
|
break;
|
|
|
|
_rPnt.Y() -= nHeight;
|
|
|
|
}
|
|
|
|
if ( aIter != aEnd )
|
2008-08-19 09:18:37 +00:00
|
|
|
pSection = &(*aIter)->getReportSection().getSectionView();
|
2007-08-03 11:46:04 +00:00
|
|
|
else
|
2008-08-19 09:18:37 +00:00
|
|
|
pSection = &(*(aEnd-1))->getReportSection().getSectionView();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return pSection;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-01-29 12:52:21 +00:00
|
|
|
void OViewsWindow::EndDragObj_removeInvisibleObjects()
|
|
|
|
{
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
rReportSection.getPage()->resetSpecialMode();
|
2008-01-29 12:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSection,const Point& _aPnt)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
|
|
|
const String sUndoAction = String((ModuleRes(RID_STR_UNDO_CHANGEPOSITION)));
|
2008-06-25 12:20:55 +00:00
|
|
|
UndoManagerListAction aListAction(*getView()->getReportView()->getController().getUndoMgr(),sUndoAction);
|
2008-01-29 12:52:21 +00:00
|
|
|
|
|
|
|
Point aNewPos = _aPnt;
|
|
|
|
OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos);
|
|
|
|
if (!_bControlKeyPressed && _pSection != pInSection)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
EndDragObj_removeInvisibleObjects();
|
|
|
|
|
|
|
|
// we need to manipulate the current clickpoint, we substract the old delta from BeginDrag
|
|
|
|
// OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aPnt);
|
|
|
|
// aNewPos.X() -= m_aDragDelta.X();
|
|
|
|
// aNewPos.Y() -= m_aDragDelta.Y();
|
|
|
|
aNewPos -= m_aDragDelta;
|
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
const TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
if ( pInSection != &rReportSection.getSectionView() )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
rReportSection.getSectionView().BrkAction();
|
|
|
|
rReportSection.Copy(aAllreadyCopiedObjects,true);
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pInSection->EndDragObj(FALSE);
|
2008-06-16 12:47:21 +00:00
|
|
|
} // for (; aIter != aEnd; ++aIter)
|
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( aAllreadyCopiedObjects.getLength() )
|
|
|
|
{
|
|
|
|
beans::NamedValue* pIter = aAllreadyCopiedObjects.getArray();
|
|
|
|
const beans::NamedValue* pEnd = pIter + aAllreadyCopiedObjects.getLength();
|
|
|
|
try
|
|
|
|
{
|
2008-06-25 12:20:55 +00:00
|
|
|
uno::Reference<report::XReportDefinition> xReportDefinition = getView()->getReportView()->getController().getReportDefinition();
|
2007-08-03 11:46:04 +00:00
|
|
|
const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
|
|
|
|
const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
|
|
|
|
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
|
|
|
|
|
|
|
|
Point aPrevious;
|
|
|
|
for (; pIter != pEnd; ++pIter)
|
|
|
|
{
|
|
|
|
uno::Sequence< uno::Reference<util::XCloneable> > aClones;
|
|
|
|
pIter->Value >>= aClones;
|
|
|
|
uno::Reference<util::XCloneable>* pColIter = aClones.getArray();
|
|
|
|
const uno::Reference<util::XCloneable>* pColEnd = pColIter + aClones.getLength();
|
|
|
|
for (; pColIter != pColEnd; ++pColIter)
|
|
|
|
{
|
|
|
|
uno::Reference< report::XReportComponent> xRC(*pColIter,uno::UNO_QUERY);
|
|
|
|
aPrevious = VCLPoint(xRC->getPosition());
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
awt::Size aSize = xRC->getSize();
|
|
|
|
if ( aNewPos.X() < nLeftMargin )
|
|
|
|
aNewPos.X() = nLeftMargin;
|
|
|
|
else if ( (aNewPos.X() + aSize.Width) > (nPaperWidth - nRightMargin) )
|
|
|
|
aNewPos.X() = nPaperWidth - nRightMargin - aSize.Width;
|
|
|
|
if ( aNewPos.Y() < 0 )
|
|
|
|
aNewPos.Y() = 0;
|
2008-01-29 12:52:21 +00:00
|
|
|
if ( aNewPos.X() < 0 )
|
|
|
|
{
|
|
|
|
aSize.Width += aNewPos.X();
|
|
|
|
aNewPos.X()= 0;
|
|
|
|
xRC->setSize(aSize);
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
xRC->setPosition(AWTPoint(aNewPos));
|
|
|
|
if ( (pColIter+1) != pColEnd )
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
uno::Reference< report::XReportComponent> xRCNext(*(pColIter + 1),uno::UNO_QUERY);
|
|
|
|
Point aNextPosition = VCLPoint(xRCNext->getPosition());
|
|
|
|
aNewPos += (aNextPosition - aPrevious);
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(uno::Exception&)
|
|
|
|
{
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
pInSection->getReportSection()->Paste(aAllreadyCopiedObjects,true);
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-01-29 12:52:21 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction( FALSE ) );
|
2008-01-29 12:52:21 +00:00
|
|
|
EndDragObj_removeInvisibleObjects();
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::EndAction()
|
|
|
|
{
|
|
|
|
::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction() );
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-01-29 12:52:21 +00:00
|
|
|
void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bool _bMove, bool _bControlKeySet)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
(void)_bMove;
|
|
|
|
|
|
|
|
Point aRealMousePos = _aPnt;
|
|
|
|
Point aCurrentSectionPos;
|
|
|
|
OSL_TRACE("MovAction X:%d Y:%d\n", aRealMousePos.X(), aRealMousePos.Y() );
|
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
Point aHdlPos;
|
|
|
|
SdrHdl* pHdl = _pSection->GetDragHdl();
|
|
|
|
if ( pHdl )
|
|
|
|
{
|
|
|
|
aHdlPos = pHdl->GetPos();
|
|
|
|
}
|
2008-01-29 12:52:21 +00:00
|
|
|
TSectionsMap::iterator aIter/* = m_aSections.begin() */;
|
2007-08-03 11:46:04 +00:00
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
|
|
|
//if ( _bMove )
|
|
|
|
//{
|
|
|
|
for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
if ( &rReportSection.getSectionView() == _pSection )
|
2008-01-29 12:52:21 +00:00
|
|
|
break;
|
2008-08-19 09:18:37 +00:00
|
|
|
const long nSectionHeight = (*aIter)->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aCurrentSectionPos.Y() += nSectionHeight;
|
2008-08-19 09:18:37 +00:00
|
|
|
} // for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
2008-01-29 12:52:21 +00:00
|
|
|
//}
|
|
|
|
aRealMousePos += aCurrentSectionPos;
|
|
|
|
|
|
|
|
// If control key is pressed the work area is limited to the section with the current selection.
|
|
|
|
Point aPosForWorkArea(0,0);
|
|
|
|
for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
OSectionView& rView = rReportSection.getSectionView();
|
|
|
|
const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
|
|
|
|
if (_bControlKeySet)
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
Rectangle aClipRect = rView.GetWorkArea();
|
|
|
|
aClipRect.Top() = aCurrentSectionPos.Y() - aPosForWorkArea.Y();
|
2008-01-29 12:52:21 +00:00
|
|
|
// if (aClipRect.Top() < 0) aClipRect.Top() = 0;
|
|
|
|
aClipRect.Bottom() = aClipRect.Top() + nSectionHeight;
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SetWorkArea( aClipRect );
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
2008-01-29 12:52:21 +00:00
|
|
|
else
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
Rectangle aClipRect = rView.GetWorkArea();
|
2008-01-29 12:52:21 +00:00
|
|
|
aClipRect.Top() = -aPosForWorkArea.Y();
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SetWorkArea( aClipRect );
|
2008-01-29 12:52:21 +00:00
|
|
|
}
|
|
|
|
aPosForWorkArea.Y() += nSectionHeight;
|
|
|
|
// aNewPos.Y() += PixelToLogic(aIter->second.second->GetSizePixel()).Height();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
|
2008-01-29 12:52:21 +00:00
|
|
|
|
2007-08-03 11:46:04 +00:00
|
|
|
for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
|
|
|
SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl();
|
2007-08-03 11:46:04 +00:00
|
|
|
if ( pCurrentHdl )
|
|
|
|
{
|
2008-01-29 12:52:21 +00:00
|
|
|
aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos;
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
rReportSection.getSectionView().MovAction ( aRealMousePos );
|
|
|
|
const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
|
2008-01-29 12:52:21 +00:00
|
|
|
aRealMousePos.Y() -= nSectionHeight;
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
BOOL OViewsWindow::IsAction() const
|
|
|
|
{
|
|
|
|
BOOL bAction = FALSE;
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for (; !bAction && aIter != aEnd; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
bAction = (*aIter)->getReportSection().getSectionView().IsAction();
|
2007-08-03 11:46:04 +00:00
|
|
|
return bAction;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
BOOL OViewsWindow::IsDragObj() const
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2007-08-03 11:46:04 +00:00
|
|
|
BOOL bAction = FALSE;
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for (; !bAction && aIter != aEnd; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
bAction = (*aIter)->getReportSection().getSectionView().IsAction();
|
2007-08-03 11:46:04 +00:00
|
|
|
return bAction;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2007-07-09 10:56:41 +00:00
|
|
|
sal_uInt32 OViewsWindow::getMarkedObjectCount() const
|
|
|
|
{
|
|
|
|
sal_uInt32 nCount = 0;
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
nCount += (*aIter)->getReportSection().getSectionView().GetMarkedObjectCount();
|
2007-07-09 10:56:41 +00:00
|
|
|
return nCount;
|
|
|
|
}
|
2007-08-03 11:46:04 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::handleKey(const KeyCode& _rCode)
|
|
|
|
{
|
|
|
|
const USHORT nCode = _rCode.GetCode();
|
|
|
|
if ( _rCode.IsMod1() )
|
|
|
|
{
|
|
|
|
// scroll page
|
|
|
|
OScrollWindowHelper* pScrollWindow = getView()->getScrollWindow();
|
|
|
|
ScrollBar* pScrollBar = ( nCode == KEY_LEFT || nCode == KEY_RIGHT ) ? pScrollWindow->GetHScroll() : pScrollWindow->GetVScroll();
|
|
|
|
if ( pScrollBar && pScrollBar->IsVisible() )
|
|
|
|
pScrollBar->DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? SCROLL_LINEUP : SCROLL_LINEDOWN );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for (; aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
OReportSection& rReportSection = (*aIter)->getReportSection();
|
2007-08-03 11:46:04 +00:00
|
|
|
long nX = 0;
|
|
|
|
long nY = 0;
|
|
|
|
|
|
|
|
if ( nCode == KEY_UP )
|
|
|
|
nY = -1;
|
|
|
|
else if ( nCode == KEY_DOWN )
|
|
|
|
nY = 1;
|
|
|
|
else if ( nCode == KEY_LEFT )
|
|
|
|
nX = -1;
|
|
|
|
else if ( nCode == KEY_RIGHT )
|
|
|
|
nX = 1;
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( rReportSection.getSectionView().AreObjectsMarked() )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
|
|
|
if ( _rCode.IsMod2() )
|
|
|
|
{
|
|
|
|
// move in 1 pixel distance
|
2008-08-19 09:18:37 +00:00
|
|
|
const Size aPixelSize = rReportSection.PixelToLogic( Size( 1, 1 ) );
|
2007-08-03 11:46:04 +00:00
|
|
|
nX *= aPixelSize.Width();
|
|
|
|
nY *= aPixelSize.Height();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move in 1 mm distance
|
|
|
|
nX *= DEFAUL_MOVE_SIZE;
|
|
|
|
nY *= DEFAUL_MOVE_SIZE;
|
|
|
|
}
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
OSectionView& rView = rReportSection.getSectionView();
|
|
|
|
const SdrHdlList& rHdlList = rView.GetHdlList();
|
2007-08-03 11:46:04 +00:00
|
|
|
SdrHdl* pHdl = rHdlList.GetFocusHdl();
|
|
|
|
|
|
|
|
if ( pHdl == 0 )
|
|
|
|
{
|
|
|
|
// no handle selected
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( rView.IsMoveAllowed() )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
|
|
|
// restrict movement to work area
|
2008-08-19 09:18:37 +00:00
|
|
|
Rectangle rWorkArea = rView.GetWorkArea();
|
2007-08-03 11:46:04 +00:00
|
|
|
|
|
|
|
if ( !rWorkArea.IsEmpty() )
|
|
|
|
{
|
2008-06-16 12:47:21 +00:00
|
|
|
if ( rWorkArea.Top() < 0 )
|
|
|
|
rWorkArea.Top() = 0;
|
2008-08-19 09:18:37 +00:00
|
|
|
Rectangle aMarkRect( rView.GetMarkedObjRect() );
|
2007-08-03 11:46:04 +00:00
|
|
|
aMarkRect.Move( nX, nY );
|
|
|
|
|
|
|
|
if ( !rWorkArea.IsInside( aMarkRect ) )
|
|
|
|
{
|
|
|
|
if ( aMarkRect.Left() < rWorkArea.Left() )
|
|
|
|
nX += rWorkArea.Left() - aMarkRect.Left();
|
|
|
|
|
|
|
|
if ( aMarkRect.Right() > rWorkArea.Right() )
|
|
|
|
nX -= aMarkRect.Right() - rWorkArea.Right();
|
|
|
|
|
|
|
|
if ( aMarkRect.Top() < rWorkArea.Top() )
|
|
|
|
nY += rWorkArea.Top() - aMarkRect.Top();
|
|
|
|
|
|
|
|
if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
|
|
|
|
nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
|
|
|
|
}
|
|
|
|
bool bCheck = false;
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
|
2007-08-03 11:46:04 +00:00
|
|
|
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
|
|
|
|
{
|
|
|
|
SdrMark* pMark = rMarkList.GetMark(i);
|
|
|
|
bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
|
|
|
|
}
|
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( bCheck && isOver(aMarkRect,*rReportSection.getPage(),rView) )
|
2007-08-03 11:46:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nX != 0 || nY != 0 )
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.MoveAllMarked( Size( nX, nY ) );
|
|
|
|
rView.MakeVisible( rView.GetAllMarkedRect(), rReportSection);
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move the handle
|
|
|
|
if ( pHdl && ( nX || nY ) )
|
|
|
|
{
|
|
|
|
const Point aStartPoint( pHdl->GetPos() );
|
|
|
|
const Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrDragStat& rDragStat = rView.GetDragStat();
|
2007-08-03 11:46:04 +00:00
|
|
|
|
|
|
|
// start dragging
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.BegDragObj( aStartPoint, 0, pHdl, 0 );
|
2007-08-03 11:46:04 +00:00
|
|
|
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( rView.IsDragObj() )
|
2007-08-03 11:46:04 +00:00
|
|
|
{
|
|
|
|
const FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
|
2008-08-19 09:18:37 +00:00
|
|
|
const BOOL bWasSnapEnabled = rView.IsSnapEnabled();
|
2007-08-03 11:46:04 +00:00
|
|
|
|
|
|
|
// switch snapping off
|
|
|
|
if ( !bWasNoSnap )
|
|
|
|
((SdrDragStat&)rDragStat).SetNoSnap( TRUE );
|
|
|
|
if ( bWasSnapEnabled )
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SetSnapEnabled( FALSE );
|
2007-08-03 11:46:04 +00:00
|
|
|
|
|
|
|
Rectangle aNewRect;
|
|
|
|
bool bCheck = false;
|
2008-08-19 09:18:37 +00:00
|
|
|
const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
|
2007-08-03 11:46:04 +00:00
|
|
|
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
|
|
|
|
{
|
|
|
|
SdrMark* pMark = rMarkList.GetMark(i);
|
|
|
|
bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
|
|
|
|
if ( bCheck )
|
|
|
|
aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(pHdl->GetKind())
|
|
|
|
{
|
|
|
|
case HDL_LEFT:
|
|
|
|
case HDL_UPLFT:
|
|
|
|
case HDL_LWLFT:
|
|
|
|
case HDL_UPPER:
|
|
|
|
aNewRect.Left() += nX;
|
|
|
|
aNewRect.Top() += nY;
|
|
|
|
break;
|
|
|
|
case HDL_UPRGT:
|
|
|
|
case HDL_RIGHT:
|
|
|
|
case HDL_LWRGT:
|
|
|
|
case HDL_LOWER:
|
|
|
|
aNewRect.setWidth(aNewRect.getWidth() + nX);
|
|
|
|
aNewRect.setHeight(aNewRect.getHeight() + nY);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
if ( !(bCheck && isOver(aNewRect,*rReportSection.getPage(),rView)) )
|
|
|
|
rView.MovAction(aEndPoint);
|
|
|
|
rView.EndDragObj();
|
2007-08-03 11:46:04 +00:00
|
|
|
|
|
|
|
// restore snap
|
|
|
|
if ( !bWasNoSnap )
|
|
|
|
((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
|
|
|
|
if ( bWasSnapEnabled )
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.SetSnapEnabled( bWasSnapEnabled );
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// make moved handle visible
|
|
|
|
const Rectangle aVisRect( aEndPoint - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.MakeVisible( aVisRect, rReportSection);
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-19 09:18:37 +00:00
|
|
|
rView.AdjustMarkHdl();
|
2007-08-03 11:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::stopScrollTimer()
|
|
|
|
{
|
|
|
|
::std::for_each(m_aSections.begin(),m_aSections.end(),
|
|
|
|
::std::compose1(::boost::mem_fn(&OReportSection::stopScrollTimer),TReportPairHelper()));
|
|
|
|
}
|
2008-06-16 12:47:21 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2008-08-19 09:18:37 +00:00
|
|
|
void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
|
|
|
|
{
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for (sal_uInt16 i = 0;aIter != aEnd ; ++aIter,++i)
|
|
|
|
{
|
|
|
|
if ( (*aIter)->getStartMarker().isCollapsed() )
|
|
|
|
_rCollapsedPositions.push_back(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue* pIter = _aCollpasedSections.getConstArray();
|
|
|
|
const beans::PropertyValue* pEnd = pIter + _aCollpasedSections.getLength();
|
|
|
|
for (; pIter != pEnd; ++pIter)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPos = sal_uInt16(-1);
|
|
|
|
if ( (pIter->Value >>= nPos) && nPos < m_aSections.size() )
|
|
|
|
{
|
|
|
|
m_aSections[nPos]->setCollapsed(sal_True);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-12-01 12:31:27 +00:00
|
|
|
void OViewsWindow::zoom(const Fraction& _aZoom)
|
2008-08-19 09:18:37 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
const MapMode& aMapMode = GetMapMode();
|
|
|
|
|
|
|
|
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
|
|
|
|
if ( _aZoom < aMapMode.GetScaleX() )
|
|
|
|
aStartWidth *= aMapMode.GetScaleX();
|
|
|
|
else
|
|
|
|
aStartWidth *= _aZoom;
|
2008-08-19 09:18:37 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
setZoomFactor(_aZoom,*this);
|
2008-08-19 09:18:37 +00:00
|
|
|
|
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
(*aIter)->zoom(_aZoom);
|
2008-08-19 09:18:37 +00:00
|
|
|
} // for (;aIter != aEnd ; ++aIter)
|
|
|
|
|
|
|
|
Resize();
|
|
|
|
|
|
|
|
Size aOut = GetOutputSizePixel();
|
2008-12-01 12:31:27 +00:00
|
|
|
aOut.Width() = aStartWidth;
|
2008-08-19 09:18:37 +00:00
|
|
|
aOut = PixelToLogic(aOut);
|
|
|
|
|
|
|
|
Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
|
|
|
|
Invalidate(aRect,/*INVALIDATE_NOERASE | */INVALIDATE_NOCHILDREN /*| INVALIDATE_TRANSPARENT*/);
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
2008-12-01 12:31:27 +00:00
|
|
|
void OViewsWindow::scrollChildren(const Point& _aThumbPos)
|
2008-08-19 09:18:37 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
const Point aPos(PixelToLogic(_aThumbPos));
|
2008-08-19 09:18:37 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
MapMode aMapMode = GetMapMode();
|
|
|
|
const Point aOld = aMapMode.GetOrigin();
|
|
|
|
aMapMode.SetOrigin(m_pParent->GetMapMode().GetOrigin());
|
|
|
|
|
|
|
|
const Point aPosY(m_pParent->PixelToLogic(_aThumbPos,aMapMode));
|
|
|
|
|
|
|
|
aMapMode.SetOrigin( Point(aOld.X() , - aPosY.Y()));
|
|
|
|
SetMapMode( aMapMode );
|
|
|
|
//OWindowPositionCorrector aCorrector(this,0,-( aOld.Y() + aPosY.Y()));
|
|
|
|
Scroll(0, -( aOld.Y() + aPosY.Y()),SCROLL_CHILDREN);
|
|
|
|
Resize();
|
2008-08-19 09:18:37 +00:00
|
|
|
Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
|
|
|
|
}
|
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
TSectionsMap::iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::iterator aEnd = m_aSections.end();
|
|
|
|
for (;aIter != aEnd ; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
(*aIter)->scrollChildren(aPos.X());
|
|
|
|
} // for (;aIter != aEnd ; ++aIter)
|
2008-08-19 09:18:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-06-16 12:47:21 +00:00
|
|
|
void OViewsWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
|
|
|
|
{
|
|
|
|
TSectionsMap::const_iterator aIter = m_aSections.begin();
|
|
|
|
TSectionsMap::const_iterator aEnd = m_aSections.end();
|
|
|
|
for(;aIter != aEnd; ++aIter)
|
|
|
|
{
|
2008-08-19 09:18:37 +00:00
|
|
|
(*aIter)->getReportSection().fillControlModelSelection(_rSelection);
|
2008-06-16 12:47:21 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
//==============================================================================
|
|
|
|
} // rptui
|
|
|
|
//==============================================================================
|