diff options
author | Michael Stahl <mst@openoffice.org> | 2010-04-28 17:52:28 +0200 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-04-28 17:52:28 +0200 |
commit | ec28d2f4aa2d449ae4b6dead85675d5c14085cae (patch) | |
tree | a8fa537519ab65a917ec15d81b2934202a108a5c /sw | |
parent | bfe661492df0e45f49c9ad9fc23b36440f6dde03 (diff) | |
parent | b812217fb9701fc0b0bca438668611fc8a10cc10 (diff) |
merge DEV300_m77
Diffstat (limited to 'sw')
162 files changed, 2585 insertions, 3716 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index 00a8ec6b825c..55fc0901a7e0 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -83,6 +83,13 @@ class IDocumentMarkAccess const ::rtl::OUString& rProposedName, MarkType eMark) =0; + virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType) = 0; + virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType) = 0; + /** Returns a mark in the document for a paragraph. If there is none, a mark will be created. diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx index a1b4c6583ffa..6a46ae01d49e 100644 --- a/sw/inc/IMark.hxx +++ b/sw/inc/IMark.hxx @@ -31,6 +31,7 @@ #include <calbck.hxx> #include <pam.hxx> #include <boost/operators.hpp> +#include <map> #ifndef SW_DECL_SWSERVEROBJECT_DEFINED #define SW_DECL_SWSERVEROBJECT_DEFINED @@ -76,6 +77,8 @@ namespace sw { namespace mark { return GetMarkEnd() < rPos; } bool EndsAfter(const SwPosition& rPos) const { return GetMarkEnd() > rPos; } + + virtual rtl::OUString ToString( ) const =0; }; class IBookmark @@ -92,13 +95,17 @@ namespace sw { namespace mark : virtual public IMark { public: + typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t; //getters virtual ::rtl::OUString GetFieldname() const =0; virtual ::rtl::OUString GetFieldHelptext() const =0; + virtual parameter_map_t* GetParameters() =0; + virtual const parameter_map_t* GetParameters() const =0; //setters virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0; virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0; + virtual void Invalidate() = 0; }; class ICheckboxFieldmark diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 9bc96c943792..bcf511aa2a5b 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -107,8 +107,9 @@ struct SwContentAtPos SW_REFMARK = 0x0100, SW_NUMLABEL = 0x0200, // #i23726# SW_CONTENT_CHECK = 0x0400, // --> FME 2005-05-13 #i43742# <-- - SW_SMARTTAG = 0x0800 -#ifdef DBG_UTIL + SW_SMARTTAG = 0x0800, + SW_FORMCTRL = 0x1000 +#ifndef PRODUCT ,SW_CURR_ATTRS = 0x4000 // nur zum Debuggen ,SW_TABLEBOXVALUE = 0x8000 // nur zum Debuggen #endif @@ -119,6 +120,7 @@ struct SwContentAtPos const SfxPoolItem* pAttr; const SwRedline* pRedl; SwCntntNode * pNode; // #i23726# + const sw::mark::IFieldmark* pFldmark; } aFnd; int nDist; // #i23726# diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index c78342e6236a..5406fb042e95 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -302,7 +302,7 @@ class SwDrawVirtObj : public SdrVirtObj using SdrVirtObj::GetPlusHdl; - private: + protected: // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is // not used but something own (top left of new SnapRect minus top left // of original SnapRect) diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 2ad41e0539f4..16e6cd047fb6 100644..100755 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -151,7 +151,8 @@ public: static rtl::OUString GetEventName( sal_Int32 nId ); //Das Doc wird fuer SO-Datenaustausch benoetigt! - SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, sal_Bool _bScriptingSupport = sal_True ); + SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED ); + SwDocShell( const sal_uInt64 i_nSfxCreationFlags ); SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); ~SwDocShell(); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 2d890f32a8bf..8d2c1a81de49 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -41,6 +41,7 @@ #include <com/sun/star/linguistic2/ProofreadingResult.hpp> #include <fldupde.hxx> #include <tblenum.hxx> +#include <IMark.hxx> #include <vector> #include <swundo.hxx> @@ -414,6 +415,9 @@ public: const SwTOXType* GetTOXType(TOXTypes eTyp, USHORT nId) const; void InsertTOXType(const SwTOXType& rTyp); + // new field stuff + BOOL UpdateField(sw::mark::IFieldmark &fieldBM); + //AutoMark file const String& GetTOIAutoMarkURL() const; void SetTOIAutoMarkURL(const String& rSet); diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 0103f21408b9..7da1c30e6577 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -536,10 +536,10 @@ public: const SfxItemSet* pFlyAttrSet = 0, const SfxItemSet* pGrfAttrSet = 0, SwFrmFmt* = 0 ); - //Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel - // angemeldet sein. - void Insert( SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet = 0, - SwFrmFmt* = 0, const Point* = 0 ); + + // Insertion of a drawing object which have to be already inserted in the DrawModel + void InsertDrawObj( SdrObject& rDrawObj, + const Point& rInsertPosition ); BOOL ReplaceSdrObj( const String& rGrfName, const String& rFltName, const Graphic* pGrf = 0 ); diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 5f0c663b4a60..8a6f536ad46b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -41,12 +41,8 @@ #define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05) #define CH_TXT_ATR_SUBST_FIELDSTART ("[") #define CH_TXT_ATR_SUBST_FIELDEND ("]") -//#define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)'#') #define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06) -/* -#define FIELD_BOOKMARK_PREFIX "__" -#define FIELD_FORM_BOOKMARK_PREFIX "__FORM" -*/ + /* * Hier kommen erst mal die enums fuer die Hints */ diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index d041dfc488c7..dd822a11dfdd 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -135,6 +135,9 @@ protected: public: ~SwNodes(); + typedef ::std::vector<SwNodeRange> NodeRanges_t; + typedef ::std::vector<NodeRanges_t> TableRanges_t; + SwNodePtr operator[]( ULONG n ) const { return (SwNodePtr)BigPtrArray::operator[] ( n ); } @@ -276,8 +279,11 @@ public: SwTableBoxFmt* pBoxFmt, SwTxtFmtColl* pTxtColl, SwUndoTxtToTbl* pUndo = 0 ); + + SwNodeRange * ExpandRangeForTableBox(const SwNodeRange & rRange); + //create a table from a vector of NodeRanges - API support - SwTableNode* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes, + SwTableNode* TextToTable( const TableRanges_t& rTableNodes, SwTableFmt* pTblFmt, SwTableLineFmt* pLineFmt, SwTableBoxFmt* pBoxFmt, diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 3e9498f5db32..748dceed0c83 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -208,10 +208,6 @@ public: BOOL GetFileFilterNms( String* pFileNm, String* pFilterNm ) const; void ReleaseLink(); - // Prioritaet beim Laden der Grafik setzen. Geht nur, wenn der Link - // ein FileObject gesetzt hat - void SetTransferPriority( USHORT nPrio ); - // Skalieren einer Image-Map: Die Image-Map wird um den Faktor // zwischen Grafik-Groesse und Rahmen-Groesse vergroessert/verkleinert void ScaleImageMap(); diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 67149cf998ec..217ff06a8be1 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -504,6 +504,10 @@ public: */ BOOL GetFirstLineOfsWithNum( short& rFirstOffset ) const; + // --> OD 2010-01-05 #b6884103# + SwTwips GetAdditionalIndentForStartingNewList() const; + // <-- + // --> OD 2008-12-02 #i96772# void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const; // <-- diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 1ded0d912d2a..62277e6d48b0 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -269,6 +269,7 @@ public: DECL_FIXEDMEMPOOL_NEWDEL(SwPaM); String GetTxt() const; + void InvalidatePaM(); }; diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 7d9ebb98d56b..592725f78d63 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -593,7 +593,6 @@ #include "sfx2/tabdlg.hxx" #include "sfx2/tbxctrl.hxx" #include "sfx2/templdlg.hxx" -#include "sfx2/topfrm.hxx" #include "sfx2/tplpitem.hxx" #include "sfx2/viewfac.hxx" #include "sfx2/viewfrm.hxx" diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index ce5cf81a6f00..f76ac65e747a 100644..100755 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -230,6 +230,9 @@ class SwRenderData std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrames; // the map of start frames for those pages + // printer paper tray to use for each of the m_aValidPages above + std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays; + // vector of pages and their order to be printed (duplicates and any order allowed!) // (see 'render' in unotxdoc.cxx) std::vector< sal_Int32 > m_aPagesToPrint; @@ -264,6 +267,7 @@ public: void DeletePostItData(); bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; } + bool NeedNewViewOptionAdjust( const SwWrtShell& ) const; void ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions ); void ViewOptionAdjust( const SwPrtOptions *pPrtOptions ); void ViewOptionAdjustStop(); @@ -284,6 +288,11 @@ public: ValidStartFramesMap_t & GetValidStartFrames() { return m_aValidStartFrames; } const ValidStartFramesMap_t & GetValidStartFrames() const { return m_aValidStartFrames; } + // a map for printer paper tray numbers to use for each document page + // a value of -1 for the tray means that there is no specific tray defined + std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() { return m_aPrinterPaperTrays; } + const std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() const { return m_aPrinterPaperTrays; } + // used for 'normal' printing // A page value of 0 as entry indicates that this page is not from the document but // from the post-it document. (See also GetPostItStartFrame below) diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx index a8dea497c3f7..fdd5df4c8a6c 100644 --- a/sw/inc/unobookmark.hxx +++ b/sw/inc/unobookmark.hxx @@ -198,6 +198,34 @@ public: }; +class SwXFieldmarkParameters + : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameContainer> + , private SwClient +{ + public: + SwXFieldmarkParameters(::sw::mark::IFieldmark* const pFieldmark) + { + pFieldmark->Add(this); + } + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); + //SwClient + virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew); + private: + ::sw::mark::IFieldmark::parameter_map_t* getCoreParameters() throw (::com::sun::star::uno::RuntimeException); +}; + typedef cppu::ImplInheritanceHelper1< SwXBookmark, ::com::sun::star::text::XFormField > SwXFieldmark_Base; @@ -219,19 +247,11 @@ public: ::com::sun::star::text::XTextRange > & xTextRange) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getDescription() - throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getType() - throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getRes() - throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL setDescription(const ::rtl::OUString& rDescription) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setType(::sal_Int16 fieldType) + virtual ::rtl::OUString SAL_CALL getFieldType(void) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setFieldType(const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRes(::sal_Int16 res) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( ) throw (::com::sun::star::uno::RuntimeException); }; diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx index cb333da905d9..ff7a536fb69e 100644 --- a/sw/inc/unotextrange.hxx +++ b/sw/inc/unotextrange.hxx @@ -60,12 +60,12 @@ class SwUnoInternalPaM private: SwUnoInternalPaM(const SwUnoInternalPaM&); - SwUnoInternalPaM& operator=(const SwPaM& rPaM); public: SwUnoInternalPaM(SwDoc& rDoc); virtual ~SwUnoInternalPaM(); + SwUnoInternalPaM& operator=(const SwPaM& rPaM); }; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index fc5ae0fad8a9..b50d5b0a1b76 100644..100755 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -607,6 +607,9 @@ public: ~SwViewOptionAdjust_Impl(); void AdjustViewOptions( const SwPrtOptions *pPrtOptions ); + + bool checkShell( const SwWrtShell& rCompare ) const + { return &rCompare == &m_rShell; } }; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 93ed55d36872..700b50121675 100644..100755 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -189,9 +189,6 @@ class SW_DLLPUBLIC ViewShell : public Ring SW_DLLPRIVATE sal_Bool CheckInvalidForPaint( const SwRect & );//Direkt Paint oder lieber //eine Aktion ausloesen. - SW_DLLPRIVATE void Scroll(); //Scrollen wenn sich aus der LayAction Scrollmoeglichkeiten - //ergaben. - SW_DLLPRIVATE void PrepareForPrint( const SwPrintData &rOptions ); SW_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt ); @@ -238,11 +235,7 @@ public: void ChgHyphenation() { Reformat(); } void ChgNumberDigits(); - //Methoden fuer Paint- und Scrollrects, die auf allen Shells im - //Ring arbeiten. sal_Bool AddPaintRect( const SwRect &rRect ); - void AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, long nOffs ); - void SetNoNextScroll(); void InvalidateWindows( const SwRect &rRect ); diff --git a/sw/prj/build.lst b/sw/prj/build.lst index 6fd49c1d77b0..87d163d72648 100755 --- a/sw/prj/build.lst +++ b/sw/prj/build.lst @@ -74,3 +74,4 @@ sw sw\source\ui nmake - all sw_ui sw_app sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_excpt sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL sw sw\source\filter nmake - all sw_flt sw_ascii sw_bsflt sw_html sw_rtf sw_wrtr sw_ww1 sw_ww8 sw_xml NULL sw sw\util nmake - all sw_util sw_core sw_flt sw_sdi sw_ui NULL +sw sw\qa\unoapi nmake - all sw_qa_unoapi NULL diff --git a/sw/qa/core/export.map b/sw/qa/core/export.map index 0e4fe0c88ff2..7321bbca16ad 100644 --- a/sw/qa/core/export.map +++ b/sw/qa/core/export.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3.0 { +UDK_3_0_0 { global: registerAllTestFunction; diff --git a/sw/qa/core/makefile.mk b/sw/qa/core/makefile.mk index 02e69f45dae2..00ebfda8844a 100644 --- a/sw/qa/core/makefile.mk +++ b/sw/qa/core/makefile.mk @@ -37,6 +37,8 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:testjob by codegen.pl diff --git a/sw/qa/unoapi/Test.java b/sw/qa/unoapi/Test.java new file mode 100644 index 000000000000..e0311cc069bb --- /dev/null +++ b/sw/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package org.openoffice.sw.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "sw.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/sw/qa/unoapi/knownissues.xcl b/sw/qa/unoapi/knownissues.xcl index ee20559798a6..0c0ae3e506eb 100644 --- a/sw/qa/unoapi/knownissues.xcl +++ b/sw/qa/unoapi/knownissues.xcl @@ -150,4 +150,7 @@ sw.SwXTextEmbeddedObject::com::sun::star::text::BaseFrameProperties sw.SwXTextPortion::com::sun::star::style::CharacterProperties ### i94977 ### -sw.SwXTextGraphicObject::com::sun::star::text::BaseFrameProperties
\ No newline at end of file +sw.SwXTextGraphicObject::com::sun::star::text::BaseFrameProperties + +### i109917 ### +sw.SwXTextDocument::com::sun::star::document::XEventBroadcaster diff --git a/sw/qa/unoapi/makefile.mk b/sw/qa/unoapi/makefile.mk index 777c108c9e3e..f5102c2c9c84 100644 --- a/sw/qa/unoapi/makefile.mk +++ b/sw/qa/unoapi/makefile.mk @@ -1,7 +1,6 @@ #************************************************************************* -# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -22,18 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. +#***********************************************************************/ -PRJNAME=sw -TARGET=qa_unoapi +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -.INCLUDE: settings.mk +PRJ = ../.. +PRJNAME = sw +TARGET = qa_unoapi + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/sw/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce sw.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi index 4b9afe2db298..cd2d1f850090 100644 --- a/sw/sdi/_docsh.sdi +++ b/sw/sdi/_docsh.sdi @@ -75,10 +75,6 @@ interface BaseTextDocument ExecMethod = Execute ; ] - SID_MAIL_PREPAREEXPORT - [ - ExecMethod = Execute ; - ] SID_MAIL_EXPORT_FINISHED [ ExecMethod = Execute; diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx index dfc5df0d2cac..d1113f4fb484 100644 --- a/sw/source/core/SwNumberTree/SwNodeNum.cxx +++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx @@ -37,6 +37,10 @@ // --> OD 2007-10-31 #i83479# #include <IDocumentListItems.hxx> // <-- +// --> OD 2010-01-13 #b6912256# +#include <svl/svstdarr.hxx> +#include <doc.hxx> +// <-- // --> OD 2008-02-19 #refactorlists# SwNodeNum::SwNodeNum( SwTxtNode* pTxtNode ) @@ -489,8 +493,21 @@ void SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum ) SwTxtNode* pTxtNode( rNodeNum.GetTxtNode() ); if ( pTxtNode ) { - // --> OD 2008-03-13 #refactorlists# pTxtNode->RemoveFromList(); + // --> OD 2010-01-13 #b6912256# + // clear all list attributes and the list style + SvUShortsSort aResetAttrsArray; + aResetAttrsArray.Insert( RES_PARATR_LIST_ID ); + aResetAttrsArray.Insert( RES_PARATR_LIST_LEVEL ); + aResetAttrsArray.Insert( RES_PARATR_LIST_ISRESTART ); + aResetAttrsArray.Insert( RES_PARATR_LIST_RESTARTVALUE ); + aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED ); + aResetAttrsArray.Insert( RES_PARATR_NUMRULE ); + SwPaM aPam( *pTxtNode ); + pTxtNode->GetDoc()->ResetAttrs( aPam, sal_False, + &aResetAttrsArray, + false ); + // <-- } } } diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 6752f70e5eaf..11060352b6c3 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -41,12 +41,14 @@ #include <undobj.hxx> #include <unobookmark.hxx> #include <rtl/random.h> +#include <xmloff/odffields.hxx> SV_IMPL_REF( SwServerObject ) using namespace ::sw::mark; using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; namespace { @@ -75,20 +77,20 @@ namespace const sal_Unicode aStartMark, const sal_Unicode aEndMark) { - const SwPosition& rStart = pField->GetMarkStart(); - const SwPosition& rEnd = pField->GetMarkEnd(); + SwPosition& rStart = pField->GetMarkStart(); + SwPosition& rEnd = pField->GetMarkEnd(); SwTxtNode const * const pStartTxtNode = io_pDoc->GetNodes()[rStart.nNode]->GetTxtNode(); SwTxtNode const * const pEndTxtNode = io_pDoc->GetNodes()[rEnd.nNode]->GetTxtNode(); const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex()); const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1); - const SwPaM aStartPaM(rStart); - const SwPaM aEndPaM(rEnd); + SwPaM aStartPaM(rStart); + SwPaM aEndPaM(rEnd); io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL); if(ch_start != aStartMark) { io_pDoc->InsertString(aStartPaM, aStartMark); } - if(aEndMark && ch_end != aEndMark) + if ( aEndMark && ( ch_end != aEndMark ) && ( rStart != rEnd ) ) { io_pDoc->InsertString(aEndPaM, aEndMark); } @@ -112,6 +114,11 @@ namespace sw { namespace mark } } + bool MarkBase::IsCoveringPosition(const SwPosition& rPos) const + { + return GetMarkStart() <= rPos && rPos <= GetMarkEnd(); + } + void MarkBase::SetMarkPos(const SwPosition& rNewPos) { ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1); @@ -124,6 +131,17 @@ namespace sw { namespace mark //lcl_FixPosition(*m_pPos2); } + rtl::OUString MarkBase::ToString( ) const + { + rtl::OUStringBuffer buf; + buf.appendAscii( "Mark: ( Name, [ Node1, Index1 ] ): ( " ); + buf.append( m_aName ).appendAscii( ", [ " ); + buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " ); + buf.append( sal_Int32( GetMarkPos().nContent.GetIndex( ) ) ).appendAscii( " ] )" ); + + return buf.makeStringAndClear( ); + } + MarkBase::~MarkBase() { } @@ -145,7 +163,7 @@ namespace sw { namespace mark return aResult.append(nCount++).append(sUniquePostfix).makeStringAndClear(); } - // SwClient + void MarkBase::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew) { SwModify::Modify(pOld, pNew); @@ -250,6 +268,7 @@ namespace sw { namespace mark uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject() { + // create new SwXBookmark SwDoc *const pDoc( GetMarkPos().GetDoc() ); OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?"); const uno::Reference< rdf::XMetadatable> xMeta( @@ -265,6 +284,28 @@ namespace sw { namespace mark SetOtherMarkPos(GetMarkPos()); } + rtl::OUString Fieldmark::ToString( ) const + { + rtl::OUStringBuffer buf; + buf.appendAscii( "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " ); + buf.append( m_aName ).appendAscii( ", " ); + buf.append( m_aFieldname ).appendAscii( ", [ " ); + buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " ); + buf.append( sal_Int32( GetMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ], [" ); + buf.append( sal_Int32( GetOtherMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " ); + buf.append( sal_Int32( GetOtherMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ] ) " ); + + return buf.makeStringAndClear( ); + } + + void Fieldmark::Invalidate( ) + { + // @TODO: Does exist a better solution to trigger a format of the + // fieldmark portion? If yes, please use it. + SwPaM aPaM( this->GetMarkPos(), this->GetOtherMarkPos() ); + aPaM.InvalidatePaM(); + } + const ::rtl::OUString Fieldmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__Fieldmark__"); TextFieldmark::TextFieldmark(const SwPaM& rPaM) @@ -282,12 +323,24 @@ namespace sw { namespace mark void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc) { - lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND); - } + lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FORMELEMENT, CH_TXT_ATR_FIELDEND); + // For some reason the end mark is moved from 1 by the Insert: we don't + // want this for checkboxes + this->GetMarkEnd( ).nContent--; + } void CheckboxFieldmark::SetChecked(bool checked) - { m_isChecked = checked; } + { + (*GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_RESULT)] = makeAny(checked); + } bool CheckboxFieldmark::IsChecked() const - { return m_isChecked; } + { + bool bResult = false; + parameter_map_t::const_iterator pResult = GetParameters()->find(::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_RESULT)); + if(pResult != GetParameters()->end()) + pResult->second >>= bResult; + return bResult; + } + }} diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 4e0d1a4151e9..dc083801ee8e 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -64,7 +64,7 @@ namespace sw { namespace mark MarkBase::SetMarkPos(rNewPos); } - const SwPosition& CrossRefBookmark::GetOtherMarkPos() const + SwPosition& CrossRefBookmark::GetOtherMarkPos() const { OSL_PRECOND(false, "<SwCrossRefBookmark::GetOtherMarkPos(..)>" diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index eae6ca072037..9af115269cd8 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -392,10 +392,18 @@ BOOL SwCrsrShell::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode, else { const BOOL bSkipHidden = !GetViewOptions()->IsShowHiddenChar(); - bRet = SetInFrontOfLabel( FALSE ); + // --> OD 2009-12-30 #i107447# + // To avoid loop the reset of <bInFrontOfLabel> flag is no longer + // reflected in the return value <bRet>. + const bool bResetOfInFrontOfLabel = SetInFrontOfLabel( FALSE ); bRet = pShellCrsr->LeftRight( bLeft, nCnt, nMode, bVisualAllowed, - bSkipHidden, - !IsOverwriteCrsr() ) || bRet; + bSkipHidden, !IsOverwriteCrsr() ); + if ( !bRet && bLeft && bResetOfInFrontOfLabel ) + { + // undo reset of <bInFrontOfLabel> flag + SetInFrontOfLabel( TRUE ); + } + // <-- } if( bRet ) @@ -1770,13 +1778,6 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) } } - //Ggf. gescrollten Bereicht korrigieren (Alignment). - //Nur wenn gescrollt wurde, und wenn keine Selektion existiert. - if( pFrm && Imp()->IsScrolled() && - pShellCrsr->GetNext() == pShellCrsr && !pShellCrsr->HasMark() ) - Imp()->RefreshScrolledArea( aCharRect ); - - eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst if( pFrm && Imp()->IsAccessible() ) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 78e4282a3f5f..249500b95f98 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1006,9 +1006,9 @@ BOOL SwCrsrShell::IsPageAtPos( const Point &rPt ) const } BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, - SwContentAtPos& rCntntAtPos, - BOOL bSetCrsr, - SwRect* pFldRect ) + SwContentAtPos& rCntntAtPos, + BOOL bSetCrsr, + SwRect* pFldRect ) { SET_CURR_SHELL( this ); BOOL bRet = FALSE; @@ -1173,6 +1173,17 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, } } + if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos ) + { + IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); + sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos ); + if( bCrsrFoundExact && pTxtNd && pFldBookmark) { + rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL; + rCntntAtPos.aFnd.pFldmark = pFldBookmark; + bRet=TRUE; + } + } + if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos ) { if( aTmpState.bFtnNoInfo ) diff --git a/sw/source/core/crsr/makefile.mk b/sw/source/core/crsr/makefile.mk index 6d579171dc02..a2571901c068 100644 --- a/sw/source/core/crsr/makefile.mk +++ b/sw/source/core/crsr/makefile.mk @@ -47,6 +47,7 @@ CDEFS+=-Dmydebug EXCEPTIONSFILES= \ $(SLO)$/crbm.obj \ $(SLO)$/crsrsh.obj \ + $(SLO)$/bookmrk.obj \ $(SLO)$/viscrs.obj SLOFILES = \ diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 565669bd7a35..ec30b5aefbe0 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -53,6 +53,7 @@ #include <ndtxt.hxx> // #111827# #include <IMark.hxx> +#include <hints.hxx> // fuer den dummen ?MSC-? Compiler inline xub_StrLen GetSttOrEnd( BOOL bCondition, const SwCntntNode& rNd ) @@ -824,16 +825,21 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const } //FIXME FieldBk // TODO: Form Protection when Enhanced Fields are enabled -// if( !bRet ) -// { -// const SwDoc *pDoc=GetDoc(); -// SwBookmark *pA = ( pDoc && pPoint ? pDoc->getFieldmarkFor( *pPoint ) : NULL ); -// SwBookmark *pB = ( pDoc && pMark ? pDoc->getFieldmarkFor( *pMark ) : pA ); -// bRet = ( pA != pB ); -// bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM ); -// if( bProtectForm ) -// bRet |= ( pA==NULL || pB==NULL ); -// } + if (!bRet) { + const SwDoc *pDoc = GetDoc(); + sw::mark::IMark* pA = NULL; + sw::mark::IMark* pB = NULL; + if ( pDoc ) + { + const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( ); + pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL; + pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA; + bRet = ( pA != pB ); + } + bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM ); + if ( bProtectForm ) + bRet |= ( pA == NULL || pB == NULL ); + } return bRet; } @@ -1220,6 +1226,20 @@ BOOL SwPaM::Overlap(const SwPaM & a, const SwPaM & b) return !(*b.End() <= *a.Start() || *a.End() <= *b.End()); } +void SwPaM::InvalidatePaM() +{ + const SwNode *_pNd=this->GetNode(); + const SwTxtNode *_pTxtNd=(_pNd!=NULL?_pNd->GetTxtNode():NULL); + if (_pTxtNd!=NULL) + { + // pretent that the PaM marks inserted text to recalc the portion... + SwInsTxt aHint( Start()->nContent.GetIndex(), + End()->nContent.GetIndex() - Start()->nContent.GetIndex() + 1 ); + SwModify *_pModify=(SwModify*)_pTxtNd; + _pModify->Modify( 0, &aHint); + } +} + BOOL SwPaM::LessThan(const SwPaM & a, const SwPaM & b) { return (*a.Start() < *b.Start()) || (*a.Start() == *b.Start() && *a.End() < *b.End()); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 0caff6058136..7f2b92979f57 100644..100755 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -47,6 +47,7 @@ #include <rtl/ustring.hxx> #include <vcl/virdev.hxx> #include <svl/itemiter.hxx> +#include <svl/poolitem.hxx> #include <unotools/syslocale.hxx> #include <sfx2/printer.hxx> #include <editeng/keepitem.hxx> @@ -55,9 +56,11 @@ #include <sfx2/linkmgr.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> +#include <editeng/pbinitem.hxx> #include <unotools/charclass.hxx> #include <unotools/localedatawrapper.hxx> +#include <swatrset.hxx> #include <swmodule.hxx> #include <fmtpdsc.hxx> #include <fmtanchr.hxx> @@ -1177,6 +1180,23 @@ static void lcl_FormatPostIt( } +// provide the paper tray to use according to the page style in use, +// but do that only if the respective item is NOT just the default item +static sal_Int32 lcl_GetPaperBin( const SwPageFrm *pStartFrm ) +{ + sal_Int32 nRes = -1; + + const SwFrmFmt &rFmt = pStartFrm->GetPageDesc()->GetMaster(); + const SfxPoolItem *pItem = NULL; + SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, FALSE, &pItem ); + const SvxPaperBinItem *pPaperBinItem = dynamic_cast< const SvxPaperBinItem * >(pItem); + if (eState > SFX_ITEM_DEFAULT && pPaperBinItem) + nRes = pPaperBinItem->GetValue(); + + return nRes; +} + + void SwDoc::CalculatePagesForPrinting( /* out */ SwRenderData &rData, const SwPrintUIOptions &rOptions, @@ -1187,11 +1207,15 @@ void SwDoc::CalculatePagesForPrinting( if (!pLayout) return; + const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + const bool bPrintSelection = nContent == 2; + // properties to take into account when calcualting the set of pages // (PDF export UI does not allow for selecting left or right pages only) bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages(); bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); - bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport ); + // #i103700# printing selections should not allow for automatic inserting empty pages + bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport ); Range aPages( 1, nDocPageCount ); @@ -1253,6 +1277,7 @@ void SwDoc::CalculatePagesForPrinting( nPageNo = nFirstPageNo; + std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); rValidPages.clear(); @@ -1268,9 +1293,10 @@ void SwDoc::CalculatePagesForPrinting( if ( bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { - // pStPage->GetUpper()->Paint( pStPage->Frm() ); rValidPages.insert( nPageNo ); rValidStartFrms[ nPageNo ] = pStPage; + + rPrinterPaperTrays[ nPageNo ] = lcl_GetPaperBin( pStPage ); } } @@ -1306,7 +1332,6 @@ void SwDoc::CalculatePagesForPrinting( // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange // 2 -> print selection - const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); if (1 == nContent) aPageRange = rOptions.getStringValue( "PageRange", OUString() ); if (2 == nContent) @@ -1526,8 +1551,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { - std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); + std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); + std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting(); rPagePairs.clear(); @@ -1535,6 +1561,18 @@ void SwDoc::CalculatePagePairsForProspectPrinting( rValidStartFrms.clear(); rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() ); + // PageContent : + // 0 -> print all pages (default if aPageRange is empty) + // 1 -> print range according to PageRange + // 2 -> print selection + const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + if (0 == nContent) + { + // set page range to print to 'all pages' + aPageRange = OUString::valueOf( (sal_Int32)1 ); + aPageRange += OUString::valueOf( (sal_Unicode)'-'); + aPageRange += OUString::valueOf( nDocPageCount ); + } StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); DBG_ASSERT( pLayout, "no layout present" ); @@ -1559,6 +1597,8 @@ void SwDoc::CalculatePagePairsForProspectPrinting( rValidPagesSet.insert( nPageNum ); rValidStartFrms[ nPageNum ] = pPageFrm; pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); + + rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage ); } DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" ); diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index b7c9538f83e3..0080694722ba 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -37,6 +37,7 @@ #include <dcontact.hxx> #include <doc.hxx> #include <docary.hxx> +#include <xmloff/odffields.hxx> #include <editsh.hxx> #include <errhdl.hxx> #include <fmtanchr.hxx> @@ -305,6 +306,17 @@ namespace sw { namespace mark : m_pDoc(&rDoc) { } + void MarkManager::dumpFieldmarks( ) const + { + const_iterator_t pIt = m_vFieldmarks.begin(); + for (; pIt != m_vFieldmarks.end( ); pIt++) + { + rtl::OUString str = (*pIt)->ToString(); + OSL_TRACE("%s\n", + ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr()); + } + } + ::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, const IDocumentMarkAccess::MarkType eType) @@ -410,6 +422,30 @@ namespace sw { namespace mark return pMark.get(); } + ::sw::mark::IFieldmark* MarkManager::makeFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType ) + { + sw::mark::IMark* pMark = makeMark( rPaM, rName, + IDocumentMarkAccess::TEXT_FIELDMARK ); + sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark ); + pFieldMark->SetFieldname( rType ); + + return pFieldMark; + } + + ::sw::mark::IFieldmark* MarkManager::makeNoTextFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType) + { + sw::mark::IMark* pMark = makeMark( rPaM, rName, + IDocumentMarkAccess::CHECKBOX_FIELDMARK ); + sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark ); + pFieldMark->SetFieldname( rType ); + + return pFieldMark; + } + ::sw::mark::IMark* MarkManager::getMarkForTxtNode(const SwTxtNode& rTxtNode, const IDocumentMarkAccess::MarkType eType) { @@ -763,12 +799,7 @@ namespace sw { namespace mark { const_iterator_t pFieldmark = find_if( m_vFieldmarks.begin(), - // we do not need to check marks starting behind the positon - lower_bound( - m_vFieldmarks.begin(), - m_vFieldmarks.end(), - rPos, - bind(&IMark::StartsAfter, _1, _2)), + m_vFieldmarks.end( ), bind(&IMark::IsCoveringPosition, _1, rPos)); if(pFieldmark == m_vFieldmarks.end()) return NULL; return dynamic_cast<IFieldmark*>(pFieldmark->get()); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index ed4ad5b25115..a19ece4daf66 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -966,6 +966,29 @@ BOOL SwCompareLine::Compare( const CompareLine& rLine ) const return CompareNode( rNode, ((SwCompareLine&)rLine).rNode ); } +namespace +{ + static String SimpleTableToText(const SwNode &rNode) + { + String sRet; + const SwNode* pEndNd = rNode.EndOfSectionNode(); + SwNodeIndex aIdx( rNode ); + while (&aIdx.GetNode() != pEndNd) + { + if (aIdx.GetNode().IsTxtNode()) + { + if (sRet.Len()) + { + sRet.Append( '\n' ); + } + sRet.Append( aIdx.GetNode().GetTxtNode()->GetExpandTxt() ); + } + aIdx++; + } + return sRet; + } +} + BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) { if( rSrcNd.GetNodeType() != rDstNd.GetNodeType() ) @@ -986,6 +1009,13 @@ BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) bRet = ( rTSrcNd.EndOfSectionIndex() - rTSrcNd.GetIndex() ) == ( rTDstNd.EndOfSectionIndex() - rTDstNd.GetIndex() ); + + // --> #i107826#: compare actual table content + if (bRet) + { + bRet = (SimpleTableToText(rSrcNd) == SimpleTableToText(rDstNd)); + } + // <-- } break; @@ -1040,6 +1070,15 @@ BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) case ND_ENDNODE: bRet = rSrcNd.StartOfSectionNode()->GetNodeType() == rDstNd.StartOfSectionNode()->GetNodeType(); + + // --> #i107826#: compare actual table content + if (bRet && rSrcNd.StartOfSectionNode()->GetNodeType() == ND_TABLENODE) + { + bRet = CompareNode( + *rSrcNd.StartOfSectionNode(), *rDstNd.StartOfSectionNode()); + } + // <-- + break; } return bRet; @@ -1056,18 +1095,7 @@ String SwCompareLine::GetText() const case ND_TABLENODE: { - const SwNode* pEndNd = rNode.EndOfSectionNode(); - SwNodeIndex aIdx( rNode ); - while( &aIdx.GetNode() != pEndNd ) - { - if( aIdx.GetNode().IsTxtNode() ) - { - if( sRet.Len() ) - sRet.Append( '\n' ); - sRet.Append( ((SwTxtNode&)rNode).GetExpandTxt() ); - } - aIdx++; - } + sRet = SimpleTableToText(rNode); sRet.InsertAscii( "Tabelle: ", 0 ); } break; diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 53f7b36aa4bf..30a385442fc0 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -319,7 +319,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, pDoc->GetSpzFrmFmts()->Count() ) { /* SfxViewFrame* pFrame = */ - SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); } xDocSh->DoSaveAs( *pTmpMed ); xDocSh->DoSaveCompleted( pTmpMed ); @@ -670,7 +670,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) pDoc->GetSpzFrmFmts()->Count() ) { /* SfxViewFrame* pFrame = */ - SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); } xDocSh->DoSaveAs( *pTmpMed ); xDocSh->DoSaveCompleted( pTmpMed ); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index c01ad49f78af..6e04d49afb3e 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -651,14 +651,14 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, // Anker noch nicht gesetzt ? RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId() : pFmt->GetAnchor().GetAnchorId(); - if( !pAnchor || - ((FLY_AT_PAGE != pAnchor->GetAnchorId()) && - //Nur Page und nicht: -// FLY_AT_CNTNT == pAnchor->GetAnchorId() || -// FLY_IN_CNTNT == pAnchor->GetAnchorId() || -// FLY_AT_FLY == pAnchor->GetAnchorId() || -// FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ) && - !pAnchor->GetCntntAnchor() )) + // --> OD 2010-01-07 #i107811# + // Assure that at-page anchored fly frames have a page num or a content anchor set. + if ( !pAnchor || + ( FLY_AT_PAGE != pAnchor->GetAnchorId() && + !pAnchor->GetCntntAnchor() ) || + ( FLY_AT_PAGE == pAnchor->GetAnchorId() && + !pAnchor->GetCntntAnchor() && + pAnchor->GetPageNum() == 0 ) ) { // dann setze ihn, wird im Undo gebraucht SwFmtAnchor aAnch( pFmt->GetAnchor() ); @@ -672,15 +672,20 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, { if( eRequestId != aAnch.GetAnchorId() && SFX_ITEM_SET != pFmt->GetItemState( RES_ANCHOR, sal_True ) ) + { aAnch.SetType( eRequestId ); + } eAnchorId = aAnch.GetAnchorId(); - if ( FLY_AT_PAGE != eAnchorId ) - //Nur Page und nicht: -// if( FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId || -// FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId ) + if ( FLY_AT_PAGE != eAnchorId || + ( FLY_AT_PAGE == eAnchorId && + ( !pAnchor || + aAnch.GetPageNum() == 0 ) ) ) + { aAnch.SetAnchor( &rAnchPos ); + } } + // <-- pFmt->SetFmtAttr( aAnch ); } else diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 4d68438895a3..fe4044dd58ac 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -169,12 +169,12 @@ void StartGrammarChecking( SwDoc &rDoc ) // check for a visible view bool bVisible = false; const SwDocShell *pDocShell = rDoc.GetDocShell(); - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False ); while (pFrame && !bVisible) { if (pFrame->IsVisible()) bVisible = true; - pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); + pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False ); } //!! only documents with visible views need to be checked diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 541cc53c1e77..bb10e9c1941b 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -295,14 +295,6 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ // <-- StopAnimation(); - if ( pSh->Imp()->IsPaintInScroll() && pSh->GetWin() && rRect != Frm() && - HasAnimation() ) - { - pSh->GetWin()->Invalidate( Frm().SVRect() ); - return; - } - - SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn) OutputDevice *pOut = pSh->GetOut(); @@ -799,6 +791,7 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut ) { + if(!pOut) return; Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() ); @@ -865,7 +858,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons //this might be a good idea for all other OLE objects also, //but as I cannot oversee the consequences I fix it only for charts for now lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut ); - } + } if( pGrfNd ) { @@ -913,8 +906,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr )) { - rGrfObj.Draw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), - &aGrfAttr ); + rGrfObj.DrawWithPDFHandling( *pOut, + aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), + &aGrfAttr ); bContinue = FALSE; } } @@ -953,8 +947,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons 0, GRFMGR_DRAW_STANDARD, pVout ); } else - rGrfObj.Draw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), - &aGrfAttr ); + rGrfObj.DrawWithPDFHandling( *pOut, + aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), + &aGrfAttr ); } else { diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 3131147cc7c2..b213eb1d075d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1265,10 +1265,72 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > return pNdTbl; } +SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) +{ + SwNodeRange * pResult = NULL; + bool bChanged = false; + + SwNodeIndex aNewStart = rRange.aStart; + SwNodeIndex aNewEnd = rRange.aEnd; + + SwNodeIndex aEndIndex = rRange.aEnd; + SwNodeIndex aIndex = rRange.aStart; + + while (aIndex < aEndIndex) + { + SwNode& rNode = aIndex.GetNode(); + + if (rNode.IsStartNode()) + { + // advance aIndex to the end node of this start node + SwNode * pEndNode = rNode.EndOfSectionNode(); + aIndex = *pEndNode; + + if (aIndex > aNewEnd) + { + aNewEnd = aIndex; + bChanged = true; + } + } + else if (rNode.IsEndNode()) + { + SwNode * pStartNode = rNode.StartOfSectionNode(); + SwNodeIndex aStartIndex = *pStartNode; + + if (aStartIndex < aNewStart) + { + aNewStart = aStartIndex; + bChanged = true; + } + } + + if (aIndex < aEndIndex) + ++aIndex; + } + + SwNode * pNode = &aIndex.GetNode(); + while (pNode->IsEndNode()) + { + SwNode * pStartNode = pNode->StartOfSectionNode(); + SwNodeIndex aStartIndex(*pStartNode); + aNewStart = aStartIndex; + aNewEnd = aIndex; + bChanged = true; + + ++aIndex; + pNode = &aIndex.GetNode(); + } + + if (bChanged) + pResult = new SwNodeRange(aNewStart, aNewEnd); + + return pResult; +} + /*-- 18.05.2006 08:23:28--------------------------------------------------- -----------------------------------------------------------------------*/ -SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes, +SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, SwTableFmt* pTblFmt, SwTableLineFmt* pLineFmt, SwTableBoxFmt* pBoxFmt, diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 2784c361f5e3..75111933e0ec 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -68,10 +68,8 @@ using namespace ::com::sun::star; // AW: For VCOfDrawVirtObj and stuff #include <svx/sdr/contact/viewcontactofvirtobj.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <sw_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> using namespace ::com::sun::star; @@ -243,20 +241,15 @@ namespace drawinglayer if(!getOuterRange().isEmpty()) { // currently this SW object has no primitive representation. As long as this is the case, - // create an invisible HitTestPrimitive to allow hitting the object. Use a filled primitive - // to get a HitTest which uses 'inside' as default object hit. The special cases from + // create invisible geometry to allow corfect HitTest and BoundRect calculations for the + // object. Use a filled primitive to get 'inside' as default object hit. The special cases from // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj; - // this removed the 'hack' to get a view from inside model data or to react on noll-tolerance + // this removed the 'hack' to get a view from inside model data or to react on null-tolerance // as it was done in the old implementation - const basegfx::B2DPolygon aOuterRangePolygon(basegfx::tools::createPolygonFromRect(getOuterRange())); - const basegfx::BColor aColor(0.0, 0.0, 0.0); - const Primitive2DReference aContentReference( - new PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOuterRangePolygon), - aColor)); const Primitive2DReference aHitTestReference( - new HitTestPrimitive2D( - Primitive2DSequence(&aContentReference, 1))); + createHiddenGeometryPrimitives2D( + true, + getOuterRange())); aRetval = Primitive2DSequence(&aHitTestReference, 1); } @@ -563,6 +556,11 @@ const Rectangle& __EXPORT SwVirtFlyDrawObj::GetCurrentBoundRect() const return aOutRect; } +const Rectangle& __EXPORT SwVirtFlyDrawObj::GetLastBoundRect() const +{ + return GetCurrentBoundRect(); +} + void __EXPORT SwVirtFlyDrawObj::RecalcBoundRect() { diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 95f6961c76e1..230e45f71079 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -57,6 +57,9 @@ #ifndef _STATSTR_HRC #include <statstr.hrc> #endif +#include <bookmrk.hxx> +#include <xmloff/odffields.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -231,6 +234,25 @@ BOOL SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) return bRet; } +BOOL SwEditShell::UpdateField( sw::mark::IFieldmark &fieldBM) +{ +// SwDocShell* pDocSh = pDoc->GetDocShell(); + //@TODO implement me...; add undo etc... + if ( pDoc && fieldBM.IsExpanded( ) ) { + SwPosition aSttPos = fieldBM.GetMarkStart( ); + aSttPos.nContent++; + + SwPosition aEndPos = fieldBM.GetMarkEnd( ); + aEndPos.nContent--; + + SwPaM aPaM( aSttPos, aEndPos ); + pDoc->DeleteRange(aPaM); + pDoc->InsertString(aPaM, String::CreateFromAscii("Implement me ;-)") ); + } + return TRUE; +} + + /*-------------------------------------------------------------------- Beschreibung: Aktuelles Verzeichnis vor oder in dem der Cursor steht diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 380c1e78ff0d..a0d9141778cb 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -72,9 +72,11 @@ // --> OD 2006-03-06 #125892# #include <HandleAnchorNodeChg.hxx> // <-- - #include <frmatr.hxx> - +// --> OD 2009-12-29 #i89920# +#include <fmtsrnd.hxx> +#include <editeng/opaqitem.hxx> +// <-- using ::rtl::OUString; using namespace ::com::sun::star; @@ -908,67 +910,50 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, } -void SwFEShell::Insert( SdrObject& rDrawObj, - const SfxItemSet* pFlyAttrSet, - SwFrmFmt* pFrmFmt, const Point* pPt ) +void SwFEShell::InsertDrawObj( SdrObject& rDrawObj, + const Point& rInsertPosition ) { - SwDrawFrmFmt* pFmt = 0; SET_CURR_SHELL( this ); - if( pPt ) - { - SfxItemSet* pSet = 0; - const SfxPoolItem* pItem; - if( !pFlyAttrSet || - !pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False, &pItem ) || - (FLY_AT_PAGE != ((SwFmtAnchor*)pItem)->GetAnchorId())) - { - pSet = new SfxItemSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange ); - pSet->Put( SwFmtAnchor( FLY_AT_PARA )); - pFlyAttrSet = pSet; - } + SfxItemSet rFlyAttrSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange ); + rFlyAttrSet.Put( SwFmtAnchor( FLY_AT_PARA )); + // --> OD 2009-12-29 #i89920# + rFlyAttrSet.Put( SwFmtSurround( SURROUND_THROUGHT ) ); + rDrawObj.SetLayer( getIDocumentDrawModelAccess()->GetHeavenId() ); + // <-- + // find anchor position + SwPaM aPam( pDoc->GetNodes() ); + { SwCrsrMoveState aState( MV_SETONLYTEXT ); - SwPaM aPam( pDoc->GetNodes() ); - Point aTmpPt( *pPt ); + Point aTmpPt( rInsertPosition ); getIDocumentLayoutAccess()->GetRootFrm()->GetCrsrOfst( aPam.GetPoint(), aTmpPt, &aState ); - SwFrm* pFrm = aPam.GetCntntNode()->GetFrm( 0, 0, sal_False ); - const Point aRelPos( pPt->X() - pFrm->Frm().Left(), - pPt->Y() - pFrm->Frm().Top() ); - // OD 2004-04-05 #i26791# - direct object positioning for <SwDoc::Insert(..)> + const SwFrm* pFrm = aPam.GetCntntNode()->GetFrm( 0, 0, sal_False ); + const Point aRelPos( rInsertPosition.X() - pFrm->Frm().Left(), + rInsertPosition.Y() - pFrm->Frm().Top() ); rDrawObj.SetRelativePos( aRelPos ); - ::lcl_FindAnchorPos( *GetDoc(), *pPt, *pFrm, *(SfxItemSet*)pFlyAttrSet ); - pFmt = GetDoc()->Insert( aPam, rDrawObj, pFlyAttrSet, pFrmFmt ); - if( pSet ) - delete pSet; - } - else - { - StartAllAction(); - FOREACHPAM_START( this ) - pFmt = GetDoc()->Insert(*PCURCRSR, rDrawObj, - pFlyAttrSet, pFrmFmt ); - ASSERT( pFmt, "Doc->Insert(sdrobj) failed." ); - - FOREACHPAM_END() - EndAllAction(); + ::lcl_FindAnchorPos( *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet ); } + // insert drawing object into the document creating a new <SwDrawFrmFmt> instance + SwDrawFrmFmt* pFmt = GetDoc()->Insert( aPam, rDrawObj, &rFlyAttrSet, 0 ); - // --> OD 2005-01-07 #i40085# - follow-up of #i35635# // move object to visible layer SwContact* pContact = static_cast<SwContact*>(rDrawObj.GetUserCall()); if ( pContact ) { pContact->MoveObjToVisibleLayer( &rDrawObj ); } - // <-- - if( pFmt ) - // das DrawObject selektieren + if ( pFmt ) + { + // select drawing object Imp()->GetDrawView()->MarkObj( &rDrawObj, Imp()->GetPageView(), - sal_False, sal_False ); + sal_False, sal_False ); + } else + { GetLayout()->SetAssertFlyPages(); + } } /*********************************************************************** diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 8eb7e12a90eb..7242ca411616 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1182,9 +1182,7 @@ bool SwFEShell::IsObjSelectable( const Point& rPt ) } // #107513# -// Test if there is a draw object at that position and if it should be selected. -// The 'should' is aimed at Writer text fly frames which may be in front of -// the draw object. +// Test if there is a object at that position and if it should be selected. sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) { SET_CURR_SHELL(this); @@ -1201,39 +1199,79 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) bRet = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMARKABLE); pDrawView->SetHitTolerancePixel(nOld); - if(bRet && pObj) + if ( bRet && pObj ) { const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); - if( pObj->GetLayer() == pIDDMA->GetHellId() ) + // --> OD 2009-12-30 #i89920# + // Do not select object in background which is overlapping this text + // at the given position. + bool bObjInBackground( false ); { - const SwFrm *pPageFrm = GetLayout()->Lower(); - while( pPageFrm && !pPageFrm->Frm().IsInside( rPt ) ) + if ( pObj->GetLayer() == pIDDMA->GetHellId() ) { - if ( rPt.Y() < pPageFrm->Frm().Top() ) - pPageFrm = 0; - else - pPageFrm = pPageFrm->GetNext(); + const SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj ); + const SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt(); + const SwFmtSurround& rSurround = rFmt.GetSurround(); + if ( rSurround.GetSurround() == SURROUND_THROUGHT ) + { + bObjInBackground = true; + } } + } + if ( bObjInBackground ) + { + const SwPageFrm* pPageFrm = GetLayout()->GetPageAtPos( rPt ); if( pPageFrm ) { - SwRect aTmp( pPageFrm->Prt() ); - aTmp += pPageFrm->Frm().Pos(); - if( aTmp.IsInside( rPt ) ) - return sal_False; + const SwCntntFrm* pCntntFrm( pPageFrm->ContainsCntnt() ); + while ( pCntntFrm ) + { + if ( pCntntFrm->UnionFrm().IsInside( rPt ) ) + { + const SwTxtFrm* pTxtFrm = + dynamic_cast<const SwTxtFrm*>(pCntntFrm); + if ( pTxtFrm ) + { + SwPosition* pPos = + new SwPosition( *(pTxtFrm->GetTxtNode()) ); + Point aTmpPt( rPt ); + if ( pTxtFrm->GetKeyCrsrOfst( pPos, aTmpPt ) ) + { + SwRect aCursorCharRect; + if ( pTxtFrm->GetCharRect( aCursorCharRect, *pPos ) ) + { + if ( aCursorCharRect.IsOver( SwRect( pObj->GetLastBoundRect() ) ) ) + { + bRet = sal_False; + } + } + } + } + else + { + bRet = sal_False; + } + break; + } + + pCntntFrm = pCntntFrm->GetNextCntntFrm(); + } } } - - const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); - // --> FME 2005-04-18 #i20965# Use GetOrdNum() instead of GetOrdNumDirect() - // because ordnums might be wrong - for(sal_uInt32 a(pObj->GetOrdNum() + 1); bRet && a < pPage->GetObjCount(); a++) - { // <-- - SdrObject *pCandidate = pPage->GetObj(a); - if(pCandidate->ISA(SwVirtFlyDrawObj) && ((SwVirtFlyDrawObj*)pCandidate)->GetCurrentBoundRect().IsInside(rPt)) + if ( bRet ) + { + const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); + for(sal_uInt32 a(pObj->GetOrdNum() + 1); bRet && a < pPage->GetObjCount(); a++) { - bRet = sal_False; + SdrObject *pCandidate = pPage->GetObj(a); + + if (pCandidate->ISA(SwVirtFlyDrawObj) && + ( (SwVirtFlyDrawObj*)pCandidate)->GetCurrentBoundRect().IsInside(rPt) ) + { + bRet = sal_False; + } } } } diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 8e10e8d00e81..bcbdc826dd66 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -670,15 +670,6 @@ void SwGrfNode::SetTwipSize( const Size& rSz ) } } - // Prioritaet beim Laden der Grafik setzen. Geht nur, wenn der Link - // ein FileObject gesetzt hat -void SwGrfNode::SetTransferPriority( USHORT nPrio ) -{ - if( refLink.Is() && refLink->GetObj() ) - sfx2::LinkManager::SetTransferPriority( *refLink, nPrio ); -} - - void SwGrfNode::ScaleImageMap() { if( !nGrfSize.Width() || !nGrfSize.Height() ) diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx index faaa487d7467..1a5cd1724050 100644 --- a/sw/source/core/inc/MarkManager.hxx +++ b/sw/source/core/inc/MarkManager.hxx @@ -40,8 +40,18 @@ namespace sw { namespace mark public: MarkManager(/*[in/out]*/ SwDoc& rDoc); + void dumpFieldmarks( ) const; + // IDocumentMarkAccess virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark); + + virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType); + virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType); + virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark); virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx index 1b341a57ae2e..90c6a44fa239 100644 --- a/sw/source/core/inc/bookmrk.hxx +++ b/sw/source/core/inc/bookmrk.hxx @@ -34,6 +34,7 @@ #include <boost/scoped_ptr.hpp> #include <boost/noncopyable.hpp> +#include <map> #include <IMark.hxx> @@ -53,26 +54,31 @@ namespace sw { namespace mark { public: //getters - virtual const SwPosition& GetMarkPos() const + virtual SwPosition& GetMarkPos() const { return *m_pPos1; } virtual const ::rtl::OUString& GetName() const { return m_aName; } - virtual bool IsCoveringPosition(const SwPosition& rPos) const - { return GetMarkStart() <= rPos && rPos <= GetMarkEnd(); }; - virtual const SwPosition& GetOtherMarkPos() const + virtual bool IsCoveringPosition(const SwPosition& rPos) const; + virtual SwPosition& GetOtherMarkPos() const { OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." ); return *m_pPos2; } - virtual const SwPosition& GetMarkStart() const + virtual SwPosition& GetMarkStart() const { - if(!m_pPos2 /* !IsExpanded()*/) return *m_pPos1; - return *m_pPos1 < *m_pPos2 ? *m_pPos1 : *m_pPos2; + if( !IsExpanded() ) return GetMarkPos( ); + if ( GetMarkPos( ) < GetOtherMarkPos( ) ) + return GetMarkPos(); + else + return GetOtherMarkPos( ); } - virtual const SwPosition& GetMarkEnd() const + virtual SwPosition& GetMarkEnd() const { - if(!m_pPos2 /* !IsExpanded()*/ ) return *m_pPos1; - return *m_pPos1 > *m_pPos2 ? *m_pPos1 : *m_pPos2; + if( !IsExpanded() ) return GetMarkPos(); + if ( GetMarkPos( ) > GetOtherMarkPos( ) ) + return GetMarkPos( ); + else + return GetOtherMarkPos( ); } virtual bool IsExpanded() const { return m_pPos2; } @@ -85,6 +91,8 @@ namespace sw { namespace mark virtual void ClearOtherMarkPos() { m_pPos2.reset(); } + virtual rtl::OUString ToString( ) const; + virtual void Swap() { if(m_pPos2) @@ -120,7 +128,6 @@ namespace sw { namespace mark class NavigatorReminder : public MarkBase - , virtual public IMark { public: NavigatorReminder(const SwPaM& rPaM); @@ -204,24 +211,31 @@ namespace sw { namespace mark Fieldmark(const SwPaM& rPaM); // getters - ::rtl::OUString GetFieldname() const + virtual ::rtl::OUString GetFieldname() const { return m_aFieldname; } - ::rtl::OUString GetFieldHelptext() const + virtual ::rtl::OUString GetFieldHelptext() const { return m_aFieldHelptext; } + virtual IFieldmark::parameter_map_t* GetParameters() + { return &m_vParams; } + + virtual const IFieldmark::parameter_map_t* GetParameters() const + { return &m_vParams; } + // setters - void SetFieldname(const ::rtl::OUString& aFieldname) + virtual void SetFieldname(const ::rtl::OUString& aFieldname) { m_aFieldname = aFieldname; } - void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext) + virtual void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext) { m_aFieldHelptext = aFieldHelptext; } - private: - //int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List - //bool ffprot; + virtual void Invalidate(); + virtual rtl::OUString ToString() const; + private: ::rtl::OUString m_aFieldname; ::rtl::OUString m_aFieldHelptext; - static const ::rtl::OUString our_sNamePrefix; + IFieldmark::parameter_map_t m_vParams; + static const ::rtl::OUString our_sNamePrefix; }; class TextFieldmark @@ -230,9 +244,6 @@ namespace sw { namespace mark public: TextFieldmark(const SwPaM& rPaM); virtual void InitDoc(SwDoc* const io_pDoc); - private: - //int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation - //int ffmaxlen; // Number of characters for text field. Zero means unlimited. }; class CheckboxFieldmark @@ -244,11 +255,6 @@ namespace sw { namespace mark virtual void InitDoc(SwDoc* const io_pDoc); bool IsChecked() const; void SetChecked(bool checked); - private: - bool m_isChecked; - //bool ffsize; // 0 = Auto, 1=Exact (see ffhps) - //bool ffrecalc; - //int ffhps; // Check box size (half-point sizes). }; }} diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx index cfacf26c65d5..27f920be7651 100644 --- a/sw/source/core/inc/crossrefbookmark.hxx +++ b/sw/source/core/inc/crossrefbookmark.hxx @@ -45,10 +45,10 @@ namespace sw { namespace mark const ::rtl::OUString& rPrefix); // getters - virtual const SwPosition& GetOtherMarkPos() const; - virtual const SwPosition& GetMarkStart() const + virtual SwPosition& GetOtherMarkPos() const; + virtual SwPosition& GetMarkStart() const { return *m_pPos1; } - virtual const SwPosition& GetMarkEnd() const + virtual SwPosition& GetMarkEnd() const { return *m_pPos1; } virtual bool IsExpanded() const { return false; } diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 0cc08f909583..47e8fb700809 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -44,8 +44,10 @@ const UINT16 SwDrawFirst = 0x0001; class SwFlyDrawObj : public SdrObject { +private: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); +protected: // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence() // is called when RecalcBoundRect() is used virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); @@ -70,9 +72,10 @@ public: class SwVirtFlyDrawObj : public SdrVirtObj { +private: SwFlyFrm *pFlyFrm; -private: +protected: // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is // not used but something own (top left of new SnapRect minus top left // of original SnapRect) @@ -97,6 +100,7 @@ public: //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand. virtual const Rectangle& GetCurrentBoundRect() const; + virtual const Rectangle& GetLastBoundRect() const; virtual void RecalcBoundRect(); virtual void RecalcSnapRect(); virtual const Rectangle& GetSnapRect() const; diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 8d546e47000b..2186ccac0d2d 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -105,14 +105,8 @@ class SwLayAction // OD 14.04.2003 #106346# - new flag for content formatting on interrupt. sal_Bool mbFormatCntntOnInterrupt; - // --> OD 2004-06-14 #i28701# - new flag, indicating, if scrolling is - // allowed during page format - bool mbScrollingAllowed; - #ifdef _LAYACT_CXX - void _AddScrollRect( const SwCntntFrm *, const SwPageFrm *, - const SwTwips, const SwTwips ); void PaintCntnt( const SwCntntFrm *, const SwPageFrm *, const SwRect &rOldRect, long nOldBottom ); BOOL PaintWithoutFlys( const SwRect &, const SwCntntFrm *, diff --git a/sw/source/core/inc/scrrect.hxx b/sw/source/core/inc/scrrect.hxx deleted file mode 100644 index 4a9a21f0e5fe..000000000000 --- a/sw/source/core/inc/scrrect.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SCRRECT_HXX -#define _SCRRECT_HXX - -#include <svl/svarray.hxx> -#include "swrect.hxx" -#include <swtypes.hxx> - -class SwStripe -{ - SwTwips nY; - SwTwips nHeight; -public: - inline SwStripe( SwTwips nPos, SwTwips nHght ) - : nY( nPos ), nHeight( nHght ) {} - inline SwTwips GetY() const { return nY; } - inline SwTwips& Y() { return nY; } - inline SwTwips GetHeight() const { return nHeight; } - inline SwTwips& Height() { return nHeight; } - inline SwTwips GetBottom() const { return nHeight ? nY + nHeight - 1 : nY; } - inline BOOL operator<( const SwStripe &rTst ) const - { return nY < rTst.nY || ( nY == rTst.nY && nHeight > rTst.nHeight ); } - inline BOOL operator==( const SwStripe& rTst ) const - { return nY == rTst.nY && nHeight == rTst.nHeight; } -}; - -SV_DECL_VARARR( SwStripeArr, SwStripe, 1, 4 ) - -class SwStripes : public SwStripeArr, public SwStripe -{ - SwTwips nMin; // Left minimum - SwTwips nMax; // Right maximum -public: - SwStripes( SwTwips nPos, SwTwips nSize, SwTwips nMn, SwTwips nMx ) - : SwStripe( nPos, nSize ), nMin( nMn ), nMax( nMx ) {} - SwStripes& Plus( const SwStripes& rOther, BOOL bVert ); - BOOL Recalc( BOOL bVert ); - - inline SwTwips GetMin() const { return nMin; } - inline SwTwips GetMax() const { return nMax; } - inline void SetMin( const SwTwips nNew ) { nMin = nNew; } - inline void SetMax( const SwTwips nNew ) { nMax = nNew; } - inline void ChkMin( const SwTwips nNew ) { if( nNew < nMin ) nMin = nNew; } - inline void ChkMax( const SwTwips nNew ) { if( nNew > nMax ) nMax = nNew; } - inline SwTwips GetRight() const { return nMax > nMin ? nMax - 1 : nMax; } - inline SwTwips GetWidth() const { return nMax - nMin; } -}; - -class SwScrollColumn -{ - SwTwips nX; - SwTwips nWidth; - SwTwips nOffs; - BOOL bVertical; -public: - inline SwScrollColumn( SwTwips nPos, SwTwips nSz, SwTwips nOff, BOOL bVert ) - : nX( nPos ), nWidth( nSz ), nOffs( nOff ), bVertical( bVert ) {} - inline SwScrollColumn( const SwScrollColumn& rCol ) - : nX( rCol.nX ), nWidth( rCol.nWidth ), - nOffs( rCol.nOffs ), bVertical( rCol.bVertical ) {} - BOOL IsVertical() const { return bVertical; } - inline BOOL operator<( const SwScrollColumn &rTst ) const - { return bVertical < rTst.bVertical || ( bVertical == rTst.bVertical && - ( nX < rTst.nX || ( nX == rTst.nX && ( nWidth < rTst.nWidth || - ( nWidth == rTst.nWidth && nOffs < rTst.nOffs ) ) ) ) ); } - inline BOOL operator==( const SwScrollColumn &rTst ) const - { return bVertical == rTst.bVertical && nX == rTst.nX && - nWidth == rTst.nWidth && nOffs == rTst.nOffs;} - inline SwTwips GetX() const { return nX; } - inline SwTwips GetWidth() const { return nWidth; } - inline SwTwips GetOffs() const { return nOffs; } - inline void ClrOffs() { nOffs = 0; } - inline SwTwips GetRight() const { return nWidth ? nX + nWidth - 1 : nX; } -}; - -typedef SwStripes* SwStripesPtr; -SV_DECL_PTRARR_SORT(SwScrollStripes, SwStripesPtr, 1, 4) - -class SwScrollArea : public SwScrollColumn, public SwScrollStripes -{ -public: - void SmartInsert( SwStripes* pStripes ); - void Add( SwScrollArea *pScroll ); - inline SwScrollArea( const SwScrollColumn &rCol, SwStripes* pStripes ) - : SwScrollColumn( rCol ) - { Insert( pStripes ); } - BOOL Compress(); -}; - -typedef SwScrollArea* SwScrollAreaPtr; -SV_DECL_PTRARR_SORT(SScrAreas,SwScrollAreaPtr,1,2) - -class SwScrollAreas : public SScrAreas -{ -public: - void InsertCol( const SwScrollColumn &rCol, SwStripes *pStripes ); -}; - - -#endif //_SCRRECT_HXX diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 0a51cec7d1ee..5a8783df261b 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -46,7 +46,6 @@ class SwBorderAttrs; class SwFrmFmt; class OutputDevice; class SwTestFormat; -class SwStripes; struct SwCrsrMoveState; struct SwFillData; class SwPortionHandler; @@ -544,8 +543,6 @@ public: // Stoppt Animationen innerhalb von Numerierungen void StopAnimation( OutputDevice *pOut ); - void CriticalLines(const OutputDevice& rOut,SwStripes &rStripes,long nOffs); - // visit all portions for Accessibility void VisitPortions( SwPortionHandler& rPH ) const; diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index 6a26c61c1f50..38fb3e2bac7a 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -42,7 +42,6 @@ class ViewShell; class SwFlyFrm; class SwViewOption; class SwRegionRects; -class SwScrollAreas; class SwFrm; class SwLayAction; class SwLayIdle; @@ -86,8 +85,6 @@ class SwViewImp SwPageFrm *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite. SwRegionRects *pRegion; //Sammler fuer Paintrects aus der LayAction. - SwScrollAreas *pScrollRects; //Sammler fuer Scrollrects aus der LayAction. - SwScrollAreas *pScrolledArea;//Sammler der gescrollten Rechtecke. SwLayAction *pLayAct; //Ist gesetzt wenn ein Action-Objekt existiert //Wird vom SwLayAction-CTor ein- und vom DTor @@ -99,17 +96,11 @@ class SwViewImp mutable const SdrObject * pSdrObjCached; mutable String sSdrObjCachedComment; - AutoTimer aScrollTimer; //Fuer das Aufraeumen nach dem Scrollen. - BOOL bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig? - BOOL bNextScroll :1; //Scroll in der folgenden EndAction erlaubt? - BOOL bScroll :1; //Scroll in der aktuellen EndAction erlaubt? - BOOL bScrolled :1; //Wurde gescrolled? Dann im Idle aufraeumen. //BOOL bResetXorVisibility:1; //StartAction/EndAction //HMHBOOL bShowHdlPaint :1; //LockPaint/UnlockPaint BOOL bResetHdlHiddenPaint:1;// -- "" -- - BOOL bPaintInScroll :1; //Paint (Update() im ScrollHdl der ViewShell BOOL bSmoothUpdate :1; //Meber fuer SmoothScroll BOOL bStopSmooth :1; @@ -144,21 +135,6 @@ class SwViewImp void SetFirstVisPage(); //Neue Ermittlung der ersten sichtbaren Seite - void ResetNextScroll() { bNextScroll = FALSE; } - void SetNextScroll() { bNextScroll = TRUE; } - void SetScroll() { bScroll = TRUE; } - void ResetScrolled() { bScrolled = FALSE; } - void SetScrolled() { bScrolled = TRUE; } - - SwScrollAreas *GetScrollRects() { return pScrollRects; } - void FlushScrolledArea(); - BOOL _FlushScrolledArea( SwRect& rRect ); - BOOL FlushScrolledArea( SwRect& rRect ) - { if( !pScrolledArea ) return FALSE; return _FlushScrolledArea( rRect ); } - void _ScrolledRect( const SwRect& rRect, long nOffs ); - void ScrolledRect( const SwRect& rRect, long nOffs ) - { if( pScrolledArea ) _ScrolledRect( rRect, nOffs ); } - void StartAction(); //Henkel Anzeigen und verstecken. void EndAction(); //gerufen von ViewShell::ImplXXXAction void LockPaint(); //dito, gerufen von ViewShell::ImplLockPaint @@ -224,32 +200,9 @@ public: inline SwPageFrm *GetFirstVisPage(); void SetFirstVisPageInvalid() { bFirstPageInvalid = TRUE; } - //SS'en fuer Paint- und Scrollrects. BOOL AddPaintRect( const SwRect &rRect ); - void AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, long nOffs ); - void MoveScrollArea(); SwRegionRects *GetRegion() { return pRegion; } - void DelRegions(); //Loescht Scroll- und PaintRects - - //Handler fuer das Refresh von gescrollten Bereichen (Korrektur des - //Alignments). Ruft das Refresh mit der ScrolledArea. - //RefreshScrolledArea kann z.B. beim Setzen des Crsr genutzt werden, es - //wird nur der Anteil des Rect refreshed, der mit der ScrolledArea - //ueberlappt. Das 'reingereichte Rechteck wird veraendert! - void RestartScrollTimer() { aScrollTimer.Start(); } - DECL_LINK( RefreshScrolledHdl, Timer * ); - void _RefreshScrolledArea( const SwRect &rRect ); - void RefreshScrolledArea( SwRect &rRect ); - - //Wird vom Layout ggf. waehrend einer Action gerufen, wenn der - //Verdacht besteht, dass es etwas drunter und drueber geht. - void ResetScroll() { bScroll = FALSE; } - - BOOL IsNextScroll() const { return bNextScroll; } - BOOL IsScroll() const { return bScroll; } - BOOL IsScrolled() const { return bScrolled; } - - BOOL IsPaintInScroll() const { return bPaintInScroll; } + void DelRegion(); // neues Interface fuer StarView Drawing inline BOOL HasDrawView() const { return 0 != pDrawView; } @@ -364,20 +317,6 @@ public: void FireAccessibleEvents(); }; -//Kann auf dem Stack angelegt werden, wenn etwas ausgegeben oder -//gescrolled wird. Handles und sontiges vom Drawing werden im CTor -//gehidet und im DTor wieder sichtbar gemacht. -//AW 06-Sep99: Hiding of handles is no longer necessary, removed -//class SwSaveHdl -//{ -// SwViewImp *pImp; -// BOOL bXorVis; -//public: -// SwSaveHdl( SwViewImp *pImp ); -// ~SwSaveHdl(); -//}; - - inline SwPageFrm *SwViewImp::GetFirstVisPage() { if ( bFirstPageInvalid ) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index fb8d28b66862..37ec80632153 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2727,10 +2727,23 @@ void SwFlyFrmFmt::MakeFrms() //die Suche vom StartNode zum FrameFormat sein. SwNodeIndex aIdx( aAnchorAttr.GetCntntAnchor()->nNode ); SwCntntNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - SwClientIter aIter( *pCNd ); - if ( aIter.First( TYPE(SwFrm) ) ) - pModify = pCNd; - else + // --> OD 2009-12-28 #i105535# + if ( pCNd == 0 ) + { + pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); + } + if ( pCNd ) + // <-- + { + SwClientIter aIter( *pCNd ); + if ( aIter.First( TYPE(SwFrm) ) ) + { + pModify = pCNd; + } + } + // --> OD 2009-12-28 #i105535# + if ( pModify == 0 ) + // <-- { const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode; SwSpzFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts(); @@ -2802,7 +2815,24 @@ void SwFlyFrmFmt::MakeFrms() !((SwCntntFrm*)pFrm)->IsFollow(); if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() ) - pFrm = pFrm->FindFlyFrm(); + { + // --> OD 2009-12-28 #i105535# + // fallback to anchor type at-paragraph, if no fly frame is found. +// pFrm = pFrm->FindFlyFrm(); + SwFrm* pFlyFrm = pFrm->FindFlyFrm(); + if ( pFlyFrm ) + { + pFrm = pFlyFrm; + } + else + { + aAnchorAttr.SetType( FLY_AT_PARA ); + SetFmtAttr( aAnchorAttr ); + MakeFrms(); + return; + } + // <-- + } if( pFrm->GetDrawObjs() ) { diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 2b49f6b44abc..d0015b12114d 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -2127,13 +2127,15 @@ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways ) // OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout if ( !pNewPage->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) { - //Bei Sections kann es passieren, das wir gleich in den Follow geflutscht - //sind. Dadurch wird nicht vom GetLeaf fuer die richtige Seite gesorgt. - //Das muessen wir fuer diesen Fall pruefen. - if ( !bSamePage && pNewUpper->IsInSct() && + // --> OD 2009-12-31 #i106452# + // check page description not only in situation with sections. + if ( !bSamePage && ( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() || pOldPage->GetPageDesc()->GetFollow() != pNewPage->GetPageDesc() ) ) + { SwFrm::CheckPageDescs( pNewPage, FALSE ); + } + // <-- } } return bSamePage; diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 2fb0535c6193..14bc23bb97a4 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -371,149 +371,6 @@ void SwLayAction::PaintCntnt( const SwCntntFrm *pCnt, /************************************************************************* |* -|* SwLayAction::_AddScrollRect() -|* -|* Ersterstellung MA 04. Mar. 94 -|* Letzte Aenderung MA 04. Mar. 94 -|* -|*************************************************************************/ -BOOL MA_FASTCALL lcl_IsOverObj( const SwFrm *pFrm, const SwPageFrm *pPage, - const SwRect &rRect1, const SwRect &rRect2, - const SwLayoutFrm *pLay ) -{ - const SwSortedObjs &rObjs = *pPage->GetSortedObjs(); - const SwFlyFrm *pSelfFly = pFrm->FindFlyFrm(); - const BOOL bInCnt = pSelfFly && pSelfFly->IsFlyInCntFrm() ? TRUE : FALSE; - - for ( sal_uInt32 j = 0; j < rObjs.Count(); ++j ) - { - // --> OD 2004-07-07 #i28701# - consider changed type of <SwSortedObjs> entries - const SwAnchoredObject* pAnchoredObj = rObjs[j]; - const SwRect aRect( pAnchoredObj->GetObjRect() ); - if ( !rRect1.IsOver( aRect ) && !rRect2.IsOver( aRect ) ) - continue; //Keine Ueberlappung, der naechste. - - const SwFlyFrm *pFly = pAnchoredObj->ISA(SwFlyFrm) - ? static_cast<const SwFlyFrm*>(pAnchoredObj) : 0; - - //Wenn der Rahmen innerhalb des LayFrm verankert ist, so darf er - //mitgescrollt werden, wenn er nicht seitlich aus dem Rechteck - //herausschaut. - if ( pLay && pFly && pFly->IsLowerOf( pLay ) ) - { - if ( pFly->Frm().Left() < rRect1.Left() || - pFly->Frm().Right()> rRect1.Right() ) - return TRUE; - continue; - } - - if ( !pSelfFly ) //Nur wenn der Frm in einem Fly steht kann - return TRUE; //es Einschraenkungen geben. - - if ( !pFly ) //Keine Einschraenkung fuer Zeichenobjekte. - return TRUE; - - if ( pFly != pSelfFly ) - { - //Flys unter dem eigenen nur dann abziehen, wenn sie innerhalb des - //eigenen stehen. - //Fuer inhaltsgebundene Flys alle Flys abziehen fuer die gilt, dass - //pSelfFly nicht innerhalb von ihnen steht. - if ( bInCnt ) - { - const SwFlyFrm *pTmp = pSelfFly->GetAnchorFrm()->FindFlyFrm(); - while ( pTmp ) - { - if ( pTmp == pFly ) - return FALSE; - else - pTmp = pTmp->GetAnchorFrm()->FindFlyFrm(); - } - } else if ( pAnchoredObj->GetDrawObj()->GetOrdNum() < - pSelfFly->GetVirtDrawObj()->GetOrdNum() ) - { - const SwFlyFrm *pTmp = pFly; - do - { if ( pTmp == pSelfFly ) - return TRUE; - else - pTmp = pTmp->GetAnchorFrm()->FindFlyFrm(); - } while ( pTmp ); - } else - return TRUE; - } - } - return FALSE; -} - -void SwLayAction::_AddScrollRect( const SwCntntFrm *pCntnt, - const SwPageFrm *pPage, - const SwTwips nOfst, - const SwTwips nOldBottom ) -{ - // --> OD 2004-07-01 #i28701# - determine, if scrolling is allowed. - bool bScroll = mbScrollingAllowed; - SwRect aPaintRect( pCntnt->PaintArea() ); - SWRECTFN( pCntnt ) - - // --> OD 2007-11-27 #notes2# - // if sidebar for notes is present, no scrolling is allowed - if ( bScroll ) - { - const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr(); - if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) - { - bScroll = false; - } - } - // <-- - - //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der - //Cntnt nicht selbst steht, so ist nichts mit Scrollen. - if ( bScroll && pPage->GetSortedObjs() ) - { - SwRect aRect( aPaintRect ); - if( bVert ) - aPaintRect.Pos().X() += nOfst; - else - aPaintRect.Pos().Y() -= nOfst; - - if ( ::lcl_IsOverObj( pCntnt, pPage, aPaintRect, aRect, 0 ) ) - bScroll = false; - - if( bVert ) - aPaintRect.Pos().X() -= nOfst; - else - aPaintRect.Pos().Y() += nOfst; - } - if ( bScroll && pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE ) - bScroll = false; - - if ( bScroll ) - { - if( aPaintRect.HasArea() ) - pImp->GetShell()->AddScrollRect( pCntnt, aPaintRect, nOfst ); - if ( pCntnt->IsRetouche() && !pCntnt->GetNext() ) - { - SwRect aRect( pCntnt->GetUpper()->PaintArea() ); - (aRect.*fnRect->fnSetTop)( (pCntnt->*fnRect->fnGetPrtBottom)() ); - if ( !pImp->GetShell()->AddPaintRect( aRect ) ) - pCntnt->ResetRetouche(); - } - pCntnt->ResetCompletePaint(); - } - else if( aPaintRect.HasArea() ) - { - if( bVert ) - aPaintRect.Pos().X() += nOfst; - else - aPaintRect.Pos().Y() -= nOfst; - PaintCntnt( pCntnt, pPage, aPaintRect, nOldBottom ); - } -} - -/************************************************************************* -|* |* SwLayAction::SwLayAction() |* |* Ersterstellung MA 30. Oct. 92 @@ -538,8 +395,6 @@ SwLayAction::SwLayAction( SwRootFrm *pRt, SwViewImp *pI ) : bUpdateExpFlds = bBrowseActionStop = bActionInProgress = FALSE; // OD 14.04.2003 #106346# - init new flag <mbFormatCntntOnInterrupt>. mbFormatCntntOnInterrupt = sal_False; - // --> OD 2004-06-14 #i28701# - mbScrollingAllowed = true; pImp->pLayAct = this; //Anmelden } @@ -654,8 +509,6 @@ void SwLayAction::Action() pRoot->ResetTurboFlag(); pRoot->ResetTurbo(); - if ( IsInput() ) - pImp->GetShell()->SetNoNextScroll(); SetCheckPages( TRUE ); bActionInProgress = FALSE; @@ -735,34 +588,6 @@ class NotifyLayoutOfPageInProgress }; // <-- -// --> OD 2004-06-14 #i28701# - local method to determine, if scrolling during -// the format of the given page is allowed. -// Scrolling isn't allowed, if the wrapping style of floating screen objects -// is considered on object positioning and to-paragraph/to-character anchored -// floating screen objects are registered at the page. -bool lcl_ScrollingAllowed( const SwPageFrm& _rPageFrm ) -{ - bool bRetScrollAllowed = true; - - if ( _rPageFrm.GetSortedObjs() && - _rPageFrm.GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) ) - { - const SwSortedObjs* pObjs = _rPageFrm.GetSortedObjs(); - sal_uInt32 i = 0; - for ( ; i < pObjs->Count(); ++i ) - { - SwAnchoredObject* pObj = (*pObjs)[i]; - if ( pObj->ConsiderObjWrapInfluenceOnObjPos() ) - { - bRetScrollAllowed = false; - break; - } - } - } - - return bRetScrollAllowed; -} - void SwLayAction::InternalAction() { ASSERT( pRoot->Lower()->IsPageFrm(), ":-( Keine Seite unterhalb der Root."); @@ -864,8 +689,6 @@ void SwLayAction::InternalAction() // <NotifyLayoutOfPageInProgress> { NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPage ); - // --> OD 2004-07-01 #i28701# - determine, if scrolling is allowed. - mbScrollingAllowed = lcl_ScrollingAllowed( *pPage ); while ( !IsInterrupt() && !IsNextCycle() && ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) ) @@ -1838,219 +1661,6 @@ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) return bChanged || bTabChanged; } -BOOL MA_FASTCALL lcl_AreLowersScrollable( const SwLayoutFrm *pLay ) -{ - const SwFrm *pLow = pLay->Lower(); - while ( pLow ) - { - if ( pLow->IsCompletePaint() || !pLow->IsValid() || pLow->IsCoveredCell() ) - return FALSE; - if ( pLow->IsLayoutFrm() && !::lcl_AreLowersScrollable( (SwLayoutFrm*)pLow )) - return FALSE; - pLow = pLow->GetNext(); - } - return TRUE; -} - -SwLayoutFrm * MA_FASTCALL lcl_IsTabScrollable( SwTabFrm *pTab ) -{ - //returnt die erste unveraenderte Zeile, oder 0 wenn nicht - //gescrollt werden darf. - if ( !pTab->IsCompletePaint() ) - { - SwLayoutFrm *pUnchgdRow = 0; - SwLayoutFrm *pRow = (SwLayoutFrm*)pTab->Lower(); - while ( pRow ) - { - if ( ::lcl_AreLowersScrollable( pRow ) ) - { - if ( !pUnchgdRow ) - pUnchgdRow = pRow; - } - else - { - pUnchgdRow = 0; - } - - pRow = (SwLayoutFrm*)pRow->GetNext(); - } - return pUnchgdRow; - } - return 0; -} - -// OD 2004-05-11 #i28701# -void lcl_ValidateLowerObjs( SwFrm* pFrm, - const SwTwips nOfst, - SwPageFrm *pPage, - bool bResetOnly ); - -// OD 2004-05-11 #i28701# - correction: floating screen objects, which are -// anchored at-fly, have also been to be considered. -void MA_FASTCALL lcl_ValidateLowers( SwLayoutFrm *pLay, const SwTwips nOfst, - SwLayoutFrm *pRow, SwPageFrm *pPage, - BOOL bResetOnly ) -{ - pLay->ResetCompletePaint(); - - // OD 2004-05-11 #i28701# - consider floating screen objects, which are - // anchored at-fly. - if ( pLay->IsFlyFrm() ) - { - ::lcl_ValidateLowerObjs( pLay, nOfst, pPage, bResetOnly ); - } - - SwFrm *pLow = pRow ? pRow : pLay->Lower(); - SwRootFrm *pRootFrm = 0; - - while ( pLow ) - { - if ( !bResetOnly ) - { - SwRect aOldFrm( pLow->Frm() ); - pLow->Frm().Pos().Y() += nOfst; - if( pLow->IsAccessibleFrm() ) - { - if( !pRootFrm ) - pRootFrm = pPage->FindRootFrm(); - if( pRootFrm && pRootFrm->IsAnyShellAccessible() && - pRootFrm->GetCurrShell() ) - { - pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( pLow, aOldFrm ); - } - } - } - if ( pLow->IsLayoutFrm() ) - { - ::lcl_ValidateLowers( (SwLayoutFrm*)pLow, nOfst, 0, pPage, bResetOnly); - } - else - { - pLow->ResetCompletePaint(); - // OD 2004-05-11 #i28701# - use new local helper method - // <lcl_ValidateLowerObjs(..)> - ::lcl_ValidateLowerObjs( pLow, nOfst, pPage, bResetOnly); - } - if ( !bResetOnly ) - pLow->Calc(); //#55435# Stabil halten. - pLow = pLow->GetNext(); - } -} - -// OD 2004-05-11 #i28701# - helper method for <lcl_ValidateLowers(..)> to -// 'ValidateLowers' for floating screen objects -void lcl_ValidateLowerObjs( SwFrm* pFrm, - const SwTwips nOfst, - SwPageFrm *pPage, - bool bResetOnly ) -{ - if ( pFrm->GetDrawObjs() ) - { - // --> OD 2004-10-15 #i26945# - consider layout direction - SWRECTFN( pFrm ) - // <-- - for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i ) - { - SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; - // --> OD 2004-10-08 #i26945# - check, if the anchor frame, which - // contains the anchor position, is the given frame - if ( pAnchoredObj->GetAnchorFrmContainingAnchPos() != pFrm ) - { - continue; - } - if ( pAnchoredObj->ISA(SwFlyFrm) ) - { - SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); - if ( !bResetOnly ) - { - // --> OD 2004-10-15 #i26945# - // - consider layout direction - // - consider condition for direct move - const bool bNoDirectMove = - WEIT_WECH == pFly->Frm().Top() || - pFly->ConsiderObjWrapInfluenceOnObjPos(); - if ( !bNoDirectMove ) - { - (pFly->Frm().*fnRect->fnSubTop)( -nOfst ); - (pFly->Frm().*fnRect->fnAddBottom)( nOfst ); - } - // <-- - pFly->GetVirtDrawObj()->SetRectsDirty(); - // --> OD 2004-08-17 - also notify view of <SdrObject> - // instance, which represents the Writer fly frame in the - // drawing layer - pFly->GetVirtDrawObj()->SetChanged(); - // <-- - if ( pFly->IsFlyInCntFrm() ) - ((SwFlyInCntFrm*)pFly)->AddRefOfst( nOfst ); - // --> OD 2004-10-15 #i26945# - consider at-character - // anchored Writer fly frames - else if( pFly->IsAutoPos() ) - { - pFly->AddLastCharY( nOfst ); - // OD 2004-05-18 #i28701# - follow-up of #i22341# - // <mnLastTopOfLine> has also been adjusted. - pFly->AddLastTopOfLineY( nOfst ); - } - // <-- - } - ::lcl_ValidateLowers( pFly, nOfst, 0, pPage, bResetOnly); - } - // --> OD 2004-10-15 #i26945# - consider drawing objects - else - { - if ( !bResetOnly ) - { - pAnchoredObj->AddLastCharY( nOfst ); - pAnchoredObj->AddLastTopOfLineY( nOfst ); - } - } - // <-- - pAnchoredObj->InvalidateObjPos(); - } - } -} - -void MA_FASTCALL lcl_AddScrollRectTab( SwTabFrm *pTab, SwLayoutFrm *pRow, - const SwRect &rRect, - const SwTwips nOfst) -{ - // --> OD 2007-11-27 #notes2# - // if sidebar for notes is present, no scrolling is allowed - const SwPageFrm* pPage = pTab->FindPageFrm(); - ASSERT( pPage, "<lcl_AddScrollRectTab(..)> - no page frame found at table frame -> crash" ); - ViewShell* pSh = pPage->GetShell(); - if ( pSh ) - { - const SwPostItMgr* pPostItMgr = pSh->GetPostItMgr(); - if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) - { - return; - } - } - // <-- - //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der - //Frm nicht selbst steht, so ist nichts mit Scrollen. - SwRect aRect( rRect ); - // OD 04.11.2002 #104100# - <SWRECTFN( pTab )> not needed. - if( pTab->IsVertical() ) - aRect.Pos().X() -= nOfst; - else - aRect.Pos().Y() += nOfst; - if ( pPage->GetSortedObjs() ) - { - if ( ::lcl_IsOverObj( pTab, pPage, rRect, aRect, pTab ) ) - return; - } - if ( pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE ) - return; - - if ( pSh ) - pSh->AddScrollRect( pTab, aRect, nOfst ); - ::lcl_ValidateLowers( pTab, nOfst, pRow, pTab->FindPageFrm(), - pTab->IsLowersFormatted() ); -} - // OD 31.10.2002 #104100# // NOTE: no adjustments for vertical layout support necessary BOOL CheckPos( SwFrm *pFrm ) @@ -2093,76 +1703,27 @@ BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) if ( !pTab->IsValid() || pTab->IsCompletePaint() || pTab->IsComplete() ) { if ( pTab->GetPrev() && !pTab->GetPrev()->IsValid() ) - pTab->GetPrev()->SetCompletePaint(); - - //Potenzielles Scrollrect ist die ganze Tabelle. Da bereits ein - //Wachstum innerhalb der Tabelle - und damit der Tabelle selbst - - //stattgefunden haben kann, muss die untere Kante durch die - //Unterkante der letzten Zeile bestimmt werden. - SwLayoutFrm* pRow = 0L; - SwRect aScrollRect( pTab->PaintArea() ); - // --> OD 2004-07-01 #i28701# - check, if scrolling is allowed. - if ( mbScrollingAllowed && - ( IsPaint() || bAddRect ) ) { - pRow = static_cast<SwLayoutFrm*>(pTab->GetLastLower()); - // OD 31.10.2002 #104100# - vertical layout support - (aScrollRect.*fnRect->fnSetBottom)( (pRow->Frm().*fnRect->fnGetBottom)() ); - //Die Oberkante wird ggf. durch die erste unveraenderte Zeile bestimmt. - pRow = ::lcl_IsTabScrollable( pTab ); - if ( pRow && pRow != pTab->Lower() ) - // OD 31.10.2002 #104100# - vertical layout support - (aScrollRect.*fnRect->fnSetTop)( (pRow->Frm().*fnRect->fnGetTop)() ); + pTab->GetPrev()->SetCompletePaint(); } - const SwFrm *pOldUp = pTab->GetUpper(); - - SwRect aOldRect( pTab->Frm() ); + const SwRect aOldRect( pTab->Frm() ); pTab->SetLowersFormatted( FALSE ); pTab->Calc(); if ( aOldRect != pTab->Frm() ) + { bChanged = TRUE; - SwRect aPaintFrm = pTab->PaintArea(); + } + const SwRect aPaintFrm = pTab->PaintArea(); if ( IsPaint() && bAddRect ) { - // --> OD 2004-07-01 #i28701# - check, if scrolling is allowed - if ( mbScrollingAllowed && - pRow && pOldUp == pTab->GetUpper() && - pTab->Frm().SSize() == aOldRect.SSize() && - // OD 31.10.2002 #104100# - vertical layout support - (pTab->Frm().*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() && - pTab->IsAnLower( pRow ) ) - { - SwTwips nOfst; - if ( pRow->GetPrev() ) - { - if ( pRow->GetPrev()->IsValid() || - ::CheckPos( pRow->GetPrev() ) ) - { - // OD 31.10.2002 #104100# - vertical layout support - nOfst = -(pRow->Frm().*fnRect->fnTopDist)( (pRow->GetPrev()->Frm().*fnRect->fnGetBottom)() ); - } - else - nOfst = 0; - } - else - // OD 31.10.2002 #104100# - vertical layout support - nOfst = (pTab->Frm().*fnRect->fnTopDist)( (aOldRect.*fnRect->fnGetTop)() ); - - if ( nOfst ) - { - ::lcl_AddScrollRectTab( pTab, pRow, aScrollRect, nOfst ); - bPainted = TRUE; - } - } - // OD 01.11.2002 #104100# - add condition <pTab->Frm().HasArea()> - if ( !pTab->IsCompletePaint() && pTab->IsComplete() && + if ( !pTab->IsCompletePaint() && + pTab->IsComplete() && ( pTab->Frm().SSize() != pTab->Prt().SSize() || // OD 31.10.2002 #104100# - vertical layout support - (pTab->*fnRect->fnGetLeftMargin)() - ) && + (pTab->*fnRect->fnGetLeftMargin)() ) && pTab->Frm().HasArea() ) { @@ -2478,13 +2039,6 @@ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt, SWRECTFN( pCntnt ) if ( !bDrawObjsOnly && IsPaint() ) { - const BOOL bPosOnly = !pCntnt->GetValidPosFlag() && - !pCntnt->IsCompletePaint() && - pCntnt->GetValidSizeFlag() && - pCntnt->GetValidPrtAreaFlag() && - ( !pCntnt->IsTxtFrm() || - !((SwTxtFrm*)pCntnt)->HasAnimation() ); - const SwFrm *pOldUp = pCntnt->GetUpper(); const SwRect aOldRect( pCntnt->UnionFrm() ); const long nOldBottom = (pCntnt->*fnRect->fnGetPrtBottom)(); pCntnt->OptCalc(); @@ -2492,23 +2046,10 @@ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt, return; if( (*fnRect->fnYDiff)( (pCntnt->Frm().*fnRect->fnGetBottom)(), (aOldRect.*fnRect->fnGetBottom)() ) < 0 ) - pCntnt->SetRetouche(); - const SwRect aNewRect( pCntnt->UnionFrm() ); - if ( bPosOnly && - (aNewRect.*fnRect->fnGetTop)() != (aOldRect.*fnRect->fnGetTop)() && - !pCntnt->IsInTab() && !pCntnt->IsInSct() && - ( !pCntnt->GetPrev() || !pCntnt->GetPrev()->IsTabFrm() ) && - pOldUp == pCntnt->GetUpper() && - (aNewRect.*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() && - aNewRect.SSize() == aOldRect.SSize() - ) { - _AddScrollRect( pCntnt, pPage, (*fnRect->fnYDiff)( - (pCntnt->Frm().*fnRect->fnGetTop)(), - (aOldRect.*fnRect->fnGetTop)() ), nOldBottom ); + pCntnt->SetRetouche(); } - else - PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom); + PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom); } else { @@ -2907,7 +2448,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : { --pSh->nStartAction; - if ( pSh->Imp()->GetRegion() || pSh->Imp()->GetScrollRects() ) + if ( pSh->Imp()->GetRegion() ) bActions = TRUE; else { @@ -2953,9 +2494,9 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : //fix(18176): SwViewImp *pViewImp = pSh->Imp(); BOOL bUnlock = FALSE; - if ( pViewImp->GetRegion() || pViewImp->GetScrollRects() ) + if ( pViewImp->GetRegion() ) { - pViewImp->DelRegions(); + pViewImp->DelRegion(); //Fuer Repaint mit virtuellem Device sorgen. pSh->LockPaint(); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f3408cc9ab9a..ee9671ac869f 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1645,7 +1645,7 @@ void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, /// Because for drawing a graphic left-top-corner and size coordinations are /// used, these coordinations have to be determined on pixel level. ::SwAlignGrfRect( &aAlignedGrfRect, *pOut ); - pGrf->Draw( pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() ); + pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() ); if ( bNotInside ) pOut->Pop(); @@ -2804,7 +2804,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con aAction.Action(); ((SwRootFrm*)this)->ResetTurboFlag(); if ( !pSh->ActionPend() ) - pSh->Imp()->DelRegions(); + pSh->Imp()->DelRegion(); } SwRect aRect( rRect ); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 84a5b1bd1cd1..c3bccc695934 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2790,9 +2790,6 @@ void SwTabFrm::MakeAll() } else if ( GetFollow() == GetNext() ) ((SwTabFrm*)GetFollow())->MoveFwd( TRUE, FALSE ); - ViewShell *pSh; - if ( 0 != (pSh = GetShell()) ) - pSh->Imp()->ResetScroll(); } continue; } diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index d3fed24fc6b7..443900e1942c 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -59,7 +59,6 @@ #include <redlnitr.hxx> // SwRedlineItr #include <swmodule.hxx> // SW_MOD #include <tabfrm.hxx> // SwTabFrm (Redlining) -#include <scrrect.hxx> #include <SwGrammarMarkUp.hxx> // --> FME 2004-06-08 #i12836# enhanced pdf export @@ -748,70 +747,3 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) } } -void SwTxtFrm::CriticalLines( const OutputDevice& rOut, SwStripes &rStripes, - long nOffs) -{ - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::CriticalLines with swapped frame" ); - SWRECTFN( this ) - long nFrmHeight; - - GetFormatted(); - if( HasPara() ) - { - const long nTopMargin = (this->*fnRect->fnGetTopMargin)(); - SwStripe aStripe( (Frm().*fnRect->fnGetTop)(), nTopMargin ); - if ( nTopMargin ) - { - rStripes.Insert( aStripe, rStripes.Count() ); - // OD 06.11.2002 #104171#,#103931# - consider vertical layout - if ( bVert ) - aStripe.Y() -= nTopMargin; - else - // OD 06.11.2002 #104171#,#103931# - *add* top margin to Y. - aStripe.Y() += nTopMargin; - } - SwLineLayout* pLay = GetPara(); - do - { - SwTwips nBase = aStripe.GetY() + - ( bVert ? -pLay->GetAscent() : pLay->GetAscent() ); - - long nLogToPixBase, nLogToPixSum, nLogToPixOffs; - - if ( bVert ) - { - nLogToPixBase = rOut.LogicToPixel( Point( nBase, 0 ) ).X(); - nLogToPixSum = rOut.LogicToPixel( Point( nBase + nOffs, 0 ) ).X(); - nLogToPixOffs = -rOut.LogicToPixel( Size( nOffs, 0 ) ).Width(); - } - else - { - nLogToPixBase = rOut.LogicToPixel( Point( 0, nBase ) ).Y(); - nLogToPixSum = rOut.LogicToPixel( Point( 0, nBase - nOffs ) ).Y(); - nLogToPixOffs = rOut.LogicToPixel( Size( 0, nOffs ) ).Height(); - } - - if( nLogToPixBase != nLogToPixSum + nLogToPixOffs ) - { - aStripe.Height() = pLay->GetRealHeight(); - rStripes.Insert( aStripe, rStripes.Count() ); - } - aStripe.Y() += ( bVert ? -pLay->GetRealHeight() : - pLay->GetRealHeight() ); - pLay = pLay->GetNext(); - } while( pLay ); - - const long nBottomMargin = (this->*fnRect->fnGetBottomMargin)(); - if( nBottomMargin ) - { - - aStripe.Height() = nBottomMargin; - rStripes.Insert( aStripe, rStripes.Count() ); - } - } - else if( 0 != (nFrmHeight = (Frm().*fnRect->fnGetHeight)() )) - rStripes.Insert( SwStripe( (Frm().*fnRect->fnGetTop)(), nFrmHeight ), - rStripes.Count() ); -} - diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 18ce262f2342..8abd5b42f06e 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -276,6 +276,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew ) bURLNotify( rNew.URLNotify() ), bStopUnderFlow( rNew.StopUnderFlow() ), bFtnInside( rNew.IsFtnInside() ), + bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ), bMulti( rNew.IsMulti() ), bFirstMulti( rNew.IsFirstMulti() ), bRuby( rNew.IsRuby() ), @@ -373,7 +374,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, nIdx = nNewIdx; nLen = nNewLen; bNotEOL = sal_False; - bStopUnderFlow = bFtnInside = sal_False; + bStopUnderFlow = bFtnInside = bOtherThanFtnInside = sal_False; bMulti = bFirstMulti = bRuby = bHanging = bScriptSpace = bForbiddenChars = sal_False; @@ -400,6 +401,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt, bURLNotify( rNew.URLNotify() ), bStopUnderFlow( rNew.StopUnderFlow() ), bFtnInside( rNew.IsFtnInside() ), + bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ), bMulti( rNew.IsMulti() ), bFirstMulti( rNew.IsFirstMulti() ), bRuby( rNew.IsRuby() ), @@ -1142,27 +1144,30 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) { SwRect aIntersect; CalcRect( rPor, &aIntersect, 0 ); - if ( aIntersect.HasArea() ) { - if (OnWin()) { - OutputDevice* pOutDev = (OutputDevice*)GetOut(); - pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - pOutDev->SetLineColor( Color(220, 233, 245)); - pOutDev->SetFillColor( Color(220, 233, 245)); - pOutDev->DrawRect( aIntersect.SVRect() ); - pOutDev->Pop(); - } - const int delta=10; - Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta); - pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - pOut->SetLineColor( Color(0, 0, 0)); - pOut->SetFillColor(); - pOut->DrawRect( r ); - if (checked) { - pOut->DrawLine(r.TopLeft(), r.BottomRight()); - pOut->DrawLine(r.TopRight(), r.BottomLeft()); + if ( aIntersect.HasArea() ) + { + if (OnWin() && SwViewOption::IsFieldShadings() && + !GetOpt().IsPagePreview()) + { + OutputDevice* pOut_ = (OutputDevice*)GetOut(); + pOut_->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + pOut_->SetFillColor( SwViewOption::GetFieldShadingsColor() ); + pOut_->SetLineColor(); + pOut_->DrawRect( aIntersect.SVRect() ); + pOut_->Pop(); + } + const int delta=10; + Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta); + pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + pOut->SetLineColor( Color(0, 0, 0)); + pOut->SetFillColor(); + pOut->DrawRect( r ); + if (checked) { + pOut->DrawLine(r.TopLeft(), r.BottomRight()); + pOut->DrawLine(r.TopRight(), r.BottomLeft()); + } pOut->Pop(); } - } } /************************************************************************* @@ -1216,14 +1221,22 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const } } bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx())); - if(pFieldmark) OSL_TRACE("Found Fieldmark"); + if(pFieldmark) { + OSL_TRACE("Found Fieldmark"); +#if DEBUG + rtl::OUString str = pFieldmark->ToString( ); + fprintf( stderr, "%s\n", rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) ); +#endif + } if(bIsStartMark) OSL_TRACE("Found StartMark"); - if (OnWin() && (pFieldmark!=NULL || bIsStartMark)) + if (OnWin() && (pFieldmark!=NULL || bIsStartMark) && + SwViewOption::IsFieldShadings() && + !GetOpt().IsPagePreview()) { OutputDevice* pOutDev = (OutputDevice*)GetOut(); pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - pOutDev->SetLineColor( Color(220, 233, 245)); - pOutDev->SetFillColor( Color(220, 233, 245)); + pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() ); + pOutDev->SetLineColor( ); pOutDev->DrawRect( aIntersect.SVRect() ); pOutDev->Pop(); } diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 69a4ed1f3fe6..c0643653a1d6 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -208,6 +208,8 @@ protected: sal_Bool bURLNotify : 1; sal_Bool bStopUnderFlow : 1;// Underflow gestoppt z.B. von einer FlyPortion sal_Bool bFtnInside : 1; // the current line contains a footnote + sal_Bool bOtherThanFtnInside : 1; // the current line contains another portion than a footnote portion. + // needed for checking keep together of footnote portion with previous portion sal_Bool bMulti : 1; // inside a multiportion sal_Bool bFirstMulti : 1; // this flag is used for two purposes: // - the multiportion is the first lineportion @@ -251,6 +253,8 @@ public: inline void SetStopUnderFlow( const sal_Bool bNew ) { bStopUnderFlow = bNew; } inline sal_Bool IsFtnInside() const { return bFtnInside; } inline void SetFtnInside( const sal_Bool bNew ) { bFtnInside = bNew; } + inline sal_Bool IsOtherThanFtnInside() const { return bOtherThanFtnInside; } + inline void SetOtherThanFtnInside( const sal_Bool bNew ) { bOtherThanFtnInside = bNew; } inline sal_Bool IsMulti() const { return bMulti; } inline void SetMulti( const sal_Bool bNew ) { bMulti = bNew; } inline sal_Bool IsFirstMulti() const { return bFirstMulti; } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 84f877ed3328..c7527b372554 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -349,6 +349,8 @@ void SwTxtFormatter::InsertPortion( SwTxtFormatInfo &rInf, } pLast->Insert( pPor ); + rInf.SetOtherThanFtnInside( rInf.IsOtherThanFtnInside() || !pPor->IsFtnPortion() ); + // Maxima anpassen: if( pCurr->Height() < pPor->Height() ) pCurr->Height( pPor->Height() ); @@ -1533,6 +1535,7 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) while( bBuild ) { GetInfo().SetFtnInside( sal_False ); + GetInfo().SetOtherThanFtnInside( sal_False ); // These values must not be reset by FormatReset(); sal_Bool bOldNumDone = GetInfo().IsNumDone(); diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 3eedc0c8c983..a849cbe42f40 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -52,11 +52,13 @@ #include <IMark.hxx> #include <pam.hxx> #include <doc.hxx> +#include <xmloff/odffields.hxx> #if OSL_DEBUG_LEVEL > 1 const sal_Char *GetLangName( const MSHORT nLang ); #endif +using namespace ::sw::mark; using namespace ::com::sun::star; using namespace ::com::sun::star::i18n::ScriptType; @@ -349,7 +351,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf ) // C2 break iterator does not found a possible line break at all: // ==> line break - // case A: line not yet full + // case A: line not yet full if ( !bFull ) { Width( aGuess.BreakWidth() ); @@ -392,12 +394,16 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf ) } // case C1 // - Footnote portions with fake line start (i.e., not at beginning of line) - // should keep together with the text portion. + // should keep together with the text portion. (Note: no keep together + // with only footnote portions. // - TabPortions not at beginning of line should keep together with the // text portion, if they are not followed by a blank // (work around different definition of tab stop character - breaking or // non breaking character - in compatibility mode) - else if ( ( IsFtnPortion() && rInf.IsFakeLineStart() ) || + else if ( ( IsFtnPortion() && rInf.IsFakeLineStart() && + // --> OD 2010-01-29 #b6921213# + rInf.IsOtherThanFtnInside() ) || + // <-- ( rInf.GetLast() && rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) && rInf.GetLast()->InTabGrp() && @@ -655,7 +661,7 @@ xub_StrLen SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf, long SwTxtPortion::CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const { - xub_StrLen nCnt = 0; + xub_StrLen nCnt = 0; if ( InExpGrp() ) { @@ -766,9 +772,10 @@ void SwHolePortion::HandlePortion( SwPortionHandler& rPH ) const rPH.Text( GetLen(), GetWhichPor() ); } -void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & rInf) const +void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & /*rInf*/) const { - SwTxtPortion::Paint(rInf); + // These shouldn't be painted! + // SwTxtPortion::Paint(rInf); } sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & ) @@ -778,38 +785,96 @@ sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & ) return ret; } +namespace { + static sal_Int32 getCurrentListIndex( IFieldmark* pBM, + ::rtl::OUString* io_pCurrentText = NULL ) + { + const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters(); + sal_Int32 nCurrentIdx = 0; + const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)); + if(pResult != pParameters->end()) + pResult->second >>= nCurrentIdx; + if(io_pCurrentText) + { + const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY)); + if(pListEntries != pParameters->end()) + { + uno::Sequence< ::rtl::OUString > vListEntries; + pListEntries->second >>= vListEntries; + if(nCurrentIdx < vListEntries.getLength()) + *io_pCurrentText = vListEntries[nCurrentIdx]; + } + } + return nCurrentIdx; + } +} //FIXME Fieldbk -//void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const -void SwFieldFormPortion::Paint( const SwTxtPaintInfo& ) const +void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const { -// SwTxtNode *pNd=const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode()); -// const SwDoc *doc=pNd->GetDoc(); -// SwIndex aIndex( pNd, rInf.GetIdx() ); -// SwPosition aPosition(*pNd, aIndex); -// pMark = dynamic_cast< doc->getFieldmarkFor(aPosition); -// OSL_ENSURE(pMark, -// "SwFieldFormPortion::Paint(..)" -// " - Where is my form field bookmark???"); - -// bool checked=(pBM!=NULL?pBM->IsChecked():false); -// rInf.DrawCheckBox(*this , checked); -} + SwTxtNode* pNd = const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode()); + const SwDoc *doc=pNd->GetDoc(); + SwIndex aIndex( pNd, rInf.GetIdx() ); + SwPosition aPosition(*pNd, aIndex); -sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo &rInf ) -{ - sal_Bool ret=0; -// ret=SwTxtPortion::Format(rInf); + IFieldmark* pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition ); + + OSL_ENSURE( pBM, + "SwFieldFormPortion::Paint(..)" + " - Where is my form field bookmark???"); - Width(rInf.GetTxtHeight()); - Height(rInf.GetTxtHeight()); - SetAscent(rInf.GetAscent()); - //int h=rInf.GetTxtHeight(); + if ( pBM != NULL ) + { + if ( pBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) + { // a checkbox... + ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM); + bool checked = pCheckboxFm->IsChecked(); + rInf.DrawCheckBox(*this, checked); + } + else if ( pBM->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) ) + { // a list... + rtl::OUString aTxt; + rInf.DrawViewOpt( *this, POR_FLD ); + rInf.DrawText( aTxt, *this, 0, 0/*aTxt.getLength()*/, false ); + } + else + { + assert(0); // unknown type... + } + } +} -/* - Height(100); - SetAscent(100); -*/ +sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf ) +{ + sal_Bool ret = 0; + SwTxtNode *pNd = const_cast < SwTxtNode * >( rInf.GetTxtFrm( )->GetTxtNode( ) ); + const SwDoc *doc = pNd->GetDoc( ); + SwIndex aIndex( pNd, rInf.GetIdx( ) ); + SwPosition aPosition( *pNd, aIndex ); + IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition ); + ASSERT( pBM != NULL, "Where is my form field bookmark???" ); + if ( pBM != NULL ) + { + if ( pBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) + { + Width( rInf.GetTxtHeight( ) ); + Height( rInf.GetTxtHeight( ) ); + SetAscent( rInf.GetAscent( ) ); + } + else if ( pBM->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) ) + { + ::rtl::OUString aTxt; + getCurrentListIndex( pBM, &aTxt ); + SwPosSize aPosSize = rInf.GetTxtSize( aTxt ); + Width( aPosSize.Width( ) ); + Height( aPosSize.Height( ) ); + SetAscent( rInf.GetAscent( ) ); + } + else + { + assert( 0 ); // unknown type... + } + } return ret; } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 27cb99662171..16fbc589c16d 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -628,23 +628,34 @@ void SwTxtFrm::HideAndShowObjects() *************************************************************************/ xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt, - const xub_StrLen nStart, const xub_StrLen nEnd ) const + const xub_StrLen nStart, + const xub_StrLen nEnd ) const { - xub_StrLen nFound = nStart; + // --> OD 2009-12-28 #i104291# - applying patch to avoid overflow. + unsigned long nFound = nStart; const xub_StrLen nEndLine = Min( nEnd, rTxt.Len() ); // Wir ueberlesen erst alle Blanks am Anfang der Zeile (vgl. Bug 2235). - while( nFound <= nEndLine && ' ' == rTxt.GetChar( nFound ) ) - ++nFound; + while( nFound <= nEndLine && + ' ' == rTxt.GetChar( static_cast<xub_StrLen>(nFound) ) ) + { + nFound++; + } // Eine knifflige Sache mit den TxtAttr-Dummy-Zeichen (hier "$"): // "Dr.$Meyer" am Anfang der zweiten Zeile. Dahinter ein Blank eingegeben // und das Wort rutscht nicht in die erste Zeile, obwohl es ginge. // Aus diesem Grund nehmen wir das Dummy-Zeichen noch mit. - while( nFound <= nEndLine && ' ' != rTxt.GetChar( nFound ) ) - ++nFound; + while( nFound <= nEndLine && + ' ' != rTxt.GetChar( static_cast<xub_StrLen>(nFound) ) ) + { + nFound++; + } - return nFound; + return nFound <= STRING_LEN + ? static_cast<xub_StrLen>(nFound) + : STRING_LEN; + // <-- } /************************************************************************* diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 74a928c75f21..7b08a0cb87e4 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -481,6 +481,7 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; pScrFont = pPrtFont; FontMetric aMet = pPrt->GetFontMetric( ); + bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); if ( USHRT_MAX == nGuessedLeading ) @@ -2417,21 +2418,18 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf ) sal_uInt16 nItrMode = i18n::CharacterIteratorMode::SKIPCELL; sal_Int32 nDone = 0; LanguageType aLang = LANGUAGE_NONE; - sal_Bool bSkipCell = sal_False; + bool bSkipCharacterCells = false; xub_StrLen nIdx = rInf.GetIdx(); xub_StrLen nLastIdx = nIdx; const xub_StrLen nEnd = rInf.GetIdx() + rInf.GetLen(); - // skip character cells for complex scripts - // --> OD 2009-10-14 #i105571# - skip also character cells for CJK - if ( rInf.GetFont() && - ( SW_CTL == rInf.GetFont()->GetActual() || - SW_CJK == rInf.GetFont()->GetActual() ) && - pBreakIt->GetBreakIter().is() ) + // --> OD 2009-12-29 #i105901# + // skip character cells for all script types + if ( pBreakIt->GetBreakIter().is() ) // <-- { aLang = rInf.GetFont()->GetLanguage(); - bSkipCell = sal_True; + bSkipCharacterCells = true; } while ( ( nRight < long( rInf.GetOfst() ) ) && ( nIdx < nEnd ) ) @@ -2442,7 +2440,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf ) // go to next character (cell). nLastIdx = nIdx; - if ( bSkipCell ) + if ( bSkipCharacterCells ) { nIdx = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(), nIdx, pBreakIt->GetLocale( aLang ), nItrMode, 1, nDone ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 02f423c22b5a..798d7e41602f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2935,6 +2935,51 @@ BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const return bRet; } +// --> OD 2010-01-05 #b6884103# +SwTwips SwTxtNode::GetAdditionalIndentForStartingNewList() const +{ + SwTwips nAdditionalIndent = 0; + + const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; + if ( pRule ) + { + const SwNumFmt& rFmt = pRule->Get(static_cast<USHORT>(GetActualListLevel())); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + + if (getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)) + { + nAdditionalIndent = nAdditionalIndent - + GetSwAttrSet().GetLRSpace().GetTxtFirstLineOfst(); + } + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + if ( AreListLevelIndentsApplicable() ) + { + nAdditionalIndent = rFmt.GetIndentAt() + rFmt.GetFirstLineIndent(); + } + else + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + if (getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)) + { + nAdditionalIndent = nAdditionalIndent - + GetSwAttrSet().GetLRSpace().GetTxtFirstLineOfst(); + } + } + } + } + else + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + } + + return nAdditionalIndent; +} +// <-- + // --> OD 2008-12-02 #i96772# void SwTxtNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const { diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 5f487bce1184..590ddb6e803e 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -49,6 +49,7 @@ #include <docsh.hxx> +using namespace ::sw::mark; using namespace ::com::sun::star; using ::rtl::OUString; @@ -520,67 +521,131 @@ SwXFieldmark::SwXFieldmark(bool _isReplacementObject, ::sw::mark::IMark* pBkm, S , isReplacementObject(_isReplacementObject) { } -void SwXFieldmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) - throw( lang::IllegalArgumentException, uno::RuntimeException ) +void SwXFieldmarkParameters::insertByName(const OUString& aName, const uno::Any& aElement) + throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException) { - attachToRangeEx(xTextRange, (isReplacementObject?IDocumentMarkAccess::CHECKBOX_FIELDMARK:IDocumentMarkAccess::TEXT_FIELDMARK)); + vos::OGuard aGuard(Application::GetSolarMutex()); + IFieldmark::parameter_map_t* pParameters = getCoreParameters(); + if(pParameters->find(aName) != pParameters->end()) + throw container::ElementExistException(); + (*pParameters)[aName] = aElement; } -::rtl::OUString SwXFieldmark::getDescription(void) throw( ::com::sun::star::uno::RuntimeException ) +void SwXFieldmarkParameters::removeByName(const OUString& aName) + throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); -// TODO implement... -// if(!GetBookmark()) - ::sw::mark::IFieldmark const * const pMark = - dynamic_cast< ::sw::mark::IFieldmark const * const>(GetBookmark()); - if(!pMark) - throw uno::RuntimeException(); - return pMark->GetFieldHelptext(); + if(!getCoreParameters()->erase(aName)) + throw container::NoSuchElementException(); } -::sal_Int16 SAL_CALL SwXFieldmark::getType() throw (::com::sun::star::uno::RuntimeException) +void SwXFieldmarkParameters::replaceByName(const OUString& aName, const uno::Any& aElement) + throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox = - dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark()); - if(pAsCheckbox) - return 1; - return 0; + IFieldmark::parameter_map_t* pParameters = getCoreParameters(); + IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName); + if(pEntry == pParameters->end()) + throw container::NoSuchElementException(); + pEntry->second = aElement; } -::sal_Int16 SAL_CALL SwXFieldmark::getRes() throw (::com::sun::star::uno::RuntimeException) +uno::Any SwXFieldmarkParameters::getByName(const OUString& aName) + throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox = - dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark()); - if(pAsCheckbox && pAsCheckbox->IsChecked()) - return 1; - return 0; + IFieldmark::parameter_map_t* pParameters = getCoreParameters(); + IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName); + if(pEntry == pParameters->end()) + throw container::NoSuchElementException(); + return pEntry->second; +} + +uno::Sequence<OUString> SwXFieldmarkParameters::getElementNames() + throw (uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + IFieldmark::parameter_map_t* pParameters = getCoreParameters(); + uno::Sequence<OUString> vResult(pParameters->size()); + OUString* pOutEntry = vResult.getArray(); + for(IFieldmark::parameter_map_t::iterator pEntry = pParameters->begin(); pEntry!=pParameters->end(); ++pEntry, ++pOutEntry) + *pOutEntry = pEntry->first; + return vResult; +} + +::sal_Bool SwXFieldmarkParameters::hasByName(const OUString& aName) + throw (uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + IFieldmark::parameter_map_t* pParameters = getCoreParameters(); + return (pParameters->find(aName) != pParameters->end()); +} + +uno::Type SwXFieldmarkParameters::getElementType() + throw (uno::RuntimeException) +{ + return ::cppu::UnoType< ::cppu::UnoVoidType>::get(); +} + +::sal_Bool SwXFieldmarkParameters::hasElements() + throw (uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + return !getCoreParameters()->empty(); } -//FIXME Remove Method -void SAL_CALL SwXFieldmark::setType( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException) +void SwXFieldmarkParameters::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew) +{ + ClientModify(this, pOld, pNew); +} + + +IFieldmark::parameter_map_t* SwXFieldmarkParameters::getCoreParameters() + throw (uno::RuntimeException) +{ + const IFieldmark* pFieldmark = dynamic_cast< const IFieldmark* >(GetRegisteredIn()); + if(!pFieldmark) + throw uno::RuntimeException(); + return const_cast< IFieldmark* >(pFieldmark)->GetParameters(); +} + + +void SwXFieldmark::attachToRange( const uno::Reference < text::XTextRange >& xTextRange ) + throw(lang::IllegalArgumentException, uno::RuntimeException) +{ + attachToRangeEx( xTextRange, + ( isReplacementObject ? IDocumentMarkAccess::CHECKBOX_FIELDMARK : IDocumentMarkAccess::TEXT_FIELDMARK ) ); +} + +::rtl::OUString SwXFieldmark::getFieldType(void) + throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - throw uno::RuntimeException(); + const IFieldmark *pBkm = dynamic_cast<const IFieldmark*>(GetBookmark()); + if(!pBkm) + throw uno::RuntimeException(); + return pBkm->GetFieldname(); } -//FIXME Remove Method -void SAL_CALL SwXFieldmark::setRes( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException) +void SwXFieldmark::setFieldType(const::rtl::OUString & fieldType) + throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - throw uno::RuntimeException(); + IFieldmark *pBkm = const_cast<IFieldmark*>( + dynamic_cast<const IFieldmark*>(GetBookmark())); + if(!pBkm) + throw uno::RuntimeException(); + pBkm->SetFieldname(fieldType); } -void SAL_CALL SwXFieldmark::setDescription( const ::rtl::OUString& description ) - throw (::com::sun::star::uno::RuntimeException) +uno::Reference<container::XNameContainer> SwXFieldmark::getParameters() + throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - const ::sw::mark::IFieldmark* pMark = - dynamic_cast<const ::sw::mark::IFieldmark*>(GetBookmark()); - if(pMark) - const_cast< ::sw::mark::IFieldmark*>(pMark)->SetFieldHelptext(description); - else + IFieldmark *pBkm = const_cast<IFieldmark*>( + dynamic_cast<const IFieldmark*>(GetBookmark())); + if(!pBkm) throw uno::RuntimeException(); + return uno::Reference<container::XNameContainer>(new SwXFieldmarkParameters(pBkm)); } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 1b5f3cbd20db..92a33da130fe 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -269,13 +269,11 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry // <-- case FN_NUMBER_NEWSTART: { + // a multi selection is not considered const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode(); - // --> OD 2006-10-19 #134160# - make code robust: - // consider case that PaM doesn't denote a text node - const SwNumRule* pRule = pTxtNd ? pTxtNd->GetNumRule() : 0; + // --> OD 2010-01-13 #b6912256# + if ( pTxtNd && pTxtNd->IsInList() ) // <-- - // hier wird Multiselektion nicht beruecksichtigt - if( pRule ) { if( pAny ) { diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index e872c3112471..d8682062f039 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1885,6 +1885,26 @@ void SwXText::Impl::ConvertCell( { throw lang::IllegalArgumentException(); } + + SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, + aEndCellPam.End()->nNode); + SwNodeRange * pCorrectedRange = + m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange); + + if (pCorrectedRange != NULL) + { + SwPaM aNewStartPaM(pCorrectedRange->aStart, 0); + aStartCellPam = aNewStartPaM; + + xub_StrLen nEndLen = 0; + SwTxtNode * pTxtNode = pCorrectedRange->aEnd.GetNode().GetTxtNode(); + if (pTxtNode != NULL) + nEndLen = pTxtNode->Len(); + + SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen); + aEndCellPam = aNewEndPaM; + } + /** check the nodes between start and end it is allowed to have pairs of StartNode/EndNodes */ diff --git a/sw/source/core/view/makefile.mk b/sw/source/core/view/makefile.mk index aa010e6b6055..0ac0e0d106cb 100644..100755 --- a/sw/source/core/view/makefile.mk +++ b/sw/source/core/view/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -40,18 +40,20 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES = \ - $(SLO)$/scrrect.obj \ $(SLO)$/vdraw.obj \ $(SLO)$/viewimp.obj \ $(SLO)$/viewsh.obj \ - $(SLO)$/viewpg.obj \ - $(SLO)$/vnew.obj \ - $(SLO)$/vprint.obj \ - $(SLO)$/pagepreviewlayout.obj - + $(SLO)$/pagepreviewlayout.obj \ + $(SLO)$/printdata.obj \ + $(SLO)$/viewpg.obj \ + $(SLO)$/vnew.obj \ + $(SLO)$/vprint.obj + + + EXCEPTIONSFILES = \ $(SLO)$/pagepreviewlayout.obj - + # --- Targets ------------------------------------------------------- diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx new file mode 100755 index 000000000000..39bd4d91290c --- /dev/null +++ b/sw/source/core/view/printdata.cxx @@ -0,0 +1,546 @@ +/************************************************************************** + * + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vprint.cxx,v $ + * $Revision: 1.46 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#include <printdata.hxx> + +#include <globals.hrc> +#include <doc.hxx> +#include <unotxdoc.hxx> +#include <wdocsh.hxx> +#include <viewsh.hxx> +#include <docfld.hxx> +#include <swprtopt.hxx> + +#include <svl/languageoptions.hxx> +#include <toolkit/awt/vclxdevice.hxx> +#include <tools/string.hxx> +#include <tools/debug.hxx> +#include <tools/resary.hxx> +#include <unotools/moduleoptions.hxx> +#include <vcl/outdev.hxx> + + +extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); + + +using namespace ::com::sun::star; +using ::rtl::OUString; + + +////////////////////////////////////////////////////////////////////// + +SwRenderData::SwRenderData() +{ + m_pPostItFields = 0; + m_pPostItDoc = 0; + m_pPostItShell = 0; + + m_pViewOptionAdjust = 0; + m_pPrtOptions = 0; +} + + +SwRenderData::~SwRenderData() +{ + delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0; + delete m_pPrtOptions; m_pPrtOptions = 0; + DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" ); + DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" ); + DBG_ASSERT( !m_pPostItFields, " should already have been deleted" ); +} + + +void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) +{ + DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" ); + m_pPostItFields = new _SetGetExpFlds; + lcl_GetPostIts( pDoc, m_pPostItFields ); + m_pPostItDoc = new SwDoc; + + //!! Disable spell and grammar checking in the temporary document. + //!! Otherwise the grammar checker might process it and crash if we later on + //!! simply delete this document while he is still at it. + SwViewOption aViewOpt( *pViewOpt ); + aViewOpt.SetOnlineSpell( FALSE ); + + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); +} + + +void SwRenderData::DeletePostItData() +{ + if (HasPostItData()) + { + m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt + delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. + delete m_pPostItFields; + m_pPostItDoc = 0; + m_pPostItShell = 0; + m_pPostItFields = 0; + } +} + +bool SwRenderData::NeedNewViewOptionAdjust( const SwWrtShell& rCompare ) const +{ + return m_pViewOptionAdjust ? ! m_pViewOptionAdjust->checkShell( rCompare ) : true; +} + + +void SwRenderData::ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions ) +{ + if (m_pViewOptionAdjust) + { + DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" ); + } + m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions ); +} + + +void SwRenderData::ViewOptionAdjust( const SwPrtOptions *pPrtOptions ) +{ + m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions ); +} + + +void SwRenderData::ViewOptionAdjustStop() +{ + if (m_pViewOptionAdjust) + { + delete m_pViewOptionAdjust; + m_pViewOptionAdjust = 0; + } +} + + +void SwRenderData::MakeSwPrtOptions( + SwPrtOptions &rOptions, + const SwDocShell *pDocShell, + const SwPrintUIOptions *pOpt, + const SwRenderData *pData, + bool bIsPDFExport ) +{ + if (!pDocShell || !pOpt || !pData) + return; + + // get default print options + const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); + BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); + rOptions.MakeOptions( bWeb ); + + // get print options to use from provided properties + rOptions.bPrintGraphic = pOpt->IsPrintGraphics(); + rOptions.bPrintTable = pOpt->IsPrintTables(); + rOptions.bPrintDraw = pOpt->IsPrintDrawings(); + rOptions.bPrintControl = pOpt->IsPrintFormControls(); + rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages(); + rOptions.bPrintRightPages = pOpt->IsPrintRightPages(); + rOptions.bPrintPageBackground = pOpt->IsPrintPageBackground(); + rOptions.bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport ); + // bUpdateFieldsInPrinting <-- not set here; mail merge only + rOptions.bPaperFromSetup = pOpt->IsPaperFromSetup(); + rOptions.bPrintReverse = pOpt->IsPrintReverse(); + rOptions.bPrintProspect = pOpt->IsPrintProspect(); + rOptions.bPrintProspectRTL = pOpt->IsPrintProspectRTL(); + // bPrintSingleJobs <-- not set here; mail merge and or configuration + // bModified <-- not set here; mail merge only + rOptions.bPrintBlackFont = pOpt->IsPrintWithBlackTextColor(); + rOptions.bPrintHiddenText = pOpt->IsPrintHiddenText(); + rOptions.bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders(); + rOptions.nPrintPostIts = pOpt->GetPrintPostItsType(); + + //! needs to be set after MakeOptions since the assignment operation in that + //! function will destroy the pointers + rOptions.SetPrintUIOptions( pOpt ); + rOptions.SetRenderData( pData ); + + // rOptions.aMulti is not used anymore in the XRenderable API + // Thus we set it to a dummy value here. + rOptions.aMulti = MultiSelection( Range( 1, 1 ) ); + + //! Note: Since for PDF export of (multi-)selection a temporary + //! document is created that contains only the selects parts, + //! and thus that document is to printed in whole the, + //! rOptions.bPrintSelection parameter will be false. + if (bIsPDFExport) + rOptions.bPrintSelection = FALSE; +} + + +////////////////////////////////////////////////////////////////////// + +SwPrintUIOptions::SwPrintUIOptions( + bool bWeb, + bool bSwSrcView, + bool bHasSelection, + bool bHasPostIts, + const SwPrintData &rDefaultPrintData ) : + m_pLast( NULL ), + m_rDefaultPrintData( rDefaultPrintData ) +{ + ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); + + DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" ); + if( aLocalizedStrings.Count() < 44 ) // bad resource ? + return; + + // printing HTML sources does not have any valid UI options. + // Its just the source code that gets printed ... + if (bSwSrcView) + { + m_aUIProperties.realloc( 0 ); + return; + } + + // check if CTL is enabled + SvtLanguageOptions aLangOpt; + bool bCTL = aLangOpt.IsCTLFontEnabled(); + + // create sequence of print UI options + // (5 options are not available for Writer-Web) + const int nCTLOpts = bCTL ? 1 : 0; + const int nNumProps = nCTLOpts + (bWeb ? 14 : 20); + m_aUIProperties.realloc( nNumProps ); + int nIdx = 0; + + // create "writer" section (new tab page in dialog) + SvtModuleOptions aModOpt; + String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); + aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), + aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); + + // create sub section for Contents + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); + + // create a bool option for background + bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), + bDefaultVal ); + + // create a bool option for pictures/graphics AND OLE and drawing objects as well + bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), + bDefaultVal ); + if (!bWeb) + { + // create a bool option for hidden text + bDefaultVal = rDefaultPrintData.IsPrintHiddenText(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + aLocalizedStrings.GetString( 7 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + bDefaultVal ); + + // create a bool option for place holder + bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), + aLocalizedStrings.GetString( 9 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), + bDefaultVal ); + } + + // create a bool option for controls + bDefaultVal = rDefaultPrintData.IsPrintControl(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), + aLocalizedStrings.GetString( 11 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), + bDefaultVal ); + + // create sub section for Color + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() ); + + // create a bool option for printing text with black font color + bDefaultVal = rDefaultPrintData.IsPrintBlackFont(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + aLocalizedStrings.GetString( 14 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), + bDefaultVal ); + + if (!bWeb) + { + // create subgroup for misc options + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); + + // create a bool option for printing automatically inserted blank pages + bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), + aLocalizedStrings.GetString( 17 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + bDefaultVal ); + } + + // create a bool option for paper tray + bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); + vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; + aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), + aLocalizedStrings.GetString( 19 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), + bDefaultVal, + aPaperTrayOpt + ); + + // print range selection + vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; + aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); + aPrintRangeOpt.mbInternalOnly = sal_True; + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), + rtl::OUString(), + aPrintRangeOpt + ); + + // create a choice for the content to create + rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); + uno::Sequence< rtl::OUString > aChoices( bHasSelection ? 3 : 2 ); + uno::Sequence< rtl::OUString > aHelpText( bHasSelection ? 3 : 2 ); + aChoices[0] = aLocalizedStrings.GetString( 38 ); + aHelpText[0] = aLocalizedStrings.GetString( 39 ); + aChoices[1] = aLocalizedStrings.GetString( 40 ); + aHelpText[1] = aLocalizedStrings.GetString( 41 ); + if (bHasSelection) + { + aChoices[2] = aLocalizedStrings.GetString( 42 ); + aHelpText[2] = aLocalizedStrings.GetString( 43 ); + } + m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), + aHelpText, + aPrintRangeName, + aChoices, + bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */); + // create a an Edit dependent on "Pages" selected + vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); + m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), + rtl::OUString(), + aPageRangeOpt + ); + // print content selection + vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; + aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ), + rtl::OUString(), + aContentsOpt + ); + // create a list box for notes content + const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); + aChoices.realloc( 4 ); + aChoices[0] = aLocalizedStrings.GetString( 21 ); + aChoices[1] = aLocalizedStrings.GetString( 22 ); + aChoices[2] = aLocalizedStrings.GetString( 23 ); + aChoices[3] = aLocalizedStrings.GetString( 24 ); + aHelpText.realloc( 2 ); + aHelpText[0] = aLocalizedStrings.GetString( 25 ); + aHelpText[1] = aLocalizedStrings.GetString( 25 ); + vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); + aAnnotOpt.mbEnabled = bHasPostIts; + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), + aHelpText, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), + aChoices, + nPrintPostIts, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aAnnotOpt + ); + + // create subsection for Page settings + vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; + aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); + + if (!bWeb) + { + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ), + rtl::OUString(), + aPageSetOpt + ); + uno::Sequence< rtl::OUString > aRLChoices( 3 ); + aRLChoices[0] = aLocalizedStrings.GetString( 28 ); + aRLChoices[1] = aLocalizedStrings.GetString( 29 ); + aRLChoices[2] = aLocalizedStrings.GetString( 30 ); + uno::Sequence< rtl::OUString > aRLHelp( 1 ); + aRLHelp[0] = aLocalizedStrings.GetString( 31 ); + // create a choice option for all/left/right pages + // 0 : all pages (left & right) + // 1 : left pages + // 2 : right pages + DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(), + "unexpected value combination" ); + sal_Int16 nPagesChoice = 0; + if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage()) + nPagesChoice = 1; + else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage()) + nPagesChoice = 2; + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ), + aRLHelp, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), + aRLChoices, + nPagesChoice, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) + ); + } + + // create a bool option for brochure + bDefaultVal = rDefaultPrintData.IsPrintProspect(); + rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), + aLocalizedStrings.GetString( 34 ), + aBrochurePropertyName, + bDefaultVal, + aPageSetOpt + ); + + if (bCTL) + { + // create a bool option for brochure RTL dependent on brochure + uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); + aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); + aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); + vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); + aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); + // RTL brochure choices + // 0 : left-to-right + // 1 : right-to-left + const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0; + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), + uno::Sequence< rtl::OUString >(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), + aBRTLChoices, + nBRTLChoice, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aBrochureRTLOpt + ); + } + + + DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); +} + + +SwPrintUIOptions::~SwPrintUIOptions() +{ +} + +bool SwPrintUIOptions::IsPrintLeftPages() const +{ + // take care of different property names for the option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) + + // 0: left and right pages + // 1: left pages only + // 2: right pages only + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 1; + bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintRightPages() const +{ + // take care of different property names for the option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) + + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 2; + bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const +{ + // take care of different property names for the option. + + bool bRes = bIsPDFExport ? + !getBoolValue( "IsSkipEmptyPages", sal_True ) : + getBoolValue( "PrintEmptyPages", sal_True ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintTables() const +{ + // take care of different property names currently in use for this option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) + +// bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); +// bRes = getBoolValue( "PrintTables", bRes ); +// return bRes; + // for now it was decided that tables should always be printed + return true; +} + +bool SwPrintUIOptions::IsPrintGraphics() const +{ + // take care of different property names for the option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) + + bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); + bRes = getBoolValue( "PrintGraphics", bRes ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintDrawings() const +{ + // take care of different property names for the option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) + + bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); + bRes = getBoolValue( "PrintDrawings", bRes ); + return bRes; +} + +bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< beans::PropertyValue >& i_rNewProp ) +{ + bool bChanged = processProperties( i_rNewProp ); + + uno::Reference< awt::XDevice > xRenderDevice; + uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); + aVal >>= xRenderDevice; + + OutputDevice* pOut = 0; + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + pOut = pDevice ? pDevice->GetOutputDevice() : 0; + } + bChanged = bChanged || (pOut != m_pLast); + if( pOut ) + m_pLast = pOut; + + return bChanged; +} + +////////////////////////////////////////////////////////////////////// + diff --git a/sw/source/core/view/scrrect.cxx b/sw/source/core/view/scrrect.cxx deleted file mode 100644 index 05baadde4946..000000000000 --- a/sw/source/core/view/scrrect.cxx +++ /dev/null @@ -1,1192 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - - -#include <viewimp.hxx> -#include <viewsh.hxx> -#include <viewopt.hxx> -#include <vcl/window.hxx> -#include <scrrect.hxx> // SwScrollRect, SwScrollRects -// OD 18.02.2003 #107562# - <SwAlignRect> for <ViewShell::Scroll()> -#include <frmtool.hxx> -#ifndef _CURSOR_HXX //autogen -#include <vcl/cursor.hxx> -#endif -#include <vcl/virdev.hxx> -#ifndef _APP_HXX //autogen -#include <vcl/svapp.hxx> -#endif -#include <txtfrm.hxx> -#include "crsrsh.hxx" -#include "rootfrm.hxx" -#include "pagefrm.hxx" - -// OD 12.11.2002 #96272# - include declaration for <SetMappingForVirtDev> -#include "setmapvirtdev.hxx" -#include <IDocumentDrawModelAccess.hxx> - -// #i75172# -#include "dview.hxx" - -DBG_NAME(RefreshTimer) - -SV_IMPL_VARARR(SwStripeArr,SwStripe); -SV_IMPL_OP_PTRARR_SORT(SwScrollStripes, SwStripesPtr); -SV_IMPL_OP_PTRARR_SORT(SScrAreas, SwScrollAreaPtr); - -/***************************************************************************** -|* -|* ViewShell::AddScrollRect() -|* -|* Creation MA 07. Mar. 94 -|* Last change AMA 20. July 00 -|* -|* Description -|* ViewShell::AddScrollRect(..) passes a registration from a scrolling frame or -|* rectangle to all ViewShells and SwViewImps respectively. -|* -******************************************************************************/ - -void ViewShell::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, - long nOfs ) -{ - ASSERT( pFrm, "Where is my friend, the frame?" ); - BOOL bScrollOn = TRUE; - -#ifdef NOSCROLL - //Auch im Product per speziellem Compilat abschaltbar. - bScrollOn = FALSE; -#endif - - if( bScrollOn && Imp()->IsScroll() && nOfs <= SHRT_MAX && nOfs >= SHRT_MIN ) - { - ViewShell *pSh = this; - do - { - pSh->Imp()->AddScrollRect( pFrm, rRect, nOfs ); - pSh = (ViewShell*)pSh->GetNext(); - } while ( pSh != this ); - } - else - AddPaintRect( rRect ); -} - -/****************************************************************************** -|* -|* ViewShell::Scroll() -|* -|* Ersterstellung MA 07. Mar. 94 -|* Last change AMA 21. July 00 -|* -|* Description -|* ViewShell::Scroll() scrolls all rectangles in the pScrollRects-list and -|* transfers the critical lines by calling SwViewImp::MoveScrollArea(..). -|* -******************************************************************************/ -#include <svx/sdrpaintwindow.hxx> -#include <svx/sdr/overlay/overlaymanager.hxx> - -void ViewShell::Scroll() -{ - SwScrollAreas *pScrollRects = Imp()->GetScrollRects(); - if ( pScrollRects ) - { - bPaintWorks = FALSE; - ASSERT( pScrollRects->Count(), "ScrollRects ohne ScrollRects." ); - - //Abgleichen der Region mit den Scroll-Bereichen!!! - //Wenn eines der Scroll-Rechtecke ungueltig wird, so muss - //der PaintMode wahrscheinlich auf PAINT_BACKGROUND umgeschaltet - //werden. - - //Auf die Richtung kommt es an: - //- Bei einem pos. Ofst muss von hinten nach vorn gescrollt werden. - //- Bei einem neg. Ofst muss von vorn nach hinten gescrollt werden. - BOOL bPositive = (*pScrollRects)[0]->GetOffs() > 0; - if( (*pScrollRects)[0]->IsVertical() ) - bPositive = !bPositive; - int i = bPositive ? pScrollRects->Count()-1 : 0; - - for ( ; bPositive ? - i >= 0 : - i < (int)pScrollRects->Count(); - bPositive ? - --i : - ++i ) - { - const SwScrollArea &rScroll = *(*pScrollRects)[ sal::static_int_cast<USHORT>(i) ]; - if( rScroll.Count() ) - { - int j = bPositive ? rScroll.Count()-1 : 0; - for ( ; bPositive ? j >= 0 : j < (int)rScroll.Count(); - bPositive ? --j : ++j ) - { - const SwStripes& rStripes = *rScroll[ sal::static_int_cast<USHORT>(j) ]; - if( rScroll.IsVertical() ) - { - Rectangle aRectangle( rStripes.GetY() - - rStripes.GetHeight() + rScroll.GetOffs(), - rStripes.GetMin(), - rStripes.GetY() + rScroll.GetOffs(), - rStripes.GetMax() ); - // OD 18.02.2003 #107562# - align rectangle for scrolling - SwRect aAlignedScrollRect( aRectangle ); - ::SwAlignRect( aAlignedScrollRect, this ); - - // #i68597# when scrolling, let DrawingLayer know about refreshed areas, - // even when no DL objects are in the area. This is needed to allow - // fully buffered overlay. - const Rectangle aSourceRect(aAlignedScrollRect.SVRect()); - const Rectangle aTargetRect( - aSourceRect.Left() - rScroll.GetOffs(), aSourceRect.Top(), - aSourceRect.Right() - rScroll.GetOffs(), aSourceRect.Bottom()); - - if(GetWin()) - { - // SCROLL_NOWINDOWINVALIDATE okay since AddPaintRect below adds the to-be-invalidated region - GetWin()->Scroll( -rScroll.GetOffs(), 0, aSourceRect, SCROLL_CHILDREN | SCROLL_NOWINDOWINVALIDATE ); - } - - // #i68597# if buffered overlay, the buffered content needs to be scrolled directly - { - SdrPaintWindow* pPaintWindow = GetDrawView()->GetPaintWindow(0); - - if(pPaintWindow) - { - sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager(); - - if(pOverlayManager) - { - pOverlayManager->copyArea(aTargetRect.TopLeft(), aSourceRect.TopLeft(), aSourceRect.GetSize()); - } - } - } - - SwRect aRect( aRectangle ); - Imp()->ScrolledRect( aRect, -rScroll.GetOffs() ); - if ( bPositive ) - aRect.Right( aRect.Left() + rScroll.GetOffs()-1 ); - else - aRect.Left( aRect.Right() - rScroll.GetOffs() ); - Imp()->AddPaintRect( aRect ); - } - else - { - Rectangle aRectangle( rStripes.GetMin(), - rStripes.GetY() - rScroll.GetOffs(), - rStripes.GetRight(), - rStripes.GetBottom() - rScroll.GetOffs() ); - // OD 18.02.2003 #107562# - use aligned rectangle for scrolling - SwRect aAlignedScrollRect( aRectangle ); - ::SwAlignRect( aAlignedScrollRect, this ); - - // #i68597# when scrolling, let DrawingLayer know about refreshed areas, - // even when no DL objects are in the area. This is needed to allow - // fully buffered overlay. - const Rectangle aSourceRect(aAlignedScrollRect.SVRect()); - const Rectangle aTargetRect( - aSourceRect.Left(), aSourceRect.Top() + rScroll.GetOffs(), - aSourceRect.Right(), aSourceRect.Bottom() + rScroll.GetOffs()); - - if(GetWin()) - { - // SCROLL_NOWINDOWINVALIDATE okay since AddPaintRect below adds the to-be-invalidated region - GetWin()->Scroll( 0, rScroll.GetOffs(), aSourceRect, SCROLL_CHILDREN | SCROLL_NOWINDOWINVALIDATE ); - } - - // #i68597# if buffered overlay, the buffered content needs to be scrolled directly - { - SdrPaintWindow* pPaintWindow = GetDrawView()->GetPaintWindow(0); - - if(pPaintWindow) - { - sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager(); - - if(pOverlayManager) - { - pOverlayManager->copyArea(aTargetRect.TopLeft(), aSourceRect.TopLeft(), aSourceRect.GetSize()); - } - } - } - - SwRect aRect( aRectangle ); - Imp()->ScrolledRect( aRect, rScroll.GetOffs() ); - if ( bPositive ) - aRect.Bottom( aRect.Top() + rScroll.GetOffs()-1 ); - else - aRect.Top( aRect.Bottom() + rScroll.GetOffs() ); - Imp()->AddPaintRect( aRect ); - } - } - } - } - if ( !Imp()->IsScrolled() ) - Imp()->SetScrolled(); - - Imp()->MoveScrollArea(); - bPaintWorks = TRUE; - } -} - -/****************************************************************************** -|* -|* ViewShell::SetNoNextScroll() -|* -|* Ersterstellung MA 08. Mar. 94 -|* Letzte Aenderung MA 08. Mar. 94 -|* -******************************************************************************/ - -void ViewShell::SetNoNextScroll() -{ - ViewShell *pSh = this; - do - { pSh->Imp()->ResetNextScroll(); - pSh = (ViewShell*)pSh->GetNext(); - - } while ( pSh != this ); -} - -/****************************************************************************** -|* -|* SwViewImp::AddScrollRect() -|* -|* Ersterstellung MA 07. Mar. 94 -|* Last change AMA 21. July 00 -|* -|* Adds a scrollable rectangle and his critical lines to the list. -|* -******************************************************************************/ - -void SwViewImp::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, - long nOffs ) -{ - ASSERT( nOffs != 0, "Scrollen ohne Ofst." ); - SwRect aRect( rRect ); - BOOL bVert = pFrm->IsVertical(); - if( bVert ) - aRect.Pos().X() += nOffs; - else - aRect.Pos().Y() -= nOffs; - if( aRect.IsOver( pSh->VisArea() ) ) - { - ASSERT( pSh->GetWin(), "Scrolling without outputdevice" ); - aRect._Intersection( pSh->VisArea() ); - SwStripes *pStr; - if ( !pScrollRects ) - pScrollRects = new SwScrollAreas; - if( bVert ) - { - aRect.Pos().X() -= nOffs; - pStr = new SwStripes( aRect.Right(), aRect.Width(), - aRect.Top(), aRect.Bottom() ); - if( pFrm->IsTxtFrm() ) - ((SwTxtFrm*)pFrm)->CriticalLines(*pSh->GetWin(), *pStr, nOffs ); - else - pStr->Insert( SwStripe( aRect.Right(), aRect.Width() ), 0 ); - pScrollRects->InsertCol( SwScrollColumn( pFrm->Frm().Top(), - pFrm->Frm().Height(), nOffs, bVert ), pStr); - } - else - { - aRect.Pos().Y() += nOffs; - pStr = new SwStripes( aRect.Top(), aRect.Height(), - aRect.Left(), aRect.Right() ); - if( pFrm->IsTxtFrm() ) - ((SwTxtFrm*)pFrm)->CriticalLines(*pSh->GetWin(), *pStr, nOffs ); - else - pStr->Insert( SwStripe( aRect.Top(), aRect.Height() ), 0 ); - pScrollRects->InsertCol( SwScrollColumn( pFrm->Frm().Left(), - pFrm->Frm().Width(), nOffs, bVert ), pStr ); - } - } - else - AddPaintRect( rRect ); -} - -/****************************************************************************** -|* -|* SwViewImp::MoveScrollArea() -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* Transfers the areas after scrolling to the scrolled list, but only those -|* parts with critical lines. -|* -******************************************************************************/ - -void SwViewImp::MoveScrollArea() -{ - if( !pScrolledArea ) - pScrolledArea = new SwScrollAreas; - for( USHORT nIdx = 0; nIdx < pScrollRects->Count(); ++nIdx ) - { - SwScrollArea *pScr = (*pScrollRects)[ nIdx ]; - if( pScr->Compress() ) - delete pScr; - else - { - USHORT nIndx; - if( pScrolledArea->Seek_Entry( pScr, &nIndx ) ) - pScrolledArea->GetObject(nIndx)->Add( pScr ); - else - pScrolledArea->Insert( pScr ); - } - } - delete pScrollRects; - pScrollRects = NULL; -} - -/****************************************************************************** -|* -|* SwViewImp::FlushScrolledArea() -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* Flushes the scrolled critical lines, that is transfer them to AddPaintRect() -|* and remove them from the list. -|* -******************************************************************************/ - -void SwViewImp::FlushScrolledArea() -{ - USHORT nCount = pScrolledArea->Count(); - while( nCount ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--nCount]; - USHORT nCnt = pScroll->Count(); - while( nCnt ) - { - SwStripes* pStripes = (*pScroll)[--nCnt]; - if( pScroll->IsVertical() ) - { - SwRect aRect( 0, pStripes->GetMin(), 0, pStripes->GetWidth() ); - for( USHORT i = 0; i < pStripes->Count(); ++i ) - { - long nWidth = (*pStripes)[i].GetHeight(); - aRect.Left( (*pStripes)[i].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - AddPaintRect( aRect ); - } - } - { - SwRect aRect( pStripes->GetMin(), 0, pStripes->GetWidth(), 0 ); - for( USHORT i = 0; i < pStripes->Count(); ++i ) - { - aRect.Top( (*pStripes)[i].GetY() ); - aRect.Height( (*pStripes)[i].GetHeight() ); - AddPaintRect( aRect ); - } - } - pScroll->Remove( nCnt ); - delete pStripes; - } - pScrolledArea->Remove( nCount ); - delete pScroll; - } - delete pScrolledArea; - pScrolledArea = NULL; -} - -/****************************************************************************** -|* -|* SwViewImp::_FlushScrolledArea(..) -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* The critical lines, which overlaps with the given rectangle, will be united -|* with the rectangle and removed from the list. -|* -******************************************************************************/ - -BOOL SwViewImp::_FlushScrolledArea( SwRect& rRect ) -{ - BOOL bRet = FALSE; - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - for( USHORT j = pScroll->Count(); j; ) - { - SwStripes* pStripes = (*pScroll)[--j]; - if( pStripes->Count() ) - { - if( pScroll->IsVertical() ) - { - SwRect aRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - if( rRect.IsOver( aRect ) ) - { - rRect.Union( aRect ); - bRet = TRUE; - pStripes->Remove( nI ); - nI = pStripes->Count(); - } - } - } - } - else - { - SwRect aRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - rRect.Union( aRect ); - bRet = TRUE; - pStripes->Remove( nI ); - nI = pStripes->Count(); - } - } - } - } - } - if( !pStripes->Count() ) - { - pScroll->Remove( j ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - } - if( !pScrolledArea->Count() ) - { - DELETEZ( pScrolledArea ); - SetNextScroll(); - } - return bRet; -} - -/****************************************************************************** -|* -|* SwViewImp::RefreshScrolledHdl(..) -|* -|* Creation MA 06. Oct. 94 -|* Last change AMA 21. July 00 -|* -|* Every timerstop one of the critical lines will be painted. -|* -******************************************************************************/ - -IMPL_LINK( SwViewImp, RefreshScrolledHdl, Timer *, EMPTYARG ) -{ - DBG_PROFSTART( RefreshTimer ); - - if ( !IsScrolled() ) - { DBG_PROFSTOP( RefreshTimer ); - return 0; - } - - SET_CURR_SHELL( GetShell() ); - - //Kein Refresh wenn eine Selektion besteht. - if ( GetShell()->IsA( TYPE(SwCrsrShell) ) && - (((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1)) - { - DBG_PROFSTOP( RefreshTimer ); - return 0; - } - - if( pScrolledArea ) - { - const SwRect aRect( GetShell()->VisArea() ); - BOOL bNoRefresh = GetShell()->IsA( TYPE(SwCrsrShell) ) && - ( ((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1 ); - if( pScrolledArea->Count() ) - { - SwScrollArea* pScroll = pScrolledArea->GetObject(0); - ASSERT( pScroll->Count(), "Empty scrollarea" ); - // OD 21.10.2003 #112616# - for savety reason: - // react, if precondition named in assertion isn't hold - if ( pScroll->Count() ) - { - SwStripes* pStripes = pScroll->GetObject(0); - // OD 20.10.2003 #112616# - consider also first stripe - ASSERT( pStripes->Count(), "Empty scrollstripes" ); - // OD 21.10.2003 #112616# - for savety reason: - // react, if precondition named in assertion isn't hold - if ( pStripes->Count() ) - { - const SwStripe &rStripe = pStripes->GetObject(0); - SwRect aTmpRect = pScroll->IsVertical() ? - SwRect( rStripe.GetY() - rStripe.GetHeight(), pScroll->GetX(), - rStripe.GetHeight(), pScroll->GetWidth() ) : - SwRect( pScroll->GetX(), rStripe.GetY(), - pScroll->GetWidth(), rStripe.GetHeight() ); - if( aTmpRect.IsOver( aRect ) ) - { - // SwSaveHdl aSaveHdl( this ); - if( !bNoRefresh ) - _RefreshScrolledArea( aTmpRect ); - } - // OD 20.10.2003 #112616# - consider also first stripe - pStripes->Remove( 0 ); - } - if( pStripes->Count() < 1 ) - { - pScroll->Remove( USHORT(0) ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - } - if( !pScrolledArea->Count() ) - { - delete pScrolledArea; - pScrolledArea = 0; - } - } - - //All done? - if( !pScrolledArea || !pScrolledArea->Count() - ) - { - ResetScrolled(); - SetNextScroll(); - aScrollTimer.Stop(); - } - - DBG_PROFSTOP( RefreshTimer ); - return 0; -} - -/****************************************************************************** -|* -|* SwViewImp::_ScrolledRect(..) -|* -|* Creation AMA 20. July 00 -|* Last change AMA 21. July 00 -|* -|* handles the problem of scrolled criticals lines, when they are a part of -|* a scrolling area again. In this case, their rectangle has to move to the -|* right position. -|* -******************************************************************************/ - -void SwViewImp::_ScrolledRect( const SwRect& rRect, long nOffs ) -{ - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - ASSERT( pScroll->Count() == 1, "Missing scrollarea compression 1" ); - SwStripes* pStripes = (*pScroll)[0]; - if( pStripes->Count() ) - { - SwRect aRect = pScroll->IsVertical() ? - SwRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ) : - SwRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - - if( rRect.IsOver( aRect ) ) - { - BOOL bRecalc = FALSE; - for( USHORT nI = pStripes->Count(); nI; ) - { - if( pScroll->IsVertical() ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - } - else - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - } - if( rRect.IsInside( aRect ) ) - { - (*pStripes)[nI].Y() += nOffs; - bRecalc = TRUE; - } - } - if( bRecalc ) - pStripes->Recalc( pScroll->IsVertical() ); - } - } - } -} - -/****************************************************************************** -|* -|* SwViewImp::_RefreshScrolledArea() -|* -******************************************************************************/ - -//Berechnen der Hoehe fuer das virtuelle Device, Breite und maximaler -//Speicherbedarf sind vorgegeben. -#define MAXKB 180L - -static void lcl_CalcVirtHeight( OutputDevice *pOut, Size &rSz ) -{ - char nBytes; - const ULONG nColorCount = pOut->GetColorCount(); - if( 256 >= nColorCount ) // 2^8 - nBytes = 1; - else - if( USHRT_MAX >= nColorCount ) // 2^16 - nBytes = 2; - else - if( 16777216 >= nColorCount ) // 2^24 - nBytes = 3; - else - nBytes = 4; // 2^n - - rSz = pOut->LogicToPixel( rSz ); - - long nKB = MAXKB * 1000; - nKB /= nBytes; - if ( rSz.Width() > 0 ) - rSz.Height() = nKB / rSz.Width(); - else - rSz.Height() = nKB; - - rSz = pOut->PixelToLogic( rSz ); -} - -void SwViewImp::_RefreshScrolledArea( const SwRect &rRect ) -{ - SwRect aScRect( rRect ); - aScRect.Intersection( GetShell()->VisArea() ); - - if( aScRect.IsEmpty() ) - return; - - BOOL bShowCrsr = FALSE; - Window *pWin = GetShell()->GetWin(); - if ( pWin && pWin->GetCursor() && pWin->GetCursor()->IsVisible() ) - { - bShowCrsr = TRUE; - pWin->GetCursor()->Hide(); - } - - //Virtuelles Device erzeugen und einstellen. - // --> OD 2007-08-16 #i80720# - // rename variable <pOld> to <pCurrentOut> - OutputDevice* pCurrentOut = GetShell()->GetOut(); - VirtualDevice *pVout = new VirtualDevice( *pCurrentOut ); - MapMode aMapMode( pCurrentOut->GetMapMode() ); - pVout->SetMapMode( aMapMode ); - Size aSize( aScRect.Width(), 0 ); - lcl_CalcVirtHeight( pCurrentOut, aSize ); - if ( aSize.Height() > aScRect.Height() ) - aSize.Height() = aScRect.Height() + 50; - - //unten in der Schleife lassen wir die Rechtecke ein wenig ueberlappen, - //das muss auch bei der Groesse beruecksichtigt werden. - aSize = pCurrentOut->LogicToPixel( aSize ); - aSize.Width() += 4; aSize.Height() += 4; - aSize = pCurrentOut->PixelToLogic( aSize ); - // <-- - - const SwRootFrm* pLayout = GetShell()->GetLayout(); - - // #i75172# Avoid VDev if PreRendering is active - static bool bDoNotUseVDev(GetDrawView()->IsBufferedOutputAllowed()); - - // --> OD 2007-08-16 #i80720# - // Enlarge paint rectangle also in case that "own" virtual device <pVout> - // isn't used. Refactor code a little bit to achieve this. - const bool bApplyVDev = !bDoNotUseVDev && pVout->SetOutputSize( aSize ); - - { - if ( bApplyVDev ) - { - // --> OD 2007-08-16 #i80720# - // rename variable <pOld> to <pCurrentOut> - pVout->SetLineColor( pCurrentOut->GetLineColor() ); - pVout->SetFillColor( pCurrentOut->GetFillColor() ); - // <-- - } - - // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev - const Region aRepaintRegion(aScRect.SVRect()); - GetShell()->DLPrePaint2(aRepaintRegion); - - //Virtuelles Device in die ViewShell 'selektieren' - // --> OD 2007-08-16 #i80720# - // remember current output device at this place - OutputDevice* pOldOut = GetShell()->GetOut(); - // <-- - if ( bApplyVDev ) - { - GetShell()->pOut = pVout; - } - - const SwFrm *pPg = GetFirstVisPage(); - do - { - SwRect aRect( pPg->Frm() ); - if ( aRect.IsOver( aScRect ) ) - { - aRect._Intersection( aScRect ); - do - { - Rectangle aTmp( aRect.SVRect() ); - long nTmp = aTmp.Top() + aSize.Height(); - if ( aTmp.Bottom() > nTmp ) - aTmp.Bottom() = nTmp; - - aTmp = pOldOut->LogicToPixel( aTmp ); - if( aRect.Top() > pPg->Frm().Top() ) - aTmp.Top() -= 2; - if( aRect.Top() + aRect.Height() < pPg->Frm().Top() - + pPg->Frm().Height() ) - aTmp.Bottom() += 2; - if( aRect.Left() > pPg->Frm().Left() ) - aTmp.Left() -= 2; - if( aRect.Left() + aRect.Width() < pPg->Frm().Left() - + pPg->Frm().Width() ) - aTmp.Right() += 2; - aTmp = pOldOut->PixelToLogic( aTmp ); - SwRect aTmp2( aTmp ); - - if ( bApplyVDev ) - { - // OD 12.11.2002 #96272# - use method to set mapping - //Point aOrigin( aTmp2.Pos() ); - //aOrigin.X() = -aOrigin.X(); aOrigin.Y() = -aOrigin.Y(); - //aMapMode.SetOrigin( aOrigin ); - ::SetMappingForVirtDev( aTmp2.Pos(), &aMapMode, pOldOut, pVout ); - pVout->SetMapMode( aMapMode ); - } - - pLayout->Paint( aTmp2 ); - if ( bApplyVDev ) - { - pOldOut->DrawOutDev( aTmp2.Pos(), aTmp2.SSize(), - aTmp2.Pos(), aTmp2.SSize(), *pVout ); - } - - aRect.Top( aRect.Top() + aSize.Height() ); - aScRect.Top( aRect.Top() ); - - } while ( aRect.Height() > 0 ); - } - pPg = pPg->GetNext(); - - } while ( pPg && pPg->Frm().IsOver( GetShell()->VisArea() ) ); - - if ( bApplyVDev ) - { - GetShell()->pOut = pOldOut; - } - delete pVout; - - // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted - GetShell()->DLPostPaint2(true); - } - // <-- - - if ( bShowCrsr ) - pWin->GetCursor()->Show(); -} - -/****************************************************************************** -|* -|* SwViewImp::RefreshScrolledArea() -|* -|* Ersterstellung MA 06. Oct. 94 -|* Letzte Aenderung MA 19. Apr. 95 -|* -******************************************************************************/ - -void SwViewImp::RefreshScrolledArea( SwRect &rRect ) -{ - // --> OD 2007-07-24 #123003# - make code robust - // avoid recursive call - static bool bRunning( false ); - - if ( bRunning ) - { - ASSERT( false, "<SwViewImp::RefreshScrolledArea(..)> - recursive method call - please inform OD" ); - return; - } - // <-- - - //1. Wird auch von der CrsrShell gerufen, um ggf. den Bereich, in den der - //Crsr gesetzt wird (Absatz, ganze Zeile bei einer Tabelle) aufzufrischen. - //Allerdings kann es dann natuerlich sein, dass das Rechteck ueberhaupt - //nicht mit aufzufrischenden Bereichen ueberlappt. - //2. Kein Refresh wenn eine Selektion besteht. - if( (GetShell()->IsA( TYPE(SwCrsrShell) ) && - (((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1))) - { - return; - } - - // --> OD 2007-07-27 #123003# - bRunning = true; - // <-- - - if( pScrolledArea && pScrolledArea->Count() && - !( ( GetShell()->IsA( TYPE(SwCrsrShell) ) && - ( ((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1) ) ) ) - { - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - for( USHORT j = pScroll->Count(); j; ) - { - SwStripes* pStripes = (*pScroll)[--j]; - if( pStripes->Count() ) - { - SwRect aRect = pScroll->IsVertical() ? - SwRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ) : - SwRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - if( pScroll->IsVertical() ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() -nWidth +1 ); - aRect.Width( nWidth ); - } - else - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - } - if( rRect.IsOver( aRect ) ) - { - pStripes->Remove( nI ); - _RefreshScrolledArea( aRect ); - } - } - } - } - if( !pStripes->Count() ) - { - pScroll->Remove( j ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - //Ist da jemand ungeduldig? - //Nur Mouse und Keyboard, weil wir sonst von jeder billigen - //Uhr unterbrochen werden. - if( GetpApp()->AnyInput( INPUT_MOUSEANDKEYBOARD ) ) - break; - } - } - - //All done? - if( !pScrolledArea || !pScrolledArea->Count() ) - { - ResetScrolled(); - SetNextScroll(); - aScrollTimer.Stop(); - } - - // --> OD 2007-07-24 #123003# - bRunning = false; - // <-- -} - -SwStripes& SwStripes::Plus( const SwStripes& rOther, BOOL bVert ) -{ - if( !Count() ) - { - Insert( &rOther, 0 ); - SetMin( rOther.GetMin() ); - SetMax( rOther.GetMax() ); - return *this; - } - - long nCnt = rOther.Count(); - if( nCnt ) - { - ChkMin( rOther.GetMin() ); - ChkMax( rOther.GetMax() ); - USHORT nStart = 0; - if( bVert ) - for( USHORT nIdx = 0; nIdx < nCnt; ++nIdx ) - { - const SwStripe& rAdd = rOther[ nIdx ]; - long nBottom = rAdd.GetY() - rAdd.GetHeight(); - USHORT nCount = Count(); - USHORT nTmpY = nStart; - while( nTmpY < nCount ) - { - SwStripe& rChk = GetObject( nTmpY ); - if( rChk.GetY() - rChk.GetHeight() < rAdd.GetY() ) - break; - else - ++nTmpY; - } - USHORT nB = nTmpY; - while( nB < nCount ) - { - const SwStripe& rChk = GetObject( nB ); - if( rChk.GetY() <= nBottom ) - break; - else - ++nB; - } - nStart = nTmpY; - if( nTmpY == nB ) - Insert( rAdd, nTmpY ); - else - { - long nChkBottom = rAdd.GetY() - rAdd.GetHeight();; - const SwStripe& rChkB = GetObject( nB - 1 ); - long nTmp = rChkB.GetY() - rChkB.GetHeight(); - if( nTmp < nChkBottom ) - nChkBottom = nTmp; - SwStripe& rChk = GetObject( nTmpY ); - if( rAdd.GetY() > rChk.GetY() ) - rChk.Y() = rAdd.GetY(); - rChk.Height() = rChk.GetY() - nChkBottom; - nChkBottom = nB - nTmpY - 1; - if( nChkBottom ) - Remove( nTmpY + 1, (USHORT)nChkBottom ); - } - } - else - { - for( USHORT nIdx = 0; nIdx < nCnt; ++nIdx ) - { - const SwStripe& rAdd = rOther[ nIdx ]; - long nBottom = rAdd.GetY() + rAdd.GetHeight(); - USHORT nCount = Count(); - USHORT nTmpY = nStart; - while( nTmpY < nCount ) - { - SwStripe& rChk = GetObject( nTmpY ); - if( rChk.GetY() + rChk.GetHeight() > rAdd.GetY() ) - break; - else - ++nTmpY; - } - USHORT nB = nTmpY; - while( nB < nCount ) - { - const SwStripe& rChk = GetObject( nB ); - if( rChk.GetY() >= nBottom ) - break; - else - ++nB; - } - nStart = nTmpY; - if( nTmpY == nB ) - Insert( rAdd, nTmpY ); - else - { - long nChkBottom = rAdd.GetY() + rAdd.GetHeight();; - const SwStripe& rChkB = GetObject( nB - 1 ); - long nTmp = rChkB.GetY() + rChkB.GetHeight(); - if( nTmp > nChkBottom ) - nChkBottom = nTmp; - SwStripe& rChk = GetObject( nTmpY ); - if( rAdd.GetY() < rChk.GetY() ) - rChk.Y() = rAdd.GetY(); - rChk.Height() = nChkBottom - rChk.GetY(); - nChkBottom = nB - nTmpY - 1; - if( nChkBottom ) - Remove( nTmpY + 1, (USHORT)nChkBottom ); - } - } - } - } - return *this; -} - -BOOL SwStripes::Recalc( BOOL bVert ) -{ - if( !Count() ) - return TRUE; - Y() = GetObject(0).GetY(); - if( bVert ) - { - long nTmpMin = GetObject(0).GetY() - GetObject(0).Height(); - for( USHORT nIdx = 1; nIdx < Count(); ) - { - const SwStripe& rStr = GetObject(nIdx++); - if( GetY() < rStr.GetY() ) - Y() = rStr.GetY(); - if( nTmpMin > rStr.GetY() - rStr.GetHeight() ) - nTmpMin = rStr.GetY() - rStr.GetHeight(); - } - Height() = GetY() - nTmpMin; - } - else - { - long nTmpMax = GetObject(0).GetY() + GetObject(0).Height(); - for( USHORT nIdx = 1; nIdx < Count(); ) - { - const SwStripe& rStr = GetObject(nIdx++); - if( GetY() > rStr.GetY() ) - Y() = rStr.GetY(); - if( nTmpMax < rStr.GetY() + rStr.GetHeight() ) - nTmpMax = rStr.GetY() + rStr.GetHeight(); - } - Height() = nTmpMax - GetY(); - } - return FALSE; -} - -BOOL SwScrollArea::Compress() -{ - if( !Count() ) - return TRUE; - for( USHORT nIdx = Count() - 1; nIdx > 0; --nIdx ) - { - GetObject(0)->Plus( *GetObject(nIdx), IsVertical() ); - delete GetObject( nIdx ); - Remove( nIdx, 1 ); - } - ClrOffs(); - return GetObject(0)->Recalc( IsVertical() ); -} - -void SwScrollArea::Add( SwScrollArea *pScroll ) -{ - ASSERT( pScroll->Count() == 1, "Missing scrollarea compression 2" ); - ASSERT( Count() == 1, "Missing scrollarea compression 3" ); - GetObject(0)->Plus( *pScroll->GetObject(0), IsVertical() ); - GetObject(0)->Recalc( IsVertical() ); - delete pScroll->GetObject( 0 ); - pScroll->Remove( (USHORT)0, 1 ); - delete pScroll; -} - -/****************************************************************************** -|* -|* SwScrollAreas::Insert(..) -|* -******************************************************************************/ - -void SwScrollAreas::InsertCol( const SwScrollColumn &rCol, - SwStripes *pStripes ) -{ - SwScrollArea *pTmp = new SwScrollArea( rCol, pStripes ); - USHORT nIdx; - if( Seek_Entry( pTmp, &nIdx ) ) - { - GetObject( nIdx )->SmartInsert( pStripes ); - delete pTmp; - } - else - Insert( pTmp ); -} - - -void SwScrollArea::SmartInsert( SwStripes* pStripes ) -{ - ASSERT( pStripes, "Insert empty scrollstripe?" ); - BOOL bNotInserted = TRUE; - if( IsVertical() ) - for( USHORT nIdx = 0; nIdx < Count() && bNotInserted; ) - { - SwStripes* pTmp = GetObject( nIdx++ ); - if( pTmp->GetY() - pTmp->GetHeight() == pStripes->GetY() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, pTmp->Count(), 0 ); - bNotInserted = FALSE; - } - else if( pTmp->GetY() == pStripes->GetY() - pStripes->GetHeight() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->Y() = pStripes->GetY(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, 0, 0 ); - bNotInserted = FALSE; - } - } - else - for( USHORT nIdx = 0; nIdx < Count() && bNotInserted; ) - { - SwStripes* pTmp = GetObject( nIdx++ ); - if( pTmp->GetY() + pTmp->GetHeight() == pStripes->GetY() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, pTmp->Count(), 0 ); - bNotInserted = FALSE; - } - else if( pTmp->GetY() == pStripes->GetY() + pStripes->GetHeight() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->Y() = pStripes->GetY(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, 0, 0 ); - bNotInserted = FALSE; - } - } - if( !bNotInserted || !Insert( pStripes ) ) - delete pStripes; -} diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index c6cebdb27ba2..04bc229627a9 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -29,7 +29,6 @@ #include "precompiled_sw.hxx" -#include "scrrect.hxx" #include "crsrsh.hxx" #include "rootfrm.hxx" #include "pagefrm.hxx" @@ -126,8 +125,6 @@ SwViewImp::SwViewImp( ViewShell *pParent ) : pSdrPageView( 0 ), pFirstVisPage( 0 ), pRegion( 0 ), - pScrollRects( 0 ), - pScrolledArea( 0 ), pLayAct( 0 ), pIdleAct( 0 ), pAccMap( 0 ), @@ -138,13 +135,9 @@ SwViewImp::SwViewImp( ViewShell *pParent ) : { //bResetXorVisibility = //HMHbShowHdlPaint = - bResetHdlHiddenPaint = bScrolled = - bPaintInScroll = bSmoothUpdate = bStopSmooth = bStopPrt = FALSE; - bFirstPageInvalid = bScroll = bNextScroll = TRUE; - - aScrollTimer.SetTimeout( 1500 ); - aScrollTimer.SetTimeoutHdl( LINK( this, SwViewImp, RefreshScrolledHdl)); - aScrollTimer.Stop(); + bResetHdlHiddenPaint = + bSmoothUpdate = bStopSmooth = bStopPrt = FALSE; + bFirstPageInvalid = TRUE; } /****************************************************************************** @@ -169,8 +162,7 @@ SwViewImp::~SwViewImp() delete pDrawView; - DelRegions(); - delete pScrolledArea; + DelRegion(); ASSERT( !pLayAct, "Have action for the rest of your life." ); ASSERT( !pIdleAct,"Be idle for the rest of your life." ); @@ -185,10 +177,9 @@ SwViewImp::~SwViewImp() |* ******************************************************************************/ -void SwViewImp::DelRegions() +void SwViewImp::DelRegion() { DELETEZ(pRegion); - DELETEZ(pScrollRects); } /****************************************************************************** diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 6beb6957c192..08aae426fd8c 100644..100755 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -216,28 +216,18 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) Imp()->StartAction(); if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() ) - Imp()->DelRegions(); + Imp()->DelRegion(); const BOOL bExtraData = ::IsExtraData( GetDoc() ); if ( !bIdleEnd ) { - if ( Imp()->IsNextScroll() && !bExtraData ) - Imp()->SetScroll(); - else - { - if ( bExtraData ) - Imp()->bScroll = FALSE; - Imp()->SetNextScroll(); - Imp()->ResetScroll(); - } SwLayAction aAction( GetLayout(), Imp() ); aAction.SetComplete( FALSE ); if ( nLockPaint ) aAction.SetPaint( FALSE ); aAction.SetInputType( INPUT_KEYBOARD ); aAction.Action(); - Imp()->SetScroll(); } if ( bIsShellForCheckViewLayout ) @@ -246,8 +236,9 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) //Wenn wir selbst keine Paints erzeugen, so warten wir auf das Paint //vom System. Dann ist das Clipping korrekt gesetzt; Beispiel: verschieben //eines DrawObjektes. - if ( Imp()->GetRegion() || Imp()->GetScrollRects() || - aInvalidRect.HasArea() || bExtraData ) + if ( Imp()->GetRegion() || + aInvalidRect.HasArea() || + bExtraData ) { if ( !nLockPaint ) { @@ -271,15 +262,10 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) // Mitte eine Selektion und mit einem anderen Cursor an linken // rechten Rand springen. Ohne ShowCrsr verschwindet die // Selektion - BOOL bShowCrsr = (pRegion || Imp()->GetScrollRects()) && - IsA( TYPE(SwCrsrShell) ); + BOOL bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) ); if( bShowCrsr ) ((SwCrsrShell*)this)->HideCrsrs(); - Scroll(); - if ( bPaintsFromSystem && Imp()->pScrolledArea ) - Imp()->FlushScrolledArea(); - if ( pRegion ) { SwRootFrm* pLayout = GetLayout(); @@ -408,14 +394,14 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) delete pVout; delete pRegion; - Imp()->DelRegions(); + Imp()->DelRegion(); } if( bShowCrsr ) ((SwCrsrShell*)this)->ShowCrsrs( TRUE ); } else { - Imp()->DelRegions(); + Imp()->DelRegion(); bPaintWorks = TRUE; } } @@ -435,13 +421,6 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) UISizeNotify(); ++nStartAction; -#ifdef DBG_UTIL - // test option 'No Scroll' suppresses the automatic repair of the scrolled area - if ( !GetViewOptions()->IsTest8() ) -#endif - if ( Imp()->IsScrolled() ) - Imp()->RestartScrollTimer(); - if( Imp()->IsAccessible() ) Imp()->FireAccessibleEvents(); } @@ -1196,12 +1175,10 @@ void ViewShell::VisPortChgd( const SwRect &rRect) //vom RootFrm::Paint erzeugt worden sein. if ( !bInEndAction && Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() ) - Imp()->DelRegions(); + Imp()->DelRegion(); SET_CURR_SHELL( this ); - //SwSaveHdl aSaveHdl( Imp() ); - bool bScrolled = false; SwPostItMgr* pPostItMgr = GetPostItMgr(); @@ -1331,9 +1308,7 @@ void ViewShell::VisPortChgd( const SwRect &rRect) Imp()->GetDrawView()->VisAreaChanged( GetWin() ); Imp()->GetDrawView()->SetActualWin( GetWin() ); } - Imp()->bPaintInScroll = TRUE; GetWin()->Update(); - Imp()->bPaintInScroll = FALSE; if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) pPostItMgr->CorrectPositions(); @@ -1833,9 +1808,8 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) //nicht ankommen. //Ergo: Alles selbst machen (siehe ImplEndAction()) if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea()) - Imp()->DelRegions(); + Imp()->DelRegion(); - Imp()->ResetScroll(); SwLayAction aAction( GetLayout(), Imp() ); aAction.SetComplete( FALSE ); // We increment the action counter to avoid a recursive call of actions @@ -1861,7 +1835,7 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) } if ( bStop ) { - Imp()->DelRegions(); + Imp()->DelRegion(); pRegion = 0; } } @@ -1906,7 +1880,7 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) } else bRet = FALSE; - Imp()->DelRegions(); + Imp()->DelRegion(); } else bRet = FALSE; @@ -1957,17 +1931,7 @@ void ViewShell::Paint(const Rectangle &rRect) { if( GetWin() && GetWin()->IsVisible() ) { - //Wenn mit dem Paint ein Bereich betroffen ist, der vorher gescrolled - //wurde, so wiederholen wir das Paint mit dem Gesamtbereich. Nur so - //koennen wir sicherstellen, das (nicht mal kurzfristig) durch das Paint - //keine Alignmentfehler sichtbar werden. SwRect aRect( rRect ); - if ( Imp()->IsScrolled() && Imp()->FlushScrolledArea( aRect ) ) - { - GetWin()->Invalidate( aRect.SVRect() ); - return; - } - if ( bPaintInProgress ) //Schutz gegen doppelte Paints! { GetWin()->Invalidate( rRect ); @@ -2279,7 +2243,8 @@ void ViewShell::ApplyViewOptions( const SwViewOption &rOpt ) void ViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) { - ASSERT( !(*pOpt == rOpt), "ViewShell::ApplyViewOptions: "); + if (*pOpt == rOpt) + return; Window *pMyWin = GetWin(); if( !pMyWin ) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index d7400ad2a73b..e74fb21f720a 100644..100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -31,35 +31,27 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/view/XRenderable.hpp> #include <hintids.hxx> -#include <vcl/oldprintadaptor.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/objsh.hxx> -#include <tools/resary.hxx> -#include <tools/debug.hxx> #include <rtl/ustring.hxx> -#include <toolkit/awt/vclxdevice.hxx> -#include <toolkit/awt/vclxdevice.hxx> - -#include <sfx2/progress.hxx> #include <sfx2/app.hxx> +#include <sfx2/objsh.hxx> #include <sfx2/prnmon.hxx> +#include <svl/languageoptions.hxx> #include <editeng/paperinf.hxx> #include <editeng/pbinitem.hxx> #include <svx/svdview.hxx> +#include <toolkit/awt/vclxdevice.hxx> +#include <tools/debug.hxx> #include <unotools/localedatawrapper.hxx> - #include <unotools/moduleoptions.hxx> -#include <svl/languageoptions.hxx> - -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/view/XRenderable.hpp> +#include <unotools/syslocale.hxx> +#include <vcl/oldprintadaptor.hxx> #include <unotxdoc.hxx> - #include <docsh.hxx> -#include <unotools/syslocale.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> #include <fmtfsize.hxx> @@ -83,9 +75,7 @@ #include <pagedesc.hxx> #include <poolfmt.hxx> // fuer RES_POOLPAGE_JAKET #include <mdiexp.hxx> // Ansteuern der Statusleiste -#ifndef _STATSTR_HRC #include <statstr.hrc> // -- " -- -#endif #include <ptqueue.hxx> #include <tabfrm.hxx> #include <txtfrm.hxx> // MinPrtLine @@ -93,13 +83,6 @@ #include <fmtpdsc.hxx> // SwFmtPageDesc #include <globals.hrc> -#define JOBSET_ERR_DEFAULT 0 -#define JOBSET_ERR_ERROR 1 -#define JOBSET_ERR_ISSTARTET 2 - - -extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); - using namespace ::com::sun::star; @@ -210,500 +193,6 @@ void SwPaintQueue::Remove( ViewShell *pSh ) } } -/*****************************************************************************/ - -const XubString& SwPrtOptions::MakeNextJobName() -{ - static char __READONLY_DATA sDelim[] = " - "; - USHORT nDelim = sJobName.SearchAscii( sDelim ); - if( STRING_NOTFOUND == nDelim ) - sJobName.AppendAscii(sDelim); - else - sJobName.Erase( nDelim + 3/*Zeichen!*/ ); - - return sJobName += XubString::CreateFromInt32( ++nJobNo ); -} - -/*****************************************************************************/ - -SwRenderData::SwRenderData() -{ - m_pPostItFields = 0; - m_pPostItDoc = 0; - m_pPostItShell = 0; - - m_pViewOptionAdjust = 0; - m_pPrtOptions = 0; -} - - -SwRenderData::~SwRenderData() -{ - delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0; - delete m_pPrtOptions; m_pPrtOptions = 0; - DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" ); - DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" ); - DBG_ASSERT( !m_pPostItFields, " should already have been deleted" ); -} - - -void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) -{ - DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" ); - m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, m_pPostItFields ); - m_pPostItDoc = new SwDoc; - - //!! Disable spell and grammar checking in the temporary document. - //!! Otherwise the grammar checker might process it and crash if we later on - //!! simply delete this document while he is still at it. - SwViewOption aViewOpt( *pViewOpt ); - aViewOpt.SetOnlineSpell( FALSE ); - - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); -} - - -void SwRenderData::DeletePostItData() -{ - if (HasPostItData()) - { - m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt - delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. - delete m_pPostItFields; - m_pPostItDoc = 0; - m_pPostItShell = 0; - m_pPostItFields = 0; - } -} - - -void SwRenderData::ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions ) -{ - if (m_pViewOptionAdjust) - { - DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" ); - } - m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions ); -} - - -void SwRenderData::ViewOptionAdjust( const SwPrtOptions *pPrtOptions ) -{ - m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions ); -} - - -void SwRenderData::ViewOptionAdjustStop() -{ - if (m_pViewOptionAdjust) - { - delete m_pViewOptionAdjust; - m_pViewOptionAdjust = 0; - } -} - - -void SwRenderData::MakeSwPrtOptions( - SwPrtOptions &rOptions, - const SwDocShell *pDocShell, - const SwPrintUIOptions *pOpt, - const SwRenderData *pData, - bool bIsPDFExport ) -{ - if (!pDocShell || !pOpt || !pData) - return; - - // get default print options - const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); - BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); - rOptions.MakeOptions( bWeb ); - - // get print options to use from provided properties - rOptions.bPrintGraphic = pOpt->IsPrintGraphics(); - rOptions.bPrintTable = pOpt->IsPrintTables(); - rOptions.bPrintDraw = pOpt->IsPrintDrawings(); - rOptions.bPrintControl = pOpt->IsPrintFormControls(); - rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages(); - rOptions.bPrintRightPages = pOpt->IsPrintRightPages(); - rOptions.bPrintPageBackground = pOpt->IsPrintPageBackground(); - rOptions.bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport ); - // bUpdateFieldsInPrinting <-- not set here; mail merge only - rOptions.bPaperFromSetup = pOpt->IsPaperFromSetup(); - rOptions.bPrintReverse = pOpt->IsPrintReverse(); - rOptions.bPrintProspect = pOpt->IsPrintProspect(); - rOptions.bPrintProspectRTL = pOpt->IsPrintProspectRTL(); - // bPrintSingleJobs <-- not set here; mail merge and or configuration - // bModified <-- not set here; mail merge only - rOptions.bPrintBlackFont = pOpt->IsPrintWithBlackTextColor(); - rOptions.bPrintHiddenText = pOpt->IsPrintHiddenText(); - rOptions.bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders(); - rOptions.nPrintPostIts = pOpt->GetPrintPostItsType(); - - //! needs to be set after MakeOptions since the assignment operation in that - //! function will destroy the pointers - rOptions.SetPrintUIOptions( pOpt ); - rOptions.SetRenderData( pData ); - - // rOptions.aMulti is not used anymore in the XRenderable API - // Thus we set it to a dummy value here. - rOptions.aMulti = MultiSelection( Range( 1, 1 ) ); - - //! Note: Since for PDF export of (multi-)selection a temporary - //! document is created that contains only the selects parts, - //! and thus that document is to printed in whole the, - //! rOptions.bPrintSelection parameter will be false. - if (bIsPDFExport) - rOptions.bPrintSelection = FALSE; -} - - -/*****************************************************************************/ - -SwPrintUIOptions::SwPrintUIOptions( - bool bWeb, - bool bSwSrcView, - bool bHasSelection, - bool bHasPostIts, - const SwPrintData &rDefaultPrintData ) : - m_pLast( NULL ), - m_rDefaultPrintData( rDefaultPrintData ) -{ - ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - - DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" ); - if( aLocalizedStrings.Count() < 44 ) // bad resource ? - return; - - // printing HTML sources does not have any valid UI options. - // Its just the source code that gets printed ... - if (bSwSrcView) - { - m_aUIProperties.realloc( 0 ); - return; - } - - // check if CTL is enabled - SvtLanguageOptions aLangOpt; - bool bCTL = aLangOpt.IsCTLFontEnabled(); - - // create sequence of print UI options - // (5 options are not available for Writer-Web) - const int nCTLOpts = bCTL ? 1 : 0; - const int nNumProps = nCTLOpts + (bWeb ? 14 : 20); - m_aUIProperties.realloc( nNumProps ); - int nIdx = 0; - - // create "writer" section (new tab page in dialog) - SvtModuleOptions aModOpt; - String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); - aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), - aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); - - // create sub section for Contents - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); - - // create a bool option for background - bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), - aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), - bDefaultVal ); - - // create a bool option for pictures/graphics AND OLE and drawing objects as well - bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), - aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), - bDefaultVal ); - if (!bWeb) - { - // create a bool option for hidden text - bDefaultVal = rDefaultPrintData.IsPrintHiddenText(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), - aLocalizedStrings.GetString( 7 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - bDefaultVal ); - - // create a bool option for place holder - bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), - aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), - bDefaultVal ); - } - - // create a bool option for controls - bDefaultVal = rDefaultPrintData.IsPrintControl(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), - aLocalizedStrings.GetString( 11 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), - bDefaultVal ); - - // create sub section for Color - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() ); - - // create a bool option for printing text with black font color - bDefaultVal = rDefaultPrintData.IsPrintBlackFont(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), - aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), - bDefaultVal ); - - if (!bWeb) - { - // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); - - // create a bool option for printing automatically inserted blank pages - bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), - aLocalizedStrings.GetString( 17 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - bDefaultVal ); - } - - // create a bool option for paper tray - bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); - vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; - aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), - aLocalizedStrings.GetString( 19 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), - bDefaultVal, - aPaperTrayOpt - ); - - // print range selection - vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; - aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); - aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), - rtl::OUString(), - aPrintRangeOpt - ); - - // create a choice for the content to create - rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); - uno::Sequence< rtl::OUString > aChoices( bHasSelection ? 3 : 2 ); - uno::Sequence< rtl::OUString > aHelpText( bHasSelection ? 3 : 2 ); - aChoices[0] = aLocalizedStrings.GetString( 38 ); - aHelpText[0] = aLocalizedStrings.GetString( 39 ); - aChoices[1] = aLocalizedStrings.GetString( 40 ); - aHelpText[1] = aLocalizedStrings.GetString( 41 ); - if (bHasSelection) - { - aChoices[2] = aLocalizedStrings.GetString( 42 ); - aHelpText[2] = aLocalizedStrings.GetString( 43 ); - } - m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), - aHelpText, - aPrintRangeName, - aChoices, - bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */); - // create a an Edit dependent on "Pages" selected - vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); - m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), - rtl::OUString(), - aPageRangeOpt - ); - // print content selection - vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; - aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ), - rtl::OUString(), - aContentsOpt - ); - // create a list box for notes content - const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); - aChoices.realloc( 4 ); - aChoices[0] = aLocalizedStrings.GetString( 21 ); - aChoices[1] = aLocalizedStrings.GetString( 22 ); - aChoices[2] = aLocalizedStrings.GetString( 23 ); - aChoices[3] = aLocalizedStrings.GetString( 24 ); - aHelpText.realloc( 2 ); - aHelpText[0] = aLocalizedStrings.GetString( 25 ); - aHelpText[1] = aLocalizedStrings.GetString( 25 ); - vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); - aAnnotOpt.mbEnabled = bHasPostIts; - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), - aHelpText, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), - aChoices, - nPrintPostIts, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - aAnnotOpt - ); - - // create subsection for Page settings - vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; - aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); - - if (!bWeb) - { - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ), - rtl::OUString(), - aPageSetOpt - ); - uno::Sequence< rtl::OUString > aRLChoices( 3 ); - aRLChoices[0] = aLocalizedStrings.GetString( 28 ); - aRLChoices[1] = aLocalizedStrings.GetString( 29 ); - aRLChoices[2] = aLocalizedStrings.GetString( 30 ); - uno::Sequence< rtl::OUString > aRLHelp( 1 ); - aRLHelp[0] = aLocalizedStrings.GetString( 31 ); - // create a choice option for all/left/right pages - // 0 : all pages (left & right) - // 1 : left pages - // 2 : right pages - DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(), - "unexpected value combination" ); - sal_Int16 nPagesChoice = 0; - if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage()) - nPagesChoice = 1; - else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage()) - nPagesChoice = 2; - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ), - aRLHelp, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), - aRLChoices, - nPagesChoice, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) - ); - } - - // create a bool option for brochure - bDefaultVal = rDefaultPrintData.IsPrintProspect(); - rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), - aLocalizedStrings.GetString( 34 ), - aBrochurePropertyName, - bDefaultVal, - aPageSetOpt - ); - - if (bCTL) - { - // create a bool option for brochure RTL dependent on brochure - uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); - aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); - aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); - vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); - aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); - // RTL brochure choices - // 0 : left-to-right - // 1 : right-to-left - const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0; - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), - uno::Sequence< rtl::OUString >(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), - aBRTLChoices, - nBRTLChoice, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - aBrochureRTLOpt - ); - } - - - DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); -} - - -SwPrintUIOptions::~SwPrintUIOptions() -{ -} - -bool SwPrintUIOptions::IsPrintLeftPages() const -{ - // take care of different property names for the option. - // for compatibility the old name should win (may still be used for PDF export or via Uno API) - - // 0: left and right pages - // 1: left pages only - // 2: right pages only - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); - bool bRes = nLRPages == 0 || nLRPages == 1; - bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintRightPages() const -{ - // take care of different property names for the option. - // for compatibility the old name should win (may still be used for PDF export or via Uno API) - - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); - bool bRes = nLRPages == 0 || nLRPages == 2; - bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const -{ - // take care of different property names for the option. - - bool bRes = bIsPDFExport ? - !getBoolValue( "IsSkipEmptyPages", sal_True ) : - getBoolValue( "PrintEmptyPages", sal_True ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintTables() const -{ - // take care of different property names currently in use for this option. - // for compatibility the old name should win (may still be used for PDF export or via Uno API) - -// bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); -// bRes = getBoolValue( "PrintTables", bRes ); -// return bRes; - // for now it was decided that tables should always be printed - return true; -} - -bool SwPrintUIOptions::IsPrintGraphics() const -{ - // take care of different property names for the option. - // for compatibility the old name should win (may still be used for PDF export or via Uno API) - - bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); - bRes = getBoolValue( "PrintGraphics", bRes ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintDrawings() const -{ - // take care of different property names for the option. - // for compatibility the old name should win (may still be used for PDF export or via Uno API) - - bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); - bRes = getBoolValue( "PrintDrawings", bRes ); - return bRes; -} - -bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) -{ - bool bChanged = processProperties( i_rNewProp ); - - uno::Reference< awt::XDevice > xRenderDevice; - uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); - aVal >>= xRenderDevice; - - OutputDevice* pOut = 0; - if (xRenderDevice.is()) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - pOut = pDevice ? pDevice->GetOutputDevice() : 0; - } - bChanged = bChanged || (pOut != m_pLast); - if( pOut ) - m_pLast = pOut; - - return bChanged; -} - - /****************************************************************************** * Methode : void SetSwVisArea( ViewShell *pSh, Point aPrtOffset, ... * Beschreibung: @@ -847,33 +336,6 @@ void ViewShell::ChgAllPageSize( Size &rSz ) } -void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, - const XubString *pStr, ULONG nAct, ULONG nCnt, ULONG nOffs, ULONG nPageNo ) -{ - XubString aTmp = XubString::CreateFromInt64( nPageNo ); - if( pStr ) - { - aTmp += ' '; - aTmp += *pStr; - if( nCnt ) - { - nMax *= 2; - rProgress.SetStateText( (nAct-1)*nMax+nPage+nOffs, - aTmp, nCnt*nMax ); - } - else - rProgress.SetStateText( nPage, aTmp, nMax ); - } - else - { - aTmp += ' '; aTmp += '('; aTmp += XubString::CreateFromInt64( nPage ); - aTmp += '/'; aTmp += XubString::CreateFromInt64( nMax ); aTmp += ')'; - rProgress.SetStateText( nPage, aTmp, nMax ); - } -} - - - void ViewShell::CalcPagesForPrint( USHORT nMax ) { SET_CURR_SHELL( this ); @@ -1394,3 +856,4 @@ void ViewShell::PrepareForPrint( const SwPrintData &rOptions ) } } } + diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 02a867f6d907..4fd450cbffd5 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -727,7 +727,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha bRemoveHidden = ( pHiddenItem == NULL || !pHiddenItem->GetValue() ); } - pTempViewFrame = SfxViewFrame::CreateViewFrame( *pDocSh, 0, sal_True ); + pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, 0 ); CallStartAction(); pDoc->GetEditShell( &pVSh ); } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 40cdd11c608a..afcb979abe6c 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -806,7 +806,6 @@ IMAGE_SETEVENT: // gleich (synchron) angepasst wird (war bug #40983#) if( bRequestGrfNow ) { - pGrfNd->SetTransferPriority( SFX_TFPRIO_VISIBLE_LOWRES_GRAPHIC ); pGrfNd->SwapIn(); } diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx index 5d9a0deda7d1..34fe44eae053 100644 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ b/sw/source/filter/rtf/wrtrtf.cxx @@ -85,6 +85,7 @@ const sal_Char SwRTFWriter::sNewLine = '\012'; const sal_Char __FAR_DATA SwRTFWriter::sNewLine[] = "\015\012"; #endif +static ::rtl::OUString aEmpty; SV_DECL_VARARR( RTFColorTbl, Color, 5, 8 ) @@ -1299,8 +1300,16 @@ void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos) Strm() << '}'; } OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKEND ) << ' '; - RTFOutFuncs::Out_String( Strm(), pAsBookmark->GetName(), + + { + ::rtl::OUString & rBookmarkName = aEmpty; + + if (pAsBookmark) + rBookmarkName = pAsBookmark->GetName(); + + RTFOutFuncs::Out_String( Strm(), rBookmarkName, eDefaultEncoding, bWriteHelpFmt ) << '}'; + } if(++nBkmkTabPos >= pMarkAccess->getMarksCount()) nBkmkTabPos = -1; diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx index 37638044a44c..46aa1d0d71a8 100644 --- a/sw/source/filter/ww8/escher.hxx +++ b/sw/source/filter/ww8/escher.hxx @@ -88,6 +88,20 @@ private: }; +class SwEscherExGlobal : public EscherExGlobal +{ +public: + explicit SwEscherExGlobal(); + virtual ~SwEscherExGlobal(); + +private: + /** Overloaded to create a new memory stream for picture data. */ + virtual SvStream* ImplQueryPictureStream(); + +private: + ::std::auto_ptr< SvStream > mxPicStrm; +}; + class SwBasicEscherEx : public EscherEx { private: @@ -95,7 +109,6 @@ private: protected: WW8Export& rWrt; SvStream* pEscherStrm; - SvStream* pPictStrm; long mnEmuMul, mnEmuDiv; virtual INT32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType, @@ -112,13 +125,11 @@ protected: INT32 ToFract16(INT32 nVal, UINT32 nMax) const; - SvStream* QueryPicStream(); - virtual void SetPicId(const SdrObject &, UINT32, EscherPropertyContainer &); SdrLayerID GetInvisibleHellId() const; public: - SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt, UINT32 nDrawings = 1); + SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt); INT32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId); INT32 WriteOLEFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId); void WriteEmptyFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId); @@ -166,7 +177,7 @@ public: virtual void WriteFrmExtraData(const SwFrmFmt& rFmt); EscherExHostAppData* StartShape(const com::sun::star::uno::Reference< - com::sun::star::drawing::XShape > &) {return &aHostData;} + com::sun::star::drawing::XShape > &, const Rectangle*) {return &aHostData;} private: //No copying SwEscherEx(const SwEscherEx&); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d85a54885e43..6686ae5b13d7 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1308,16 +1308,14 @@ void WW8Export::WriteEscher() void SwEscherEx::WritePictures() { - if (pPictStrm) + if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() ) { // set the blip - entries to the correct stream pos INT32 nEndPos = rWrt.Strm().Tell(); - SetNewBlipStreamOffset( nEndPos ); + mxGlobal->SetNewBlipStreamOffset( nEndPos ); - pPictStrm->Seek( 0 ); - rWrt.Strm() << *pPictStrm; - - delete pPictStrm, pPictStrm = 0; + pPicStrm->Seek( 0 ); + rWrt.Strm() << *pPicStrm; } Flush(); } @@ -1326,10 +1324,24 @@ void SwEscherEx::WritePictures() // Output- Routines for Escher Export -SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt, - UINT32 nDrawings) - : EscherEx(*pStrm, nDrawings), rWrt(rWW8Wrt), pEscherStrm(pStrm), - pPictStrm(0) +SwEscherExGlobal::SwEscherExGlobal() +{ +} + +SwEscherExGlobal::~SwEscherExGlobal() +{ +} + +SvStream* SwEscherExGlobal::ImplQueryPictureStream() +{ + // this function will be called exactly once + mxPicStrm.reset( new SvMemoryStream ); + mxPicStrm->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + return mxPicStrm.get(); +} + +SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) + : EscherEx( EscherExGlobalRef( new SwEscherExGlobal ), *pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm) { Init(); } @@ -1442,8 +1454,8 @@ INT32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId) Point aEmptyPoint = Point(); Rectangle aRect( aEmptyPoint, aSize ); - sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId, - aRect, NULL, 0 ); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aUniqueId, aRect, NULL, 0 ); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True); } @@ -1651,8 +1663,8 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush, Point aEmptyPoint = Point(); Rectangle aRect(aEmptyPoint, aSize); - sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aUniqueId, - aRect, NULL, 0); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aUniqueId, aRect, NULL, 0); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,sal_True); } @@ -1894,16 +1906,6 @@ INT32 SwBasicEscherEx::ToFract16(INT32 nVal, UINT32 nMax) const return 0; } -SvStream* SwBasicEscherEx::QueryPicStream() -{ - if (!pPictStrm) - { - pPictStrm = new SvMemoryStream; - pPictStrm->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); - } - return pPictStrm; -} - SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const { return rWrt.pDoc->GetInvisibleHellId(); @@ -1911,22 +1913,19 @@ SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const void SwBasicEscherEx::WritePictures() { - ASSERT(pPictStrm, "no picture!"); - if (pPictStrm) + if( SvStream* pPicStrm = static_cast< SwEscherExGlobal& >( *mxGlobal ).GetPictureStream() ) { // set the blip - entries to the correct stream pos - INT32 nEndPos = pPictStrm->Tell(); - WriteBlibStoreEntry(*pEscherStrm, 1, sal_True, nEndPos); - - pPictStrm->Seek(0); - *pEscherStrm << *pPictStrm; + INT32 nEndPos = pPicStrm->Tell(); + mxGlobal->WriteBlibStoreEntry(*pEscherStrm, 1, sal_True, nEndPos); - delete pPictStrm, pPictStrm = 0; + pPicStrm->Seek(0); + *pEscherStrm << *pPicStrm; } } SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) - : SwBasicEscherEx(pStrm, rWW8Wrt, rWW8Wrt.pHFSdrObjs->size() ? 2 : 1), + : SwBasicEscherEx(pStrm, rWW8Wrt), pTxtBxs(0) { aHostData.SetClientData(&aWinwordAnchoring); @@ -1964,7 +1963,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) EnterGroup( 0 ); - ULONG nSecondShapeId = pSdrObjs == rWrt.pSdrObjs ? GetShapeID() : 0; + ULONG nSecondShapeId = pSdrObjs == rWrt.pSdrObjs ? GenerateShapeId() : 0; // write now all Writer-/DrawObjects DrawObjPointerVector aSorted; @@ -1990,7 +1989,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) nBorderThick = WriteFlyFrm(*pObj, nShapeId, aSorted); break; case sw::Frame::eFormControl: - WriteOCXControl(rFmt, nShapeId=GetShapeID()); + WriteOCXControl(rFmt, nShapeId = GenerateShapeId()); break; case sw::Frame::eDrawing: aWinwordAnchoring.SetAnchoring(rFmt); @@ -2560,10 +2559,10 @@ INT32 SwEscherEx::WriteFlyFrm(const DrawObj &rObj, UINT32 &rShapeId, switch( aIdx.GetNode().GetNodeType() ) { case ND_GRFNODE: - nBorderThick = WriteGrfFlyFrame( rFmt, rShapeId = GetShapeID() ); + nBorderThick = WriteGrfFlyFrame( rFmt, rShapeId = GenerateShapeId() ); break; case ND_OLENODE: - nBorderThick = WriteOLEFlyFrame( rFmt, rShapeId = GetShapeID() ); + nBorderThick = WriteOLEFlyFrame( rFmt, rShapeId = GenerateShapeId() ); break; default: if (const SdrObject* pObj = rFmt.FindRealSdrObject()) @@ -2702,7 +2701,8 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer &rPropOpt, aRect.SetPos(Point(0,0)); aRect.Right() = DrawModelToEmu(aRect.Right()); aRect.Bottom() = DrawModelToEmu(aRect.Bottom()); - sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aId, aRect, pVisArea, 0); // SJ: the fourth parameter (VisArea) should be set.. + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), + aId, aRect, pVisArea, 0); // SJ: the fourth parameter (VisArea) should be set.. if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True); } @@ -2774,7 +2774,7 @@ void SwEscherEx::MakeZOrderArrAndFollowIds( bNeedsShapeId = true; } - ULONG nShapeId = bNeedsShapeId ? GetShapeID() : 0; + ULONG nShapeId = bNeedsShapeId ? GenerateShapeId() : 0; aFollowShpIds.Insert(nShapeId, n); } @@ -2789,12 +2789,12 @@ UINT32 SwEscherEx::GetFlyShapeId(const SwFrmFmt& rFmt, { if (0 == (nShapeId = aFollowShpIds[nPos])) { - nShapeId = GetShapeID(); + nShapeId = GenerateShapeId(); aFollowShpIds[ nPos ] = nShapeId; } } else - nShapeId = GetShapeID(); + nShapeId = GenerateShapeId(); return nShapeId; } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index a50bdb775837..23fa8ecb2c34 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -103,12 +103,53 @@ #include <ndgrf.hxx> #include <ndole.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; using namespace sw::util; using namespace sw::types; +using namespace sw::mark; using namespace nsFieldFlags; + +static String lcl_getFieldCode( const IFieldmark* pFieldmark ) { + ASSERT(pFieldmark!=NULL, "where is my fieldmark???"); + if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) ) { + return String::CreateFromAscii(" FORMTEXT "); + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) ) { + return String::CreateFromAscii(" FORMDROPDOWN "); + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) { + return String::CreateFromAscii(" FORMCHECKBOX "); + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_TOC ) ) { + return String::CreateFromAscii(" TOC "); + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_HYPERLINK ) ) { + return String::CreateFromAscii(" HYPERLINK "); + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_PAGEREF ) ) { + return String::CreateFromAscii(" PAGEREF "); + } else { + return pFieldmark->GetFieldname(); + } +} + +ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) { + ASSERT(pFieldmark!=NULL, "where is my fieldmark???"); + if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) ) { + return ww::eFORMTEXT; + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) ) { + return ww::eFORMDROPDOWN; + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) { + return ww::eFORMCHECKBOX; + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_TOC ) ) { + return ww::eTOC; + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_HYPERLINK ) ) { + return ww::eHYPERLINK; + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_PAGEREF ) ) { + return ww::ePAGEREF; + } else { + return ww::eUNKNOWN; + } +} + /* */ MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport ) @@ -259,22 +300,40 @@ SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : nAktSwPos = SearchNext(1); } +xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 ) +{ + xub_StrLen min = STRING_NOTFOUND; + if ( pos1 == STRING_NOTFOUND && pos2 != STRING_NOTFOUND ) + min = pos2; + else if ( pos2 == STRING_NOTFOUND && pos1 != STRING_NOTFOUND ) + min = pos1; + else if ( pos2 != STRING_NOTFOUND && pos2 != STRING_NOTFOUND ) + { + if ( pos1 < pos2 ) + min = pos1; + else + min = pos2; + } + + return min; +} + xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) { xub_StrLen nPos; xub_StrLen nMinPos = STRING_MAXLEN; + xub_StrLen i=0; + const String aTxt = rNd.GetTxt(); - xub_StrLen pos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos); - if( pos==STRING_NOTFOUND ) - { - pos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos); - if( pos==STRING_NOTFOUND ) - pos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos); - } - if( pos!=STRING_NOTFOUND ) - nMinPos=pos; + xub_StrLen fieldEndPos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos); + xub_StrLen fieldStartPos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos); + xub_StrLen formElementPos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos); - xub_StrLen i=0; + xub_StrLen pos = lcl_getMinPos( fieldEndPos, fieldStartPos ); + pos = lcl_getMinPos( pos, formElementPos ); + + if (pos!=STRING_NOTFOUND) + nMinPos=pos; // first the redline, then the attributes if( pCurRedline ) @@ -1692,12 +1751,14 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); - if ( pFieldmark ) - AppendBookmark( pFieldmark->GetName(), true ); - OutputField( NULL, ww::eFORMTEXT, String::CreateFromAscii( " FORMTEXT " ), WRITEFIELD_START | WRITEFIELD_CMD_START ); - if ( pFieldmark ) + if ( pFieldmark->GetFieldname().equalsAscii( ODF_FORMTEXT ) ) + AppendBookmark( pFieldmark->GetName(), false ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), lcl_getFieldCode( pFieldmark ), WRITEFIELD_START | WRITEFIELD_CMD_START ); + if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) ) WriteFormData( *pFieldmark ); - OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CMD_END ); + else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_HYPERLINK ) ) + WriteHyperlinkData( *pFieldmark ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END ); } else if ( ch == CH_TXT_ATR_FIELDEND ) { @@ -1705,8 +1766,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); - OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CLOSE ); - if ( pFieldmark ) + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE ); + if ( pFieldmark->GetFieldname().equalsAscii( ODF_FORMTEXT ) ) AppendBookmark( pFieldmark->GetName(), false ); } else if ( ch == CH_TXT_ATR_FORMELEMENT ) @@ -1715,13 +1776,18 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); - if ( pFieldmark ) - AppendBookmark( pFieldmark->GetName(), true ); - OutputField( NULL, ww::eFORMCHECKBOX, String::CreateFromAscii( " FORMCHECKBOX " ), WRITEFIELD_START | WRITEFIELD_CMD_START ); - if ( pFieldmark ) + bool isDropdownOrCheckbox = pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) || + pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ); + + if ( isDropdownOrCheckbox ) + AppendBookmark( pFieldmark->GetName(), 0 ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), + lcl_getFieldCode( pFieldmark ), + WRITEFIELD_START | WRITEFIELD_CMD_START ); + if ( isDropdownOrCheckbox ) WriteFormData( *pFieldmark ); - OutputField( NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE ); - if ( pFieldmark ) + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE ); + if ( isDropdownOrCheckbox ) AppendBookmark( pFieldmark->GetName(), false ); } nLen -= static_cast< USHORT >( ofs ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index ddb0a55cd5fa..6bf7ecbb8cdf 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -94,7 +94,7 @@ #include <fmtline.hxx> #include <fmtfsize.hxx> #include <comphelper/extract.hxx> - +#include <comphelper/stlunosequence.hxx> #include <writerfilter/doctok/sprmids.hxx> #include "writerhelper.hxx" @@ -102,6 +102,7 @@ #include "ww8attributeoutput.hxx" #include <IDocumentMarkAccess.hxx> +#include <xmloff/odffields.hxx> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> @@ -2379,33 +2380,33 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), m_rWW8Export.pO->Count() ); - for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) - { - const SwTableBox * pBox1 = rTabBoxes[n]; - const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); - const SfxPoolItem * pI = NULL; - Color aColor; + for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) + { + const SwTableBox * pBox1 = rTabBoxes[n]; + const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); + const SfxPoolItem * pI = NULL; + Color aColor; if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet(). GetItemState( RES_BACKGROUND, false, &pI ) ) - { - aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); - } - else - aColor = COL_AUTO; + { + aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); + } + else + aColor = COL_AUTO; - WW8SHDLong aSHD; - aSHD.setCvFore( 0xFF000000 ); + WW8SHDLong aSHD; + aSHD.setCvFore( 0xFF000000 ); - sal_uInt32 nBgColor = aColor.GetColor(); - if ( nBgColor == COL_AUTO ) - aSHD.setCvBack( 0xFF000000 ); - else - aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); + sal_uInt32 nBgColor = aColor.GetColor(); + if ( nBgColor == COL_AUTO ) + aSHD.setCvBack( 0xFF000000 ); + else + aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); - aSHD.Write( m_rWW8Export ); - } + aSHD.Write( m_rWW8Export ); + } } } } @@ -2709,18 +2710,19 @@ void WW8Export::WriteFkpPlcUsw() if ( pSttbfAssoc ) // <-- { - ::std::vector<String> aStrings; - ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); - ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); - for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); - aIt != aItEnd; aIt++) - { - String aStr(aIt->getStr()); - aStrings.push_back(aStr); - } + ::std::vector<String> aStrings; - WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, - pFib->lcbSttbfAssoc); + ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); + ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); + for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); + aIt != aItEnd; aIt++) + { + String aStr(aIt->getStr()); + aStrings.push_back(aStr); + } + + WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, + pFib->lcbSttbfAssoc); } } Strm().Seek( 0 ); @@ -2728,18 +2730,17 @@ void WW8Export::WriteFkpPlcUsw() // Reclaim stored FIB data from document. ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> (pDoc->getExternalData(::sw::FIB).get()); - // --> OD 2009-10-19 #i106057# + if ( pFibData ) // <-- { - pFib->fReadOnlyRecommended = - pFibData->getReadOnlyRecommended() ? 1 : 0; - pFib->fWriteReservation = - pFibData->getWriteReservation() ? 1 : 0; + pFib->fReadOnlyRecommended = + pFibData->getReadOnlyRecommended() ? 1 : 0; + pFib->fWriteReservation = + pFibData->getWriteReservation() ? 1 : 0; } pFib->Write( Strm() ); // FIB - } void WW8Export::StoreDoc1() @@ -3527,11 +3528,23 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark; const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark ); + + ASSERT(rFieldmark.GetFieldname().equalsAscii( ODF_FORMTEXT ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMCHECKBOX ), "Unknown field type!!!"); + if ( ! ( rFieldmark.GetFieldname().equalsAscii( ODF_FORMTEXT ) || + rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) || + rFieldmark.GetFieldname().equalsAscii( ODF_FORMCHECKBOX ) ) ) + return; + int type = 0; // TextFieldmark if ( pAsCheckbox ) type = 1; + if ( rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) ) + type=2; - const ::rtl::OUString ffname = rFieldmark.GetFieldname(); + ::sw::mark::IFieldmark::parameter_map_t::const_iterator pNameParameter = rFieldmark.GetParameters()->find(::rtl::OUString::createFromAscii("name")); + ::rtl::OUString ffname; + if(pNameParameter != rFieldmark.GetParameters()->end()) + pNameParameter->second >>= ffname; ULONG nDataStt = pDataStrm->Tell(); pChpPlc->AppendFkpEntry(Strm().Tell()); @@ -3553,15 +3566,37 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) sal_uInt8 aFldHeader[] = { 0xFF, 0xFF, 0xFF, 0xFF, // Unicode Marker... - 0, 0, 0, 0//, 0, 0, 0, 0 + 0, 0, 0, 0,// 0, 0, 0, 0 }; aFldHeader[4] |= (type & 0x03); - int ffres = 0; // rFieldmark.GetFFRes(); + sal_Int32 ffres = 0; // rFieldmark.GetFFRes(); if ( pAsCheckbox && pAsCheckbox->IsChecked() ) ffres = 1; + else if ( type == 2 ) + { + ::sw::mark::IFieldmark::parameter_map_t::const_iterator pResParameter = rFieldmark.GetParameters()->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN)); + if(pResParameter != rFieldmark.GetParameters()->end()) + pResParameter->second >>= ffres; + else + ffres = 0; + } aFldHeader[4] |= ( (ffres<<2) & 0x7C ); + std::vector< ::rtl::OUString > aListItems; + if (type==2) + { + aFldHeader[5] |= 0x80; // ffhaslistbox + const ::sw::mark::IFieldmark::parameter_map_t* const pParameters = rFieldmark.GetParameters(); + ::sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY)); + if(pListEntries != pParameters->end()) + { + uno::Sequence< ::rtl::OUString > vListEntries; + pListEntries->second >>= vListEntries; + copy(::comphelper::stl_begin(vListEntries), ::comphelper::stl_end(vListEntries), back_inserter(aListItems)); + } + } + const ::rtl::OUString ffdeftext; const ::rtl::OUString ffformat; const ::rtl::OUString ffhelptext; @@ -3569,6 +3604,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) const ::rtl::OUString ffentrymcr; const ::rtl::OUString ffexitmcr; + const sal_uInt8 aFldData[] = { 0x44,0, // the start of "next" data @@ -3578,7 +3614,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16 0,0,0,0, // / /4 }; - sal_uInt32 slen=sizeof(sal_uInt32) + sal_uInt32 slen = sizeof(sal_uInt32) + sizeof(aFldData) + sizeof( aFldHeader ) + 2*ffname.getLength() + 4 @@ -3588,6 +3624,15 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) + 2*ffstattext.getLength() + 4 + 2*ffentrymcr.getLength() + 4 + 2*ffexitmcr.getLength() + 4; + if ( type==2 ) { + slen += 2; // for 0xFF, 0xFF + slen += 4; // for num of list items + const int items = aListItems.size(); + for( int i = 0; i < items; i++ ) { + rtl::OUString item = aListItems[i]; + slen += 2 * item.getLength() + 2; + } + } *pDataStrm << slen; @@ -3597,6 +3642,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) len = sizeof( aFldHeader ); OSL_ENSURE( len == 8, "SwWW8Writer::WriteFormData(..) - wrong aFldHeader length" ); + pDataStrm->Write( aFldHeader, len ); SwWW8Writer::WriteString_xstz( *pDataStrm, ffname, true ); // Form field name @@ -3611,11 +3657,20 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffstattext ), true ); SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffentrymcr ), true ); SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffexitmcr ), true ); -// if (type==2) { -// // 0xFF, 0xFF -// // sal_uInt32 number of strings -// // (sal_uInt16 len; sal_uInt16 unicode char[len])*num of strings -// } + if (type==2) { + *pDataStrm<<(sal_uInt16)0xFFFF; + const int items=aListItems.size(); + *pDataStrm<<(sal_uInt32)items; + for(int i=0;i<items;i++) { + rtl::OUString item=aListItems[i]; + SwWW8Writer::WriteString_xstz( *pDataStrm, item, false ); + } + } +} + +void WW8Export::WriteHyperlinkData( const sw::mark::IFieldmark& /*rFieldmark*/ ) +{ + //@TODO implement me !!! } void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index ca96f617c5fd..21295ba11ca4 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -706,6 +706,7 @@ public: /// Write the data of the form field virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) = 0; + virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark ) = 0; virtual void DoComboBox(const rtl::OUString &rName, const rtl::OUString &rHelp, @@ -1073,6 +1074,7 @@ public: /// Write the data of the form field virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ); + virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark ); /// Fields. WW8_WrPlcFld* CurrentFieldPlc() const; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0285b3451b6f..a290e8f30790 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1508,7 +1508,6 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : maOldApos.push_back(false); maOldApos.swap(pRdr->maApos); maOldFieldStack.swap(pRdr->maFieldStack); - maFieldCtxStack.swap(pRdr->maNewFieldCtxStack); } void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) @@ -1555,7 +1554,6 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) pRdr->pPlcxMan->RestoreAllPLCFx(maPLCFxSave); pRdr->maApos.swap(maOldApos); pRdr->maFieldStack.swap(maOldFieldStack); - pRdr->maNewFieldCtxStack.swap(maFieldCtxStack); } void SwWW8ImplReader::Read_HdFtFtnText( const SwNodeIndex* pSttIdx, @@ -2673,29 +2671,6 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) case 0x15: if( !bSpec ) // Juristenparagraph cInsert = '\xa7'; - else - { - // 0x15 is special --> so it's our field end mark...; - // hmmm what about field marks not handled by us??, maybe a problem with nested fields; - // probably an area of bugs... [well release quick and release often....] - if (!maNewFieldCtxStack.empty() && pPaM!=NULL && pPaM->GetPoint()!=NULL) - { - ::boost::scoped_ptr<WW8NewFieldCtx> pFieldCtx(maNewFieldCtxStack.back()); - maNewFieldCtxStack.pop_back(); - SwPosition aEndPos = *pPaM->GetPoint(); - SwPaM aFldPam(pFieldCtx->GetPtNode(), pFieldCtx->GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); - IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); - ::sw::mark::IFieldmark* pFieldmark = - dynamic_cast< ::sw::mark::IFieldmark*>(pMarkAccess->makeMark( - aFldPam, - pFieldCtx->GetBookmarkName(), - IDocumentMarkAccess::TEXT_FIELDMARK)); - OSL_ENSURE(pFieldmark!=NULL, - "hmmm; why was the bookmark not created?"); - if (pFieldmark) - pFieldCtx->SetCurrentFieldParamsTo(pFieldmark); - } - } break; case 0x9: cInsert = '\x9'; // Tab @@ -3507,7 +3482,14 @@ void wwSectionManager::InsertSegments() bool bInsertSection = (aIter != aStart) ? (aIter->IsContinous() && bThisAndPreviousAreCompatible): false; bool bInsertPageDesc = !bInsertSection; - bool bProtected = !bUseEnhFields && SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disales this... + bool bProtected = SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disales this... + if (bUseEnhFields && mrReader.pWDop->fProtEnabled && aIter->IsNotProtected()) { + // here we have the special case that the whole document is protected, with the execption of this section. + // I want to address this when I do the section rework, so for the moment we disable the overall protection then... + mrReader.rDoc.set(IDocumentSettingAccess::PROTECT_FORM, false ); + } + + if (bInsertPageDesc) { /* diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 6d731ea1204e..099ecca83d6a 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -57,6 +57,8 @@ #include "ww8glsy.hxx" #include "wrtww8.hxx" #include "../inc/msfilter.hxx" +#include <xmloff/odffields.hxx> +#include <IMark.hxx> class SwDoc; class SwPaM; @@ -359,43 +361,35 @@ namespace sw Position(const SwPosition &rPos); Position(const Position &rPos); operator SwPosition() const; + SwNodeIndex GetPtNode() { return maPtNode; }; + xub_StrLen GetPtCntnt() { return mnPtCntnt; }; }; } } class FieldEntry { -public: - sw::hack::Position maStartPos; - sal_uInt16 mnFieldId; - FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw(); - FieldEntry(const FieldEntry &rOther) throw(); - FieldEntry &operator=(const FieldEntry &rOther) throw(); - void Swap(FieldEntry &rOther) throw(); -}; - -class WW8NewFieldCtx -{ -private: - SwNodeIndex maPtNode; - xub_StrLen mnPtCntnt; - ::rtl::OUString msBookmarkName; - ::rtl::OUString msMarkType; - typedef ::std::pair< ::rtl::OUString, ::rtl::OUString> Param_t; - typedef ::std::vector< Param_t > Params_t; - Params_t maParams; - SwPaM * mpPaM; - -public: - WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType); - ~WW8NewFieldCtx(); - - SwNodeIndex GetPtNode() { return maPtNode; }; - xub_StrLen GetPtCntnt() { return mnPtCntnt; }; - ::rtl::OUString GetBookmarkName(); - ::rtl::OUString GetMarkType(); - void AddParam(::rtl::OUString name, ::rtl::OUString value); - void SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark); + private: + ::rtl::OUString msBookmarkName; + ::rtl::OUString msMarkType; + ::sw::mark::IFieldmark::parameter_map_t maParams; + + public: + sw::hack::Position maStartPos; + sal_uInt16 mnFieldId; + FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw(); + FieldEntry(const FieldEntry &rOther) throw(); + FieldEntry &operator=(const FieldEntry &rOther) throw(); + void Swap(FieldEntry &rOther) throw(); + + SwNodeIndex GetPtNode() { return maStartPos.GetPtNode(); }; + xub_StrLen GetPtCntnt() { return maStartPos.GetPtCntnt(); }; + + ::rtl::OUString GetBookmarkName(); + ::rtl::OUString GetBookmarkType(); + void SetBookmarkName(::rtl::OUString bookmarkName); + void SetBookmarkType(::rtl::OUString bookmarkType); + ::sw::mark::IFieldmark::parameter_map_t& getParameters(); }; @@ -431,7 +425,6 @@ private: bool mbWasParaEnd; bool mbHasBorder; bool mbFirstPara; - std::deque<WW8NewFieldCtx *> maFieldCtxStack; public: WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1); void Restore(SwWW8ImplReader* pRdr); @@ -886,9 +879,6 @@ private: std::deque<FieldEntry> maFieldStack; typedef std::deque<FieldEntry>::const_iterator mycFieldIter; - typedef std::deque<WW8NewFieldCtx *> WW8NewFieldCtxStack_t; - WW8NewFieldCtxStack_t maNewFieldCtxStack; - /* A stack of open footnotes. Should only be one in it at any time. */ diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 984f5792e5ac..465d07c0d2b5 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <comphelper/extract.hxx> +#include <comphelper/stlunosequence.hxx> #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -93,66 +94,15 @@ #include <IMark.hxx> #include <unotools/fltrcfg.hxx> +#include <xmloff/odffields.hxx> #include <stdio.h> +#include <algorithm> using namespace com::sun::star; using namespace sw::util; using namespace sw::types; - -WW8NewFieldCtx::WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType) - : maPtNode(aStartPos.nNode) - , mnPtCntnt(aStartPos.nContent.GetIndex()) - , msBookmarkName(sBookmarkName) - , msMarkType(sMarkType) - , mpPaM(NULL) -{ -} - - -WW8NewFieldCtx::~WW8NewFieldCtx() -{ - if (mpPaM) delete mpPaM; -} - -::rtl::OUString WW8NewFieldCtx::GetBookmarkName() -{ - return msBookmarkName; -} - -::rtl::OUString WW8NewFieldCtx::GetMarkType() -{ - return msMarkType; -} - -void WW8NewFieldCtx::AddParam(::rtl::OUString name, ::rtl::OUString value) -{ - maParams.push_back( Param_t(name, value) ); -} - -void WW8NewFieldCtx::SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark) -{ - for(Params_t::iterator i=maParams.begin();i!=maParams.end();i++) - { - ::rtl::OUString aName=i->first; - ::rtl::OUString aValue=i->second; - if(aName.compareToAscii("Description")==0) - { - pFieldmark->SetFieldHelptext(aValue); - } - else if(aName.compareToAscii("Name")==0) - { - pFieldmark->SetFieldname(aValue); - } - else if(aName.compareToAscii("Result")==0) - { - ::sw::mark::ICheckboxFieldmark* pAsCheckbox = - dynamic_cast< ::sw::mark::ICheckboxFieldmark* >(pFieldmark); - if(pAsCheckbox) - pAsCheckbox->SetChecked(aValue.toInt32()==0); - } - } -} +using namespace sw::mark; //----------------------------------------- // UNO-Controls @@ -230,10 +180,10 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr ) if (aBookmarkName.Len()>0) { - WW8NewFieldCtx *pFieldCtx=new WW8NewFieldCtx(*pPaM->GetPoint(), aBookmarkName, ::rtl::OUString::createFromAscii("ecma.office-open-xml.field.FORMTEXT")); - maNewFieldCtxStack.push_back(pFieldCtx); - pFieldCtx->AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip); - pFieldCtx->AddParam(::rtl::OUString::createFromAscii("Name"), aFormula.sTitle); + maFieldStack.back().SetBookmarkName(aBookmarkName); + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ODF_FORMTEXT)); + maFieldStack.back().getParameters()[::rtl::OUString::createFromAscii("Description")] = uno::makeAny(::rtl::OUString(aFormula.sToolTip)); + maFieldStack.back().getParameters()[::rtl::OUString::createFromAscii("Name")] = uno::makeAny(::rtl::OUString(aFormula.sTitle)); } return FLD_TEXT; } @@ -276,19 +226,20 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle); } - if (aBookmarkName.Len()>0) { - ::sw::mark::ICheckboxFieldmark* pFieldmark = - dynamic_cast< ::sw::mark::ICheckboxFieldmark*>(rDoc.getIDocumentMarkAccess()->makeMark( - *pPaM, - aBookmarkName, - IDocumentMarkAccess::CHECKBOX_FIELDMARK)); - OSL_ENSURE(pFieldmark, - "hmmm; why was the bookmark not created?"); - if(pFieldmark) - { - pFieldmark->SetFieldname(aFormula.sTitle); - pFieldmark->SetFieldHelptext(aFormula.sToolTip); - pFieldmark->SetChecked(aFormula.nChecked!=0); + if (aBookmarkName.Len()>0) + { + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); + IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark( + *pPaM, aBookmarkName, + rtl::OUString::createFromAscii( ODF_FORMCHECKBOX ) ) ); + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + if (pFieldmark!=NULL) { + IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters(); + ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(pFieldmark); + (*pParameters)[::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_NAME)] = uno::makeAny(::rtl::OUString(aFormula.sTitle)); + (*pParameters)[::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_HELPTEXT)] = uno::makeAny(::rtl::OUString(aFormula.sToolTip)); + if(pCheckboxFm) + pCheckboxFm->SetChecked(aFormula.nChecked); // set field data here... } } @@ -303,24 +254,71 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr) if (0x01 == rStr.GetChar(writer_cast<xub_StrLen>(pF->nLCode-1))) ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_DROPDOWN); - SwDropDownField aFld( - (SwDropDownFieldType*)rDoc.GetSysFldType(RES_DROPDOWN)); - - aFld.SetName(aFormula.sTitle); - aFld.SetHelp(aFormula.sHelp); - aFld.SetToolTip(aFormula.sToolTip); + const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); - if (!aFormula.maListEntries.empty()) + if (!bUseEnhFields) { - aFld.SetItems(aFormula.maListEntries); - int nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() - ? aFormula.fDropdownIndex : 0; - aFld.SetSelectedItem(aFormula.maListEntries[nIndex]); + SwDropDownField aFld((SwDropDownFieldType*)rDoc.GetSysFldType(RES_DROPDOWN)); + + aFld.SetName(aFormula.sTitle); + aFld.SetHelp(aFormula.sHelp); + aFld.SetToolTip(aFormula.sToolTip); + + if (!aFormula.maListEntries.empty()) + { + aFld.SetItems(aFormula.maListEntries); + int nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() ? aFormula.fDropdownIndex : 0; + aFld.SetSelectedItem(aFormula.maListEntries[nIndex]); + } + + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); + return FLD_OK; } + else + { + // TODO: review me + String aBookmarkName; + WW8PLCFx_Book* pB = pPlcxMan->GetBook(); + if (pB!=NULL) + { + WW8_CP currentCP=pF->nSCode; + WW8_CP currentLen=pF->nLen; - rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); + USHORT bkmFindIdx; + String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); - return FLD_OK; + if (aBookmarkFind.Len()>0) + { + pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field + if (aBookmarkFind.Len()>0) + aBookmarkName=aBookmarkFind; + } + } + + if (pB!=NULL && aBookmarkName.Len()==0) + aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle); + + if (aBookmarkName.Len()>0) + { + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); + IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( + pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName, + ::rtl::OUString::createFromAscii( ODF_FORMDROPDOWN ) ) ); + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + if ( pFieldmark != NULL ) + { + uno::Sequence< ::rtl::OUString > vListEntries(aFormula.maListEntries.size()); + ::std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), ::comphelper::stl_begin(vListEntries)); + (*pFieldmark->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY)] = uno::makeAny(vListEntries); + sal_Int32 nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() ? aFormula.fDropdownIndex : 0; + (*pFieldmark->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)] = uno::makeAny(nIndex); + // set field data here... + } + } + + return FLD_OK; + } } void SwWW8ImplReader::DeleteFormImpl() @@ -2137,11 +2135,6 @@ bool SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula, if((aPic.lcb > 0x3A) && !pDataStream->GetError() ) { - pDataStream->Seek( nPicLocFc + aPic.cbHeader ); - int len=aPic.lcb-aPic.cbHeader; - char *pBuf=(char*)malloc(len); - pDataStream->Read( pBuf, len); - pDataStream->Seek( nPicLocFc + aPic.cbHeader ); aFormula.FormulaRead(nWhich,pDataStream); bRet = true; } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 79f7537e4ac8..93a39b1c390c 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -79,22 +79,26 @@ #include <fmtclds.hxx> #include <pagedesc.hxx> #include <SwStyleNameMapper.hxx> - +#include <IMark.hxx> #include "ww8scan.hxx" // WW8FieldDesc #include "ww8par.hxx" #include "ww8par2.hxx" #include "writerhelper.hxx" #include "fields.hxx" +#include <unotools/fltrcfg.hxx> #include <algorithm> // #i24377# +//#define WW_NATIVE_TOC 0 + #define MAX_FIELDLEN 64000 #define WW8_TOX_LEVEL_DELIM ':' using namespace ::com::sun::star; using namespace sw::util; +using namespace sw::mark; using namespace std; // #i24377# using namespace nsSwDocInfoSubType; @@ -319,9 +323,11 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) //"_Toc*" and "_Hlt*" are unnecessary const String* pName = pB->GetName(); +#if !defined(WW_NATIVE_TOC) if( !pName || pName->EqualsIgnoreCaseAscii( "_Toc", 0, 4 ) || pName->EqualsIgnoreCaseAscii( "_Hlt", 0, 4 ) ) return 0; +#endif //JP 16.11.98: ToUpper darf auf keinen Fall gemacht werden, weil der //Bookmark- name ein Hyperlink-Ziel sein kann! @@ -663,6 +669,9 @@ sal_uInt16 SwWW8ImplReader::End_Field() if (!pF || !pF->EndPosIsFieldEnd()) return nRet; + const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + ASSERT(!maFieldStack.empty(), "Empty field stack\n"); if (!maFieldStack.empty()) { @@ -674,9 +683,42 @@ sal_uInt16 SwWW8ImplReader::End_Field() nRet = maFieldStack.back().mnFieldId; switch (nRet) { + case 70: + if (bUseEnhFields && pPaM!=NULL && pPaM->GetPoint()!=NULL) { + SwPosition aEndPos = *pPaM->GetPoint(); + SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); + IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeFieldBookmark( + aFldPam, maFieldStack.back().GetBookmarkName(), ::rtl::OUString::createFromAscii(ODF_FORMTEXT ) ) ); + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + if (pFieldmark!=NULL) { + const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters(); + pFieldmark->GetParameters()->insert(pParametersToAdd.begin(), pParametersToAdd.end()); + } + } + break; +#if defined(WW_NATIVE_TOC) + case 8: // TOX_INDEX + case 13: // TOX_CONTENT + case 88: // HYPERLINK + case 37: // REF + if (pPaM!=NULL && pPaM->GetPoint()!=NULL) { + + SwPosition aEndPos = *pPaM->GetPoint(); + SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); + SwFieldBookmark *pFieldmark=(SwFieldBookmark*)rDoc.makeFieldBookmark(aFldPam, maFieldStack.back().GetBookmarkName(), maFieldStack.back().GetBookmarkType()); + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + if (pFieldmark!=NULL) { + const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters(); + pFieldmark->GetParameters()->insert(pParameters.begin(), pParameters.end()); + } + } + break; +#else case 88: pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_TXTATR_INETFMT); break; +#endif case 36: case 68: //Move outside the section associated with this type of field @@ -694,6 +736,10 @@ bool AcceptableNestedField(sal_uInt16 nFieldCode) { switch (nFieldCode) { +#if defined(WW_NATIVE_TOC) + case 8: // allow recursive field in TOC... + case 13: // allow recursive field in TOC... +#endif case 36: case 68: case 79: @@ -732,6 +778,32 @@ FieldEntry &FieldEntry::operator=(const FieldEntry &rOther) throw() return *this; } +::rtl::OUString FieldEntry::GetBookmarkName() +{ + return msBookmarkName; +} + +::rtl::OUString FieldEntry::GetBookmarkType() +{ + return msMarkType; +} + +void FieldEntry::SetBookmarkName(::rtl::OUString bookmarkName) +{ + msBookmarkName=bookmarkName; +} + +void FieldEntry::SetBookmarkType(::rtl::OUString bookmarkType) +{ + msMarkType=bookmarkType; +} + + +::sw::mark::IFieldmark::parameter_map_t& FieldEntry::getParameters() { + return maParams; +} + + // Read_Field liest ein Feld ein oder, wenn es nicht gelesen werden kann, // wird 0 zurueckgegeben, so dass das Feld vom Aufrufer textuell gelesen wird. // Returnwert: Gesamtlaenge des Feldes ( zum UEberlesen ) @@ -2061,6 +2133,17 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr ) String sName(GetMappedBookmark(sOrigName)); +#if defined(WW_NATIVE_TOC) + if (1) { + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_REF"); + maFieldStack.back().SetBookmarkName(aBookmarkName); + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ODF_PAGEREF)); + maFieldStack.back().AddParam(rtl::OUString(), sName); + return FLD_TEXT; + } +#endif + + SwGetRefField aFld( (SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), sName, REF_BOOKMARK, 0, REF_PAGE ); @@ -2761,6 +2844,16 @@ USHORT lcl_GetMaxValidWordTOCLevel(const SwForm &rForm) eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr ) { +#if defined(WW_NATIVE_TOC) + if (1) { + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_TOC"); + maFieldStack.back().SetBookmarkName(aBookmarkName); + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ODF_TOC)); +// maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip); + return FLD_TEXT; + } +#endif + if (pF->nLRes < 3) return FLD_TEXT; // ignore (#i25440#) @@ -3279,6 +3372,16 @@ eF_ResT SwWW8ImplReader::Read_F_Shape(WW8FieldDesc* /*pF*/, String& /*rStr*/) eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) { +#if defined(WW_NATIVE_TOC) + if (1) { + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_HYPERLINK"); + maFieldStack.back().SetBookmarkName(aBookmarkName); + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ODF_HYPERLINK)); +// maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip); + return FLD_TEXT; + } +#endif + String sURL, sTarget, sMark; bool bDataImport = false; //HYPERLINk "filename" [switches] diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index a35bc90f38f0..ce06c22cfc88 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -191,7 +191,7 @@ static USHORT nTitleNo = 0; // Neues Dokument erzeugen (kein Show!) SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); - pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); pNewView = (SwView*) pFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. pSh = pNewView->GetWrtShellPtr(); @@ -501,7 +501,7 @@ static USHORT nTitleNo = 0; if (nMode == ENV_NEWDOC) { - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); if ( rItem.aAddrText.indexOf('<') >= 0 ) { diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index accb052033f6..8d8fc095b5be 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -240,7 +240,7 @@ SwView* lcl_LoadDoc(SwView* pView, const String& rURL) if( pViewShell->ISA(SwView) ) { pNewView = PTR_CAST(SwView,pViewShell); - pNewView->GetViewFrame()->GetFrame()->Appear(); + pNewView->GetViewFrame()->GetFrame().Appear(); } else { @@ -474,7 +474,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM { SwView* pTargetView = m_pMMConfig->GetTargetView(); uno::Reference< frame::XFrame > xFrame = - m_pView->GetViewFrame()->GetFrame()->GetFrameInterface(); + m_pView->GetViewFrame()->GetFrame().GetFrameInterface(); xFrame->getContainerWindow()->setVisible(sal_False); DBG_ASSERT(pTargetView, "No target view has been created"); if(pTargetView) @@ -520,7 +520,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM { m_pView2Close = pTargetView; pTargetView->GetViewFrame()->GetTopViewFrame()->GetWindow().Hide(); - pSourceView->GetViewFrame()->GetFrame()->AppearWithUpdate(); + pSourceView->GetViewFrame()->GetFrame().AppearWithUpdate(); // the current view has be be set when the target is destroyed m_pView = pSourceView; m_pMMConfig->SetTargetView(0); @@ -559,7 +559,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM if(pDocShell->HasName() && !pDocShell->IsModified()) m_pMMConfig->GetSourceView()->GetViewFrame()->DoClose(); else - m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->Appear(); + m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear(); } ExecutionFinished( true ); break; @@ -593,7 +593,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, CancelHdl, AbstractMailMergeWizard*, EMPTY m_pMMConfig->SetTargetView(0); } if(m_pMMConfig->GetSourceView()) - m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->AppearWithUpdate(); + m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().AppearWithUpdate(); m_pMMConfig->Commit(); delete m_pMMConfig; @@ -959,21 +959,8 @@ void NewXForms( SfxRequest& rReq ) // initialize XForms static_cast<SwDocShell*>( &xDocSh )->GetDoc()->initXForms( true ); - // put document into frame - const SfxItemSet* pArgs = rReq.GetArgs(); - DBG_ASSERT( pArgs, "no arguments in SfxRequest"); - if( pArgs != NULL ) - { - const SfxPoolItem* pFrameItem = NULL; - pArgs->GetItemState( SID_DOCFRAME, FALSE, &pFrameItem ); - if( pFrameItem != NULL ) - { - SfxFrame* pFrame = - static_cast<const SfxFrameItem*>( pFrameItem )->GetFrame(); - DBG_ASSERT( pFrame != NULL, "no frame?" ); - pFrame->InsertDocument( xDocSh ); - } - } + // load document into frame + SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); // set return value rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) ); diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 311276e26d51..41f055f86050 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -220,25 +220,9 @@ static sal_uInt16 nBCTitleNo = 0; pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); } - const SfxItemSet *pArgs = rReq.GetArgs(); - DBG_ASSERT( pArgs, "no arguments in SfxRequest"); - const SfxPoolItem* pFrameItem = 0; - if(pArgs) - pArgs->GetItemState(SID_DOCFRAME, FALSE, &pFrameItem); - - SfxViewFrame* pFrame = 0; - if( pFrameItem ) - { - SfxFrame* pFr = ((const SfxFrameItem*)pFrameItem)->GetFrame(); - xDocSh->PutItem(SfxBoolItem(SID_HIDDEN, TRUE)); - pFr->InsertDocument(xDocSh); - pFrame = pFr->GetCurrentViewFrame(); - } - else - { - pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); - } - SwView *pNewView = (SwView*) pFrame->GetViewShell(); + SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); + + SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. // Dokumenttitel setzen @@ -255,7 +239,7 @@ static sal_uInt16 nBCTitleNo = 0; } xDocSh->SetTitle( aTmp ); - pFrame->GetFrame()->Appear(); + pViewFrame->GetFrame().Appear(); // Shell ermitteln SwWrtShell *pSh = pNewView->GetWrtShellPtr(); @@ -458,7 +442,7 @@ static sal_uInt16 nBCTitleNo = 0; if( rItem.bSynchron ) { - SfxDispatcher* pDisp = pFrame->GetDispatcher(); + SfxDispatcher* pDisp = pViewFrame->GetDispatcher(); ASSERT(pDisp, "Heute kein Dispatcher am Frame?"); pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON); } diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 3759f3a9cd89..1f932e6a93bd 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -763,6 +763,10 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) if ( pWrtShell ) { SwWait aWait( *this, TRUE ); + // --> OD 2009-12-31 #i106906# + const sal_Bool bFormerLockView = pWrtShell->IsViewLocked(); + pWrtShell->LockView( sal_True ); + // <-- pWrtShell->StartAllAction(); pWrtShell->Push(); SwWriter aWrt( rMedium, *pWrtShell, TRUE ); @@ -773,6 +777,9 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) { pWrtShell->Pop(FALSE); pWrtShell->EndAllAction(); + // --> OD 2009-12-31 #i106906# + pWrtShell->LockView( bFormerLockView ); + // <-- } } else diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index cb8931b0a055..9cb3caffa7cc 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -676,7 +676,7 @@ void SwDocShell::Execute(SfxRequest& rReq) bOnly = FALSE; else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell())) { - pTmpFrm->GetFrame()->Appear(); + pTmpFrm->GetFrame().Appear(); bFound = TRUE; } if( bFound && !bOnly ) @@ -1027,7 +1027,7 @@ void SwDocShell::Execute(SfxRequest& rReq) else { // Neues Dokument erzeugen. - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0 ); + SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 ); SwView *pCurrView = (SwView*) pFrame->GetViewShell(); // Dokumenttitel setzen @@ -1169,18 +1169,6 @@ void SwDocShell::Execute(SfxRequest& rReq) } break; - case SID_MAIL_PREPAREEXPORT: - { - //pWrtShell is not set in page preview - if(pWrtShell) - pWrtShell->StartAllAction(); - pDoc->UpdateFlds( NULL, false ); - pDoc->EmbedAllLinks(); - pDoc->RemoveInvisibleContent(); - if(pWrtShell) - pWrtShell->EndAllAction(); - } - break; case SID_MAIL_EXPORT_FINISHED: { if(pWrtShell) @@ -1766,15 +1754,15 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView ) // Currently there can be only one view (layout) if the document is viewed in Web layout // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed - SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE); + SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, FALSE); do { if( pTmpFrm != pTempView->GetViewFrame() ) { pTmpFrm->DoClose(); - pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE); + pTmpFrm = SfxViewFrame::GetFirst(this, FALSE); } else - pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, 0, FALSE); + pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, FALSE); } while ( pTmpFrm ); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 8ed82a935a4d..c201109ca1cb 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -39,6 +39,7 @@ #include <svtools/ctrltool.hxx> #include <unotools/lingucfg.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/sfxmodelfactory.hxx> #include <sfx2/printer.hxx> #include <sfx2/bindings.hxx> #include <svl/asiancfg.hxx> @@ -371,7 +372,7 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) --------------------------------------------------------------------*/ -SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport ) : +SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) : SfxObjectShell ( eMode ), pDoc(0), pFontList(0), @@ -382,8 +383,25 @@ SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport ) bInUpdateFontList(false) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); - if ( !_bScriptingSupport ) - SetHasNoBasic(); + Init_Impl(); +} + +/*-------------------------------------------------------------------- + Beschreibung: Ctor / Dtor + --------------------------------------------------------------------*/ + + +SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) : + SfxObjectShell ( i_nSfxCreationFlags ), + pDoc(0), + pFontList(0), + pView( 0 ), + pWrtShell( 0 ), + pOLEChildList( 0 ), + nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), + bInUpdateFontList(false) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); Init_Impl(); } diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 0cf03f803ad3..d06ab31b7478 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -1017,18 +1017,10 @@ USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* pCurrWrtShell->StartAllAction(); pCurrWrtShell->GetFlyFrmAttr( aSet ); - // JP 10.06.98: nur automatische Orientierungen uebernehmen -/* #61359# jetzt auch wieder alle Orientierungen - * const SfxPoolItem* pItem; - if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT, - FALSE, &pItem ) && - text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient()) - aSet.ClearItem( RES_VERT_ORIENT ); - - if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT, - FALSE, &pItem ) && - text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient()) - aSet.ClearItem( RES_HORI_ORIENT );*/ + // --> OD 2009-12-28 #i105535# + // no update of anchor attribute + aSet.ClearItem( RES_ANCHOR ); + // <-- pFrm->SetFmtAttr( aSet ); diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk index 943f1004eb74..88f9ff9d6398 100644 --- a/sw/source/ui/app/makefile.mk +++ b/sw/source/ui/app/makefile.mk @@ -69,6 +69,7 @@ SLOFILES = \ EXCEPTIONSFILES= \ $(SLO)$/docsh.obj \ $(SLO)$/docst.obj \ + $(SLO)$/docshini.obj \ $(SLO)$/swmodule.obj \ $(SLO)$/swmodul1.obj \ $(SLO)$/apphdl.obj \ diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx index 97c34c573756..2b3a5df1391b 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -355,7 +355,7 @@ SwChapterNumRules* SwModule::GetChapterNumRules() void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/) { - Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface(); Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY); uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame( diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx index 0345cd8a6806..4392bdea04ac 100644 --- a/sw/source/ui/app/swwait.cxx +++ b/sw/source/ui/app/swwait.cxx @@ -38,25 +38,25 @@ void SwDocShell::EnterWait( BOOL bLockDispatcher ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE ); while ( pFrame ) { pFrame->GetWindow().EnterWait(); if ( bLockDispatcher ) pFrame->GetDispatcher()->Lock( TRUE ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE ); + pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE ); } } void SwDocShell::LeaveWait( BOOL bLockDispatcher ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE ); while ( pFrame ) { pFrame->GetWindow().LeaveWait(); if ( bLockDispatcher ) pFrame->GetDispatcher()->Lock( FALSE ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE ); + pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE ); } } diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index fdf633a45b8a..38b1ba906fdd 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -241,8 +241,8 @@ SwCharURLPage::SwCharURLPage( Window* pParent, ::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell()); TargetList* pList = new TargetList; - const SfxFrame* pFrame = pView->GetViewFrame()->GetTopFrame(); - pFrame->GetTargetList(*pList); + const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame(); + rFrame.GetTargetList(*pList); USHORT nCount = (USHORT)pList->Count(); if( nCount ) { diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index a2b9b4af8a9e..97f903557bda 100644..100755 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -952,11 +952,11 @@ StringArray STR_PRINTOPTUI < "Contents"; >; < "Page ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; - < "~Pictures and objects"; >; + < "P~ictures and other graphic objects"; >; < "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; - < "~Text placeholder"; >; + < "~Text placeholders"; >; < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; < "Form control~s"; >; < "Specifies whether the form control fields of the text document are printed"; >; @@ -985,7 +985,7 @@ StringArray STR_PRINTOPTUI < "Select the Brochure option to print the document in brochure format."; >; < "Left-to-right script"; >; < "Right-to-left script"; >; - < "Ranges and copies"; >; + < "Range and copies"; >; < "~All pages"; >; < "Print the whole document."; >; < "Pa~ges"; >; diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 6797a2cedf0e..dc007fc68e13 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -580,7 +580,7 @@ void SwAddressListDialog::DetectTablesAndQueries( uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); uno::Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY); + xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) ); } if(pUserData->xConnection.is()) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index f449ad816c3e..8ad861713e0a 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -935,7 +935,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // create a target docshell to put the merged document into xTargetDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD ); xTargetDocShell->DoInitNew( 0 ); - SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE ); + SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() ); @@ -1055,7 +1055,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, if (xWorkDocSh->DoLoad(pWorkMed)) { //create a view frame for the document - SfxViewFrame* pWorkFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE ); + SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 ); //request the layout calculation SwWrtShell& rWorkShell = static_cast< SwView* >(pWorkFrame->GetViewShell())->GetWrtShell(); @@ -1255,6 +1255,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; } while( !bCancel && (bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord())); + + aPrtMonDlg.Show( FALSE ); + // save the single output document if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile) { @@ -1613,7 +1616,7 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData { rxSource.set(xComplConnection,UNO_QUERY); Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY); + xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); xConnection = xComplConnection->connectWithCompletion( xHandler ); } } @@ -2556,7 +2559,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, pWorkMed->SetFilter( pSfxFlt ); if( xWorkDocSh->DoLoad(pWorkMed) ) { - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 ); SwView *pView = (SwView*) pFrame->GetViewShell(); pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird. //set the current DBMgr @@ -2765,7 +2768,7 @@ uno::Reference<XResultSet> SwNewDBMgr::createCursor(const ::rtl::OUString& _sDat if ( xRowSet.is() ) { - uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.sdb.InteractionHandler")), UNO_QUERY); + uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")), UNO_QUERY); xRowSet->executeWithCompletion(xHandler); } xResultSet = uno::Reference<XResultSet>(xRowSet, UNO_QUERY); @@ -2848,14 +2851,14 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, // create a target docshell to put the merged document into SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTargetDocShell->DoInitNew( 0 ); - SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE ); + SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); //the created window has to be located at the same position as the source window - Window& rTargetWindow = pTargetFrame->GetFrame()->GetWindow(); - Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame()->GetWindow(); + Window& rTargetWindow = pTargetFrame->GetFrame().GetWindow(); + Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame().GetWindow(); rTargetWindow.SetPosPixel(rSourceWindow.GetPosPixel()); -// pTargetFrame->GetFrame()->Appear(); +// pTargetFrame->GetFrame().Appear(); SwView* pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() ); rMMConfig.SetTargetView(pTargetView); //initiate SelectShell() to create sub shells @@ -2909,7 +2912,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, xWorkDocSh->DoInitNew(); } //create a ViewFrame - SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() ); + SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() ); SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird. diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src index aa84a1b1f997..f0dba28f75cc 100644 --- a/sw/source/ui/dbui/dbui.src +++ b/sw/source/ui/dbui/dbui.src @@ -83,7 +83,7 @@ ModelessDialog DLG_PRINTMONITOR Pos = MAP_APPFONT ( 6, 17 ) ; Size = MAP_APPFONT ( 100, 8 ) ; CENTER = TRUE ; - Text [ en-US ] = "is being printed on" ; + Text [ en-US ] = "is being prepared for printing on" ; }; FixedText FT_SENDING { diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index e4903ba83134..54cf6edac512 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -307,7 +307,7 @@ void SwMailMergeWizard::CreateTargetDocument() MergeDocuments( m_rConfigItem, *GetSwView() ); m_rConfigItem.SetMergeDone(); if( m_rConfigItem.GetTargetView() ) - m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame()->Appear(); + m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame().Appear(); } /*-- 23.08.2004 08:51:36--------------------------------------------------- diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index a9d1b4a0e2ae..0fe1a3717ca1 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -692,7 +692,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveStartHdl_Impl, PushButton*, pButton) { SfxViewFrame* pSourceViewFrm = pSourceView->GetViewFrame(); uno::Reference< frame::XFrame > xFrame = - pSourceViewFrm->GetFrame()->GetFrameInterface(); + pSourceViewFrm->GetFrame().GetFrameInterface(); xFrame->getContainerWindow()->setVisible(sal_True); pSourceViewFrm->GetDispatcher()->Execute(SID_SAVEDOC, SFX_CALLMODE_SYNCHRON); xFrame->getContainerWindow()->setVisible(sal_False); @@ -855,8 +855,8 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) //now extract a document from the target document SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); - SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE ); -// pTempFrame->GetFrame()->Appear(); + SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); +// pTempFrame->GetFrame().Appear(); SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); SwgReaderOption aOpt; @@ -1254,8 +1254,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) //now extract a document from the target document SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); - SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE ); -// pTempFrame->GetFrame()->Appear(); + SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); +// pTempFrame->GetFrame().Appear(); SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); SwgReaderOption aOpt; diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 2f78c22a83ab..2d2b7c357720 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -149,7 +149,7 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG ); if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) { diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk index 54b7784946e8..758ea00fcb10 100644 --- a/sw/source/ui/dialog/makefile.mk +++ b/sw/source/ui/dialog/makefile.mk @@ -86,11 +86,7 @@ $(INCCOM)$/swuilib.hxx: makefile.mk $(RM) $@ echo \#define DLL_NAME \"libswui$(DLLPOSTFIX)$(DLLPOST)\" >$@ .ELSE -.IF "$(USE_SHELL)"!="4nt" echo \#define DLL_NAME \"swui$(DLLPOSTFIX)$(DLLPOST)\" >$@ -.ELSE # "$(USE_SHELL)"!="4nt" - echo #define DLL_NAME "swui$(DLLPOSTFIX)$(DLLPOST)" >$@ -.ENDIF # "$(USE_SHELL)"!="4nt" .ENDIF $(SLO)$/swabstdlg.obj : $(INCCOM)$/swuilib.hxx diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 4bce94b43cbe..66cb07f33e9c 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -2636,7 +2636,9 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData, if(pFmView) { const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData); if(0 != (pObj = pFmView->CreateXFormsControl(rDesc))) - rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt ); + { + rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); + } } } else if( nWh ) @@ -2697,7 +2699,7 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData, if (pFmView && bHaveColumnDescriptor) { if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) ) - rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt ); + rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); } } nRet = 1; diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc index d0a696c4dd99..31fd6a04949e 100644 --- a/sw/source/ui/docvw/docvw.hrc +++ b/sw/source/ui/docvw/docvw.hrc @@ -34,7 +34,7 @@ #define MN_READONLY_OPENURL (RC_DOCVW_BEGIN + 2) #define MN_READONLY_OPENURLNEW (RC_DOCVW_BEGIN + 3) #define MN_READONLY_EDITDOC (RC_DOCVW_BEGIN + 4) -#define MN_READONLY_BROWSE_STOP (RC_DOCVW_BEGIN + 5) + // FREE, formerly known as MN_READONLY_BROWSE_STOP #define MN_READONLY_BROWSE_BACKWARD (RC_DOCVW_BEGIN + 6) #define MN_READONLY_BROWSE_FORWARD (RC_DOCVW_BEGIN + 7) #define MN_READONLY_SELECTION_MODE (RC_DOCVW_BEGIN + 8) diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src index aa9c8de1176c..d38f249d905e 100644 --- a/sw/source/ui/docvw/docvw.src +++ b/sw/source/ui/docvw/docvw.src @@ -78,12 +78,6 @@ Menu MN_READONLY_POPUP SEPARATOR MenuItem { - Identifier = MN_READONLY_BROWSE_STOP ; - HelpID = SID_BROWSE_STOP ; - Text [ en-US ] = "~Stop" ; - }; - MenuItem - { Identifier = MN_READONLY_BROWSE_BACKWARD ; HelpID = SID_BROWSE_BACKWARD ; Text [ en-US ] = "Backwards" ; diff --git a/sw/source/ui/docvw/edtdd.cxx b/sw/source/ui/docvw/edtdd.cxx index 94e131b06407..8e11e5117c27 100644 --- a/sw/source/ui/docvw/edtdd.cxx +++ b/sw/source/ui/docvw/edtdd.cxx @@ -515,7 +515,7 @@ IMPL_LINK( SwEditWin, DDHandler, Timer *, EMPTYARG ) ReleaseMouse(); bFrmDrag = FALSE; - if ( rView.GetViewFrame() && rView.GetViewFrame()->GetFrame() ) + if ( rView.GetViewFrame() ) { bExecuteDrag = TRUE; StartExecuteDrag(); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 3801d72186e8..0a0bde33327b 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -137,6 +137,7 @@ #include <IMark.hxx> #include <doc.hxx> +#include <xmloff/odffields.hxx> #include "PostItMgr.hxx" #include "postit.hxx" @@ -146,6 +147,7 @@ //#define TEST_FOR_BUG91313 #endif +using namespace sw::mark; using namespace ::com::sun::star; /*-------------------------------------------------------------------- @@ -2311,6 +2313,12 @@ KEYINPUT_CHECKTABLE_INSDEL: ChgToEnEmDash | SetINetAttr | Autocorrect ) && !rSh.HasReadonlySel() ) + /* { + pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | + ChgFractionSymbol | ChgOrdinalNumber | + ChgToEnEmDash | SetINetAttr | + Autocorrect ) && + !rSh.HasReadonlySel() ) */ { FlushInBuffer(); rSh.AutoCorrect( *pACorr, static_cast< sal_Unicode >('\0') ); @@ -3356,11 +3364,16 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bNoInterrupt = bTmpNoInterrupt; } - if( !bOverURLGrf && !bOnlyText ) + if ( !bOverURLGrf && !bOnlyText ) { const int nSelType = rSh.GetSelectionType(); - if( nSelType == nsSelectionType::SEL_OLE || - nSelType == nsSelectionType::SEL_GRF ) + // --> OD 2009-12-30 #i89920# + // Check in general, if an object is selectable at given position. + // Thus, also text fly frames in background become selectable via Ctrl-Click. + if ( nSelType & nsSelectionType::SEL_OLE || + nSelType & nsSelectionType::SEL_GRF || + rSh.IsObjSelectable( aDocPos ) ) + // <-- { MV_KONTEXT( &rSh ); if( !rSh.IsFrmSelected() ) @@ -3608,10 +3621,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) pAnchorMarker->ChgHdl( pHdl ); if( aNew.X() || aNew.Y() ) { - pAnchorMarker->SetPos( aNew ); - pAnchorMarker->SetLastPos( aDocPt ); - //OLMpSdrView->RefreshAllIAOManagers(); - } + pAnchorMarker->SetPos( aNew ); + pAnchorMarker->SetLastPos( aDocPt ); + //OLMpSdrView->RefreshAllIAOManagers(); + } } else { @@ -4177,7 +4190,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD | SwContentAtPos::SW_INETATTR | - SwContentAtPos::SW_SMARTTAG ); + SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL); if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, TRUE ) ) { @@ -4198,6 +4211,29 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() ) rView.ExecSmartTagPopup( aDocPt ); } + else if ( SwContentAtPos::SW_FORMCTRL == aCntntAtPos.eCntntAtPos ) + { + ASSERT( aCntntAtPos.aFnd.pFldmark != NULL, "where is my field ptr???"); + if ( aCntntAtPos.aFnd.pFldmark != NULL) + { + IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark ); + //SwDocShell* pDocSh = rView.GetDocShell(); + //SwDoc *pDoc=pDocSh->GetDoc(); + if (fieldBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) + { + ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(fieldBM); + pCheckboxFm->SetChecked(!pCheckboxFm->IsChecked()); + pCheckboxFm->Invalidate(); + rSh.InvalidateWindows( rView.GetVisArea() ); + } else if (fieldBM->GetFieldname().equalsAscii( ODF_FORMDROPDOWN) ) { + rView.ExecFieldPopup( aDocPt, fieldBM ); + fieldBM->Invalidate(); + rSh.InvalidateWindows( rView.GetVisArea() ); + } else { + // unknown type.. + } + } + } else // if ( SwContentAtPos::SW_INETATTR == aCntntAtPos.eCntntAtPos ) { if ( bExecHyperlinks ) @@ -4700,7 +4736,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) { SwWrtShell &rSh = rView.GetWrtShell(); - if ( !rView.GetViewFrame() || !rView.GetViewFrame()->GetFrame() ) + if ( !rView.GetViewFrame() ) { //Wenn der ViewFrame in Kuerze stirbt kein Popup mehr! Window::Command(rCEvt); diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index b5a8ea2edba8..06d26534abfd 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -117,7 +117,6 @@ #include <sw_primitivetypes2d.hxx> #include <drawinglayer/primitive2d/primitivetools2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 0e3ab86c71a7..f793a7f854b7 100644 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -214,7 +214,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) : else EnableItem( MN_READONLY_LOADGRAPHIC, FALSE ); - BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame()->GetParentFrame(); + BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame().GetParentFrame(); EnableItem( MN_READONLY_RELOAD_FRAME, bReloadFrame ); EnableItem( MN_READONLY_RELOAD, !bReloadFrame); @@ -222,7 +222,6 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) : Check( MN_READONLY_EDITDOC, SID_EDITDOC, rDis ); Check( MN_READONLY_SELECTION_MODE, FN_READONLY_SELECTION_MODE, rDis ); Check( MN_READONLY_SOURCEVIEW, SID_SOURCEVIEW, rDis ); - Check( MN_READONLY_BROWSE_STOP, SID_BROWSE_STOP, rDis ); Check( MN_READONLY_BROWSE_BACKWARD, SID_BROWSE_BACKWARD,rDis ); Check( MN_READONLY_BROWSE_FORWARD, SID_BROWSE_FORWARD, rDis ); #ifdef WNT @@ -314,7 +313,6 @@ void SwReadOnlyPopup::Execute( Window* pWin, USHORT nId ) rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD); break; - case MN_READONLY_BROWSE_STOP: nExecId = SID_BROWSE_STOP; break; case MN_READONLY_BROWSE_BACKWARD: nExecId = SID_BROWSE_BACKWARD;break; case MN_READONLY_BROWSE_FORWARD: nExecId = SID_BROWSE_FORWARD; break; case MN_READONLY_SOURCEVIEW: nExecId = SID_SOURCEVIEW; break; diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index ae553ee89a19..141adf35ddf0 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -65,7 +65,7 @@ #include <com/sun/star/sdbc/XDataSource.hpp> #include <toolkit/unohlp.hxx> #include <comphelper/processfactory.hxx> -#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/form/runtime/XFormController.hpp> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XContainerQuery.hpp> @@ -96,7 +96,7 @@ using namespace ::com::sun::star::ui::dialogs; ---------------------------------------------------------------------------*/ struct SwMailMergeDlg_Impl { - uno::Reference<XFormController> xFController; + uno::Reference<runtime::XFormController> xFController; uno::Reference<XSelectionChangeListener> xChgLstnr; uno::Reference<XSelectionSupplier> xSelSupp; }; @@ -329,7 +329,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, pBeamerWin->Show(); } uno::Reference<XController> xController = xFrame->getController(); - pImpl->xFController = uno::Reference<XFormController>(xController, UNO_QUERY); + pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY); if(pImpl->xFController.is()) { uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( ); diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 47c97f34ce99..2c354551f1f3 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -407,7 +407,7 @@ IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG ) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet, - pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_ADDR ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(RET_OK == pDlg->Execute()) diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 6f62f65c6b87..c78f51f4796f 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -567,7 +567,7 @@ void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) SfxAllItemSet aNewSet(*aSet.GetPool()); aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) ); if ( pWrtShell ) - rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); rPage.PageCreated(aNewSet); break; } diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index 42b1fb1bed5f..740d31c5e88c 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -193,7 +193,7 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) aNewSet.Put( SwMacroAssignDlg::AddEvents( DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) ); if ( m_pWrtShell ) - rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); rPage.PageCreated(aNewSet); break; } diff --git a/sw/source/ui/inc/tbxmgr.hxx b/sw/source/ui/inc/tbxmgr.hxx deleted file mode 100644 index 43798be42de1..000000000000 --- a/sw/source/ui/inc/tbxmgr.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _TBXMGR_HXX -#define _TBXMGR_HXX - -#include <svx/tbxdraw.hxx> -/* -class SwPopupWindowTbxMgr : public SvxPopupWindowTbxMgr -{ - BOOL bWeb:1; //gilt der WebMode? - ResId aRIdWinTemp; - ResId aRIdTbxTemp; - WindowAlign eAlignment; - SfxBindings& mrBindings; - -public: - SwPopupWindowTbxMgr( USHORT nId, - WindowAlign eAlign, - ResId aRIdWin, - ResId aRIdTbx, - SfxBindings& rBindings ); - - virtual void StateChanged(USHORT nSID, SfxItemState eState, const SfxPoolItem* pState); - virtual SfxPopupWindow* Clone() const; -}; -*/ - -#endif // _TBX_DRAW_HXX diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index f243202a01ac..7cff88c897cc 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -40,6 +40,7 @@ #include <swtypes.hxx> #include <shellid.hxx> #include <layout/layout.hxx> +#include <IMark.hxx> class SwBaseShell; class Button; @@ -92,6 +93,7 @@ struct SwConversionArgs; class Graphic; class GraphicFilter; class SwPostItMgr; +class SwFieldBookmark; namespace com{ namespace sun { namespace star { namespace view{ class XSelectionSupplier; } @@ -463,7 +465,7 @@ public: DECL_LINK( SpellError, LanguageType * ); BOOL ExecSpellPopup( const Point& rPt ); - + BOOL ExecFieldPopup( const Point& rPt, sw::mark::IFieldmark *fieldBM ); // SMARTTAGS BOOL ExecSmartTagPopup( const Point& rPt ); diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index 43cc414380a4..2fce41b1a972 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -32,6 +32,7 @@ #include <fesh.hxx> #include <sortopt.hxx> #include <swurl.hxx> +#include <IMark.hxx> class Window; class OutputDevice; @@ -319,6 +320,9 @@ typedef BOOL (SwWrtShell:: *FNSimpleMove)(); void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0); BOOL UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0); + // new fields + BOOL UpdateField( sw::mark::IFieldmark &fieldBM); + // Numerierung und Bullets /** Turns on numbering or bullets. diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 351999015711..a3f2b67b69b6 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -275,7 +275,7 @@ USHORT SwSpellPopup::fillLangPopupMenu( //6--all languages used in current document uno::Reference< com::sun::star::frame::XModel > xModel; - uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface()->getController(), uno::UNO_QUERY ); + uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); @@ -576,7 +576,7 @@ bGrammarResults(false) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); @@ -710,7 +710,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index fe6950ef4722..a2b6b85a7449 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -638,7 +638,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) const SfxPoolItem* pItem; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, - pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), SID_EVENTCONFIG ); + pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG ); if ( pMacroDlg && pMacroDlg->Execute() == RET_OK && SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) ) { diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index b3011985bbc0..4d93f8d7542f 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -306,7 +306,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS } // Dokumenttitel setzen - SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, nViewId, !bShow ); + SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId ); String aDocTitle(SW_RES( STR_GLOSSARY )); aDocTitle += ' '; aDocTitle += sLongName; @@ -343,7 +343,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS xDocSh->GetDoc()->DoUndo( bDoesUndo ); xDocSh->GetDoc()->ResetModified(); if ( bShow ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); delete pGroup; } diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index b67981018015..5cc82f8473eb 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -173,7 +173,7 @@ IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if (RET_OK == pDlg->Execute()) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE ); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index f03a6de204d9..be7622319626 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -393,7 +393,7 @@ IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG ) SfxAllItemSet aSet( rSh.GetAttrPool() ); aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pMap->Execute() ) { SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, FALSE ); diff --git a/sw/source/ui/ribbar/tblctrl.cxx b/sw/source/ui/ribbar/tblctrl.cxx index 5c214950f4bc..ad5046af6b42 100644 --- a/sw/source/ui/ribbar/tblctrl.cxx +++ b/sw/source/ui/ribbar/tblctrl.cxx @@ -36,7 +36,6 @@ #include "cmdid.h" #include "swtypes.hxx" -#include "tbxmgr.hxx" #include "tblctrl.hxx" #include "tblctrl.hrc" diff --git a/sw/source/ui/ribbar/tbxmgr.cxx b/sw/source/ui/ribbar/tbxmgr.cxx deleted file mode 100644 index cbef12105242..000000000000 --- a/sw/source/ui/ribbar/tbxmgr.cxx +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - - - -#include "cmdid.h" -#include "swtypes.hxx" // nur wegen aEmptyString?? -#include "errhdl.hxx" -#include "wdocsh.hxx" -#include "tbxmgr.hxx" - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ -/* -SwPopupWindowTbxMgr::SwPopupWindowTbxMgr( USHORT nId, WindowAlign eAlign, - ResId aRIdWin, ResId aRIdTbx, - SfxBindings& rBindings ) : - SvxPopupWindowTbxMgr( nId, eAlign, aRIdWin, aRIdTbx ), - bWeb(FALSE), - aRIdWinTemp(aRIdWin), - aRIdTbxTemp(aRIdTbx), - eAlignment( eAlign ), - mrBindings( rBindings ) -{ - SfxObjectShell* pObjShell = SfxObjectShell::Current(); - if(PTR_CAST(SwWebDocShell, pObjShell)) - { - bWeb = TRUE; - ToolBox& rTbx = GetTbxMgr().GetToolBox(); - // jetzt muessen ein paar Items aus der Toolbox versteckt werden: - switch(nId) - { - case FN_INSERT_CTRL: - rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL); - rTbx.HideItem(FN_INSERT_FRAME_INTERACT); - rTbx.HideItem(FN_INSERT_FOOTNOTE); - rTbx.HideItem(FN_INSERT_ENDNOTE); - rTbx.HideItem(FN_PAGE_STYLE_SET_COLS); - rTbx.HideItem(FN_INSERT_IDX_ENTRY_DLG); - - break; - case FN_INSERT_FIELD_CTRL: - rTbx.HideItem(FN_INSERT_FLD_PGNUMBER); - rTbx.HideItem(FN_INSERT_FLD_PGCOUNT); - rTbx.HideItem(FN_INSERT_FLD_TOPIC); - rTbx.HideItem(FN_INSERT_FLD_TITLE); - break; - } - } - else if( FN_INSERT_CTRL == nId) - { - ToolBox& rTbx = GetTbxMgr().GetToolBox(); - rTbx.ShowItem(FN_INSERT_FRAME_INTERACT); - rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL); - } - - Size aSize = GetTbxMgr().CalcWindowSizePixel(); - GetTbxMgr().SetPosSizePixel( Point(), aSize ); - SetOutputSizePixel( aSize ); -} -*/ -/************************************************************************* -|* -|* -|* -\************************************************************************/ -/* -void SwPopupWindowTbxMgr::StateChanged(USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState) -{ - static USHORT __READONLY_DATA aInsertCtrl[] = - { - FN_INSERT_FRAME_INTERACT, - FN_INSERT_FOOTNOTE, - FN_INSERT_ENDNOTE, - FN_PAGE_STYLE_SET_COLS, - FN_INSERT_IDX_ENTRY_DLG, - 0 - }; - static USHORT __READONLY_DATA aInsertFld[] = - { - FN_INSERT_FLD_PGNUMBER, - FN_INSERT_FLD_PGCOUNT, - FN_INSERT_FLD_TOPIC, - FN_INSERT_FLD_TITLE, - 0 - }; - - SfxObjectShell* pObjShell = SfxObjectShell::Current(); - BOOL bNewWeb = 0 != PTR_CAST(SwWebDocShell, pObjShell); - - if(bWeb != bNewWeb) - { - bWeb = bNewWeb; - ToolBox& rTbx = GetTbxMgr().GetToolBox(); - // jetzt muessen ein paar Items aus der Toolbox versteckt werden: - const USHORT* pSid = 0; - - switch(nSID) - { - case FN_INSERT_CTRL: - pSid = &aInsertCtrl[0]; - if(bWeb) - rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL); - else - rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL); - break; - case FN_INSERT_FIELD_CTRL: - pSid = & aInsertFld[0]; - break; - } - if(pSid) - { - if(bWeb) - while(*pSid) - { - rTbx.HideItem(*pSid); - pSid++; - } - else - while(*pSid) - { - rTbx.ShowItem(*pSid); - pSid++; - } - Size aSize = GetTbxMgr().CalcWindowSizePixel(); - GetTbxMgr().SetPosSizePixel( Point(), aSize ); - SetOutputSizePixel( aSize ); - } - } - - SfxPopupWindow::StateChanged(nSID, eState, pState); -} -*/ -/* -SfxPopupWindow* SwPopupWindowTbxMgr::Clone() const -{ - return new SwPopupWindowTbxMgr( - GetId(), - eAlignment, -// ((SwPopupWindowTbxMgr*)this)->GetTbxMgr().GetToolBox().GetAlign(), - aRIdWinTemp, - aRIdTbxTemp, - mrBindings -// (SfxBindings&)GetBindings() - ); -} -*/ - diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx index f802751a47ea..c75cb3f0dfc4 100644 --- a/sw/source/ui/ribbar/workctrl.cxx +++ b/sw/source/ui/ribbar/workctrl.cxx @@ -50,7 +50,6 @@ #include <gloshdl.hxx> #include <glosdoc.hxx> #include <gloslst.hxx> -#include <tbxmgr.hxx> #include <workctrl.hxx> #ifndef _WORKCTRL_HRC #include <workctrl.hrc> diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 886ff9c3b81c..b7b7b509d036 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1554,7 +1554,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) // Wenn Zeichen selektiert ist kann es angezeigt werden SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index ab8d63ec7f12..0cee102729a7 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -186,7 +186,7 @@ void lcl_UpdateIMapDlg( SwWrtShell& rSh ) void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType ? rSh.GetIMapInventor() : 0; TargetList* pList = new TargetList; - rSh.GetView().GetViewFrame()->GetTopFrame()->GetTargetList(*pList); + rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList); SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); @@ -2555,7 +2555,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) SvxBrushItem aBrush(RES_BACKGROUND); rSh.GetBoxBackground( aBrush ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); aSet.Put( aBrush ); @@ -2574,7 +2574,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rSh.GetFlyFrmAttr( aSet ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) @@ -2589,7 +2589,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rSh.GetCurAttr( aSet ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index ee3a581d420b..4b8e2c65c5fc 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -809,7 +809,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) // Wenn Zeichen selektiert ist kann es angezeigt werden SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) { diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 4523ece1f8b4..5d972af52f72 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -450,7 +450,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET) nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); - aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame())); + aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric) )); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 69e84ce48184..037758450081 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -225,7 +225,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio())); aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom())); - aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame())); + aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index 6bfc86cf59af..fe2e7502a3df 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -153,7 +153,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) pObj->setURL( aURL ); rSh.EnterStdMode(); - rSh.SwFEShell::Insert( *pObj, 0, 0, &aPos ); + rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); bRet = true; if( pWindow ) diff --git a/sw/source/ui/shells/makefile.mk b/sw/source/ui/shells/makefile.mk index 412304022516..e9a03a5a41cc 100644 --- a/sw/source/ui/shells/makefile.mk +++ b/sw/source/ui/shells/makefile.mk @@ -73,6 +73,7 @@ SLOFILES = \ $(SLO)$/txtnum.obj EXCEPTIONSFILES = \ + $(SLO)$/basesh.obj \ $(SLO)$/annotsh.obj \ $(SLO)$/drwtxtsh.obj \ $(SLO)$/textsh.obj \ diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 7ff660a6c0bb..5f3389791122 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -729,7 +729,7 @@ void SwTableShell::Execute(SfxRequest &rReq) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, - pView->GetViewFrame()->GetFrame()->GetFrameInterface(), + pView->GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 7cbf1767c014..c2308b9def0a 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -1140,7 +1140,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet, - GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pDlg->Execute() ) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 50ae047a8b93..9e89620bed28 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -561,7 +561,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), DLG_SWDROPCAPS ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (pDlg->Execute() == RET_OK) { diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index aeebee5eecfe..c3631be9669f 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -44,7 +44,6 @@ #include <sfx2/printer.hxx> #include <sfx2/progress.hxx> #include <sfx2/app.hxx> -#include <sfx2/topfrm.hxx> #include <sfx2/bindings.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -128,8 +127,7 @@ SFX_IMPL_INTERFACE(SwPagePreView, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX)) TYPEINIT1(SwPagePreView,SfxViewShell) -#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST|SFX_VIEW_OPTIMIZE_EACH| \ - SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS ) +#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS ) #define MIN_PREVIEW_ZOOM 25 #define MAX_PREVIEW_ZOOM 600 @@ -1566,7 +1564,8 @@ void SwPagePreView::GetState( SfxItemSet& rSet ) ASSERT(nWhich, leeres Set); SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); //#106746# zoom has to be disabled if Accessibility support is switched on - BOOL bZoomEnabled = !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); + // MT 2010/01, see #110498# + BOOL bZoomEnabled = TRUE; // !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); while(nWhich) { @@ -1816,7 +1815,7 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): pPageUpBtn(0), pPageDownBtn(0), pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(), - pViewFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )), + pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), mnPageCount( 0 ), // OD 09.01.2003 #106334# mbResetFormDesignMode( false ), @@ -1901,15 +1900,13 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): delete pPageDownBtn; /* SfxObjectShell* pDocSh = GetDocShell(); - TypeId aType = TYPE( SfxTopViewFrame ); - - for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh, aType ); - pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh, aType ) ) + for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh ); + pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) if( pFrame != GetViewFrame() ) { // es gibt noch eine weitere Sicht auf unser Dokument, also // aktiviere dieses - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); break; } */} @@ -2086,8 +2083,11 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize ) //Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen //Scrollrange immer die halbe Hoehe der VisArea abgezogen wird. - if ( pVScrollbar ) - ScrollDocSzChg(); + if ( pVScrollbar && + aTmpSize.Width() > 0 && aTmpSize.Height() > 0 ) + { + ScrollDocSzChg(); + } } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 58ce311d800d..c7c52e3f53ff 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -111,9 +111,7 @@ using ::rtl::OUString; using ::com::sun::star::util::SearchOptions; -#define SWSRCVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \ - SFX_VIEW_OBJECTSIZE_EMBEDDED| \ - SFX_VIEW_CAN_PRINT|\ +#define SWSRCVIEWFLAGS ( SFX_VIEW_CAN_PRINT|\ SFX_VIEW_NO_NEWWINDOW ) #define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL)) diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 677015b25d96..23e6a44012e4 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -127,14 +127,9 @@ using ::rtl::OUStringBuffer; extern sal_Bool bNoInterrupt; // in mainwn.cxx -#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \ - SFX_VIEW_OBJECTSIZE_EMBEDDED| \ - SFX_VIEW_CAN_PRINT| \ +#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT| \ SFX_VIEW_HAS_PRINTOPTIONS) -//MA 06. Nov. 95: Each raus in Absprache mit MI wg. Bug 21523 -// SFX_VIEW_OPTIMIZE_EACH| - /*-------------------------------------------------------------------- Beschreibung: Statics --------------------------------------------------------------------*/ @@ -174,7 +169,7 @@ inline SfxDispatcher &SwView::GetDispatcher() void SwView::ImpSetVerb( int nSelType ) { sal_Bool bResetVerbs = bVerbsActive; - if ( !GetViewFrame()->GetFrame()->IsInPlace() && + if ( !GetViewFrame()->GetFrame().IsInPlace() && (nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType ) { if ( !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) ) @@ -756,7 +751,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pFormShell(0), pHScrollbar(0), pVScrollbar(0), - pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )), + pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin, SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS | @@ -928,10 +923,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) if( SFX_CREATE_MODE_EMBEDDED != pDocSh->GetCreateMode() ) aBrwsBorder = GetMargin(); - if( _pFrame->GetFrameType() & SFXFRAME_INTERNAL ) - pWrtShell->SetFrameView( aBrwsBorder ); - else - pWrtShell->SetBrowseBorder( aBrwsBorder ); + pWrtShell->SetBrowseBorder( aBrwsBorder ); // Im CTOR duerfen keine Shell wechsel erfolgen, die muessen ueber // den Timer "zwischen gespeichert" werden. Sonst raeumt der SFX @@ -943,7 +935,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pVRuler->SetActive( sal_True ); SfxViewFrame* pViewFrame = GetViewFrame(); - if( pViewFrame->GetFrame()->GetParentFrame()) + if( pViewFrame->GetFrame().GetParentFrame()) { aUsrPref.SetViewHRuler(sal_False); aUsrPref.SetViewVRuler(sal_False); @@ -1002,13 +994,6 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() ); pWrtShell->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions()); - if( UseObjectSize() ) - { - //Damit der Sfx _rechtzeitig weiss_, wie gross die sheet::Border sind. - SvBorder aTmp; - CalcAndSetBorderPixel( aTmp, sal_True ); - } - if( pWrtShell->GetDoc()->IsUpdateExpFld() ) { SET_CURR_SHELL( pWrtShell ); @@ -1057,10 +1042,10 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) /*uno::Reference< awt::XWindow > aTmpRef; - _pFrame->GetFrame()->GetFrameInterface()->setComponent( aTmpRef, + _pFrame->GetFrame().GetFrameInterface()->setComponent( aTmpRef, pViewImpl->GetUNOObject_Impl());*/ - uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame().GetFrameInterface(); uno::Reference< frame::XFrame > xBeamerFrame = xFrame->findFrame( OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN); @@ -1622,7 +1607,7 @@ void SwView::ShowCursor( FASTBOOL bOn ) ErrCode SwView::DoVerb( long nVerb ) { - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { SwWrtShell &rSh = GetWrtShell(); const int nSel = rSh.GetSelectionType(); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index e6b4fd00d588..1be7cebbb2f9 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -72,7 +72,6 @@ #include <sfx2/fcontnr.hxx> #include <editeng/sizeitem.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/topfrm.hxx> #include <svl/whiter.hxx> #include <svl/ptitem.hxx> #include <sfx2/linkmgr.hxx> @@ -1028,7 +1027,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) if(bQuery) { SfxViewFrame* pTmpFrame = GetViewFrame(); - SfxHelp::OpenHelpAgent( pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT ); + SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE, diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx index fe38c56f29e5..7e35ca0049df 100644 --- a/sw/source/ui/uiview/viewdraw.cxx +++ b/sw/source/ui/uiview/viewdraw.cxx @@ -171,7 +171,7 @@ void SwView::ExecDraw(SfxRequest& rReq) // TODO: unmark all other pWrtShell->EnterStdMode(); - pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aStartPos ); + pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos ); } } } @@ -218,7 +218,7 @@ void SwView::ExecDraw(SfxRequest& rReq) aSize = Size( 2835, 2835 ); pWrtShell->EnterStdMode(); - pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aPos ); + pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos ); rReq.Ignore (); } } diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 65e6aa20f546..04414b5d83db 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -70,7 +70,7 @@ #include <edtwin.hxx> #include <crsskip.hxx> #include <ndtxt.hxx> - +#include <vcl/lstbox.hxx> #include <cmdid.h> #include <globals.hrc> #include <comcore.hrc> // STR_MULT_INTERACT_SPELL_WARN @@ -97,10 +97,13 @@ #include <svx/dialogs.hrc> #include <svtools/langtab.hxx> #include <unomid.h> +#include <IMark.hxx> +#include <xmloff/odffields.hxx> #include <memory> #include <editeng/editerr.hxx> +using namespace sw::mark; using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -827,10 +830,9 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) else { SfxViewFrame *pSfxViewFrame = GetViewFrame(); - SfxFrame *pSfxFrame = pSfxViewFrame? pSfxViewFrame->GetFrame() : 0; uno::Reference< frame::XFrame > xFrame; - if (pSfxFrame) - xFrame = pSfxFrame->GetFrameInterface(); + if ( pSfxViewFrame ) + xFrame = pSfxViewFrame->GetFrame().GetFrameInterface(); com::sun::star::util::URL aURL; uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY ); uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory(), uno::UNO_QUERY ); @@ -916,3 +918,142 @@ sal_Bool SwView::ExecSmartTagPopup( const Point& rPt ) return bRet; } + + +class SwFieldPopup : public PopupMenu +{ +public: + SwFieldPopup() { + InsertItem(1, ::rtl::OUString::createFromAscii("Hello")); + } +}; + +class SwFieldListBox : public ListBox +{ +public: + SwFieldListBox(Window* pParent) : ListBox(pParent /*, WB_DROPDOWN*/) { + } + + void *GetImplWin() { + return NULL; //FIXME!!! +// return mpImplWin; + } + +protected: + virtual void LoseFocus() { +// printf("ListBox: lose focus!!\n"); + ListBox::LoseFocus(); + } + + virtual void Select() { +// printf("SELECT!!! IsTravelSelect=%i\n", IsTravelSelect()); + ListBox::Select(); + } +}; + +class SwFieldDialog : public Dialog +{ +private: + SwFieldListBox aListBox; + Edit aText; + int selection; + + DECL_LINK( MyListBoxHandler, ListBox * ); + +public: + SwFieldDialog(Window* parent, IFieldmark *fieldBM) : Dialog(parent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ), aListBox(this), aText(this, WB_RIGHT | WB_READONLY), selection(-1) { + + assert(fieldBM!=NULL); + if (fieldBM!=NULL) { + const IFieldmark::parameter_map_t* const pParameters = fieldBM->GetParameters(); + IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY)); + if(pListEntries != pParameters->end()) + { + Sequence< ::rtl::OUString> vListEntries; + pListEntries->second >>= vListEntries; + for( ::rtl::OUString* pCurrent = vListEntries.getArray(); + pCurrent != vListEntries.getArray() + vListEntries.getLength(); + ++pCurrent) + { + aListBox.InsertEntry(*pCurrent); + } + } + } + Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED); + lbSize.Width()+=50; + lbSize.Height()+=20; + aListBox.SetSizePixel(lbSize); + aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) ); + aListBox.Show(); + aText.SetText(rtl::OUString::createFromAscii("Cancel")); + Size tSize=aText.GetOptimalSize(WINDOWSIZE_PREFERRED); + aText.SetSizePixel(Size(lbSize.Width(), tSize.Height())); + aText.SetPosPixel(Point(0, lbSize.Height())); + aText.Show(); + SetSizePixel(Size(lbSize.Width(), lbSize.Height()+tSize.Height())); +// SetSizePixel(Size(200, 200)); + } + + int getSelection() { + return selection; + } +protected: + /* + virtual void LoseFocus() { + printf("lose focus!!\n"); + Dialog::LoseFocus(); + printf("close:\n"); + EndDialog(8); + } + */ + + virtual long PreNotify( NotifyEvent& rNEvt ) { + if (rNEvt.GetType() == EVENT_LOSEFOCUS && aListBox.GetImplWin()==rNEvt.GetWindow()) { + EndDialog(8); + return 1; + } + if (rNEvt.GetType() == EVENT_KEYINPUT) { +// printf("PreNotify::KEYINPUT\n"); + } + return Dialog::PreNotify(rNEvt); + } +}; + +IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox ) +{ +// printf("### DROP DOWN SELECT... IsTravelSelect=%i\n", pBox->IsTravelSelect()); + if (pBox->IsTravelSelect()) { + return 0; + } else { + this->selection=pBox->GetSelectEntryPos(); + EndDialog(9); //@TODO have meaningfull returns... + return 1; + } +} + + +BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM ) +{ + sal_Bool bRet = sal_False; + const sal_Bool bOldViewLock = pWrtShell->IsViewLocked(); + pWrtShell->LockView( sal_True ); + pWrtShell->Push(); + + bRet=sal_True; + const Point aPixPos = GetEditWin().LogicToPixel( rPt ); + + SwFieldDialog aFldDlg(pEditWin, fieldBM); + aFldDlg.SetPosPixel(pEditWin->OutputToScreenPixel(aPixPos)); + + /*short ret=*/aFldDlg.Execute(); + sal_Int32 selection=aFldDlg.getSelection(); + if (selection>=0) { + (*fieldBM->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)] = makeAny(selection); + } + + pWrtShell->Pop( sal_False ); + pWrtShell->LockView( bOldViewLock ); + + return bRet; +} + diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx index 8df3116fa189..d3c5d54d8743 100644 --- a/sw/source/ui/uiview/viewmdi.cxx +++ b/sw/source/ui/uiview/viewmdi.cxx @@ -178,7 +178,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType, nFac = Max( long( MINZOOM ), nFac ); SwViewOption aOpt( *pOpt ); - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen //View updaten. @@ -261,7 +261,7 @@ void SwView::SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly ) ACT_KONTEXT(pWrtShell); - if ( !GetViewFrame()->GetFrame()->IsInPlace() && !bViewOnly ) + if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly ) { const BOOL bWeb = 0 != PTR_CAST(SwWebView, this); SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb); @@ -347,7 +347,7 @@ void SwView::CreatePageButtons(BOOL bShow) pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP); pPageDownBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), FALSE ); pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN); - Reference< XFrame > xFrame = GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = GetViewFrame()->GetFrame().GetFrameInterface(); pNaviBtn = new SwNaviImageButton(pMDI, xFrame ); pNaviBtn->SetHelpId(HID_SCRL_NAVI); Link aLk( LINK( this, SwView, BtnPage ) ); diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx index 3d8c3f05e1f7..b343619f2ea8 100644 --- a/sw/source/ui/uiview/viewport.cxx +++ b/sw/source/ui/uiview/viewport.cxx @@ -221,7 +221,7 @@ aDocSz = rSz; SetVisArea( aNewVisArea, FALSE ); if ( UpdateScrollbars() && !bInOuterResizePixel && !bInInnerResizePixel && - !GetViewFrame()->GetFrame()->IsInPlace()) + !GetViewFrame()->GetFrame().IsInPlace()) OuterResizePixel( Point(), GetViewFrame()->GetWindow().GetOutputSizePixel() ); } @@ -355,7 +355,7 @@ void SwView::SetVisArea( const Point &rPt, BOOL bUpdateScrollbar ) void SwView::CheckVisArea() { pHScrollbar->SetAuto( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - !GetViewFrame()->GetFrame()->IsInPlace() ); + !GetViewFrame()->GetFrame().IsInPlace() ); if ( IsDocumentBorder() ) { if ( aVisArea.Left() != DOCUMENTBORDER || @@ -732,7 +732,7 @@ IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar ) { // JP 21.07.00: the end scrollhandler invalidate the FN_STAT_PAGE, // so we dont must do it agin. -// if(!GetViewFrame()->GetFrame()->IsInPlace()) +// if(!GetViewFrame()->GetFrame().IsInPlace()) // S F X_BINDINGS().Update(FN_STAT_PAGE); //QuickHelp: @@ -1053,7 +1053,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize ) Size aSz( rSize ); SvBorder aBorder; CalcAndSetBorderPixel( aBorder, TRUE ); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) + if ( GetViewFrame()->GetFrame().IsInPlace() ) { Size aViewSize( aSz ); Point aViewPos( rOfst ); diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx index 4cfbdf7c40ab..7f0347ac8bf7 100644 --- a/sw/source/ui/uno/unodispatch.cxx +++ b/sw/source/ui/uno/unodispatch.cxx @@ -57,8 +57,7 @@ const sal_Char* cInternalDBChangeNotification = ".uno::Writer/DataSourceChanged" SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) : m_pView(&rVw) { - SfxFrame* pFrame = m_pView->GetViewFrame()->GetFrame(); - uno::Reference< frame::XFrame> xUnoFrame = pFrame->GetFrameInterface(); + uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame()->GetFrame().GetFrameInterface(); m_xIntercepted = uno::Reference< frame::XDispatchProviderInterception>(xUnoFrame, uno::UNO_QUERY); if(m_xIntercepted.is()) { diff --git a/sw/source/ui/uno/unodoc.cxx b/sw/source/ui/uno/unodoc.cxx index 49e8f37f2b06..3558b5391a06 100644 --- a/sw/source/ui/uno/unodoc.cxx +++ b/sw/source/ui/uno/unodoc.cxx @@ -66,9 +66,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance( { ::vos::OGuard aGuard( Application::GetSolarMutex() ); SwDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - SfxObjectShell* pShell = new SwDocShell( eCreateMode, bScriptSupport ); + SfxObjectShell* pShell = new SwDocShell( _nCreationFlags ); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index c0645c0d0648..06b9e62b4a94 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -426,7 +426,7 @@ SwXMailMerge::SwXMailMerge() : SwDocShell *pDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD ); xDocSh = pDocShell; xDocSh->DoInitNew( 0 ); - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); SwView *pView = (SwView*) pFrame->GetViewShell(); pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird. @@ -624,7 +624,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( aCurSelection = aTranslated; } - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, 0, FALSE); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, FALSE); SwView *pView = PTR_CAST( SwView, pFrame->GetViewShell() ); if (!pView) throw RuntimeException(); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index e60241b19814..a4167da88748 100644..100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -35,6 +35,7 @@ #include <vcl/print.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/sfxbasecontroller.hxx> +#include <sfx2/docfile.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/awt/vclxdevice.hxx> #include <cmdid.h> @@ -220,7 +221,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) { // check if the view frame still exists SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell, - 0, FALSE ); while(pFound) { @@ -231,7 +231,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) } pFound = SfxViewFrame::GetNext( *pFound, pDocShell, - 0, FALSE ); } } @@ -1223,7 +1222,7 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption ::vos::OGuard aGuard(Application::GetSolarMutex()); if(IsValid()) { - SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *pDocShell, 7, sal_True ); + SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 ); SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SFX_CALLMODE_SYNCHRON, pDocShell->GetDoc()->GetAttrPool()); aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, sal_True)); @@ -2698,7 +2697,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (!pWrtShell) { //create a hidden view to be able to export as PDF also in print preview - m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); + m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 ); SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); pWrtShell = pSwView->GetWrtShellPtr(); } @@ -2711,6 +2710,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const TypeId aSwViewTypeId = TYPE(SwView); if (pView->IsA(aSwViewTypeId)) { + if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pWrtShell ) ) + m_pRenderData->ViewOptionAdjustStop(); if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust()) m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() ); } @@ -2813,6 +2814,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); + const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", false ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); @@ -2840,7 +2842,21 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( uno::Sequence< beans::PropertyValue > aRenderer; if (m_pRenderData) { + const USHORT nPage = nRenderer + 1; + + // get paper tray to use ... + sal_Int32 nPrinterPaperTray = -1; + if (! bPrintPaperFromSetup) + { + // ... from individual page style (see the page tab in Format/Page dialog) + const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays(); + std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) ); + if (aIt != rPaperTrays.end()) + nPrinterPaperTray = aIt->second; + } + awt::Size aPageSize; + awt::Size aPreferredPageSize; Size aTmpSize; if (bIsSwSrcView || bPrintProspect) { @@ -2858,36 +2874,49 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); if (pPrinter) { + // HTML source view and prospect adapt to the printer's paper size + aTmpSize = pPrinter->GetPaperSize(); + aTmpSize = pPrinter->LogicToLogic( aTmpSize, + pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); + aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); if (bPrintProspect) { - aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); // we just state what output size we would need - // the rest is nowadays up to vcl - aPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), - TWIP_TO_MM100( aTmpSize.Height() )); - } - else - { - // printing HTML source view - aTmpSize = pPrinter->GetPaperSize(); - aTmpSize = pPrinter->LogicToLogic( aTmpSize, - pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); - aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); + // which may cause vcl to set that page size on the printer + // (if available and not overriden by the user) + aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages ); + aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), + TWIP_TO_MM100( aTmpSize.Height() )); } } } else { - aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); + aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages ); aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), TWIP_TO_MM100( aTmpSize.Height() )); } + sal_Int32 nLen = 2; aRenderer.realloc(2); aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); aRenderer[0].Value <<= aPageSize; aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); aRenderer[1].Value <<= sal_True; + if (aPreferredPageSize.Width && aPreferredPageSize.Height) + { + ++nLen; + aRenderer.realloc( nLen ); + aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferredPageSize" ) ); + aRenderer[ nLen - 1 ].Value <<= aPreferredPageSize; + } + if (nPrinterPaperTray >= 0) + { + ++nLen; + aRenderer.realloc( nLen ); + aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) ); + aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray; + } } m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); @@ -2908,7 +2937,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( SwView *pSwView = 0; SwPagePreView *pSwPagePreView = 0; SwSrcView *pSwSrcView = 0; - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False ); // look for the view shell with the same controller in use, // otherwise look for a suitable view, preferably a SwView, @@ -2927,7 +2956,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( } else if (pSwView || pSwSrcView) break; - pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); + pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False ); } DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" ); @@ -3075,6 +3104,12 @@ void SAL_CALL SwXTextDocument::render( { lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); m_pHiddenViewFrame = 0; + + // prevent crash described in #i108805 + SwDocShell *pRenderDocShell = pDoc->GetDocShell(); + SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet(); + pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); + } } } diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index 736304e6aefb..24049e571f60 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -911,7 +911,7 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); pOldSh->FillPrtDoc(pDocSh->GetDoc(), pPrt); - SfxViewFrame* pDocFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); SwView* pDocView = (SwView*) pDocFrame->GetViewShell(); pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird. SwWrtShell* pSh = pDocView->GetWrtShellPtr(); diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index a2d0d2cdf2d3..ea43533f70d8 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -500,7 +500,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, BOOL bSetFocus { // SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings(); // rBind.ENTERREGISTRATIONS(); - Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface(); SwScrollNaviPopup* pPopup = new SwScrollNaviPopup(FN_SCROLL_NAVIGATION, xFrame ); diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index 58e332ccbc45..baf059c51c32 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -435,7 +435,7 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aCoreSet, - GetView()->GetViewFrame()->GetFrame()->GetFrameInterface(), + GetView()->GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index facc83c6a0a9..01f6c4e84d7a 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -756,7 +756,7 @@ bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, USHORT nId } if(sCommand.Len()) { - uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame().GetFrameInterface(); uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY ); util::URL aURL; aURL.Complete = sCommand; diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index c3a8ae118f8a..57e76a9cff61 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -108,6 +108,8 @@ #include <paratr.hxx> #include <ndtxt.hxx> #include <editeng/acorrcfg.hxx> +//#include <svx/acorrcfg.hxx> +#include <IMark.hxx> // -> #111827# #include <SwRewriter.hxx> @@ -122,6 +124,7 @@ #include "PostItMgr.hxx" +using namespace sw::mark; using namespace com::sun::star; #define COMMON_INI_LIST \ @@ -641,7 +644,7 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm void SwWrtShell::LaunchOLEObj( long nVerb ) { if ( GetCntType() == CNT_OLE && - !GetView().GetViewFrame()->GetFrame()->IsInPlace() ) + !GetView().GetViewFrame()->GetFrame().IsInPlace() ) { svt::EmbeddedObjectRef& xRef = GetOLEObject(); ASSERT( xRef.is(), "OLE not found" ); @@ -1375,10 +1378,13 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum) if ( pTxtNode && ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { - short nTxtNodeFirstLineOffset( 0 ); - pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset ); - const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() + - nTxtNodeFirstLineOffset; + // --> OD 2010-01-05 #b6884103# +// short nTxtNodeFirstLineOffset( 0 ); +// pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset ); +// const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() + +// nTxtNodeFirstLineOffset; + const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList(); + // <-- if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 ) { const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; @@ -1750,6 +1756,12 @@ SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell ) SetSfxViewShell( (SfxViewShell *)&rShell ); SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) ); + + // place the cursor on the first field... + IFieldmark *pBM = NULL; + if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) { + GotoFieldmark(pBM); + } } diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 0472124df128..17af61be8bad 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -239,6 +239,13 @@ BOOL SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) return bResult; } +BOOL SwWrtShell::UpdateField( sw::mark::IFieldmark &fieldBM ) +{ + return SwEditShell::UpdateField(fieldBM); +} + + + // ein Klick aus das angegebene Feld. Der Cursor steht auf diesem. // Fuehre die vor definierten Aktionen aus. diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index c69cec312565..557e871a74e7 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -134,7 +134,7 @@ DEFLIB1NAME=swall $(SWLIBFILES:b) SHL2TARGET= swd$(DLLPOSTFIX) SHL2IMPLIB= swdimp -SHL2VERSIONMAP= swd.map +SHL2VERSIONMAP=$(SOLARENV)/src/component.map SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME= $(SHL2TARGET) @@ -342,7 +342,7 @@ TARGET_VBA=vbaswobj SHL5TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno SHL5IMPLIB= i$(TARGET_VBA) -SHL5VERSIONMAP=$(TARGET_VBA).map +SHL5VERSIONMAP=$(SOLARENV)/src/component.map SHL5DEF=$(MISC)$/$(SHL5TARGET).def DEF5NAME=$(SHL5TARGET) SHL5STDLIBS= \ diff --git a/sw/util/msword.map b/sw/util/msword.map index db60fc5ce8c8..16b9d25b0b78 100644..100755 --- a/sw/util/msword.map +++ b/sw/util/msword.map @@ -1,4 +1,4 @@ -MSWORD_1_0 { +UDK_3_0_0 { global: ImportRTF; ExportRTF; diff --git a/sw/util/sw.map b/sw/util/sw.map deleted file mode 100644 index 272fab31a03d..000000000000 --- a/sw/util/sw.map +++ /dev/null @@ -1,8 +0,0 @@ -SW_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/sw/util/swd.map b/sw/util/swd.map deleted file mode 100644 index 272fab31a03d..000000000000 --- a/sw/util/swd.map +++ /dev/null @@ -1,8 +0,0 @@ -SW_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/sw/util/swui.map b/sw/util/swui.map index f40bd255fe1d..ad5e33836c7c 100644 --- a/sw/util/swui.map +++ b/sw/util/swui.map @@ -1,4 +1,4 @@ -SWUI_1_0 { +UDK_3_0_0 { global: CreateDialogFactory; local: diff --git a/sw/util/vbaswobj.map b/sw/util/vbaswobj.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/sw/util/vbaswobj.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; |