2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 19:24:36 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 19:24:36 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 19:24:36 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 19:24:36 +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.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 19:24:36 +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).
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 19:24:36 +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.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _SWPVIEW_HXX
|
|
|
|
#define _SWPVIEW_HXX
|
|
|
|
|
|
|
|
#include <tools/link.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
2004-08-23 08:01:09 +00:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#include <sfx2/viewfac.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <sfx2/viewsh.hxx>
|
2012-06-12 19:04:05 +02:00
|
|
|
#include <sfx2/zoomitem.hxx>
|
2004-08-23 08:01:09 +00:00
|
|
|
#include "swdllapi.h"
|
|
|
|
#include "shellid.hxx"
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
class SwViewOption;
|
|
|
|
class SwDocShell;
|
|
|
|
class SwScrollbar;
|
|
|
|
class ViewShell;
|
|
|
|
class SwPagePreView;
|
|
|
|
class ImageButton;
|
|
|
|
class Button;
|
|
|
|
class SwRect;
|
|
|
|
class DataChangedEvent;
|
|
|
|
class CommandEvent;
|
2002-05-06 11:11:40 +00:00
|
|
|
class SvtAccessibilityOptions;
|
2003-03-27 14:45:43 +00:00
|
|
|
// OD 12.12.2002 #103492#
|
|
|
|
class SwPagePreviewLayout;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-04-17 09:15:55 +00:00
|
|
|
// OD 24.03.2003 #108282# - delete member <mnVirtPage> and its accessor.
|
2000-09-18 16:15:01 +00:00
|
|
|
class SwPagePreViewWin : public Window
|
|
|
|
{
|
2002-12-03 14:21:46 +00:00
|
|
|
ViewShell* mpViewShell;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 mnSttPage;
|
|
|
|
sal_uInt8 mnRow, mnCol;
|
2003-03-27 14:45:43 +00:00
|
|
|
Size maPxWinSize;
|
2002-12-03 14:21:46 +00:00
|
|
|
Fraction maScale;
|
|
|
|
SwPagePreView& mrView;
|
|
|
|
// OD 02.12.2002 #103492#
|
|
|
|
bool mbCalcScaleForPreviewLayout;
|
|
|
|
Rectangle maPaintedPreviewDocRect;
|
2003-03-27 14:45:43 +00:00
|
|
|
// OD 12.12.2002 #103492#
|
|
|
|
SwPagePreviewLayout* mpPgPrevwLayout;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2007-10-22 14:22:44 +00:00
|
|
|
using Window::Scroll;
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
|
|
|
SwPagePreViewWin( Window* pParent, SwPagePreView& rView );
|
|
|
|
~SwPagePreViewWin();
|
|
|
|
|
2011-04-21 18:12:29 +02:00
|
|
|
// calls ViewShell::Paint
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual void Paint( const Rectangle& rRect );
|
|
|
|
virtual void KeyInput( const KeyEvent & );
|
|
|
|
virtual void Command( const CommandEvent& rCEvt );
|
|
|
|
virtual void MouseButtonDown(const MouseEvent& rMEvt);
|
|
|
|
virtual void DataChanged( const DataChangedEvent& );
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
void SetViewShell( ViewShell* pShell );
|
|
|
|
|
2002-12-03 14:21:46 +00:00
|
|
|
ViewShell* GetViewShell() const { return mpViewShell; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 GetRow() const { return mnRow; }
|
|
|
|
void SetRow( sal_uInt8 n ) { if( n ) mnRow = n; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 GetCol() const { return mnCol; }
|
|
|
|
void SetCol( sal_uInt8 n ) { if( n ) mnCol = n; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 GetSttPage() const { return mnSttPage; }
|
|
|
|
void SetSttPage( sal_uInt16 n ) { mnSttPage = n; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
/** get selected page number of document preview
|
|
|
|
|
|
|
|
OD 13.12.2002 #103492#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
|
|
|
|
@return selected page number
|
|
|
|
*/
|
|
|
|
sal_uInt16 SelectedPage() const;
|
|
|
|
|
|
|
|
/** set selected page number in document preview
|
|
|
|
|
|
|
|
OD 13.12.2002 #103492#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
|
|
|
|
@param _nSelectedPageNum
|
|
|
|
input parameter - physical page number of page that will be the selected one.
|
|
|
|
*/
|
|
|
|
void SetSelectedPage( sal_uInt16 _nSelectedPageNum );
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
//JP 19.08.98: bei Einspaltigkeit gibt es keine 0. Seite!
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 GetDefSttPage() const { return 1 == mnCol ? 1 : 0; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-12-03 14:21:46 +00:00
|
|
|
const Size& GetWinSize() const { return maPxWinSize; }
|
2000-09-18 16:15:01 +00:00
|
|
|
void SetWinSize( const Size& rNewSize );
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
// OD 18.12.2002 #103492# - add <MV_SELPAGE>, <MV_SCROLL>
|
|
|
|
enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END,
|
|
|
|
MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE };
|
2000-09-18 16:15:01 +00:00
|
|
|
int MovePage( int eMoveMode );
|
|
|
|
|
|
|
|
// erzeuge den String fuer die StatusLeiste
|
2011-01-17 15:06:54 +01:00
|
|
|
void GetStatusStr( String& rStr, sal_uInt16 nPageCount ) const;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
void RepaintCoreRect( const SwRect& rRect );
|
2002-05-22 10:48:43 +00:00
|
|
|
|
2002-12-03 14:21:46 +00:00
|
|
|
/** method to adjust preview to a new zoom factor
|
|
|
|
|
|
|
|
OD 02.12.2002 #103492#
|
2003-03-27 14:45:43 +00:00
|
|
|
paint of preview is prepared for a new zoom factor
|
2003-12-01 08:46:39 +00:00
|
|
|
OD 24.09.2003 #i19975# - zoom type has also been considered.
|
|
|
|
Thus, add new parameter <_eZoomType>
|
2002-12-03 14:21:46 +00:00
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2003-12-01 08:46:39 +00:00
|
|
|
void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
|
|
|
|
const SvxZoomType _eZoomType );
|
2002-12-06 15:25:21 +00:00
|
|
|
|
2004-04-21 08:41:25 +00:00
|
|
|
const Rectangle& GetPaintedPreviewDocRect() const
|
|
|
|
{
|
|
|
|
return maPaintedPreviewDocRect;
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void Scroll(long nXMove, long nYMove, sal_uInt16 nFlags = 0);
|
2004-04-21 08:41:25 +00:00
|
|
|
|
|
|
|
/** method to enable/disable book preview
|
|
|
|
|
|
|
|
OD 2004-03-05 #i18143#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
|
|
|
|
@param _bBookPreview
|
|
|
|
input parameter - boolean indicating, if book preview mode has to
|
2011-01-17 15:06:54 +01:00
|
|
|
switch on <sal_True> or of <sal_False>
|
2004-04-21 08:41:25 +00:00
|
|
|
|
|
|
|
@return boolean indicating, if book preview mode has changed.
|
|
|
|
*/
|
|
|
|
bool SetBookPreviewMode( const bool _bBookPreview );
|
2002-12-03 14:21:46 +00:00
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
virtual ::com::sun::star::uno::Reference<
|
2003-04-24 15:14:54 +00:00
|
|
|
::com::sun::star::accessibility::XAccessible>
|
2002-05-22 10:48:43 +00:00
|
|
|
CreateAccessible();
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
2011-04-21 18:12:29 +02:00
|
|
|
Description: view of a document
|
2000-09-18 16:15:01 +00:00
|
|
|
--------------------------------------------------------------------*/
|
2004-08-23 08:01:09 +00:00
|
|
|
class SW_DLLPUBLIC SwPagePreView: public SfxViewShell
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-04-21 18:12:29 +02:00
|
|
|
// ViewWindow and handle to core
|
|
|
|
// current dispatcher shell
|
2000-09-18 16:15:01 +00:00
|
|
|
SwPagePreViewWin aViewWin;
|
|
|
|
//viewdata of the previous SwView and the new crsrposition
|
|
|
|
String sSwViewData,
|
|
|
|
//and the new cursor position if the user double click in the PagePreView
|
|
|
|
sNewCrsrPos;
|
2002-03-15 06:33:34 +00:00
|
|
|
// to support keyboard the number of the page to go to can be set too
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nNewPage;
|
2011-04-21 18:12:29 +02:00
|
|
|
// visible range
|
2000-09-18 16:15:01 +00:00
|
|
|
String sPageStr;
|
|
|
|
Size aDocSz;
|
|
|
|
Rectangle aVisArea;
|
|
|
|
|
2011-04-21 18:12:29 +02:00
|
|
|
// MDI control elements
|
2000-09-18 16:15:01 +00:00
|
|
|
SwScrollbar *pHScrollbar;
|
|
|
|
SwScrollbar *pVScrollbar;
|
|
|
|
ImageButton *pPageUpBtn,
|
|
|
|
*pPageDownBtn;
|
2011-04-21 18:12:29 +02:00
|
|
|
// dummy window for filling the lower right edge when both scrollbars are active
|
2000-09-18 16:15:01 +00:00
|
|
|
Window *pScrollFill;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 mnPageCount;
|
|
|
|
sal_Bool bNormalPrint;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
// OD 09.01.2003 #106334#
|
|
|
|
// new members to reset design mode at draw view for form shell on switching
|
|
|
|
// back from writer page preview to normal view.
|
|
|
|
sal_Bool mbResetFormDesignMode:1;
|
|
|
|
sal_Bool mbFormDesignModeToReset:1;
|
|
|
|
|
2004-08-23 08:01:09 +00:00
|
|
|
SW_DLLPRIVATE void Init(const SwViewOption* = 0);
|
|
|
|
SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SW_DLLPRIVATE int _CreateScrollbar( sal_Bool bHori );
|
2004-08-23 08:01:09 +00:00
|
|
|
SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
|
|
|
|
SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
|
|
|
|
SW_DLLPRIVATE DECL_LINK( BtnPage, Button * );
|
2011-01-17 15:06:54 +01:00
|
|
|
SW_DLLPRIVATE int ChgPage( int eMvMode, int bUpdateScrollbar = sal_True );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( sal_Bool bCreate = sal_False );
|
|
|
|
SW_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
|
2004-08-23 08:01:09 +00:00
|
|
|
SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent,
|
2000-09-18 16:15:01 +00:00
|
|
|
const SfxItemSet &rOptions );
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool bInner );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
/** help method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN
|
|
|
|
|
|
|
|
OD 04.03.2003 #107369#
|
|
|
|
|
|
|
|
@param _bPgUp
|
|
|
|
input parameter - boolean that indicates, if FN_PAGE_UP or FN_PAGE_DOWN
|
|
|
|
has to be executed.
|
|
|
|
|
|
|
|
@param _pReq
|
|
|
|
optional input parameter - pointer to the <SfxRequest> instance, if existing.
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2004-08-23 08:01:09 +00:00
|
|
|
SW_DLLPRIVATE void _ExecPgUpAndPgDown( const bool _bPgUp,
|
2003-03-27 14:45:43 +00:00
|
|
|
SfxRequest* _pReq = 0 );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
|
|
|
|
virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
|
|
|
|
virtual Size GetOptimalSizePixel() const;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetZoom(SvxZoomType eSet, sal_uInt16 nFactor);
|
2002-11-27 08:01:27 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
|
|
|
SFX_DECL_VIEWFACTORY(SwPagePreView);
|
2007-09-27 11:08:14 +00:00
|
|
|
SFX_DECL_INTERFACE(SW_PAGEPREVIEW)
|
2000-09-18 16:15:01 +00:00
|
|
|
TYPEINFO();
|
|
|
|
|
|
|
|
inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
|
2002-12-04 11:17:32 +00:00
|
|
|
inline ViewShell* GetViewShell() const { return aViewWin.GetViewShell(); }
|
2000-09-18 16:15:01 +00:00
|
|
|
inline const Rectangle& GetVisArea() const { return aVisArea; }
|
|
|
|
inline void GrabFocusViewWin() { aViewWin.GrabFocus(); }
|
|
|
|
inline void RepaintCoreRect( const SwRect& rRect )
|
|
|
|
{ aViewWin.RepaintCoreRect( rRect ); }
|
|
|
|
|
|
|
|
void DocSzChgd(const Size& rNewSize);
|
|
|
|
const Size& GetDocSz() const { return aDocSz; }
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual void SetVisArea( const Rectangle&, sal_Bool bUpdateScrollbar = sal_True);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
inline void AdjustEditWin();
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
void ScrollViewSzChg();
|
|
|
|
void ScrollDocSzChg();
|
2002-06-28 11:11:19 +00:00
|
|
|
void ShowHScrollbar(sal_Bool bShow);
|
|
|
|
|
|
|
|
void ShowVScrollbar(sal_Bool bShow);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 GetPageCount() const { return mnPageCount; }
|
2011-11-16 15:47:51 +04:00
|
|
|
sal_uInt16 GetSelectedPage() const {return aViewWin.SelectedPage();}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool HandleWheelCommands( const CommandEvent& );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
const String& GetPrevSwViewData() const { return sSwViewData; }
|
|
|
|
void SetNewCrsrPos( const String& rStr ) { sNewCrsrPos = rStr; }
|
|
|
|
const String& GetNewCrsrPos() const { return sNewCrsrPos; }
|
2002-03-15 06:33:34 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 GetNewPage() const {return nNewPage;}
|
|
|
|
void SetNewPage(sal_uInt16 nSet) {nNewPage = nSet;}
|
2002-03-15 06:33:34 +00:00
|
|
|
|
2011-04-21 18:12:29 +02:00
|
|
|
// handler
|
2000-09-18 16:15:01 +00:00
|
|
|
void Execute(SfxRequest&);
|
|
|
|
void GetState(SfxItemSet&);
|
|
|
|
void StateUndo(SfxItemSet&);
|
|
|
|
|
|
|
|
SwDocShell* GetDocShell();
|
|
|
|
|
2002-05-06 11:11:40 +00:00
|
|
|
//apply Accessiblity options
|
|
|
|
void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
// OD 09.01.2003 #106334# - inline method to request values of new members
|
|
|
|
// <mbResetFormDesignMode> and <mbFormDesignModeToReset>
|
|
|
|
inline sal_Bool ResetFormDesignMode() const
|
|
|
|
{
|
|
|
|
return mbResetFormDesignMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline sal_Bool FormDesignModeToReset() const
|
|
|
|
{
|
|
|
|
return mbFormDesignModeToReset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** adjust position of vertical scrollbar
|
|
|
|
|
|
|
|
OD 19.02.2003 #107369
|
|
|
|
Currently used, if the complete preview layout rows fit into to the given
|
|
|
|
window, if a new page is selected and this page is visible.
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
|
|
|
|
@param _nNewThumbPos
|
|
|
|
input parameter - new position, which will be assigned to the vertical
|
|
|
|
scrollbar.
|
|
|
|
*/
|
|
|
|
void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
SwPagePreView( SfxViewFrame* pFrame, SfxViewShell* );
|
|
|
|
~SwPagePreView();
|
|
|
|
};
|
|
|
|
|
2011-04-21 18:12:29 +02:00
|
|
|
// ----------------- inline methods ----------------------
|
2000-09-18 16:15:01 +00:00
|
|
|
inline void SwPagePreView::AdjustEditWin()
|
|
|
|
{
|
|
|
|
OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|