Files
libreoffice/sw/source/ui/uiview/viewmdi.cxx
Ivo Hinkelmann df6d312ca5 CWS-TOOLING: integrate CWS swrefactormarks2
2009-04-09 12:51:41 +0200 b_michaelsen  r270689 : #i94949# cleaned up assertions after rebasing
2009-04-08 17:37:08 +0200 b_michaelsen  r270658 : fixing sw/source/ui/utlui/makefile.mk
2009-04-07 17:56:54 +0200 b_michaelsen  r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4
2009-04-07 17:05:20 +0200 b_michaelsen  r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4
2009-04-02 23:44:38 +0200 b_michaelsen  r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45)
2009-02-27 16:25:31 +0100 b_michaelsen  r268606 : #i94949# fixed Windows buildbreaker
2009-02-25 18:01:13 +0100 b_michaelsen  r268464 : #i94949# Bookmarktest document filter roundtrips
2009-02-24 18:23:55 +0100 b_michaelsen  r268404 : #i94949# Bookmark unittests
2009-02-23 19:47:44 +0100 b_michaelsen  r268370 : #i94949# added unittest for bookmarks
2009-02-23 12:22:07 +0100 b_michaelsen  r268348 : #i94949# fixing CheckCrossReferences testcase
2009-02-20 18:12:50 +0100 b_michaelsen  r268335 : #i94949# fixing SwXTextRange
2009-02-18 18:32:57 +0100 b_michaelsen  r268252 : #i94949# deregistering DdeBookmarks on delete
2009-02-18 18:29:08 +0100 b_michaelsen  r268251 : fixing dbgoutsw.cxx for debug builds
2009-02-16 18:42:43 +0100 b_michaelsen  r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41)
2009-02-12 15:32:02 +0100 b_michaelsen  r267667 : #i94949 fixed crossrefbookmark naming
2009-02-11 18:30:08 +0100 b_michaelsen  r267624 : #94949# fixing bookmark navigation
2009-02-11 13:55:26 +0100 b_michaelsen  r267599 : #i94949# fixed bookmark naming
2009-02-10 17:53:05 +0100 b_michaelsen  r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded
2009-02-10 17:23:01 +0100 b_michaelsen  r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark
2009-02-10 16:16:32 +0100 b_michaelsen  r267553 : #i94949# creating only CrossRefBookmark per Txtnode
2009-02-10 12:14:05 +0100 b_michaelsen  r267547 : #i94949# fixed bookmark count in navigator
2009-02-09 19:12:18 +0100 b_michaelsen  r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly
2009-02-09 17:32:45 +0100 b_michaelsen  r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..)
2009-02-09 17:22:15 +0100 b_michaelsen  r267523 : #i94949# trying to harden SwServerObject
2009-02-09 16:47:32 +0100 b_michaelsen  r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible
2009-02-09 16:05:42 +0100 b_michaelsen  r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion
2009-02-09 15:55:38 +0100 b_michaelsen  r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..)
2009-02-09 15:23:47 +0100 b_michaelsen  r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx
2009-02-09 14:14:47 +0100 b_michaelsen  r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type
2009-02-09 14:04:25 +0100 b_michaelsen  r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks
2009-02-09 13:55:01 +0100 b_michaelsen  r267510 : #i94949# using empty string for UnoMark construction
2009-02-09 13:46:46 +0100 b_michaelsen  r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj
2009-02-06 14:38:37 +0100 b_michaelsen  r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches
2009-02-05 18:05:07 +0100 b_michaelsen  r267436 : #i94949# removing superfluous #includes
2009-02-04 15:51:31 +0100 b_michaelsen  r267391 : fixing resync merge error
2009-02-02 19:39:55 +0100 b_michaelsen  r267294 : #i94949# bookmark performance
2009-01-30 19:30:51 +0100 b_michaelsen  r267229 : #i94949# throwing IllegalArgumentException, if appropriate
2009-01-30 19:29:56 +0100 b_michaelsen  r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness
2009-01-30 19:23:49 +0100 b_michaelsen  r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness
2009-01-30 19:16:06 +0100 b_michaelsen  r267226 : #i94949# refactored lcl_FillBookmarkArray
2009-01-30 17:59:27 +0100 b_michaelsen  r267222 : #i94949# removed superficial #include
2009-01-30 17:50:02 +0100 b_michaelsen  r267220 : #i94949# SwXTextRange remembers its UNO bookmark
2009-01-29 20:19:58 +0100 b_michaelsen  r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark
2009-01-29 17:22:17 +0100 b_michaelsen  r267162 : #i94949# implemented renameMark in Markmanager
2009-01-29 14:17:10 +0100 b_michaelsen  r267134 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:21:54 +0100 b_michaelsen  r267125 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:06:10 +0100 b_michaelsen  r267120 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:00:09 +0100 b_michaelsen  r267118 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 10:35:10 +0100 b_michaelsen  r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found
2009-01-28 17:05:36 +0100 b_michaelsen  r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx
2009-01-28 15:46:13 +0100 b_michaelsen  r267063 : #i94949# documentation
2009-01-28 15:36:59 +0100 b_michaelsen  r267062 : #i94949# removing superficial #include
2009-01-28 15:30:36 +0100 b_michaelsen  r267061 : #i94949# basic code conventions
2009-01-28 11:14:30 +0100 b_michaelsen  r267039 : #i94949# comparing to the actual name of the new mark
2009-01-26 15:22:25 +0100 b_michaelsen  r266927 : #i94949# performance fixes
2009-01-14 21:16:56 +0100 b_michaelsen  r266332 : #i94949# fixing linux x86-64 compiler warnings
2009-01-14 19:52:06 +0100 b_michaelsen  r266331 : #i94949# fixing some compiler warnings
2008-12-15 13:04:49 +0100 b_michaelsen  r265474 : #i94949# fixed microsoft compiler warnings
2008-12-12 18:26:02 +0100 b_michaelsen  r265434 : #i94949# fixed pro platform buildbreakers
2008-12-11 17:51:24 +0100 b_michaelsen  r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37)
2008-12-09 18:30:59 +0100 b_michaelsen  r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree
2008-12-09 16:56:26 +0100 b_michaelsen  r265118 : #i94949# fixed deleteMark optimization
2008-12-09 14:55:58 +0100 b_michaelsen  r265092 : #i94949# DdeLink and DdeBookmark
2008-12-05 18:28:05 +0100 b_michaelsen  r264914 : #i94949# fixed InitDoc in bookmarks
2008-12-02 02:23:51 +0100 b_michaelsen  r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty
2008-12-02 02:05:19 +0100 b_michaelsen  r264648 : #i94949# using bisect search for delete
2008-12-02 01:58:16 +0100 b_michaelsen  r264647 : #i94949# using bisect search for delete
2008-12-02 01:37:33 +0100 b_michaelsen  r264646 : #i94949# using bisect search for delete
2008-12-02 01:03:29 +0100 b_michaelsen  r264645 : #i94949# fixed deleteMark crash
2008-12-01 20:55:00 +0100 b_michaelsen  r264638 : #i94949# removed crossrefs from ui enumerations
2008-12-01 15:48:12 +0100 b_michaelsen  r264613 : #i94949# removed superfluous local functions
2008-12-01 15:01:19 +0100 b_michaelsen  r264608 : #i94949# optimized insertion of new marks
2008-12-01 14:33:21 +0100 b_michaelsen  r264603 : #i94949# simplified code finding Fieldmark for a position
2008-12-01 14:05:55 +0100 b_michaelsen  r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName()
2008-11-27 18:48:15 +0100 b_michaelsen  r264515 : #i94949# fixed _SaveCntntIdx and friends
2008-11-27 15:59:49 +0100 b_michaelsen  r264500 : #i94949# fix Mark position only in ctor
2008-11-27 15:52:28 +0100 b_michaelsen  r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early
2008-11-26 14:54:22 +0100 b_michaelsen  r264396 : #i94949# fixed documentation, simplified  navigator reminder code
2008-11-24 20:45:51 +0100 b_michaelsen  r264266 : #i94949# removed last obsolete getUniqueMarkName calls
2008-11-24 20:21:35 +0100 b_michaelsen  r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls
2008-11-24 18:34:32 +0100 b_michaelsen  r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation
2008-11-21 14:08:49 +0100 b_michaelsen  r264137 : #i94949# simplified makeMark
2008-11-21 12:07:09 +0100 b_michaelsen  r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark
2008-11-19 12:50:49 +0100 b_michaelsen  r263981 : #i94949# starting refactoring of bookmark naming
2008-11-19 11:31:08 +0100 b_michaelsen  r263972 : #i94949# getting rid of obsolete dynamic casts
2008-11-18 19:06:09 +0100 b_michaelsen  r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators
2008-11-18 17:50:18 +0100 b_michaelsen  r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators
2008-11-18 16:48:20 +0100 b_michaelsen  r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess
2008-11-18 11:31:35 +0100 b_michaelsen  r263753 : #i94949# cleaning up mark code in crsrsh
2008-11-17 10:15:25 +0100 b_michaelsen  r263705 : #i94949# removed possible integer overflow
2008-11-14 18:48:45 +0100 b_michaelsen  r263695 : #i94949# management of mark names in MarkManager
2008-11-14 18:23:40 +0100 b_michaelsen  r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc
2008-11-14 16:27:09 +0100 b_michaelsen  r263684 : #i94949# got rid of makeCrossRefBookmark
2008-11-14 13:03:32 +0100 b_michaelsen  r263674 : #i94949# refactored Correction methods
2008-11-13 12:27:55 +0100 b_michaelsen  r263631 : #i94949# got rid of old-style tools assertions in new code
2008-11-12 16:58:16 +0100 b_michaelsen  r263608 : #i94949# added assertion for unique names
2008-11-12 16:55:18 +0100 b_michaelsen  r263607 : #i94949# maked XFormField deprecated
2008-11-12 13:04:29 +0100 b_michaelsen  r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible
2008-11-11 18:45:53 +0100 b_michaelsen  r263572 : #i94949# cleaned up SwHstryBookmark
2008-11-11 13:48:18 +0100 b_michaelsen  r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it
2008-11-11 11:26:28 +0100 b_michaelsen  r263548 : #i94949# fixed SwXBookmark
2008-11-10 17:01:19 +0100 b_michaelsen  r263529 : #i94949# fixed DdeBookmarks in clipboard
2008-11-10 16:44:52 +0100 b_michaelsen  r263527 : #i94949# formatting
2008-11-10 16:29:16 +0100 b_michaelsen  r263526 : #i94949# fixing unoobj.cxx
2008-11-10 16:23:50 +0100 b_michaelsen  r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx
2008-11-10 16:02:08 +0100 b_michaelsen  r263524 : #i94949# Pdf Export should only generate 'real' bookmarks
2008-11-10 15:33:58 +0100 b_michaelsen  r263521 : #i94949# removed const_casts
2008-11-10 15:12:06 +0100 b_michaelsen  r263520 : #i94949# moved _DelBookmarks into MarksManager
2008-11-07 18:48:38 +0100 b_michaelsen  r263480 : #i94949# using iterator interface
2008-11-07 18:41:46 +0100 b_michaelsen  r263478 : #i94949# using iterator interface
2008-11-07 18:07:41 +0100 b_michaelsen  r263477 : #i94949# using iterator interface
2008-11-07 17:54:41 +0100 b_michaelsen  r263476 : #i94949# using iterator interface
2008-11-07 17:44:41 +0100 b_michaelsen  r263475 : #i94949# moved correction methods into MarkManager
2008-11-06 18:47:28 +0100 b_michaelsen  r263404 : #i94949# getting rid of superfluous const_casts
2008-11-06 17:58:01 +0100 b_michaelsen  r263403 : #i94949# no more setting of mark positions outside of the core
2008-11-06 17:08:37 +0100 b_michaelsen  r263401 : #i94949# removed setters from IMark
2008-11-06 13:55:25 +0100 b_michaelsen  r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore
2008-11-04 18:17:03 +0100 b_michaelsen  r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc
2008-11-04 16:48:34 +0100 b_michaelsen  r263330 : removing dead code (SwBitArray) found by mst
2008-11-04 16:29:32 +0100 b_michaelsen  r263329 : removing dead code (SwBitArray) found by mst
2008-11-04 14:57:48 +0100 b_michaelsen  r263326 : removing dead code (SwBitArray) found by mst
2008-11-04 14:50:18 +0100 b_michaelsen  r263325 : #i94949# stricter typing in IDocumentMarkAccess
2008-10-24 15:16:27 +0200 b_michaelsen  r262647 : #i94949# renamed ::sw:🔖:SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum
2008-10-24 15:10:10 +0200 b_michaelsen  r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear
2008-10-24 13:06:23 +0200 b_michaelsen  r262636 : #i94949# Fieldmark tabnavigation
2008-10-23 12:16:36 +0200 b_michaelsen  r262619 : #i94949# Fieldmark classes and filters
2008-10-22 13:17:18 +0200 b_michaelsen  r262597 : #i94949# writer import fixes
2008-10-21 11:30:38 +0200 b_michaelsen  r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface
2008-10-20 14:09:02 +0200 b_michaelsen  r262318 : #i94949# fixed SwDoc::CorrRel
2008-10-16 22:45:13 +0200 b_michaelsen  r262273 : #i94949 simplified Before/After methods
2008-10-16 21:40:57 +0200 b_michaelsen  r262271 : #i94949 renamed SimpleMark to NavigatorReminder
2008-10-16 21:15:23 +0200 b_michaelsen  r262270 : #i94949 using shared_ptr only in MarkManager
2008-10-16 17:46:37 +0200 b_michaelsen  r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter
2008-10-16 17:12:13 +0200 b_michaelsen  r262265 : #i94949# cleanup in crbm.cxx
2008-10-16 12:49:01 +0200 b_michaelsen  r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast
2008-10-15 15:34:20 +0200 b_michaelsen  r262239 : #i94949# added moved files
2008-10-15 15:26:45 +0200 b_michaelsen  r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00

759 lines
23 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewmdi.cxx,v $
* $Revision: 1.24.140.1 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
#include "hintids.hxx"
#include <vcl/svapp.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/ruler.hxx>
#include <svx/lrspitem.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/request.hxx>
#include <swmodule.hxx>
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#include <wrtsh.hxx>
#ifndef _DOCSH_HXX
#include <docsh.hxx>
#endif
#include <viewopt.hxx>
#include <frmatr.hxx>
#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
#endif
#include <uitool.hxx>
#include <edtwin.hxx>
#include <pagedesc.hxx>
#include <IMark.hxx>
#include <fldbas.hxx>
#include <workctrl.hxx>
#include <usrpref.hxx>
#include <scroll.hxx>
#ifndef _WVIEW_HXX
#include <wview.hxx>
#endif
#ifndef _CMDID_H
#include <cmdid.h>
#endif
#ifndef _VIEW_HRC
#include <view.hrc>
#endif
#ifndef _RIBBAR_HRC
#include <ribbar.hrc>
#endif
#ifndef _HELPID_H
#include <helpid.h>
#endif
#ifndef _GLOBALS_HRC
#include <globals.hrc>
#endif
#include <IDocumentSettingAccess.hxx>
#include <PostItMgr.hxx>
#include <postit.hxx>
USHORT SwView::nMoveType = NID_PGE;
sal_Int32 SwView::nActMark = 0;
#define VIEW_IMAGECOLOR COL_LIGHTBLUE
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, BOOL bViewOnly )
{
_SetZoom( GetEditWin().GetOutputSizePixel(), eZoomType, nFactor, bViewOnly );
}
void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
short nFactor, BOOL bViewOnly )
{
BOOL bUnLockView = !pWrtShell->IsViewLocked();
pWrtShell->LockView( TRUE );
pWrtShell->LockPaint();
{
ACT_KONTEXT(pWrtShell);
long nFac = nFactor;
BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
const SwViewOption *pOpt = pWrtShell->GetViewOptions();
long lLeftMargin = 0;
if( eZoomType != SVX_ZOOM_PERCENT )
{
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()) );
}
if( SVX_ZOOM_OPTIMAL == eZoomType )
{
if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
{
lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
}
else
{
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_WHOLEPAGE == eZoomType || SVX_ZOOM_PAGEWIDTH == eZoomType )
{
const long nOf = DOCUMENTBORDER * 2L;
long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
nTmpWidth += nOf;
aPageSize.Height() += nOf;
nFac = aWindowSize.Width() * 100 / nTmpWidth;
if ( SVX_ZOOM_WHOLEPAGE == eZoomType )
{
long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
nFac = Min( nFac, nVisPercent );
}
}
else /*if( SVX_ZOOM_PAGEWIDTH_NOBORDER == eZoomType )*/
{
const long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
nFac = aWindowSize.Width() * 100 / nTmpWidth;
}
}
nFac = Max( long( MINZOOM ), nFac );
SwViewOption aOpt( *pOpt );
if ( !GetViewFrame()->GetFrame()->IsInPlace() )
{
//MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
//View updaten.
if ( !bViewOnly &&
(USHORT(nFac) != pUsrPref->GetZoom() ||
BYTE (eZoomType) != pUsrPref->GetZoomType()) )
{
pUsrPref->SetZoom ( USHORT(nFac) );
pUsrPref->SetZoomType( eZoomType );
SW_MOD()->ApplyUsrPref( *pUsrPref,
bViewOnly ? this: 0,
bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
pUsrPref->SetModified();
}
if ( pOpt->GetZoom() != (USHORT) nFac )
{
aOpt.SetZoom ( USHORT(nFac) );
aOpt.SetReadonly(pOpt->IsReadonly());
pWrtShell->ApplyViewOptions( aOpt );
}
if ( eZoomType != SVX_ZOOM_PERCENT )
{
Point aPos;
if ( eZoomType == SVX_ZOOM_WHOLEPAGE )
aPos.Y() = pWrtShell->GetAnyCurRect(RECT_PAGE).Top() - DOCUMENTBORDER;
else
{
//sicherstellen, dass sich der Cursor im sichtbaren
//Bereich befindet, damit nur 1x gescrollt wird
aPos.X() = lLeftMargin;
const SwRect &rCharRect = pWrtShell->GetCharRect();
if ( rCharRect.Top() > GetVisArea().Bottom() ||
rCharRect.Bottom() < aPos.Y() )
aPos.Y() = rCharRect.Top() - rCharRect.Height();
else
aPos.Y() = GetVisArea().Top();
}
SetVisArea( aPos );
}
// OS: Notloesung - in CalcVisArea wird u.U. wieder SetZoom gerufen und
// dann werden falsche Werte eingestellt
((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
CalcVisArea( rEditSize ); //fuer das Neuberechnen des sichtbaren Bereiches
}
else if ( USHORT(nFac) != pOpt->GetZoom() )
{
aOpt.SetZoom ( USHORT(nFac) );
pWrtShell->ApplyViewOptions( aOpt );
}
const Fraction aFrac( nFac, 100 );
pVRuler->SetZoom( aFrac );
pVRuler->ForceUpdate();
pHRuler->SetZoom( aFrac );
pHRuler->ForceUpdate();
((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
}
pWrtShell->UnlockPaint();
if( bUnLockView )
pWrtShell->LockView( FALSE );
if ( mpPostItMgr )
{
mpPostItMgr->Rescale();
mpPostItMgr->CalcRects();
mpPostItMgr->LayoutPostIts();
}
// 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
*/
int SwView::_CreateScrollbar( BOOL bHori )
{
Window *pMDI = &GetViewFrame()->GetWindow();
SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
ASSERT( !*ppScrollbar, "vorher abpruefen!" )
if( !bHori )
CreatePageButtons( !bShowAtResize );
*ppScrollbar = new SwScrollbar( pMDI, bHori );
UpdateScrollbars();
if(bHori)
(*ppScrollbar)->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
else
(*ppScrollbar)->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
(*ppScrollbar)->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
(*ppScrollbar)->EnableDrag( TRUE );
if(GetWindow())
InvalidateBorder();
// Scrollbar muss nochmals getestet werden, da im InvalidateBorder u.U. der
// Scrollbar wieder geloescht wurde
if ( !bShowAtResize && (*ppScrollbar))
(*ppScrollbar)->ExtendedShow();
return 1;
}
void SwView::CreatePageButtons(BOOL bShow)
{
Window *pMDI = &GetViewFrame()->GetWindow();
pPageUpBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEUP ), TRUE );
pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP);
pPageDownBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), FALSE );
pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN);
Reference< XFrame > xFrame = GetViewFrame()->GetFrame()->GetFrameInterface();
pNaviBtn = new SwNaviImageButton(pMDI, xFrame );
pNaviBtn->SetHelpId(HID_SCRL_NAVI);
Link aLk( LINK( this, SwView, BtnPage ) );
pPageUpBtn->SetClickHdl( aLk );
pPageDownBtn->SetClickHdl( aLk );
if(nMoveType != NID_PGE)
{
Color aColor(VIEW_IMAGECOLOR);
SetImageButtonColor(aColor);
}
if(bShow)
{
pPageUpBtn->Show();
pPageDownBtn->Show();
pNaviBtn->Show();
}
};
/*
* Button-Handler
*/
IMPL_LINK( SwView, BtnPage, Button *, pButton )
{
// #i75416# move the execution of the search to an asynchronously called static link
bool* pbNext = new bool( (pButton == pPageDownBtn) );
Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext );
return 0;
}
/*-----------------20.06.97 10:46-------------------
--------------------------------------------------*/
IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
{
if ( !pbNext )
return 0;
bool bNext = *pbNext;
SwWrtShell& rSh = pThis->GetWrtShell();
switch( nMoveType )
{
case NID_PGE:
bNext ? pThis->PhyPageDown() : pThis->PhyPageUp();
break;
case NID_TBL :
rSh.EnterStdMode();
if(bNext)
rSh.MoveTable(fnTableNext, fnTableStart);
else
rSh.MoveTable(fnTablePrev, fnTableStart);
break;
case NID_FRM :
case NID_GRF:
case NID_OLE:
{
USHORT eType = GOTOOBJ_FLY_FRM;
if(nMoveType == NID_GRF)
eType = GOTOOBJ_FLY_GRF;
else if(nMoveType == NID_OLE)
eType = GOTOOBJ_FLY_OLE;
BOOL bSuccess = bNext ?
rSh.GotoNextFly(eType) :
rSh.GotoPrevFly(eType);
if(bSuccess)
{
rSh.HideCrsr();
rSh.EnterSelFrmMode();
}
}
break;
case NID_DRW :
case NID_CTRL:
rSh.GotoObj(bNext,
nMoveType == NID_DRW ?
GOTOOBJ_DRAW_SIMPLE :
GOTOOBJ_DRAW_CONTROL);
break;
case NID_REG :
rSh.EnterStdMode();
if(bNext)
rSh.MoveRegion(fnRegionNext, fnRegionStart);
else
rSh.MoveRegion(fnRegionPrev, fnRegionStart);
break;
case NID_BKM :
rSh.EnterStdMode();
pThis->GetViewFrame()->GetDispatcher()->Execute(bNext ?
FN_NEXT_BOOKMARK :
FN_PREV_BOOKMARK);
break;
case NID_OUTL:
rSh.EnterStdMode();
bNext ? rSh.GotoNextOutline() : rSh.GotoPrevOutline();
break;
case NID_SEL :
bNext ? rSh.GoNextCrsr() : rSh.GoPrevCrsr();
break;
case NID_FTN:
rSh.EnterStdMode();
bNext ?
rSh.GotoNextFtnAnchor() :
rSh.GotoPrevFtnAnchor();
break;
case NID_MARK:
{
// unselect
rSh.MoveCrsr();
rSh.EnterStdMode();
// collect navigator reminders
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
::std::vector< const ::sw::mark::IMark* > vNavMarks;
for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
ppMark != pMarkAccess->getMarksEnd();
ppMark++)
{
if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
vNavMarks.push_back(ppMark->get());
}
// move
if(vNavMarks.size())
{
if(bNext)
{
nActMark++;
if (nActMark >= MAX_MARKS || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
nActMark = 0;
}
else
{
nActMark--;
if (nActMark < 0 || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
nActMark = vNavMarks.size()-1;
}
rSh.GotoMark(vNavMarks[nActMark]);
}
}
break;
case NID_POSTIT:
{
SwMarginWin* pPostIt = pThis->GetPostItMgr()->GetActivePostIt();
if (pPostIt)
pThis->GetPostItMgr()->SetActivePostIt(0);
SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
if (rSh.MoveFldType(pFldType, bNext))
pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
else
//first/last item
pThis->GetPostItMgr()->SetActivePostIt(pPostIt);
}
break;
case NID_SRCH_REP:
if(pSrchItem)
{
BOOL bBackward = pSrchItem->GetBackward();
if(rSh.HasSelection() && !bNext == rSh.IsCrsrPtAtEnd())
rSh.SwapPam();
pSrchItem->SetBackward(!bNext);
SfxRequest aReq(FN_REPEAT_SEARCH, SFX_CALLMODE_SLOT, pThis->GetPool());
pThis->ExecSearch(aReq);
pSrchItem->SetBackward(bBackward);
}
break;
case NID_INDEX_ENTRY:
rSh.GotoNxtPrvTOXMark(bNext);
break;
case NID_TABLE_FORMULA:
rSh.GotoNxtPrvTblFormula( bNext );
break;
case NID_TABLE_FORMULA_ERROR:
rSh.GotoNxtPrvTblFormula( bNext, TRUE );
break;
}
pThis->pEditWin->GrabFocus();
delete pbNext;
return 0;
}
/*************************************************************************
|*
|* SwView::CreateTab()
|*
|* Beschreibung
|* Ersterstellung VB 29.05.91
|* Letzte Aenderung OS 09.05.96
|*
*************************************************************************/
int SwView::CreateTab()
{
pHRuler->SetActive(GetFrame() && IsActive());
pHRuler->Show();
InvalidateBorder();
return 1;
}
/*************************************************************************
|*
|* SwView::KillTab()
|*
|* Beschreibung
|* Ersterstellung VB 29.05.91
|* Letzte Aenderung OS 09.05.96
|*
*************************************************************************/
int SwView::KillTab()
{
pHRuler->Hide();
InvalidateBorder();
return 1;
}
void SwView::ChangeTabMetric( FieldUnit eUnit )
{
if(pHRuler->GetUnit() != eUnit )
{
pHRuler->SetUnit( eUnit );
pHRuler->Invalidate();
}
}
void SwView::ChangeVLinealMetric( FieldUnit eUnit )
{
if(pVRuler->GetUnit() != eUnit)
{
pVRuler->SetUnit( eUnit );
pVRuler->Invalidate();
}
}
/* -----------------------------07.04.01 17:09--------------------------------
---------------------------------------------------------------------------*/
void SwView::GetVLinealMetric(FieldUnit& eToFill) const
{
eToFill = pVRuler->GetUnit();
}
/* -----------------------------07.04.01 17:09--------------------------------
---------------------------------------------------------------------------*/
void SwView::GetHLinealMetric(FieldUnit& eToFill) const
{
eToFill = pHRuler->GetUnit();
}
/*************************************************************************
|*
|* SwView::CreateVLineal()
|*
|* Beschreibung
|* Ersterstellung VB 29.05.91
|*
*************************************************************************/
int SwView::CreateVLineal()
{
pHRuler->SetBorderPos( pVRuler->GetSizePixel().Width()-1 );
pVRuler->SetActive(GetFrame() && IsActive());
pVRuler->Show();
InvalidateBorder();
return 1;
}
/*************************************************************************
|*
|* SwView::KillVLineal()
|*
|* Beschreibung
|* Ersterstellung VB 29.05.91
|*
*************************************************************************/
int SwView::KillVLineal()
{
pVRuler->Hide();
pHRuler->SetBorderPos( 0 );
InvalidateBorder();
return 1;
}
/*************************************************************************
|*
|* SwView::ExecRulerClick()
|*
|* Beschreibung
|* Ersterstellung OS 15.06.95
|* Letzte Aenderung
|*
*************************************************************************/
IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler )
{
USHORT nDefPage = 0;
switch( pRuler->GetClickType() )
{
case RULER_TYPE_DONTKNOW:
case RULER_TYPE_OUTSIDE:
case RULER_TYPE_INDENT:
case RULER_TYPE_MARGIN1:
case RULER_TYPE_MARGIN2:
nDefPage = TP_PARA_STD;
break;
default:
nDefPage = TP_TABULATOR;
}
SfxUInt16Item aDefPage(SID_PARA_DLG, nDefPage);
GetViewFrame()->GetDispatcher()->Execute( SID_PARA_DLG,
SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
&aDefPage, 0L );
return 0;
}
/*-----------------20.02.97 09:11-------------------
--------------------------------------------------*/
USHORT SwView::GetMoveType()
{
return nMoveType;
}
/*-----------------20.02.97 09:11-------------------
--------------------------------------------------*/
void SwView::SetMoveType(USHORT nSet)
{
BOOL bLastPage = nMoveType == NID_PGE;
nMoveType = nSet;
BOOL bNewPage = nMoveType == NID_PGE;
if(bNewPage != bLastPage)
{
Color aColor(bNewPage ? COL_BLACK : VIEW_IMAGECOLOR);
const TypeId aTypeId = TYPE(SwView);
SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
while( pView )
{
pView->SetImageButtonColor(aColor);
pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
}
}
}
/*-----------------20.06.97 11:18-------------------
--------------------------------------------------*/
void SwView::SetActMark(sal_Int32 nSet)
{
nActMark = nSet;
}
/*-----------------15.03.97 10:53-------------------
--------------------------------------------------*/
void SwView::SetImageButtonColor(Color& rColor)
{
if(pPageUpBtn)
{
pPageUpBtn->SetControlForeground(rColor);
pPageDownBtn->SetControlForeground(rColor);
}
}
/* -----------------------------2002/06/26 13:57------------------------------
---------------------------------------------------------------------------*/
void SwView::ShowHScrollbar(sal_Bool bShow)
{
DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
pHScrollbar->ExtendedShow(bShow);
}
/* -----------------------------2002/06/26 13:57------------------------------
---------------------------------------------------------------------------*/
sal_Bool SwView::IsHScrollbarVisible()const
{
DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
return pHScrollbar->IsVisible( FALSE ) || pHScrollbar->IsAuto();
}
/* -----------------------------2002/06/26 13:57------------------------------
---------------------------------------------------------------------------*/
void SwView::ShowVScrollbar(sal_Bool bShow)
{
DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
pVScrollbar->ExtendedShow(bShow);
pPageUpBtn->Show(bShow);
pPageDownBtn->Show(bShow);
pNaviBtn->Show(bShow);
}
/* -----------------------------2002/06/26 13:57------------------------------
---------------------------------------------------------------------------*/
sal_Bool SwView::IsVScrollbarVisible()const
{
DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
return pVScrollbar->IsVisible( FALSE );
}