Files
libreoffice/sw/source/ui/inc/pview.hxx

303 lines
11 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SW_SOURCE_UI_INC_PVIEW_HXX
#define INCLUDED_SW_SOURCE_UI_INC_PVIEW_HXX
2000-09-18 16:15:01 +00:00
#include <tools/link.hxx>
#include <vcl/window.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewfac.hxx>
2000-09-18 16:15:01 +00:00
#include <sfx2/viewsh.hxx>
#include <sfx2/zoomitem.hxx>
#include "swdllapi.h"
#include "shellid.hxx"
2000-09-18 16:15:01 +00:00
class SwViewOption;
class SwDocShell;
class SwScrollbar;
class SwViewShell;
class SwPagePreview;
2000-09-18 16:15:01 +00:00
class ImageButton;
class Button;
class SwRect;
class DataChangedEvent;
class CommandEvent;
class SvtAccessibilityOptions;
class SwPagePreviewLayout;
2000-09-18 16:15:01 +00:00
// Delete member <mnVirtPage> and its accessor
class SwPagePreviewWin : public Window
2000-09-18 16:15:01 +00:00
{
SwViewShell* mpViewShell;
sal_uInt16 mnSttPage;
sal_uInt8 mnRow, mnCol;
Size maPxWinSize;
Fraction maScale;
SwPagePreview& mrView;
bool mbCalcScaleForPreviewLayout;
Rectangle maPaintedPreviewDocRect;
SwPagePreviewLayout* mpPgPreviewLayout;
2000-09-18 16:15:01 +00:00
void SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol );
2000-09-18 16:15:01 +00:00
using Window::Scroll;
2000-09-18 16:15:01 +00:00
public:
SwPagePreviewWin( Window* pParent, SwPagePreview& rView );
~SwPagePreviewWin();
2000-09-18 16:15:01 +00:00
// calls SwViewShell::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& );
void SetViewShell( SwViewShell* pShell );
SwViewShell* GetViewShell() const { return mpViewShell; }
2000-09-18 16:15:01 +00:00
sal_uInt8 GetRow() const { return mnRow; }
void SetRow( sal_uInt8 n ) { if( n ) mnRow = n; }
2000-09-18 16:15:01 +00:00
sal_uInt8 GetCol() const { return mnCol; }
void SetCol( sal_uInt8 n ) { if( n ) mnCol = n; }
2000-09-18 16:15:01 +00:00
sal_uInt16 GetSttPage() const { return mnSttPage; }
void SetSttPage( sal_uInt16 n ) { mnSttPage = n; }
2000-09-18 16:15:01 +00:00
/** get selected page number of document preview
@return selected page number
*/
sal_uInt16 SelectedPage() const;
/** set selected page number in document preview
@param _nSelectedPageNum
input parameter - physical page number of page that will be the selected one.
*/
void SetSelectedPage( sal_uInt16 _nSelectedPageNum );
// If we only have one column we do not have a oth page
sal_uInt16 GetDefSttPage() const { return 1 == mnCol ? 1 : 0; }
2000-09-18 16:15:01 +00:00
void CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol );
2000-09-18 16:15:01 +00:00
const Size& GetWinSize() const { return maPxWinSize; }
2000-09-18 16:15:01 +00:00
void SetWinSize( const Size& rNewSize );
// 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 );
// Create the status bar's string
OUString GetStatusStr( 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
/** Method to adjust preview to a new zoom factor
paint of preview is prepared for a new zoom factor
Zoom type has also been considered.
Thus, add new parameter <_eZoomType>
*/
void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
const SvxZoomType _eZoomType );
2002-12-06 15:25:21 +00:00
const Rectangle& GetPaintedPreviewDocRect() const
{
return maPaintedPreviewDocRect;
}
void Scroll(long nXMove, long nYMove, sal_uInt16 nFlags = 0);
/** Method to enable/disable book preview
@param _bBookPreview
input parameter - boolean indicating, if book preview mode has to
switch on <sal_True> or of <sal_False>
@return boolean indicating, if book preview mode has changed.
*/
bool SetBookPreviewMode( const bool _bBookPreview );
2002-05-22 10:48:43 +00:00
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>
2002-05-22 10:48:43 +00:00
CreateAccessible();
virtual void SwitchView();
2000-09-18 16:15:01 +00:00
};
/**
* View of a document
*/
class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
2000-09-18 16:15:01 +00:00
{
// ViewWindow and handle to core
// current dispatcher shell
SwPagePreviewWin* pViewWin;
2000-09-18 16:15:01 +00:00
//viewdata of the previous SwView and the new crsrposition
OUString sSwViewData;
//and the new cursor position if the user double click in the PagePreview
OUString sNewCrsrPos;
// to support keyboard the number of the page to go to can be set too
sal_uInt16 nNewPage;
// visible range
OUString sPageStr;
2000-09-18 16:15:01 +00:00
Size aDocSz;
Rectangle aVisArea;
// MDI control elements
2000-09-18 16:15:01 +00:00
SwScrollbar *pHScrollbar;
SwScrollbar *pVScrollbar;
bool mbHScrollbarEnabled;
bool mbVScrollbarEnabled;
2000-09-18 16:15:01 +00:00
ImageButton *pPageUpBtn,
*pPageDownBtn;
// dummy window for filling the lower right edge when both scrollbars are active
2000-09-18 16:15:01 +00:00
Window *pScrollFill;
sal_uInt16 mnPageCount;
sal_Bool bNormalPrint;
2000-09-18 16:15:01 +00:00
// 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;
SW_DLLPRIVATE void Init(const SwViewOption* = 0);
SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
2000-09-18 16:15:01 +00:00
SW_DLLPRIVATE int _CreateScrollbar( sal_Bool bHori );
SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
SW_DLLPRIVATE DECL_LINK( BtnPage, Button * );
SW_DLLPRIVATE bool ChgPage( int eMvMode, int bUpdateScrollbar = sal_True );
2000-09-18 16:15:01 +00: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 );
SW_DLLPRIVATE virtual bool HasPrintOptionsPage() const;
SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent,
2000-09-18 16:15:01 +00:00
const SfxItemSet &rOptions );
SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool bInner );
2000-09-18 16:15:01 +00:00
/** Helper method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN
@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.
*/
SW_DLLPRIVATE void _ExecPgUpAndPgDown( const bool _bPgUp,
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 );
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);
SFX_DECL_INTERFACE(SW_PAGEPREVIEW)
2000-09-18 16:15:01 +00:00
TYPEINFO();
inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
inline SwViewShell* GetViewShell() const { return pViewWin->GetViewShell(); }
2000-09-18 16:15:01 +00:00
inline const Rectangle& GetVisArea() const { return aVisArea; }
inline void GrabFocusViewWin() { pViewWin->GrabFocus(); }
2000-09-18 16:15:01 +00:00
inline void RepaintCoreRect( const SwRect& rRect )
{ pViewWin->RepaintCoreRect( rRect ); }
2000-09-18 16:15:01 +00:00
void DocSzChgd(const Size& rNewSize);
const Size& GetDocSz() const { return aDocSz; }
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();
void ShowHScrollbar(sal_Bool bShow);
void ShowVScrollbar(sal_Bool bShow);
void EnableHScrollbar(bool bEnable);
void EnableVScrollbar(bool bEnable);
2000-09-18 16:15:01 +00:00
sal_uInt16 GetPageCount() const { return mnPageCount; }
sal_uInt16 GetSelectedPage() const {return pViewWin->SelectedPage();}
2000-09-18 16:15:01 +00:00
sal_Bool HandleWheelCommands( const CommandEvent& );
2000-09-18 16:15:01 +00:00
OUString GetPrevSwViewData() const { return sSwViewData; }
void SetNewCrsrPos( const OUString& rStr ) { sNewCrsrPos = rStr; }
const OUString& GetNewCrsrPos() const { return sNewCrsrPos; }
sal_uInt16 GetNewPage() const {return nNewPage;}
void SetNewPage(sal_uInt16 nSet) {nNewPage = nSet;}
// Handler
2000-09-18 16:15:01 +00:00
void Execute(SfxRequest&);
void GetState(SfxItemSet&);
void StateUndo(SfxItemSet&);
SwDocShell* GetDocShell();
// apply Accessiblity options
void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
// 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
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.
@param _nNewThumbPos
input parameter - new position, which will be assigned to the vertical
scrollbar.
*/
void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
SwPagePreview( SfxViewFrame* pFrame, SfxViewShell* );
~SwPagePreview();
2000-09-18 16:15:01 +00:00
};
// ----------------- inline methods ----------------------
inline void SwPagePreview::AdjustEditWin()
2000-09-18 16:15:01 +00:00
{
OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */