2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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 .
|
|
|
|
*/
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2006-09-16 22:22:36 +00:00
|
|
|
|
2004-10-04 18:31:48 +00:00
|
|
|
#include <sfx2/objface.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <vcl/timer.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <vcl/field.hxx>
|
|
|
|
#include <vcl/fixed.hxx>
|
|
|
|
#include <vcl/help.hxx>
|
|
|
|
#include <vcl/cmdevt.hxx>
|
|
|
|
#include <vcl/button.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/whiter.hxx>
|
|
|
|
#include <svl/stritem.hxx>
|
|
|
|
#include <svl/eitem.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <sfx2/printer.hxx>
|
2009-07-28 09:43:30 +00:00
|
|
|
#include <sfx2/progress.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
2002-11-27 08:01:27 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <svx/stddlg.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/paperinf.hxx>
|
2009-12-10 23:06:35 +01:00
|
|
|
#include <svl/srchitem.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <svx/svdview.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <svx/dlgutil.hxx>
|
2008-03-07 14:06:36 +00:00
|
|
|
#include <svx/zoomslideritem.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <svx/svxids.hrc>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <swwait.hxx>
|
|
|
|
#include <globdoc.hxx>
|
|
|
|
#include <wdocsh.hxx>
|
|
|
|
#include <pvprtdat.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <swmodule.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <modcfg.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <wrtsh.hxx>
|
|
|
|
#include <docsh.hxx>
|
|
|
|
#include <viewopt.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <pview.hxx>
|
|
|
|
#include <view.hxx>
|
|
|
|
#include <textsh.hxx>
|
|
|
|
#include <scroll.hxx>
|
2010-09-30 16:03:07 +02:00
|
|
|
#include <prtopt.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <docstat.hxx>
|
|
|
|
#include <usrpref.hxx>
|
|
|
|
#include <viewfunc.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <helpid.h>
|
|
|
|
#include <cmdid.h>
|
|
|
|
#include <globals.hrc>
|
|
|
|
#include <popup.hrc>
|
2013-04-25 12:27:59 +01:00
|
|
|
#include <view.hrc>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
#define SwPagePreview
|
CWS-TOOLING: integrate CWS odfmetadata2
2009-06-22 11:48:36 +0200 mst r273206 : - connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx:
+ add "include ustrbuf.hxx" to work around warning caused by
solaris <sys/kstat.h> declaring a global "long l ;"
2009-06-19 14:25:25 +0200 mst r273159 : - scp2/source/ooo/file_library_ooo.scp:
+ fix MinGW build
2009-06-08 12:52:33 +0200 mst r272727 : - redland/raptor-1.4.18.patch.mingw, redland/raptor/makefile.mk:
+ disable parsers that do not build on MinGW (thanks for patch by tono)
2009-05-15 17:31:07 +0200 mst r271957 : fix typos
2009-05-15 17:28:57 +0200 mst r271956 : #i101965#
- offapi/com/sun/star/text/TextPortion:
+ add missing properties:
SoftPageBreak, DocumentIndexMark, ReferenceMark, Footnote, TextField
+ fix read-only status of properties: Bookmark, IsStart, IsCollapsed
- offapi/type_reference/{typelibrary_history.txt,types.rdb}:
+ update reference types.rdb
2009-05-07 14:41:38 +0200 mst r271669 : - sw/inc/{fmtftn.hxx,unocoll.hxx,doc.hxx,editsh.hxx,ftninfo.hxx},
sw/source/core/layout/{flowfrm.cxx,ftnfrm.cxx},
sw/source/core/doc/docftn.cxx, sw/source/core/edit/edattr.cxx,
sw/source/core/txtnode/atrftn.cxx, sw/source/core/unocore/unocoll.cxx,
sw/source/ui/fldui/fldref.cxx:
+ fix warning ... the hard way
+ also fix signature of SwDoc::SetCurFtn
2009-05-05 19:52:55 +0200 mst r271556 : - sw/inc/undobj.hxx:
+ make some members const
2009-05-05 19:34:40 +0200 mst r271555 : - sw/inc/rolbck.hxx, sw/source/core/undo/rolbck.cxx:
+ make some members const
2009-05-05 19:13:14 +0200 mst r271553 : - sw/inc/{undobj.hxx,rolbck.hxx},
sw/source/core/undo/{unbkmk.cxx,rolbck.cxx}:
+ fix rebase merge error
+ rename SwHstryBookmark to SwHistoryBookmark
+ clean up SwUndoBookmark
2009-05-05 19:05:53 +0200 mst r271552 : - sw/source/core/unocore/unoportenum.cxx:
+ fix annoying assertion
2009-05-05 15:34:48 +0200 mst r271522 : CWS-TOOLING: rebase CWS odfmetadata2 to trunk@271427 (milestone: DEV300:m47)
2009-05-04 12:37:01 +0200 mst r271444 : trivial
2009-04-22 13:30:37 +0200 mst r271102 : - sfx2/inc/sfx2/dinfdlg.hxx:
+ trivial change
2009-04-21 16:46:58 +0200 mst r271043 : - sw/inc/hintids.hxx:
+ introduce some predicates for the various hints, and use them
2009-04-21 16:19:03 +0200 mst r271041 : - sw/inc/undobj.hxx,
sw/source/core/doc/{docfly.cxx,docfmt.cxx,docftn.cxx,doctxm.cxx},
sw/source/core/undo/{unattr.cxx,unins.cxx}:
+ clean up unattr.cxx:
remove/fix casts, prefix members, use auto_ptr, etc.
2009-04-21 15:34:23 +0200 mst r271039 : - sw/inc/{rolbck.hxx,undobj.hxx},
sw/source/core/doc/docfmt.cxx,
sw/source/core/txtnode/{thints.cxx,txtedt.cxx},
sw/source/core/undo/{rolbck.cxx,undel.cxx,undobj.cxx,unins.cxx,unmove.cxx,
unovwr.cxx,unsect.cxx,unspnd.cxx,untbl.cxx,untblk.cxx,unattr.cxx}:
+ clean up SwHistory, SwRegHistory and SwHistoryHint etc.:
remove/fix casts, prefix members, remove wrong const annotations,
use auto_ptr, remove unused members, etc.
2009-04-20 19:17:36 +0200 mst r271013 : - sw/inc/ndhints.hxx,
sw/source/core/text/{itrtxt.cxx,txtftn.cxx,itratr.cxx,porfly.cxx,
txtfrm.cxx,txtdrop.cxx,frmform.cxx},
sw/source/core/txtnode/{ndtxt.cxx,ndhints.cxx,thints.cxx,txtedt.cxx},
sw/source/core/edit/acorrect.cxx,
sw/source/core/doc/{docedt.cxx,docfmt.cxx},
sw/source/filter/html/swhtml.cxx:
+ clean up SwHintsArray and its subclasses: remove/fix casts, prefix members
2009-04-20 18:42:07 +0200 mst r271007 : - sw/source/core/text/txtio.cxx, sw/source/core/edit/edattr.cxx,
sw/source/core/undo/rolbck.cxx:
+ remove JP_NEWCORE dead code
2009-04-20 18:38:09 +0200 mst r271006 : - sw/source/core/unocore/unochart.cxx:
+ silence unxlngi warning (debug=t)
2009-04-20 16:36:13 +0200 mst r270991 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx,
sfx2/source/doc/objserv.cxx, sw/source/ui/fldui/flddinf.hxx:
+ trivial cleanups
2009-04-20 15:28:52 +0200 mst r270990 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx,
sfx2/source/doc/objserv.cxx:
+ fix bug: replaying a macro with a DocumentInfoItem removes all
user-defined properties
2009-03-10 15:08:20 +0100 mst r269273 : - sfx2/source/doc/Metadatable.cxx:
+ add missing SolarMutex guards
2009-03-10 14:46:29 +0100 mst r269272 : - unoxml/source/rdf/librdf_repository.cxx:
+ never free rdf_world because that would call libxm2 xmlCleanupParser
(and, to add insult to injury, other libxml2 functions later...)
2009-03-06 19:02:44 +0100 mst r269041 : argh! undo...
2009-03-06 19:00:58 +0100 mst r269040 : fix #i99931#
- sw/source/ui/uno/unomod.cxx:
+ SwXViewSettings::_getSingleValue returns uninitialized memory
for the ZoomType property if the value is PAGE_WIDTH_EXACT
2009-03-06 18:59:28 +0100 mst r269039 : - sw/inc/ndtxt.hxx, sw/source/core/txtnode/ndtxt.cxx,
sw/source/core/unocore/unoportenum.cxx:
+ fix some more wntmsci12 warnings...
2009-03-06 18:56:46 +0100 mst r269038 : - sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx:
+ work around spurious warning on unxsoli4 debug=t
2009-03-05 14:02:01 +0100 mst r268902 : - sw/inc/txatbase.hxx:
+ back to c-style casts, they also compile on wntmsci12...
2009-03-05 10:23:25 +0100 mst r268882 : - comphelper/inc/comphelper/processfactory.hxx,
comphelper/source/processfactory/processfactory.cxx:
+ revert change of return type of comphelper_getProcessComponentContext
to Reference: does not build on wntmsci12
2009-03-04 19:08:09 +0100 mst r268861 : - sw/source/core/txtnode/{atrtox.cxx,ndtxt.cxx}:
+ fix initialization
2009-03-04 14:37:30 +0100 mst r268831 : - solenv/inc/target.mk:
+ fix CLASSPATH so complex tests run (fix by sb)
2009-03-04 14:36:30 +0100 mst r268830 : - sw/inc/unoobj.hxx,
sw/source/core/unocore/{unoparagraph.cxx,unoobj.cxx,unoobj2.cxx}:
+ SwXParaFrameEnumeration constructor now takes SwPaM, not SwUnoCrsr
+ move SwParaSelection into unoparagraph.cxx, as it is only used there
+ bugfix: replace SwUnoCrsrs on stack with SwCursors
2009-03-04 14:34:46 +0100 mst r268829 : - sw/inc/pam.hxx, sw/source/core/crsr/pam.cxx,
sw/source/core/edit/eddel.cxx, sw/source/core/doc/docredln.cxx,
sw/source/core/undo/{untbl.cxx,undel.cxx}, sw/source/filter/rtf/swparrtf.cxx:
+ clean up SwPaM: prefix members
+ new constructor SwPosition(SwCntntNode&, xub_StrLen)
+ fix several broken SwPosition and SwPaM constructors
+ SwPam::DeleteMark now actually resets the unused position to default
2009-03-02 12:07:09 +0100 mst r268646 : - sw/inc/fmtcol.hxx:
+ fix annoying warning (gcc 4)
2009-03-02 12:06:27 +0100 mst r268645 : - odk/util/check.pl, odk/examples/DevelopersGuide/Text/TextDocuments.java:
+ rename module from FieldMaster to fieldmaster
2009-02-27 19:49:56 +0100 mst r268614 : - sfx2/inc/sfx2/Metadatable.hxx, sfx2/prj/d.lst,
sfx2/source/doc/{Metadatable.cxx,makefile.mk},
sw/inc/{SwMetadatable.hxx,unoobj.hxx,undobj.hxx,ndtxt.hxx},
sw/source/core/doc/{SwMetadatable.cxx,makefile.mk,docnew.cxx},
sw/source/core/undo/{untbl.cxx,unins.cxx},
sw/source/core/unocore/unoparagraph.cxx, sw/source/ui/app/docsh.cxx:
+ move Metadatable implementation from sw to sfx2
2009-02-27 17:58:55 +0100 mst r268608 : - sw/inc/{SwMetadatable.hxx,undobj.hxx}, sw/source/core/doc/SwMetadatable.cxx,
sw/source/core/undo/{untbl.cxx,unins.cxx,undel.cxx}:
+ CreateUndo now returns an opaque MetadatableUndo object
2009-02-27 13:15:44 +0100 mst r268587 : - sw/inc/ndtxt.hxx, sw/source/core/doc/docfmt.cxx,
sw/source/core/text/{itratr.cxx,porlay.cxx},
sw/source/core/txtnode/{txtedt.cxx,ndtxt.cxx,thints.cxx}:
+ clean up SwTxtNode: fix casts, prefix members
+ factor out inline function SwTxtNode::TryDeleteSwpHints()
2009-02-27 13:14:30 +0100 mst r268586 : - svx/inc/svx/emphitem.hxx:
+ fix borken header guard
2009-02-27 13:13:56 +0100 mst r268585 : - sfx2/source/bastyp/progress.cxx:
+ fix use of compiler specific macro
2009-02-27 11:00:32 +0100 mst r268564 : - sw/inc/{txatbase.hxx,txtatr.hxx,txtinet.hxx,txtfld.hxx,txtftn.hxx,
txtflcnt.hxx,txttxmrk.hxx,txtrfmrk.hxx},
sw/source/core/txtnode/{atrtox.cxx,atrref.cxx,atrflyin.cxx,atrftn.cxx,
txtatr2.cxx,txatbase.cxx,atrfld.cxx,txtedt.cxx},
sw/source/core/text/atrstck.cxx, sw/source/core/access/acchyperlink.cxx,
sw/source/core/doc/visiturl.cxx, sw/source/ui/wrtsh/wrtsh2.cxx:
+ clean up SwTxtAttr and its subclasses: remove/fix casts, prefix members
+ SwTxtINetFmt: remove unused member bColor
- sw/source/core/text/txtfld.cxx:
+ move SwTxtFld methods to atrfld.cxx
2009-02-27 10:58:44 +0100 mst r268563 : - sfx2/inc/sfx2/sfxbasemodel.hxx:
+ don't privately inherit BaseMutex, ScModelObj wants to access it
2009-02-27 10:58:02 +0100 mst r268562 : - xmloff/source/core/{RDFaExportHelper.cxx,RDFaImportHelper.cxx}:
+ arrrgh!!! someone thought it would be a good idea to have 2 different
versions of boost in external! and they're NOT compatible!!!
insert an ugly fragile hack that maybe works with both...
2009-02-26 17:42:26 +0100 mst r268544 : - comphelper/inc/comphelper/storagehelper.hxx.
sfx2/source/doc/DocumentMetadataAccess.cxx:
+ someone made IsValidZipEntryFileName a static method and didn't tell me
2009-02-26 15:52:56 +0100 mst r268529 : redland: split up patches
2009-02-26 13:17:56 +0100 mst r268509 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
#i95863#
- sw/inc/segdefs{,_}.hxx:
+ remove obsolete files
- sw/source/ui/inc/itemdef.hxx:
+ remove itemdef.hxx
- sw/source/ui/app/[apphdl.cxx,docsh.cxx}, sw/source/ui/misc/glshell.cxx,
sw/source/ui/shells/*.cxx, sw/source/ui/uiview/*.cxx, sw/source/ui/web/*.cxx:
+ use sfx2/msg.hxx instead of itemdef.hxx
- sw/source/core/edit/eddel.cxx:
+ @ JP: SwEditShell::Replace:
you're right, deleting the text to be replaced first, and then inserting
a space, and then replacing that space is unnecessary.
whew, i'm so happy that we finally answered that question after 11 years.
- sw/inc/edimp.hxx:
+ remove FOREACHCURSOR_START, FOREACHCURSOR_END
- sw/inc/{swcrsr.hxx,unocrsr.hxx,viscrs.hxx},
sw/source/core/crsr/{crsrsh.cxx,swcrsr.cxx,trvlreg.cxx,trvltbl.cxx,
unocrsr.cxx,viscrs.cxx},
sw/source/core/doc/{docbm.cxx,doccorr.cxx},
sw/source/core/docnode/{ndtbl.cxx,ndtbl1.cxx},
sw/source/core/edit/editsh.cxx,
sw/source/core/frmedt/{fefly1.cxx,fetab.cxx,tblsel.cxx},
sw/source/core/layout/trvlfrm.cxx,
sw/source/core/unocore/{unochart.cxx,unoobj2.cxx,unoparagraph.cxx,
unoportenum.cxx,unotbl.cxx},
sw/source/core/view/vprint.cxx:
+ remove the hideous virtual operator SwFooCursor*
+ make SwCursor::IsReadOnlyAvailable() virtual
+ make SwUnoCrsr::Clone() virtual
+ refactor SwCursor methods IsSelOver(), LeftRight(), UpDown(), GotoTable():
replace dynamic_cast<...>(this) with new virtual methods
2009-02-26 13:14:58 +0100 mst r268508 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
- sw/source/filter/xml/swxml.cxx:
+ XMLReader::Read: load RDF metadata of the ODF document
- sw/source/filter/xml/wrtxml.cxx:
+ SwXMLWriter::_Write: write RDF metadata of the ODF document if ODF >= 1.2
#i90620#: import xml:id in text tables (does not actually work yet)
- sw/source/filter/xml/xmltbli{.hxx,.cxx}:
+ SwXMLTableCellAttrTokens,aTableCellAttrTokenMap: add XML_TOK_TABLE_XMLID
+ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl: attribute xml:id
+ SwXMLTableCellContext_Impl::CreateChildContext: attribute xml:id
+ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl: attribute xml:id
+ SwXMLTableContext::SwXMLTableContext: attribute xml:id
fix #i98530#
- sw/inc/unoport.hxx, sw/source/core/unocore/unoport.cxx:
+ SwXTextPortion: make constructor params const&
- sw/source/core/unocore/unoportenum.cxx:
+ refactor to remove some code duplication
+ fix bug: paragraph w/out hints: bookmark before frame gets lost
#i97274# handle invalid tables
- sw/source/core/layout/tabfrm.cxx, sw/source/filter/xml/xmltbli.cxx:
+ SwXMLTableContext::MakeTable():
check that the table actually contains cells,
and abort (removing the inserted table nodes) if not
2009-02-26 13:11:48 +0100 mst r268507 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
refactor SwXTextRange and SwXParagraph
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoobj2.cxx:
+ remove 3 constructors of SwXTextRange
+ new method SwXTextRange::CreateParentXText
+ refactor SwXTextRange::CreateTextRangeFromPosition and
SwXTextRange::getText
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx:
+ SwXParagraph no longer uses a cursor; it registers directly at SwTxtNode
+ replace SwXParagraph::GetCrsr with SwXParagraph::GetTxtNode
- sw/source/core/unocore/unotext.cxx, sw/source/ui/uno/unotxvw.cxx:
+ adapt to new SwXParagraph
#i90620#
- sw/inc/SwMetadatable.hxx,
sw/source/core/doc/SwMetadatable.cxx:
+ new files: base classes sw::Metadatable and sw::MetadatableMixin;
also, 2 implementations of IXmlIdRegistry:
sw::XmlIdRegistryDocument and sw::XmlIdRegistryClipboard
+ setMetadataReference: handle empty stream name as auto-detect
- sw/source/core/doc/makefile.mk:
+ add SwMetadatable
add a XmlIdRegistry to SwDoc
- sw/inc/doc.hxx:
+ SwDoc: add member m_pXmlIdRegistry, method GetXmlIdRegistry()
- sw/source/core/doc/docnew.cxx:
+ initialize XmlIdRegistry in SwDoc::GetXmlIdRegistry, not in constructor,
because the constructor is not told whether the SwDoc is a clipboard
- sw/inc/docsh.hxx, sw/source/ui/app/docsh.cxx:
+ SwDocShell: override GetXmlIdRegistry()
#i91563#: make the SwTxtNode metadatable
- sw/inc/ndtxt.hxx
+ SwTxtNode inherits sw::Metadatable
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx:
+ SwXParagraph inherits sw::MetadatableMixin
#i91563#: handle SwTxtNode's metadata for delete
- sw/source/core/txtnode/ndtxt.cxx:
+ SwTxtNode::SplitCntntNode: handle XmlId
+ SwTxtNode::JoinNext: merge XmlIds
- sw/source/core/doc/docedt.cxx:
+ lcl_GetJoinFlags: document postcondition
+ SwDoc::Delete: remove XmlId only if SwTxtNode _becomes_ empty
#i91563#: handle SwTxtNode's metadata for delete with undo
- sw/inc/undobj.hxx
+ SwUndoDelete: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
- sw/source/core/undo/undel.cxx:
+ SwUndoDelete::SaveCntnt: save XmlIds for start and end SwTxtNode
+ SwUndoDelete::SaveCntnt: remove XmlId only if SwTxtNode _becomes_ empty
+ SwUndoDelete::Undo: restore saved XmlIds for start and end SwTxtNode
- sw/source/core/docnode/ndcopy.cxx:
+ SwTxtNode::MakeCopy: register copy at XmlIdRegistry
#i91563#: handle SwTxtNode's metadata for find/replace with undo
- sw/source/core/undo/unins.cxx:
+ _UnReplaceData: rename members: add prefix m_
+ _UnReplaceData: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
+ _UnReplaceData::_UnReplaceData: save XmlIds for start and end SwTxtNode
+ _UnReplaceData::Undo: restore saved XmlIds for start and end SwTxtNode
#i91563#: handle SwTxtNode's metadata for table-to-text with undo
- sw/source/core/undo/untbl.cxx:
+ SwTblToTxtSave: rename members: add prefix m_
+ SwTblToTxtSave: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
+ SwTblToTxtSave::SwTblToTxtSave: save XmlIds for start and end SwTxtNode
+ SwTblToTxtSave::SwTblToTxtSave, SwNodes::UndoTableToText:
always store the index of the first SwTxtNode in the cell, instead of
the index of the first SwTxtNode in case of the first cell in a row,
and the cell start node in other cases
+ SwNodes::UndoTableToText: restore saved XmlIds for start and end SwTxtNode
- sw/source/core/docnode/ndtbl.cxx:
+ lcl_DelBox: simplify for refactored start index handling in SwTblToTxtSave
2009-02-26 13:02:28 +0100 mst r268505 : migration of cws odfmetadata2 from CVS (resync to m42): module sd
- sd/source/ui/table/tableobjectbar.cxx,sd/source/ui/view/*.cxx:
+ remove invocations of SFX_DECL_TYPE
- sd/source/ui/slideshow/SlideShowRestarter.cxx,
sd/source/ui/toolpanel/LayoutMenu.cxx,
sd/source/ui/unoidl/DrawController.cxx,
sd/source/ui/view/{ViewShellBase.cxx,ViewTabBar.cxx,frmview.cxx}:
+ fix abuses of comphelper_getProcessComponentContext (missing release)
2009-02-26 13:01:24 +0100 mst r268504 : migration of cws odfmetadata2 from CVS (resync to m42): module starmath
- starmath/source/document.cxx:
+ don't touch SfxObjectShell's privates
2009-02-26 13:00:37 +0100 mst r268503 : migration of cws odfmetadata2 from CVS (resync to m42): module sfx2
#i90620#
- sfx2/inc/sfx2/XmlIdRegistry.hxx:
+ new file: interfaces sfx2::IXmlIdRegistry and sfx2::IXmlIdRegistrySupplier
and a couple of utility functions
- sfx2/inc/sfx2/DocumentMetadataAccess.hxx,
sfx2/source/doc/DocumentMetadataAccess.cxx:
+ new class sfx2::DocumentMetadataAccess, implements XDocumentMetadataAccess
+ the URI of the DocumentMetadataAccess is now the URI from which the
document was loaded; for a new document, use a vnd.sun.star.tdoc URI
+ add new function sfx2::createBaseURI()
+ prevent using reserved file names
+ try not to recurse into embedded subdocuments
- sfx2/source/doc/makefile.mk:
+ add DocumentMetadataAccess
- sfx2/util/makefile.mk:
+ link libsfx2 against libxml2 (needed for xmlValidateNCName)
- sfx2/source/doc/makefile.mk:
+ add LIBXML_CFLAGS to CFLAGS
- sfx2/prj/build.lst:
+ add dependence on libxml2
- sfx2/prj/d.lst:
+ add XmlIdRegistry.hxx, DocumentMetadataAccess.hxx
- sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/objxtor.cxx:
+ make SfxObjectShell's members private
+ new method SfxObjectShell::GetAutoStyleFilterIndex
+ SfxObjectShell inherits sfx2::IXmlIdRegistrySupplier
- sfx2/source/dialog/templdlg.cxx, sfx2/source/doc/sfxbasemodel.cxx:
+ don't touch SfxObjectShell's privates
- sfx2/inc/sfx2/sfxbasemodel.hxx, sfx2/source/doc/sfxbasemodel.cxx:
+ SfxBaseModel inherits BaseMutex instead of IMPL_SfxBaseModel_MutexContainer
+ SfxBaseModel implements additional interface XDocumentMetadataAccess
+ IMPL_SfxBaseModel_DataContainer has new member:
a sfx2::DocumentMetadataAccess
+ implementation of XDocumentMetadataAccess forwards to
the sfx2::DocumentMetadataAccess member
- sfx2/qa/complex/DocumentMetadataAccessTest.java,
sfx2/qa/complex/{tests.sce,makefile.mk},
sfx2/qa/complex/testdocuments/TESTRDFA.odt:
+ add complex test: DocumentMetadataAccessTest
+ add RDFa test document
#i95863#
- sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx:
+ refactor SfxDocumentItem so it no longer requires a XDocumentInfo
+ move struct CustomProperty to implementation file
+ remove class SfxDocumentUserPage
+ QueryValue,PutValue: remove MID_DOCINFO_FIELD*
- sfx2/source/doc/objserv.cxx:
+ adapt to SfxDocumentItem change
- sfx2/inc/sfx2/sfx.hrc, sfx2/sdi/sfxslots.sdi, sfx2/inc/sfx2/msg.hxx:
+ remove MID_DOCINFO_FIELD*
+ put all invocations of SFX_DECL_TYPE in msg.hxx, and undef SFX_DECL_TYPE
- sfx2/source/doc/objxtor.cxx:
+ fix abuses of comphelper_getProcessComponentContext (missing release)
- sfx2/source/doc/docfile.cxx:
+ SfxMedium::SfxMedium: don't dereference NULL, throw exception instead
- sfx2/source/doc/objstor.cxx:
+ SfxObjectShell::DoLoad: fix bug: DocumentBaseURI is not initialized
2009-02-26 12:58:07 +0100 mst r268502 : migration of cws odfmetadata2 from CVS (resync to m42): module xmloff
#i90620#: implement RDFa import (interface change)
- xmloff/inc/xmloff/xmlimp.hxx. xmloff/source/core/xmlimp.cxx:
+ make SvXMLImport::GetAbsoluteReference() const
+ add SvXMLImport::GetComponentContext()
+ SvXMLImport::_InitCtor(): add RDFa namespace
+ add SvXMLImport::AddRDFa()
+ SvXMLImport::endDocument() inserts RDFa into document repository
- xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/xmltoken.cxx:
+ new tokens for RDFa: XML_ABOUT, XML_DATATYPE
- xmloff/inc/RDFaImportHelper.hxx, xmloff/source/core/RDFaImportHelper.cxx:
+ new class RDFaImportHelper
+ adapt the code to the bleak reality of broken C++ implementations
+ handle empty xhtml:about attributes properly, which are actually
valid relative URIs
+ work around broken SvXMLImport::GetAbsoluteReference
- xmloff/source/core/makefile.mk:
+ add RDFaImportHelper.cxx
#i90620#: implement RDFa export
- xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx:
+ add SvXMLExport::EnsureNamespace(), and a stack of namespace maps
+ add SvXMLExport::GetComponentContext()
+ add SvXMLExport::AddAttributesRDFa()
- xmloff/inc/RDFaExportHelper.hxx, xmloff/source/core/RDFaExportHelper.cxx:
+ new class RDFaExportHelper
+ don't use std::map::data_type, which is actually called
std::map::mapped_type by libstdc++
- xmloff/source/core/makefile.mk:
+ add RDFaExportHelper.cxx
#i91563#
- xmloff/inc/xmloff/txtimp.hxx, xmloff/source/text/txtimp.cxx:
+ XMLTextPAttrTokens: add RDFa tokens
- xmloff/source/text/txtparai{.hxx,.cxx}:
+ import RDFa for text:p
- xmloff/source/text/txtparae.cxx:
+ export RDFa for text:p
interface change: use XHTML namespace instead of RDFA
- xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx,
xmloff/source/core/{xmltoken.cxx,xmlimp.cxx,xmlexp.cxx,RDFaExportHelper.cxx},
xmloff/source/text/txtimp.cxx:
+ use XHTML namespace instead of RDFA
#i91565#, #i91566#: (preliminary) import for text:meta, text:meta-field
- xmloff/source/text/txtparai.cxx:
+ new class XMLMetaImportContextBase with subclasses to import
text:meta and text:meta-field
- xmloff/source/text/XMLTextMarkImportContext.cxx:
+ change XMLTextMarkImportContext::CreateAndInsertMark to handle marks
with no name (text:meta)
#i91565#, #i91566#: (preliminary) export for text:meta, text:meta-field
- xmloff/inc/txtflde.hxx, xmloff/source/text/txtflde.cxx:
+ add FIELD_ID_META to FieldIdEnum
+ new method XMLTextFieldExport::ExportMetaField()
+ change XMLTextFieldExport::ExportField{,AutoStyle,Helper}
to take additional parameter for progress bar
- xmloff/inc/xmloff/txtparae.hxx, xmloff/source/text/txtparae.cxx:
+ make XMLTextParagraphExport::exportTextRangeEnumeration() public
+ new method XMLTextParagraphExport::exportMeta()
#i90620#
- xmloff/inc/xmloff/xmlimp.hxx, xmloff/source/core/xmlimp.cxx,
xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx:
+ rename SvXML{Im,Ex}port::GetStreamPath() to GetStreamName()
+ fix xml:id {im,ex}port for embedded documents and non-packages
+ adapt to API change: XMetadatable
#i90620# GRDDL
- xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx,
xmloff/source/core/{xmltoken.cxx,xmlexp.cxx}:
+ add GRDDL namespace
+ add token XML_TRANSFORMATION
+ add grddl:transformation attribute to root elements for meta.xml,
content.xml and styles.xml
2009-02-26 12:54:40 +0100 mst r268501 : migration of cws odfmetadata2 from CVS (resync to m42): module unoxml
#i90620#
- unoxml/source/rdf/librdf_repository.cxx:
+ librdf_Repository::importGraph: allocate buffer sized length of stream
+ switch from one librdf_world per repository to a single static world
because redland has global variables with a brain-damaged life-cycle...
+ exportGraph: use new raptor 1.4.18 feature to disable writing
an xml:base attribute in RDF/XML files
- unoxml/source/rdf/librdf_repository.cxx:
unoxml/qa/complex/RDFRepositoryTest.java:
+ adapt to predicate is URI change
+ adapt to RDFa API change
+ adapt to API change: RDFa has multiple predicates...
+ adapt to API change: XMetadatable derives from XURI
+ allow xhtml:datatype without xhtml:content
+ adapt to API change: attribute MetadataReference is StringPair
- unoxml/source/rdf/CURI.cxx:
+ add some more URI constants
2009-02-26 12:53:32 +0100 mst r268500 : migration of cws odfmetadata2 from CVS (resync to m42): module package
- package/inc/ImplValidCharacters.hxx:
+ remove (moved to comphelper)
2009-02-26 12:52:49 +0100 mst r268499 : migration of cws odfmetadata2 from CVS (resync to m42): module comphelper
- comphelper/inc/comphelper/processfactory.hxx,
comphelper/source/processfactory/processfactory.cxx:
+ add getProcessComponentContext()
+ change return type of comphelper_getProcessComponentContext to Reference
- comphelper/inc/comphelper/stl_types.hxx:
+ add OUStringBufferAppender
+ add algorithm intersperse
- comphelper/source/misc/string.cxx:
+ rewrite convertCommaSeparated with intersperse and OUStringBufferAppender
- comphelper/inc/comphelper/stlunosequence.hxx:
+ fix bug: begin() on empty sequence != end()
2009-02-26 12:50:47 +0100 mst r268498 : migration of cws odfmetadata2 from CVS (resync to m42): module offapi
#i96209#
- offapi/com/sun/star/text/fieldmaster/*.idl:
+ rename module from FieldMaster to fieldmaster
- offapi/type_reference/{typelibrary_history.txt,types.rdb}:
+ update reference types.rdb
#i90620#
- offapi/com/sun/star/rdf/{XMetadatable.idl,XDocumentMetadataAccess.idl}:
+ API change: XMetadatable derives from XURI
+ API change: replace XmlId (string) with MetadataReference (StringPair)
- offapi/com/sun/star/rdf/{Statement.idl,XDocumentRepository.idl,
XNamedGraph.idl,XRepository.idl}:
+ the predicate of a statement is a URI, not a Resource
- offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl:
+ rename: s/Package/Document/
+ remove uuid
+ remove everything related to mapping
+ graph names are now generated from base URI and file names
+ load methods: improve error handling with XInteractionHandler
- offapi/com/sun/star/rdf/XDocumentRepository.idl:
+ change: RDFa permits using multiple predicates in one attribute
+ setStatementRDFa: subject is now XResource, object is now XMetadatable
- offapi/com/sun/star/rdf/URIs.idl:
+ add some more URI constants
- offapi/com/sun/star/rdf:
+ fix @since tags and replace <method> with <member>
2009-02-26 12:47:24 +0100 mst r268497 : migration of cws odfmetadata2 from CVS (resync to m42): module redland
fix #i93768#
- redland/raptor-1.4.17.patch, redland/raptor/makefile.mk:
+ disable GRDDL parser to prevent call to libxslt
xsltSetDefaultSecurityPrefs, which breaks xmlhelp
- redland/raptor/makefile.mk, redland/raptor-1.4.17.patch,
redland/raptor-1.4.18.patch:
+ upgrade raptor to 1.4.18
+ deactivate serializer for RSS/Atom (does not build)
- redland/rasqal/makefile.mk, redland/rasqal-0.9.15.patch,
redland/rasqal-0.9.16.patch,
+ upgrade rasqal to 0.9.16
- redland/redland/makefile.mk, redland/redland-1.0.7.patch,
redland/redland-1.0.8.patch:
+ upgrade redland to 1.0.8
- redland/redlandversion.mk:
+ the librasqal SONAME has changed
2009-07-02 09:05:03 +00:00
|
|
|
#include <sfx2/msg.hxx>
|
2001-10-08 12:52:46 +00:00
|
|
|
#include <swslots.hxx>
|
2003-03-27 14:45:43 +00:00
|
|
|
#include <pagepreviewlayout.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2007-09-27 11:35:25 +00:00
|
|
|
#include <svx/svxdlg.hxx>
|
|
|
|
#include <svx/dialogs.hrc>
|
2010-10-16 03:22:02 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2006-11-14 14:20:39 +00:00
|
|
|
|
2014-01-21 10:18:02 +09:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2007-09-27 11:35:25 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2013-10-16 16:36:45 +02:00
|
|
|
SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreview, "PrintPreview")
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SFX_VIEW_REGISTRATION(SwDocShell);
|
|
|
|
SFX_VIEW_REGISTRATION(SwWebDocShell);
|
|
|
|
SFX_VIEW_REGISTRATION(SwGlobalDocShell);
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SFX_IMPL_INTERFACE(SwPagePreview, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SFX_POPUPMENU_REGISTRATION(SW_RES(MN_PPREVIEW_POPUPMENU));
|
|
|
|
SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|
|
|
|
|
SFX_VISIBILITY_CLIENT|SFX_VISIBILITY_FULLSCREEN|
|
|
|
|
SFX_VISIBILITY_READONLYDOC,
|
|
|
|
SW_RES(RID_PVIEW_TOOLBOX));
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
TYPEINIT1(SwPagePreview,SfxViewShell)
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2009-11-30 12:56:05 +01:00
|
|
|
#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS )
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-11-27 08:01:27 +00:00
|
|
|
#define MIN_PREVIEW_ZOOM 25
|
|
|
|
#define MAX_PREVIEW_ZOOM 600
|
2010-10-11 17:38:56 -05:00
|
|
|
|
2012-10-12 16:49:40 +02:00
|
|
|
static sal_uInt16 lcl_GetNextZoomStep(sal_uInt16 nCurrentZoom, sal_Bool bZoomIn)
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
2013-07-16 10:26:45 +09:00
|
|
|
static const sal_uInt16 aZoomArr[] =
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
|
|
|
25, 50, 75, 100, 150, 200, 400, 600
|
|
|
|
};
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_uInt16 nZoomArrSize = sizeof(aZoomArr)/sizeof(sal_uInt16);
|
2002-11-27 08:01:27 +00:00
|
|
|
if(bZoomIn)
|
2007-09-27 11:35:25 +00:00
|
|
|
for(int i = nZoomArrSize - 1; i >= 0; --i)
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
|
|
|
if(nCurrentZoom > aZoomArr[i] || !i)
|
|
|
|
return aZoomArr[i];
|
|
|
|
}
|
|
|
|
else
|
2007-09-27 11:35:25 +00:00
|
|
|
for(int i = 0; i < nZoomArrSize; ++i)
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
|
|
|
if(nCurrentZoom < aZoomArr[i])
|
|
|
|
return aZoomArr[i];
|
|
|
|
}
|
|
|
|
return bZoomIn ? MAX_PREVIEW_ZOOM : MIN_PREVIEW_ZOOM;
|
|
|
|
};
|
2010-10-11 17:38:56 -05:00
|
|
|
|
2012-10-12 16:49:40 +02:00
|
|
|
static void lcl_InvalidateZoomSlots(SfxBindings& rBindings)
|
2002-12-02 07:36:05 +00:00
|
|
|
{
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 const aInval[] =
|
2002-12-02 07:36:05 +00:00
|
|
|
{
|
2008-03-07 14:06:36 +00:00
|
|
|
SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN, SID_ATTR_ZOOMSLIDER, FN_PREVIEW_ZOOM, FN_STAT_ZOOM,
|
2002-12-02 07:36:05 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
rBindings.Invalidate( aInval );
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// At first the zoom dialog
|
2013-10-16 16:36:45 +02:00
|
|
|
class SwPreviewZoomDlg : public SvxStandardDialog
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-04-25 12:27:59 +01:00
|
|
|
NumericField* m_pRowEdit;
|
|
|
|
NumericField* m_pColEdit;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-04-25 12:27:59 +01:00
|
|
|
virtual void Apply();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
public:
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPreviewZoomDlg( SwPagePreviewWin& rParent );
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent )
|
2013-04-25 12:27:59 +01:00
|
|
|
: SvxStandardDialog(&rParent, "PreviewZoomDialog", "modules/swriter/ui/previewzoomdialog.ui")
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-04-25 12:27:59 +01:00
|
|
|
get(m_pRowEdit, "rows");
|
|
|
|
get(m_pColEdit, "cols");
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-04-25 12:27:59 +01:00
|
|
|
m_pRowEdit->SetValue( rParent.GetRow() );
|
|
|
|
m_pColEdit->SetValue( rParent.GetCol() );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPreviewZoomDlg::Apply()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-10-16 16:36:45 +02:00
|
|
|
((SwPagePreviewWin*)GetParent())->CalcWish(
|
2013-04-25 12:27:59 +01:00
|
|
|
sal_uInt8(m_pRowEdit->GetValue()),
|
|
|
|
sal_uInt8(m_pColEdit->GetValue()) );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
// all for SwPagePreviewWin
|
|
|
|
SwPagePreviewWin::SwPagePreviewWin( Window *pParent, SwPagePreview& rPView )
|
2014-02-06 13:20:57 +00:00
|
|
|
: Window(pParent, WinBits(WB_CLIPCHILDREN))
|
|
|
|
, mpViewShell(0)
|
|
|
|
, mrView(rPView)
|
|
|
|
, mbCalcScaleForPreviewLayout(true)
|
|
|
|
, maPaintedPreviewDocRect(Rectangle(0,0,0,0))
|
|
|
|
, mpPgPreviewLayout(NULL)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW );
|
2000-09-18 16:15:01 +00:00
|
|
|
SetHelpId(HID_PAGEPREVIEW);
|
|
|
|
SetFillColor( GetBackground().GetColor() );
|
|
|
|
SetLineColor( GetBackground().GetColor());
|
|
|
|
SetMapMode( MapMode(MAP_TWIP) );
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(sal_False);
|
2013-06-06 23:24:23 +02:00
|
|
|
mnRow = pUsrPref->GetPagePrevRow(); // 1 row
|
|
|
|
mnCol = pUsrPref->GetPagePrevCol(); // 1 column
|
2003-04-17 09:16:40 +00:00
|
|
|
mnSttPage = USHRT_MAX;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPagePreviewWin::~SwPagePreviewWin()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::Paint( const Rectangle& rRect )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-03 14:35:28 +00:00
|
|
|
if( !mpViewShell || !mpViewShell->GetLayout() )
|
2000-09-18 16:15:01 +00:00
|
|
|
return;
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
if( USHRT_MAX == mnSttPage ) // was never calculated ? (Init-Phase!)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// This is the size to which I always relate.
|
2002-12-03 14:35:28 +00:00
|
|
|
if( !maPxWinSize.Height() || !maPxWinSize.Width() )
|
|
|
|
maPxWinSize = GetOutputSizePixel();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
Rectangle aRect( LogicToPixel( rRect ));
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Prepare( 1, Point(0,0), maPxWinSize,
|
2003-04-17 09:16:40 +00:00
|
|
|
mnSttPage, maPaintedPreviewDocRect );
|
2003-03-27 14:45:43 +00:00
|
|
|
SetSelectedPage( 1 );
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Paint( PixelToLogic( aRect ) );
|
2002-12-03 14:35:28 +00:00
|
|
|
SetPagePreview(mnRow, mnCol);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MapMode aMM( GetMapMode() );
|
2002-12-03 14:35:28 +00:00
|
|
|
aMM.SetScaleX( maScale );
|
|
|
|
aMM.SetScaleY( maScale );
|
2000-09-18 16:15:01 +00:00
|
|
|
SetMapMode( aMM );
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Paint( rRect );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-03 14:35:28 +00:00
|
|
|
if( !mpViewShell || !mpViewShell->GetLayout() )
|
2000-09-18 16:15:01 +00:00
|
|
|
return;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nOldCol = mnCol;
|
2002-12-03 14:35:28 +00:00
|
|
|
mnRow = nNewRow;
|
|
|
|
mnCol = nNewCol;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nPages = mnRow * mnCol,
|
2002-12-03 14:35:28 +00:00
|
|
|
nLastSttPg = mrView.GetPageCount()+1 > nPages
|
|
|
|
? mrView.GetPageCount()+1 - nPages : 0;
|
|
|
|
if( mnSttPage > nLastSttPg )
|
|
|
|
mnSttPage = nLastSttPg;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Init( mnCol, mnRow, maPxWinSize, true );
|
|
|
|
mpPgPreviewLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
|
2003-04-17 09:16:40 +00:00
|
|
|
mnSttPage, maPaintedPreviewDocRect );
|
2003-03-27 14:45:43 +00:00
|
|
|
SetSelectedPage( mnSttPage );
|
2002-12-03 14:35:28 +00:00
|
|
|
SetPagePreview(mnRow, mnCol);
|
|
|
|
maScale = GetMapMode().GetScaleX();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// If changes have taken place at the columns, the special case "single column"
|
|
|
|
// must be considered and corrected if necessary.
|
2014-01-17 17:11:45 +01:00
|
|
|
if( (1 == nOldCol) != (1 == mnCol) )
|
2002-12-04 11:17:32 +00:00
|
|
|
mrView.ScrollDocSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Order must be maintained!
|
2011-01-29 10:26:56 +09:00
|
|
|
// additional invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-02 07:36:05 +00:00
|
|
|
SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN,
|
|
|
|
FN_PREVIEW_ZOOM,
|
2000-09-18 16:15:01 +00:00
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
|
2003-04-17 09:16:40 +00:00
|
|
|
FN_STAT_PAGE, FN_STAT_ZOOM,
|
2002-12-06 13:15:24 +00:00
|
|
|
FN_SHOW_TWO_PAGES, FN_SHOW_MULTIPLE_PAGES,
|
2000-09-18 16:15:01 +00:00
|
|
|
0
|
|
|
|
};
|
2002-12-03 14:35:28 +00:00
|
|
|
SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
|
2000-09-18 16:15:01 +00:00
|
|
|
rBindings.Invalidate( aInval );
|
|
|
|
rBindings.Update( FN_SHOW_TWO_PAGES );
|
2002-12-06 13:15:24 +00:00
|
|
|
rBindings.Update( FN_SHOW_MULTIPLE_PAGES );
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust scrollbars
|
2003-03-27 14:45:43 +00:00
|
|
|
mrView.ScrollViewSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2010-10-11 17:38:56 -05:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// mnSttPage is Absolute
|
2013-10-16 16:36:45 +02:00
|
|
|
int SwPagePreviewWin::MovePage( int eMoveMode )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// number of pages up
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nPages = mnRow * mnCol;
|
|
|
|
sal_uInt16 nNewSttPage = mnSttPage;
|
|
|
|
sal_uInt16 nPageCount = mrView.GetPageCount();
|
|
|
|
sal_uInt16 nDefSttPg = GetDefSttPage();
|
2002-12-06 15:25:21 +00:00
|
|
|
bool bPaintPageAtFirstCol = true;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
switch( eMoveMode )
|
|
|
|
{
|
2002-12-03 14:35:28 +00:00
|
|
|
case MV_PAGE_UP:
|
2005-12-21 14:13:15 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
const sal_uInt16 nRelSttPage = mpPgPreviewLayout->ConvertAbsoluteToRelativePageNum( mnSttPage );
|
2005-12-21 14:13:15 +00:00
|
|
|
const sal_uInt16 nNewAbsSttPage = nRelSttPage - nPages > 0 ?
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage - nPages ) :
|
2005-12-21 14:13:15 +00:00
|
|
|
nDefSttPg;
|
|
|
|
nNewSttPage = nNewAbsSttPage;
|
|
|
|
|
2013-10-16 16:31:35 +02:00
|
|
|
const sal_uInt16 nRelSelPage = mpPgPreviewLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() );
|
2005-12-21 14:13:15 +00:00
|
|
|
const sal_uInt16 nNewRelSelPage = nRelSelPage - nPages > 0 ?
|
|
|
|
nRelSelPage - nPages :
|
|
|
|
1;
|
2013-10-16 16:31:35 +02:00
|
|
|
SetSelectedPage( mpPgPreviewLayout->ConvertRelativeToAbsolutePageNum( nNewRelSelPage ) );
|
2005-12-21 14:13:15 +00:00
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
break;
|
2005-12-21 14:13:15 +00:00
|
|
|
}
|
2002-12-03 14:35:28 +00:00
|
|
|
case MV_PAGE_DOWN:
|
2005-12-21 14:13:15 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
const sal_uInt16 nRelSttPage = mpPgPreviewLayout->ConvertAbsoluteToRelativePageNum( mnSttPage );
|
|
|
|
const sal_uInt16 nNewAbsSttPage = mpPgPreviewLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage + nPages );
|
2005-12-21 14:13:15 +00:00
|
|
|
nNewSttPage = nNewAbsSttPage < nPageCount ? nNewAbsSttPage : nPageCount;
|
|
|
|
|
2013-10-16 16:31:35 +02:00
|
|
|
const sal_uInt16 nRelSelPage = mpPgPreviewLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() );
|
|
|
|
const sal_uInt16 nNewAbsSelPage = mpPgPreviewLayout->ConvertRelativeToAbsolutePageNum( nRelSelPage + nPages );
|
2005-12-21 14:13:15 +00:00
|
|
|
SetSelectedPage( nNewAbsSelPage < nPageCount ? nNewAbsSelPage : nPageCount );
|
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
break;
|
2005-12-21 14:13:15 +00:00
|
|
|
}
|
2002-12-03 14:35:28 +00:00
|
|
|
case MV_DOC_STT:
|
|
|
|
nNewSttPage = nDefSttPg;
|
2013-10-16 16:31:35 +02:00
|
|
|
SetSelectedPage( mpPgPreviewLayout->ConvertRelativeToAbsolutePageNum( nNewSttPage ? nNewSttPage : 1 ) );
|
2002-12-03 14:35:28 +00:00
|
|
|
break;
|
|
|
|
case MV_DOC_END:
|
2011-01-29 10:26:56 +09:00
|
|
|
// correct calculation of new start page.
|
2002-12-06 15:25:21 +00:00
|
|
|
nNewSttPage = nPageCount;
|
2003-03-27 14:45:43 +00:00
|
|
|
SetSelectedPage( nPageCount );
|
2002-12-03 14:35:28 +00:00
|
|
|
break;
|
2003-03-27 14:45:43 +00:00
|
|
|
case MV_SELPAGE:
|
|
|
|
// <nNewSttPage> and <SelectedPage()> are already set.
|
2011-01-29 10:26:56 +09:00
|
|
|
// not start at first column, only if the
|
2003-03-27 14:45:43 +00:00
|
|
|
// complete preview layout columns doesn't fit into window.
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( !mpPgPreviewLayout->DoesPreviewLayoutColsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
bPaintPageAtFirstCol = false;
|
|
|
|
break;
|
|
|
|
case MV_SCROLL:
|
2011-01-29 10:26:56 +09:00
|
|
|
// check, if paint page at first column
|
2003-03-27 14:45:43 +00:00
|
|
|
// has to be avoided
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( !mpPgPreviewLayout->DoesPreviewLayoutRowsFitIntoWindow() ||
|
|
|
|
!mpPgPreviewLayout->DoesPreviewLayoutColsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
bPaintPageAtFirstCol = false;
|
|
|
|
break;
|
|
|
|
case MV_NEWWINSIZE:
|
2011-01-29 10:26:56 +09:00
|
|
|
// nothing special to do.
|
2003-03-27 14:45:43 +00:00
|
|
|
break;
|
|
|
|
case MV_CALC:
|
2011-01-29 10:26:56 +09:00
|
|
|
// re-init page preview layout.
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->ReInit();
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// correct calculation of new start page.
|
2002-12-06 15:25:21 +00:00
|
|
|
if( nNewSttPage > nPageCount )
|
|
|
|
nNewSttPage = nPageCount;
|
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// correct selected page number
|
2003-03-27 14:45:43 +00:00
|
|
|
if( SelectedPage() > nPageCount )
|
|
|
|
SetSelectedPage( nNewSttPage ? nNewSttPage : 1 );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Prepare( nNewSttPage, Point(0,0), maPxWinSize,
|
2003-04-17 09:16:40 +00:00
|
|
|
nNewSttPage,
|
2003-03-27 14:45:43 +00:00
|
|
|
maPaintedPreviewDocRect, bPaintPageAtFirstCol );
|
|
|
|
if( nNewSttPage == mnSttPage &&
|
|
|
|
eMoveMode != MV_SELPAGE )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
SetPagePreview(mnRow, mnCol);
|
|
|
|
mnSttPage = nNewSttPage;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// additional invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2003-04-17 09:16:40 +00:00
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
|
|
|
|
FN_STAT_PAGE, 0
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
|
2000-09-18 16:15:01 +00:00
|
|
|
rBindings.Invalidate( aInval );
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::SetWinSize( const Size& rNewSize )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// We always want the size as pixel units.
|
2002-12-03 14:35:28 +00:00
|
|
|
maPxWinSize = LogicToPixel( rNewSize );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
if( USHRT_MAX == mnSttPage )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
|
|
|
mnSttPage = GetDefSttPage();
|
|
|
|
SetSelectedPage( GetDefSttPage() );
|
|
|
|
}
|
2002-12-02 06:57:41 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( mbCalcScaleForPreviewLayout )
|
2002-12-02 06:57:41 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Init( mnCol, mnRow, maPxWinSize, true );
|
2003-03-27 14:45:43 +00:00
|
|
|
maScale = GetMapMode().GetScaleX();
|
2002-12-02 06:57:41 +00:00
|
|
|
}
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
|
2003-04-17 09:16:40 +00:00
|
|
|
mnSttPage, maPaintedPreviewDocRect );
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( mbCalcScaleForPreviewLayout )
|
2002-03-20 08:18:37 +00:00
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
SetSelectedPage( mnSttPage );
|
|
|
|
mbCalcScaleForPreviewLayout = false;
|
2002-03-20 08:18:37 +00:00
|
|
|
}
|
2002-12-03 14:35:28 +00:00
|
|
|
SetPagePreview(mnRow, mnCol);
|
|
|
|
maScale = GetMapMode().GetScaleX();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
OUString SwPagePreviewWin::GetStatusStr( sal_uInt16 nPageCnt ) const
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// show physical and virtual page number of
|
2003-04-17 09:16:40 +00:00
|
|
|
// selected page, if it's visible.
|
|
|
|
sal_uInt16 nPageNum;
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( mpPgPreviewLayout->IsPageVisible( mpPgPreviewLayout->SelectedPage() ) )
|
2003-04-17 09:16:40 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
nPageNum = mpPgPreviewLayout->SelectedPage();
|
2003-04-17 09:16:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nPageNum = mnSttPage > 1 ? mnSttPage : 1;
|
|
|
|
}
|
2012-08-26 12:48:56 +04:00
|
|
|
OUStringBuffer aStatusStr;
|
2013-10-16 16:31:35 +02:00
|
|
|
sal_uInt16 nVirtPageNum = mpPgPreviewLayout->GetVirtPageNumByPageNum( nPageNum );
|
2003-04-17 09:16:40 +00:00
|
|
|
if( nVirtPageNum && nVirtPageNum != nPageNum )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-03-10 11:22:28 -03:00
|
|
|
aStatusStr.append( OUString::number(nVirtPageNum) + " " );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2013-03-10 11:22:28 -03:00
|
|
|
aStatusStr.append( OUString::number(nPageNum) + " / " + OUString::number(nPageCnt) );
|
2012-08-26 12:48:56 +04:00
|
|
|
return aStatusStr.makeStringAndClear();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::KeyInput( const KeyEvent &rKEvt )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
const KeyCode& rKeyCode = rKEvt.GetKeyCode();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nKey = rKeyCode.GetCode();
|
2013-02-20 00:58:47 +09:00
|
|
|
bool bHandled = false;
|
2002-12-04 11:17:32 +00:00
|
|
|
if(!rKeyCode.GetModifier())
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nSlot = 0;
|
2002-12-04 11:17:32 +00:00
|
|
|
switch(nKey)
|
|
|
|
{
|
|
|
|
case KEY_ADD : nSlot = SID_ZOOM_OUT; break;
|
2006-03-07 09:47:51 +00:00
|
|
|
case KEY_ESCAPE: nSlot = FN_CLOSE_PAGEPREVIEW; break;
|
2002-12-04 11:17:32 +00:00
|
|
|
case KEY_SUBTRACT : nSlot = SID_ZOOM_IN; break;
|
|
|
|
}
|
|
|
|
if(nSlot)
|
|
|
|
{
|
2013-02-20 00:58:47 +09:00
|
|
|
bHandled = true;
|
2002-12-04 11:17:32 +00:00
|
|
|
mrView.GetViewFrame()->GetDispatcher()->Execute(
|
|
|
|
nSlot, SFX_CALLMODE_ASYNCHRON );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !bHandled && !mrView.KeyInput( rKEvt ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
Window::KeyInput( rKEvt );
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::Command( const CommandEvent& rCEvt )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-02-20 00:58:47 +09:00
|
|
|
bool bCallBase = true;
|
2000-09-18 16:15:01 +00:00
|
|
|
switch( rCEvt.GetCommand() )
|
|
|
|
{
|
2008-03-18 15:04:21 +00:00
|
|
|
case COMMAND_CONTEXTMENU:
|
|
|
|
mrView.GetViewFrame()->GetDispatcher()->ExecutePopup();
|
2013-02-20 00:58:47 +09:00
|
|
|
bCallBase = false;
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
|
|
|
|
2008-06-06 12:42:43 +00:00
|
|
|
case COMMAND_WHEEL:
|
|
|
|
case COMMAND_STARTAUTOSCROLL:
|
|
|
|
case COMMAND_AUTOSCROLL:
|
|
|
|
{
|
|
|
|
const CommandWheelData* pData = rCEvt.GetWheelData();
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
const CommandWheelData aDataNew(pData->GetDelta(),pData->GetNotchDelta(),COMMAND_WHEEL_PAGESCROLL,
|
2010-02-27 13:42:34 +01:00
|
|
|
pData->GetMode(),pData->GetModifier(),pData->IsHorz(), pData->IsDeltaPixel());
|
2008-06-06 12:42:43 +00:00
|
|
|
const CommandEvent aEvent( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),rCEvt.IsMouseEvent(),&aDataNew);
|
|
|
|
bCallBase = !mrView.HandleWheelCommands( aEvent );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bCallBase = !mrView.HandleWheelCommands( rCEvt );
|
2008-03-18 15:04:21 +00:00
|
|
|
}
|
2008-06-06 12:42:43 +00:00
|
|
|
break;
|
2008-03-18 15:04:21 +00:00
|
|
|
default:
|
|
|
|
;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bCallBase )
|
|
|
|
Window::Command( rCEvt );
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::MouseButtonDown( const MouseEvent& rMEvt )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// consider single-click to set selected page
|
2003-03-27 14:45:43 +00:00
|
|
|
if( MOUSE_LEFT == ( rMEvt.GetModifier() + rMEvt.GetButtons() ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
Point aPreviewPos( PixelToLogic( rMEvt.GetPosPixel() ) );
|
2003-03-27 14:45:43 +00:00
|
|
|
Point aDocPos;
|
|
|
|
bool bPosInEmptyPage;
|
|
|
|
sal_uInt16 nNewSelectedPage;
|
|
|
|
bool bIsDocPos =
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->IsPreviewPosInDocPreviewPage( aPreviewPos,
|
2003-03-27 14:45:43 +00:00
|
|
|
aDocPos, bPosInEmptyPage, nNewSelectedPage );
|
|
|
|
if ( bIsDocPos && rMEvt.GetClicks() == 2 )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
// close page preview, set new cursor position and switch to
|
|
|
|
// normal view.
|
2013-10-11 15:57:23 +02:00
|
|
|
OUString sNewCrsrPos = OUString::number( aDocPos.X() ) + ";" +
|
|
|
|
OUString::number( aDocPos.Y() ) + ";";
|
2002-12-03 14:35:28 +00:00
|
|
|
mrView.SetNewCrsrPos( sNewCrsrPos );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-12-03 14:35:28 +00:00
|
|
|
SfxViewFrame *pTmpFrm = mrView.GetViewFrame();
|
2000-09-18 16:15:01 +00:00
|
|
|
pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0,
|
|
|
|
SFX_CALLMODE_ASYNCHRON );
|
|
|
|
}
|
2003-03-27 14:45:43 +00:00
|
|
|
else if ( bIsDocPos || bPosInEmptyPage )
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
// show clicked page as the selected one
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->MarkNewSelectedPage( nNewSelectedPage );
|
2013-10-16 16:36:45 +02:00
|
|
|
GetViewShell()->ShowPreviewSelection( nNewSelectedPage );
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust position at vertical scrollbar.
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( mpPgPreviewLayout->DoesPreviewLayoutRowsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
|
|
|
mrView.SetVScrollbarThumbPos( nNewSelectedPage );
|
|
|
|
}
|
2011-01-29 10:26:56 +09:00
|
|
|
// invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2003-04-17 09:16:40 +00:00
|
|
|
{
|
|
|
|
FN_STAT_PAGE, 0
|
|
|
|
};
|
|
|
|
SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
|
|
|
|
rBindings.Invalidate( aInval );
|
2004-04-21 08:41:45 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Set user prefs or view options
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwMasterUsrPref *pOpt = (SwMasterUsrPref *)SW_MOD()->GetUsrPref(sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if (nRow != pOpt->GetPagePrevRow() || nCol != pOpt->GetPagePrevCol())
|
|
|
|
{
|
|
|
|
pOpt->SetPagePrevRow( nRow );
|
|
|
|
pOpt->SetPagePrevCol( nCol );
|
|
|
|
pOpt->SetModified();
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Update scrollbar!
|
2002-12-04 11:17:32 +00:00
|
|
|
mrView.ScrollViewSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
/** get selected page in document preview
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
sal_uInt16 SwPagePreviewWin::SelectedPage() const
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
return mpPgPreviewLayout->SelectedPage();
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** set selected page number in document preview
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::SetSelectedPage( sal_uInt16 _nSelectedPageNum )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->SetSelectedPage( _nSelectedPageNum );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
|
2004-04-21 08:41:45 +00:00
|
|
|
/** method to enable/disable book preview
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
bool SwPagePreviewWin::SetBookPreviewMode( const bool _bBookPreview )
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
return mpPgPreviewLayout->SetBookPreviewMode( _bBookPreview,
|
2004-04-21 08:41:45 +00:00
|
|
|
mnSttPage,
|
|
|
|
maPaintedPreviewDocRect );
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::DataChanged( const DataChangedEvent& rDCEvt )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-11-30 11:54:23 +00:00
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
switch( rDCEvt.GetType() )
|
|
|
|
{
|
|
|
|
case DATACHANGED_SETTINGS:
|
2013-06-06 23:24:23 +02:00
|
|
|
// Rearrange the scrollbars or trigger resize, because the
|
|
|
|
// size of the scrollbars may have be changed. Also the
|
|
|
|
// size of the scrollbars has to be retrieved from the settings
|
|
|
|
// out of the resize handler.
|
2001-11-30 11:54:23 +00:00
|
|
|
if( rDCEvt.GetFlags() & SETTINGS_STYLE )
|
2013-06-06 23:24:23 +02:00
|
|
|
mrView.InvalidateBorder(); // Scrollbar widths
|
2011-01-29 10:26:56 +09:00
|
|
|
// zoom has to be disabled if Accessibility support is switched on
|
2003-03-27 14:45:43 +00:00
|
|
|
lcl_InvalidateZoomSlots(mrView.GetViewFrame()->GetBindings());
|
2001-11-30 11:54:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DATACHANGED_PRINTER:
|
|
|
|
case DATACHANGED_DISPLAY:
|
|
|
|
case DATACHANGED_FONTS:
|
|
|
|
case DATACHANGED_FONTSUBSTITUTION:
|
2013-06-06 23:24:23 +02:00
|
|
|
mrView.GetDocShell()->UpdateFontList(); // Font change
|
2002-12-03 14:35:28 +00:00
|
|
|
if ( mpViewShell->GetWin() )
|
|
|
|
mpViewShell->GetWin()->Invalidate();
|
2001-11-30 11:54:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
/** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::_ExecPgUpAndPgDown( const bool _bPgUp,
|
2003-03-27 14:45:43 +00:00
|
|
|
SfxRequest* _pReq )
|
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
|
2003-03-27 14:45:43 +00:00
|
|
|
// check, if top/bottom of preview is *not* already visible.
|
2013-10-16 16:31:35 +02:00
|
|
|
if( pPagePreviewLay->GetWinPagesScrollAmount( _bPgUp ? -1 : 1 ) != 0 )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->DoesPreviewLayoutRowsFitIntoWindow() &&
|
|
|
|
pPagePreviewLay->DoesPreviewLayoutColsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
|
|
|
const int eMvMode = _bPgUp ?
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPagePreviewWin::MV_PAGE_UP :
|
|
|
|
SwPagePreviewWin::MV_PAGE_DOWN;
|
2011-01-17 15:06:54 +01:00
|
|
|
if ( ChgPage( eMvMode, sal_True ) )
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwTwips nScrollAmount;
|
|
|
|
sal_uInt16 nNewSelectedPageNum = 0;
|
2013-11-29 13:03:27 +00:00
|
|
|
const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
|
2003-03-27 14:45:43 +00:00
|
|
|
if( _bPgUp )
|
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->DoesPreviewLayoutRowsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
nScrollAmount = pPagePreviewLay->GetWinPagesScrollAmount( -1 );
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( (pViewWin->SelectedPage() - nVisPages) > 0 )
|
|
|
|
nNewSelectedPageNum = pViewWin->SelectedPage() - nVisPages;
|
2003-03-27 14:45:43 +00:00
|
|
|
else
|
|
|
|
nNewSelectedPageNum = 1;
|
|
|
|
}
|
|
|
|
else
|
2013-11-29 13:03:27 +00:00
|
|
|
nScrollAmount = - std::min( pViewWin->GetOutputSize().Height(),
|
|
|
|
pViewWin->GetPaintedPreviewDocRect().Top() );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->DoesPreviewLayoutRowsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
nScrollAmount = pPagePreviewLay->GetWinPagesScrollAmount( 1 );
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( (pViewWin->SelectedPage() + nVisPages) <= mnPageCount )
|
|
|
|
nNewSelectedPageNum = pViewWin->SelectedPage() + nVisPages;
|
2003-03-27 14:45:43 +00:00
|
|
|
else
|
|
|
|
nNewSelectedPageNum = mnPageCount;
|
|
|
|
}
|
|
|
|
else
|
2013-11-29 13:03:27 +00:00
|
|
|
nScrollAmount = std::min( pViewWin->GetOutputSize().Height(),
|
2013-10-16 16:31:35 +02:00
|
|
|
( pPagePreviewLay->GetPreviewDocSize().Height() -
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->GetPaintedPreviewDocRect().Bottom() ) );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Scroll( 0, nScrollAmount );
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( nNewSelectedPageNum != 0 )
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSelectedPage( nNewSelectedPageNum );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
ScrollViewSzChg();
|
2011-01-29 10:26:56 +09:00
|
|
|
// additional invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2003-04-17 09:16:40 +00:00
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
|
|
|
|
FN_STAT_PAGE, 0
|
2003-03-27 14:45:43 +00:00
|
|
|
};
|
|
|
|
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
|
|
|
rBindings.Invalidate( aInval );
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( _pReq )
|
|
|
|
_pReq->Done();
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
// Then all for the SwPagePreview
|
|
|
|
void SwPagePreview::Execute( SfxRequest &rReq )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
int eMvMode;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nRow = 1;
|
2013-02-20 00:58:47 +09:00
|
|
|
bool bRetVal = false;
|
2003-03-27 14:45:43 +00:00
|
|
|
bool bRefresh = true;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
switch(rReq.GetSlot())
|
|
|
|
{
|
|
|
|
case FN_REFRESH_VIEW:
|
|
|
|
case FN_STAT_PAGE:
|
|
|
|
case FN_STAT_ZOOM:
|
|
|
|
break;
|
|
|
|
|
2002-12-06 13:15:24 +00:00
|
|
|
case FN_SHOW_MULTIPLE_PAGES:
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
const SfxItemSet *pArgs = rReq.GetArgs();
|
|
|
|
if( pArgs && pArgs->Count() >= 2 )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nCols = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(
|
2002-11-27 08:01:27 +00:00
|
|
|
SID_ATTR_TABLE_COLUMN)).GetValue();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nRows = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(
|
2001-05-17 08:32:40 +00:00
|
|
|
SID_ATTR_TABLE_ROW)).GetValue();
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->CalcWish( nRows, nCols );
|
2002-11-27 08:01:27 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
2013-11-29 13:03:27 +00:00
|
|
|
SwPreviewZoomDlg( *pViewWin ).Execute();
|
2002-11-27 08:01:27 +00:00
|
|
|
|
2004-04-21 08:41:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FN_SHOW_BOOKVIEW:
|
|
|
|
{
|
|
|
|
const SfxItemSet* pArgs = rReq.GetArgs();
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
bool bBookPreview = GetViewShell()->GetViewOptions()->IsPagePrevBookview();
|
2011-01-17 15:06:54 +01:00
|
|
|
if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_SHOW_BOOKVIEW, sal_False, &pItem ) )
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
|
|
|
bBookPreview = static_cast< const SfxBoolItem* >( pItem )->GetValue();
|
|
|
|
( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview );
|
|
|
|
// cast is not gentleman like, but it's common use in writer and in this case
|
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( pViewWin->SetBookPreviewMode( bBookPreview ) )
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
|
|
|
// book preview mode changed. Thus, adjust scrollbars and
|
|
|
|
// invalidate corresponding states.
|
|
|
|
ScrollViewSzChg();
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
|
|
|
|
FN_STAT_PAGE, FN_SHOW_BOOKVIEW, 0
|
|
|
|
};
|
|
|
|
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
|
|
|
rBindings.Invalidate( aInval );
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2004-04-21 08:41:45 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-11-27 08:01:27 +00:00
|
|
|
case FN_SHOW_TWO_PAGES:
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->CalcWish( nRow, 2 );
|
2002-11-27 08:01:27 +00:00
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2002-11-27 08:01:27 +00:00
|
|
|
case FN_PREVIEW_ZOOM:
|
|
|
|
case SID_ATTR_ZOOM:
|
|
|
|
{
|
|
|
|
const SfxItemSet *pArgs = rReq.GetArgs();
|
|
|
|
const SfxPoolItem* pItem;
|
2014-01-21 10:18:02 +09:00
|
|
|
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg;
|
2002-11-27 08:01:27 +00:00
|
|
|
if(!pArgs)
|
|
|
|
{
|
|
|
|
SfxItemSet aCoreSet(GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
|
2002-12-04 11:17:32 +00:00
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
2002-11-27 08:01:27 +00:00
|
|
|
SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(),
|
|
|
|
pVOpt->GetZoom() );
|
|
|
|
aZoom.SetValueSet(
|
|
|
|
SVX_ZOOM_ENABLE_50|
|
|
|
|
SVX_ZOOM_ENABLE_75|
|
|
|
|
SVX_ZOOM_ENABLE_100|
|
|
|
|
SVX_ZOOM_ENABLE_150|
|
|
|
|
SVX_ZOOM_ENABLE_200|
|
|
|
|
SVX_ZOOM_ENABLE_WHOLEPAGE);
|
|
|
|
aCoreSet.Put( aZoom );
|
|
|
|
|
2004-02-03 15:56:59 +00:00
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
if(pFact)
|
|
|
|
{
|
2014-01-21 10:18:02 +09:00
|
|
|
pDlg.reset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet));
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(pDlg, "Dialogdiet fail!");
|
2004-02-03 15:56:59 +00:00
|
|
|
}
|
|
|
|
|
2002-11-27 08:01:27 +00:00
|
|
|
pDlg->SetLimits( MINZOOM, MAXZOOM );
|
|
|
|
|
|
|
|
if( pDlg->Execute() != RET_CANCEL )
|
|
|
|
pArgs = pDlg->GetOutputItemSet();
|
|
|
|
}
|
|
|
|
if( pArgs )
|
|
|
|
{
|
|
|
|
enum SvxZoomType eType = SVX_ZOOM_PERCENT;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nZoomFactor = USHRT_MAX;
|
|
|
|
if(SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOM, sal_True, &pItem))
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
|
|
|
eType = ((const SvxZoomItem *)pItem)->GetType();
|
|
|
|
nZoomFactor = ((const SvxZoomItem *)pItem)->GetValue();
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
else if(SFX_ITEM_SET == pArgs->GetItemState(FN_PREVIEW_ZOOM, sal_True, &pItem))
|
2002-11-27 08:01:27 +00:00
|
|
|
nZoomFactor = ((const SfxUInt16Item *)pItem)->GetValue();
|
|
|
|
if(USHRT_MAX != nZoomFactor)
|
|
|
|
SetZoom(eType, nZoomFactor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2008-03-07 14:06:36 +00:00
|
|
|
case SID_ATTR_ZOOMSLIDER :
|
|
|
|
{
|
|
|
|
const SfxItemSet *pArgs = rReq.GetArgs();
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, sal_True, &pItem ) )
|
2008-03-07 14:06:36 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
|
2008-03-07 14:06:36 +00:00
|
|
|
SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-11-27 08:01:27 +00:00
|
|
|
case SID_ZOOM_IN:
|
|
|
|
case SID_ZOOM_OUT:
|
|
|
|
{
|
|
|
|
enum SvxZoomType eType = SVX_ZOOM_PERCENT;
|
2002-12-04 11:17:32 +00:00
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
2002-11-27 08:01:27 +00:00
|
|
|
SetZoom(eType,
|
|
|
|
lcl_GetNextZoomStep(pVOpt->GetZoom(), SID_ZOOM_IN == rReq.GetSlot()));
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_CHAR_LEFT:
|
|
|
|
case FN_CHAR_RIGHT:
|
|
|
|
case FN_LINE_UP:
|
|
|
|
case FN_LINE_DOWN:
|
2002-03-15 06:33:34 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
|
2002-12-06 15:25:21 +00:00
|
|
|
sal_uInt16 nNewSelectedPage;
|
|
|
|
sal_uInt16 nNewStartPage;
|
|
|
|
Point aNewStartPos;
|
2003-03-27 14:45:43 +00:00
|
|
|
sal_Int16 nHoriMove = 0;
|
|
|
|
sal_Int16 nVertMove = 0;
|
|
|
|
switch(rReq.GetSlot())
|
|
|
|
{
|
|
|
|
case FN_CHAR_LEFT: nHoriMove = -1; break;
|
|
|
|
case FN_CHAR_RIGHT: nHoriMove = 1; break;
|
|
|
|
case FN_LINE_UP: nVertMove = -1; break;
|
|
|
|
case FN_LINE_DOWN: nVertMove = 1; break;
|
|
|
|
}
|
2013-10-16 16:31:35 +02:00
|
|
|
pPagePreviewLay->CalcStartValuesForSelectedPageMove( nHoriMove, nVertMove,
|
2002-12-06 15:25:21 +00:00
|
|
|
nNewSelectedPage, nNewStartPage, aNewStartPos );
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( pViewWin->SelectedPage() != nNewSelectedPage )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->IsPageVisible( nNewSelectedPage ) )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
pPagePreviewLay->MarkNewSelectedPage( nNewSelectedPage );
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust position at vertical scrollbar.
|
2003-03-27 14:45:43 +00:00
|
|
|
SetVScrollbarThumbPos( nNewSelectedPage );
|
|
|
|
bRefresh = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSelectedPage( nNewSelectedPage );
|
|
|
|
pViewWin->SetSttPage( nNewStartPage );
|
2014-01-17 17:11:45 +01:00
|
|
|
bRefresh = ChgPage( SwPagePreviewWin::MV_SELPAGE, sal_True );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2013-10-16 16:36:45 +02:00
|
|
|
GetViewShell()->ShowPreviewSelection( nNewSelectedPage );
|
2011-01-29 10:26:56 +09:00
|
|
|
// invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2003-04-17 09:16:40 +00:00
|
|
|
{
|
|
|
|
FN_STAT_PAGE, 0
|
|
|
|
};
|
|
|
|
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
|
|
|
rBindings.Invalidate( aInval );
|
2003-03-27 14:45:43 +00:00
|
|
|
rReq.Done();
|
|
|
|
}
|
2004-04-21 08:41:45 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
bRefresh = false;
|
|
|
|
}
|
2003-03-27 14:45:43 +00:00
|
|
|
break;
|
2002-03-15 06:33:34 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_PAGEUP:
|
|
|
|
case FN_PAGEDOWN:
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
|
|
|
_ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq );
|
|
|
|
break;
|
|
|
|
}
|
2002-03-15 06:33:34 +00:00
|
|
|
case FN_START_OF_LINE:
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_START_OF_DOCUMENT:
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSelectedPage( 1 );
|
2013-10-16 16:36:45 +02:00
|
|
|
eMvMode = SwPagePreviewWin::MV_DOC_STT; bRetVal = true; goto MOVEPAGE;
|
2002-03-15 06:33:34 +00:00
|
|
|
case FN_END_OF_LINE:
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_END_OF_DOCUMENT:
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSelectedPage( mnPageCount );
|
2013-10-16 16:36:45 +02:00
|
|
|
eMvMode = SwPagePreviewWin::MV_DOC_END; bRetVal = true; goto MOVEPAGE;
|
2000-09-18 16:15:01 +00:00
|
|
|
MOVEPAGE:
|
|
|
|
{
|
2014-01-17 17:11:45 +01:00
|
|
|
bool nRet = ChgPage( eMvMode, sal_True );
|
2000-09-18 16:15:01 +00:00
|
|
|
// return value fuer Basic
|
|
|
|
if(bRetVal)
|
2014-01-17 17:11:45 +01:00
|
|
|
rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), !nRet));
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-01-17 17:11:45 +01:00
|
|
|
bRefresh = nRet;
|
2002-11-25 10:49:52 +00:00
|
|
|
rReq.Done();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FN_PRINT_PAGEPREVIEW:
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
const SwPagePreviewPrtData* pPPVPD = pViewWin->GetViewShell()->GetDoc()->GetPreviewPrtData();
|
2013-06-06 23:24:23 +02:00
|
|
|
// The thing with the orientation
|
2000-09-18 16:15:01 +00:00
|
|
|
if(pPPVPD)
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SfxPrinter* pPrinter = GetPrinter( sal_True );
|
2000-09-18 16:15:01 +00:00
|
|
|
if((pPrinter->GetOrientation() == ORIENTATION_LANDSCAPE)
|
|
|
|
!= pPPVPD->GetLandscape())
|
|
|
|
pPrinter->SetOrientation(pPPVPD->GetLandscape() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
|
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
|
2011-01-17 15:06:54 +01:00
|
|
|
bNormalPrint = sal_False;
|
|
|
|
sal_uInt16 nPrtSlot = SID_PRINTDOC;
|
2000-09-18 16:15:01 +00:00
|
|
|
rReq.SetSlot( nPrtSlot );
|
|
|
|
SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
|
|
|
|
rReq.SetSlot( FN_PRINT_PAGEPREVIEW );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case SID_PRINTDOCDIRECT:
|
|
|
|
case SID_PRINTDOC:
|
2013-11-29 13:03:27 +00:00
|
|
|
::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
|
2011-01-17 15:06:54 +01:00
|
|
|
bNormalPrint = sal_True;
|
2000-09-18 16:15:01 +00:00
|
|
|
SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
|
|
|
|
return;
|
2002-03-20 10:00:27 +00:00
|
|
|
case FN_CLOSE_PAGEPREVIEW:
|
2000-09-18 16:15:01 +00:00
|
|
|
case SID_PRINTPREVIEW:
|
|
|
|
// print preview is now always in the same frame as the tab view
|
|
|
|
// -> always switch this frame back to normal view
|
|
|
|
// (ScTabViewShell ctor reads stored view data)
|
2004-02-04 13:10:46 +00:00
|
|
|
GetViewFrame()->GetDispatcher()->Execute( SID_VIEWSHELL0, 0, 0, SFX_CALLMODE_ASYNCHRON );
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
2002-03-15 06:33:34 +00:00
|
|
|
case FN_INSERT_BREAK:
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
sal_uInt16 nSelPage = pViewWin->SelectedPage();
|
2002-03-20 08:18:37 +00:00
|
|
|
//if a dummy page is selected (e.g. a non-existing right/left page)
|
|
|
|
//the direct neighbor is used
|
2002-12-04 11:17:32 +00:00
|
|
|
if(GetViewShell()->IsDummyPage( nSelPage ) && GetViewShell()->IsDummyPage( --nSelPage ))
|
2002-03-20 08:18:37 +00:00
|
|
|
nSelPage +=2;
|
|
|
|
SetNewPage( nSelPage );
|
2002-03-15 06:33:34 +00:00
|
|
|
SfxViewFrame *pTmpFrm = GetViewFrame();
|
|
|
|
pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0,
|
|
|
|
SFX_CALLMODE_ASYNCHRON );
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
default:
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(!this, "wrong dispatcher");
|
2000-09-18 16:15:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bRefresh )
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::GetState( SfxItemSet& rSet )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SfxWhichIter aIter(rSet);
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nRow = 1;
|
|
|
|
sal_uInt16 nWhich = aIter.FirstWhich();
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(nWhich, "empty set");
|
2013-10-16 16:31:35 +02:00
|
|
|
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
while(nWhich)
|
|
|
|
{
|
|
|
|
switch(nWhich)
|
|
|
|
{
|
2009-09-18 10:15:03 +00:00
|
|
|
case SID_BROWSER_MODE:
|
|
|
|
case FN_PRINT_LAYOUT:
|
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_START_OF_DOCUMENT:
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->IsPageVisible( 1 ) )
|
2003-03-27 14:45:43 +00:00
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FN_END_OF_DOCUMENT:
|
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( pPagePreviewLay->IsPageVisible( mnPageCount ) )
|
2003-03-27 14:45:43 +00:00
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_PAGEUP:
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if( pPagePreviewLay->GetWinPagesScrollAmount( -1 ) == 0 )
|
2000-09-18 16:15:01 +00:00
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
break;
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
case FN_PAGEDOWN:
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
if( pPagePreviewLay->GetWinPagesScrollAmount( 1 ) == 0 )
|
2003-03-27 14:45:43 +00:00
|
|
|
rSet.DisableItem(nWhich);
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
case FN_STAT_PAGE:
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
OUString aStr = sPageStr + pViewWin->GetStatusStr( mnPageCount );
|
2000-09-18 16:15:01 +00:00
|
|
|
rSet.Put( SfxStringItem( nWhich, aStr) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_ZOOM:
|
|
|
|
case FN_STAT_ZOOM:
|
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
|
|
|
SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(),
|
|
|
|
pVOpt->GetZoom());
|
|
|
|
aZoom.SetValueSet(
|
|
|
|
SVX_ZOOM_ENABLE_50|
|
|
|
|
SVX_ZOOM_ENABLE_75|
|
|
|
|
SVX_ZOOM_ENABLE_100|
|
|
|
|
SVX_ZOOM_ENABLE_150|
|
|
|
|
SVX_ZOOM_ENABLE_200);
|
|
|
|
rSet.Put( aZoom );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2002-11-27 08:01:27 +00:00
|
|
|
break;
|
2008-03-07 14:06:36 +00:00
|
|
|
case SID_ATTR_ZOOMSLIDER :
|
|
|
|
{
|
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_uInt16 nCurrentZoom = pVOpt->GetZoom();
|
2008-03-07 14:06:36 +00:00
|
|
|
SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
|
|
|
|
aZoomSliderItem.AddSnappingPoint( 100 );
|
|
|
|
rSet.Put( aZoomSliderItem );
|
|
|
|
}
|
|
|
|
break;
|
2002-12-02 07:36:05 +00:00
|
|
|
case FN_PREVIEW_ZOOM:
|
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
|
|
|
rSet.Put(SfxUInt16Item(nWhich, pVOpt->GetZoom()));
|
2002-12-02 07:36:05 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-11-27 08:01:27 +00:00
|
|
|
case SID_ZOOM_IN:
|
|
|
|
case SID_ZOOM_OUT:
|
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
|
2013-02-19 23:41:06 +09:00
|
|
|
if((SID_ZOOM_OUT == nWhich && pVOpt->GetZoom() >= MAX_PREVIEW_ZOOM)||
|
2002-12-02 07:36:05 +00:00
|
|
|
(SID_ZOOM_IN == nWhich && pVOpt->GetZoom() <= MIN_PREVIEW_ZOOM))
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-12-06 13:15:24 +00:00
|
|
|
case FN_SHOW_MULTIPLE_PAGES:
|
2013-06-06 23:24:23 +02:00
|
|
|
// should never be disabled
|
2002-11-27 08:01:27 +00:00
|
|
|
break;
|
2004-04-21 08:41:45 +00:00
|
|
|
case FN_SHOW_BOOKVIEW:
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool b = GetViewShell()->GetViewOptions()->IsPagePrevBookview();
|
2004-04-21 08:41:45 +00:00
|
|
|
rSet.Put(SfxBoolItem(nWhich, b));
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
case FN_SHOW_TWO_PAGES:
|
2013-11-29 13:03:27 +00:00
|
|
|
if( 2 == pViewWin->GetCol() && nRow == pViewWin->GetRow() )
|
2000-09-18 16:15:01 +00:00
|
|
|
rSet.DisableItem( nWhich );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FN_PRINT_PAGEPREVIEW:
|
2013-06-06 23:24:23 +02:00
|
|
|
// has the same status like the normal printing
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
SfxItemSet aSet( *rSet.GetPool(), SID_PRINTDOC, SID_PRINTDOC );
|
|
|
|
GetSlotState( SID_PRINTDOC, SfxViewShell::GetInterface(), &aSet );
|
2006-03-22 08:32:25 +00:00
|
|
|
if( SFX_ITEM_DISABLED == aSet.GetItemState( SID_PRINTDOC,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_False, &pItem ))
|
2006-03-22 08:32:25 +00:00
|
|
|
rSet.DisableItem( nWhich );
|
|
|
|
else if( SFX_ITEM_SET == aSet.GetItemState( SID_PRINTDOC,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_False, &pItem ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
((SfxPoolItem*)pItem)->SetWhich( FN_PRINT_PAGEPREVIEW );
|
|
|
|
rSet.Put( *pItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_PRINTPREVIEW:
|
2014-01-28 19:59:54 +01:00
|
|
|
rSet.Put( SfxBoolItem( nWhich, true ) );
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_PRINTDOC:
|
|
|
|
case SID_PRINTDOCDIRECT:
|
|
|
|
GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nWhich = aIter.NextWhich();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::StateUndo(SfxItemSet& rSet)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SfxWhichIter aIter(rSet);
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nWhich = aIter.FirstWhich();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
while (nWhich)
|
|
|
|
{
|
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
nWhich = aIter.NextWhich();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::Init(const SwViewOption * pPrefs)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
if ( GetViewShell()->HasDrawView() )
|
2011-01-17 15:06:54 +01:00
|
|
|
GetViewShell()->GetDrawView()->SetAnimationEnabled( sal_False );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
bNormalPrint = sal_True;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Check and process the DocSize. The shell could not be found via
|
|
|
|
// the handler, because the shell is unknown to the SFX management
|
|
|
|
// within the CTOR phase.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( !pPrefs )
|
2011-01-17 15:06:54 +01:00
|
|
|
pPrefs = SW_MOD()->GetUsrPref(sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-11-08 12:47:21 +04:00
|
|
|
mbHScrollbarEnabled = pPrefs->IsViewHScrollBar();
|
|
|
|
mbVScrollbarEnabled = pPrefs->IsViewVScrollBar();
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Update the fields
|
|
|
|
// ATTENTION: Do cast the EditShell up, to use the SS.
|
|
|
|
// At the methodes the current shell will be queried!
|
2002-12-04 11:17:32 +00:00
|
|
|
SwEditShell* pESh = (SwEditShell*)GetViewShell();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bIsModified = pESh->IsModified();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
SwViewOption aOpt( *pPrefs );
|
2011-01-17 15:06:54 +01:00
|
|
|
aOpt.SetPagePreview(sal_True);
|
|
|
|
aOpt.SetTab( sal_False );
|
|
|
|
aOpt.SetBlank( sal_False );
|
|
|
|
aOpt.SetHardBlank( sal_False );
|
|
|
|
aOpt.SetParagraph( sal_False );
|
|
|
|
aOpt.SetLineBreak( sal_False );
|
|
|
|
aOpt.SetPageBreak( sal_False );
|
|
|
|
aOpt.SetColumnBreak( sal_False );
|
|
|
|
aOpt.SetSoftHyph( sal_False );
|
|
|
|
aOpt.SetFldName( sal_False );
|
|
|
|
aOpt.SetPostIts( sal_False );
|
|
|
|
aOpt.SetShowHiddenChar( sal_False );
|
|
|
|
aOpt.SetShowHiddenField( sal_False );
|
|
|
|
aOpt.SetShowHiddenPara( sal_False );
|
|
|
|
aOpt.SetViewHRuler( sal_False );
|
|
|
|
aOpt.SetViewVRuler( sal_False );
|
|
|
|
aOpt.SetGraphic( sal_True );
|
|
|
|
aOpt.SetTable( sal_True );
|
|
|
|
aOpt.SetSnap( sal_False );
|
|
|
|
aOpt.SetGridVisible( sal_False );
|
2011-02-09 15:55:27 +01:00
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
GetViewShell()->ApplyViewOptions( aOpt );
|
|
|
|
GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust view shell option to the same as for print
|
2010-09-30 16:03:07 +02:00
|
|
|
SwPrintData const aPrintOptions = *SW_MOD()->GetPrtOptions(false);
|
2003-03-27 14:45:43 +00:00
|
|
|
GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions );
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
GetViewShell()->CalcLayout();
|
|
|
|
DocSzChgd( GetViewShell()->GetDocSize() );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( !bIsModified )
|
|
|
|
pESh->ResetModified();
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
|
2007-09-27 11:35:25 +00:00
|
|
|
SfxViewShell( pViewFrame, SWVIEWFLAGS ),
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin( new SwPagePreviewWin(&(GetViewFrame())->GetWindow(), *this ) ),
|
2007-09-27 11:35:25 +00:00
|
|
|
nNewPage(USHRT_MAX),
|
2012-08-26 11:30:07 +04:00
|
|
|
sPageStr(SW_RES(STR_PAGE)),
|
2000-09-18 16:15:01 +00:00
|
|
|
pHScrollbar(0),
|
|
|
|
pVScrollbar(0),
|
2007-09-27 11:35:25 +00:00
|
|
|
pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(),
|
2009-12-15 23:07:57 +01:00
|
|
|
pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
|
2002-12-06 15:25:21 +00:00
|
|
|
mnPageCount( 0 ),
|
2003-03-27 14:45:43 +00:00
|
|
|
mbResetFormDesignMode( false ),
|
|
|
|
mbFormDesignModeToReset( false )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
SetName(OUString("PageView" ));
|
2013-11-29 13:03:27 +00:00
|
|
|
SetWindow( pViewWin );
|
2000-09-18 16:15:01 +00:00
|
|
|
SetHelpId(SW_PAGEPREVIEW);
|
2011-01-17 15:06:54 +01:00
|
|
|
_CreateScrollbar( sal_True );
|
|
|
|
_CreateScrollbar( sal_False );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2007-09-27 11:35:25 +00:00
|
|
|
SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( !pOldSh )
|
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// Exists already a view on the document?
|
2000-09-18 16:15:01 +00:00
|
|
|
SfxViewFrame *pF = SfxViewFrame::GetFirst( pObjShell );
|
2007-09-27 11:35:25 +00:00
|
|
|
if ( pF == pViewFrame )
|
2000-09-18 16:15:01 +00:00
|
|
|
pF = SfxViewFrame::GetNext( *pF, pObjShell );
|
|
|
|
if ( pF )
|
|
|
|
pOldSh = pF->GetViewShell();
|
|
|
|
}
|
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
SwViewShell *pVS, *pNew;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
if( pOldSh && pOldSh->IsA( TYPE( SwPagePreview ) ) )
|
|
|
|
pVS = ((SwPagePreview*)pOldSh)->GetViewShell();
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) )
|
|
|
|
{
|
|
|
|
pVS = ((SwView*)pOldSh)->GetWrtShellPtr();
|
|
|
|
// save the current ViewData of the previous SwView
|
2013-08-14 18:41:28 +04:00
|
|
|
pOldSh->WriteUserData( sSwViewData, false );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pVS = GetDocShell()->GetWrtShell();
|
|
|
|
if( pVS )
|
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// Set the current page as the first.
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nPhysPg, nVirtPg;
|
2011-03-14 16:51:14 +00:00
|
|
|
((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, sal_True, sal_False );
|
2013-11-29 13:03:27 +00:00
|
|
|
if( 1 != pViewWin->GetCol() && 1 == nPhysPg )
|
2000-09-18 16:15:01 +00:00
|
|
|
--nPhysPg;
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSttPage( nPhysPg );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// for form shell remember design mode of draw view
|
2003-03-27 14:45:43 +00:00
|
|
|
// of previous view shell
|
|
|
|
if ( pVS && pVS->HasDrawView() )
|
|
|
|
{
|
|
|
|
mbResetFormDesignMode = true;
|
|
|
|
mbFormDesignModeToReset = pVS->GetDrawView()->IsDesignMode();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
if( pVS )
|
2013-11-29 13:03:27 +00:00
|
|
|
pNew = new SwViewShell( *pVS, pViewWin, 0, VSHELLFLAG_ISPREVIEW );
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
2013-10-26 19:50:13 +02:00
|
|
|
pNew = new SwViewShell(
|
2007-09-27 11:35:25 +00:00
|
|
|
*((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(),
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetViewShell( pNew );
|
2000-09-18 16:15:01 +00:00
|
|
|
pNew->SetSfxViewShell( this );
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPagePreview::~SwPagePreview()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SetWindow( 0 );
|
2013-11-29 13:03:27 +00:00
|
|
|
SwViewShell* pVShell = pViewWin->GetViewShell();
|
|
|
|
pVShell->SetWin(0);
|
|
|
|
delete pVShell;
|
|
|
|
delete pViewWin;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
delete pScrollFill;
|
|
|
|
delete pHScrollbar;
|
|
|
|
delete pVScrollbar;
|
2010-11-30 16:44:46 +01:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SwDocShell* SwPagePreview::GetDocShell()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
return PTR_CAST(SwDocShell, GetViewFrame()->GetObjectShell());
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
int SwPagePreview::_CreateScrollbar( sal_Bool bHori )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
Window *pMDI = &GetViewFrame()->GetWindow();
|
|
|
|
SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
OSL_ENSURE( !*ppScrollbar, "check beforehand!" );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
*ppScrollbar = new SwScrollbar( pMDI, bHori );
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
ScrollDocSzChg();
|
2011-01-17 15:06:54 +01:00
|
|
|
(*ppScrollbar)->EnableDrag( sal_True );
|
2013-10-16 16:36:45 +02:00
|
|
|
(*ppScrollbar)->SetEndScrollHdl( LINK( this, SwPagePreview, EndScrollHdl ));
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
(*ppScrollbar)->SetScrollHdl( LINK( this, SwPagePreview, ScrollHdl ));
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
InvalidateBorder();
|
2007-09-27 11:35:25 +00:00
|
|
|
(*ppScrollbar)->ExtendedShow();
|
2000-09-18 16:15:01 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-01-17 17:11:45 +01:00
|
|
|
bool SwPagePreview::ChgPage( int eMvMode, int bUpdateScrollbar )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
Rectangle aPixVisArea( pViewWin->LogicToPixel( aVisArea ) );
|
2014-01-17 17:11:45 +01:00
|
|
|
bool bChg = pViewWin->MovePage( eMvMode ) ||
|
2013-10-16 16:36:45 +02:00
|
|
|
eMvMode == SwPagePreviewWin::MV_CALC ||
|
|
|
|
eMvMode == SwPagePreviewWin::MV_NEWWINSIZE;
|
2013-11-29 13:03:27 +00:00
|
|
|
aVisArea = pViewWin->PixelToLogic( aPixVisArea );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( bChg )
|
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// Update statusbar
|
2013-11-29 13:03:27 +00:00
|
|
|
OUString aStr = sPageStr + pViewWin->GetStatusStr( mnPageCount );
|
2000-09-18 16:15:01 +00:00
|
|
|
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
|
|
|
|
|
|
|
if( bUpdateScrollbar )
|
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
ScrollViewSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT,
|
|
|
|
FN_PAGEUP, FN_PAGEDOWN, 0
|
|
|
|
};
|
|
|
|
rBindings.Invalidate( aInval );
|
|
|
|
}
|
|
|
|
rBindings.SetState( SfxStringItem( FN_STAT_PAGE, aStr ) );
|
|
|
|
}
|
|
|
|
return bChg;
|
|
|
|
}
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// From here, everything was taken from the SwView.
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*/ )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
const StyleSettings &rSet = pViewWin->GetSettings().GetStyleSettings();
|
2011-01-29 10:26:56 +09:00
|
|
|
const long nTmp = rSet.GetScrollBarSize();
|
2012-04-03 16:33:41 +01:00
|
|
|
if ( pVScrollbar->IsVisible( true ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
rToFill.Right() = nTmp;
|
2012-05-15 10:35:41 +04:00
|
|
|
if ( pHScrollbar->IsVisible( true ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
rToFill.Bottom() = nTmp;
|
|
|
|
SetBorderPixel( rToFill );
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::InnerResizePixel( const Point &rOfst, const Size &rSize )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SvBorder aBorder;
|
2011-01-17 15:06:54 +01:00
|
|
|
CalcAndSetBorderPixel( aBorder, sal_True );
|
2000-09-18 16:15:01 +00:00
|
|
|
Rectangle aRect( rOfst, rSize );
|
|
|
|
aRect += aBorder;
|
2013-11-29 13:03:27 +00:00
|
|
|
ViewResizePixel( *pViewWin, aRect.TopLeft(), aRect.GetSize(),
|
|
|
|
pViewWin->GetOutputSizePixel(),
|
2013-09-26 21:42:34 +02:00
|
|
|
*pVScrollbar, *pHScrollbar, *pScrollFill );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Never set EditWin !
|
|
|
|
// Never set VisArea !
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::OuterResizePixel( const Point &rOfst, const Size &rSize )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SvBorder aBorder;
|
2011-01-17 15:06:54 +01:00
|
|
|
CalcAndSetBorderPixel( aBorder, sal_False );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Never set EditWin !
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
Size aTmpSize( pViewWin->GetOutputSizePixel() );
|
|
|
|
Point aBottomRight( pViewWin->PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
|
2000-09-18 16:15:01 +00:00
|
|
|
SetVisArea( Rectangle( Point(), aBottomRight ) );
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Call of the DocSzChgd-Methode of the scrollbars is necessary,
|
|
|
|
// because from the maximum scoll range half the height of the
|
|
|
|
// VisArea is always deducted.
|
2012-04-03 16:33:41 +01:00
|
|
|
if ( pVScrollbar && aTmpSize.Width() > 0 && aTmpSize.Height() > 0 )
|
|
|
|
{
|
|
|
|
ScrollDocSzChg();
|
|
|
|
}
|
|
|
|
|
|
|
|
SvBorder aBorderNew;
|
|
|
|
CalcAndSetBorderPixel( aBorderNew, sal_False );
|
2013-11-29 13:03:27 +00:00
|
|
|
ViewResizePixel( *pViewWin, rOfst, rSize, pViewWin->GetOutputSizePixel(),
|
2013-09-26 21:42:34 +02:00
|
|
|
*pVScrollbar, *pHScrollbar, *pScrollFill );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
const Point aTopLeft(AlignToPixel(rRect.TopLeft()));
|
|
|
|
const Point aBottomRight(AlignToPixel(rRect.BottomRight()));
|
|
|
|
Rectangle aLR(aTopLeft,aBottomRight);
|
|
|
|
|
|
|
|
if(aLR == aVisArea)
|
|
|
|
return;
|
2013-06-06 23:24:23 +02:00
|
|
|
// No negative position, no negative size
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if(aLR.Top() < 0)
|
|
|
|
{
|
2013-04-11 00:21:40 -03:00
|
|
|
aLR.Bottom() += std::abs(aLR.Top());
|
2000-09-18 16:15:01 +00:00
|
|
|
aLR.Top() = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(aLR.Left() < 0)
|
|
|
|
{
|
2013-04-11 00:21:40 -03:00
|
|
|
aLR.Right() += std::abs(aLR.Left());
|
2000-09-18 16:15:01 +00:00
|
|
|
aLR.Left() = 0;
|
|
|
|
}
|
|
|
|
if(aLR.Right() < 0) aLR.Right() = 0;
|
|
|
|
if(aLR.Bottom() < 0) aLR.Bottom() = 0;
|
|
|
|
if(aLR == aVisArea ||
|
2013-06-06 23:24:23 +02:00
|
|
|
// Ignore empty rectangle
|
2000-09-18 16:15:01 +00:00
|
|
|
( 0 == aLR.Bottom() - aLR.Top() && 0 == aLR.Right() - aLR.Left() ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( aLR.Left() > aLR.Right() || aLR.Top() > aLR.Bottom() )
|
|
|
|
return;
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Before the data can be changed call an update if necessary.
|
|
|
|
// Thereby ensured, that adjacent paints are correctly converted into
|
|
|
|
// document coordinates.
|
|
|
|
// As a precaution, we do this only when at the shell runs an action,
|
|
|
|
// because then we do not really paint but the rectangles are just
|
|
|
|
// bookmarked (in document coordinates).
|
2002-12-04 11:17:32 +00:00
|
|
|
if( GetViewShell()->ActionPend() )
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Update();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// Set at View-Win the current size
|
2000-09-18 16:15:01 +00:00
|
|
|
aVisArea = aLR;
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetWinSize( aLR.GetSize() );
|
2013-10-16 16:36:45 +02:00
|
|
|
ChgPage( SwPagePreviewWin::MV_NEWWINSIZE, bUpdateScrollbar );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
IMPL_LINK( SwPagePreview, ScrollHdl, SwScrollbar *, pScrollbar )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
if(!GetViewShell())
|
|
|
|
return 0;
|
2000-09-18 16:15:01 +00:00
|
|
|
if( !pScrollbar->IsHoriScroll() &&
|
2002-12-04 11:17:32 +00:00
|
|
|
pScrollbar->GetType() == SCROLL_DRAG &&
|
|
|
|
Help::IsQuickHelpEnabled() &&
|
2003-03-27 14:45:43 +00:00
|
|
|
GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow())
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// Scroll how many pages??
|
2013-10-11 15:57:23 +02:00
|
|
|
OUString sStateStr(sPageStr);
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
|
2013-11-29 13:03:27 +00:00
|
|
|
if( 1 == pViewWin->GetCol() || !nThmbPos )
|
2000-09-18 16:15:01 +00:00
|
|
|
++nThmbPos;
|
2013-02-20 00:18:07 +01:00
|
|
|
sStateStr += OUString::number( nThmbPos );
|
2000-09-18 16:15:01 +00:00
|
|
|
Point aPos = pScrollbar->GetParent()->OutputToScreenPixel(
|
|
|
|
pScrollbar->GetPosPixel());
|
|
|
|
aPos.Y() = pScrollbar->OutputToScreenPixel(pScrollbar->GetPointerPosPixel()).Y();
|
|
|
|
Rectangle aRect;
|
|
|
|
aRect.Left() = aPos.X() -8;
|
|
|
|
aRect.Right() = aRect.Left();
|
|
|
|
aRect.Top() = aPos.Y();
|
|
|
|
aRect.Bottom() = aRect.Top();
|
|
|
|
|
|
|
|
Help::ShowQuickHelp(pScrollbar, aRect, sStateStr,
|
|
|
|
QUICKHELP_RIGHT|QUICKHELP_VCENTER);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
EndScrollHdl( pScrollbar );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
if(!GetViewShell())
|
|
|
|
return 0;
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// boolean to avoid unnecessary invalidation of the window.
|
2003-03-27 14:45:43 +00:00
|
|
|
bool bInvalidateWin = true;
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
if( !pScrollbar->IsHoriScroll() ) // scroll vertically
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( Help::IsQuickHelpEnabled() )
|
2014-01-15 13:01:41 +00:00
|
|
|
Help::ShowQuickHelp(pScrollbar, Rectangle(), OUString(), 0);
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-06-06 23:24:23 +02:00
|
|
|
// Scroll how many pages ??
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust to new preview functionality
|
2013-11-29 13:03:27 +00:00
|
|
|
if( nThmbPos != pViewWin->SelectedPage() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// consider case that page <nThmbPos>
|
2003-03-27 14:45:43 +00:00
|
|
|
// is already visible
|
2013-10-16 16:31:35 +02:00
|
|
|
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
|
|
|
|
if ( pPagePreviewLay->IsPageVisible( nThmbPos ) )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
pPagePreviewLay->MarkNewSelectedPage( nThmbPos );
|
2011-01-29 10:26:56 +09:00
|
|
|
// invalidation of window is unnecessary
|
2003-03-27 14:45:43 +00:00
|
|
|
bInvalidateWin = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// consider whether layout columns
|
2003-03-27 14:45:43 +00:00
|
|
|
// fit or not.
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( !pPagePreviewLay->DoesPreviewLayoutColsFitIntoWindow() )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSttPage( nThmbPos );
|
|
|
|
pViewWin->SetSelectedPage( nThmbPos );
|
2013-10-16 16:36:45 +02:00
|
|
|
ChgPage( SwPagePreviewWin::MV_SCROLL, sal_False );
|
2011-01-29 10:26:56 +09:00
|
|
|
// update scrollbars
|
2003-03-27 14:45:43 +00:00
|
|
|
ScrollViewSzChg();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// correct scroll amount
|
2013-11-29 13:03:27 +00:00
|
|
|
const sal_Int16 nPageDiff = nThmbPos - pViewWin->SelectedPage();
|
|
|
|
const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
|
2003-03-27 14:45:43 +00:00
|
|
|
sal_Int16 nWinPagesToScroll = nPageDiff / nVisPages;
|
|
|
|
if ( nPageDiff % nVisPages )
|
|
|
|
{
|
|
|
|
// decrease/increase number of preview pages to scroll
|
|
|
|
nPageDiff < 0 ? --nWinPagesToScroll : ++nWinPagesToScroll;
|
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->SetSelectedPage( nThmbPos );
|
|
|
|
pViewWin->Scroll( 0, pPagePreviewLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-29 10:26:56 +09:00
|
|
|
// update accessibility
|
2013-10-16 16:36:45 +02:00
|
|
|
GetViewShell()->ShowPreviewSelection( nThmbPos );
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// invalidation of window is unnecessary
|
2003-03-27 14:45:43 +00:00
|
|
|
bInvalidateWin = false;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
long nThmbPos = pScrollbar->GetThumbPos();
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Scroll(0, nThmbPos - pViewWin->GetPaintedPreviewDocRect().Top());
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
2002-12-04 11:17:32 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
long nThmbPos = pScrollbar->GetThumbPos();
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Scroll(nThmbPos - pViewWin->GetPaintedPreviewDocRect().Left(), 0);
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
2011-01-29 10:26:56 +09:00
|
|
|
// additional invalidate page status.
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2002-12-04 11:17:32 +00:00
|
|
|
{
|
2003-04-17 09:16:40 +00:00
|
|
|
FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
|
|
|
|
FN_STAT_PAGE, 0
|
2002-12-04 11:17:32 +00:00
|
|
|
};
|
|
|
|
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
|
|
|
rBindings.Invalidate( aInval );
|
2011-01-29 10:26:56 +09:00
|
|
|
// control invalidation of window
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( bInvalidateWin )
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
Point SwPagePreview::AlignToPixel(const Point &rPt) const
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
return pViewWin->PixelToLogic( pViewWin->LogicToPixel( rPt ) );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::DocSzChgd( const Size &rSz )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if( aDocSz == rSz )
|
|
|
|
return;
|
|
|
|
|
|
|
|
aDocSz = rSz;
|
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
// #i96726#
|
2009-08-27 14:36:29 +00:00
|
|
|
// Due to the multiple page layout it is needed to trigger recalculation
|
|
|
|
// of the page preview layout, even if the count of pages is not changing.
|
|
|
|
mnPageCount = GetViewShell()->GetNumPages();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( aVisArea.GetWidth() )
|
|
|
|
{
|
2013-10-16 16:36:45 +02:00
|
|
|
ChgPage( SwPagePreviewWin::MV_CALC, sal_True );
|
2002-12-04 11:17:32 +00:00
|
|
|
ScrollDocSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::ScrollViewSzChg()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
if(!GetViewShell())
|
|
|
|
return ;
|
2012-05-29 18:35:36 +04:00
|
|
|
|
|
|
|
bool bShowVScrollbar = false, bShowHScrollbar = false;
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
if(pVScrollbar)
|
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
if(GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow())
|
2002-12-04 11:17:32 +00:00
|
|
|
{
|
|
|
|
//vertical scrolling by row
|
2011-01-29 10:26:56 +09:00
|
|
|
// adjust to new preview functionality
|
2013-11-29 13:03:27 +00:00
|
|
|
sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
|
2012-04-03 16:33:41 +01:00
|
|
|
|
2012-05-28 18:04:17 +04:00
|
|
|
pVScrollbar->SetVisibleSize( nVisPages );
|
|
|
|
// set selected page as scroll bar position,
|
|
|
|
// if it is visible.
|
2013-10-16 16:31:35 +02:00
|
|
|
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( pPagePreviewLay->IsPageVisible( pViewWin->SelectedPage() ) )
|
2012-05-28 18:04:17 +04:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pVScrollbar->SetThumbPos( pViewWin->SelectedPage() );
|
2012-05-28 18:04:17 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
pVScrollbar->SetThumbPos( pViewWin->GetSttPage() );
|
2012-05-28 18:04:17 +04:00
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
pVScrollbar->SetLineSize( pViewWin->GetCol() );
|
2012-05-28 18:04:17 +04:00
|
|
|
pVScrollbar->SetPageSize( nVisPages );
|
|
|
|
// calculate and set scrollbar range
|
|
|
|
Range aScrollbarRange( 1, mnPageCount );
|
|
|
|
// increase range by one, because left-top-corner is left blank.
|
|
|
|
++aScrollbarRange.Max();
|
|
|
|
// increase range in order to access all pages
|
|
|
|
aScrollbarRange.Max() += ( nVisPages - 1 );
|
|
|
|
pVScrollbar->SetRange( aScrollbarRange );
|
|
|
|
|
2012-05-29 18:35:36 +04:00
|
|
|
bShowVScrollbar = nVisPages < mnPageCount;
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
|
|
|
else //vertical scrolling by pixel
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
|
2003-03-27 14:45:43 +00:00
|
|
|
const Size& rPreviewSize =
|
2013-10-16 16:31:35 +02:00
|
|
|
GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
|
2002-12-04 11:17:32 +00:00
|
|
|
pVScrollbar->SetRangeMax(rPreviewSize.Height()) ;
|
|
|
|
long nVisHeight = rDocRect.GetHeight();
|
|
|
|
pVScrollbar->SetVisibleSize( nVisHeight );
|
|
|
|
pVScrollbar->SetThumbPos( rDocRect.Top() );
|
|
|
|
pVScrollbar->SetLineSize( nVisHeight / 10 );
|
|
|
|
pVScrollbar->SetPageSize( nVisHeight / 2 );
|
2012-05-29 18:35:36 +04:00
|
|
|
|
|
|
|
bShowVScrollbar = true;
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
2012-05-29 18:35:36 +04:00
|
|
|
|
2012-11-08 12:47:21 +04:00
|
|
|
if (!mbVScrollbarEnabled)
|
|
|
|
bShowVScrollbar = false;
|
|
|
|
|
2012-05-29 18:35:36 +04:00
|
|
|
ShowVScrollbar(bShowVScrollbar);
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
|
|
|
if(pHScrollbar)
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
|
2003-03-27 14:45:43 +00:00
|
|
|
const Size& rPreviewSize =
|
2013-10-16 16:31:35 +02:00
|
|
|
GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
|
2002-12-04 11:17:32 +00:00
|
|
|
long nVisWidth = 0;
|
|
|
|
long nThumb = 0;
|
|
|
|
Range aRange(0,0);
|
|
|
|
|
|
|
|
if(rDocRect.GetWidth() < rPreviewSize.Width())
|
|
|
|
{
|
2012-05-29 18:35:36 +04:00
|
|
|
bShowHScrollbar = true;
|
2012-04-03 16:33:41 +01:00
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
nVisWidth = rDocRect.GetWidth();
|
|
|
|
nThumb = rDocRect.Left();
|
|
|
|
aRange = Range(0, rPreviewSize.Width());
|
2012-04-03 16:33:41 +01:00
|
|
|
|
|
|
|
pHScrollbar->SetRange( aRange );
|
|
|
|
pHScrollbar->SetVisibleSize( nVisWidth );
|
|
|
|
pHScrollbar->SetThumbPos( nThumb );
|
|
|
|
pHScrollbar->SetLineSize( nVisWidth / 10 );
|
|
|
|
pHScrollbar->SetPageSize( nVisWidth / 2 );
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
2012-05-29 18:35:36 +04:00
|
|
|
|
2012-11-08 12:47:21 +04:00
|
|
|
if (!mbHScrollbarEnabled)
|
|
|
|
bShowHScrollbar = false;
|
|
|
|
|
2012-05-29 18:35:36 +04:00
|
|
|
ShowHScrollbar(bShowHScrollbar);
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
2012-05-29 18:35:36 +04:00
|
|
|
pScrollFill->Show(bShowVScrollbar && bShowHScrollbar);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::ScrollDocSzChg()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
ScrollViewSzChg();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-06-06 23:24:23 +02:00
|
|
|
// All about printing
|
2013-10-16 16:36:45 +02:00
|
|
|
SfxPrinter* SwPagePreview::GetPrinter( sal_Bool bCreate )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
return pViewWin->GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
sal_uInt16 SwPagePreview::SetPrinter( SfxPrinter *pNew, sal_uInt16 nDiffFlags, bool )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-10-26 19:50:13 +02:00
|
|
|
SwViewShell &rSh = *GetViewShell();
|
2009-09-18 10:15:03 +00:00
|
|
|
SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
|
|
|
|
if ( pOld && pOld->IsPrinting() )
|
|
|
|
return SFX_PRINTERROR_BUSY;
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
SwEditShell &rESh = (SwEditShell&)rSh; //Buh...
|
|
|
|
if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags )
|
|
|
|
{
|
2006-08-14 16:56:12 +00:00
|
|
|
rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
|
2000-09-18 16:15:01 +00:00
|
|
|
if( nDiffFlags & SFX_PRINTER_PRINTER )
|
|
|
|
rESh.SetModified();
|
|
|
|
}
|
|
|
|
if ( ( nDiffFlags & SFX_PRINTER_OPTIONS ) == SFX_PRINTER_OPTIONS )
|
2011-01-17 15:06:54 +01:00
|
|
|
::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, sal_False );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-02-20 00:58:47 +09:00
|
|
|
const bool bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION;
|
|
|
|
const bool bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE;
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( bChgOri || bChgSize )
|
|
|
|
{
|
|
|
|
rESh.StartAllAction();
|
|
|
|
if ( bChgOri )
|
2011-01-17 15:06:54 +01:00
|
|
|
rSh.ChgAllPageOrientation( sal_uInt16(pNew->GetOrientation()) );
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( bChgSize )
|
|
|
|
{
|
|
|
|
Size aSz( SvxPaperInfo::GetPaperSize( pNew ) );
|
|
|
|
rSh.ChgAllPageSize( aSz );
|
|
|
|
}
|
|
|
|
if( !bNormalPrint )
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->CalcWish( pViewWin->GetRow(), pViewWin->GetCol() );
|
2000-09-18 16:15:01 +00:00
|
|
|
rESh.SetModified();
|
|
|
|
rESh.EndAllAction();
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
|
|
|
|
SID_RULER_BORDERS, SID_RULER_PAGE_POS, 0
|
|
|
|
};
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_uInt16* pPtr = aInval + 1;
|
2000-09-18 16:15:01 +00:00
|
|
|
do {
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE( *(pPtr - 1) < *pPtr, "wrong sorting!" );
|
2000-09-18 16:15:01 +00:00
|
|
|
} while( *++pPtr );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GetViewFrame()->GetBindings().Invalidate(aInval);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
bool SwPagePreview::HasPrintOptionsPage() const
|
2012-12-06 21:05:57 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
SfxTabPage* SwPagePreview::CreatePrintOptionsPage( Window *pParent,
|
2000-09-18 16:15:01 +00:00
|
|
|
const SfxItemSet &rOptions )
|
|
|
|
{
|
|
|
|
return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint );
|
|
|
|
}
|
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
void SwPagePreviewWin::SetViewShell( SwViewShell* pShell )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
mpViewShell = pShell;
|
2013-10-16 16:36:45 +02:00
|
|
|
if ( mpViewShell && mpViewShell->IsPreview() )
|
2002-12-02 06:57:41 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout = mpViewShell->PagePreviewLayout();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::RepaintCoreRect( const SwRect& rRect )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// #i24183#
|
2013-10-16 16:31:35 +02:00
|
|
|
if ( mpPgPreviewLayout->PreviewLayoutValid() )
|
2004-04-21 08:41:45 +00:00
|
|
|
{
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Repaint( Rectangle( rRect.Pos(), rRect.SSize() ) );
|
2004-04-21 08:41:45 +00:00
|
|
|
}
|
2002-12-03 14:35:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** method to adjust preview to a new zoom factor
|
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
#i19975# also consider zoom type - adding parameter <_eZoomType>
|
2002-12-03 14:35:28 +00:00
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
|
2003-12-01 08:47:37 +00:00
|
|
|
const SvxZoomType _eZoomType )
|
|
|
|
{
|
2011-01-29 10:26:56 +09:00
|
|
|
// #i19975# consider zoom type
|
2003-12-01 08:47:37 +00:00
|
|
|
if ( _eZoomType == SVX_ZOOM_WHOLEPAGE )
|
|
|
|
{
|
|
|
|
mnRow = 1;
|
|
|
|
mnCol = 1;
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Init( mnCol, mnRow, maPxWinSize, true );
|
|
|
|
mpPgPreviewLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
|
2003-12-01 08:47:37 +00:00
|
|
|
mnSttPage, maPaintedPreviewDocRect );
|
|
|
|
SetSelectedPage( mnSttPage );
|
|
|
|
SetPagePreview(mnRow, mnCol);
|
|
|
|
maScale = GetMapMode().GetScaleX();
|
|
|
|
}
|
|
|
|
else if ( _nZoomFactor != 0 )
|
|
|
|
{
|
|
|
|
// calculate new scaling and set mapping mode appropriately.
|
|
|
|
Fraction aNewScale( _nZoomFactor, 100 );
|
|
|
|
MapMode aNewMapMode = GetMapMode();
|
|
|
|
aNewMapMode.SetScaleX( aNewScale );
|
|
|
|
aNewMapMode.SetScaleY( aNewScale );
|
|
|
|
SetMapMode( aNewMapMode );
|
|
|
|
|
|
|
|
// calculate new start position for preview paint
|
|
|
|
Size aNewWinSize = PixelToLogic( maPxWinSize );
|
|
|
|
Point aNewPaintStartPos =
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->GetPreviewStartPosForNewScale( aNewScale, maScale, aNewWinSize );
|
2003-12-01 08:47:37 +00:00
|
|
|
|
|
|
|
// remember new scaling and prepare preview paint
|
|
|
|
// Note: paint of preview will be performed by a corresponding invalidate
|
|
|
|
// due to property changes.
|
|
|
|
maScale = aNewScale;
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Prepare( 0, aNewPaintStartPos, maPxWinSize,
|
2003-12-01 08:47:37 +00:00
|
|
|
mnSttPage, maPaintedPreviewDocRect );
|
|
|
|
}
|
2002-12-03 14:35:28 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2010-10-11 17:38:56 -05:00
|
|
|
|
2011-01-29 10:26:56 +09:00
|
|
|
/**
|
2002-12-04 11:17:32 +00:00
|
|
|
* pixel scrolling - horizontally always or vertically
|
|
|
|
* when less than the desired number of rows fits into
|
|
|
|
* the view
|
2011-01-29 10:26:56 +09:00
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreviewWin::Scroll(long nXMove, long nYMove, sal_uInt16 /*nFlags*/)
|
2002-12-04 11:17:32 +00:00
|
|
|
{
|
|
|
|
maPaintedPreviewDocRect.Move(nXMove, nYMove);
|
2013-10-16 16:31:35 +02:00
|
|
|
mpPgPreviewLayout->Prepare( 0, maPaintedPreviewDocRect.TopLeft(),
|
2003-04-17 09:16:40 +00:00
|
|
|
maPxWinSize, mnSttPage,
|
2003-03-27 14:45:43 +00:00
|
|
|
maPaintedPreviewDocRect );
|
|
|
|
|
2002-12-04 11:17:32 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
sal_Bool SwPagePreview::HandleWheelCommands( const CommandEvent& rCEvt )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bOk = sal_False;
|
2000-09-18 16:15:01 +00:00
|
|
|
const CommandWheelData* pWData = rCEvt.GetWheelData();
|
|
|
|
if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
//only the Preference shouldn't control the Zoom, it is better to detect AT tools running. So the bridge can be used here
|
|
|
|
if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom();
|
|
|
|
const sal_uInt16 nOffset = 10;
|
2003-03-27 14:45:43 +00:00
|
|
|
if( 0L > pWData->GetDelta() )
|
|
|
|
{
|
|
|
|
nFactor -= nOffset;
|
|
|
|
if(nFactor < MIN_PREVIEW_ZOOM)
|
2013-11-29 13:03:27 +00:00
|
|
|
nFactor = MIN_PREVIEW_ZOOM;
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFactor += nOffset;
|
|
|
|
if(nFactor > MAX_PREVIEW_ZOOM)
|
2013-11-29 13:03:27 +00:00
|
|
|
nFactor = MAX_PREVIEW_ZOOM;
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
|
|
|
SetZoom(SVX_ZOOM_PERCENT, nFactor);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
bOk = sal_True;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
2013-11-29 13:03:27 +00:00
|
|
|
bOk = pViewWin->HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
|
2000-09-18 16:15:01 +00:00
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
|
2007-09-27 11:35:25 +00:00
|
|
|
uno::Reference< ::com::sun::star::accessibility::XAccessible >
|
2013-10-16 16:36:45 +02:00
|
|
|
SwPagePreviewWin::CreateAccessible()
|
2002-05-22 10:48:43 +00:00
|
|
|
{
|
2013-03-03 17:11:39 +01:00
|
|
|
SolarMutexGuard aGuard; // this should have happened already!!!
|
2002-05-22 10:48:43 +00:00
|
|
|
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE( GetViewShell() != NULL, "We need a view shell" );
|
2013-11-29 13:03:27 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible( sal_False );
|
|
|
|
if (xAcc.is())
|
|
|
|
{
|
|
|
|
return xAcc;
|
|
|
|
}
|
|
|
|
if (mpViewShell)
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccPreview = mpViewShell->CreateAccessiblePreview();
|
|
|
|
SetAccessible(xAccPreview);
|
|
|
|
}
|
|
|
|
return GetAccessible( sal_False );
|
|
|
|
}
|
|
|
|
|
|
|
|
// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
|
|
|
|
// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
|
|
|
|
void SwPagePreviewWin::SwitchView()
|
|
|
|
{
|
|
|
|
#ifdef ACCESSIBLE_LAYOUT
|
|
|
|
if (!Application::IsAccessibilityEnabled())
|
|
|
|
{
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
if (mpViewShell)
|
|
|
|
{
|
|
|
|
mpViewShell->InvalidateAccessibleFocus();
|
|
|
|
}
|
|
|
|
#endif
|
2002-05-22 10:48:43 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
|
2002-05-06 11:11:40 +00:00
|
|
|
{
|
2002-12-04 11:17:32 +00:00
|
|
|
GetViewShell()->ApplyAccessiblityOptions(rAccessibilityOptions);
|
2002-05-06 11:11:40 +00:00
|
|
|
}
|
2002-06-28 11:11:19 +00:00
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::ShowHScrollbar(sal_Bool bShow)
|
2002-06-28 11:11:19 +00:00
|
|
|
{
|
2002-07-05 11:39:21 +00:00
|
|
|
pHScrollbar->Show(bShow);
|
|
|
|
InvalidateBorder();
|
2002-06-28 11:11:19 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::ShowVScrollbar(sal_Bool bShow)
|
2002-06-28 11:11:19 +00:00
|
|
|
{
|
2002-07-05 11:39:21 +00:00
|
|
|
pVScrollbar->Show(bShow);
|
|
|
|
InvalidateBorder();
|
2002-06-28 11:11:19 +00:00
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::EnableHScrollbar(bool bEnable)
|
2012-11-08 12:47:21 +04:00
|
|
|
{
|
|
|
|
if (mbHScrollbarEnabled != bEnable)
|
|
|
|
{
|
|
|
|
mbHScrollbarEnabled = bEnable;
|
|
|
|
ScrollViewSzChg();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::EnableVScrollbar(bool bEnable)
|
2012-11-08 12:47:21 +04:00
|
|
|
{
|
|
|
|
if (mbVScrollbarEnabled != bEnable)
|
|
|
|
{
|
|
|
|
mbVScrollbarEnabled = bEnable;
|
|
|
|
ScrollViewSzChg();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::SetZoom(SvxZoomType eType, sal_uInt16 nFactor)
|
2002-11-27 08:01:27 +00:00
|
|
|
{
|
2013-10-26 19:50:13 +02:00
|
|
|
SwViewShell& rSh = *GetViewShell();
|
2002-11-27 08:01:27 +00:00
|
|
|
SwViewOption aOpt(*rSh.GetViewOptions());
|
2011-01-29 10:26:56 +09:00
|
|
|
// perform action only on changes of zoom or zoom type.
|
2003-03-27 14:45:43 +00:00
|
|
|
if ( aOpt.GetZoom() != nFactor ||
|
|
|
|
aOpt.GetZoomType() != eType )
|
|
|
|
{
|
|
|
|
aOpt.SetZoom(nFactor);
|
|
|
|
aOpt.SetZoomType(eType);
|
|
|
|
rSh.ApplyViewOptions( aOpt );
|
|
|
|
lcl_InvalidateZoomSlots(GetViewFrame()->GetBindings());
|
2011-01-29 10:26:56 +09:00
|
|
|
// #i19975# also consider zoom type
|
2013-11-29 13:03:27 +00:00
|
|
|
pViewWin->AdjustPreviewToNewZoom( nFactor, eType );
|
2003-03-27 14:45:43 +00:00
|
|
|
ScrollViewSzChg();
|
|
|
|
}
|
2002-11-27 08:01:27 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
/** adjust position of vertical scrollbar
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2013-10-16 16:36:45 +02:00
|
|
|
void SwPagePreview::SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos )
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
|
|
|
if ( pVScrollbar )
|
|
|
|
{
|
|
|
|
pVScrollbar->SetThumbPos( _nNewThumbPos );
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|