summaryrefslogtreecommitdiff
path: root/sw/source/ui/uno
diff options
context:
space:
mode:
authoros <os@openoffice.org>2010-02-10 16:26:31 +0100
committeros <os@openoffice.org>2010-02-10 16:26:31 +0100
commitc5583bb79dc1b1eea2251a05459ae2dd3247bd9b (patch)
treefd5db508e63a70cff58183baefa23a94cb7507e9 /sw/source/ui/uno
parent1273878636fe1a470d238b897365845c9b2b8d86 (diff)
parent65d792a0b8508a931221451c6e1e5072681fd3db (diff)
update to m71
Diffstat (limited to 'sw/source/ui/uno')
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.cxx6
-rw-r--r--sw/source/ui/uno/unoatxt.cxx57
-rw-r--r--sw/source/ui/uno/unodispatch.cxx7
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx1
-rw-r--r--sw/source/ui/uno/unomod.cxx40
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx887
-rw-r--r--sw/source/ui/uno/unotxvw.cxx102
7 files changed, 707 insertions, 393 deletions
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index a3fbd23474..88b9e291a4 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -30,16 +30,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <vos/mutex.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <SwXDocumentSettings.hxx>
#include <SwXPrintPreviewSettings.hxx>
-#ifndef _COMPHELPER_MASTERPROPERTSETINFO_HXX_
#include <comphelper/MasterPropertySetInfo.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <doc.hxx>
@@ -50,7 +47,6 @@
#include <editsh.hxx>
#include <drawdoc.hxx>
#include <svl/zforlist.hxx>
-#include <unoobj.hxx>
#include <unotxdoc.hxx>
#include <cmdid.h>
#include <svx/zoomitem.hxx>
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index df941b500a..74158364f2 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -34,10 +34,7 @@
#define _SVSTDARR_STRINGS
-
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <vos/mutex.hxx>
#include <tools/debug.hxx>
#include <vcl/svapp.hxx>
@@ -52,7 +49,10 @@
#include <gloslst.hxx>
#include <unoatxt.hxx>
#include <unomap.hxx>
-#include <unoobj.hxx>
+#include <unomid.h>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <TextCursorHelper.hxx>
#include <swevent.hxx>
#include <doc.hxx>
#include <unocrsr.hxx>
@@ -68,6 +68,7 @@
#include <memory>
+
SV_IMPL_REF ( SwDocShell )
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -410,25 +411,25 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR
SwCntntNode * pNd = aIdx.GetNode().GetCntntNode();
SwPosition aPos( aIdx, SwIndex( pNd, pNd->Len() ));
- sal_Bool bRet = sal_False;
+ bool bRet = false;
pInsDoc->LockExpFlds();
{
+ SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : pxRange->GetDoc());
+ SwPaM aPam(pDoc->GetNodes());
+ SwPaM * pPam(0);
if(pxCursor)
{
- SwPaM* pUnoCrsr = pxCursor->GetPaM();
- bRet = pxCursor->GetDoc()->CopyRange( *pUnoCrsr, aPos, false )
- || bRet;
+ pPam = pxCursor->GetPaM();
}
else
{
- const ::sw::mark::IMark* const pBkmk = pxRange->GetBookmark();
- if(pBkmk && pBkmk->IsExpanded())
+ if (pxRange->GetPositions(aPam))
{
- SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos());
- bRet = pxRange->GetDoc()->CopyRange(aTmp, aPos, false)
- || bRet;
+ pPam = & aPam;
}
}
+ if (!pPam) { return false; }
+ bRet = pDoc->CopyRange( *pPam, aPos, false ) || bRet;
}
pInsDoc->UnlockExpFlds();
@@ -1112,7 +1113,7 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR
}
SwDoc* pDoc = 0;
- if ( pRange && pRange->GetBookmark())
+ if (pRange)
pDoc = pRange->GetDoc();
else if ( pCursor )
pDoc = pCursor->GetDoc();
@@ -1130,29 +1131,23 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR
if(!pDoc)
throw uno::RuntimeException();
- SwPaM* pInsertPaM = 0;
- if(pRange)
+
+ SwPaM InsertPaM(pDoc->GetNodes());
+ if (pRange)
{
- const ::sw::mark::IMark* const pBkmk = pRange->GetBookmark();
- if(pBkmk->IsExpanded())
- pInsertPaM = new SwPaM(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos());
- else
- pInsertPaM = new SwPaM(pBkmk->GetMarkPos());
+ if (!pRange->GetPositions(InsertPaM))
+ {
+ throw uno::RuntimeException();
+ }
}
else
{
- SwPaM* pCrsr = pCursor->GetPaM();
- if(pCrsr->HasMark())
- pInsertPaM = new SwPaM(*pCrsr->GetPoint(), *pCrsr->GetMark());
- else
- pInsertPaM = new SwPaM(*pCrsr->GetPoint());
+ InsertPaM = *pCursor->GetPaM();
}
- SwTextBlocks* pBlock = pGlossaries->GetGroupDoc(sGroupName);
- sal_Bool bResult = pBlock && !pBlock->GetError() &&
- pDoc->InsertGlossary( *pBlock, sEntryName, *pInsertPaM);
- delete pBlock;
- delete pInsertPaM;
+ ::std::auto_ptr<SwTextBlocks> pBlock(pGlossaries->GetGroupDoc(sGroupName));
+ const bool bResult = pBlock.get() && !pBlock->GetError()
+ && pDoc->InsertGlossary( *pBlock, sEntryName, InsertPaM);
if(!bResult)
throw uno::RuntimeException();
diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx
index 44b82239b1..02e669d3b2 100644
--- a/sw/source/ui/uno/unodispatch.cxx
+++ b/sw/source/ui/uno/unodispatch.cxx
@@ -31,17 +31,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <vcl/svapp.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+
#include <unodispatch.hxx>
-#include <unoobj.hxx>
+#include <unobaseclass.hxx>
#include <view.hxx>
#include <cmdid.h>
#include "wrtsh.hxx"
#include "dbmgr.hxx"
-#include <svx/dataaccessdescriptor.hxx>
+
using namespace ::com::sun::star;
using namespace rtl;
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index fb42b86801..d9966ac213 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -725,6 +725,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
// when mail merge is called as command line macro
aMergeDesc.bPrintAsync = sal_False;
aMergeDesc.aPrintOptions = aPrintSettings;
+ aMergeDesc.bCreateSingleFile = true;
}
else /* FILE and MAIL*/
{
diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx
index d5315fbd33..4d077c5b9f 100644
--- a/sw/source/ui/uno/unomod.cxx
+++ b/sw/source/ui/uno/unomod.cxx
@@ -35,7 +35,7 @@
#include <swtypes.hxx>
#include <tools/debug.hxx>
#include <unomod.hxx>
-#include <unoobj.hxx>
+#include <unomid.h>
#include <unoprnms.hxx>
#include <unomap.hxx>
#include <prtopt.hxx>
@@ -519,81 +519,75 @@ void SwXPrintSettings::_preGetValues ()
void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
throw(UnknownPropertyException, WrappedTargetException )
{
- sal_Bool bBool = TRUE;
- sal_Bool bBoolVal;
switch( rInfo.mnHandle )
{
case HANDLE_PRINTSET_LEFT_PAGES:
- bBoolVal = mpPrtOpt->IsPrintLeftPage();
+ rValue <<= mpPrtOpt->IsPrintLeftPage();
break;
case HANDLE_PRINTSET_RIGHT_PAGES:
- bBoolVal = mpPrtOpt->IsPrintRightPage();
+ rValue <<= mpPrtOpt->IsPrintRightPage();
break;
case HANDLE_PRINTSET_REVERSED:
- bBoolVal = mpPrtOpt->IsPrintReverse();
+ rValue <<= mpPrtOpt->IsPrintReverse();
break;
case HANDLE_PRINTSET_PROSPECT:
- bBoolVal = mpPrtOpt->IsPrintProspect();
+ rValue <<= mpPrtOpt->IsPrintProspect();
break;
case HANDLE_PRINTSET_GRAPHICS:
- bBoolVal = mpPrtOpt->IsPrintGraphic();
+ rValue <<= mpPrtOpt->IsPrintGraphic();
break;
case HANDLE_PRINTSET_TABLES:
- bBoolVal = mpPrtOpt->IsPrintTable();
+ rValue <<= mpPrtOpt->IsPrintTable();
break;
case HANDLE_PRINTSET_DRAWINGS:
- bBoolVal = mpPrtOpt->IsPrintDraw();
+ rValue <<= mpPrtOpt->IsPrintDraw();
break;
case HANDLE_PRINTSET_CONTROLS:
- bBoolVal = mpPrtOpt->IsPrintControl();
+ rValue <<= mpPrtOpt->IsPrintControl();
break;
case HANDLE_PRINTSET_PAGE_BACKGROUND:
- bBoolVal = mpPrtOpt->IsPrintPageBackground();
+ rValue <<= mpPrtOpt->IsPrintPageBackground();
break;
case HANDLE_PRINTSET_BLACK_FONTS:
- bBoolVal = mpPrtOpt->IsPrintBlackFont();
+ rValue <<= mpPrtOpt->IsPrintBlackFont();
break;
case HANDLE_PRINTSET_SINGLE_JOBS:
- bBoolVal = mpPrtOpt->IsPrintSingleJobs();
+ rValue <<= mpPrtOpt->IsPrintSingleJobs();
break;
case HANDLE_PRINTSET_EMPTY_PAGES:
- bBoolVal = mpPrtOpt->IsPrintEmptyPages();
+ rValue <<= mpPrtOpt->IsPrintEmptyPages();
break;
case HANDLE_PRINTSET_PAPER_FROM_SETUP:
- bBoolVal = mpPrtOpt->IsPaperFromSetup();
+ rValue <<= mpPrtOpt->IsPaperFromSetup();
break;
case HANDLE_PRINTSET_ANNOTATION_MODE:
{
- bBool = FALSE;
rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() );
}
break;
case HANDLE_PRINTSET_FAX_NAME :
{
- bBool = FALSE;
rValue <<= mpPrtOpt->GetFaxName();
}
break;
case HANDLE_PRINTSET_PROSPECT_RTL:
{
- bBoolVal = mpPrtOpt->IsPrintProspect_RTL();
+ rValue <<= mpPrtOpt->IsPrintProspectRTL();
}
break;
case HANDLE_PRINTSET_PLACEHOLDER:
{
- bBoolVal = mpPrtOpt->IsPrintTextPlaceholder();
+ rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
}
break;
case HANDLE_PRINTSET_HIDDEN_TEXT:
{
- bBoolVal = mpPrtOpt->IsPrintHiddenText();
+ rValue <<= mpPrtOpt->IsPrintHiddenText();
}
break;
default:
throw UnknownPropertyException();
}
- if(bBool)
- rValue.setValue(&bBoolVal, ::getBooleanCppuType());
}
void SwXPrintSettings::_postGetValues ()
throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 8e233c537c..09785b273a 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -1,5 +1,5 @@
/*************************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -31,13 +31,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#include <cmdid.h>
-#include <swtypes.hxx>
+#include <vos/mutex.hxx>
#include <vcl/image.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <cmdid.h>
+#include <swtypes.hxx>
#include <wdocsh.hxx>
#include <wrtsh.hxx>
#include <view.hxx>
@@ -49,12 +53,14 @@
#include <svl/stritem.hxx>
#include <unotxdoc.hxx>
#include <svl/numuno.hxx>
-#include <unoobj.hxx>
+#include <fldbas.hxx>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
#include <unosett.hxx>
#include <unocoll.hxx>
#include <unoredlines.hxx>
#include <unosrch.hxx>
-#include <toolkit/awt/vclxdevice.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <sfx2/objsh.hxx> // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell)
@@ -68,6 +74,7 @@
#include <unofield.hxx>
#include <unoidx.hxx>
#include <unoflatpara.hxx>
+#include <unotxvw.hxx>
#include <poolfmt.hxx>
#include <globdoc.hxx>
#include <viewopt.hxx>
@@ -75,6 +82,8 @@
#include <doc.hxx>
#include <charatr.hxx>
#include <svx/xmleohlp.hxx>
+#include <globals.hrc>
+#include <unomid.h>
#include <com/sun/star/util/SearchOptions.hpp>
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
@@ -131,11 +140,14 @@
#include <svl/stylepool.hxx>
#include <swatrset.hxx>
+#include <view.hxx>
+#include <srcview.hxx>
//#include <com/sun/star/i18n/ScriptType.hpp>
#include <svtools/langtab.hxx>
#include <map>
#include <set>
+#include <vector>
#include <svx/eeitem.hxx>
#include <svx/editeng.hxx>
@@ -172,6 +184,32 @@ using ::osl::FileBase;
/******************************************************************************
*
******************************************************************************/
+
+extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
+
+SwPrintUIOptions * lcl_GetPrintUIOptions(
+ SwDocShell * pDocShell,
+ const SfxViewShell * pView )
+{
+ if (!pDocShell)
+ return NULL;
+
+ const BOOL bWebDoc = NULL != dynamic_cast< const SwWebDocShell * >(pDocShell);
+ const bool bSwSrcView = NULL != dynamic_cast< const SwSrcView * >(pView);
+ const SwView * pSwView = dynamic_cast< const SwView * >(pView);
+ const bool bHasSelection = pSwView ? pSwView->HasSelection( sal_False ) : false; // check for any selection, not just text selection
+ const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 );
+
+ // get default values to use in dialog from documents SwPrintData
+ const SwPrintData *pPrintData = pDocShell->GetDoc()->getPrintData();
+ DBG_ASSERT( pPrintData, "failed to get SwPrintData from document" );
+
+ return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, *pPrintData );
+}
+
+////////////////////////////////////////////////////////////
+
+
SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)
{
SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName );
@@ -366,7 +404,9 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
pxXLineNumberingProperties(0),
pxLinkTargetSupplier(0),
pxXRedlines(0),
- m_pHiddenViewFrame(0)
+ m_pHiddenViewFrame(0),
+ m_pPrintUIOptions( NULL ),
+ m_pRenderData( NULL )
{
}
/*-- 18.12.98 11:53:00---------------------------------------------------
@@ -381,6 +421,8 @@ SwXTextDocument::~SwXTextDocument()
xNumFmtAgg->setDelegator(x0);
xNumFmtAgg = 0;
}
+ delete m_pPrintUIOptions;
+ delete m_pRenderData;
}
@@ -727,19 +769,12 @@ Reference< util::XReplaceDescriptor > SwXTextDocument::createReplaceDescriptor(
SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCrsr)
{
getText();
- XText* pText = xBodyText.get();
+ XText *const pText = xBodyText.get();
SwXBodyText* pBText = (SwXBodyText*)pText;
- xCrsr = pBText->CreateTextCursor(sal_True);
+ SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true);
+ xCrsr.set( static_cast<text::XWordCursor*>(pXTextCursor) );
- Reference<XUnoTunnel> xRangeTunnel( xCrsr, UNO_QUERY);
- SwXTextCursor* pxUnoCrsr = 0;
- if(xRangeTunnel.is())
- {
- pxUnoCrsr = reinterpret_cast<SwXTextCursor*>(xRangeTunnel->getSomething(
- SwXTextCursor::getUnoTunnelId()));
- }
-
- SwUnoCrsr* pUnoCrsr = pxUnoCrsr->GetCrsr();
+ SwUnoCrsr *const pUnoCrsr = pXTextCursor->GetCursor();
pUnoCrsr->SetRemainInSection(sal_False);
return pUnoCrsr;
}
@@ -970,10 +1005,7 @@ Reference< XIndexAccess >
if(!pResultCrsr)
throw RuntimeException();
Reference< XIndexAccess > xRet;
- if(nResult)
- xRet = new SwXTextRanges(pResultCrsr);
- else
- xRet = new SwXTextRanges();
+ xRet = new SwXTextRanges( (nResult) ? pResultCrsr : 0 );
delete pResultCrsr;
return xRet;
}
@@ -993,11 +1025,10 @@ Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSear
Reference< XInterface > xRet;
if(nResult)
{
- Reference< XTextRange > xTempRange = SwXTextRange::CreateTextRangeFromPosition(
- pDocShell->GetDoc(),
- *pResultCrsr->GetPoint(),
- pResultCrsr->GetMark());
- xRet = *new SwXTextCursor(xTempRange->getText(), pResultCrsr);
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
+ xRet = *new SwXTextCursor(xParent, *pResultCrsr);
delete pResultCrsr;
}
return xRet;
@@ -1021,12 +1052,11 @@ Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface >
Reference< XInterface > xRet;
if(nResult)
{
- Reference< XTextRange > xTempRange = SwXTextRange::CreateTextRangeFromPosition(
- pDocShell->GetDoc(),
- *pResultCrsr->GetPoint(),
- pResultCrsr->GetMark());
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
- xRet = *new SwXTextCursor(xTempRange->getText(), pResultCrsr);
+ xRet = *new SwXTextCursor(xParent, *pResultCrsr);
delete pResultCrsr;
}
return xRet;
@@ -2455,100 +2485,74 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName
}
return aAny;
}
-/*-- 06.01.2004 15:08:34---------------------------------------------------
- The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of
- the current ViewShell so that fields are not printed as commands and
- hidden text and hidden characters are always invisible.
- After printing the view options are restored
- -----------------------------------------------------------------------*/
-class SwViewOptionAdjust_Impl
-{
- bool m_bSwitchOff_IsFldName;
- bool m_bSwitchOff_PlaceHolderView;
- bool m_bSwitchOff_HiddenChar;
- bool m_bSwitchOff_HiddenParagraphs;
- bool m_bSwitchOff_IsShowHiddenField;
-
- SwViewOption* m_pViewOption;
- SwWrtShell& m_rShell;
-public:
- SwViewOptionAdjust_Impl(SwWrtShell& rSh);
- ~SwViewOptionAdjust_Impl();
-};
-/*-- 06.01.2004 15:08:34---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl(SwWrtShell& rSh) :
- m_pViewOption(0),
- m_rShell(rSh)
-{
- const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions();
- m_bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && m_rShell.IsAnyFieldInDoc();
- bool bApplyViewOptions = m_bSwitchOff_IsFldName;
- //switch off painting of placeholder fields
- m_bSwitchOff_PlaceHolderView = pCurrentViewOptions->IsShowPlaceHolderFields();
- //switch off display of hidden characters if on and hidden characters are in use
- m_bSwitchOff_HiddenChar = pCurrentViewOptions->IsShowHiddenChar() && m_rShell.GetDoc()->ContainsHiddenChars();
- //switch off display of hidden paragraphs if on and hidden paragraphs are in use
- m_bSwitchOff_HiddenParagraphs = pCurrentViewOptions->IsShowHiddenPara();
- if(m_bSwitchOff_HiddenParagraphs)
- {
- const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENPARAFLD);
- if(!pFldType || !pFldType->GetDepends())
- m_bSwitchOff_HiddenParagraphs = false;
- }
- m_bSwitchOff_IsShowHiddenField = pCurrentViewOptions->IsShowHiddenField();
- if(m_bSwitchOff_IsShowHiddenField)
- {
- const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENTXTFLD);
- if( !pFldType || !pFldType->GetDepends())
- m_bSwitchOff_IsShowHiddenField = false;
- }
-
- bApplyViewOptions |= m_bSwitchOff_PlaceHolderView;
- bApplyViewOptions |= m_bSwitchOff_HiddenChar;
- bApplyViewOptions |= m_bSwitchOff_HiddenParagraphs;
- bApplyViewOptions |= m_bSwitchOff_IsShowHiddenField;
- if(bApplyViewOptions)
- {
- m_pViewOption = new SwViewOption(*m_rShell.GetViewOptions());
- if(m_bSwitchOff_IsFldName)
- m_pViewOption->SetFldName(FALSE);
- if(m_bSwitchOff_PlaceHolderView)
- m_pViewOption->SetShowPlaceHolderFields(FALSE);
- if(m_bSwitchOff_HiddenChar)
- m_pViewOption->SetShowHiddenChar(FALSE);
- if(m_bSwitchOff_HiddenParagraphs)
- m_pViewOption->SetShowHiddenPara(FALSE);
- if(m_bSwitchOff_IsShowHiddenField)
- m_pViewOption->SetShowHiddenField(FALSE);
- SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY );
- }
-}
-/*-- 06.01.2004 15:08:34---------------------------------------------------
- -----------------------------------------------------------------------*/
-SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
+static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
{
- if(m_pViewOption)
+ OutputDevice *pOut = 0;
+
+ uno::Any aAny( rPrintUIOptions.getValue( C2U( "RenderDevice" ) ));
+ uno::Reference< awt::XDevice > xRenderDevice;
+ aAny >>= xRenderDevice;
+ if (xRenderDevice.is())
{
- if(m_bSwitchOff_IsFldName)
- m_pViewOption->SetFldName(TRUE);
- if(m_bSwitchOff_PlaceHolderView)
- m_pViewOption->SetShowPlaceHolderFields(TRUE);
- if(m_bSwitchOff_HiddenChar)
- m_pViewOption->SetShowHiddenChar(TRUE);
- if(m_bSwitchOff_HiddenParagraphs)
- m_pViewOption->SetShowHiddenPara(TRUE);
- if(m_bSwitchOff_IsShowHiddenField)
- m_pViewOption->SetShowHiddenField(TRUE);
- SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY );
- delete m_pViewOption;
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ pOut = pDevice ? pDevice->GetOutputDevice() : 0;
}
-}
-/* -----------------------------23.08.02 16:00--------------------------------
- ---------------------------------------------------------------------------*/
+ return pOut;
+}
+
+
+static bool lcl_SeqHasProperty(
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ const sal_Char *pPropName )
+{
+ bool bRes = false;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for (sal_Int32 i = 0; i < nLen && !bRes; ++i)
+ {
+ if (pProps[i].Name.equalsAscii( pPropName ))
+ bRes = true;
+ }
+ return bRes;
+}
+
+
+SfxViewShell * SwXTextDocument::GetRenderView(
+ bool &rbIsSwSrcView,
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ bool bIsPDFExport )
+{
+ // get view shell to use
+ SfxViewShell *pView = 0;
+ if (bIsPDFExport)
+ pView = GuessViewShell( rbIsSwSrcView );
+ else
+ {
+ uno::Any aTmp;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for (sal_Int32 i = 0; i < nLen; ++i)
+ {
+ if (pProps[i].Name.equalsAscii( "View" ))
+ {
+ aTmp = pProps[i].Value;
+ break;
+ }
+ }
+
+ uno::Reference< frame::XController > xController;
+ if (aTmp >>= xController)
+ {
+ DBG_ASSERT( xController.is(), "controller is empty!" );
+ pView = GuessViewShell( rbIsSwSrcView, xController );
+ }
+ }
+ return pView;
+}
+
+
/*
* GetRenderDoc:
* returns the document to be rendered, usually this will be the 'regular'
@@ -2558,7 +2562,10 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
* SfxViewShell.
*/
-SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rSelection )
+SwDoc * SwXTextDocument::GetRenderDoc(
+ SfxViewShell *&rpView,
+ const uno::Any& rSelection,
+ bool bIsPDFExport )
{
SwDoc *pDoc = 0;
@@ -2568,11 +2575,22 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS
pDoc = pDocShell->GetDoc();
else
{
- // used for PDF export of (multi-)selection
+ DBG_ASSERT( !xModel.is(), "unexpected model found" );
+
if (rSelection.hasValue()) // is anything selected ?
{
+ // this part should only be called when a temporary document needs to be created,
+ // for example for PDF export or printing of (multi-)selection only.
+
+ bool bIsSwSrcView = false;
if (!rpView)
- rpView = GuessViewShell();
+ {
+ (void) bIsPDFExport;
+ // aside from maybe PDF export the view should always have been provided!
+ DBG_ASSERT( bIsPDFExport, "view is missing, guessing one..." );
+
+ rpView = GuessViewShell( bIsSwSrcView );
+ }
DBG_ASSERT( rpView, "ViewShell missing" );
// the view shell should be SwView for documents PDF export.
// for the page preview no selection should be possible
@@ -2587,56 +2605,188 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS
rpView = pDoc->GetDocShell()->GetView();
}
}
- else {
+ else
+ {
DBG_ERROR( "unexpected ViewShell" );
}
}
}
return pDoc;
}
+
/* -----------------------------23.08.02 16:00--------------------------------
---------------------------------------------------------------------------*/
+
+static void lcl_SavePrintUIOptionsToDocumentPrintData(
+ SwDoc &rDoc,
+ const SwPrintUIOptions &rPrintUIOptions,
+ bool bIsPDFEXport )
+{
+ if (!rDoc.getPrintData())
+ {
+ SwPrintData *pTmpData = new SwPrintData;
+ rDoc.setPrintData ( *pTmpData );
+ delete pTmpData; // setPrintData does make its own copy!
+ }
+
+ SwPrintData *pDocPrintData = rDoc.getPrintData();
+
+ pDocPrintData->SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() );
+ pDocPrintData->SetPrintTable( rPrintUIOptions.IsPrintTables() );
+ pDocPrintData->SetPrintDraw( rPrintUIOptions.IsPrintDrawings() );
+ pDocPrintData->SetPrintControl( rPrintUIOptions.IsPrintFormControls() );
+ pDocPrintData->SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() );
+ pDocPrintData->SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() );
+ pDocPrintData->SetPrintReverse( rPrintUIOptions.IsPrintReverse() );
+ pDocPrintData->SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() );
+ pDocPrintData->SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) );
+ pDocPrintData->SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() );
+ pDocPrintData->SetPrintProspect( rPrintUIOptions.IsPrintProspect() );
+ pDocPrintData->SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() );
+ pDocPrintData->SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() );
+ pDocPrintData->SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() );
+ // pDocPrintData->SetPrintSingleJobs( b ); handled by File/Print dialog itself
+ // pDocPrintData->SetFaxName( s ); n/a in File/Print dialog
+ pDocPrintData->SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() );
+ pDocPrintData->SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() );
+}
+
+
sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
const uno::Any& rSelection,
- const uno::Sequence< beans::PropertyValue >& /*rxOptions*/ )
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
throw (IllegalArgumentException, RuntimeException)
{
::vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw RuntimeException();
- SfxViewShell *pView = 0;
- SwDoc *pDoc = GetRenderDoc( pView, rSelection );
- if (!pDoc)
- throw RuntimeException();
- SwDocShell *pRenderDocShell = pDoc->GetDocShell();
- // #i38289
- if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE))
- {
- pRenderDocShell->ToggleBrowserMode(false,NULL);
- }
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ if (!bIsSwSrcView && !m_pRenderData)
+ m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions );
+ // const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (!pDoc || !pView)
+ return 0;
- SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell();
+ // save current UI options from the print dialog for the next call to that dialog
+ lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport );
sal_Int32 nRet = 0;
- if( !pWrtShell )
+ if (bIsSwSrcView)
{
- //create a hidden view to be able to export as PDF also in print preview
- m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE );
- SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell();
- pWrtShell = pSwView->GetWrtShellPtr();
+ SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView);
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ nRet = pSwSrcView->PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ );
}
+ else
+ {
+ SwDocShell *pRenderDocShell = pDoc->GetDocShell();
+ SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell();
+ if (bFormat)
+ {
+ // #i38289
+ if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ pRenderDocShell->ToggleBrowserMode(false,NULL);
+ }
+
+ if (!pWrtShell)
+ {
+ //create a hidden view to be able to export as PDF also in print preview
+ m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE );
+ SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell();
+ pWrtShell = pSwView->GetWrtShellPtr();
+ }
+
+ // reformating the document for printing will show the changes in the view
+ // which is likely to produce many unwanted and not nice to view actions.
+ // We don't want that! Thus we disable updating of the view.
+ pWrtShell->StartAction();
+
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ if (pView->IsA(aSwViewTypeId))
+ {
+ if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
+ m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() );
+ }
+
+ m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) );
+ m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell,
+ m_pPrintUIOptions, m_pRenderData, bIsPDFExport );
+
+ if (pView->IsA(aSwViewTypeId))
+ {
+ // PDF export should not make use of the SwPrtOptions
+ const SwPrtOptions *pPrtOptions = bIsPDFExport? NULL : m_pRenderData->GetSwPrtOptions();
+ m_pRenderData->ViewOptionAdjust( pPrtOptions );
+ }
+
+ // since printing now also use the API for PDF export this option
+ // should be set for printing as well ...
+ pWrtShell->SetPDFExportOption( sal_True );
+
+ // --> FME 2005-05-23 #122919# Force field update before PDF export:
+ pWrtShell->ViewShell::UpdateFlds(TRUE);
+ // <--
+
+ // there is some redundancy between those two function calls, but right now
+ // there is no time to sort this out.
+ //TODO: check what exatly needs to be done and make just one function for that
+ pWrtShell->CalcLayout();
+ pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() );
+
+ pWrtShell->SetPDFExportOption( sal_False );
+
+
+ // enable view again
+ pWrtShell->EndAction();
+ }
+
+ const sal_Int32 nPageCount = pDoc->GetPageCount();
+
+ //
+ // get number of pages to be rendered
+ //
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ if (bPrintProspect)
+ {
+ pDoc->CalculatePagePairsForProspectPrinting( *m_pRenderData, *m_pPrintUIOptions, nPageCount );
+ nRet = m_pRenderData->GetPagePairsForProspectPrinting().size();
+ }
+ else
+ {
+ const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 );
+ if (nPostItMode != POSTITS_NONE)
+ {
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ m_pRenderData->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev );
+ }
- SwViewOptionAdjust_Impl aAdjust(*pWrtShell);
- pWrtShell->SetPDFExportOption( sal_True );
- // --> FME 2005-05-23 #122919# Force field update before PDF export:
- pWrtShell->ViewShell::UpdateFlds(TRUE);
- // <--
- pWrtShell->CalcLayout();
- pWrtShell->SetPDFExportOption( sal_False );
- nRet = pDoc->GetPageCount();
+ // get set of valid document pages (according to the current settings)
+ // and their start frames
+ pDoc->CalculatePagesForPrinting( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount );
+ if (nPostItMode != POSTITS_NONE)
+ {
+ pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData,
+ *m_pPrintUIOptions, bIsPDFExport, nPageCount );
+ }
+
+ nRet = m_pRenderData->GetPagesToPrint().size();
+ }
+ }
+ DBG_ASSERT( nRet >= 0, "negative number of pages???" );
+
return nRet;
}
/* -----------------------------23.08.02 16:00--------------------------------
@@ -2651,41 +2801,110 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
::vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw RuntimeException();
- SfxViewShell *pView = 0;
- SwDoc *pDoc = GetRenderDoc( pView, rSelection );
- if (!pDoc)
- throw RuntimeException();
+
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ // m_pRenderData should NOT be created here!
+ // That should only be done in getRendererCount. If this function is called before
+ // getRendererCount was called then the caller will probably just retrieve the extra UI options
+ // and is not interested in getting valid information about the other data that would
+ // otherwise be provided here!
+// if( ! m_pRenderData )
+// m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ m_pPrintUIOptions->processProperties( rxOptions );
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (!pDoc || !pView)
+ return uno::Sequence< beans::PropertyValue >();
// due to #110067# (document page count changes sometimes during
// PDF export/printing) we can not check for the upper bound properly.
// Thus instead of throwing the exception we silently return.
- if (!(0 <= nRenderer /* && nRenderer < pDoc->GetPageCount()*/))
+ if (0 > nRenderer)
throw IllegalArgumentException();
- if (nRenderer >= pDoc->GetPageCount())
- return uno::Sequence< beans::PropertyValue >();
-
- bool bSkipEmptyPages = false;
- for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
+ sal_Int32 nMaxRenderer = 0;
+ if (!bIsSwSrcView && m_pRenderData)
{
- if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ) )
- rxOptions[ nProperty].Value >>= bSkipEmptyPages;
+ DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" );
+ nMaxRenderer = bPrintProspect?
+ m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
+ m_pRenderData->GetPagesToPrint().size() - 1;
}
+ // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
+ // we obmit checking of the upper bound in this case.
+ if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer)
+ return uno::Sequence< beans::PropertyValue >();
- Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bSkipEmptyPages ) );
+ uno::Sequence< beans::PropertyValue > aRenderer;
+ if (m_pRenderData)
+ {
+ awt::Size aPageSize;
+ Size aTmpSize;
+ if (bIsSwSrcView || bPrintProspect)
+ {
+ // for printing of HTML source code and prospect printing we should use
+ // the printers paper size since
+ // a) HTML source view has no page size
+ // b) prospect printing has a different page size from the documents page
+ // since two document pages will get rendered on one printer page
+
+ // since PageIncludesNonprintableArea will be set to true we can return the
+ // printers paper size here.
+ // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this
+ // case we won't get an OutputDevice here, but then the caller also has no need
+ // for the correct PageSisze right now...
+ Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
+ if (pPrinter)
+ {
+ 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() );
+ }
+ }
+ }
+ else
+ {
+ aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages );
+ aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ),
+ TWIP_TO_MM100( aTmpSize.Height() ));
+ }
- awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ),
- TWIP_TO_MM100( aPgSize.Height() ));
- uno::Sequence< beans::PropertyValue > aRenderer(1);
- PropertyValue &rValue = aRenderer.getArray()[0];
- rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
- rValue.Value <<= aPageSize;
+ 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;
+ }
+ m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
+
return aRenderer;
}
/* -----------------------------28.10.02 16:00--------------------------------
---------------------------------------------------------------------------*/
-SfxViewShell * SwXTextDocument::GuessViewShell()
+SfxViewShell * SwXTextDocument::GuessViewShell(
+ /* out */ bool &rbIsSwSrcView,
+ const uno::Reference< css::frame::XController > xController )
{
// #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell()
// must not be used (see comment from MBA)
@@ -2693,24 +2912,39 @@ SfxViewShell * SwXTextDocument::GuessViewShell()
SfxViewShell *pView = 0;
SwView *pSwView = 0;
SwPagePreView *pSwPagePreView = 0;
+ SwSrcView *pSwSrcView = 0;
SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False );
+
+ // look for the view shell with the same controller in use,
+ // otherwise look for a suitable view, preferably a SwView,
+ // if that one is not found use a SwPagePreView if found.
while (pFrame)
{
pView = pFrame->GetViewShell();
pSwView = dynamic_cast< SwView * >(pView);
- if (pSwView)
- break;
+ pSwSrcView = dynamic_cast< SwSrcView * >(pView);
if (!pSwPagePreView)
pSwPagePreView = dynamic_cast< SwPagePreView * >(pView);
+ if (xController.is())
+ {
+ if (pView && pView->GetController() == xController)
+ break;
+ }
+ else if (pSwView || pSwSrcView)
+ break;
pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False );
}
- return pSwView ? pSwView : dynamic_cast< SwView * >(pSwPagePreView);
+ DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" );
+ if (pView)
+ rbIsSwSrcView = pSwSrcView != 0;
+ return pView;
+// return pSwView ? dynamic_cast< SfxViewShell * >(pSwView) :
+// (pSwSrcView ? dynamic_cast< SfxViewShell * >(pSwSrcView) :
+// dynamic_cast< SfxViewShell * >(pSwPagePreView) );
}
-/* -----------------------------23.08.02 16:00--------------------------------
- ---------------------------------------------------------------------------*/
void SAL_CALL SwXTextDocument::render(
sal_Int32 nRenderer,
const uno::Any& rSelection,
@@ -2720,121 +2954,143 @@ void SAL_CALL SwXTextDocument::render(
::vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw RuntimeException();
- SfxViewShell *pView = GuessViewShell();
- SwDoc *pDoc = GetRenderDoc( pView, rSelection );
- if (!pDoc || !pView)
- throw RuntimeException();
// due to #110067# (document page count changes sometimes during
// PDF export/printing) we can not check for the upper bound properly.
// Thus instead of throwing the exception we silently return.
- if (!(0 <= nRenderer /* && nRenderer < pDoc->GetPageCount()*/))
+ if (0 > nRenderer)
throw IllegalArgumentException();
- if (nRenderer >= pDoc->GetPageCount())
- return;
-
- // the view shell should be SwView for documents PDF export
- // or SwPagePreView for PDF export of the page preview
- //!! (check for SwView first as in GuessViewShell) !!
- const TypeId aSwViewTypeId = TYPE(SwView);
- ViewShell* pVwSh = pView->IsA(aSwViewTypeId) ?
- ((SwView*)pView)->GetWrtShellPtr() :
- ((SwPagePreView*)pView)->GetViewShell();
- uno::Reference< awt::XDevice > xRenderDevice;
- bool bFirstPage = false;
- bool bLastPage = false;
- rtl::OUString aPages;
- bool bSkipEmptyPages = false;
-
- for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
- {
- if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) )
- rxOptions[ nProperty].Value >>= xRenderDevice;
- else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ) )
- rxOptions[ nProperty].Value >>= bFirstPage;
- else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ) )
- rxOptions[ nProperty].Value >>= bLastPage;
- else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) )
- rxOptions[ nProperty].Value >>= aPages;
- else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ) )
- rxOptions[ nProperty].Value >>= bSkipEmptyPages;
- }
-
- OutputDevice* pOut = 0;
- if (xRenderDevice.is())
- {
- VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- pOut = pDevice ? pDevice->GetOutputDevice() : 0;
- }
-
- if(pVwSh && pOut)
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." );
+ DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." );
+ if (!bIsSwSrcView && !m_pRenderData)
+ m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ m_pPrintUIOptions->processProperties( rxOptions );
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (pDoc && pView)
{
- SwPrtOptions aOptions( C2U("PDF export") );
-
- const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
- BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
- SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL );
-
- Range aPageRange( nRenderer+1, nRenderer+1 );
- MultiSelection aPage( aPageRange );
- aPage.SetTotalRange( Range( 0, RANGE_MAX ) );
- aPage.Select( aPageRange );
- aOptions.aMulti = aPage;
-
- //! 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,
- //! aOptions.bPrintSelection parameter will be false.
- aOptions.bPrintSelection = FALSE;
-
- SwViewOptionAdjust_Impl* pViewOptionAdjust = pView->IsA(aSwViewTypeId) ?
- new SwViewOptionAdjust_Impl(*((SwView*)pView)->GetWrtShellPtr()) : 0;
-
-
- pVwSh->SetPDFExportOption( sal_True );
-
- // --> FME 2004-06-08 #i12836# enhanced pdf export
- //
- // First, we have to export hyperlinks, notes, and outline to pdf.
- // During this process, additional information required for tagging
- // the pdf file are collected, which are evaulated during painting.
- //
- SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ?
- ((SwView*)pView)->GetWrtShellPtr() :
- 0;
-
- if ( bFirstPage && pWrtShell )
+ sal_Int32 nMaxRenderer = 0;
+ if (!bIsSwSrcView)
{
- SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_False );
+ DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" );
+ nMaxRenderer = bPrintProspect?
+ m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
+ m_pRenderData->GetPagesToPrint().size() - 1;
}
- // <--
-
- pVwSh->Prt( aOptions, 0, pOut );
-
- // --> FME 2004-10-08 #i35176#
- //
- // After printing the last page, we take care for the links coming
- // from the EditEngine. The links are generated during the painting
- // process, but the destinations are still missing.
- //
- if ( bLastPage && pWrtShell )
- {
- SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_True );
- }
- // <--
-
- pVwSh->SetPDFExportOption( sal_False );
- // #i96167# haggai: delete pViewOptionsAdjust here because it makes use
- // of the shell, which might get destroyed in lcl_DisposeView!
- delete pViewOptionAdjust;
-
- if( bLastPage && m_pHiddenViewFrame)
+ // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
+ // we obmit checking of the upper bound in this case.
+ if (bIsSwSrcView || nRenderer <= nMaxRenderer)
{
- lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
- m_pHiddenViewFrame = 0;
+ if (bIsSwSrcView)
+ {
+ SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView);
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false );
+ }
+ else
+ {
+ // the view shell should be SwView for documents PDF export
+ // or SwPagePreView for PDF export of the page preview
+ //!! (check for SwView first as in GuessViewShell) !!
+ DBG_ASSERT( pView, "!! view missing !!" );
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ ViewShell* pVwSh = 0;
+ if (pView)
+ {
+ pVwSh = pView->IsA(aSwViewTypeId) ?
+ ((SwView*)pView)->GetWrtShellPtr() :
+ ((SwPagePreView*)pView)->GetViewShell();
+ }
+
+ // get output device to use
+ OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
+
+ if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions())
+ {
+ const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() );
+ const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False );
+ bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+
+ DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust())
+ || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()),
+ "SwView / SwViewOptionAdjust_Impl availability mismatch" );
+
+ // since printing now also use the API for PDF export this option
+ // should be set for printing as well ...
+ pVwSh->SetPDFExportOption( sal_True );
+
+ // --> FME 2004-06-08 #i12836# enhanced pdf export
+ //
+ // First, we have to export hyperlinks, notes, and outline to pdf.
+ // During this process, additional information required for tagging
+ // the pdf file are collected, which are evaulated during painting.
+ //
+ SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ?
+ ((SwView*)pView)->GetWrtShellPtr() :
+ 0;
+
+ if (bIsPDFExport && bFirstPage && pWrtShell)
+ {
+ SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False );
+ }
+ // <--
+
+ const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions();
+ if (bPrintProspect)
+ pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer );
+ else // normal printing and PDF export
+ pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer );
+
+ // --> FME 2004-10-08 #i35176#
+ //
+ // After printing the last page, we take care for the links coming
+ // from the EditEngine. The links are generated during the painting
+ // process, but the destinations are still missing.
+ //
+ if (bIsPDFExport && bLastPage && pWrtShell)
+ {
+ SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True );
+ }
+ // <--
+
+ pVwSh->SetPDFExportOption( sal_False );
+
+ // last page to be rendered? (not necessarily the last page of the document)
+ // -> do clean-up of data
+ if (bLastPage)
+ {
+ // #i96167# haggai: delete ViewOptionsAdjust here because it makes use
+ // of the shell, which might get destroyed in lcl_DisposeView!
+ if (m_pRenderData && m_pRenderData->IsViewOptionAdjust())
+ m_pRenderData->ViewOptionAdjustStop();
+
+ if (m_pRenderData && m_pRenderData->HasPostItData())
+ m_pRenderData->DeletePostItData();
+ if (m_pHiddenViewFrame)
+ {
+ lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
+ m_pHiddenViewFrame = 0;
+ }
+ }
+ }
+ }
}
}
+ if( bLastPage )
+ {
+ delete m_pRenderData; m_pRenderData = NULL;
+ delete m_pPrintUIOptions; m_pPrintUIOptions = NULL;
+ }
}
/* -----------------------------03.10.04 -------------------------------------
@@ -3789,3 +4045,80 @@ void SwXDocumentPropertyHelper::onChange()
if(m_pDoc)
m_pDoc->SetModified();
}
+
+
+/*****************************************************************************/
+
+SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwViewOption &rViewOptions ) :
+ m_rShell( rSh ),
+ m_aOldViewOptions( rViewOptions )
+{
+}
+
+
+SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
+{
+ m_rShell.ApplyViewOptions( m_aOldViewOptions );
+}
+
+
+void SwViewOptionAdjust_Impl::AdjustViewOptions(
+ const SwPrtOptions *pPrtOptions )
+{
+ // to avoid unnecessary reformatting the view options related to the content
+ // below should only change if necessary, that is if respective content is present
+ const bool bContainsHiddenChars = m_rShell.GetDoc()->ContainsHiddenChars();
+ const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENTXTFLD );
+ const bool bContainsHiddenFields = pFldType && pFldType->GetDepends();
+ pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENPARAFLD );
+ const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends();
+ pFldType = m_rShell.GetDoc()->GetSysFldType( RES_JUMPEDITFLD );
+ const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends();
+ const bool bContainsFields = m_rShell.IsAnyFieldInDoc();
+
+ SwViewOption aRenderViewOptions( m_aOldViewOptions );
+
+ // disable anything in the view that should not be printed (or exported to PDF) by default
+ // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids"
+ // in section "Display of ...")
+ aRenderViewOptions.SetParagraph( FALSE ); // paragraph end
+ aRenderViewOptions.SetSoftHyph( FALSE ); // aka custom hyphens
+ aRenderViewOptions.SetBlank( FALSE ); // spaces
+ aRenderViewOptions.SetHardBlank( FALSE ); // non-breaking spaces
+ aRenderViewOptions.SetTab( FALSE ); // tabs
+ aRenderViewOptions.SetLineBreak( FALSE ); // breaks (type 1)
+ aRenderViewOptions.SetPageBreak( FALSE ); // breaks (type 2)
+ aRenderViewOptions.SetColumnBreak( FALSE ); // breaks (type 3)
+ BOOL bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : FALSE;
+ if (bContainsHiddenChars)
+ aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text
+ if (bContainsHiddenFields)
+ aRenderViewOptions.SetShowHiddenField( bVal );
+ if (bContainsHiddenParagraphs)
+ aRenderViewOptions.SetShowHiddenPara( bVal );
+
+ if (bContainsPlaceHolders)
+ {
+ // should always be printed in PDF export!
+ bVal = pPrtOptions ? pPrtOptions->bPrintTextPlaceholder : TRUE;
+ aRenderViewOptions.SetShowPlaceHolderFields( bVal );
+ }
+
+ if (bContainsFields)
+ aRenderViewOptions.SetFldName( FALSE );
+
+ // we need to set this flag in order to get to see the visible effect of
+ // some of the above settings (needed for correct rendering)
+ aRenderViewOptions.SetViewMetaChars( TRUE );
+
+ if (m_aOldViewOptions != aRenderViewOptions) // check if reformatting is necessary
+ {
+ aRenderViewOptions.SetPrinting( pPrtOptions != NULL );
+ m_rShell.ApplyViewOptions( aRenderViewOptions );
+ }
+}
+
+
+/*****************************************************************************/
+
+
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index de8bcd61ee..e2b40a8a9e 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -77,6 +77,10 @@
#include <SwStyleNameMapper.hxx>
#include <crsskip.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <unobookmark.hxx>
+#include <unoparagraph.hxx>
+#include <unocrsrhelper.hxx>
+#include <unotextrange.hxx>
#include <svx/editview.hxx>
#include <sfx2/docfile.hxx>
@@ -104,24 +108,8 @@ SV_IMPL_PTRARR( SelectionChangeListenerArr, XSelectionChangeListenerPtr );
* --------------------------------------------------*/
SwPaM* lcl_createPamCopy(const SwPaM& rPam)
{
- SwPaM* pRet = new SwPaM(*rPam.GetPoint());
- if(rPam.HasMark())
- {
- pRet->SetMark();
- *pRet->GetMark() = *rPam.GetMark();
- }
- if(rPam.GetNext() != (const Ring*)&rPam)
- {
- SwPaM *_pStartCrsr = (SwPaM *)rPam.GetNext();
- do
- {
- //neuen PaM erzeugen
- SwPaM* pPaM = new SwPaM(*_pStartCrsr);
- //und in den Ring einfuegen
- pPaM->MoveTo(pRet);
-
- } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != rPam.GetNext() );
- }
+ SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
+ ::sw::DeepCopyPaM(rPam, *pRet);
return pRet;
}
/******************************************************************
@@ -329,8 +317,9 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg
: 0;
if(pCursor && pCursor->GetDoc() == GetView()->GetDocShell()->GetDoc())
- pPam = lcl_createPamCopy(*((SwXTextCursor*)pCursor)->GetPaM());
-
+ {
+ pPam = lcl_createPamCopy(*pCursor->GetPaM());
+ }
}
else if(xPosN.is() &&
xIfcTunnel.is() &&
@@ -346,7 +335,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg
else if(!pFrame && !pCell && xPos.is())
{
SwUnoInternalPaM aPam(*pDoc);
- if(SwXTextRange::XTextRangeToSwPaM(aPam, xPos))
+ if (::sw::XTextRangeToSwPaM(aPam, xPos))
{
pPam = lcl_createPamCopy(aPam);
}
@@ -429,19 +418,14 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg
if(xBkm.is() && xIfcTunnel.is())
{
- SwXBookmark* pBkm = reinterpret_cast<SwXBookmark*>(
- xIfcTunnel->getSomething(SwXBookmark::getUnoTunnelId()));
- if(pBkm && pBkm->GetDoc() == pDoc)
+ ::sw::mark::IMark const*const pMark(
+ SwXBookmark::GetBookmarkInDoc(pDoc, xIfcTunnel) );
+ if (pMark)
{
- IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
- IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(pBkm->getName());
- if( ppMark != pMarkAccess->getMarksEnd() )
- {
- rSh.EnterStdMode();
- rSh.GotoMark( ppMark->get() );
- }
- return sal_True;
+ rSh.EnterStdMode();
+ rSh.GotoMark(pMark);
}
+ return sal_True;
}
// IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
//
@@ -721,7 +705,7 @@ uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< a
/*-- 08.03.07 13:55------------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< form::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException)
+uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException)
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -731,7 +715,7 @@ uno::Reference< form::XFormController > SAL_CALL SwXTextView::getFormController(
Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
- uno::Reference< form::XFormController > xController;
+ uno::Reference< form::runtime::XFormController > xController;
if ( pFormShell && pDrawView && pWindow )
xController = pFormShell->GetFormController( _Form, *pDrawView, *pWindow );
return xController;
@@ -1379,8 +1363,10 @@ void SwXTextViewCursor::gotoRange(
throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
- if(!SwXTextRange::XTextRangeToSwPaM( rDestPam, xRange))
- throw IllegalArgumentException();
+ if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
+ {
+ throw uno::RuntimeException();
+ }
ShellModes eSelMode = m_pView->GetShellMode();
SwWrtShell& rSh = m_pView->GetWrtShell();
@@ -1435,10 +1421,13 @@ void SwXTextViewCursor::gotoRange(
{
pSrcNode = pCursor->GetPaM()->GetNode();
}
- else if(pRange && pRange->GetBookmark())
+ else if (pRange)
{
- const ::sw::mark::IMark* const pBkmk = pRange->GetBookmark();
- pSrcNode = &(pBkmk->GetMarkPos().nNode.GetNode());
+ SwPaM aPam(pRange->GetDoc()->GetNodes());
+ if (pRange->GetPositions(aPam))
+ {
+ pSrcNode = aPam.GetNode();
+ }
}
else if (pPara && pPara->GetTxtNode())
{
@@ -1713,9 +1702,7 @@ uno::Reference< text::XText > SwXTextViewCursor::getText(void) throw( uno::Runt
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- uno::Reference< text::XTextRange > xRg = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->Start(), 0);
- xRet = xRg->getText();
+ xRet = ::sw::CreateParentXText(*pDoc, *pShellCrsr->Start());
}
else
throw uno::RuntimeException();
@@ -1736,8 +1723,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getStart(void) throw( uno
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->Start(), 0);
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->Start(), 0);
}
else
throw uno::RuntimeException();
@@ -1758,8 +1744,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd(void) throw( uno::
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->End(), 0);
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->End(), 0);
}
else
throw uno::RuntimeException();
@@ -1791,7 +1776,7 @@ OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException )
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- SwXTextCursor::getTextFromPam(*pShellCrsr, uRet);
+ SwUnoCursorHelper::GetTextFromPam(*pShellCrsr, uRet);
}
default:;//prevent warning
}
@@ -1823,7 +1808,7 @@ void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeEx
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwCursor* pShellCrsr = rSh.GetSwCrsr();
- SwXTextCursor::SetString( *pShellCrsr, aString );
+ SwUnoCursorHelper::SetString(*pShellCrsr, aString);
}
default:;//prevent warning
}
@@ -1852,7 +1837,10 @@ void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const
SwPaM* pShellCrsr = rSh.GetCrsr();
SwNode *pNode = pShellCrsr->GetNode();
if (pNode && pNode->IsTxtNode())
- SwXTextCursor::SetPropertyValue(*pShellCrsr, *m_pPropSet, rPropertyName, aValue );
+ {
+ SwUnoCursorHelper::SetPropertyValue(
+ *pShellCrsr, *m_pPropSet, rPropertyName, aValue );
+ }
else
throw RuntimeException();
}
@@ -1871,7 +1859,8 @@ Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- aRet = SwXTextCursor::GetPropertyValue( *pShellCrsr, *m_pPropSet, rPropertyName);
+ aRet = SwUnoCursorHelper::GetPropertyValue(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
}
else
throw RuntimeException();
@@ -1920,7 +1909,8 @@ PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyNam
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- eState = SwXTextCursor::GetPropertyState( *pShellCrsr, *m_pPropSet, rPropertyName);
+ eState = SwUnoCursorHelper::GetPropertyState(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
}
else
throw RuntimeException();
@@ -1938,7 +1928,8 @@ Sequence< PropertyState > SwXTextViewCursor::getPropertyStates(
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- aRet = SwXTextCursor::GetPropertyStates(*pShellCrsr, *m_pPropSet, rPropertyNames);
+ aRet = SwUnoCursorHelper::GetPropertyStates(
+ *pShellCrsr, *m_pPropSet, rPropertyNames);
}
return aRet;
}
@@ -1953,7 +1944,8 @@ void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- SwXTextCursor::SetPropertyToDefault( *pShellCrsr, *m_pPropSet, rPropertyName);
+ SwUnoCursorHelper::SetPropertyToDefault(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
}
}
/*-- 29.06.00 17:33:43---------------------------------------------------
@@ -1968,7 +1960,8 @@ Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
{
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
- aRet = SwXTextCursor::GetPropertyDefault( *pShellCrsr, *m_pPropSet, rPropertyName);
+ aRet = SwUnoCursorHelper::GetPropertyDefault(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
}
return aRet;
}
@@ -2214,5 +2207,6 @@ void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfe
}
}
}
+
// -----------------------------------------------------------------------------