summaryrefslogtreecommitdiff
path: root/sw/source/ui/uiview/viewmdi.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-03-07 14:07:37 +0000
committerKurt Zenker <kz@openoffice.org>2008-03-07 14:07:37 +0000
commit4eb5bf34df824bc12bf42ba9ae3dbc83f1d2dfde (patch)
treef0a0d6e052ff00c4db64f499d57c7830289e1f7b /sw/source/ui/uiview/viewmdi.cxx
parent64585c9fda2a7a127961621b8f423783e18c8011 (diff)
INTEGRATION: CWS pages01_DEV300 (1.19.10); FILE MERGED
2008/02/21 12:44:43 fme 1.19.10.7: RESYNC: (1.19-1.20); FILE MERGED 2007/12/13 14:27:57 fme 1.19.10.6: #i1598# Multiple page view - zoom slider 2007/12/13 14:16:03 fme 1.19.10.5: #i1598# Multiple page view - zoom slider 2007/12/03 11:45:30 fme 1.19.10.4: #i1598# Multiple Page View - Configuration 2007/11/28 16:02:52 fme 1.19.10.3: #i1598# Multiple Page View - Dynamic Zoom factors in automatic view layout 2007/11/19 12:32:54 fme 1.19.10.2: #i1598# Multiple page view 2007/10/24 15:00:20 fme 1.19.10.1: #i1598# Multiple Page View
Diffstat (limited to 'sw/source/ui/uiview/viewmdi.cxx')
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx114
1 files changed, 89 insertions, 25 deletions
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
index 2e3c98ec33f7..d66c5302407b 100644
--- a/sw/source/ui/uiview/viewmdi.cxx
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewmdi.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: rt $ $Date: 2008-02-19 13:59:19 $
+ * last change: $Author: kz $ $Date: 2008-03-07 15:07:37 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -148,6 +148,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
BOOL bUnLockView = !pWrtShell->IsViewLocked();
pWrtShell->LockView( TRUE );
pWrtShell->LockPaint();
+
{
ACT_KONTEXT(pWrtShell);
@@ -156,52 +157,60 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
- const SwPageDesc &rDesc = pWrtShell->GetPageDesc(
- pWrtShell->GetCurPageDesc() );
+ const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
const SwViewOption *pOpt = pWrtShell->GetViewOptions();
- long lLeftMargin;
+ long lLeftMargin = 0;
if( eZoomType != SVX_ZOOM_PERCENT )
{
- const long nOf = DOCUMENTBORDER * 2L;
- Size aPageSize( pWrtShell->GetAnyCurRect(RECT_PAGE_CALC).SSize() );
+ const bool bAutomaticViewLayout = 0 == pOpt->GetViewLayoutColumns();
+
+ const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) );
+ const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) );
+ Size aPageSize( aPageRect.SSize() );
+ Size aRootSize( aRootRect.SSize() );
//mod #i6193# added sidebar width
SwPostItMgr* pPostItMgr = GetPostItMgr();
if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
aPageSize.Width() += pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth();
+ const MapMode aTmpMap( MAP_TWIP );
+ const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
+
if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() ) // gespiegelte Seiten
{
const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
- aPageSize.Width() +=
- Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
+ aPageSize.Width() += Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
}
+
if( SVX_ZOOM_OPTIMAL == eZoomType )
{
- aPageSize.Width() -=
- ( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 );
+ aPageSize.Width() -= ( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 );
+ lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
+ nFac = aWindowSize.Width() * 100 / aPageSize.Width();
}
- else if(SVX_ZOOM_PAGEWIDTH_NOBORDER != eZoomType)
+ else if(SVX_ZOOM_WHOLEPAGE == eZoomType || SVX_ZOOM_PAGEWIDTH == eZoomType )
{
- aPageSize.Width() += nOf;
+ const long nOf = DOCUMENTBORDER * 2L;
+ long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
+ nTmpWidth += nOf;
aPageSize.Height() += nOf;
- }
- lLeftMargin = SVX_ZOOM_PAGEWIDTH != eZoomType && SVX_ZOOM_PAGEWIDTH_NOBORDER != eZoomType ?
- long(rLRSpace.GetLeft()) + DOCUMENTBORDER + nLeftOfst : 0L;
+ nFac = aWindowSize.Width() * 100 / nTmpWidth;
- const MapMode aTmpMap( MAP_TWIP );
- const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
- nFac = aWindowSize.Width() * 100 / aPageSize.Width();
- if( SVX_ZOOM_WHOLEPAGE == eZoomType )
+ if ( SVX_ZOOM_WHOLEPAGE == eZoomType )
+ {
+ long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
+ nFac = Min( nFac, nVisPercent );
+ }
+ }
+ else /*if( SVX_ZOOM_PAGEWIDTH_NOBORDER == eZoomType )*/
{
- long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
- nFac = Min( nFac, nVisPercent );
+ const long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
+ nFac = aWindowSize.Width() * 100 / nTmpWidth;
}
}
- else
- lLeftMargin = long(rLRSpace.GetLeft()) + DOCUMENTBORDER;
nFac = Max( long( MINZOOM ), nFac );
@@ -230,6 +239,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
if ( eZoomType != SVX_ZOOM_PERCENT )
{
Point aPos;
+
if ( eZoomType == SVX_ZOOM_WHOLEPAGE )
aPos.Y() = pWrtShell->GetAnyCurRect(RECT_PAGE).Top() - DOCUMENTBORDER;
else
@@ -239,7 +249,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
aPos.X() = lLeftMargin;
const SwRect &rCharRect = pWrtShell->GetCharRect();
if ( rCharRect.Top() > GetVisArea().Bottom() ||
- rCharRect.Bottom() < aPos.Y() )
+ rCharRect.Bottom() < aPos.Y() )
aPos.Y() = rCharRect.Top() - rCharRect.Height();
else
aPos.Y() = GetVisArea().Top();
@@ -278,6 +288,60 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
// eZoom = eZoomType;
}
+void SwView::SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly )
+{
+ const BOOL bUnLockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE );
+ pWrtShell->LockPaint();
+
+ {
+
+ ACT_KONTEXT(pWrtShell);
+
+ if ( !GetViewFrame()->GetFrame()->IsInPlace() && !bViewOnly )
+ {
+ const BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
+
+ //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
+ //View updaten.
+ if ( nColumns != pUsrPref->GetViewLayoutColumns() ||
+ bBookMode != pUsrPref->IsViewLayoutBookMode() )
+ {
+ pUsrPref->SetViewLayoutColumns( nColumns );
+ pUsrPref->SetViewLayoutBookMode( bBookMode );
+ SW_MOD()->ApplyUsrPref( *pUsrPref,
+ bViewOnly ? this: 0,
+ bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
+ pUsrPref->SetModified();
+ }
+ }
+
+ const SwViewOption *pOpt = pWrtShell->GetViewOptions();
+
+ if ( nColumns != pOpt->GetViewLayoutColumns() ||
+ bBookMode != pOpt->IsViewLayoutBookMode() )
+ {
+ SwViewOption aOpt( *pOpt );
+ aOpt.SetViewLayoutColumns( nColumns );
+ aOpt.SetViewLayoutBookMode( bBookMode );
+ pWrtShell->ApplyViewOptions( aOpt );
+ }
+
+ pVRuler->ForceUpdate();
+ pHRuler->ForceUpdate();
+
+ }
+
+ pWrtShell->UnlockPaint();
+ if( bUnLockView )
+ pWrtShell->LockView( FALSE );
+
+ SfxBindings& rBnd = GetViewFrame()->GetBindings();
+ rBnd.Invalidate( SID_ATTR_VIEWLAYOUT );
+ rBnd.Invalidate( SID_ATTR_ZOOMSLIDER);
+}
+
/*
* Scrollbar - Handler
*/