From c1d1c0cbe28ac55eea80afa97c5f7828324e9ade Mon Sep 17 00:00:00 2001
From: Daniel Mihalyi <[email protected]>
Date: Tue, 14 Feb 2012 17:33:38 +0100
Subject: [PATCH] Added SwDocStub class
---
sw/source/core/doc/docnew.cxx | 9 +++++++++
sw/source/core/layout/layouter.cxx | 1 +
sw/source/filter/basflt/docfact.cxx | 18 +++++++++++++++++-
3 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index d3e1ad5..66c5afd 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -28,6 +28,7 @@
#define ROLBCK_HISTORY_ONLY // The fight against the CLOOK's
#include <doc.hxx>
+#include <docStub.hxx>
#include <dcontact.hxx>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
@@ -205,6 +206,10 @@ sal_Bool lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
/*
* exported methods
*/
+SwDocStub::SwDocStub() {
+
+}
+
SwDoc::SwDoc()
: m_pNodes( new SwNodes(this) )
,
@@ -443,6 +448,10 @@ SwDoc::SwDoc()
ResetModified();
}
+SwDocStub::~SwDocStub() {
+
+}
+
/*
* Speciality: a member of the class SwDoc is located at
* position 0 in the array of the Format and GDI objects.
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index 344b388..cbdb1ea 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -327,6 +327,7 @@ sal_Bool SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage )
OSL_ENSURE( pDoc, "No doc, no fun" );
if( !pDoc->GetLayouter() )
pDoc->SetLayouter( new SwLayouter() );
+ if(!pDoc->GetLayouter()) return false;
return !pDoc->GetLayouter()->pLooping &&
pDoc->GetLayouter()->StartLooping( pPage );
}
diff --git a/sw/source/filter/basflt/docfact.cxx b/sw/source/filter/basflt/docfact.cxx
index 15a5d27..982ae5e 100644
--- a/sw/source/filter/basflt/docfact.cxx
+++ b/sw/source/filter/basflt/docfact.cxx
@@ -28,9 +28,11 @@
#include <shellio.hxx>
#include <doc.hxx>
+#include <docStub.hxx>
#include <node.hxx>
#include <cmdid.h>
+#include "../../../../sal/rtl/source/cmdargs.cxx"
/******************************************************************************
@@ -64,8 +66,22 @@ SwDoc *SwDocFac::GetDoc()
{
if( !pDoc )
{
- pDoc = new SwDoc;
+ rtl_uString* pCommandArg = NULL;
+ sal_uInt32 nCommandArgs = rtl_getAppCommandArgCount();
+ rtl_uString* with = NULL;
+ rtl_uString_newFromAscii(&with, "-with-swdoc-stub");
+ sal_uInt32 i;
+ for ( i = 0; i < nCommandArgs; i++ ) {
+ rtl_getAppCommandArg( i, &pCommandArg);
+ if(!rtl_ustr_compare(rtl_uString_getStr(pCommandArg),rtl_uString_getStr(with))) {
+ pDoc = new SwDocStub;
+ break;
+ }
+ }
+ if(i == nCommandArgs) pDoc = new SwDoc;
pDoc->acquire();
+ if(pCommandArg) rtl_uString_release(pCommandArg);
+ rtl_uString_release(with);
}
return pDoc;
}
--
1.7.9
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice