summaryrefslogtreecommitdiffstats
path: root/reportdesign/source/ui/report/ReportWindow.cxx
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
commit2363c961947028ee152cbdfca7e4b4d1099ca019 (patch)
treed4e60312f0d4cca1098aa9ea181329711867e53e /reportdesign/source/ui/report/ReportWindow.cxx
parentCWS-TOOLING: integrate CWS sqlsyntaxhighlighting (diff)
downloadcore-2363c961947028ee152cbdfca7e4b4d1099ca019.tar.gz
core-2363c961947028ee152cbdfca7e4b4d1099ca019.zip
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
Diffstat (limited to 'reportdesign/source/ui/report/ReportWindow.cxx')
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx105
1 files changed, 72 insertions, 33 deletions
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 3a71951ea152..3d04b2898669 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -134,7 +134,6 @@ void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSecti
m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition);
- Resize();
m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
}
//------------------------------------------------------------------------------
@@ -152,11 +151,11 @@ void OReportWindow::showRuler(sal_Bool _bShow)
//------------------------------------------------------------------------------
sal_Int32 OReportWindow::getMaxMarkerWidth(sal_Bool _bWithEnd) const
{
- Fraction aStartWith(long(REPORT_STARTMARKER_WIDTH));
- aStartWith *= m_aViewsWindow.GetMapMode().GetScaleX();
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX();
if ( _bWithEnd )
- aStartWith += Fraction(long(REPORT_ENDMARKER_WIDTH));
- return sal_Int32((long)aStartWith);
+ aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH));
+ return sal_Int32((long)aStartWidth);
}
//------------------------------------------------------------------------------
sal_Int32 OReportWindow::GetTotalWidth() const
@@ -164,11 +163,14 @@ sal_Int32 OReportWindow::GetTotalWidth() const
sal_Int32 nWidth = 0;
if ( !m_aViewsWindow.empty() )
{
- Fraction aStartWith(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH));
- aStartWith *= m_aViewsWindow.GetMapMode().GetScaleX();
+ Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
+ const Fraction aZoom(m_pView->getController().getZoomValue(),100);
+ aStartWidth *= aZoom; // m_aViewsWindow.GetMapMode().GetScaleX();;
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
- const Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth,0));
- nWidth = aPageSize.Width() + long(aStartWith);
+ Fraction aPaperWidth(nPaperWidth,1);
+ aPaperWidth *= aZoom;
+ const Size aPageSize = LogicToPixel(Size(aPaperWidth,0));
+ nWidth = aPageSize.Width() + long(aStartWidth);
}
return nWidth;
}
@@ -179,16 +181,15 @@ void OReportWindow::Resize()
if ( !m_aViewsWindow.empty() )
{
const Size aTotalOutputSize = GetOutputSizePixel();
- Fraction aStartWith(long(REPORT_STARTMARKER_WIDTH));
- aStartWith *= m_aViewsWindow.GetMapMode().GetScaleX();
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
- const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT );
- Point aStartPoint((long)aStartWith + aOffset.X(),0);
+ const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, 0 ), MAP_APPFONT );
+ Point aStartPoint((long)aStartWidth + aOffset.X(),0);
uno::Reference<report::XReportDefinition> xReportDefinition = getReportView()->getController().getReportDefinition();
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
- Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth,0));
+ Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0));
nLeftMargin = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width();
nRightMargin = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width();
@@ -211,9 +212,9 @@ void OReportWindow::Resize()
}
}
//------------------------------------------------------------------------------
-Point OReportWindow::getScrollOffset() const
+Point OReportWindow::getThumbPos() const
{
- return m_pParent->getScrollOffset();
+ return m_pParent->getThumbPos();
}
//------------------------------------------------------------------------------
void OReportWindow::ImplInitSettings()
@@ -235,22 +236,22 @@ void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt )
//------------------------------------------------------------------------------
sal_Int32 OReportWindow::GetTotalHeight() const
{
- return m_aHRuler.GetSizePixel().Height() + m_aViewsWindow.getTotalHeight();
+ return m_aViewsWindow.getTotalHeight();
}
//------------------------------------------------------------------------------
-void OReportWindow::ScrollChildren(long nDeltaX, long nDeltaY)
+void OReportWindow::ScrollChildren(const Point& _aThumbPos)
{
- if ( nDeltaX )
+ MapMode aMap = m_aHRuler.GetMapMode();
+ Point aOrg( aMap.GetOrigin() );
+ if ( aOrg.X() != (-_aThumbPos.X()) )
{
- MapMode aMap = m_aHRuler.GetMapMode();
- Point aOrg( aMap.GetOrigin() );
- aMap.SetOrigin( Point(aOrg.X() - nDeltaX, aOrg.Y()));
+ aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y()));
m_aHRuler.SetMapMode( aMap );
- m_aHRuler.Scroll(-nDeltaX,0);
+ m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0);
}
-
- m_aViewsWindow.scrollChildren(nDeltaX,nDeltaY);
+ /*const Point aPos(PixelToLogic(_aThumbPos));*/
+ m_aViewsWindow.scrollChildren(_aThumbPos);
}
//----------------------------------------------------------------------------
USHORT OReportWindow::getSectionCount() const
@@ -258,11 +259,9 @@ USHORT OReportWindow::getSectionCount() const
return m_aViewsWindow.getSectionCount();
}
//----------------------------------------------------------------------------
-void OReportWindow::notifyHeightChanged()
+void OReportWindow::notifySizeChanged()
{
m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
- //Resize();
- //Invalidate(INVALIDATE_TRANSPARENT);
}
//----------------------------------------------------------------------------
BOOL OReportWindow::HasSelection()
@@ -371,7 +370,6 @@ void OReportWindow::setGridSnap(BOOL bOn)
// -----------------------------------------------------------------------------
void OReportWindow::setDragStripes(BOOL bOn)
{
-
m_aViewsWindow.setDragStripes(bOn);
}
// -----------------------------------------------------------------------------
@@ -385,13 +383,18 @@ sal_uInt32 OReportWindow::getMarkedObjectCount() const
return m_aViewsWindow.getMarkedObjectCount();
}
// -----------------------------------------------------------------------------
-void OReportWindow::zoom(const sal_Int16 _nZoom)
+void OReportWindow::zoom(const Fraction& _aZoom)
{
- m_aHRuler.SetZoom(Fraction(_nZoom,100));
+ m_aHRuler.SetZoom(_aZoom);
m_aHRuler.Invalidate();
- m_aViewsWindow.zoom(_nZoom);
- notifyHeightChanged();
+ //setZoomFactor(_aZoom,*this); // if this will be include the H - ruler has the wrong size
+ m_aViewsWindow.zoom(_aZoom);
+
+ notifySizeChanged();
+ const Point aNewThumbPos( m_pParent->getThumbPos() );
+
+ ScrollChildren( aNewThumbPos );
Resize();
Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
@@ -401,7 +404,43 @@ void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno
{
m_aViewsWindow.fillControlModelSelection(_rSelection);
}
+// -----------------------------------------------------------------------------
+sal_Int32 OReportWindow::impl_getRealPixelWidth() const
+{
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
+ MapMode aMap( MAP_100TH_MM );
+ const Size aPageSize = LogicToPixel(Size(nPaperWidth,0),aMap);
+ return aPageSize.Width() + REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH + SECTION_OFFSET;
+}
+// -----------------------------------------------------------------------------
+sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
+{
+ sal_uInt16 nZoom(100);
+ const Size aSize( GetSizePixel() );
+ switch( _eType)
+ {
+ case SVX_ZOOM_PERCENT:
+ nZoom = m_pView->getController().getZoomValue();
+ break;
+ case SVX_ZOOM_OPTIMAL:
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ {
+ nZoom = (USHORT)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ MapMode aMap( MAP_100TH_MM );
+ const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap);
+ nZoom = ::std::min(nZoom,(USHORT)(long)Fraction(aSize.Height()*100,aHeight.Height()));
+ }
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nZoom = (USHORT)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ break;
+ default:
+ break;
+ }
+ return nZoom;
+}
//==================================================================
} //rptui
//==================================================================