summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-21 19:01:55 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-21 19:01:55 +0200
commit834e0a54701f7511159b84cd1dc1203f8f8846b4 (patch)
treec577104ff9e1f6477439c13037aa7bb508e225e3
parent78b298eba8bb9d99361bac845fa1b042db2d06a6 (diff)
parent9298050e22cddecf42d5b541d92f5ded5ec7ba3c (diff)
resyncing to master
-rw-r--r--starmath/CppunitTest_starmath_qa_cppunit.mk7
-rw-r--r--starmath/Library_sm.mk6
-rw-r--r--starmath/Library_smd.mk6
-rw-r--r--starmath/inc/document.hxx4
-rw-r--r--starmath/prj/build.lst2
-rw-r--r--starmath/source/detreg.cxx2
-rw-r--r--starmath/source/document.cxx6
-rw-r--r--starmath/source/edit.cxx2
-rw-r--r--starmath/source/mathtype.hxx6
-rw-r--r--starmath/source/node.cxx6
-rw-r--r--starmath/source/register.cxx2
-rw-r--r--starmath/source/toolbox.cxx12
-rw-r--r--starmath/source/view.cxx5
-rw-r--r--starmath/source/visitors.cxx2
-rw-r--r--starmath/util/sm.component2
-rw-r--r--starmath/util/smd.component2
-rw-r--r--sw/CppunitTest_sw_swdoc_test.mk13
-rw-r--r--sw/CppunitTest_sw_test_filters.mk15
-rw-r--r--sw/Library_msword.mk6
-rw-r--r--sw/Library_sw.mk6
-rw-r--r--sw/Library_swd.mk6
-rw-r--r--sw/Library_swui.mk6
-rw-r--r--sw/Library_vbaswobj.mk7
-rw-r--r--sw/inc/PostItMgr.hxx2
-rw-r--r--sw/inc/cmdid.h1
-rw-r--r--sw/inc/comcore.hrc3
-rw-r--r--sw/inc/crsrsh.hxx5
-rw-r--r--sw/inc/extinput.hxx9
-rw-r--r--sw/inc/fesh.hxx1
-rw-r--r--sw/inc/ftnidx.hxx9
-rw-r--r--sw/inc/shellio.hxx1
-rw-r--r--sw/inc/viewsh.hxx4
-rw-r--r--sw/prj/build.lst2
-rw-r--r--sw/qa/core/data/rtf/fail/CVE-2005-2971-1.rtf11
-rw-r--r--sw/qa/core/data/rtf/indeterminate/.gitignore (renamed from sw/qa/core/data/rtf/fail/.gitignore)0
-rw-r--r--sw/qa/core/data/rtf/pass/CVE-2005-2964.rtf11
-rw-r--r--sw/qa/core/data/rtf/pass/CVE-2005-2972-1.rtf57
-rw-r--r--sw/qa/core/data/rtf/pass/CVE-2005-2972-2.rtf57
-rw-r--r--sw/qa/core/data/rtf/pass/CVE-2010-3333-1.rtfbin0 -> 11289 bytes
-rw-r--r--sw/qa/core/data/ww8/fail/CVE-2005-0941-1.docbin0 -> 32256 bytes
-rw-r--r--sw/qa/core/data/ww8/fail/CVE-2006-2389-1.docbin0 -> 98816 bytes
-rw-r--r--sw/qa/core/data/ww8/fail/CVE-2008-0320-1.docbin0 -> 116224 bytes
-rw-r--r--sw/qa/core/data/ww8/indeterminate/.gitignore0
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2006-3493-1.docbin0 -> 48128 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2006-6561-1.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2006-6628-1.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2007-1347-1.docbin0 -> 24064 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-1.docbin0 -> 25088 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-2.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-3.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-4.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-4841-1.docbin0 -> 101888 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2009-0259-1.docbin0 -> 101888 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2010-3200-1.docbin0 -> 48128 bytes
-rw-r--r--sw/qa/core/data/xml/indeterminate/.gitignore0
-rw-r--r--sw/qa/core/filters-test.cxx76
-rw-r--r--sw/sdi/_textsh.sdi6
-rw-r--r--sw/sdi/swriter.sdi27
-rw-r--r--sw/source/core/crsr/crsrsh.cxx61
-rw-r--r--sw/source/core/crsr/findtxt.cxx26
-rw-r--r--sw/source/core/doc/doc.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx22
-rw-r--r--sw/source/core/doc/docedt.cxx8
-rw-r--r--sw/source/core/doc/docfld.cxx14
-rw-r--r--sw/source/core/doc/docfmt.cxx2
-rw-r--r--sw/source/core/doc/docnew.cxx59
-rw-r--r--sw/source/core/doc/extinput.cxx8
-rw-r--r--sw/source/core/doc/ftnidx.cxx6
-rw-r--r--sw/source/core/doc/notxtfrm.cxx37
-rw-r--r--sw/source/core/doc/poolfmt.cxx8
-rw-r--r--sw/source/core/docnode/ndcopy.cxx21
-rw-r--r--sw/source/core/docnode/ndtbl.cxx16
-rw-r--r--sw/source/core/edit/edfld.cxx2
-rw-r--r--sw/source/core/fields/reffld.cxx2
-rw-r--r--sw/source/core/frmedt/feshview.cxx13
-rw-r--r--sw/source/core/frmedt/fews.cxx12
-rw-r--r--sw/source/core/inc/UndoTable.hxx28
-rw-r--r--sw/source/core/inc/frame.hxx4
-rw-r--r--sw/source/core/inc/mvsave.hxx7
-rw-r--r--sw/source/core/inc/pagefrm.hxx2
-rw-r--r--sw/source/core/inc/scriptinfo.hxx25
-rw-r--r--sw/source/core/layout/dbg_lay.cxx220
-rw-r--r--sw/source/core/layout/dumpfilter.cxx4
-rw-r--r--sw/source/core/layout/ftnfrm.cxx2
-rw-r--r--sw/source/core/layout/laycache.cxx24
-rw-r--r--sw/source/core/layout/layhelp.hxx7
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx208
-rw-r--r--sw/source/core/layout/tabfrm.cxx4
-rw-r--r--sw/source/core/layout/trvlfrm.cxx68
-rw-r--r--sw/source/core/layout/wsfrm.cxx20
-rw-r--r--sw/source/core/sw3io/sw3convert.cxx108
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks.cxx21
-rw-r--r--sw/source/core/table/swtable.cxx8
-rwxr-xr-xsw/source/core/text/frmform.cxx11
-rw-r--r--sw/source/core/text/frmpaint.cxx6
-rw-r--r--sw/source/core/text/inftxt.cxx3
-rw-r--r--sw/source/core/text/inftxt.hxx8
-rw-r--r--sw/source/core/text/itradj.cxx9
-rw-r--r--sw/source/core/text/itrcrsr.cxx24
-rw-r--r--sw/source/core/text/porlay.cxx4
-rw-r--r--sw/source/core/text/porlay.hxx9
-rw-r--r--sw/source/core/text/pormulti.cxx7
-rw-r--r--sw/source/core/text/redlnitr.cxx9
-rw-r--r--sw/source/core/text/redlnitr.hxx13
-rw-r--r--sw/source/core/text/txtfly.cxx19
-rw-r--r--sw/source/core/text/txtfrm.cxx7
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx4
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx9
-rw-r--r--sw/source/core/txtnode/txtedt.cxx67
-rw-r--r--sw/source/core/undo/undo.src2
-rw-r--r--sw/source/core/undo/untbl.cxx131
-rw-r--r--sw/source/core/view/printdata.cxx2
-rw-r--r--sw/source/core/view/viewsh.cxx7
-rw-r--r--sw/source/core/view/vnew.cxx2
-rw-r--r--sw/source/filter/html/css1atr.cxx195
-rw-r--r--sw/source/filter/html/htmlatr.cxx42
-rw-r--r--sw/source/filter/html/htmlplug.cxx6
-rw-r--r--sw/source/filter/html/svxcss1.cxx35
-rw-r--r--sw/source/filter/html/wrthtml.hxx8
-rw-r--r--sw/source/filter/inc/fltshell.hxx83
-rw-r--r--sw/source/filter/inc/msfilter.hxx23
-rw-r--r--sw/source/filter/writer/writer.cxx8
-rw-r--r--sw/source/filter/ww1/fltshell.cxx363
-rw-r--r--sw/source/filter/ww8/WW8Sttbf.cxx54
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx66
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx20
-rw-r--r--sw/source/filter/ww8/docxexport.cxx22
-rw-r--r--sw/source/filter/ww8/docxexport.hxx3
-rw-r--r--sw/source/filter/ww8/docxexportfilter.cxx11
-rw-r--r--sw/source/filter/ww8/escher.hxx2
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx7
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.hxx6
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx9
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx7
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx43
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx8
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx11
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx104
-rw-r--r--sw/source/filter/ww8/ww8par.cxx340
-rw-r--r--sw/source/filter/ww8/ww8par.hxx201
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx162
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx121
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx358
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx43
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx147
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx848
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx51
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx25
-rw-r--r--sw/source/filter/xml/xmlexpit.cxx14
-rw-r--r--sw/source/filter/xml/xmlexpit.hxx6
-rw-r--r--sw/source/filter/xml/xmlimp.cxx20
-rw-r--r--sw/source/filter/xml/xmltexte.cxx2
-rw-r--r--sw/source/ui/app/app.src10
-rwxr-xr-xsw/source/ui/app/docsh2.cxx2
-rw-r--r--sw/source/ui/app/mn.src1
-rw-r--r--sw/source/ui/config/usrpref.cxx14
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx64
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.cxx4
-rw-r--r--sw/source/ui/docvw/edtwin.cxx18
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx11
-rw-r--r--sw/source/ui/envelp/label1.cxx6
-rw-r--r--sw/source/ui/inc/label.hxx9
-rwxr-xr-xsw/source/ui/inc/view.hxx3
-rw-r--r--sw/source/ui/misc/pggrid.cxx3
-rw-r--r--sw/source/ui/misc/titlepage.cxx8
-rw-r--r--sw/source/ui/shells/grfsh.cxx2
-rw-r--r--sw/source/ui/shells/textsh1.cxx27
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx67
-rw-r--r--sw/source/ui/uno/detreg.cxx9
-rw-r--r--sw/source/ui/uno/unofreg.cxx9
-rw-r--r--sw/source/ui/vba/service.cxx22
-rw-r--r--sw/source/ui/vba/vbadocument.cxx4
-rw-r--r--sw/source/ui/vba/vbafield.cxx3
-rwxr-xr-xsw/uiconfig/sglobal/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/sglobal/toolbar/standardbar.xml2
-rw-r--r--sw/uiconfig/sweb/toolbar/standardbar.xml2
-rwxr-xr-xsw/uiconfig/swform/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/swform/toolbar/standardbar.xml2
-rwxr-xr-xsw/uiconfig/swreport/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/swreport/toolbar/standardbar.xml2
-rwxr-xr-xsw/uiconfig/swriter/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/swriter/toolbar/standardbar.xml2
-rwxr-xr-xsw/uiconfig/swxform/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/swxform/toolbar/standardbar.xml2
-rw-r--r--sw/util/msword.component3
-rw-r--r--sw/util/sw.component3
-rw-r--r--sw/util/swd.component2
-rw-r--r--sw/util/vbaswobj.component2
190 files changed, 3394 insertions, 2255 deletions
diff --git a/starmath/CppunitTest_starmath_qa_cppunit.mk b/starmath/CppunitTest_starmath_qa_cppunit.mk
index 0f4606a2064e..1713710c9762 100644
--- a/starmath/CppunitTest_starmath_qa_cppunit.mk
+++ b/starmath/CppunitTest_starmath_qa_cppunit.mk
@@ -32,7 +32,11 @@ $(eval $(call gb_CppunitTest_set_include,starmath_qa_cppunit,\
-I$(realpath $(SRCDIR)/starmath/inc) \
-I$(realpath $(SRCDIR)/starmath/inc/pch) \
-I$(OUTDIR)/inc \
- -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_CppunitTest_add_api,starmath_qa_cppunit,\
+ offapi \
+ udkapi \
))
$(eval $(call gb_CppunitTest_set_defs,starmath_qa_cppunit,\
@@ -86,6 +90,7 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,starmath_qa_cppunit,\
$(eval $(call gb_CppunitTest_set_args,starmath_qa_cppunit,\
--headless \
--invisible \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
))
$(eval $(call gb_RdbTarget_RdbTarget,starmath_qa_cppunit))
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index 7e5162fe6637..6d9e05efd51a 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -32,10 +32,14 @@ $(eval $(call gb_Library_set_include,sm,\
-I$(realpath $(SRCDIR)/starmath/inc) \
-I$(WORKDIR)/SdiTarget/starmath/sdi \
$$(INCLUDE) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
+))
+
+$(eval $(call gb_Library_add_api,sm,\
+ offapi \
+ udkapi \
$(eval $(call gb_Library_add_linked_libs,sm,\
comphelper \
cppu \
diff --git a/starmath/Library_smd.mk b/starmath/Library_smd.mk
index 5653614c956b..995cd77c1df9 100644
--- a/starmath/Library_smd.mk
+++ b/starmath/Library_smd.mk
@@ -35,7 +35,11 @@ $(eval $(call gb_Library_set_include,smd,\
$$(INCLUDE) \
-I$(SRCDIR)/starmath/inc \
-I$(SRCDIR)/starmath/inc/pch \
- -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_add_api,smd,\
+ offapi \
+ udkapi \
))
$(eval $(call gb_Library_add_linked_libs,smd,\
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 97753d9446e1..562763e12fc8 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -100,9 +100,7 @@ public:
////////////////////////////////////////////////////////////
-void SetEditEngineDefaultFonts(
- EditEngine &rEditEngine,
- SfxItemPool &rEditEngineItemPool );
+void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool);
////////////////////////////////////////////////////////////
diff --git a/starmath/prj/build.lst b/starmath/prj/build.lst
index 6b60a031bd13..924ca7fd9e81 100644
--- a/starmath/prj/build.lst
+++ b/starmath/prj/build.lst
@@ -1,2 +1,2 @@
-sm starmath : LIBXSLT:libxslt TRANSLATIONS:translations svx configmgr dtrans ure NULL
+sm starmath : LIBXSLT:libxslt TRANSLATIONS:translations svx configmgr dtrans ure test NULL
sm starmath\prj nmake - all sm_prj NULL
diff --git a/starmath/source/detreg.cxx b/starmath/source/detreg.cxx
index 366b64d8abbe..be0fe1135d49 100644
--- a/starmath/source/detreg.cxx
+++ b/starmath/source/detreg.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::lang;
extern "C" {
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL smd_component_getFactory( const sal_Char* pImplementationName,
void* pServiceManager,
void* /*pRegistryKey*/ )
{
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 337e038df69e..b0ec43e32615 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -325,9 +325,7 @@ void SmDocShell::ArrangeFormula()
}
-void SetEditEngineDefaultFonts(
- EditEngine &/*rEditEngine*/,
- SfxItemPool &rEditEngineItemPool )
+void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool)
{
//
// set fonts to be used
@@ -394,7 +392,7 @@ EditEngine& SmDocShell::GetEditEngine()
pEditEngineItemPool = EditEngine::CreatePool();
- SetEditEngineDefaultFonts( *pEditEngine, *pEditEngineItemPool );
+ SetEditEngineDefaultFonts(*pEditEngineItemPool);
pEditEngine = new EditEngine( pEditEngineItemPool );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index bfc0309ebe71..0779c823052c 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -250,7 +250,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& )
pEditEngine->SetDefTab( sal_uInt16( GetTextWidth( C2S("XXXX") ) ) );
- SetEditEngineDefaultFonts( *pEditEngine, *pEditEngineItemPool );
+ SetEditEngineDefaultFonts(*pEditEngineItemPool);
// forces new settings to be used
// unfortunately this resets the whole edit engine
diff --git a/starmath/source/mathtype.hxx b/starmath/source/mathtype.hxx
index cfacad560290..e37d388f8e8a 100644
--- a/starmath/source/mathtype.hxx
+++ b/starmath/source/mathtype.hxx
@@ -64,14 +64,16 @@ class MathType
public:
MathType(String &rIn) :
rRet(rIn), nHAlign(0), nVAlign(0), nDefaultSize(12),
- nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), bIsSilent(sal_False)
+ nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), bIsSilent(sal_False),
+ nTypeFace(0)
{
Init();
}
MathType(String &rIn,SmNode *pIn) :
rRet(rIn), pTree(pIn), nHAlign(2), nVAlign(0), nInsertion(0), nDefaultSize(12),
- nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), nSpec(0), bIsSilent(sal_False)
+ nLSize(0), nDSize(0), nCurSize(0), nLastSize(0), nSpec(0), bIsSilent(sal_False),
+ nTypeFace(0)
{
Init();
}
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 1df2de00ec53..93dbedf73ea5 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -564,7 +564,7 @@ void SmNode::DumpAsDot(std::ostream &out, String* label, int number, int& id, in
eq.SearchAndReplaceAll(String::CreateFromAscii("\\"), String::CreateFromAscii("\\\\"));
eq.SearchAndReplaceAll(String::CreateFromAscii("\""), String::CreateFromAscii("\\\""));
out<<"label= \"Equation: \\\"";
- out<<ByteString( eq, RTL_TEXTENCODING_UTF8).GetBuffer();
+ out<< rtl::OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
out<<"\\\"\";"<<std::endl;
}
}
@@ -605,13 +605,13 @@ void SmNode::DumpAsDot(std::ostream &out, String* label, int number, int& id, in
case NPLACE: out<<"SmPlaceNode"; break;
case NTEXT:
out<<"SmTextNode: ";
- out<< ByteString( ((SmTextNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).GetBuffer();
+ out<< rtl::OUStringToOString(((SmTextNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
break;
case NSPECIAL: out<<"SmSpecialNode"; break;
case NGLYPH_SPECIAL: out<<"SmGlyphSpecialNode"; break;
case NMATH:
out<<"SmMathSymbolNode: ";
- out<< ByteString( ((SmMathSymbolNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).GetBuffer();
+ out<< rtl::OUStringToOString(((SmMathSymbolNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
break;
case NBLANK: out<<"SmBlankNode"; break;
case NERROR: out<<"SmErrorNode"; break;
diff --git a/starmath/source/register.cxx b/starmath/source/register.cxx
index 815e05185f45..ef921342ba07 100644
--- a/starmath/source/register.cxx
+++ b/starmath/source/register.cxx
@@ -112,7 +112,7 @@ extern Reference< XInterface > SAL_CALL
extern "C" {
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pImplementationName,
void* pServiceManager,
void* /*pRegistryKey*/ )
{
diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index e398e6313114..68e15f6079d0 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -238,7 +238,7 @@ void SmToolBoxWindow::StateChanged( StateChangedType nStateChange )
void SmToolBoxWindow::AdjustPosSize( bool bSetPos )
{
Size aCatSize( aToolBoxCat.CalcWindowSizePixel( 2 ) );
- Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( 4 /* see nLines in SetCategory*/ ) );
+ Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( 5 /* see nLines in SetCategory*/ ) );
OSL_ENSURE( aCatSize.Width() == aCmdSize.Width(), "width mismatch" );
// catalog settings
@@ -307,13 +307,13 @@ void SmToolBoxWindow::SetCategory(sal_uInt16 nCategoryRID)
switch (nCategoryRID)
{
case RID_UNBINOPS_CAT : nLines = 4; break;
- case RID_RELATIONS_CAT: nLines = 4; break;
- case RID_SETOPERATIONS_CAT: nLines = 4; break;
- case RID_FUNCTIONS_CAT: nLines = 4; break;
+ case RID_RELATIONS_CAT: nLines = 5; break;
+ case RID_SETOPERATIONS_CAT: nLines = 5; break;
+ case RID_FUNCTIONS_CAT: nLines = 5; break;
case RID_OPERATORS_CAT: nLines = 3; break;
- case RID_ATTRIBUTES_CAT: nLines = 4; break;
+ case RID_ATTRIBUTES_CAT: nLines = 5; break;
case RID_MISC_CAT: nLines = 4; break;
- case RID_BRACKETS_CAT: nLines = 4; break;
+ case RID_BRACKETS_CAT: nLines = 5; break;
case RID_FORMAT_CAT: nLines = 3; break;
default:
// nothing to be done
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index b8e91f8981ed..ffd5413eced8 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -195,6 +195,8 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
if (pNode)
{ SmEditWindow *pEdit = pViewShell->GetEditWindow();
+ if (!pEdit)
+ return;
const SmToken aToken (pNode->GetToken());
// set selection to the beginning of the token
@@ -222,7 +224,8 @@ void SmGraphicWindow::GetFocus()
{
if (!IsInlineEditEnabled())
return;
- pViewShell->GetEditWindow()->Flush();
+ if (pViewShell->GetEditWindow())
+ pViewShell->GetEditWindow()->Flush();
//Let view shell know what insertions should be done in visual editor
pViewShell->SetInsertIntoEditWindow(false);
SetIsCursorVisible(true);
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 5e8a574eab7b..f342b3dbb73a 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -486,7 +486,7 @@ public:
void SetFillColor( const Color& rColor ) { rOutDev.SetFillColor( Impl_GetColor( rColor ) ); }
void SetTextColor( const Color& rColor ) { rOutDev.SetTextColor( Impl_GetColor( rColor ) ); }
- operator OutputDevice & ( ) { return rOutDev; }
+ operator OutputDevice & ( ) const { return rOutDev; }
};
SmTmpDevice2::SmTmpDevice2( OutputDevice &rTheDev, bool bUseMap100th_mm ) :
diff --git a/starmath/util/sm.component b/starmath/util/sm.component
index 8047662e2915..407f0676a12b 100644
--- a/starmath/util/sm.component
+++ b/starmath/util/sm.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="sm"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.Math.FormulaDocument">
<service name="com.sun.star.formula.FormulaProperties"/>
diff --git a/starmath/util/smd.component b/starmath/util/smd.component
index 9f566864482e..70adf5a12753 100644
--- a/starmath/util/smd.component
+++ b/starmath/util/smd.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="smd"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.math.FormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
diff --git a/sw/CppunitTest_sw_swdoc_test.mk b/sw/CppunitTest_sw_swdoc_test.mk
index 9953cea2f5b1..f1c23360b99d 100644
--- a/sw/CppunitTest_sw_swdoc_test.mk
+++ b/sw/CppunitTest_sw_swdoc_test.mk
@@ -34,8 +34,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_swdoc_test, \
sw/qa/core/Test-BigPtrArray \
))
-$(call gb_CxxObject_get_target,sw/qa/core/swdoc-test): $(WORKDIR)/AllLangRes/sw
-
$(eval $(call gb_CppunitTest_add_library_objects,sw_swdoc_test,sw))
$(eval $(call gb_CppunitTest_add_linked_libs,sw_swdoc_test, \
@@ -76,10 +74,14 @@ $(eval $(call gb_CppunitTest_set_include,sw_swdoc_test,\
-I$(realpath $(SRCDIR)/sw/source/ui/inc) \
-I$(realpath $(SRCDIR)/sw/inc) \
$$(INCLUDE) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
+$(eval $(call gb_CppunitTest_add_api,sw_swdoc_test,\
+ offapi \
+ udkapi \
+))
+
$(eval $(call gb_CppunitTest_uses_ure,sw_swdoc_test))
$(eval $(call gb_CppunitTest_add_type_rdbs,sw_swdoc_test,\
@@ -96,6 +98,7 @@ $(call gb_CppunitTest_get_target,sw_swdoc_test) : \
$(eval $(call gb_CppunitTest_set_args,sw_swdoc_test,\
--headless \
--invisible \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
))
$(eval $(call gb_RdbTarget_RdbTarget,sw_swdoc_test))
@@ -114,4 +117,8 @@ $(eval $(call gb_RdbTarget_add_old_components,sw_swdoc_test,\
ucpfile1 \
))
+# we need to explicitly depend on the sw resource files needed at unit-test
+# runtime
+$(call gb_CppunitTest_get_target,sw_swdoc_test) : $(WORKDIR)/AllLangRes/sw
+
# vim: set noet sw=4:
diff --git a/sw/CppunitTest_sw_test_filters.mk b/sw/CppunitTest_sw_test_filters.mk
index 15b3f7a5e9eb..cc49fa677215 100644
--- a/sw/CppunitTest_sw_test_filters.mk
+++ b/sw/CppunitTest_sw_test_filters.mk
@@ -57,10 +57,14 @@ $(eval $(call gb_CppunitTest_set_include,sw_filters_test,\
-I$(realpath $(SRCDIR)/sw/source/ui/inc) \
-I$(realpath $(SRCDIR)/sw/inc) \
$$(INCLUDE) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
+$(eval $(call gb_CppunitTest_add_api,sw_filters_test,\
+ offapi \
+ udkapi \
+))
+
$(eval $(call gb_CppunitTest_uses_ure,sw_filters_test))
$(eval $(call gb_CppunitTest_add_type_rdbs,sw_filters_test,\
@@ -74,6 +78,7 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,sw_filters_test,\
$(eval $(call gb_CppunitTest_set_args,sw_filters_test,\
--headless \
--invisible \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
))
$(eval $(call gb_RdbTarget_RdbTarget,sw_filters_test))
@@ -81,8 +86,11 @@ $(eval $(call gb_RdbTarget_RdbTarget,sw_filters_test))
$(eval $(call gb_RdbTarget_add_components,sw_filters_test,\
sw/util/sw \
sw/util/msword \
+ forms/util/frm \
+ dbaccess/util/dba \
sfx2/util/sfx \
framework/util/fwk \
+ toolkit/util/tk \
unoxml/source/service/unoxml \
fileaccess/source/fileacc \
comphelper/util/comphelp \
@@ -90,8 +98,13 @@ $(eval $(call gb_RdbTarget_add_components,sw_filters_test,\
$(eval $(call gb_RdbTarget_add_old_components,sw_filters_test,\
i18npool \
+ package2 \
ucb1 \
ucpfile1 \
))
+# we need to explicitly depend on library msword because it is not implied
+# by a link relation
+$(call gb_CppunitTest_get_target,sw_filters_test) : $(call gb_Library_get_target,msword)
+
# vim: set noet sw=4:
diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk
index e90639e18104..c06bbcb79c45 100644
--- a/sw/Library_msword.mk
+++ b/sw/Library_msword.mk
@@ -39,10 +39,14 @@ $(eval $(call gb_Library_set_include,msword,\
-I$(WORKDIR)/Misc/sw/ \
$$(INCLUDE) \
$(if $(filter YES,$(SYSTEM_LIBXML)),$(LIBXML_CFLAGS)) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc/sw \
))
+$(eval $(call gb_Library_add_api,msword,\
+ udkapi \
+ offapi \
+))
+
$(eval $(call gb_Library_add_linked_libs,msword,\
basegfx \
comphelper \
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index a2a555af9d01..e541473c2d9b 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -43,10 +43,14 @@ $(eval $(call gb_Library_set_include,sw,\
-I$(WORKDIR)/Misc/sw/ \
$$(INCLUDE) \
$(if $(filter YES,$(SYSTEM_LIBXML)),$(LIBXML_CFLAGS)) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
+$(eval $(call gb_Library_add_api,sw,\
+ udkapi \
+ offapi \
+))
+
$(eval $(call gb_Library_add_defs,sw,\
-DSW_DLLIMPLEMENTATION \
))
diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk
index 067adb7e2757..52988841c6dd 100644
--- a/sw/Library_swd.mk
+++ b/sw/Library_swd.mk
@@ -38,7 +38,11 @@ $(eval $(call gb_Library_set_include,swd,\
-I$(realpath $(SRCDIR)/sw/source/core/inc) \
-I$(realpath $(SRCDIR)/sw/source/filter/inc) \
-I$(realpath $(SRCDIR)/sw/source/ui/inc) \
- -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_add_api,swd,\
+ udkapi \
+ offapi \
))
$(eval $(call gb_Library_add_defs,swd,\
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index c46b6035347a..9649aab2db32 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -36,9 +36,13 @@ $(eval $(call gb_Library_set_include,swui,\
-I$(WORKDIR)/SdiTarget/sw/sdi \
-I$(WORKDIR)/Misc/sw \
$$(INCLUDE) \
- -I$(OUTDIR)/inc/offuh \
))
+))
+
+$(eval $(call gb_Library_add_api,swui,\
+ udkapi \
+ offapi \
$(eval $(call gb_Library_add_linked_libs,swui,\
comphelper \
cppu \
diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk
index 42a1c9115b5d..41ee17cd9a3c 100644
--- a/sw/Library_vbaswobj.mk
+++ b/sw/Library_vbaswobj.mk
@@ -37,10 +37,15 @@ $(eval $(call gb_Library_set_include,vbaswobj,\
-I$(realpath $(SRCDIR)/sw/inc) \
-I$(WORKDIR)/Misc/sw/ \
$$(INCLUDE) \
- -I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc/ \
))
+$(eval $(call gb_Library_add_api,vbaswobj,\
+ udkapi \
+ offapi \
+ oovbaapi \
+))
+
$(eval $(call gb_Library_add_linked_libs,vbaswobj,\
comphelper \
cppu \
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 9a2485abf93b..502f750ebf4c 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -83,7 +83,7 @@ struct SwPostItPageItem
long lOffset;
SwRect mPageRect;
SwSidebarItem_list* mList;
- SwPostItPageItem(): bScrollbar(false),lOffset(0)
+ SwPostItPageItem(): bScrollbar(false), eSidebarPosition( sw::sidebarwindows::SIDEBAR_LEFT ), lOffset(0)
{
mList = new SwSidebarItem_list;
}
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 5c5ab9a71505..ab78d6a5d62b 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -215,6 +215,7 @@ included in c-context files, so c++ style stuff will cause problems.
#define FN_SELECT_INDEX (FN_EDIT + 85) /**/
#define FN_UP (FN_EDIT + 86) /**/
+#define FN_EDIT_HEADER_FOOTER (FN_EDIT + 95) /* Toggle headers/footers edition*/
#define FN_SELECT_PARA (FN_EDIT + 97) /* select paragraph*/
#define FN_SELECT_CONTENT (FN_EDIT + 99) /* Navigator - Content Type */
diff --git a/sw/inc/comcore.hrc b/sw/inc/comcore.hrc
index 494baae50466..7166ab19b1d1 100644
--- a/sw/inc/comcore.hrc
+++ b/sw/inc/comcore.hrc
@@ -84,6 +84,9 @@
#define STR_TABLE_NAME (RC_COMCORE_BEGIN + 46)
#define STR_PARAGRAPH_UNDO (RC_COMCORE_BEGIN + 47)
+#define STR_HEADER (RC_COMCORE_BEGIN + 48)
+#define STR_FOOTER (RC_COMCORE_BEGIN + 49)
+
// defines for the Autoformat Redline Comments
#define STR_AUTOFMTREDL_DEL_EMPTY_PARA 0
#define STR_AUTOFMTREDL_USE_REPLACE 1
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index b24d29742db2..3dc677e81e54 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -190,6 +190,7 @@ private:
SwShellCrsr* pCurCrsr; // current cursor
SwShellCrsr* pCrsrStk; // stack for the cursor
SwVisCrsr *pVisCrsr; // the visible cursor
+ SwShellCrsr* pCrsrBack; // Backup cursor for header/footer edit mode
IBlockCursor *pBlockCrsr; // interface of cursor for block (=rectangular) selection
@@ -495,6 +496,8 @@ public:
void SetReadOnlyAvailable( sal_Bool bFlag );
sal_Bool IsOverReadOnlyPos( const Point& rPt ) const;
+ sal_Bool IsOverHeaderFooterPos( const Point& rPt ) const;
+
// Methods for aFlyMacroLnk.
void SetFlyMacroLnk( const Link& rLnk ) { aFlyMacroLnk = rLnk; }
const Link& GetFlyMacroLnk() const { return aFlyMacroLnk; }
@@ -848,6 +851,8 @@ public:
String GetCrsrDescr() const;
SwRect GetRectOfCurrentChar();
+
+ virtual void ToggleHeaderFooterEdit( );
};
// Cursor Inlines:
diff --git a/sw/inc/extinput.hxx b/sw/inc/extinput.hxx
index 9ce347e37902..317928682086 100644
--- a/sw/inc/extinput.hxx
+++ b/sw/inc/extinput.hxx
@@ -28,18 +28,15 @@
#ifndef _EXTINPUT_HXX
#define _EXTINPUT_HXX
-#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_USHORTS
-#include <svl/svstdarr.hxx>
-#endif
#include <pam.hxx>
#include <i18npool/lang.h>
+#include <vector>
class CommandExtTextInputData;
class SwExtTextInput : public SwPaM
{
- SvUShorts aAttrs;
+ std::vector<sal_uInt16> aAttrs;
String sOverwriteText;
sal_Bool bInsText : 1;
sal_Bool bIsOverwriteCursor : 1;
@@ -49,7 +46,7 @@ public:
virtual ~SwExtTextInput();
void SetInputData( const CommandExtTextInputData& rData );
- const SvUShorts& GetAttrs() const { return aAttrs; }
+ const std::vector<sal_uInt16>& GetAttrs() const { return aAttrs; }
void SetInsText( sal_Bool bFlag ) { bInsText = bFlag; }
sal_Bool IsOverwriteCursor() const { return bIsOverwriteCursor; }
void SetOverwriteCursor( sal_Bool bFlag );
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 5feb33085334..06f306c1d250 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -772,6 +772,7 @@ public:
bool IsVerticalModeAtNdAndPos( const SwTxtNode& _rTxtNode,
const Point& _rDocPos ) const;
+ virtual void ToggleHeaderFooterEdit( );
};
#endif
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
index e2d6fcfd1138..d3ae3c8ca764 100644
--- a/sw/inc/ftnidx.hxx
+++ b/sw/inc/ftnidx.hxx
@@ -28,9 +28,8 @@
#ifndef _FTNIDX_HXX
#define _FTNIDX_HXX
-
-#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
+#include <vector>
class SwTxtFtn;
class SwNodeIndex;
@@ -60,12 +59,10 @@ public:
class SwUpdFtnEndNtAtEnd
{
SvPtrarr aFtnSects, aEndSects;
- SvUShorts aFtnNums, aEndNums;
+ std::vector<sal_uInt16> aFtnNums, aEndNums;
public:
- SwUpdFtnEndNtAtEnd() : aFtnSects( 0, 4 ), aEndSects( 0, 4 ),
- aFtnNums( 0, 4 ), aEndNums( 0, 4 )
- {}
+ SwUpdFtnEndNtAtEnd() : aFtnSects( 0, 4 ), aEndSects( 0, 4 ) {}
static const SwSectionNode* FindSectNdWithEndAttr(
const SwTxtFtn& rTxtFtn );
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 1218d1b913b5..c4d46507861e 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -412,7 +412,6 @@ protected:
void PutNumFmtFontsInAttrPool();
void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
- void PutCJKandCTLFontsInAttrPool();
virtual sal_uLong WriteStream() = 0;
void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 88280b45613b..472739e988a3 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -156,6 +156,7 @@ class SW_DLLPUBLIC ViewShell : public Ring
sal_Bool bEnableSmooth :1; // Disable SmoothScroll, e.g. for drag
// of scrollbars.
sal_Bool bEndActionByVirDev:1; // Paints from EndAction always via virtual device
+ sal_Bool bHeaderFooterEdit;
// (e.g. when browsing).
// boolean, indicating that class in in constructor.
@@ -562,6 +563,9 @@ public:
const SwPostItMgr* GetPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
SwPostItMgr* GetPostItMgr();
+
+ virtual void ToggleHeaderFooterEdit( );
+ sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
};
//---- class CurrShell manages global ShellPointer -------------------
diff --git a/sw/prj/build.lst b/sw/prj/build.lst
index 39e49fd47020..75c602e315ab 100644
--- a/sw/prj/build.lst
+++ b/sw/prj/build.lst
@@ -1,2 +1,2 @@
-sw sw : filter TRANSLATIONS:translations connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package comphelper LIBXSLT:libxslt NULL
+sw sw : filter TRANSLATIONS:translations connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package forms toolkit dbaccess comphelper LIBXSLT:libxslt test NULL
sw sw\prj nmake - all sw_prj NULL
diff --git a/sw/qa/core/data/rtf/fail/CVE-2005-2971-1.rtf b/sw/qa/core/data/rtf/fail/CVE-2005-2971-1.rtf
new file mode 100644
index 000000000000..7ed841f88d7b
--- /dev/null
+++ b/sw/qa/core/data/rtf/fail/CVE-2005-2971-1.rtf
@@ -0,0 +1,11 @@
+{\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1\ansi\deff0\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Nimbus Roman No9 L;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033\snext1 Default;}
+}
+{\info{\comment StarWriter}{\vern6410}}\deftab1250
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Default;}}
+\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pard\plain \s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033 {\ltrch\loch\f0 hello}
+\par }
diff --git a/sw/qa/core/data/rtf/fail/.gitignore b/sw/qa/core/data/rtf/indeterminate/.gitignore
index e69de29bb2d1..e69de29bb2d1 100644
--- a/sw/qa/core/data/rtf/fail/.gitignore
+++ b/sw/qa/core/data/rtf/indeterminate/.gitignore
diff --git a/sw/qa/core/data/rtf/pass/CVE-2005-2964.rtf b/sw/qa/core/data/rtf/pass/CVE-2005-2964.rtf
new file mode 100644
index 000000000000..bf61eeade2a3
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/CVE-2005-2964.rtf
@@ -0,0 +1,11 @@
+{\rtf1\ansi\deff0\adeflang1025
+{\fonttbl{\f0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfroman\fprq2\fcharset0 Nimbus Roman No9 L;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033\snext1 Default;}
+}
+{\info{\comment StarWriter}{\vern6410}}\deftab1250
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Default;}}
+\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pard\plain \s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033 {\ltrch\loch\f0 hello}
+\par }
diff --git a/sw/qa/core/data/rtf/pass/CVE-2005-2972-1.rtf b/sw/qa/core/data/rtf/pass/CVE-2005-2972-1.rtf
new file mode 100644
index 000000000000..c38d6fc644e7
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/CVE-2005-2972-1.rtf
@@ -0,0 +1,57 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
+{\f1\fnil\fcharset0\fprq0\fttruetype Nimbus Sans L;}
+{\f2\fnil\fcharset0\fprq0\fttruetype Dingbats;}
+{\f3\fnil\fcharset0\fprq0\fttruetype Symbol;}
+{\f4\fnil\fcharset0\fprq0\fttruetype Courier New;}}
+{\colortbl
+\red0\green0\blue0;
+\red255\green255\blue255;}
+{\stylesheet
+{\s1\fi-431\li720\sbasedon28\snext28 Contents 1;}
+{\s2\fi-431\li1440\sbasedon28\snext28 Contents 2;}
+{\s3\fi-431\li2160\sbasedon28\snext28 Contents 3;}
+{\s8\fi-431\li720\sbasedon28 Lower Roman List;}
+{\s5\tx431\sbasedon24\snext28 Numbered Heading 1;}
+{\s6\tx431\sbasedon25\snext28 Numbered Heading 2;}
+{\s7\fi-431\li720 Square List;}
+{\*\cs11\sbasedon28 Endnote Text;}
+{\s4\fi-431\li2880\sbasedon28\snext28 Contents 4;}
+{\s9\fi-431\li720 Diamond List;}
+{\s10\fi-431\li720 Numbered List;}
+{\*\cs12\fs20\super Endnote Reference;}
+{\s13\fi-431\li720 Triangle List;}
+{\s14\tx431\sbasedon26\snext28 Numbered Heading 3;}
+{\s15\fi-431\li720 Dashed List;}
+{\s16\fi-431\li720\sbasedon10 Upper Roman List;}
+{\s17\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 4;}
+{\s18\fi-431\li720 Heart List;}
+{\s34\fi-431\li720 Box List;}
+{\s20\fi-431\li720\sbasedon10 Upper Case List;}
+{\s21\fi-431\li720 Bullet List;}
+{\s22\fi-431\li720 Hand List;}
+{\*\cs23\fs20\sbasedon28 Footnote Text;}
+{\s24\sb440\sa60\f1\fs34\b\sbasedon28\snext28 Heading 1;}
+{\s25\sb440\sa60\f1\fs28\b\sbasedon28\snext28 Heading 2;}
+{\s19\qc\sb240\sa120\f1\fs32\b\sbasedon28\snext28 Contents Header;}
+{\s27\fi-431\li720 Tick List;}
+{\s26\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 3;}
+{\s29\fi-431\li720\sbasedon10 Lower Case List;}
+{\s30\li1440\ri1440\sa120\sbasedon28 Block Text;}
+{\s36\f4\sbasedon28 Plain Text;}
+{\s32\tx1584\sbasedon5\snext28 Section Heading;}
+{\s33\fi-431\li720 Implies List;}
+{\s28\f0\fs24\lang1033 Normal;}
+{\s35\fi-431\li720 Star List;}
+{\*\cs31\fs20\super Footnote Reference;}
+{\s37\tx1584\sbasedon5\snext28 Chapter Heading;}}
+{\*\listtable
+{\list\listtemplateid1002\listsimple{\listlevel\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}}\listid1000}}
+{\*\listoverridetable
+{\listoverride\listoverridecount0\listid1000\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}\ls1}}
+
+\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\facingp\titlepg\revprop3{\info}\deftab720\viewkind1\paperw12240\paperh15840\margl1440\margr1440\widowctl
+\sectd\sbknone\colsx360\pgncont\ltrsect
+{\listtext\pard\fi-431\li720 1. }\pard\plain{\ltrpar\ql\fi-431\li720\s28{\*\abilist\abilistid1000\abilistparentid0\abilistlevel1\abistartat1{\abifieldfont NULL}{\abilistdecimal .}{\abilistdelim %L.}{\abiliststyle Numbered List}}{\*\pn\pnql\pnstart1\pnlvlbody\pndec{\pntxtb AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA}{\pntxta .}}\fn-431\li720\ls1\ilvl0\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\abinodiroverride\ltrch test}{\s28\f0\fs24\lang1033{\*\listtag1001}\par}
+}\pard\plain\ltrpar\ql\s28\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\par}}
diff --git a/sw/qa/core/data/rtf/pass/CVE-2005-2972-2.rtf b/sw/qa/core/data/rtf/pass/CVE-2005-2972-2.rtf
new file mode 100644
index 000000000000..2a3f782b72c4
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/CVE-2005-2972-2.rtf
@@ -0,0 +1,57 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
+{\f1\fnil\fcharset0\fprq0\fttruetype Nimbus Sans L;}
+{\f2\fnil\fcharset0\fprq0\fttruetype Dingbats;}
+{\f3\fnil\fcharset0\fprq0\fttruetype Symbol;}
+{\f4\fnil\fcharset0\fprq0\fttruetype Courier New;}}
+{\colortbl
+\red0\green0\blue0;
+\red255\green255\blue255;}
+{\stylesheet
+{\s1\fi-431\li720\sbasedon28\snext28 Contents 1;}
+{\s2\fi-431\li1440\sbasedon28\snext28 Contents 2;}
+{\s3\fi-431\li2160\sbasedon28\snext28 Contents 3;}
+{\s8\fi-431\li720\sbasedon28 Lower Roman List;}
+{\s5\tx431\sbasedon24\snext28 Numbered Heading 1;}
+{\s6\tx431\sbasedon25\snext28 Numbered Heading 2;}
+{\s7\fi-431\li720 Square List;}
+{\*\cs11\sbasedon28 Endnote Text;}
+{\s4\fi-431\li2880\sbasedon28\snext28 Contents 4;}
+{\s9\fi-431\li720 Diamond List;}
+{\s10\fi-431\li720 Numbered List;}
+{\*\cs12\fs20\super Endnote Reference;}
+{\s13\fi-431\li720 Triangle List;}
+{\s14\tx431\sbasedon26\snext28 Numbered Heading 3;}
+{\s15\fi-431\li720 Dashed List;}
+{\s16\fi-431\li720\sbasedon10 Upper Roman List;}
+{\s17\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 4;}
+{\s18\fi-431\li720 Heart List;}
+{\s34\fi-431\li720 Box List;}
+{\s20\fi-431\li720\sbasedon10 Upper Case List;}
+{\s21\fi-431\li720 Bullet List;}
+{\s22\fi-431\li720 Hand List;}
+{\*\cs23\fs20\sbasedon28 Footnote Text;}
+{\s24\sb440\sa60\f1\fs34\b\sbasedon28\snext28 Heading 1;}
+{\s25\sb440\sa60\f1\fs28\b\sbasedon28\snext28 Heading 2;}
+{\s19\qc\sb240\sa120\f1\fs32\b\sbasedon28\snext28 Contents Header;}
+{\s27\fi-431\li720 Tick List;}
+{\s26\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 3;}
+{\s29\fi-431\li720\sbasedon10 Lower Case List;}
+{\s30\li1440\ri1440\sa120\sbasedon28 Block Text;}
+{\s36\f4\sbasedon28 Plain Text;}
+{\s32\tx1584\sbasedon5\snext28 Section Heading;}
+{\s33\fi-431\li720 Implies List;}
+{\s28\f0\fs24\lang1033 Normal;}
+{\s35\fi-431\li720 Star List;}
+{\*\cs31\fs20\super Footnote Reference;}
+{\s37\tx1584\sbasedon5\snext28 Chapter Heading;}}
+{\*\listtable
+{\list\listtemplateid1002\listsimple{\listlevel\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}}\listid1000}}
+{\*\listoverridetable
+{\listoverride\listoverridecount0\listid1000\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}\ls1}}
+
+\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\facingp\titlepg\revprop3{\info}\deftab720\viewkind1\paperw12240\paperh15840\margl1440\margr1440\widowctl
+\sectd\sbknone\colsx360\pgncont\ltrsect
+{\listtext\pard\fi-431\li720 1. }\pard\plain{\ltrpar\ql\fi-431\li720\s28{\*\abilist\abilistid1000\abilistparentid0\abilistlevel1\abistartat1{\abifieldfont NULL}{\abilistdecimal .}{\abilistdelim %L.}{\abiliststyle AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANumbered List}}{\*\pn\pnql\pnstart1\pnlvlbody\pndec{\pntxtb }{\pntxta .}}\fn-431\li720\ls1\ilvl0\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\abinodiroverride\ltrch test}{\s28\f0\fs24\lang1033{\*\listtag1001}\par}
+}\pard\plain\ltrpar\ql\s28\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\par}}
diff --git a/sw/qa/core/data/rtf/pass/CVE-2010-3333-1.rtf b/sw/qa/core/data/rtf/pass/CVE-2010-3333-1.rtf
new file mode 100644
index 000000000000..aaf9acd99a4e
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/CVE-2010-3333-1.rtf
Binary files differ
diff --git a/sw/qa/core/data/ww8/fail/CVE-2005-0941-1.doc b/sw/qa/core/data/ww8/fail/CVE-2005-0941-1.doc
new file mode 100644
index 000000000000..18b300c8525e
--- /dev/null
+++ b/sw/qa/core/data/ww8/fail/CVE-2005-0941-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/fail/CVE-2006-2389-1.doc b/sw/qa/core/data/ww8/fail/CVE-2006-2389-1.doc
new file mode 100644
index 000000000000..a1bf07a71a82
--- /dev/null
+++ b/sw/qa/core/data/ww8/fail/CVE-2006-2389-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/fail/CVE-2008-0320-1.doc b/sw/qa/core/data/ww8/fail/CVE-2008-0320-1.doc
new file mode 100644
index 000000000000..b5a08324f1c5
--- /dev/null
+++ b/sw/qa/core/data/ww8/fail/CVE-2008-0320-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/indeterminate/.gitignore b/sw/qa/core/data/ww8/indeterminate/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/qa/core/data/ww8/indeterminate/.gitignore
diff --git a/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc b/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc
new file mode 100644
index 000000000000..af452ddc0e5f
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2006-6561-1.doc b/sw/qa/core/data/ww8/pass/CVE-2006-6561-1.doc
new file mode 100644
index 000000000000..240ea77bca12
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2006-6561-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc b/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc
new file mode 100644
index 000000000000..240ea77bca12
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc b/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc
new file mode 100644
index 000000000000..d25e62ab2416
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc
new file mode 100644
index 000000000000..f51fa8fe9b2e
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc
new file mode 100644
index 000000000000..7ce7a07bb6e2
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc
new file mode 100644
index 000000000000..8b04872af739
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc
new file mode 100644
index 000000000000..148a30d4ab35
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc b/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc
new file mode 100644
index 000000000000..0942b6d8d466
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc b/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc
new file mode 100644
index 000000000000..0942b6d8d466
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc b/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc
new file mode 100644
index 000000000000..596aec93bd60
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc
Binary files differ
diff --git a/sw/qa/core/data/xml/indeterminate/.gitignore b/sw/qa/core/data/xml/indeterminate/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/qa/core/data/xml/indeterminate/.gitignore
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 75262f70cdbf..71e5d743d962 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -65,6 +65,8 @@
SO2_DECL_REF(SwDocShell)
SO2_IMPL_REF(SwDocShell)
+const int indeterminate = 2;
+
using namespace ::com::sun::star;
/* Implementation of Filters test */
@@ -78,13 +80,9 @@ public:
virtual void setUp();
virtual void tearDown();
- void recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, bool bExpected);
+ void recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, int nExpected);
bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
- bool testLoad(const rtl::OUString &rFilter,
- const rtl::OUString &rUserData,
- const rtl::OUString &rURL);
-
/**
* Ensure CVEs remain unbroken
*/
@@ -99,6 +97,7 @@ private:
uno::Reference<lang::XMultiComponentFactory> m_xFactory;
uno::Reference<uno::XInterface> m_xWriterComponent;
::rtl::OUString m_aSrcRoot;
+ int m_nLoadedDocs;
};
bool FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
@@ -112,10 +111,14 @@ bool FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
SwDocShellRef xDocShRef = new SwDocShell;
SfxMedium aSrcMed(rURL, STREAM_STD_READ, true);
aSrcMed.SetFilter(&aFilter);
- return xDocShRef->DoLoad(&aSrcMed);
+ bool bRet = xDocShRef->DoLoad(&aSrcMed);
+
+ ++m_nLoadedDocs;
+
+ return bRet;
}
-void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, bool bExpected)
+void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, int nExpected)
{
osl::Directory aDir(rURL);
@@ -127,43 +130,43 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
aItem.getFileStatus(aFileStatus);
rtl::OUString sURL = aFileStatus.getFileURL();
if (aFileStatus.getFileType() == osl::FileStatus::Directory)
- recursiveScan(rFilter, sURL, rUserData, bExpected);
+ recursiveScan(rFilter, sURL, rUserData, nExpected);
else
{
- sal_Int32 nGitIndex = sURL.lastIndexOfAsciiL(
- RTL_CONSTASCII_STRINGPARAM(".gitignore"));
-
- if (nGitIndex == sURL.getLength() - RTL_CONSTASCII_LENGTH(".gitignore"))
+ sal_Int32 nLastSlash = sURL.lastIndexOf('/');
+
+ //ignore .files
+ if (
+ (nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()) &&
+ (sURL.getStr()[nLastSlash+1] == '.')
+ )
+ {
continue;
-
+ }
+
+ rtl::OString aRes(rtl::OUStringToOString(sURL,
+ osl_getThreadTextEncoding()));
+ if (nExpected == indeterminate)
+ {
+ fprintf(stderr, "loading %s\n", aRes.getStr());
+ }
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
bool bRes = load(rFilter, sURL, rUserData);
- rtl::OString aRes(rtl::OUStringToOString(sURL, osl_getThreadTextEncoding()));
- CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == bExpected);
+ sal_uInt32 nEndTime = osl_getGlobalTimer();
+ if (nExpected == indeterminate)
+ {
+ fprintf(stderr, "pass/fail was %d (%"SAL_PRIuUINT32" ms)\n",
+ bRes, nEndTime-nStartTime);
+ continue;
+ }
+ CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == nExpected);
}
}
CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
}
-bool FiltersTest::testLoad(const rtl::OUString &rFilter,
- const rtl::OUString &rUserData,
- const rtl::OUString &rURL)
-{
- SfxFilter aFilter(
- rFilter,
- rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
- rUserData, rtl::OUString() );
-
- SwDocShellRef xDocShRef = new SwDocShell;
- SfxMedium aSrcMed(rURL, STREAM_STD_READ, true);
- aSrcMed.SetFilter(&aFilter);
- return xDocShRef->DoLoad(&aSrcMed);
-}
-
void FiltersTest::testCVEs()
{
-//To-Do: I know this works on Linux, please check if this test works under
-//windows and enable it if so
-#ifndef WNT
recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Staroffice XML (Writer)")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/xml/pass")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CXML")), true);
recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Staroffice XML (Writer)")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/xml/fail")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CXML")), false);
@@ -172,15 +175,20 @@ void FiltersTest::testCVEs()
recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rich Text Format")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/rtf/fail")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RTF")), false);
+ recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rich Text Format")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/rtf/indeterminate")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RTF")), indeterminate);
+
recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/ww8/pass")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")), true);
recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/ww8/fail")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")), false);
-#endif
+ recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/ww8/indeterminate")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")), indeterminate);
+
+ printf("Writer: tested %d files\n", m_nLoadedDocs);
}
FiltersTest::FiltersTest()
: m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://"))
+ , m_nLoadedDocs(0)
{
m_xContext = cppu::defaultBootstrap_InitialComponentContext();
m_xFactory = m_xContext->getServiceManager();
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index c0f1126ec5cf..a175daea03d7 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -373,6 +373,12 @@ interface BaseText
StateMethod = GetState;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+ FN_EDIT_HEADER_FOOTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
FN_TABLE_UNSET_READ_ONLY // status(final|play)
[
ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 36c45e495cc4..152b3fd36a43 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10417,3 +10417,30 @@ SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
ToolBoxConfig = TRUE,
GroupId = GID_NAVIGATION;
]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditHeaderFooter FN_EDIT_HEADER_FOOTER
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f0edc77dc6c2..67bbdad2c892 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -676,6 +676,11 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock )
// -> zurueck
return bRet;
+ // Toggle the Header/Footer mode if needed
+ bool bInHeaderFooter = pFrm && ( pFrm->IsHeaderFrm() || pFrm->IsFooterFrm() );
+ if ( bInHeaderFooter ^ IsHeaderFooterEdit() )
+ ToggleHeaderFooterEdit();
+
if( pBlockCrsr && bBlock )
{
pBlockCrsr->setEndPoint( rLPt );
@@ -2326,6 +2331,15 @@ sal_Bool SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const
return aPam.HasReadonlySel( GetViewOptions()->IsFormView() );
}
+sal_Bool SwCrsrShell::IsOverHeaderFooterPos( const Point& rPt ) const
+{
+ Point aPt( rPt );
+ SwPaM aPam( *pCurCrsr->GetPoint() );
+ GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
+
+ return GetDoc()->IsInHeaderFooter( aPam.GetPoint()->nNode );
+}
+
// returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
// aufgepspannte haben will - sprich etwas selektiert ist (Basic))
@@ -2531,7 +2545,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
: ViewShell( rShell, pInitWin ),
- SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ SwModify( 0 ), pCrsrStk( 0 ), pCrsrBack( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ),
sMarkedListId(),
@@ -2559,7 +2573,7 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
const SwViewOption *pInitOpt )
: ViewShell( rDoc, pInitWin, pInitOpt ),
- SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ SwModify( 0 ), pCrsrStk( 0 ), pCrsrBack( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst
sMarkedListId(),
@@ -2621,6 +2635,9 @@ SwCrsrShell::~SwCrsrShell()
delete pCrsrStk;
}
+ if( pCrsrBack )
+ delete pCrsrBack;
+
// JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in
// der CursorShell haengt keine Chance geben, sich an den
// TextNode zu haengen.
@@ -3432,4 +3449,44 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
}
}
+
+void SwCrsrShell::ToggleHeaderFooterEdit( )
+{
+ ViewShell::ToggleHeaderFooterEdit();
+
+ SET_CURR_SHELL( this );
+
+ if ( IsHeaderFooterEdit() )
+ {
+ pCrsrBack = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
+ pCurCrsr->GetPtPos() );
+
+ if ( pCurCrsr->HasMark() )
+ {
+ pCrsrBack->SetMark();
+ *pCrsrBack->GetMark() = *pCurCrsr->GetMark();
+ }
+ }
+ else
+ {
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+ rPos.nNode = pCrsrBack->GetPoint()->nNode;
+ rPos.nContent = pCrsrBack->GetPoint()->nContent;
+
+ if ( pCrsrBack->HasMark( ) )
+ {
+ pCurCrsr->SetMark();
+ rPos = *pCurCrsr->GetMark();
+ rPos.nNode = pCrsrBack->GetMark()->nNode;
+ rPos.nContent = pCrsrBack->GetMark()->nContent;
+ }
+
+ delete pCrsrBack;
+ pCrsrBack = NULL;
+
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index ec939a7f9786..3add53407f6c 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -33,7 +33,6 @@
#include <com/sun/star/util/SearchFlags.hpp>
#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
#include <vcl/svapp.hxx>
@@ -63,12 +62,11 @@ using namespace util;
String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
- xub_StrLen& rEnde, SvULongs& rArr, String& rRet,
+ xub_StrLen& rEnde, std::vector<sal_uLong> &rArr, String& rRet,
bool bRemoveSoftHyphen )
{
rRet = rNd.GetTxt();
- if( rArr.Count() )
- rArr.Remove( 0, rArr.Count() );
+ rArr.clear();
const SwpHints *pHts = rNd.GetpSwpHints();
@@ -119,7 +117,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
else
break;
- const xub_StrLen nAkt = nStt - rArr.Count();
+ const xub_StrLen nAkt = nStt - rArr.size();
if ( bNewHint )
{
@@ -150,7 +148,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
->GetFld().GetFld()->ExpandField(true).Len());
if ( bEmpty && nStart == nAkt )
{
- rArr.Insert( nAkt, rArr.Count() );
+ rArr.push_back( nAkt );
--rEnde;
rRet.Erase( nAkt, 1 );
}
@@ -172,7 +170,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
if ( bNewSoftHyphen )
{
- rArr.Insert( nAkt, rArr.Count() );
+ rArr.push_back( nAkt );
--rEnde;
rRet.Erase( nAkt, 1 );
++nSoftHyphen;
@@ -186,7 +184,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
if( nTmp == rRet.Len() - 1 )
{
rRet.Erase( nTmp );
- rArr.Insert( nTmp, rArr.Count() );
+ rArr.push_back( nTmp );
--rEnde;
}
}
@@ -265,10 +263,6 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
*/
sal_Bool bFirst = sal_True;
SwCntntNode * pNode;
- //testarea
- //String sCleanStr;
- //SvULongs aFltArr;
- //const SwNode* pSttNd = &rNdIdx.GetNode();
xub_StrLen nStart, nEnde, nTxtLen;
@@ -429,7 +423,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
const SwNode* pSttNd = &rNdIdx.GetNode();
String sCleanStr;
- SvULongs aFltArr;
+ std::vector<sal_uLong> aFltArr;
LanguageType eLastLang = 0;
// if the search string contains a soft hypen, we don't strip them from the text:
bool bRemoveSoftHyphens = true;
@@ -501,19 +495,19 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SetMark();
// Start und Ende wieder korrigieren !!
- if( aFltArr.Count() )
+ if( !aFltArr.empty() )
{
xub_StrLen n, nNew;
// bei Rueckwaertssuche die Positionen temp. vertauschen
if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; }
for( n = 0, nNew = nStart;
- n < aFltArr.Count() && aFltArr[ n ] <= nStart;
+ n < aFltArr.size() && aFltArr[ n ] <= nStart;
++n, ++nNew )
;
nStart = nNew;
for( n = 0, nNew = nEnde;
- n < aFltArr.Count() && aFltArr[ n ] < nEnde;
+ n < aFltArr.size() && aFltArr[ n ] < nEnde;
++n, ++nNew )
;
nEnde = nNew;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index d876d507f07a..8b1c82f6435a 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -796,7 +796,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
}
}
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
// FIXME: only SwTxtNode has a valid implementation of SplitCntntNode!
@@ -805,7 +805,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
if (pNode)
{
// verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 6770cb5756bc..b88de101ab44 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -904,15 +904,15 @@ namespace
SetTypeAndCount( nType, 0 );
nContent = 0;
}
- _SwSaveTypeCountContent( const SvULongs& rArr, sal_uInt16& rPos )
+ _SwSaveTypeCountContent( const std::vector<sal_uLong> &rArr, sal_uInt16& rPos )
{
TYPECOUNT.nTypeCount = rArr[ rPos++ ];
nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]);
}
- void Add( SvULongs& rArr )
+ void Add( std::vector<sal_uLong> &rArr )
{
- rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() );
- rArr.Insert( nContent, rArr.Count() );
+ rArr.push_back( TYPECOUNT.nTypeCount );
+ rArr.push_back( nContent );
}
void SetType( sal_uInt16 n ) { TYPECOUNT.TC.nType = n; }
@@ -966,7 +966,7 @@ namespace
return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() );
}
- static void lcl_ChkPaM( SvULongs& rSaveArr, sal_uLong nNode, xub_StrLen nCntnt,
+ static void lcl_ChkPaM( std::vector<sal_uLong> &rSaveArr, sal_uLong nNode, xub_StrLen nCntnt,
const SwPaM& rPam, _SwSaveTypeCountContent& rSave,
sal_Bool bChkSelDirection )
{
@@ -1213,7 +1213,7 @@ void _DelBookmarks(
void _SaveCntntIdx(SwDoc* pDoc,
sal_uLong nNode,
xub_StrLen nCntnt,
- SvULongs& rSaveArr,
+ std::vector<sal_uLong> &rSaveArr,
sal_uInt8 nSaveFly)
{
// 1. Bookmarks
@@ -1429,7 +1429,7 @@ void _SaveCntntIdx(SwDoc* pDoc,
void _RestoreCntntIdx(SwDoc* pDoc,
- SvULongs& rSaveArr,
+ std::vector<sal_uLong> &rSaveArr,
sal_uLong nNode,
xub_StrLen nOffset,
sal_Bool bAuto)
@@ -1439,7 +1439,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
sal_uInt16 n = 0;
- while( n < rSaveArr.Count() )
+ while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
SwPosition* pPos = 0;
@@ -1590,7 +1590,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
}
}
-void _RestoreCntntIdx(SvULongs& rSaveArr,
+void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
const SwNode& rNd,
xub_StrLen nLen,
xub_StrLen nChkLen)
@@ -1602,7 +1602,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
sal_uInt16 n = 0;
- while( n < rSaveArr.Count() )
+ while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
if( aSave.GetContent() >= nChkLen )
@@ -1748,7 +1748,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
pPos->nContent.Assign( pCNd, Min( aSave.GetContent(), nLen ) );
}
n -= 2;
- rSaveArr.Remove( n, 2 );
+ rSaveArr.erase( rSaveArr.begin() + n, rSaveArr.begin() + n + 2);
}
}
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 76eb486373fc..aa2546310de1 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -949,13 +949,13 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
bSplit = sal_True;
xub_StrLen nMkCntnt = rPaM.GetMark()->nContent.GetIndex();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
pTNd = static_cast<SwTxtNode*>(pTNd->SplitCntntNode( rPos ));
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
// jetzt noch den Pam berichtigen !!
@@ -1381,7 +1381,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
}
pOldTxtNd->FmtToTxtAttr( pTxtNd );
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
::_SaveCntntIdx( pDoc, aOldIdx.GetIndex(),
pOldTxtNd->Len(), aBkmkArr );
@@ -1392,7 +1392,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
// falls der uebergebene PaM nicht im Crsr-Ring steht,
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 16e5a7680da7..239238e23417 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -36,7 +36,6 @@
#include <float.h>
#include <tools/datetime.hxx>
#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_ULONGS
#include <svl/svarray.hxx>
#endif
#include <vcl/svapp.hxx>
@@ -2241,7 +2240,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
{
// damit die Frames richtig angelegt werden, muessen sie in der
// Reihenfolgen von oben nach unten expandiert werden
- SvULongs aTmpArr;
+ std::vector<sal_uLong> aTmpArr;
SwSectionFmts& rArr = rDoc.GetSections();
SwSectionNode* pSectNd;
sal_uInt16 nArrStt = 0;
@@ -2254,20 +2253,17 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ))
{
sal_uLong nIdx = pSectNd->GetIndex();
- sal_uInt16 i;
-
- for( i = 0; i < aTmpArr.Count() && aTmpArr[ i ] < nIdx; ++i )
- ;
- aTmpArr.Insert( nIdx, i );
+ aTmpArr.push_back( nIdx );
if( nIdx < nSttCntnt )
++nArrStt;
}
}
+ std::sort(aTmpArr.begin(), aTmpArr.end());
// erst alle anzeigen, damit die Frames vorhanden sind. Mit deren
// Position wird das BodyAnchor ermittelt.
// Dafuer erst den ContentBereich, dann die Sonderbereiche!!!
- for (sal_uInt16 n = nArrStt; n < aTmpArr.Count(); ++n)
+ for (sal_uInt16 n = nArrStt; n < aTmpArr.size(); ++n)
{
pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
OSL_ENSURE( pSectNd, "Wo ist mein SectionNode" );
@@ -2281,7 +2277,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
}
// so, erst jetzt alle sortiert in die Liste eintragen
- for (sal_uInt16 n = 0; n < aTmpArr.Count(); ++n)
+ for (sal_uInt16 n = 0; n < aTmpArr.size(); ++n)
{
GetBodyNode( *rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode() );
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index fe5f762da618..d9622623e6bd 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -443,7 +443,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange );
if( !rAttrs.empty() )
{
- for( std::set<sal_uInt16>::reverse_iterator it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
+ for( std::set<sal_uInt16>::const_reverse_iterator it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
{
if( POOLATTR_END > *it )
aDelSet.Put( *GetDfltAttr( *it ));
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 85f3b33ae9c9..a7a9a6e0b94b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -909,39 +909,40 @@ void SwDoc::UpdateLinks( sal_Bool bUI )
{
SfxObjectCreateMode eMode;
sal_uInt16 nLinkMode = getLinkUpdateMode( true );
- sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
- if( GetDocShell() &&
- (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
- GetLinkManager().GetLinks().Count() &&
- SFX_CREATE_MODE_INTERNAL !=
- ( eMode = GetDocShell()->GetCreateMode()) &&
- SFX_CREATE_MODE_ORGANIZER != eMode &&
- SFX_CREATE_MODE_PREVIEW != eMode &&
- !GetDocShell()->IsPreview() )
- {
- ViewShell* pVSh = 0;
- sal_Bool bAskUpdate = nLinkMode == MANUAL;
- sal_Bool bUpdate = sal_True;
- switch(nUpdateDocMode)
- {
- case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break;
- case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break;
- case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break;
- }
- if( bUpdate && (bUI || !bAskUpdate) )
+ if ( GetDocShell()) {
+ sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
+ if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
+ GetLinkManager().GetLinks().Count() &&
+ SFX_CREATE_MODE_INTERNAL !=
+ ( eMode = GetDocShell()->GetCreateMode()) &&
+ SFX_CREATE_MODE_ORGANIZER != eMode &&
+ SFX_CREATE_MODE_PREVIEW != eMode &&
+ !GetDocShell()->IsPreview() )
{
- SfxMedium* pMedium = GetDocShell()->GetMedium();
- SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
- Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
- if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225
+ ViewShell* pVSh = 0;
+ sal_Bool bAskUpdate = nLinkMode == MANUAL;
+ sal_Bool bUpdate = sal_True;
+ switch(nUpdateDocMode)
{
- ViewShell aVSh( *this, 0, 0 );
+ case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break;
+ case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break;
+ case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break;
+ }
+ if( bUpdate && (bUI || !bAskUpdate) )
+ {
+ SfxMedium* pMedium = GetDocShell()->GetMedium();
+ SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
+ Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
+ if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225
+ {
+ ViewShell aVSh( *this, 0, 0 );
- SET_CURR_SHELL( &aVSh );
- GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent );
+ SET_CURR_SHELL( &aVSh );
+ GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent );
+ }
+ else
+ GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent );
}
- else
- GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent );
}
}
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index 030461e12499..0cd666c7229d 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -204,10 +204,12 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
GetPoint()->nContent = nSttCnt;
- if( aAttrs.Count() )
- aAttrs.Remove( 0, aAttrs.Count() );
+ aAttrs.clear();
if( rData.GetTextAttr() )
- aAttrs.Insert( rData.GetTextAttr(), rData.GetText().Len(), 0 );
+ {
+ const sal_uInt16 *pAttrs = rData.GetTextAttr();
+ aAttrs.insert( aAttrs.begin(), pAttrs, pAttrs + rData.GetText().Len() );
+ }
}
}
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index 0304d41ddf3d..89f4540cf549 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -356,7 +356,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
{
sal_uInt16 nRet = 0, nWh;
SvPtrarr* pArr;
- SvUShorts* pNum;
+ std::vector<sal_uInt16> *pNum;
if( rTxtFtn.GetFtn().IsEndNote() )
{
pArr = &aEndSects;
@@ -374,7 +374,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
for( sal_uInt16 n = pArr->Count(); n; )
if( pArr->GetObject( --n ) == pNd )
{
- nRet = ++pNum->GetObject( n );
+ nRet = ++((*pNum)[ n ]);
break;
}
@@ -384,7 +384,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
nRet = ((SwFmtFtnEndAtTxtEnd&)rNd.GetSection().GetFmt()->
GetFmtAttr( nWh )).GetOffset();
++nRet;
- pNum->Insert( nRet, pNum->Count() );
+ pNum->push_back( nRet );
}
return nRet;
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 530a1270cd13..77f99dbdf225 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -248,6 +248,10 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
return;
const ViewShell* pSh = getRootFrm()->GetCurrShell();
+ OutputDevice *pOut = pSh->GetOut();
+
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
if( !pSh->GetViewOptions()->IsGraphic() )
{
StopAnimation();
@@ -262,6 +266,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
aTxt = FindFlyFrm()->GetFmt()->GetName();
lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
}
+ pOut->SetDrawMode( nOldDrawMode );
return;
}
@@ -272,7 +277,6 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn)
- OutputDevice *pOut = pSh->GetOut();
pOut->Push();
sal_Bool bClip = sal_True;
PolyPolygon aPoly;
@@ -329,6 +333,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
pGrfNd->SetFrameInPaint( sal_False );
pOut->Pop();
+ pOut->SetDrawMode( nOldDrawMode );
SfxProgress::LeaveLock();
}
@@ -817,9 +822,10 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( pGrfNd )
{
// Fix for bug fdo#33781
+ const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
{
- pOut->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW );
+ pOut->SetAntialiasing( nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW );
}
sal_Bool bForceSwap = sal_False, bContinue = sal_True;
@@ -933,8 +939,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bSwapped && bPrn )
bForceSwap = sal_True;
}
+
if( bForceSwap )
pGrfNd->SwapOut();
+
+ if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
}
else if( bIsChart
//charts must be painted resolution dependent!! #i82893#, #i75867#
@@ -947,15 +957,18 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
else if( pOLENd )
{
- // #i99665#
- // Adjust AntiAliasing mode at output device for chart OLE
+ // Fix for bug fdo#33781
const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
- if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
{
- const sal_uInt16 nAntialiasingForChartOLE =
- nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
- pOut->SetAntialiasing( nAntialiasingForChartOLE );
+ sal_uInt16 nNewAntialiasingAtOutput = nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW;
+
+ // #i99665#
+ // Adjust AntiAliasing mode at output device for chart OLE
+ if ( pOLENd->IsChart() )
+ nNewAntialiasingAtOutput |= ANTIALIASING_PIXELSNAPHAIRLINE;
+
+ pOut->SetAntialiasing( nNewAntialiasingAtOutput );
}
Point aPosition(aAlignedGrfArea.Pos());
@@ -1000,12 +1013,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
}
- // #i99665#
- if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
- {
+ if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
- }
}
}
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 3e7086bcdc13..a75f4a92353e 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -575,12 +575,12 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
}
break;
- case RES_POOLCOLL_FOOTNOTE: // Fussnote
- case RES_POOLCOLL_ENDNOTE:
+ case RES_POOLCOLL_FOOTNOTE: // paragraph style Footnote
+ case RES_POOLCOLL_ENDNOTE: // paragraph style Endnote
{
SvxLRSpaceItem aLR( RES_LR_SPACE );
- aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
- aLR.SetTxtLeft( GetMetricVal( CM_05 ));
+ aLR.SetTxtFirstLineOfst( -(short)( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) ) );
+ aLR.SetTxtLeft( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) );
SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
aSet.Put( aLR );
SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 7b0de1c4796f..a4ee1447052e 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -186,14 +186,33 @@ namespace
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
+
+ // copying additional attributes for bookmarks or fieldmarks
::sw::mark::IBookmark* const pNewBookmark =
dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark);
- if(pNewBookmark) /* copying additional attributes for bookmarks */
+ if(pNewBookmark)
{
const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark);
pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
pNewBookmark->SetShortName(pOldBookmark->GetShortName());
}
+ ::sw::mark::IFieldmark* const pNewFieldmark =
+ dynamic_cast< ::sw::mark::IFieldmark* const >(pNewMark);
+ if(pNewFieldmark)
+ {
+ const ::sw::mark::IFieldmark* const pOldFieldmark = dynamic_cast< const ::sw::mark::IFieldmark* >(pMark);
+ pNewFieldmark->SetFieldname(pOldFieldmark->GetFieldname());
+ pNewFieldmark->SetFieldHelptext(pOldFieldmark->GetFieldHelptext());
+ ::sw::mark::IFieldmark::parameter_map_t* pNewParams = pNewFieldmark->GetParameters();
+ const ::sw::mark::IFieldmark::parameter_map_t* pOldParams = pOldFieldmark->GetParameters();
+ ::sw::mark::IFieldmark::parameter_map_t::const_iterator pIt = pOldParams->begin();
+ while ( pIt != pOldParams->end() )
+ {
+ pNewParams->insert( *pIt );
+ pIt++;
+ }
+ }
+
::sfx2::Metadatable const*const pMetadatable(
dynamic_cast< ::sfx2::Metadatable const* >(pMark));
::sfx2::Metadatable *const pNewMetadatable(
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 8e721b415378..1ba462f23a3d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -977,7 +977,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
SwStartNode* pSttNd;
SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd ));
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aSttIdx.GetIndex(), pTxtNd->GetTxt().Len(), aBkmkArr );
const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
@@ -989,7 +989,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
aCntPos.nContent = nChPos;
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode( aCntPos );
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pNewNd, nChPos,
nChPos + 1 );
@@ -1013,7 +1013,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
}
// und jetzt den letzten Teil-String
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pTxtNd, pTxtNd->GetTxt().Len(),
pTxtNd->GetTxt().Len()+1 );
@@ -1508,14 +1508,14 @@ sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
aCntIdx.GetIndex() );
- SvULongs aBkmkArr( 4, 4 );
+ std::vector<sal_uLong> aBkmkArr;
xub_StrLen nOldTxtLen = aCntIdx.GetIndex();
_SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().Len(),
aBkmkArr );
pDelPara->pLastNd->JoinNext();
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr,
pDelPara->pLastNd->GetIndex(),
nOldTxtLen );
@@ -2145,7 +2145,7 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
if( rTbl.ISA( SwDDETable ))
return sal_False;
- SvULongs aNdsCnts;
+ std::vector<sal_uLong> aNdsCnts;
SwTableSortBoxes aTmpLst( 0, 5 );
SwUndoTblNdsChg* pUndo = 0;
if (GetIDocumentUndoRedo().DoesUndo())
@@ -2159,8 +2159,8 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd();
- aNdsCnts.Insert( pSttNd->EndOfSectionIndex() -
- pSttNd->GetIndex(), n );
+ aNdsCnts.push_back( pSttNd->EndOfSectionIndex() -
+ pSttNd->GetIndex() );
}
}
}
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 58005a97832b..9897e0a5f23d 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -204,7 +204,7 @@ void SwEditShell::FieldToText( SwFieldType* pType )
SwFieldHint aHint( pPaM );
SwClientIter aIter( *pType );
- for ( SwClient* pClient = aIter.GoStart(); pClient; aIter++ )
+ for ( SwClient* pClient = aIter.GoStart(); pClient; pClient = aIter++ )
{
pPaM->DeleteMark();
pClient->SwClientNotifyCall( *pType, aHint );
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 9881aa3f1702..17f0dd225c42 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -73,7 +73,7 @@
#include <set>
#include <map>
-#include "../../../../../libs-core/sfx2/inc/sfx2/childwin.hxx"
+#include <sfx2/childwin.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::text;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 436153808496..2e09a378a224 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1194,6 +1194,19 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
}
}
+ // Don't select header / footer objects in body edition and vice-versa
+ SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
+ if ( !pContact->ObjAnchoredAtPage() )
+ {
+ const SwPosition& rPos = pContact->GetCntntAnchor();
+ bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rPos.nNode );
+ if ( ( IsHeaderFooterEdit() && !bInHdrFtr ) ||
+ ( !IsHeaderFooterEdit() && bInHdrFtr ) )
+ {
+ bRet = sal_False;
+ }
+ }
+
if ( bRet )
{
const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0);
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 2afde1cf1d55..4dc03adf570d 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -1314,4 +1314,16 @@ void SwFEShell::MoveObjectIfActive( svt::EmbeddedObjectRef&, const Point& )
// does not do anything, only avoids crash if the method is used for wrong shell
}
+void SwFEShell::ToggleHeaderFooterEdit()
+{
+ // Clear objects selection
+ if ( Imp()->GetDrawView()->AreObjectsMarked() )
+ {
+ Imp()->GetDrawView()->UnmarkAll();
+ ClearMark();
+ }
+
+ SwCrsrShell::ToggleHeaderFooterEdit();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 78c0af9a8a68..be93d4af436c 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -32,11 +32,11 @@
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
#endif
#include <vector>
+#include <set>
#include <swtypes.hxx>
#include <itabenum.hxx>
@@ -90,7 +90,7 @@ class SwUndoTxtToTbl : public SwUndo, public SwUndRng
{
String sTblNm;
SwInsertTableOptions aInsTblOpts;
- SvULongs* pDelBoxes;
+ std::vector<sal_uLong>* pDelBoxes;
SwTableAutoFmt* pAutoFmt;
SwHistory* pHistory;
sal_Unicode cTrenner;
@@ -179,13 +179,16 @@ public:
class SwUndoTblNdsChg : public SwUndo
{
_SaveTable* pSaveTbl;
- SvULongs aBoxes;
-
- union {
- SvULongs* pNewSttNds;
- SwUndoSaveSections* pDelSects;
- } Ptrs;
- std::vector<bool> aMvBoxes; // for SplitRow (split Nodes of Box)
+ std::set<sal_uLong> aBoxes;
+ struct _BoxMove
+ {
+ sal_uLong index; ///< Index of this box.
+ bool hasMoved; ///< Has this box been moved already.
+ _BoxMove(sal_uLong idx, bool moved=false) : index(idx), hasMoved(moved) {};
+ bool operator<(const _BoxMove other) const { return index < other.index; };
+ };
+ std::set<_BoxMove> *pNewSttNds;
+ SwUndoSaveSections *pDelSects;
long nMin, nMax; // for redo of delete column
sal_uLong nSttNode, nCurrBox;
sal_uInt16 nCount, nRelDiff, nAbsDiff, nSetColType;
@@ -209,7 +212,7 @@ public:
void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld );
void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld,
- const SwSelBoxes& rBoxes, const SvULongs& rNodeCnts );
+ const SwSelBoxes& rBoxes, const std::vector<sal_uLong> &rNodeCnts );
void SaveSection( SwStartNode* pSttNd );
void ReNewBoxes( const SwSelBoxes& rBoxes );
@@ -230,7 +233,8 @@ class SwUndoTblMerge : public SwUndo, private SwUndRng
{
sal_uLong nTblNode;
_SaveTable* pSaveTbl;
- SvULongs aBoxes, aNewSttNds;
+ std::set<sal_uLong> aBoxes;
+ std::vector<sal_uLong> aNewSttNds;
SwUndoMoves* pMoves;
SwHistory* pHistory;
@@ -247,7 +251,7 @@ public:
void SetSelBoxes( const SwSelBoxes& rBoxes );
void AddNewBox( sal_uLong nSttNdIdx )
- { aNewSttNds.Insert( nSttNdIdx, aNewSttNds.Count() ); }
+ { aNewSttNds.push_back( nSttNdIdx ); }
void SaveCollection( const SwTableBox& rBox );
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 3b41dd650a02..74e33df9aa76 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -30,6 +30,7 @@
#include <vector>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <svl/svarray.hxx>
#include <editeng/borderline.hxx>
#include "swtypes.hxx" // fuer SwTwips
@@ -527,6 +528,7 @@ public:
void PaintBorderLine( const SwRect&, const SwRect&, const SwPageFrm*,
const Color *pColor, const editeng::SvxBorderStyle = editeng::SOLID ) const;
+ drawinglayer::processor2d::BaseProcessor2D * CreateProcessor2D( ) const;
void ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const;
//Retouche, nicht im Bereich des uebergebenen Rect!
@@ -909,6 +911,8 @@ public:
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
void dumpChildrenAsXml(xmlTextWriterPtr writer);
bool IsCollapse() const;
+
+ sal_uInt64 SetHeaderFooterEditMask( OutputDevice* pOut ) const;
};
inline sal_Bool SwFrm::IsInDocBody() const
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index ed4a856de65a..37ebc5b4ce72 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -39,7 +39,6 @@ namespace sfx2 {
}
class SvNumberFormatter;
-class SvULongs;
class SwDoc;
class SwFmtAnchor;
class SwFrmFmt;
@@ -92,11 +91,11 @@ void _DelBookmarks(const SwNodeIndex& rStt,
const SwIndex* pSttIdx =0,
const SwIndex* pEndIdx =0);
void _SaveCntntIdx( SwDoc* pDoc, sal_uLong nNode, xub_StrLen nCntnt,
- SvULongs& rSaveArr, sal_uInt8 nSaveFly = 0 );
-void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr,
+ std::vector<sal_uLong>& rSaveArr, sal_uInt8 nSaveFly = 0 );
+void _RestoreCntntIdx( SwDoc* pDoc, std::vector<sal_uLong>& rSaveArr,
sal_uLong nNode, xub_StrLen nOffset = 0,
sal_Bool bAuto = sal_False );
-void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd,
+void _RestoreCntntIdx( std::vector<sal_uLong>& rSaveArr, const SwNode& rNd,
xub_StrLen nLen, xub_StrLen nCorrLen );
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 1fb456dea39d..dfb0cefa1911 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -209,6 +209,8 @@ public:
void PaintGrid( OutputDevice* pOut, SwRect &rRect ) const;
sal_Bool HasGrid() const { return bHasGrid; }
+ void PaintDecorators( OutputDevice* pOut ) const;
+
//Zeilennummern usw malen
void RefreshExtraData( const SwRect & ) const;
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index d814bc089666..fd0ac6a14a9b 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -53,24 +53,25 @@ typedef std::list< xub_StrLen > PositionList;
class SwScanner
{
- XubString aWord;
+ rtl::OUString aWord;
const SwTxtNode& rNode;
- const String& rText;
+ const rtl::OUString& rText;
const LanguageType* pLanguage;
const ModelToViewHelper::ConversionMap* pConversionMap;
- xub_StrLen nStartPos;
- xub_StrLen nEndPos;
- xub_StrLen nBegin;
- xub_StrLen nLen;
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPos;
+ sal_Int32 nBegin;
+ sal_Int32 nLen;
LanguageType aCurrLang;
sal_uInt16 nWordType;
sal_Bool bClip;
public:
- SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageType* pLang,
+ SwScanner( const SwTxtNode& rNd, const rtl::OUString& rTxt,
+ const LanguageType* pLang,
const ModelToViewHelper::ConversionMap* pConvMap,
sal_uInt16 nWordType,
- xub_StrLen nStart, xub_StrLen nEnde, sal_Bool bClip = sal_False );
+ sal_Int32 nStart, sal_Int32 nEnde, sal_Bool bClip = sal_False );
// This next word function tries to find the language for the next word
@@ -78,11 +79,11 @@ public:
// ! bReverse
sal_Bool NextWord();
- const XubString& GetWord() const { return aWord; }
+ const rtl::OUString& GetWord() const { return aWord; }
- xub_StrLen GetBegin() const { return nBegin; }
- xub_StrLen GetEnd() const { return nBegin + nLen; }
- xub_StrLen GetLen() const { return nLen; }
+ sal_Int32 GetBegin() const { return nBegin; }
+ sal_Int32 GetEnd() const { return nBegin + nLen; }
+ sal_Int32 GetLen() const { return nLen; }
LanguageType GetCurrentLanguage() const {return aCurrLang;}
};
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index ac4dcd56119b..bb79020b893b 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -129,8 +129,9 @@
#include "ndtxt.hxx"
#include "dflyobj.hxx"
#include <fntcache.hxx>
-// OD 2004-05-24 #i28701#
-#include <sortedobjs.hxx>
+#include <sortedobjs.hxx> // #i28701#
+
+#include <rtl/strbuf.hxx>
sal_uLong SwProtocol::nRecord = 0;
SwImplProtocol* SwProtocol::pImpl = NULL;
@@ -152,7 +153,7 @@ class SwImplProtocol
SvFileStream *pStream; // Ausgabestream
std::set<sal_uInt16> *pFrmIds; // welche FrmIds sollen aufgezeichnet werden ( NULL == alle )
std::vector<long> aVars; // Variables
- ByteString aLayer; // Einrueckung der Ausgabe (" " pro Start/End)
+ rtl::OStringBuffer aLayer; // Einrueckung der Ausgabe (" " pro Start/End)
sal_uInt16 nTypes; // welche Typen sollen aufgezeichnet werden
sal_uInt16 nLineCount; // Ausgegebene Zeilen
sal_uInt16 nMaxLines; // Maximal auszugebende Zeilen
@@ -162,7 +163,7 @@ class SwImplProtocol
void _Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong nAct, void* pParam );
sal_Bool NewStream();
void CheckLine( ByteString& rLine );
- void SectFunc( ByteString &rOut, const SwFrm* pFrm, sal_uLong nAct, void* pParam );
+ void SectFunc( rtl::OStringBuffer& rOut, const SwFrm* pFrm, sal_uLong nAct, void* pParam );
public:
SwImplProtocol();
~SwImplProtocol();
@@ -470,21 +471,21 @@ void SwImplProtocol::FileInit()
* lcl_Start sorgt fuer Einrueckung um zwei Blanks bei ACT_START
* und nimmt diese bei ACT_END wieder zurueck.
* --------------------------------------------------*/
-void lcl_Start( ByteString& rOut, ByteString& rLay, sal_uLong nAction )
+void lcl_Start(rtl::OStringBuffer& rOut, rtl::OStringBuffer& rLay, sal_uLong nAction)
{
if( nAction == ACT_START )
{
- rLay += " ";
- rOut += " On";
+ rLay.append(RTL_CONSTASCII_STRINGPARAM(" "));
+ rOut.append(RTL_CONSTASCII_STRINGPARAM(" On"));
}
else if( nAction == ACT_END )
{
- if( rLay.Len() > 1 )
+ if( rLay.getLength() > 1 )
{
- rLay.Erase( rLay.Len() - 2 );
- rOut.Erase( 0, 2 );
+ rLay.remove(rLay.getLength() - 2, rLay.getLength());
+ rOut.remove(0, 2);
}
- rOut += " Off";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM(" Off"));
}
}
@@ -493,63 +494,63 @@ void lcl_Start( ByteString& rOut, ByteString& rLay, sal_uLong nAction )
* des Frames aus, "+" fuer valid, "-" fuer invalid.
* --------------------------------------------------*/
-void lcl_Flags( ByteString& rOut, const SwFrm* pFrm )
+void lcl_Flags(rtl::OStringBuffer& rOut, const SwFrm* pFrm)
{
- rOut += " Sz";
- rOut += pFrm->GetValidSizeFlag() ? '+' : '-';
- rOut += " Ps";
- rOut += pFrm->GetValidPosFlag() ? '+' : '-';
- rOut += " PA";
- rOut += pFrm->GetValidPrtAreaFlag() ? '+' : '-';
+ rOut.append(RTL_CONSTASCII_STRINGPARAM(" Sz"));
+ rOut.append(pFrm->GetValidSizeFlag() ? '+' : '-');
+ rOut.append(RTL_CONSTASCII_STRINGPARAM(" Ps"));
+ rOut.append(pFrm->GetValidPosFlag() ? '+' : '-');
+ rOut.append(RTL_CONSTASCII_STRINGPARAM(" PA"));
+ rOut.append(pFrm->GetValidPrtAreaFlag() ? '+' : '-');
}
/* --------------------------------------------------
* lcl_FrameType gibt den Typ des Frames in Klartext aus.
* --------------------------------------------------*/
-void lcl_FrameType( ByteString& rOut, const SwFrm* pFrm )
+void lcl_FrameType( rtl::OStringBuffer& rOut, const SwFrm* pFrm )
{
if( pFrm->IsTxtFrm() )
- rOut += "Txt ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Txt "));
else if( pFrm->IsLayoutFrm() )
{
if( pFrm->IsPageFrm() )
- rOut += "Page ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Page "));
else if( pFrm->IsColumnFrm() )
- rOut += "Col ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Col "));
else if( pFrm->IsBodyFrm() )
{
if( pFrm->GetUpper() && pFrm->IsColBodyFrm() )
- rOut += "(Col)";
- rOut += "Body ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("(Col)"));
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Body "));
}
else if( pFrm->IsRootFrm() )
- rOut += "Root ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Root "));
else if( pFrm->IsCellFrm() )
- rOut += "Cell ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Cell "));
else if( pFrm->IsTabFrm() )
- rOut += "Tab ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Tab "));
else if( pFrm->IsRowFrm() )
- rOut += "Row ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Row "));
else if( pFrm->IsSctFrm() )
- rOut += "Sect ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Sect "));
else if( pFrm->IsHeaderFrm() )
- rOut += "Header ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Header "));
else if( pFrm->IsFooterFrm() )
- rOut += "Footer ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Footer "));
else if( pFrm->IsFtnFrm() )
- rOut += "Ftn ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Ftn "));
else if( pFrm->IsFtnContFrm() )
- rOut += "FtnCont ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("FtnCont "));
else if( pFrm->IsFlyFrm() )
- rOut += "Fly ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Fly "));
else
- rOut += "Layout ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Layout "));
}
else if( pFrm->IsNoTxtFrm() )
- rOut += "NoTxt ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("NoTxt "));
else
- rOut += "Not impl. ";
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Not impl. "));
}
/* --------------------------------------------------
@@ -586,75 +587,92 @@ void SwImplProtocol::_Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong
if( 1 == nTestMode && nFunction != PROT_TESTFORMAT )
return; // Wir sollen nur innerhalb einer Testformatierung aufzeichnen
sal_Bool bTmp = sal_False;
- ByteString aOut = aLayer;
- aOut += ByteString::CreateFromInt64( lcl_GetFrameId( pFrm ) );
- aOut += ' ';
+ rtl::OStringBuffer aOut(aLayer);
+ aOut.append(static_cast<sal_Int64>(lcl_GetFrameId(pFrm)));
+ aOut.append(' ');
lcl_FrameType( aOut, pFrm ); // dann den FrameType
switch ( nFunction ) // und die Funktion
{
case PROT_SNAPSHOT: lcl_Flags( aOut, pFrm );
break;
- case PROT_MAKEALL: aOut += "MakeAll";
+ case PROT_MAKEALL: aOut.append(RTL_CONSTASCII_STRINGPARAM("MakeAll"));
lcl_Start( aOut, aLayer, nAct );
if( nAct == ACT_START )
lcl_Flags( aOut, pFrm );
break;
case PROT_MOVE_FWD: bTmp = sal_True; // NoBreak
- case PROT_MOVE_BWD: aOut += ( nFunction == bTmp ) ? "Fwd" : "Bwd";
+ case PROT_MOVE_BWD:
+ if (nFunction == bTmp)
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Fwd"));
+ else
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Bwd"));
lcl_Start( aOut, aLayer, nAct );
if( pParam )
{
- aOut += ' ';
- aOut += ByteString::CreateFromInt32( *((sal_uInt16*)pParam) );
+ aOut.append(' ');
+ aOut.append(static_cast<sal_Int32>(*((sal_uInt16*)pParam)));
}
break;
case PROT_GROW_TST: if( ACT_START != nAct )
return;
- aOut += "TestGrow";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("TestGrow"));
break;
case PROT_SHRINK_TST: if( ACT_START != nAct )
return;
- aOut += "TestShrink";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("TestShrink"));
break;
case PROT_ADJUSTN :
case PROT_SHRINK: bTmp = sal_True; // NoBreak
- case PROT_GROW: aOut += !bTmp ? "Grow" :
- ( nFunction == PROT_SHRINK ? "Shrink" : "AdjustNgbhd" );
+ case PROT_GROW:
+ if (!bTmp)
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Grow"));
+ else
+ {
+ if (nFunction == PROT_SHRINK)
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Shrink"));
+ else
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("AdjustNgbhd"));
+ }
lcl_Start( aOut, aLayer, nAct );
if( pParam )
{
- aOut += ' ';
- aOut += ByteString::CreateFromInt64( *((long*)pParam) );
+ aOut.append(' ');
+ aOut.append(static_cast<sal_Int64>(*((long*)pParam)));
}
break;
case PROT_POS: break;
- case PROT_PRTAREA: aOut += "PrtArea";
+ case PROT_PRTAREA: aOut.append(RTL_CONSTASCII_STRINGPARAM("PrtArea"));
lcl_Start( aOut, aLayer, nAct );
break;
- case PROT_SIZE: aOut += "Size";
+ case PROT_SIZE: aOut.append(RTL_CONSTASCII_STRINGPARAM("Size"));
lcl_Start( aOut, aLayer, nAct );
- aOut += ' ';
- aOut += ByteString::CreateFromInt64( pFrm->Frm().Height() );
+ aOut.append(' ');
+ aOut.append(static_cast<sal_Int64>(pFrm->Frm().Height()));
break;
- case PROT_LEAF: aOut += "Prev/NextLeaf";
+ case PROT_LEAF: aOut.append(RTL_CONSTASCII_STRINGPARAM("Prev/NextLeaf"));
lcl_Start( aOut, aLayer, nAct );
- aOut += ' ';
+ aOut.append(' ');
if( pParam )
{
- aOut += ' ';
- aOut += ByteString::CreateFromInt64( lcl_GetFrameId( (SwFrm*)pParam ) );
+ aOut.append(' ');
+ aOut.append(static_cast<sal_Int64>(lcl_GetFrameId((SwFrm*)pParam)));
}
break;
case PROT_FILE_INIT: FileInit();
- aOut = "Initialize";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Initialize"));
break;
- case PROT_SECTION: SectFunc( aOut, pFrm, nAct, pParam );
+ case PROT_SECTION: SectFunc(aOut, pFrm, nAct, pParam);
break;
case PROT_CUT: bTmp = sal_True; // NoBreak
- case PROT_PASTE: aOut += bTmp ? "Cut from " : "Paste to ";
- aOut += ByteString::CreateFromInt64( lcl_GetFrameId( (SwFrm*)pParam ) );
+ case PROT_PASTE:
+ if (bTmp)
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Cut from "));
+ else
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Paste to "));
+ aOut.append(static_cast<sal_Int64>(lcl_GetFrameId((SwFrm*)pParam)));
break;
- case PROT_TESTFORMAT: aOut += "Test";
+ case PROT_TESTFORMAT:
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Test"));
lcl_Start( aOut, aLayer, nAct );
if( ACT_START == nAct )
nTestMode |= 2;
@@ -666,36 +684,36 @@ void SwImplProtocol::_Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong
SwRect& rFrm = *((SwRect*)pParam);
if( pFrm->Frm().Pos() != rFrm.Pos() )
{
- aOut += "PosChg: (";
- aOut += ByteString::CreateFromInt64(rFrm.Left());
- aOut += ", ";
- aOut += ByteString::CreateFromInt64(rFrm.Top());
- aOut += ") (";
- aOut += ByteString::CreateFromInt64(pFrm->Frm().Left());
- aOut += ", ";
- aOut += ByteString::CreateFromInt64(pFrm->Frm().Top());
- aOut += ") ";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("PosChg: ("));
+ aOut.append(static_cast<sal_Int64>(rFrm.Left()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(", "));
+ aOut.append(static_cast<sal_Int64>(rFrm.Top()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(") ("));
+ aOut.append(static_cast<sal_Int64>(pFrm->Frm().Left()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(", "));
+ aOut.append(static_cast<sal_Int64>(pFrm->Frm().Top()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(") "));
}
if( pFrm->Frm().Height() != rFrm.Height() )
{
- aOut += "Height: ";
- aOut += ByteString::CreateFromInt64(rFrm.Height());
- aOut += " -> ";
- aOut += ByteString::CreateFromInt64(pFrm->Frm().Height());
- aOut += " ";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Height: "));
+ aOut.append(static_cast<sal_Int64>(rFrm.Height()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(" -> "));
+ aOut.append(static_cast<sal_Int64>(pFrm->Frm().Height()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(" "));
}
if( pFrm->Frm().Width() != rFrm.Width() )
{
- aOut += "Width: ";
- aOut += ByteString::CreateFromInt64(rFrm.Width());
- aOut += " -> ";
- aOut += ByteString::CreateFromInt64(pFrm->Frm().Width());
- aOut += " ";
+ aOut.append(RTL_CONSTASCII_STRINGPARAM("Width: "));
+ aOut.append(static_cast<sal_Int64>(rFrm.Width()));
+ aOut.append(RTL_CONSTASCII_STRINGPARAM(" -> "));
+ aOut.append(static_cast<sal_Int64>(pFrm->Frm().Width()));
+ aOut.append(' ');
}
break;
}
}
- *pStream << aOut.GetBuffer() << endl; // Ausgabe
+ *pStream << aOut.getStr() << endl; // Ausgabe
pStream->Flush(); // Gleich auf die Platte, damit man mitlesen kann
if( ++nLineCount >= nMaxLines ) // Maximale Ausgabe erreicht?
SwProtocol::SetRecord( 0 ); // => Ende der Aufzeichnung
@@ -706,23 +724,29 @@ void SwImplProtocol::_Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong
* hier werden die Ausgaben rund um SectionFrms abgehandelt.
* --------------------------------------------------*/
-void SwImplProtocol::SectFunc( ByteString &rOut, const SwFrm* , sal_uLong nAct, void* pParam )
+void SwImplProtocol::SectFunc(rtl::OStringBuffer &rOut, const SwFrm* , sal_uLong nAct, void* pParam)
{
sal_Bool bTmp = sal_False;
switch( nAct )
{
- case ACT_MERGE: rOut += "Merge Section ";
- rOut += ByteString::CreateFromInt64( lcl_GetFrameId( (SwFrm*)pParam ) );
+ case ACT_MERGE: rOut.append(RTL_CONSTASCII_STRINGPARAM("Merge Section "));
+ rOut.append(static_cast<sal_Int64>(lcl_GetFrameId((SwFrm*)pParam)));
break;
case ACT_CREATE_MASTER: bTmp = sal_True; // NoBreak
- case ACT_CREATE_FOLLOW: rOut += "Create Section ";
- rOut += bTmp ? "Master to " : "Follow from ";
- rOut += ByteString::CreateFromInt64( lcl_GetFrameId( (SwFrm*)pParam ) );
+ case ACT_CREATE_FOLLOW: rOut.append(RTL_CONSTASCII_STRINGPARAM("Create Section "));
+ if (bTmp)
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Master to "));
+ else
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Follow from "));
+ rOut.append(static_cast<sal_Int64>(lcl_GetFrameId((SwFrm*)pParam)));
break;
case ACT_DEL_MASTER: bTmp = sal_True; // NoBreak
- case ACT_DEL_FOLLOW: rOut += "Delete Section ";
- rOut += bTmp ? "Master to " : "Follow from ";
- rOut += ByteString::CreateFromInt64( lcl_GetFrameId( (SwFrm*)pParam ) );
+ case ACT_DEL_FOLLOW: rOut.append(RTL_CONSTASCII_STRINGPARAM("Delete Section "));
+ if (bTmp)
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Master to "));
+ else
+ rOut.append(RTL_CONSTASCII_STRINGPARAM("Follow from "));
+ rOut.append(static_cast<sal_Int64>(lcl_GetFrameId((SwFrm*)pParam)));
break;
}
}
@@ -767,7 +791,7 @@ void SwImplProtocol::SnapShot( const SwFrm* pFrm, sal_uLong nFlags )
_Record( pFrm, PROT_SNAPSHOT, 0, 0);
if( pFrm->GetDrawObjs() && nFlags & SNAP_FLYFRAMES )
{
- aLayer += "[ ";
+ aLayer.append(RTL_CONSTASCII_STRINGPARAM("[ "));
const SwSortedObjs &rObjs = *pFrm->GetDrawObjs();
for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
{
@@ -775,16 +799,16 @@ void SwImplProtocol::SnapShot( const SwFrm* pFrm, sal_uLong nFlags )
if ( pObj->ISA(SwFlyFrm) )
SnapShot( static_cast<SwFlyFrm*>(pObj), nFlags );
}
- if( aLayer.Len() > 1 )
- aLayer.Erase( aLayer.Len() - 2 );
+ if (aLayer.getLength() > 1)
+ aLayer.remove(aLayer.getLength() - 2, aLayer.getLength());
}
if( pFrm->IsLayoutFrm() && nFlags & SNAP_LOWER &&
( !pFrm->IsTabFrm() || nFlags & SNAP_TABLECONT ) )
{
- aLayer += " ";
+ aLayer.append(RTL_CONSTASCII_STRINGPARAM(" "));
SnapShot( ((SwLayoutFrm*)pFrm)->Lower(), nFlags );
- if( aLayer.Len() > 1 )
- aLayer.Erase( aLayer.Len() - 2 );
+ if (aLayer.getLength() > 1)
+ aLayer.remove(aLayer.getLength() - 2, aLayer.getLength());
}
pFrm = pFrm->GetNext();
}
diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx
index 6fe482b2b25b..b5ee4eeb4992 100644
--- a/sw/source/core/layout/dumpfilter.cxx
+++ b/sw/source/core/layout/dumpfilter.cxx
@@ -77,7 +77,7 @@ namespace
strncpy( ( char * ) seq.getArray() , sBuffer, nLen );
xOut->writeBytes( seq );
}
- catch ( uno::Exception )
+ catch (const uno::Exception&)
{
written = -1;
}
@@ -94,7 +94,7 @@ namespace
uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW );
xOut->closeOutput( );
}
- catch ( uno::Exception )
+ catch (const uno::Exception&)
{
result = -1;
}
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 75bafc4dd1a9..51b4bfaa067e 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2678,7 +2678,7 @@ void SwPageFrm::UpdateFtnNum()
SwPageFrm* pPage = pTmpBoss->FindPageFrm();
pFtn = NULL;
lcl_NextFtnBoss( pTmpBoss, pPage, sal_False );
- SwFtnContFrm *pCont = pTmpBoss->FindNearestFtnCont();
+ SwFtnContFrm *pCont = pTmpBoss ? pTmpBoss->FindNearestFtnCont() : NULL;
if ( pCont )
pFtn = (SwFtnFrm*)pCont->Lower();
}
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index c44d7de0a0a9..1c4296124b9a 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -103,7 +103,7 @@ void SwLayoutCache::Read( SvStream &rStream )
void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, xub_StrLen nOffset )
{
aType.Insert( nType, aType.Count() );
- SvULongs::Insert( nIndex, SvULongs::Count() );
+ std::vector<sal_uLong>::push_back( nIndex );
aOffset.push_back( nOffset );
}
@@ -363,7 +363,7 @@ sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
pPage = (SwPageFrm*)pPage->GetNext();
while( pPage )
{
- if( nIndex >= pImpl->Count() )
+ if( nIndex >= pImpl->size() )
{
if( bRet )
bRet = sal_False;
@@ -525,9 +525,9 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg,
nNodeIndex -= nStartOfContent;
nIndex = 0;
nFlyIdx = 0;
- while( nIndex < pImpl->Count() && (*pImpl)[ nIndex ] < nNodeIndex )
+ while( nIndex < pImpl->size() && (*pImpl)[ nIndex ] < nNodeIndex )
++nIndex;
- if( nIndex >= pImpl->Count() )
+ if( nIndex >= pImpl->size() )
{
pDoc->GetLayoutCache()->UnlockImpl();
pImpl = NULL;
@@ -562,7 +562,7 @@ sal_uLong SwLayHelper::CalcPageCount()
pDoc->GetLayoutCache()->LockImpl() : NULL;
if( pCache )
{
- nPgCount = pCache->Count() + 1;
+ nPgCount = pCache->size() + 1;
pDoc->GetLayoutCache()->UnlockImpl();
}
else
@@ -804,14 +804,14 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
}
else
++nParagraphCnt;
- if( bFirst && pImpl && nIndex < pImpl->Count() &&
+ if( bFirst && pImpl && nIndex < pImpl->size() &&
pImpl->GetBreakIndex( nIndex ) == nNodeIndex &&
( pImpl->GetBreakOfst( nIndex ) < STRING_LEN ||
- ( ++nIndex < pImpl->Count() &&
+ ( ++nIndex < pImpl->size() &&
pImpl->GetBreakIndex( nIndex ) == nNodeIndex ) ) )
bFirst = sal_False;
#if OSL_DEBUG_LEVEL > 1
- sal_uLong nBreakIndex = ( pImpl && nIndex < pImpl->Count() ) ?
+ sal_uLong nBreakIndex = ( pImpl && nIndex < pImpl->size() ) ?
pImpl->GetBreakIndex(nIndex) : 0xffff;
(void)nBreakIndex;
#endif
@@ -826,7 +826,7 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
if( pImpl || bLongTab )
{
#if OSL_DEBUG_LEVEL > 1
- sal_uLong nBrkIndex = ( pImpl && nIndex < pImpl->Count() ) ?
+ sal_uLong nBrkIndex = ( pImpl && nIndex < pImpl->size() ) ?
pImpl->GetBreakIndex(nIndex) : 0xffff;
(void)nBrkIndex;
#endif
@@ -839,10 +839,10 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
}
else
{
- while( nIndex < pImpl->Count() &&
+ while( nIndex < pImpl->size() &&
pImpl->GetBreakIndex(nIndex) < nNodeIndex)
++nIndex;
- if( nIndex < pImpl->Count() &&
+ if( nIndex < pImpl->size() &&
pImpl->GetBreakIndex(nIndex) == nNodeIndex )
{
nType = pImpl->GetBreakType( nIndex );
@@ -982,7 +982,7 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
rpLay = rpLay->GetNextLayoutLeaf();
}
}
- } while( bLongTab || ( pImpl && nIndex < pImpl->Count() &&
+ } while( bLongTab || ( pImpl && nIndex < pImpl->size() &&
(*pImpl)[ nIndex ] == nNodeIndex ) );
}
bFirst = sal_False;
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index d690940320d7..edd60207deb7 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -29,7 +29,6 @@
#define _LAYHELP_HXX
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
#define _SVSTDARR_XUB_STRLEN
#include <svl/svstdarr.hxx>
#endif
@@ -63,7 +62,7 @@ class SwFlyCache;
typedef SwFlyCache* SwFlyCachePtr;
SV_DECL_PTRARR_DEL( SwPageFlyCache, SwFlyCachePtr, 0, 4 )
-class SwLayCacheImpl : public SvULongs
+class SwLayCacheImpl : public std::vector<sal_uLong>
{
SvXub_StrLens aOffset;
SvUShorts aType;
@@ -72,10 +71,10 @@ class SwLayCacheImpl : public SvULongs
void Insert( sal_uInt16 nType, sal_uLong nIndex, xub_StrLen nOffset );
public:
- SwLayCacheImpl() : SvULongs( 20, 10 ), aType( 20, 10 ) {}
+ SwLayCacheImpl() : aType( 20, 10 ) {}
sal_Bool Read( SvStream& rStream );
- sal_uLong GetBreakIndex( sal_uInt16 nIdx ) const { return GetObject( nIdx ); }
+ sal_uLong GetBreakIndex( sal_uInt16 nIdx ) const { return std::vector<sal_uLong>::operator[]( nIdx ); }
xub_StrLen GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index fa8fbf2695e1..bd68607ccddb 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -86,6 +86,10 @@
#include <svx/svdogrp.hxx>
#include <sortedobjs.hxx>
#include <EnhancedPDFExportHelper.hxx>
+#include <fesh.hxx>
+#include <svx/svdpage.hxx>
+#include <hffrm.hxx>
+#include <fmtpdsc.hxx>
// <--
// --> OD #i76669#
#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
@@ -109,11 +113,16 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <svx/sdr/contact/objectcontacttools.hxx>
#include <svx/unoapi.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
using namespace ::editeng;
using namespace ::com::sun::star;
@@ -2960,6 +2969,30 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
if ( pSh->Imp()->HasDrawView() )
{
+ // Loop over the drawing object to mark them as in or outside a group
+ if ( !pGlobalShell->GetViewOptions()->IsPDFExport() &&
+ !pGlobalShell->GetViewOptions()->IsPrinting() &&
+ !pGlobalShell->IsPreView() )
+ {
+ SdrObjList* pObjs = pSh->Imp()->GetPageView()->GetObjList();
+ for ( sal_uInt32 i = 0; pObjs && i < pObjs->GetObjCount(); i++ )
+ {
+ SdrObject* pDrawObj = pObjs->GetObj( i );
+ const SwContact* pContact = ::GetUserCall( pDrawObj );
+ const SwAnchoredObject* pObj = pContact->GetAnchoredObj( pDrawObj );
+
+ const SwFrm* pAnchorFrm = pObj->GetAnchorFrm();
+ bool bInHeaderFooter = false;
+
+ // Handle all non anchored as character objects... others are handled elsewere
+ if ( pAnchorFrm )
+ bInHeaderFooter = pAnchorFrm->FindFooterOrHeader() != NULL;
+ bool bHeaderFooterEdit = pSh->IsHeaderFooterEdit();
+
+ pDrawObj->SetGhosted( bHeaderFooterEdit ^ bInHeaderFooter );
+ }
+ }
+
pLines->LockLines( sal_True );
const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
pSh->Imp()->PaintLayer( pIDDMA->GetHellId(),
@@ -3007,6 +3040,8 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
if ( bExtraData )
pPage->RefreshExtraData( aPaintRect );
+ pPage->PaintDecorators( pSh->GetOut() );
+
if ( pSh->GetWin() )
{
pSubsLines->PaintSubsidiary( pSh->GetOut(), pLines );
@@ -3284,11 +3319,143 @@ void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
::lcl_EmergencyFormatFtnCont( (SwFtnContFrm*)pFrm->GetNext() );
pFrm = pFrm->GetNext();
+
if ( pFrm && (sal_True == (bCnt = pFrm->IsCntntFrm())) )
pFrm->Calc();
}
}
+drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPrimitives(
+ OutputDevice* pOut, drawinglayer::processor2d::BaseProcessor2D* pProcessor,
+ double nLeft, double nRight, double nLineY,
+ bool bHeader, const String& rStyleName )
+{
+ drawinglayer::primitive2d::Primitive2DSequence aSeq( 4 );
+
+ basegfx::B2DPoint aLeft ( nLeft, nLineY );
+ basegfx::B2DPoint aRight( nRight, nLineY );
+
+ // Compute the text to show
+ String aText = SW_RESSTR( STR_HEADER );
+ if ( !bHeader )
+ aText = SW_RESSTR( STR_FOOTER );
+ aText += rStyleName;
+
+ // Colors
+ basegfx::BColor aLineColor( 3.0 / 255.0, 105.0 / 255.0, 163.0 / 255.0 );
+ basegfx::BColor aFillColor( 170.0 / 255.0, 220.0 / 255.0, 247.0 / 255.0 );
+
+ // Dashed line in twips
+ std::vector< double > aStrokePattern;
+ aStrokePattern.push_back( 110 );
+ aStrokePattern.push_back( 110 );
+
+
+ // Compute the dashed line primitive
+ basegfx::B2DPolygon aLinePolygon;
+ aLinePolygon.append( aLeft );
+ aLinePolygon.append( aRight );
+
+ drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
+ new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D (
+ basegfx::B2DPolyPolygon( aLinePolygon ),
+ drawinglayer::attribute::LineAttribute( aLineColor, 20.0 ),
+ drawinglayer::attribute::StrokeAttribute( aStrokePattern ) );
+
+ aSeq[1] = drawinglayer::primitive2d::Primitive2DReference( pLine );
+
+ // Compute the text primitive
+ basegfx::B2DVector aFontSize;
+
+ Font aFont = pOut->GetSettings().GetStyleSettings().GetAppFont();
+ aFont.SetHeight( 8 * 20 ); // 8pt to twips
+
+ drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontSize, aFont, false, false );
+
+ FontMetric aFontMetric = pOut->GetFontMetric( aFont );
+
+ double nTextOffsetY = aFontMetric.GetHeight() - aFontMetric.GetDescent() + 70.0;
+ if ( !bHeader )
+ nTextOffsetY = - aFontMetric.GetDescent() - 70.0;
+ basegfx::B2DHomMatrix aTextMatrix( basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aFontSize.getX(), aFontSize.getY(),
+ nLeft + 80.0, nLineY + nTextOffsetY ) );
+
+
+ drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
+ new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aTextMatrix,
+ aText, 0, aText.Len(),
+ std::vector< double >(),
+ aFontAttr,
+ lang::Locale(),
+ aLineColor );
+ aSeq[3] = drawinglayer::primitive2d::Primitive2DReference( pText );
+ basegfx::B2DRange aTextRange = pText->getB2DRange( pProcessor->getViewInformation2D() );
+
+ // Draw the polygon around the flag
+ basegfx::B2DPolygon aFlagPolygon;
+ basegfx::B2DVector aFlagVector( 0, 1 );
+
+ double nFlagHeight = aTextRange.getMaxY() - nLineY + 60.0;
+
+ if ( !bHeader )
+ {
+ aFlagVector = - aFlagVector;
+ nFlagHeight = nLineY - aTextRange.getMinY() + 60.0;
+ }
+ basegfx::B2DPoint aStartPt( aTextRange.getMinX() - 60.0, nLineY );
+ aFlagPolygon.append( aStartPt );
+ basegfx::B2DPoint aNextPt = aStartPt + aFlagVector * ( nFlagHeight );
+ aFlagPolygon.append( aNextPt );
+ aNextPt += ( aTextRange.getWidth() + 120.0 ) * basegfx::B2DVector( 1, 0 );
+ aFlagPolygon.append( aNextPt );
+ aNextPt.setY( nLineY );
+ aFlagPolygon.append( aNextPt );
+
+ // Compute the flag background color primitive
+ aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon( aFlagPolygon ),
+ aFillColor ) );
+
+ drawinglayer::primitive2d::PolygonHairlinePrimitive2D * pBoxLine =
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aFlagPolygon, aLineColor );
+ aSeq[2] = drawinglayer::primitive2d::Primitive2DReference( pBoxLine );
+
+ return aSeq;
+}
+
+void SwPageFrm::PaintDecorators( OutputDevice *pOut ) const
+{
+ const SwLayoutFrm* pBody = FindBodyCont();
+ if ( pBody )
+ {
+ SwRect aBodyRect( pBody->Frm() );
+
+ if ( !pGlobalShell->GetViewOptions()->IsPrinting() &&
+ !pGlobalShell->GetViewOptions()->IsPDFExport() &&
+ !pGlobalShell->IsPreView() &&
+ pGlobalShell->IsHeaderFooterEdit( ) )
+ {
+ const String aStyleName = FindPageFrm()->GetPageDesc()->GetName();
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D();
+
+ pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives(
+ pOut, pProcessor, double( Frm().Left() ), double( Frm().Right() ),
+ double( aBodyRect.Top() ), true, aStyleName ) );
+
+ pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives(
+ pOut, pProcessor, double( Frm().Left() ), double( Frm().Right() ),
+ double( aBodyRect.Bottom() ), false, aStyleName ) );
+
+ delete pProcessor;
+ }
+ }
+}
+
/** FlyFrm::IsBackgroundTransparent - for feature #99657#
OD 12.08.2002
@@ -3486,6 +3653,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
aRect._Intersection( Frm() );
OutputDevice* pOut = pGlobalShell->GetOut();
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
pOut->Push( PUSH_CLIPREGION );
pOut->SetClipRegion();
const SwPageFrm* pPage = FindPageFrm();
@@ -3693,6 +3862,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
pOut->Pop();
+ pOut->SetDrawMode( nOldDrawMode );
+
if ( pProgress && pNoTxt )
pProgress->Reschedule();
}
@@ -3704,6 +3875,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pGlobalShell->GetOut() );
if ( pGlobalShell->GetViewOptions()->IsTable() )
{
// #i29550#
@@ -3740,6 +3912,8 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
DrawRect( pGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY );
}
((SwTabFrm*)this)->ResetComplete();
+
+ pGlobalShell->GetOut()->SetDrawMode( nOldDrawMode );
}
/*************************************************************************
@@ -4115,26 +4289,6 @@ void MA_FASTCALL lcl_SubTopBottom( SwRect& _iorRect,
}
}
-// method called for top and bottom border rectangles.
-void MA_FASTCALL lcl_SubLeftRight( SwRect& rRect,
- const SvxBoxItem& rBox,
- const SwRectFn& rRectFn )
-{
- if ( rBox.GetLeft() && rBox.GetLeft()->GetInWidth() )
- {
- const long nDist = ::lcl_MinWidthDist( rBox.GetLeft()->GetDistance() )
- + ::lcl_AlignWidth( rBox.GetLeft()->GetOutWidth() );
- (rRect.*rRectFn->fnSubLeft)( -nDist );
- }
-
- if ( rBox.GetRight() && rBox.GetRight()->GetInWidth() )
- {
- const long nDist = ::lcl_MinWidthDist( rBox.GetRight()->GetDistance() )
- + ::lcl_AlignWidth( rBox.GetRight()->GetOutWidth() );
- (rRect.*rRectFn->fnAddRight)( -nDist );
- }
-}
-
sal_uInt16 lcl_GetLineWidth( const SvxBorderLine* pLine )
{
sal_uInt16 result = 0;
@@ -4596,7 +4750,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm,
return pRet;
}
-void SwFrm::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const
+drawinglayer::processor2d::BaseProcessor2D * SwFrm::CreateProcessor2D( ) const
{
basegfx::B2DRange aViewRange;
@@ -4609,10 +4763,14 @@ void SwFrm::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSeque
0.0,
uno::Sequence< beans::PropertyValue >() );
- drawinglayer::processor2d::BaseProcessor2D * pProcessor2D =
- sdr::contact::createBaseProcessor2DFromOutputDevice(
+ return sdr::contact::createBaseProcessor2DFromOutputDevice(
*getRootFrm()->GetCurrShell()->GetOut(),
aNewViewInfos );
+}
+
+void SwFrm::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const
+{
+ drawinglayer::processor2d::BaseProcessor2D * pProcessor2D = CreateProcessor2D();
if ( pProcessor2D )
{
@@ -5779,6 +5937,9 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
aRect.Intersection( rRect );
OutputDevice *pOut = pSh->GetOut();
+ sal_uInt64 nOldDrawMode = pOut->GetDrawMode();
+ if ( !IsPageFrm() && !IsRootFrm() )
+ SetHeaderFooterEditMask( pOut );
if ( aRect.HasArea() )
{
@@ -5817,6 +5978,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if( pCol )
delete pNewItem;
}
+ pOut->SetDrawMode( nOldDrawMode );
}
else
bLowMode = bLowerMode ? sal_True : sal_False;
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index ba18f0a23b34..db2431015879 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -376,7 +376,7 @@ void lcl_ShrinkCellsAndAllContent( SwRowFrm& rRow )
while ( pTmp )
{
// the frames have to be shrunk
- if ( pTmp && pTmp->IsTabFrm() )
+ if ( pTmp->IsTabFrm() )
{
SwRowFrm* pTmpRow = (SwRowFrm*)((SwTabFrm*)pTmp)->Lower();
while ( pTmpRow )
@@ -3454,7 +3454,7 @@ sal_Bool SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool &r
if( Abs( nNewWidth - nOldWidth ) < 2 )
{
if( sal_False ==
- ( bMoveAnyway = BwdMoveNecessary( pOldPage, Frm() ) > 1 ) )
+ ( bMoveAnyway = (BwdMoveNecessary( pOldPage, Frm() ) > 1) ) )
{
SwRect aRect( pNewUpper->Prt() );
aRect.Pos() += pNewUpper->Frm().Pos();
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index e6d665abafc1..a508045378b6 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -58,6 +58,7 @@
#include <crstate.hxx>
#include <frmtool.hxx>
#include <ndtxt.hxx>
+#include <dcontact.hxx>
// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
@@ -65,6 +66,44 @@
#include <cfloat>
#include <swselectionlist.hxx>
+namespace {
+ bool lcl_GetCrsrOfst_Objects( const SwPageFrm* pPageFrm, bool bSearchBackground,
+ SwPosition *pPos, Point& rPoint, SwCrsrMoveState* pCMS )
+ {
+ bool bRet = false;
+ Point aPoint( rPoint );
+ SwOrderIter aIter( pPageFrm );
+ aIter.Top();
+ while ( aIter() )
+ {
+ const SwVirtFlyDrawObj* pObj =
+ static_cast<const SwVirtFlyDrawObj*>(aIter());
+ const SwAnchoredObject* pAnchoredObj = GetUserCall( aIter() )->GetAnchoredObj( aIter() );
+ const SwFmtSurround& rSurround = pAnchoredObj->GetFrmFmt().GetSurround();
+ bool bInBackground = ( rSurround.GetSurround() == SURROUND_THROUGHT );
+
+ bool bBackgroundMatches = ( bInBackground && bSearchBackground ) ||
+ ( !bInBackground && !bSearchBackground );
+
+ const SwFlyFrm* pFly = pObj ? pObj->GetFlyFrm() : 0;
+ if ( pFly && bBackgroundMatches &&
+ ( ( pCMS ? pCMS->bSetInReadOnly : false ) ||
+ !pFly->IsProtected() ) &&
+ pFly->GetCrsrOfst( pPos, aPoint, pCMS ) )
+ {
+ bRet = true;
+ break;
+ }
+
+ if ( pCMS && pCMS->bStop )
+ return false;
+ aIter.Prev();
+ }
+ return bRet;
+ }
+}
+
+
//Fuer SwFlyFrm::GetCrsrOfst
class SwCrsrOszControl
{
@@ -166,26 +205,7 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
//hineinsetzen, dadurch sollten alle Aenderungen unmoeglich sein.
if ( GetSortedObjs() )
{
- SwOrderIter aIter( this );
- aIter.Top();
- while ( aIter() )
- {
- const SwVirtFlyDrawObj* pObj =
- static_cast<const SwVirtFlyDrawObj*>(aIter());
- const SwFlyFrm* pFly = pObj ? pObj->GetFlyFrm() : 0;
- if ( pFly &&
- ( ( pCMS ? pCMS->bSetInReadOnly : sal_False ) ||
- !pFly->IsProtected() ) &&
- pFly->GetCrsrOfst( pPos, aPoint, pCMS ) )
- {
- bRet = sal_True;
- break;
- }
-
- if ( pCMS && pCMS->bStop )
- return sal_False;
- aIter.Prev();
- }
+ bRet = lcl_GetCrsrOfst_Objects( this, false, pPos, rPoint, pCMS );
}
if ( !bRet )
@@ -222,6 +242,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
}
}
+ // Check objects in the background if nothing else matched
+ if ( !bRet && GetSortedObjs() )
+ {
+ bRet = lcl_GetCrsrOfst_Objects( this, true, pPos, rPoint, pCMS );
+ }
+
if ( bRet )
rPoint = aPoint;
@@ -1731,7 +1757,7 @@ sal_Bool SwFrm::WannaRightPage() const
OSL_ENSURE( pDesc, "No pagedescriptor" );
sal_Bool bOdd;
if( nPgNum )
- bOdd = nPgNum % 2 ? sal_True : sal_False;
+ bOdd = (nPgNum % 2) ? sal_True : sal_False;
else
{
bOdd = pPage->OnRightPage();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index de7417879a0c..60cdad6d2959 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -75,6 +75,7 @@
#include <editeng/frmdiritem.hxx>
// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
+#include <viewopt.hxx>
using namespace ::com::sun::star;
@@ -130,6 +131,25 @@ void SwFrm::RegisterToFormat( SwFmt& rFmt )
rFmt.Add( this );
}
+sal_uInt64 SwFrm::SetHeaderFooterEditMask( OutputDevice* pOut ) const
+{
+ sal_uInt64 nOldDrawMode = pOut->GetDrawMode();
+ ViewShell* pShell = getRootFrm()->GetCurrShell();
+ if ( !pShell->IsPreView() &&
+ !pShell->GetViewOptions()->IsPDFExport() &&
+ !pShell->GetViewOptions()->IsPrinting() )
+ {
+ bool bInHdrFtr = FindFooterOrHeader( ) != NULL;
+ bool bEditHdrFtr = pShell->IsHeaderFooterEdit();
+ if ( ( bInHdrFtr && !bEditHdrFtr ) || ( !bInHdrFtr && bEditHdrFtr ) )
+ pOut->SetDrawMode( DRAWMODE_GHOSTEDLINE | DRAWMODE_GHOSTEDFILL |
+ DRAWMODE_GHOSTEDTEXT | DRAWMODE_GHOSTEDBITMAP |
+ DRAWMODE_GHOSTEDGRADIENT );
+ }
+
+ return nOldDrawMode;
+}
+
void SwFrm::CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse )
{
if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) )
diff --git a/sw/source/core/sw3io/sw3convert.cxx b/sw/source/core/sw3io/sw3convert.cxx
index 8605e23f6204..0d0bff6d3699 100644
--- a/sw/source/core/sw3io/sw3convert.cxx
+++ b/sw/source/core/sw3io/sw3convert.cxx
@@ -301,113 +301,5 @@ SW_DLLPUBLIC void sw3io_ConvertFromOldField( SwDoc& rDoc, sal_uInt16& rWhich,
}
}
}
-SW_DLLPUBLIC void sw3io_ConvertToOldField( const SwField* pFld, sal_uInt16& rWhich,
- sal_uLong& rFmt, sal_uLong nFFVersion )
-{
- const OldFormats *pOldFmt = 0L;
- sal_uLong nOldFmt = rFmt;
-
- switch( rWhich )
- {
- case RES_DOCINFOFLD:
- if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
- {
- switch (pFld->GetSubType() & 0xff00)
- {
- case DI_SUB_AUTHOR: rFmt = RF_AUTHOR; break;
- case DI_SUB_TIME: rFmt = RF_TIME; break;
- case DI_SUB_DATE: rFmt = RF_DATE; break;
- }
- }
- break;
-
- case RES_DATETIMEFLD:
- if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
- {
- sal_uInt16 nSubType = ((SwDateTimeField*) pFld)->GetSubType();
- switch( nSubType )
- {
- case DATEFLD: rWhich = RES_DATEFLD; break;
- case TIMEFLD: rWhich = RES_TIMEFLD; break;
- case DATEFLD|FIXEDFLD: rWhich = RES_FIXDATEFLD; break;
- case TIMEFLD|FIXEDFLD: rWhich = RES_FIXTIMEFLD; break;
- }
-
- if( nSubType & DATEFLD )
- {
- rFmt = DFF_DMY;
- pOldFmt = aOldDateFmt40;
- }
- else
- {
- rFmt = TF_SYSTEM;
- pOldFmt = aOldTimeFmt;
- }
- }
- break;
-
- case RES_DBFLD:
- case RES_TABLEFLD:
- case RES_GETEXPFLD:
- case RES_SETEXPFLD:
- case RES_USERFLD:
- if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
- {
- sal_uInt16 nSubType = pFld->GetSubType();
-
- if (nSubType & nsSwExtendedSubType::SUB_INVISIBLE)
- rFmt = VVF_INVISIBLE;
- else if (nSubType & nsSwExtendedSubType::SUB_CMD)
- rFmt = VVF_CMD;
- else if( !(nsSwGetSetExpType::GSE_SEQ & nSubType) )
- {
- pOldFmt = aOldGetSetExpFmt40;
- rFmt = VVF_SYS;
- }
- }
- break;
-
- case RES_GETREFFLD:
- if( SOFFICE_FILEFORMAT_31 == nFFVersion )
- {
- switch( rFmt )
- {
- case REF_PAGE:
- case REF_CHAPTER:
- case REF_CONTENT:
- break;
-
- default:
- rFmt = REF_PAGE;
- break;
- }
- }
- break;
- }
-
- if( pOldFmt && nOldFmt )
- {
- SvNumberFormatter *pFormatter = ((SwValueField*)pFld)->GetDoc()->GetNumberFormatter();
- const SvNumberformat* pEntry = pFormatter->GetEntry( nOldFmt );
-
- if( pEntry )
- {
- sal_uInt16 i = 0;
- while( pOldFmt[i].eFormatIdx != NF_NUMERIC_START ||
- pOldFmt[i].nOldFormat )
- {
- sal_uLong nKey = pFormatter->GetFormatIndex(
- pOldFmt[i].eFormatIdx, pEntry->GetLanguage() );
-
- if( nOldFmt == nKey )
- {
- rFmt = pOldFmt[i].nOldFormat;
- break;
- }
- i++;
- }
- }
- }
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index e90646bc24bf..58e56feadfce 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -89,7 +89,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile )
refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READWRITE );
bReadOnly = sal_False;
}
- catch( const uno::Exception& )
+ catch(const uno::Exception&)
{
//couldn't open the file - maybe it's readonly
}
@@ -99,7 +99,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile )
{
refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READ );
}
- catch( const uno::Exception& )
+ catch(const uno::Exception&)
{
OSL_FAIL("exception while creating AutoText storage");
}
@@ -194,7 +194,7 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n )
xTrans->commit();
return 0;
}
- catch ( uno::Exception)
+ catch (const uno::Exception&)
{
return ERR_SWG_WRITE_ERROR;
}
@@ -230,9 +230,8 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con
{
xBlkRoot->renameElement ( aOldName, aPackageName );
}
- catch( const container::ElementExistException& rEx )
+ catch(const container::ElementExistException&)
{
- (void)rEx;
}
}
uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY );
@@ -279,7 +278,7 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, String& rShort,
uno::Reference < embed::XStorage > rDestRoot = ((SwXMLTextBlocks&)rDestImp).xBlkRoot->openStorageElement( sDestShortName, embed::ElementModes::READWRITE );
rSourceRoot->copyToStorage( rDestRoot );
}
- catch ( uno::Exception& )
+ catch (const uno::Exception&)
{
nError = ERR_SWG_WRITE_ERROR;
}
@@ -311,7 +310,7 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const String& rShort, const String& rP
::rtl::OUString aMime( SotExchange::GetFormatMimeType( SOT_FORMATSTR_ID_STARWRITER_8 ) );
xRootProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
}
- catch (uno::Exception&)
+ catch (const uno::Exception&)
{
}
return 0;
@@ -372,7 +371,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& )
xTempStorage->copyToStorage( xRoot );
bOK = bTmpOK;
}
- catch( uno::Exception& )
+ catch(const uno::Exception&)
{
}
@@ -397,7 +396,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& )
xTmpTrans->commit();
}
}
- catch (uno::Exception&)
+ catch (const uno::Exception&)
{
}
@@ -465,7 +464,7 @@ sal_Bool SwXMLTextBlocks::PutMuchEntries( sal_Bool bOn )
bInPutMuchBlocks = sal_False;
bRet = sal_True;
}
- catch (uno::Exception&)
+ catch (const uno::Exception&)
{
}
}
@@ -484,7 +483,7 @@ sal_uLong SwXMLTextBlocks::OpenFile( sal_Bool bRdOnly )
bRdOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE );
InitBlockMode ( refStg );
}
- catch ( uno::Exception& )
+ catch (const uno::Exception&)
{
//TODO/LATER: error handling
nRet = 1;
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 2205ef3aa2ad..524ebcbdef4d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -460,6 +460,7 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
const bool bRefreshHidden )
{
const long nWish = pTabFmt->GetFrmSize().GetWidth();
+ OSL_ENSURE(nWish, "weird <= 0 width frmfrm");
const long nAct = rToFill.GetRight() - rToFill.GetLeft(); // +1 why?
//Der Wert fuer die linke Kante der Box errechnet sich aus den
@@ -471,13 +472,18 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
const SwTableBox *pCur = pBox;
const SwTableLine *pLine = pBox->GetUpper();
while ( pLine )
- { const SwTableBoxes &rBoxes = pLine->GetTabBoxes();
+ {
+ const SwTableBoxes &rBoxes = pLine->GetTabBoxes();
for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
SwTwips nWidth = rBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth();
nSum = (sal_uInt16)(nSum + nWidth);
sal_uInt64 nTmp = nSum;
nTmp *= nAct;
+
+ if (nWish == 0) //fdo#33012 0 width frmfmt
+ continue;
+
nTmp /= nWish;
if (rBoxes[i] != pCur)
{
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 6a4be326a337..6b3b9cc59e55 100755
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
{
- const SwLineLayout* pLine;
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
+ const SwLineLayout* pLine=NULL;
+ if (pMaster)
{
- SwTxtFrm *pMaster = FindMaster();
- OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
if( !pMaster->HasPara() )
pMaster->GetFormatted();
SwTxtSizeInfo aInf( pMaster );
@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
aMasterLine.Bottom();
pLine = aMasterLine.GetCurr();
}
- SwLinePortion* pRest =
- rLine.MakeRestPortion( pLine, GetOfst() );
+ SwLinePortion* pRest = pLine ?
+ rLine.MakeRestPortion(pLine, GetOfst()) : NULL;
if( pRest )
rInf.SetRest( pRest );
else
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index ccae7856dc20..eb1eaaa7b3e0 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -567,6 +567,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
// Don't show the paragraph mark for collapsed paragraphs, when they are hidden
if ( EmptyHeight( ) > 1 )
{
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pSh->GetOut() );
const XubString aTmp( CH_PAR );
SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 );
aDrawInf.SetLeft( rRect.Left() );
@@ -582,6 +583,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
aDrawInf.SetSnapToGrid( sal_False );
pFnt->_DrawText( aDrawInf );
+ pSh->GetOut()->SetDrawMode( nOldDrawMode );
}
delete pClip;
}
@@ -697,6 +699,8 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
OutputDevice* pOut = aInf.GetOut();
const sal_Bool bOnWin = pSh->GetWin() != 0;
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : 0 );
// Ausgabeschleife: Fuer jede Zeile ... (die noch zu sehen ist) ...
@@ -728,6 +732,8 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
if( rRepaint.HasArea() )
rRepaint.Clear();
+ pOut->SetDrawMode( nOldDrawMode );
+
UNDO_SWAP( this )
(SwRect&)rRect = aOldRect;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 570b3c6f19c9..a76d74689188 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init()
if ( GetTxtFrm()->IsFollow() )
{
const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
- const SwLinePortion* pTmpPara = pMaster->GetPara();
+ OSL_ENSURE(pMaster, "pTxtFrm without Master");
+ const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL;
// there is a master for this follow and the master does not have
// any contents (especially it does not have a number portion)
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 73d41d0e9cbd..b549cf42e336 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -178,7 +178,7 @@ protected:
SwTxtPortionTable aMaxWidth;
// for each line, an array of compression values is calculated
// this array is passed over to the info structure
- SvUShorts* pKanaComp;
+ std::deque<sal_uInt16>* pKanaComp;
ViewShell *pVsh;
@@ -365,10 +365,10 @@ public:
inline void ResetKanaIdx(){ nKanaIdx = 0; }
inline void SetKanaIdx( MSHORT nNew ) { nKanaIdx = nNew; }
inline void IncKanaIdx() { ++nKanaIdx; }
- inline void SetKanaComp( SvUShorts *pNew ){ pKanaComp = pNew; }
- inline SvUShorts* GetpKanaComp() const { return pKanaComp; }
+ inline void SetKanaComp( std::deque<sal_uInt16> *pNew ){ pKanaComp = pNew; }
+ inline std::deque<sal_uInt16>* GetpKanaComp() const { return pKanaComp; }
inline sal_uInt16 GetKanaComp() const
- { return ( pKanaComp && nKanaIdx < pKanaComp->Count() )
+ { return ( pKanaComp && nKanaIdx < pKanaComp->size() )
? (*pKanaComp)[nKanaIdx] : 0; }
#if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 6e78fe11da82..a50246072bbb 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -423,7 +423,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
OSL_ENSURE( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" );
OSL_ENSURE( !pCurrent->GetpKanaComp(), "pKanaComp already exists!!" );
- SvUShorts *pNewKana = new SvUShorts;
+ std::deque<sal_uInt16> *pNewKana = new std::deque<sal_uInt16>();
pCurrent->SetKanaComp( pNewKana );
const sal_uInt16 nNull = 0;
@@ -461,8 +461,8 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
}
else if( pPos->InGlueGrp() && pPos->InFixMargGrp() )
{
- if ( nKanaIdx == pCurrent->GetKanaComp().Count() )
- pCurrent->GetKanaComp().Insert( nNull, nKanaIdx );
+ if ( nKanaIdx == pCurrent->GetKanaComp().size() )
+ pCurrent->GetKanaComp().push_back( nNull );
sal_uInt16 nRest;
@@ -549,8 +549,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
// set fix width to width
((SwTabPortion*)pPos)->SetFixWidth( pPos->Width() );
- const SvUShorts& rKanaComp = pCurrent->GetKanaComp();
- if ( ++nKanaIdx < rKanaComp.Count() )
+ if ( ++nKanaIdx < pCurrent->GetKanaComp().size() )
nCompress = ( pCurrent->GetKanaComp() )[ nKanaIdx ];
nKanaDiffSum = 0;
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index a2a9ddcea28e..a8dc60b685ed 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -537,9 +537,9 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
SwLinePortion *pPor = pCurr->GetFirstPortion();
SwBidiPortion* pLastBidiPor = 0;
SwTwips nLastBidiPorWidth = 0;
- SvUShorts* pKanaComp = pCurr->GetpKanaComp();
+ std::deque<sal_uInt16>* pKanaComp = pCurr->GetpKanaComp();
MSHORT nSpaceIdx = 0;
- MSHORT nKanaIdx = 0;
+ size_t nKanaIdx = 0;
long nSpaceAdd = pCurr->IsSpaceAdd() ? pCurr->GetLLSpaceAdd( 0 ) : 0;
sal_Bool bNoTxt = sal_True;
@@ -573,7 +573,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nSpaceAdd = 0;
}
- if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
++nKanaIdx;
}
if( pPor->InFixMargGrp() )
@@ -591,7 +591,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nSpaceAdd = 0;
}
- if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
++nKanaIdx;
}
}
@@ -648,7 +648,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
}
if ( pKanaComp &&
- ( nKanaIdx + 1 ) < pKanaComp->Count()
+ ( nKanaIdx + 1 ) < pKanaComp->size()
)
++nKanaIdx;
}
@@ -668,7 +668,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nSpaceAdd = 0;
}
- if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
++nKanaIdx;
}
@@ -988,7 +988,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nSpaceAdd = 0;
}
- if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
++nKanaIdx;
}
if ( !pPor->IsFlyPortion() || ( pPor->GetPortion() &&
@@ -1006,7 +1006,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nSpaceAdd = 0;
}
- if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
++nKanaIdx;
}
if( !pPor->IsFlyPortion() )
@@ -1298,10 +1298,10 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
sal_Bool bHolePortion = sal_False;
sal_Bool bLastHyph = sal_False;
- SvUShorts *pKanaComp = pCurr->GetpKanaComp();
+ std::deque<sal_uInt16> *pKanaComp = pCurr->GetpKanaComp();
xub_StrLen nOldIdx = GetInfo().GetIdx();
MSHORT nSpaceIdx = 0;
- MSHORT nKanaIdx = 0;
+ size_t nKanaIdx = 0;
long nSpaceAdd = pCurr->IsSpaceAdd() ? pCurr->GetLLSpaceAdd( 0 ) : 0;
short nKanaComp = pKanaComp ? (*pKanaComp)[0] : 0;
@@ -1330,7 +1330,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
if( pKanaComp )
{
- if ( nKanaIdx + 1 < pKanaComp->Count() )
+ if ( nKanaIdx + 1 < pKanaComp->size() )
nKanaComp = (*pKanaComp)[++nKanaIdx];
else
nKanaComp = 0;
@@ -1375,7 +1375,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
if ( pKanaComp )
{
- if( nKanaIdx + 1 < pKanaComp->Count() )
+ if( nKanaIdx + 1 < pKanaComp->size() )
nKanaComp = (*pKanaComp)[++nKanaIdx];
else
nKanaComp = 0;
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index a3768b8b1469..1ce9da3f697d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -339,8 +339,8 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin()
// Die FlyPortion wird ausgesogen ...
pLeft->Join( (SwGluePortion*)pPos );
pPos = pLeft->GetPortion();
- if( GetpKanaComp() )
- GetKanaComp().Remove( 0, 1 );
+ if( GetpKanaComp() && !GetKanaComp().empty() )
+ GetKanaComp().pop_front();
}
else
pPos = 0;
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index fb9ffd504152..57ed53699870 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -37,6 +37,7 @@
#include "swfont.hxx"
#include <vector>
+#include <deque>
class SwMarginPortion;
class SwDropPortion;
@@ -101,7 +102,7 @@ class SwLineLayout : public SwTxtPortion
private:
SwLineLayout *pNext; // Die naechste Zeile.
std::vector<long>* pLLSpaceAdd; // Used for justified alignment.
- SvUShorts* pKanaComp; // Used for Kana compression.
+ std::deque<sal_uInt16>* pKanaComp; // Used for Kana compression.
KSHORT nRealHeight; // Die aus Zeilenabstand/Register resultierende Hoehe.
sal_Bool bFormatAdj : 1;
sal_Bool bDummy : 1;
@@ -210,10 +211,10 @@ public:
//
// STUFF FOR KANA COMPRESSION
//
- inline void SetKanaComp( SvUShorts* pNew ){ pKanaComp = pNew; }
+ inline void SetKanaComp( std::deque<sal_uInt16>* pNew ){ pKanaComp = pNew; }
inline void FinishKanaComp() { delete pKanaComp; pKanaComp = NULL; }
- inline SvUShorts* GetpKanaComp() const { return pKanaComp; }
- inline SvUShorts& GetKanaComp() { return *pKanaComp; }
+ inline std::deque<sal_uInt16>* GetpKanaComp() const { return pKanaComp; }
+ inline std::deque<sal_uInt16>& GetKanaComp() { return *pKanaComp; }
/** determine ascent and descent for positioning of as-character anchored
object
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 88e3f9898eac..95737d35adea 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -947,15 +947,18 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
else
pRotItem = NULL;
const SvxTwoLinesItem* p2Lines = NULL;
+ const SwTxtNode *pLclTxtNode = pFrm->GetTxtNode();
+ if( !pLclTxtNode )
+ return NULL;
const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet().
+ if( SFX_ITEM_SET == pLclTxtNode->GetSwAttrSet().
GetItemState( RES_CHRATR_TWO_LINES, sal_True, &pItem ) &&
((SvxTwoLinesItem*)pItem)->GetValue() )
p2Lines = (SvxTwoLinesItem*)pItem;
else
pItem = NULL;
- const SwpHints *pHints = pFrm->GetTxtNode()->GetpSwpHints();
+ const SwpHints *pHints = pLclTxtNode->GetpSwpHints();
if( !pHints && !p2Lines && !pRotate )
return NULL;
const SwTxtAttr *pRuby = NULL;
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 441077728afe..2579fdd144b3 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -149,7 +149,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
MSHORT nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
if( pExtInp || MSHRT_MAX != nRedlPos )
{
- const SvUShorts* pArr = 0;
+ const std::vector<sal_uInt16> *pArr = 0;
xub_StrLen nInputStt = 0;
if( pExtInp )
{
@@ -185,8 +185,9 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
*************************************************************************/
SwRedlineItr::SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt,
- SwAttrHandler& rAH, MSHORT nRed, sal_Bool bShw, const SvUShorts *pArr,
- xub_StrLen nExtStart )
+ SwAttrHandler& rAH, MSHORT nRed, sal_Bool bShw,
+ const std::vector<sal_uInt16> *pArr,
+ xub_StrLen nExtStart )
: rDoc( *rTxtNd.GetDoc() ), rNd( rTxtNd ), rAttrHandler( rAH ), pSet( 0 ),
nNdIdx( rTxtNd.GetIndex() ), nFirst( nRed ),
nAct( MSHRT_MAX ), bOn( sal_False ), bShow( bShw )
@@ -492,7 +493,7 @@ xub_StrLen SwExtend::Next( xub_StrLen nNext )
{
MSHORT nIdx = nPos - nStart;
MSHORT nAttr = rArr[ nIdx ];
- while( ++nIdx < rArr.Count() && nAttr == rArr[ nIdx ] )
+ while( ++nIdx < rArr.size() && nAttr == rArr[ nIdx ] )
; //nothing
nIdx = nIdx + nStart;
if( nNext > nIdx )
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 0fd14acd302f..8cbc1178dce1 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -33,10 +33,7 @@
#include <IDocumentRedlineAccess.hxx>
#include "swfont.hxx"
-#ifndef _SVSTDARR_USHORTS
-#define _SVSTDARR_USHORTS
-#include <svl/svstdarr.hxx>
-#endif
+#include <vector>
class SwTxtNode;
class SwDoc;
@@ -46,7 +43,7 @@ class SwAttrHandler;
class SwExtend
{
SwFont *pFnt;
- const SvUShorts &rArr; // XAMA: Array of xub_StrLen
+ const std::vector<sal_uInt16> &rArr; // XAMA: Array of xub_StrLen
xub_StrLen nStart;
xub_StrLen nPos;
xub_StrLen nEnd;
@@ -54,8 +51,8 @@ class SwExtend
sal_Bool Inside() const { return ( nPos >= nStart && nPos < nEnd ); }
void ActualizeFont( SwFont &rFnt, xub_StrLen nAttr );
public:
- SwExtend( const SvUShorts &rA, xub_StrLen nSt ) : pFnt(0), rArr( rA ),
- nStart( nSt ), nPos( STRING_LEN ), nEnd( nStart + rA.Count() ) {}
+ SwExtend( const std::vector<sal_uInt16> &rA, xub_StrLen nSt ) : pFnt(0), rArr( rA ),
+ nStart( nSt ), nPos( STRING_LEN ), nEnd( nStart + rA.size() ) {}
~SwExtend() { delete pFnt; }
sal_Bool IsOn() const { return pFnt != 0; }
void Reset() { if( pFnt ) { delete pFnt; pFnt = NULL; } nPos = STRING_LEN; }
@@ -94,7 +91,7 @@ class SwRedlineItr
{ if( pExt ) return pExt->Next( nNext ); return nNext; }
public:
SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt, SwAttrHandler& rAH,
- xub_StrLen nRedlPos, sal_Bool bShw, const SvUShorts *pArr = 0,
+ xub_StrLen nRedlPos, sal_Bool bShw, const std::vector<sal_uInt16> *pArr = 0,
xub_StrLen nStart = STRING_LEN );
~SwRedlineItr();
inline sal_Bool IsOn() const { return bOn || ( pExt && pExt->IsOn() ); }
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 2e70bb4f9c0b..f7039e230bf0 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const
const SwCntntFrm* SwTxtFly::_GetMaster()
{
pMaster = pCurrFrm;
- while( pMaster->IsFollow() )
+ while( pMaster && pMaster->IsFollow() )
pMaster = (SwCntntFrm*)pMaster->FindMaster();
return pMaster;
}
@@ -1380,14 +1380,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
const SwSortedObjs *pSorted = pPage->GetSortedObjs();
const sal_uInt32 nCount = pSorted ? pSorted->Count() : 0;
- // --> #108724# Page header/footer content doesn't have to wrap around
- // floating screen objects
- const bool bFooterHeader = 0 != pCurrFrm->FindFooterOrHeader();
- const IDocumentSettingAccess* pIDSA = pCurrFrm->GetTxtNode()->getIDocumentSettingAccess();
- // #i40155# - check, if frame is marked not to wrap
- const sal_Bool bWrapAllowed = ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) ||
- ( !pCurrFrm->IsInFtn() && !bFooterHeader ) ) &&
- !SwLayouter::FrmNotToWrap( *pCurrFrm->GetTxtNode()->getIDocumentLayoutAccess(), *pCurrFrm );
+ const sal_Bool bWrapAllowed = !SwLayouter::FrmNotToWrap( *pCurrFrm->GetTxtNode()->getIDocumentLayoutAccess(), *pCurrFrm );
bOn = sal_False;
@@ -1399,6 +1392,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
// #i28701# - consider complete frame area for new
// text wrapping
SwRect aRect;
+ const IDocumentSettingAccess* pIDSA = pCurrFrm->GetTxtNode()->getIDocumentSettingAccess();
if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) )
{
aRect = pCurrFrm->Prt();
@@ -1414,6 +1408,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
const long nRight = (aRect.*fnRect->fnGetRight)() - 1;
const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1;
const sal_Bool bR2L = pCurrFrm->IsRightToLeft();
+ const bool bFooterHeader = ( pCurrFrm->FindFooterOrHeader() != NULL );
const IDocumentDrawModelAccess* pIDDMA = pCurrFrm->GetTxtNode()->getIDocumentDrawModelAccess();
@@ -1551,7 +1546,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
SwTwips SwTxtFly::CalcMinBottom() const
{
SwTwips nRet = 0;
- const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs();
+ const SwCntntFrm *pLclMaster = GetMaster();
+ OSL_ENSURE(pLclMaster, "SwTxtFly without master");
+ const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL;
const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0;
if( nCount )
{
@@ -1779,7 +1776,7 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
MSHORT nIdx = 0;
while( nIdx < nCount && (*pTmp)[ nIdx ] < nXPos )
++nIdx;
- sal_Bool bOdd = nIdx % 2 ? sal_True : sal_False;
+ sal_Bool bOdd = (nIdx % 2) ? sal_True : sal_False;
sal_Bool bSet = sal_True;
if( bOdd )
--nIdx; // innerhalb eines Intervalls
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6e5f764680b8..9e4a23762f36 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects()
}
}
- if ( IsFollow() )
+ if (IsFollow())
{
- FindMaster()->HideAndShowObjects();
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE(pMaster, "SwTxtFrm without master");
+ if (pMaster)
+ pMaster->HideAndShowObjects();
}
}
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index ed7ab96e35e2..0abbdf6dcbc4 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -814,7 +814,9 @@ void MetaField::GetPrefixAndSuffix(
(pShell) ? pShell->GetModel() : 0, uno::UNO_SET_THROW);
getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix);
}
- } catch (uno::Exception) {
+ }
+ catch (const uno::Exception&)
+ {
OSL_FAIL("exception?");
}
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 0117facb916c..07b590c6b39e 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -38,7 +38,6 @@
#include <editeng/tstpitem.hxx>
#include <svl/urihelper.hxx>
#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
#endif
#include <svl/ctloptions.hxx>
@@ -633,7 +632,7 @@ SwCntntNode *SwTxtNode::JoinNext()
if( SwCntntNode::CanJoinNext( &aIdx ) )
{
SwDoc* pDoc = rNds.GetDoc();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
xub_StrLen nOldLen = m_Text.Len();
@@ -700,7 +699,7 @@ SwCntntNode *SwTxtNode::JoinNext()
pTxtNode->CutText( this, SwIndex(pTxtNode), pTxtNode->Len() );
}
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr, GetIndex(), nOldLen );
if( pTxtNode->HasAnyIndex() )
@@ -728,7 +727,7 @@ SwCntntNode *SwTxtNode::JoinPrev()
if( SwCntntNode::CanJoinPrev( &aIdx ) )
{
SwDoc* pDoc = rNds.GetDoc();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
xub_StrLen nLen = pTxtNode->Len();
@@ -795,7 +794,7 @@ SwCntntNode *SwTxtNode::JoinPrev()
pTxtNode->CutText( this, SwIndex(this), SwIndex(pTxtNode), nLen );
}
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr, GetIndex() );
if( pTxtNode->HasAnyIndex() )
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 5e36fa1ae34e..fe9175b3fe15 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -661,12 +661,12 @@ XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
static_cast<xub_StrLen>(aBndry.endPos - aBndry.startPos) );
}
-SwScanner::SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageType* pLang,
- const ModelToViewHelper::ConversionMap* pConvMap,
- sal_uInt16 nType, xub_StrLen nStart, xub_StrLen nEnde, sal_Bool bClp )
+SwScanner::SwScanner( const SwTxtNode& rNd, const rtl::OUString& rTxt,
+ const LanguageType* pLang, const ModelToViewHelper::ConversionMap* pConvMap,
+ sal_uInt16 nType, sal_Int32 nStart, sal_Int32 nEnde, sal_Bool bClp )
: rNode( rNd ), rText( rTxt), pLanguage( pLang ), pConversionMap( pConvMap ), nLen( 0 ), nWordType( nType ), bClip( bClp )
{
- OSL_ENSURE( rText.Len(), "SwScanner: EmptyString" );
+ OSL_ENSURE( !rText.isEmpty(), "SwScanner: EmptyString" );
nStartPos = nBegin = nStart;
nEndPos = nEnde;
@@ -677,7 +677,7 @@ SwScanner::SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageTy
else
{
ModelToViewHelper::ModelPosition aModelBeginPos = ModelToViewHelper::ConvertToModelPosition( pConversionMap, nBegin );
- const xub_StrLen nModelBeginPos = (xub_StrLen)aModelBeginPos.mnPos;
+ const sal_Int32 nModelBeginPos = aModelBeginPos.mnPos;
aCurrLang = rNd.GetLang( nModelBeginPos );
}
}
@@ -693,22 +693,22 @@ sal_Bool SwScanner::NextWord()
while ( true )
{
// skip non-letter characters:
- while ( nBegin < rText.Len() )
+ while ( nBegin < rText.getLength() )
{
- if ( !lcl_IsSkippableWhiteSpace( rText.GetChar( nBegin ) ) )
+ if ( !lcl_IsSkippableWhiteSpace( rText[nBegin] ) )
{
if ( !pLanguage )
{
const sal_uInt16 nNextScriptType = pBreakIt->GetBreakIter()->getScriptType( rText, nBegin );
ModelToViewHelper::ModelPosition aModelBeginPos = ModelToViewHelper::ConvertToModelPosition( pConversionMap, nBegin );
- const xub_StrLen nBeginModelPos = (xub_StrLen)aModelBeginPos.mnPos;
+ const sal_Int32 nBeginModelPos = aModelBeginPos.mnPos;
aCurrLang = rNode.GetLang( nBeginModelPos, 1, nNextScriptType );
}
if ( nWordType != i18n::WordType::WORD_COUNT )
{
rCC.setLocale( pBreakIt->GetLocale( aCurrLang ) );
- if ( rCC.isLetterNumeric( rText.GetChar( nBegin ) ) )
+ if ( rCC.isLetterNumeric( rText[nBegin] ) )
break;
}
else
@@ -717,7 +717,7 @@ sal_Bool SwScanner::NextWord()
++nBegin;
}
- if ( nBegin >= rText.Len() || nBegin >= nEndPos )
+ if ( nBegin >= rText.getLength() || nBegin >= nEndPos )
return sal_False;
// get the word boundaries
@@ -741,21 +741,21 @@ sal_Bool SwScanner::NextWord()
// #i89042, as discussed with HDU: don't evaluate script changes for word count. Use whole word.
if ( nWordType == i18n::WordType::WORD_COUNT )
{
- nBegin = Max( static_cast< xub_StrLen >(aBound.startPos), nBegin );
+ nBegin = Max(aBound.startPos, nBegin);
nLen = 0;
- if (static_cast< xub_StrLen >(aBound.endPos) > nBegin)
- nLen = static_cast< xub_StrLen >(aBound.endPos) - nBegin;
+ if (aBound.endPos > nBegin)
+ nLen = aBound.endPos - nBegin;
}
else
{
// we have to differenciate between these cases:
if ( aBound.startPos <= nBegin )
{
- OSL_ENSURE( aBound.endPos >= nBegin, "Unexpected aBound result" );
+ OSL_ENSURE( aBound.endPos >= nBegin, "Unexpected aBound result" );
// restrict boundaries to script boundaries and nEndPos
const sal_uInt16 nCurrScript = pBreakIt->GetBreakIter()->getScriptType( rText, nBegin );
- XubString aTmpWord = rText.Copy( nBegin, static_cast<xub_StrLen>(aBound.endPos - nBegin) );
+ rtl::OUString aTmpWord = rText.copy( nBegin, aBound.endPos - nBegin );
const sal_Int32 nScriptEnd = nBegin +
pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, nCurrScript );
const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
@@ -765,42 +765,42 @@ sal_Bool SwScanner::NextWord()
if ( aBound.startPos < nBegin )
{
// search from nBegin backwards until the next script change
- aTmpWord = rText.Copy( static_cast<xub_StrLen>(aBound.startPos),
- static_cast<xub_StrLen>(nBegin - aBound.startPos + 1) );
+ aTmpWord = rText.copy( aBound.startPos,
+ nBegin - aBound.startPos + 1 );
nScriptBegin = aBound.startPos +
pBreakIt->GetBreakIter()->beginOfScript( aTmpWord, nBegin - aBound.startPos,
nCurrScript );
}
- nBegin = (xub_StrLen)Max( aBound.startPos, nScriptBegin );
- nLen = (xub_StrLen)(nEnd - nBegin);
+ nBegin = Max( aBound.startPos, nScriptBegin );
+ nLen = nEnd - nBegin;
}
else
{
const sal_uInt16 nCurrScript = pBreakIt->GetBreakIter()->getScriptType( rText, aBound.startPos );
- XubString aTmpWord = rText.Copy( static_cast<xub_StrLen>(aBound.startPos),
- static_cast<xub_StrLen>(aBound.endPos - aBound.startPos) );
+ rtl::OUString aTmpWord = rText.copy( aBound.startPos,
+ aBound.endPos - aBound.startPos );
const sal_Int32 nScriptEnd = aBound.startPos +
pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, nCurrScript );
const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
- nBegin = (xub_StrLen)aBound.startPos;
- nLen = (xub_StrLen)(nEnd - nBegin);
+ nBegin = aBound.startPos;
+ nLen = nEnd - nBegin;
}
}
// optionally clip the result of getWordBoundaries:
if ( bClip )
{
- aBound.startPos = Max( (xub_StrLen)aBound.startPos, nStartPos );
- aBound.endPos = Min( (xub_StrLen)aBound.endPos, nEndPos );
- nBegin = (xub_StrLen)aBound.startPos;
- nLen = (xub_StrLen)(aBound.endPos - nBegin);
+ aBound.startPos = Max( aBound.startPos, nStartPos );
+ aBound.endPos = Min( aBound.endPos, nEndPos );
+ nBegin = aBound.startPos;
+ nLen = aBound.endPos - nBegin;
}
if( ! nLen )
return sal_False;
- aWord = rText.Copy( nBegin, nLen );
+ aWord = rText.copy( nBegin, nLen );
return sal_True;
}
@@ -1803,6 +1803,10 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
{ // not counting hidden paras
return;
}
+
+ // count of non-empty paras
+ ++rStat.nPara;
+
// Shortcut when counting whole paragraph and current count is clean
if ( isCountAll && !IsWordCountDirty() )
{
@@ -1842,15 +1846,12 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
sal_uInt32 nTmpChars = 0; // count of all chars
sal_uInt32 nTmpCharsExcludingSpaces = 0; // all non-white chars
- ++rStat.nPara; // count of non-empty paras
-
// count words in masked and expanded text:
if( pBreakIt->GetBreakIter().is() )
{
- const String aScannerText( aExpandText );
// zero is NULL for pLanguage -----------v last param = true for clipping
- SwScanner aScanner( *this, aScannerText, 0, pConversionMap, i18n::WordType::WORD_COUNT,
- (xub_StrLen)nExpandBegin, (xub_StrLen)nExpandEnd, true );
+ SwScanner aScanner( *this, aExpandText, 0, pConversionMap, i18n::WordType::WORD_COUNT,
+ nExpandBegin, nExpandEnd, true );
// used to filter out scanner returning almost empty strings (len=1; unichar=0x0001)
const rtl::OUString aBreakWord( CH_TXTATR_BREAKWORD );
diff --git a/sw/source/core/undo/undo.src b/sw/source/core/undo/undo.src
index 108346ac636b..fefa5ef65cdd 100644
--- a/sw/source/core/undo/undo.src
+++ b/sw/source/core/undo/undo.src
@@ -139,7 +139,7 @@ String STR_DRAG_AND_MOVE
};
String STR_INSERT_RULER
{
- Text [ en-US ] = "Insert horizontal ruler" ;
+ Text [ en-US ] = "Insert horizontal rule" ;
};
String STR_INSERT_CHART
{
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index ee16891ab5e1..dc6cd562225c 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -192,7 +192,6 @@ public:
};
void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = 0 );
-void InsertSort( SvULongs& rArr, sal_uLong nIdx, sal_uInt16* pInsPos = 0 );
#if OSL_DEBUG_LEVEL > 1
#include "shellio.hxx"
@@ -570,7 +569,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
SwTableLine* pLine = new SwTableLine( pLineFmt, rSavedData.Count(), 0 );
pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pLine, 0 );
- SvULongs aBkmkArr( 0, 4 );
+ std::vector<sal_uLong> aBkmkArr;
for( sal_uInt16 n = rSavedData.Count(); n; )
{
SwTblToTxtSave* pSave = rSavedData[ --n ];
@@ -589,14 +588,13 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
pTxtNd->EraseText( aCntPos, 1 );
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode(
SwPosition( aSttIdx, aCntPos ));
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pNewNd, pSave->m_nCntnt,
pSave->m_nCntnt + 1 );
}
else
{
- if( aBkmkArr.Count() )
- aBkmkArr.Remove( 0, aBkmkArr.Count() );
+ aBkmkArr.clear();
if( pTxtNd )
_SaveCntntIdx( GetDoc(), aSttIdx.GetIndex(),
pTxtNd->GetTxt().Len(), aBkmkArr );
@@ -767,7 +765,7 @@ void SwUndoTxtToTbl::UndoImpl(::sw::UndoRedoContext & rContext)
if( pDelBoxes )
{
SwTable& rTbl = pTNd->GetTable();
- for( sal_uInt16 n = pDelBoxes->Count(); n; )
+ for( sal_uInt16 n = pDelBoxes->size(); n; )
{
SwTableBox* pBox = rTbl.GetTblBox( (*pDelBoxes)[ --n ] );
if( pBox )
@@ -848,8 +846,8 @@ void SwUndoTxtToTbl::RepeatImpl(::sw::RepeatContext & rContext)
void SwUndoTxtToTbl::AddFillBox( const SwTableBox& rBox )
{
if( !pDelBoxes )
- pDelBoxes = new SvULongs;
- pDelBoxes->Insert( rBox.GetSttIdx(), pDelBoxes->Count() );
+ pDelBoxes = new std::vector<sal_uLong>;
+ pDelBoxes->push_back( rBox.GetSttIdx() );
}
SwHistory& SwUndoTxtToTbl::GetHistory()
@@ -1547,7 +1545,6 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
long nMn, long nMx,
sal_uInt16 nCnt, sal_Bool bFlg, sal_Bool bSmHght )
: SwUndo( nAction ),
- aBoxes( rBoxes.Count() < 255 ? (sal_uInt8)rBoxes.Count() : 255, 10 ),
nMin( nMn ), nMax( nMx ),
nSttNode( rTblNd.GetIndex() ), nCurrBox( 0 ),
nCount( nCnt ), nRelDiff( 0 ), nAbsDiff( 0 ),
@@ -1555,14 +1552,13 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
bFlag( bFlg ),
bSameHeight( bSmHght )
{
- Ptrs.pNewSttNds = 0;
+ pNewSttNds = 0;
const SwTable& rTbl = rTblNd.GetTable();
pSaveTbl = new _SaveTable( rTbl );
// und die Selektion merken
- for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
- aBoxes.Insert( rBoxes[n]->GetSttIdx(), n );
+ ReNewBoxes( rBoxes );
}
@@ -1570,7 +1566,6 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
const SwSelBoxes& rBoxes,
const SwTableNode& rTblNd )
: SwUndo( nAction ),
- aBoxes( rBoxes.Count() < 255 ? (sal_uInt8)rBoxes.Count() : 255, 10 ),
nMin( 0 ), nMax( 0 ),
nSttNode( rTblNd.GetIndex() ), nCurrBox( 0 ),
nCount( 0 ), nRelDiff( 0 ), nAbsDiff( 0 ),
@@ -1578,23 +1573,22 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
bFlag( sal_False ),
bSameHeight( sal_False )
{
- Ptrs.pNewSttNds = 0;
+ pNewSttNds = 0;
const SwTable& rTbl = rTblNd.GetTable();
pSaveTbl = new _SaveTable( rTbl );
// und die Selektion merken
- for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
- aBoxes.Insert( rBoxes[n]->GetSttIdx(), n );
+ ReNewBoxes( rBoxes );
}
void SwUndoTblNdsChg::ReNewBoxes( const SwSelBoxes& rBoxes )
{
- if( rBoxes.Count() != aBoxes.Count() )
+ if( rBoxes.Count() != aBoxes.size() )
{
- aBoxes.Remove( 0, aBoxes.Count() );
+ aBoxes.clear();
for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
- aBoxes.Insert( rBoxes[n]->GetSttIdx(), n );
+ aBoxes.insert( rBoxes[n]->GetSttIdx() );
}
}
@@ -1603,9 +1597,9 @@ SwUndoTblNdsChg::~SwUndoTblNdsChg()
delete pSaveTbl;
if( IsDelBox() )
- delete Ptrs.pDelSects;
+ delete pDelSects;
else
- delete Ptrs.pNewSttNds;
+ delete pNewSttNds;
}
void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
@@ -1617,7 +1611,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
sal_uInt16 i;
OSL_ENSURE( ! IsDelBox(), "falsche Action" );
- Ptrs.pNewSttNds = new SvULongs( (sal_uInt8)(rTblBoxes.Count() - rOld.Count()), 5 );
+ pNewSttNds = new std::set<_BoxMove>;
for( n = 0, i = 0; n < rOld.Count(); ++i )
{
@@ -1625,12 +1619,12 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
++n;
else
// neue Box: sortiert einfuegen!!
- InsertSort( *Ptrs.pNewSttNds, rTblBoxes[ i ]->GetSttIdx() );
+ pNewSttNds->insert( _BoxMove(rTblBoxes[ i ]->GetSttIdx()) );
}
for( ; i < rTblBoxes.Count(); ++i )
// neue Box: sortiert einfuegen!!
- InsertSort( *Ptrs.pNewSttNds, rTblBoxes[ i ]->GetSttIdx() );
+ pNewSttNds->insert( _BoxMove(rTblBoxes[ i ]->GetSttIdx()) );
}
@@ -1664,13 +1658,13 @@ const SwTableLines& lcl_FindParentLines( const SwTable& rTable,
void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
const SwTableSortBoxes& rOld,
const SwSelBoxes& rBoxes,
- const SvULongs& rNodeCnts )
+ const std::vector<sal_uLong> &rNodeCnts )
{
const SwTable& rTbl = rTblNd.GetTable();
const SwTableSortBoxes& rTblBoxes = rTbl.GetTabSortBoxes();
OSL_ENSURE( ! IsDelBox(), "falsche Action" );
- Ptrs.pNewSttNds = new SvULongs( (sal_uInt8)(rTblBoxes.Count() - rOld.Count()), 5 );
+ pNewSttNds = new std::set<_BoxMove>;
OSL_ENSURE( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(),
"unexpected boxes" );
@@ -1686,9 +1680,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
else
{
// new box found: insert (obey sort order)
- sal_uInt16 nInsPos;
const SwTableBox* pBox = rTblBoxes[ i ];
- InsertSort( *Ptrs.pNewSttNds, pBox->GetSttIdx(), &nInsPos );
// find the source box. It must be one in rBoxes.
// We found the right one if it's in the same column as pBox.
@@ -1735,14 +1727,11 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
// then pBox received nodes from elsewhere.
// If bNodesMoved is set for pBox the undo must move the
// boxes back, otherwise it must delete them.
- // The bNodesMoved flag is stored in a seperate array
- // which mirrors Ptrs.pNewSttNds, i.e. Ptrs.pNewSttNds[i]
- // and aMvBoxes[i] belong together.
sal_Bool bNodesMoved =
( nNodes != ( pSourceBox->GetSttNd()->EndOfSectionIndex() -
pSourceBox->GetSttIdx() ) )
&& ( nNodes - 1 > nLineDiff );
- aMvBoxes.insert( aMvBoxes.begin() + nInsPos, bNodesMoved );
+ pNewSttNds->insert( _BoxMove(pBox->GetSttIdx(), bNodesMoved) );
}
}
}
@@ -1751,14 +1740,14 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
void SwUndoTblNdsChg::SaveSection( SwStartNode* pSttNd )
{
OSL_ENSURE( IsDelBox(), "falsche Action" );
- if( !Ptrs.pDelSects )
- Ptrs.pDelSects = new SwUndoSaveSections( 10, 5 );
+ if( !pDelSects )
+ pDelSects = new SwUndoSaveSections( 10, 5 );
SwTableNode* pTblNd = pSttNd->FindTableNode();
SwUndoSaveSection* pSave = new SwUndoSaveSection;
pSave->SaveSection( pSttNd->GetDoc(), SwNodeIndex( *pSttNd ));
- Ptrs.pDelSects->Insert( pSave, Ptrs.pDelSects->Count() );
+ pDelSects->Insert( pSave, pDelSects->Count() );
nSttNode = pTblNd->GetIndex();
}
@@ -1790,9 +1779,9 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
SwTableBoxes& rLnBoxes = pCpyBox->GetUpper()->GetTabBoxes();
// die Sections wieder herstellen
- for( sal_uInt16 n = Ptrs.pDelSects->Count(); n; )
+ for( sal_uInt16 n = pDelSects->Count(); n; )
{
- SwUndoSaveSection* pSave = (*Ptrs.pDelSects)[ --n ];
+ SwUndoSaveSection* pSave = (*pDelSects)[ --n ];
pSave->RestoreSection( &rDoc, &aIdx, SwTableBoxStartNode );
if( pSave->GetHistory() )
pSave->GetHistory()->Rollback( &rDoc );
@@ -1800,20 +1789,19 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
pCpyBox->GetUpper() );
rLnBoxes.C40_INSERT( SwTableBox, pBox, rLnBoxes.Count() );
}
- Ptrs.pDelSects->DeleteAndDestroy( 0, Ptrs.pDelSects->Count() );
+ pDelSects->DeleteAndDestroy( 0, pDelSects->Count() );
}
- else if( !aMvBoxes.empty() )
+ else if( !pNewSttNds->empty() )
{
// dann muessen Nodes verschoben und nicht geloescht werden!
// Dafuer brauchen wir aber ein temp Array
- SvULongs aTmp( 0, 5);
- aTmp.Insert( Ptrs.pNewSttNds, 0 );
+ std::vector<_BoxMove> aTmp( pNewSttNds->begin(), pNewSttNds->end() );
// von hinten anfangen
- for( sal_uInt16 n = aTmp.Count(); n; )
+ for( int n = aTmp.size() - 1; n >= 0 ; --n)
{
// Box aus der Tabellen-Struktur entfernen
- sal_uLong nIdx = aTmp[ --n ];
+ sal_uLong nIdx = aTmp[n].index;
SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx );
OSL_ENSURE( pBox, "Wo ist meine TabellenBox geblieben?" );
@@ -1821,7 +1809,7 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
if (pPCD)
pPCD->DeleteBox( &pTblNd->GetTable(), *pBox );
- if( aMvBoxes[ n ] )
+ if( aTmp[n].hasMoved )
{
SwNodeRange aRg( *pBox->GetSttNd(), 1,
*pBox->GetSttNd()->EndOfSectionNode() );
@@ -1833,8 +1821,8 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
sal_uInt16 i = n;
sal_uLong nSttIdx = aInsPos.GetIndex() - 2,
nNdCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
- while( i && aTmp[ --i ] > nSttIdx )
- aTmp[ i ] += nNdCnt;
+ while( i && aTmp[ --i ].index > nSttIdx )
+ aTmp[ i ].index += nNdCnt;
// erst die Box loeschen
delete pBox;
@@ -1849,9 +1837,10 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
else
{
// Remove nodes from nodes array (backwards!)
- for( sal_uInt16 n = Ptrs.pNewSttNds->Count(); n; )
+ std::set<_BoxMove>::reverse_iterator it;
+ for( it = pNewSttNds->rbegin(); it != pNewSttNds->rend(); ++it )
{
- sal_uLong nIdx = (*Ptrs.pNewSttNds)[ --n ];
+ sal_uLong nIdx = (*it).index;
SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx );
OSL_ENSURE( pBox, "Where's my table box?" );
// TL_CHART2: notify chart about box to be removed
@@ -1891,9 +1880,9 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
CHECK_TABLE( pTblNd->GetTable() )
SwSelBoxes aSelBoxes;
- for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ for( std::set<sal_uLong>::iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
{
- SwTableBox* pBox = pTblNd->GetTable().GetTblBox( aBoxes[ n ] );
+ SwTableBox* pBox = pTblNd->GetTable().GetTblBox( *it );
aSelBoxes.Insert( pBox );
}
@@ -1977,8 +1966,8 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
if( pUndo )
{
- Ptrs.pDelSects->Insert( pUndo->Ptrs.pDelSects, 0 );
- pUndo->Ptrs.pDelSects->Remove( 0, pUndo->Ptrs.pDelSects->Count() );
+ pDelSects->Insert( pUndo->pDelSects, 0 );
+ pUndo->pDelSects->Remove( 0, pUndo->pDelSects->Count() );
delete pUndo;
}
@@ -2044,9 +2033,10 @@ CHECKTABLE(pTblNd->GetTable())
SwTxtFmtColl* pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
sal_uInt16 n;
- for( n = 0; n < aBoxes.Count(); ++n )
+ std::set<sal_uLong>::iterator it;
+ for( it = aBoxes.begin(); it != aBoxes.end(); ++it )
{
- aIdx = aBoxes[ n ];
+ aIdx = *it;
SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( aIdx,
SwTableBoxStartNode, pColl );
pBox = new SwTableBox( (SwTableBoxFmt*)pCpyBox->GetFrmFmt(), *pSttNd,
@@ -2061,7 +2051,7 @@ CHECKTABLE(pTblNd->GetTable())
SwChartDataProvider *pPCD = rDoc.GetChartDataProvider();
// 2. die eingefuegten Boxen loeschen
// die Nodes loeschen (von Hinten!!)
- for( n = aNewSttNds.Count(); n; )
+ for( n = aNewSttNds.size(); n; )
{
// Box aus der Tabellen-Struktur entfernen
sal_uLong nIdx = aNewSttNds[ --n ];
@@ -2192,10 +2182,10 @@ void SwUndoTblMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
{
// die Selektion merken
for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
- InsertSort( aBoxes, rBoxes[n]->GetSttIdx() );
+ aBoxes.insert( rBoxes[n]->GetSttIdx() );
// als Trennung fuers einfuegen neuer Boxen nach dem Verschieben!
- aNewSttNds.Insert( (sal_uLong)0, aNewSttNds.Count() );
+ aNewSttNds.push_back( (sal_uLong)0 );
// The new table model does not delete overlapped cells (by row span),
// so the rBoxes array might be empty even some cells have been merged.
@@ -3222,33 +3212,6 @@ void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos )
*pInsPos = nU;
}
-void InsertSort( SvULongs& rArr, sal_uLong nIdx, sal_uInt16* pInsPos )
-{
- sal_uInt16 nO = rArr.Count(), nM, nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- if( *(rArr.GetData() + nM) == nIdx )
- {
- OSL_FAIL( "Index ist schon vorhanden, darf nie sein!" );
- return;
- }
- if( *(rArr.GetData() + nM) < nIdx )
- nU = nM + 1;
- else if( nM == 0 )
- break;
- else
- nO = nM - 1;
- }
- }
- rArr.Insert( nIdx, nU );
- if( pInsPos )
- *pInsPos = nU;
-}
-
#if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index f002ba4ebcfb..48a6b148bd1d 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -326,7 +326,7 @@ SwPrintUIOptions::SwPrintUIOptions(
aHelpIds,
aPrintRangeName,
aChoices,
- bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */,
+ 0 /* always default to 'All pages' */,
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
aChoicesDisabled
);
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b9415531fd95..92481ed8de10 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -77,6 +77,7 @@
#include "../../ui/inc/view.hxx"
#include <PostItMgr.hxx>
#include <vcl/virdev.hxx>
+#include <rootfrm.hxx>
#include <vcl/svapp.hxx>
@@ -96,6 +97,12 @@ TYPEINIT0(ViewShell);
using namespace ::com::sun::star;
+void ViewShell::ToggleHeaderFooterEdit( ) {
+ bHeaderFooterEdit = !bHeaderFooterEdit;
+ // Repaint everything to update the colors of the selected area
+ Paint( VisArea().SVRect() );
+}
+
//////////////////////////////////////////////////////////////////////////////
// #i72754# 2nd set of Pre/PostPaints
// This time it uses the lock counter (mPrePostPaintRegions empty/non-empty) to allow only one activation
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 14ec08fa617f..3bc3012ca4b5 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -153,6 +153,7 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow,
mpTmpRef( 0 ),
pOpt( 0 ),
pAccOptions( new SwAccessibilityOptions ),
+ bHeaderFooterEdit( sal_False ),
mpTargetPaintWindow(0),
mpBufferedOut(0),
pDoc( &rDocument ),
@@ -219,6 +220,7 @@ ViewShell::ViewShell( ViewShell& rShell, Window *pWindow,
mpTmpRef( 0 ),
pOpt( 0 ),
pAccOptions( new SwAccessibilityOptions ),
+ bHeaderFooterEdit( sal_False ),
mpTargetPaintWindow(0),
mpBufferedOut(0),
pDoc( rShell.GetDoc() ),
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 6375d4291033..b8a5d2a46c67 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -101,6 +101,8 @@
#include <IDocumentStylePoolAccess.hxx>
#include <numrule.hxx>
+#include <rtl/strbuf.hxx>
+
using ::editeng::SvxBorderLine;
/*
@@ -184,7 +186,7 @@ static Writer& OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( Writer& rWrt,
sal_Bool bDeep );
static Writer& OutCSS1_SwFmtLayoutSplit( Writer& rWrt, const SfxPoolItem& rHt );
-static void ConvToHex( sal_uInt16 nHex, ByteString& rStr )
+static rtl::OString ConvToHex(sal_uInt16 nHex)
{
sal_Char aNToABuf[] = "00";
@@ -198,16 +200,19 @@ static void ConvToHex( sal_uInt16 nHex, ByteString& rStr )
nHex >>= 4;
}
- rStr.Append( aNToABuf );
+ return rtl::OString(aNToABuf, 2);
}
-static void GetCSS1Color( const Color& rColor, ByteString& rStr )
+static rtl::OString GetCSS1Color(const Color& rColor)
{
- rStr += '#';
+ rtl::OStringBuffer aStr;
+ aStr.append('#');
+
+ aStr.append(ConvToHex(rColor.GetRed()));
+ aStr.append(ConvToHex(rColor.GetGreen()));
+ aStr.append(ConvToHex(rColor.GetBlue()));
- ConvToHex( rColor.GetRed(), rStr );
- ConvToHex( rColor.GetGreen(), rStr );
- ConvToHex( rColor.GetBlue(), rStr );
+ return aStr.makeStringAndClear();
}
class SwCSS1OutMode
@@ -321,13 +326,14 @@ void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
Strm() << sOut.GetBuffer();
}
-static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut )
+static void AddUnitPropertyValue(rtl::OStringBuffer &rOut, long nVal,
+ FieldUnit eUnit)
{
if( nVal < 0 )
{
// Vorzeichen extra behandeln
nVal = -nVal;
- rOut += '-';
+ rOut.append('-');
}
// Die umgerechnete Einheit ergibt sich aus (x * nMul)/(nDiv*nFac*10)
@@ -416,12 +422,12 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut )
rOut += (long)(nBigVal / nBigFac);
if( !(nBigVal % nBigFac).IsZero() )
{
- rOut += '.';
+ rOut.append('.');
while( nFac > 1 && !(nBigVal % nBigFac).IsZero() )
{
nFac /= 10;
nBigFac = nFac;
- rOut += (int)((nBigVal / nBigFac) % nBig10 );
+ rOut.append(static_cast<sal_Int32>((nBigVal / nBigFac) % nBig10));
}
}
bOutLongVal = sal_False;
@@ -440,15 +446,14 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut )
}
else
{
- rOut += ByteString::CreateFromInt64( nBigVal / (sal_Int64)nFac );
+ rOut.append(nBigVal / (sal_Int64)nFac);
if( (nBigVal % (sal_Int64)nFac) != 0 )
{
- rOut += '.';
+ rOut.append('.');
while( nFac > 1 && (nBigVal % (sal_Int64)nFac) != 0 )
{
nFac /= 10;
- rOut += ByteString::CreateFromInt64(
- (nBigVal / (sal_Int64)nFac) % (sal_Int64)10 );
+ rOut.append((nBigVal / (sal_Int64)nFac) % (sal_Int64)10);
}
}
bOutLongVal = sal_False;
@@ -465,26 +470,26 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut )
if( bOutLongVal )
{
- rOut += ByteString::CreateFromInt32( nLongVal/nFac );
+ rOut.append(static_cast<sal_Int32>(nLongVal/nFac));
if( (nLongVal % nFac) != 0 )
{
- rOut += '.';
+ rOut.append('.');
while( nFac > 1 && (nLongVal % nFac) != 0 )
{
nFac /= 10;
- rOut += ByteString::CreateFromInt32( (nLongVal / nFac) % 10 );
+ rOut.append(static_cast<sal_Int32>((nLongVal / nFac) % 10));
}
}
}
- rOut.Append( pUnit );
+ rOut.append(pUnit);
}
void SwHTMLWriter::OutCSS1_UnitProperty( const sal_Char *pProp, long nVal )
{
- ByteString sOut;
- AddUnitPropertyValue( nVal, eCSS1Unit, sOut );
- OutCSS1_PropertyAscii( pProp, sOut );
+ rtl::OStringBuffer sOut;
+ AddUnitPropertyValue(sOut, nVal, eCSS1Unit);
+ OutCSS1_PropertyAscii(pProp, sOut.makeStringAndClear());
}
void SwHTMLWriter::OutCSS1_PixelProperty( const sal_Char *pProp, long nVal,
@@ -499,9 +504,10 @@ void SwHTMLWriter::OutCSS1_PixelProperty( const sal_Char *pProp, long nVal,
nVal = 1;
}
- ByteString sOut( ByteString::CreateFromInt32( nVal ) );
- sOut.Append( sCSS1_UNIT_px );
- OutCSS1_PropertyAscii( pProp, sOut );
+ rtl::OStringBuffer sOut;
+ sOut.append(static_cast<sal_Int32>(nVal));
+ sOut.append(sCSS1_UNIT_px);
+ OutCSS1_PropertyAscii(pProp, sOut.makeStringAndClear());
}
void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet,
@@ -1856,11 +1862,11 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc,
}
else
{
- ByteString sVal;
- AddUnitPropertyValue( rSz.Width(), rHTMLWrt.GetCSS1Unit(), sVal );
- sVal += ' ';
- AddUnitPropertyValue( rSz.Height(), rHTMLWrt.GetCSS1Unit(), sVal );
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_size, sVal );
+ rtl::OStringBuffer sVal;
+ AddUnitPropertyValue(sVal, rSz.Width(), rHTMLWrt.GetCSS1Unit());
+ sVal.append(' ');
+ AddUnitPropertyValue(sVal, rSz.Height(), rHTMLWrt.GetCSS1Unit());
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_size, sVal);
}
// Die Abstand-Attribute koennen auf gwohnte Weise exportiert werden
@@ -2417,9 +2423,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
aColor = pVSh->GetViewOptions()->GetRetoucheColor().GetColor();
}
- ByteString sOut;
- GetCSS1Color( aColor, sOut );
- OutCSS1_PropertyAscii( sCSS1_P_background, sOut );
+ OutCSS1_PropertyAscii(sCSS1_P_background, GetCSS1Color(aColor));
}
}
@@ -2561,9 +2565,6 @@ static Writer& OutCSS1_SvxCaseMap( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
- if( !rHTMLWrt.IsHTMLMode(HTMLMODE_SMALL_CAPS) )
- return rWrt;
-
switch( ((const SvxCaseMapItem&)rHt).GetCaseMap() )
{
case SVX_CASEMAP_NOT_MAPPED:
@@ -2604,10 +2605,7 @@ static Writer& OutCSS1_SvxColor( Writer& rWrt, const SfxPoolItem& rHt )
if( COL_AUTO == aColor.GetColor() )
aColor.SetColor( COL_BLACK );
- ByteString sOut;
- GetCSS1Color( aColor, sOut );
-
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_color, sOut );
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_color, GetCSS1Color(aColor));
return rWrt;
}
@@ -2684,11 +2682,12 @@ static Writer& OutCSS1_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt )
if( rHTMLWrt.aFontHeights[nSize-1] == nHeight )
return rWrt;
}
- ByteString sHeight( ByteString::CreateFromInt32(
- (sal_Int32)(nHeight/20) ) );
- sHeight.Append( sCSS1_UNIT_pt );
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size, sHeight );
+ rtl::OStringBuffer sHeight;
+ sHeight.append(static_cast<sal_Int32>(nHeight/20));
+ sHeight.append(sCSS1_UNIT_pt);
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size,
+ sHeight.makeStringAndClear());
return rWrt;
}
@@ -2742,21 +2741,22 @@ static Writer& OutCSS1_SvxKerning( Writer& rWrt, const SfxPoolItem& rHt )
sal_Int16 nValue = ((const SvxKerningItem&)rHt).GetValue();
if( nValue )
{
- ByteString sOut;
+ rtl::OStringBuffer sOut;
if( nValue < 0 )
{
- sOut = '-';
+ sOut.append('-');
nValue = -nValue;
}
// Breite als n.n pt
nValue = (nValue + 1) / 2; // 1/10pt
- sOut.Append( ByteString::CreateFromInt32( (sal_Int32)(nValue / 10) ) );
- sOut.Append( '.' );
- sOut.Append( ByteString::CreateFromInt32( (sal_Int32)(nValue % 10) ) );
- sOut.Append( sCSS1_UNIT_pt );
+ sOut.append(static_cast<sal_Int32>(nValue / 10));
+ sOut.append('.');
+ sOut.append(static_cast<sal_Int32>(nValue % 10));
+ sOut.append(sCSS1_UNIT_pt);
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_letter_spacing, sOut );
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_letter_spacing,
+ sOut.makeStringAndClear());
}
else
{
@@ -2925,14 +2925,14 @@ static Writer& OutCSS1_SvxLineSpacing( Writer& rWrt, const SfxPoolItem& rHt )
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_line_height, (long)nHeight );
else if( nPrcHeight )
{
- ByteString sHeight(
- ByteString::CreateFromInt32( (sal_Int32)nPrcHeight ) );
- sHeight += '%';
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_line_height, sHeight );
+ rtl::OStringBuffer sHeight;
+ sHeight.append(static_cast<sal_Int32>(nPrcHeight));
+ sHeight.append('%');
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_line_height,
+ sHeight.makeStringAndClear());
}
return rWrt;
-
}
static Writer& OutCSS1_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt )
@@ -2990,8 +2990,8 @@ static Writer& OutCSS1_SvxWidows( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
- ByteString aStr(
- ByteString::CreateFromInt32( ((const SvxWidowsItem&)rHt).GetValue() ) );
+ rtl::OString aStr(rtl::OString::valueOf(static_cast<sal_Int32>(
+ ((const SvxWidowsItem&)rHt).GetValue())));
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_widows, aStr );
return rWrt;
@@ -3001,8 +3001,8 @@ static Writer& OutCSS1_SvxOrphans( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
- ByteString aStr(
- ByteString::CreateFromInt32( ((const SvxOrphansItem&)rHt).GetValue() ) );
+ rtl::OString aStr(rtl::OString::valueOf(static_cast<sal_Int32>(
+ ((const SvxOrphansItem&)rHt).GetValue())));
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_orphans, aStr );
return rWrt;
@@ -3016,9 +3016,10 @@ static void OutCSS1_SwFmtDropAttrs( SwHTMLWriter& rHWrt,
rHWrt.OutCSS1_PropertyAscii( sCSS1_P_float, sCSS1_PV_left );
// Anzahl der Zeilen -> %-Angabe fuer Font-Hoehe!
- ByteString sOut( ByteString::CreateFromInt32( rDrop.GetLines()*100 ) );
- sOut += '%';
- rHWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size, sOut );
+ rtl::OStringBuffer sOut;
+ sOut.append(static_cast<sal_Int32>(rDrop.GetLines()*100));
+ sOut.append('%');
+ rHWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size, sOut.makeStringAndClear());
// Abstand zum Text = rechter Rand
sal_uInt16 nDistance = rDrop.GetDistance();
@@ -3065,7 +3066,6 @@ static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt,
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
- ByteString sOut;
const SwFmtFrmSize& rFSItem = (const SwFmtFrmSize&)rHt;
if( nMode & CSS1_FRMSIZE_WIDTH )
@@ -3073,8 +3073,11 @@ static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt8 nPrcWidth = rFSItem.GetWidthPercent();
if( nPrcWidth )
{
- (sOut = ByteString::CreateFromInt32( nPrcWidth) ) += '%';
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_width, sOut );
+ rtl::OStringBuffer sOut;
+ sOut.append(static_cast<sal_Int32>(nPrcWidth));
+ sOut.append('%');
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_width,
+ sOut.makeStringAndClear());
}
else if( nMode & CSS1_FRMSIZE_PIXEL )
{
@@ -3112,8 +3115,11 @@ static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt8 nPrcHeight = rFSItem.GetHeightPercent();
if( nPrcHeight )
{
- (sOut = ByteString::CreateFromInt32( nPrcHeight ) ) += '%';
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_height, sOut );
+ rtl::OStringBuffer sOut;
+ sOut.append(static_cast<sal_Int32>(nPrcHeight));
+ sOut.append('%');
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_height,
+ sOut.makeStringAndClear());
}
else if( nMode & CSS1_FRMSIZE_PIXEL )
{
@@ -3494,9 +3500,9 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
{
if( bColor )
{
- ByteString sTmp;
- GetCSS1Color( aColor, sTmp );
- sOut += String( sTmp, RTL_TEXTENCODING_ASCII_US );
+ rtl::OString sTmp(GetCSS1Color(aColor));
+ sOut += String(rtl::OStringToOUString(sTmp,
+ RTL_TEXTENCODING_ASCII_US));
}
if( pLink )
@@ -3551,38 +3557,37 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt,
sal_Int32 nWidth = pLine->GetWidth();
- ByteString sOut;
+ rtl::OStringBuffer sOut;
if( Application::GetDefaultDevice() &&
nWidth <= Application::GetDefaultDevice()->PixelToLogic(
Size( 1, 1 ), MapMode( MAP_TWIP) ).Width() )
{
// Wenn die Breite kleiner ist als ein Pixel, dann als 1px
// ausgeben, damit Netscape und IE die Linie auch darstellen.
- sOut += "1px";
+ sOut.append(RTL_CONSTASCII_STRINGPARAM("1px"));
}
else
{
nWidth *= 5; // 1/100pt
// Breite als n.nn pt
- sOut += ByteString::CreateFromInt32( nWidth / 100 );
- (((sOut += '.')
- += ByteString::CreateFromInt32((nWidth/10) % 10))
- += ByteString::CreateFromInt32(nWidth % 10)) += sCSS1_UNIT_pt;
+ sOut.append(static_cast<sal_Int32>(nWidth / 100));
+ sOut.append('.').append(static_cast<sal_Int32>((nWidth/10) % 10)).
+ append(static_cast<sal_Int32>(nWidth % 10)).append(sCSS1_UNIT_pt);
}
// Linien-Stil: solid oder double
- sOut += ' ';
+ sOut.append(' ');
switch ( pLine->GetStyle( ) )
{
case ::editeng::SOLID:
- sOut += sCSS1_PV_solid;
+ sOut.append(sCSS1_PV_solid);
break;
case ::editeng::DOTTED:
- sOut += sCSS1_PV_dotted;
+ sOut.append(sCSS1_PV_dotted);
break;
case ::editeng::DASHED:
- sOut += sCSS1_PV_dashed;
+ sOut.append(sCSS1_PV_dashed);
break;
case ::editeng::DOUBLE:
case ::editeng::THINTHICK_SMALLGAP:
@@ -3591,29 +3596,29 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt,
case ::editeng::THICKTHIN_SMALLGAP:
case ::editeng::THICKTHIN_MEDIUMGAP:
case ::editeng::THICKTHIN_LARGEGAP:
- sOut += sCSS1_PV_double;
+ sOut.append(sCSS1_PV_double);
break;
case ::editeng::EMBOSSED:
- sOut += sCSS1_PV_ridge;
+ sOut.append(sCSS1_PV_ridge);
break;
case ::editeng::ENGRAVED:
- sOut += sCSS1_PV_groove;
+ sOut.append(sCSS1_PV_groove);
break;
case ::editeng::INSET:
- sOut += sCSS1_PV_inset;
+ sOut.append(sCSS1_PV_inset);
break;
case ::editeng::OUTSET:
- sOut += sCSS1_PV_outset;
+ sOut.append(sCSS1_PV_outset);
break;
default:
- sOut += sCSS1_PV_none;
+ sOut.append(sCSS1_PV_none);
}
- sOut += ' ';
+ sOut.append(' ');
// und noch die Farbe
- GetCSS1Color( pLine->GetColor(), sOut );
+ sOut.append(GetCSS1Color(pLine->GetColor()));
- rHTMLWrt.OutCSS1_PropertyAscii( pProperty, sOut );
+ rHTMLWrt.OutCSS1_PropertyAscii(pProperty, sOut.makeStringAndClear());
}
Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt )
@@ -3650,14 +3655,14 @@ Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt )
if( nTopDist == nBottomDist && nLeftDist == nRightDist )
{
- ByteString sVal;
- AddUnitPropertyValue( nTopDist, rHTMLWrt.GetCSS1Unit(), sVal );
+ rtl::OStringBuffer sVal;
+ AddUnitPropertyValue(sVal, nTopDist, rHTMLWrt.GetCSS1Unit());
if( nTopDist != nLeftDist )
{
- sVal += ' ';
- AddUnitPropertyValue( nLeftDist, rHTMLWrt.GetCSS1Unit(), sVal );
+ sVal.append(' ');
+ AddUnitPropertyValue(sVal, nLeftDist, rHTMLWrt.GetCSS1Unit());
}
- rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_padding, sVal );
+ rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_padding, sVal.makeStringAndClear());
}
else
{
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 102134251e48..547cd6f28de3 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -91,6 +91,7 @@
#include <wrthtml.hxx>
#include <htmlfly.hxx>
#include <numrule.hxx>
+#include <rtl/strbuf.hxx>
using namespace ::com::sun::star;
@@ -147,13 +148,14 @@ static Writer& OutHTML_HoriSpacer( Writer& rWrt, sal_Int16 nSize )
->LogicToPixel( Size(nSize,0), MapMode(MAP_TWIP) ).Width();
}
- ByteString sOut( '<' );
- (((((((((sOut += OOO_STRING_SVTOOLS_HTML_spacer)
- += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal)
- += ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=')
- +=ByteString::CreateFromInt32(nSize)) += '>';
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_spacer).append(' ').
+ append(OOO_STRING_SVTOOLS_HTML_O_type).append('=').
+ append(OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal).append(' ').
+ append(OOO_STRING_SVTOOLS_HTML_O_size).append('=').
+ append(static_cast<sal_Int32>(nSize)).append('>');
- rWrt.Strm() << sOut.GetBuffer();
+ rWrt.Strm() << sOut.getStr();
return rWrt;
}
@@ -920,13 +922,15 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
// ggf ein List-Item aufmachen
if( rInfo.bInNumBulList && bNumbered )
{
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_li;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_li);
if( USHRT_MAX != nNumStart )
- (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += '=')
- += ByteString::CreateFromInt32(nNumStart);
- sOut += '>';
- rWrt.Strm() << sOut.GetBuffer();
+ {
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value).
+ append('=').append(static_cast<sal_Int32>(nNumStart));
+ }
+ sOut.append('>');
+ rWrt.Strm() << sOut.getStr();
}
if( rHWrt.nDefListLvl > 0 && !bForceDL )
@@ -1505,8 +1509,8 @@ HTMLOnOffState HTMLEndPosLst::GetHTMLItemState( const SfxPoolItem& rItem )
break;
case RES_CHRATR_CASEMAP:
- if( IsHTMLMode(HTMLMODE_SMALL_CAPS) )
- eState = HTML_STYLE_VALUE;
+ eState = HTML_STYLE_VALUE;
+ break;
case RES_CHRATR_KERNING:
if( IsHTMLMode(HTMLMODE_FULL_STYLES) )
@@ -2855,14 +2859,14 @@ static Writer& OutHTML_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt )
if( rHTMLWrt.bTagOn )
{
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_font;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_font);
sal_uInt32 nHeight = ((const SvxFontHeightItem&)rHt).GetHeight();
sal_uInt16 nSize = rHTMLWrt.GetHTMLFontSize( nHeight );
- (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=')
- += ByteString::CreateFromInt32( nSize );
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size).append('=').
+ append(static_cast<sal_Int32>(nSize));
+ rWrt.Strm() << sOut.getStr();
if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr &&
rHTMLWrt.aFontHeights[nSize-1] != nHeight )
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 6ceed78fe4c9..c13ea1ffca1e 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1171,7 +1171,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
SvCommandList aCommands;
aCommands.FillFromSequence( aProps );
- SvULongs aParams;
+ std::vector<sal_uLong> aParams;
size_t i = aCommands.size();
while( i > 0 )
{
@@ -1188,7 +1188,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
}
else if( SWHTML_OPTTYPE_PARAM == nType )
{
- aParams.Insert( i, aParams.Count() );
+ aParams.push_back( i );
}
}
@@ -1196,7 +1196,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
rHTMLWrt.IncIndentLevel(); // Inhalt von Applet einruecken
- sal_uInt16 ii = aParams.Count();
+ sal_uInt16 ii = aParams.size();
while( ii > 0 )
{
const SvCommand& rCommand = aCommands[ aParams[--ii] ];
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 9de2080428c2..0a0b86c5cd2d 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -128,6 +128,14 @@ static CSS1PropertyEnum const aFontVariantTable[] =
{ 0, 0 }
};
+static CSS1PropertyEnum const aTextTransformTable[] =
+{
+ { sCSS1_PV_uppercase, SVX_CASEMAP_VERSALIEN },
+ { sCSS1_PV_lowercase, SVX_CASEMAP_GEMEINE },
+ { sCSS1_PV_capitalize, SVX_CASEMAP_TITEL },
+ { 0, 0 }
+};
+
static CSS1PropertyEnum const aDirectionTable[] =
{
{ sCSS1_PV_ltr, FRMDIR_HORI_LEFT_TOP },
@@ -1314,6 +1322,32 @@ static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
}
}
+static void ParseCSS1_text_transform( const CSS1Expression *pExpr,
+ SfxItemSet &rItemSet,
+ SvxCSS1PropertyInfo& /*rPropInfo*/,
+ const SvxCSS1Parser& /*rParser*/ )
+{
+ OSL_ENSURE( pExpr, "no expression" );
+
+ // none | capitalize | uppercase | lowercase
+
+ switch( pExpr->GetType() )
+ {
+ case CSS1_IDENT:
+ {
+ sal_uInt16 nCaseMap;
+ if( SvxCSS1Parser::GetEnum( aTextTransformTable, pExpr->GetString(),
+ nCaseMap ) )
+ {
+ rItemSet.Put( SvxCaseMapItem( (SvxCaseMap)nCaseMap,
+ aItemIds.nCaseMap ) );
+ }
+ }
+ default:
+ ;
+ }
+}
+
/* */
static void ParseCSS1_color( const CSS1Expression *pExpr,
@@ -3140,6 +3174,7 @@ static CSS1PropEntry aCSS1PropFnTab[] =
CSS1_PROP_ENTRY(text_align),
CSS1_PROP_ENTRY(text_decoration),
CSS1_PROP_ENTRY(text_indent),
+ CSS1_PROP_ENTRY(text_transform),
CSS1_PROP_ENTRY(margin_left),
CSS1_PROP_ENTRY(margin_right),
CSS1_PROP_ENTRY(margin_top),
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 61b7e99a9bf3..68e8d2e30828 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -381,6 +381,8 @@ public:
const sal_Char *pVal );
inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
const ByteString& rVal );
+ inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
+ const rtl::OString& rVal );
inline void OutCSS1_Property( const sal_Char *pProp, const String& rVal );
void OutCSS1_Property( const sal_Char *pProp, const sal_Char *pVal,
const String *pSVal );
@@ -514,6 +516,12 @@ inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
OutCSS1_Property( pProp, rVal.GetBuffer(), 0 );
}
+inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
+ const rtl::OString& rVal )
+{
+ OutCSS1_Property( pProp, rVal.getStr(), 0 );
+}
+
inline void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
const String& rVal )
{
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index d6f4e9dc335b..909900edd948 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -28,8 +28,6 @@
#ifndef _FLTSHELL_HXX
#define _FLTSHELL_HXX
-#include <deque>
-
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
@@ -40,8 +38,12 @@
#include <poolfmt.hxx>
#include <fmtornt.hxx>
#include <ndindex.hxx>
+#include <pam.hxx>
#include <IDocumentRedlineAccess.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_deque.hpp>
+
class SwTOXBase;
class SwFltShell;
class SwField;
@@ -62,34 +64,76 @@ inline void SwFltSetFlag(sal_uLong& rFieldFlags, int no)
inline sal_Bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
{ return (nFieldFlags & (1L << no)) != 0; }
+//Subvert the Node/Content system to get positions which don't update as
+//content is appended to them
+struct SW_DLLPUBLIC SwFltPosition
+{
+public:
+ SwNodeIndex m_nNode;
+ xub_StrLen m_nCntnt;
+public:
+ SwFltPosition(const SwFltPosition &rOther)
+ : m_nNode(rOther.m_nNode)
+ , m_nCntnt(rOther.m_nCntnt)
+ {
+ }
+ SwFltPosition &operator=(const SwFltPosition &rOther)
+ {
+ m_nNode = rOther.m_nNode;
+ m_nCntnt = rOther.m_nCntnt;
+ return *this;
+ }
+ bool operator==(const SwFltPosition &rOther) const
+ {
+ return (m_nCntnt == rOther.m_nCntnt &&
+ m_nNode == rOther.m_nNode);
+ }
+ void SetPos(SwNodeIndex &rNode, sal_uInt16 nIdx)
+ {
+ m_nNode = rNode;
+ m_nCntnt = nIdx;
+ }
+ //operators with SwPosition, where the node is hacked to the previous one,
+ //and the offset to content is de-dynamic-ified
+ SwFltPosition(const SwPosition &rPos)
+ : m_nNode(rPos.nNode, -1)
+ , m_nCntnt(rPos.nContent.GetIndex())
+ {
+ }
+ void SetPos(const SwPosition &rPos)
+ {
+ m_nNode = rPos.nNode.GetIndex()-1;
+ m_nCntnt = rPos.nContent.GetIndex();
+ }
+};
+
// Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben.
-class SwFltStackEntry
+class SwFltStackEntry : private ::boost::noncopyable
{
public:
- SwNodeIndex nMkNode;
- SwNodeIndex nPtNode;
+ SwFltPosition m_aMkPos;
+ SwFltPosition m_aPtPos;
+
SfxPoolItem * pAttr;// Format Attribute
- long nHandle; // fuer verschachtelte Attrs, z.B. Bookmarks
- xub_StrLen nMkCntnt;// Nachbildung von Mark()
- xub_StrLen nPtCntnt;// Nachbildung von GetPoint()
sal_Bool bOld; // to mark Attributes *before* skipping field results
- sal_Bool bLocked;
- sal_Bool bCopied;
+ sal_Bool bOpen; //Entry open, awaiting being closed
sal_Bool bConsumedByField;
SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt );
- SW_DLLPUBLIC SwFltStackEntry(const SwFltStackEntry& rEntry);
SW_DLLPUBLIC ~SwFltStackEntry();
void SetStartPos(const SwPosition & rStartPos);
SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos);
- SW_DLLPUBLIC sal_Bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bCheck );
+ SW_DLLPUBLIC bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const;
+ SW_DLLPUBLIC static bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion,
+ bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
+ sal_uInt16 nWhich=0);
};
-class SW_DLLPUBLIC SwFltControlStack
+class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable
{
- typedef std::deque<SwFltStackEntry*> Entries;
+ typedef boost::ptr_deque<SwFltStackEntry> Entries;
typedef Entries::iterator myEIter;
Entries maEntries;
friend class SwFltShell;
@@ -102,7 +146,7 @@ protected:
sal_Bool bIsEndStack;
void MoveAttrs( const SwPosition& rPos );
- virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pEntry);
+ virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry);
public:
enum Flags
@@ -125,17 +169,18 @@ public:
void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr );
- virtual void SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand = LONG_MAX, sal_Bool consumedByField=sal_False);
+ virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand = LONG_MAX, sal_Bool consumedByField=sal_False);
- void StealAttr(const SwPosition* pPos, sal_uInt16 nAttrId = 0);
+ void StealAttr(const SwNodeIndex& rNode, sal_uInt16 nAttrId = 0);
void MarkAllAttrsOld();
void KillUnlockedAttrs(const SwPosition& pPos);
SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
void Delete(const SwPaM &rPam);
- Entries::size_type Count() { return maEntries.size(); }
- SwFltStackEntry* operator[](Entries::size_type nIndex)
+ bool empty() const { return maEntries.empty(); }
+ Entries::size_type size() const { return maEntries.size(); }
+ SwFltStackEntry& operator[](Entries::size_type nIndex)
{ return maEntries[nIndex]; }
void DeleteAndDestroy(Entries::size_type nCnt);
};
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index f7b72790a37d..c9b51bc8f189 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -43,6 +43,8 @@
#include <shellio.hxx>
#include <svl/zforlist.hxx>
+#include <boost/noncopyable.hpp>
+
#define CREATE_CONST_ASC(s) String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM(s))
class SwDoc;
@@ -316,7 +318,6 @@ namespace sw
public:
String msPrimary;
String msSecondary;
- bool HasDistinctSecondary() const;
FontMapExport(const String &rFontDescription);
};
@@ -363,7 +364,7 @@ namespace sw
@author
<a href="mailto:mmaher@openoffice.org">Martin Maher</a>
*/
- class RedlineStack
+ class RedlineStack : public boost::noncopyable
{
private:
std::vector<SwFltStackEntry *> maStack;
@@ -377,10 +378,6 @@ namespace sw
WW8TabDesc* pTabDesc );
void closeall(const SwPosition& rPos);
~RedlineStack();
- private:
- //No copying
- RedlineStack(const RedlineStack&);
- RedlineStack& operator=(const RedlineStack&);
};
/**
@@ -403,20 +400,20 @@ namespace sw
@author
<a href="mailto:mmaher@openoffice.org">Martin Maher</a>
*/
- class CloseIfOpen //Subclass from something ?
+ class SetEndIfOpen //Subclass from something ?
{
private:
const SwPosition &mrPos;
public:
- explicit CloseIfOpen(const SwPosition &rPos) : mrPos(rPos) {}
+ explicit SetEndIfOpen(const SwPosition &rPos) : mrPos(rPos) {}
void operator()(SwFltStackEntry *pEntry) const
{
- if (pEntry->bLocked)
+ if (pEntry->bOpen)
pEntry->SetEndPos(mrPos);
}
private:
//No assignment
- CloseIfOpen& operator=(const CloseIfOpen&);
+ SetEndIfOpen& operator=(const SetEndIfOpen&);
};
/**
@@ -432,16 +429,12 @@ namespace sw
const;
};
- class WrtRedlineAuthor
+ class WrtRedlineAuthor : public boost::noncopyable
{
protected:
std::vector<String> maAuthors; // Array of Sw - Bookmarknames
sal_uInt16 GetPos( const String& rNm );
-
- //No copying
- WrtRedlineAuthor(const WrtRedlineAuthor&);
- WrtRedlineAuthor& operator=(const WrtRedlineAuthor&);
public:
WrtRedlineAuthor() {}
virtual ~WrtRedlineAuthor() {}
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 771c65b3d878..d874cefd6de0 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -466,14 +466,6 @@ void Writer::PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL )
}
}
-void Writer::PutCJKandCTLFontsInAttrPool()
-{
- SfxItemPool& rPool = pDoc->GetAttrPool();
- _AddFontItems( rPool, RES_CHRATR_CJK_FONT );
- _AddFontItems( rPool, RES_CHRATR_CTL_FONT );
-}
-
-
void Writer::_AddFontItems( SfxItemPool& rPool, sal_uInt16 nW )
{
const SvxFontItem* pFont = (const SvxFontItem*)&rPool.GetDefaultItem( nW );
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 90716a7de39a..aa4c3fc8e11f 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -91,31 +91,16 @@ static SwCntntNode* GetCntntNode(SwDoc* pDoc, SwNodeIndex& rIdx, sal_Bool bNext)
}
// ------ Stack-Eintrag fuer die gesamten - Attribute vom Text -----------
-SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt ) :
- nMkNode(rStartPos.nNode, -1),
- nPtNode(nMkNode)
+SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt)
+ : m_aMkPos(rStartPos)
+ , m_aPtPos(rStartPos)
{
- // Anfang vom Bereich merken
- nMkCntnt = rStartPos.nContent.GetIndex();
pAttr = pHt; // speicher eine Kopie vom Attribut
bOld = sal_False; // used for marking Attributes *before* skipping field results
- bLocked = sal_True; // locke das Attribut --> darf erst
- bCopied = sal_False; // gesetzt werden, wenn es wieder geunlocked ist
+ bOpen = sal_True; // locke das Attribut --> darf erst
bConsumedByField = sal_False;
}
-SwFltStackEntry::SwFltStackEntry(const SwFltStackEntry& rEntry) :
- nMkNode(rEntry.nMkNode),
- nPtNode(rEntry.nPtNode)
-{
- pAttr = rEntry.pAttr->Clone();
- nMkCntnt= rEntry.nMkCntnt;
- bOld = rEntry.bOld;
- bLocked = bCopied = sal_True; // when rEntry were NOT bLocked we would never have been called
- bConsumedByField = rEntry.bConsumedByField;
-}
-
-
SwFltStackEntry::~SwFltStackEntry()
{
// Attribut kam zwar als Pointer, wird aber hier geloescht
@@ -130,36 +115,37 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos)
// Cursor-Position auch der Bereich vom Attribut weiter
// verschoben wird.
// Das ist aber nicht das gewollte!
- bLocked = sal_False; // freigeben und das ENDE merken
- nPtNode = rEndPos.nNode.GetIndex()-1;
- nPtCntnt = rEndPos.nContent.GetIndex();
+ bOpen = sal_False; // freigeben und das ENDE merken
+ m_aPtPos.SetPos(rEndPos);
}
-sal_Bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bCheck )
+bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
+ const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
+ sal_uInt16 nWhich)
{
// does this range actually contain something?
// empty range is allowed if at start of empty paragraph
// fields are special: never have range, so leave them
SwCntntNode *const pCntntNode(
- SwNodeIndex(nMkNode, +1).GetNode().GetCntntNode());
- if ((nMkNode.GetIndex() == nPtNode.GetIndex()) && (nMkCntnt == nPtCntnt)
- && ((0 != nPtCntnt) || (pCntntNode && (0 != pCntntNode->Len())))
- && (RES_TXTATR_FIELD != pAttr->Which()))
+ SwNodeIndex(rMkPos.m_nNode, +1).GetNode().GetCntntNode());
+ if (rMkPos == rPtPos &&
+ ((0 != rPtPos.m_nCntnt) || (pCntntNode && (0 != pCntntNode->Len())))
+ && (RES_TXTATR_FIELD != nWhich))
{
- return sal_False;
+ return false;
}
// !!! Die Content-Indizies beziehen sich immer auf den Node !!!
- rRegion.GetPoint()->nNode = nMkNode.GetIndex() + 1;
+ rRegion.GetPoint()->nNode = rMkPos.m_nNode.GetIndex() + 1;
SwCntntNode* pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, sal_True);
- rRegion.GetPoint()->nContent.Assign(pCNd, nMkCntnt);
+ rRegion.GetPoint()->nContent.Assign(pCNd, rMkPos.m_nCntnt);
rRegion.SetMark();
- if( nMkNode != nPtNode )
+ if (rMkPos.m_nNode != rPtPos.m_nNode)
{
- rRegion.GetPoint()->nNode = nPtNode.GetIndex() + 1;
+ rRegion.GetPoint()->nNode = rPtPos.m_nNode.GetIndex() + 1;
pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, sal_False);
}
- rRegion.GetPoint()->nContent.Assign(pCNd, nPtCntnt);
+ rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nCntnt);
#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode,
rRegion.End()->nNode, sal_True ),
@@ -169,7 +155,13 @@ sal_Bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bChec
return CheckNodesRange( rRegion.Start()->nNode,
rRegion.End()->nNode, sal_True );
else
- return sal_True;
+ return true;
+}
+
+bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const
+{
+ return MakeRegion(pDoc, rRegion, bCheck, m_aMkPos, m_aPtPos,
+ pAttr->Which());
}
SwFltControlStack::SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl)
@@ -180,7 +172,7 @@ SwFltControlStack::SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl)
SwFltControlStack::~SwFltControlStack()
{
- OSL_ENSURE(!Count(), "noch Attribute auf dem Stack");
+ OSL_ENSURE(maEntries.empty(), "There are still Attributes on the stack");
}
// MoveAttrs() ist fuer folgendes Problem:
@@ -193,24 +185,30 @@ SwFltControlStack::~SwFltControlStack()
// nach rechts verschoben werden.
void SwFltControlStack::MoveAttrs( const SwPosition& rPos )
{
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
- SwFltStackEntry* pEntry;
+ size_t nCnt = maEntries.size();
sal_uLong nPosNd = rPos.nNode.GetIndex();
sal_uInt16 nPosCt = rPos.nContent.GetIndex() - 1;
- for (sal_uInt16 i=0; i < nCnt; i++){
- pEntry = (*this)[ i ];
- if(( pEntry->nMkNode.GetIndex() + 1 == nPosNd )
- &&( pEntry->nMkCntnt >= nPosCt )){
- pEntry->nMkCntnt++;
- OSL_ENSURE( pEntry->nMkCntnt
+ for (size_t i=0; i < nCnt; ++i)
+ {
+ SwFltStackEntry& rEntry = maEntries[i];
+ if (
+ (rEntry.m_aMkPos.m_nNode.GetIndex()+1 == nPosNd) &&
+ (rEntry.m_aMkPos.m_nCntnt >= nPosCt)
+ )
+ {
+ rEntry.m_aMkPos.m_nCntnt++;
+ OSL_ENSURE( rEntry.m_aMkPos.m_nCntnt
<= pDoc->GetNodes()[nPosNd]->GetCntntNode()->Len(),
"Attribut-Anfang hinter Zeilenende" );
}
- if(( pEntry->nPtNode.GetIndex() + 1 == nPosNd )
- &&( pEntry->nPtCntnt >= nPosCt )){
- pEntry->nPtCntnt++;
- OSL_ENSURE( pEntry->nPtCntnt
+ if (
+ (rEntry.m_aPtPos.m_nNode.GetIndex()+1 == nPosNd) &&
+ (rEntry.m_aPtPos.m_nCntnt >= nPosCt)
+ )
+ {
+ rEntry.m_aPtPos.m_nCntnt++;
+ OSL_ENSURE( rEntry.m_aPtPos.m_nCntnt
<= pDoc->GetNodes()[nPosNd]->GetCntntNode()->Len(),
"Attribut-Ende hinter Zeilenende" );
}
@@ -219,19 +217,44 @@ void SwFltControlStack::MoveAttrs( const SwPosition& rPos )
void SwFltControlStack::MarkAllAttrsOld()
{
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
- for (sal_uInt16 i=0; i < nCnt; i++)
- (*this)[ i ]->bOld = sal_True;
+ size_t nCnt = maEntries.size();
+ for (sal_uInt16 i=0; i < nCnt; ++i)
+ maEntries[i].bOld = sal_True;
+}
+
+namespace
+{
+ bool couldExtendEntry(const SwFltStackEntry *pExtendCandidate,
+ const SfxPoolItem& rAttr)
+ {
+ return (pExtendCandidate &&
+ !pExtendCandidate->bConsumedByField &&
+ //potentially more, but lets keep it simple
+ (isPARATR_LIST(rAttr.Which()) || isCHRATR(rAttr.Which())) &&
+ *(pExtendCandidate->pAttr) == rAttr);
+ }
}
-void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr )
+void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr)
{
- SwFltStackEntry *pTmp = new SwFltStackEntry(rPos, rAttr.Clone() );
- sal_uInt16 nWhich = pTmp->pAttr->Which();
- SetAttr(rPos, nWhich);// Ende von evtl. gleichen Attributen auf dem Stack
- // Setzen, damit sich die Attribute nicht auf
- // dem Stack haeufen
- maEntries.push_back(pTmp);
+ sal_uInt16 nWhich = rAttr.Which();
+ // Ende von evtl. gleichen Attributen auf dem Stack Setzen, damit sich die
+ // Attribute nicht auf dem Stack haeufen
+ SwFltStackEntry *pExtendCandidate = SetAttr(rPos, nWhich);
+ if (couldExtendEntry(pExtendCandidate, rAttr))
+ {
+ //Here we optimize by seeing if there is an attribute uncommited
+ //to the document which
+ //
+ //a) has the same value as this attribute
+ //b) is already open, or ends at the same place as where we're starting
+ //from. If so we merge it with this one and elide adding another
+ //to the stack
+ pExtendCandidate->SetEndPos(rPos);
+ pExtendCandidate->bOpen=true;
+ }
+ else
+ maEntries.push_back(new SwFltStackEntry(rPos, rAttr.Clone()));
}
void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
@@ -240,7 +263,6 @@ void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
if (nCnt < maEntries.size())
{
myEIter aElement = maEntries.begin() + nCnt;
- delete *aElement;
maEntries.erase(aElement);
}
}
@@ -248,46 +270,42 @@ void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
// SwFltControlStack::StealAttr() loescht Attribute des angegebenen Typs vom Stack.
// Als nAttrId sind erlaubt: 0 fuer alle, oder ein spezieller Typ.
// Damit erscheinen sie nicht in der Doc-Struktur. Dabei werden nur die
-// Attribute entfernt, die im selben Absatz wie pPos stehen.
+// Attribute entfernt, die im selben Absatz wie rPos stehen.
// Wird fuer Grafik-Apos -> Grafiken benutzt.
-void SwFltControlStack::StealAttr(const SwPosition* pPos, sal_uInt16 nAttrId /* = 0 */)
+void SwFltControlStack::StealAttr(const SwNodeIndex& rNode, sal_uInt16 nAttrId)
{
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
-
- SwFltStackEntry* pEntry;
+ size_t nCnt = maEntries.size();
while (nCnt)
{
nCnt --;
- pEntry = (*this)[ nCnt ];
- if (pEntry->nPtNode.GetIndex()+1 == pPos->nNode.GetIndex() &&
- (!nAttrId || nAttrId == pEntry->pAttr->Which()))
+ SwFltStackEntry& rEntry = maEntries[nCnt];
+ if (rEntry.m_aPtPos.m_nNode.GetIndex()+1 == rNode.GetIndex() &&
+ (!nAttrId || nAttrId == rEntry.pAttr->Which()))
+ {
DeleteAndDestroy(nCnt); // loesche aus dem Stack
+ }
}
}
// SwFltControlStack::KillUnlockedAttr() loescht alle Attribute vom Stack,
-// welche punktuell auf pPos aufgespannt sind.
+// welche punktuell auf rPos aufgespannt sind.
// Damit erscheinen sie nicht in der Doc-Struktur.
// Wird im WW Import benoetigt zum ignorieren der auf dem 0x0c Section-
// Break-Symbol gesetzten Attribute.
-void SwFltControlStack::KillUnlockedAttrs(const SwPosition& pPos)
+void SwFltControlStack::KillUnlockedAttrs(const SwPosition& rPos)
{
- SwNodeIndex aAktNode( pPos.nNode, -1 );
- sal_uInt16 nAktIdx = pPos.nContent.GetIndex();
+ SwFltPosition aFltPos(rPos);
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
- SwFltStackEntry* pEntry;
+ size_t nCnt = maEntries.size();
while( nCnt )
{
nCnt --;
- pEntry = (*this)[ nCnt ];
- if( !pEntry->bOld
- && !pEntry->bLocked
- && (pEntry->nMkNode == aAktNode)
- && (pEntry->nMkCntnt == nAktIdx )
- && (pEntry->nPtNode == aAktNode)
- && (pEntry->nPtCntnt == nAktIdx ))
+ SwFltStackEntry& rEntry = maEntries[nCnt];
+ if( !rEntry.bOld
+ && !rEntry.bOpen
+ && (rEntry.m_aMkPos == aFltPos)
+ && (rEntry.m_aPtPos == aFltPos))
{
DeleteAndDestroy( nCnt ); // loesche aus dem Stack
}
@@ -298,39 +316,55 @@ void SwFltControlStack::KillUnlockedAttrs(const SwPosition& pPos)
// alle anderen im Document setzen und wieder aus dem Stack loeschen
// Returned, ob das gesuchte Attribut / die gesuchten Attribute
// ueberhaupt auf dem Stack standen
-void SwFltControlStack::SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId,
- sal_Bool bTstEnde, long nHand, sal_Bool consumedByField )
+SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
+ sal_uInt16 nAttrId, sal_Bool bTstEnde, long nHand,
+ sal_Bool consumedByField)
{
+ SwFltStackEntry *pRet = NULL;
+
+ SwFltPosition aFltPos(rPos);
+
OSL_ENSURE(!nAttrId ||
(POOLATTR_BEGIN <= nAttrId && POOLATTR_END > nAttrId) ||
(RES_FLTRATTR_BEGIN <= nAttrId && RES_FLTRATTR_END > nAttrId),
"Falsche Id fuers Attribut");
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
-
- SwFltStackEntry* pEntry;
-
- for (sal_uInt16 i=0; i < nCnt; i++)
+ myEIter aI = maEntries.begin();
+ while (aI != maEntries.end())
{
- pEntry = (*this)[ i ];
- if (pEntry->bLocked)
+ SwFltStackEntry& rEntry = *aI;
+ if (rEntry.bOpen)
{
// setze das Ende vom Attribut
bool bF = false;
- if (!nAttrId ){
+ if (!nAttrId )
+ {
bF = true;
- }else if( nAttrId == pEntry->pAttr->Which()){
- if( nAttrId != RES_FLTR_BOOKMARK ){ // Handle abfragen
+ }
+ else if (nAttrId == rEntry.pAttr->Which())
+ {
+ if( nAttrId != RES_FLTR_BOOKMARK )
+ {
+ // Handle abfragen
bF = true;
- }else if( nHand == ((SwFltBookmark*)(pEntry->pAttr))->GetHandle() )
+ }
+ else if (nHand == ((SwFltBookmark*)(rEntry.pAttr))->GetHandle())
{
bF = true;
}
}
- if (bF) {
- pEntry->bConsumedByField = consumedByField;
- pEntry->SetEndPos(rPos);
+ if (bF)
+ {
+ rEntry.bConsumedByField = consumedByField;
+ rEntry.SetEndPos(rPos);
+ if (nAttrId == rEntry.pAttr->Which())
+ {
+ //potential candidate for merging with an identical
+ //property beginning at rPos
+ pRet = &rEntry;
+ }
}
+ ++aI;
continue;
}
@@ -340,35 +374,54 @@ void SwFltControlStack::SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId,
// Beim Ende-Stack niemals ausser am DocEnde reinsetzen
if (bTstEnde)
{
- if (bIsEndStack || pEntry->nPtNode.GetIndex()+1 ==
- rPos.nNode.GetIndex())
- continue;
+ if (bIsEndStack)
+ {
+ ++aI;
+ continue;
+ }
+
+ //defer inserting this attribute into the document until
+ //we advance to the next node, or finish processing the document
+ if (rEntry.m_aPtPos.m_nNode.GetIndex() == aFltPos.m_nNode.GetIndex())
+ {
+ if (nAttrId == rEntry.pAttr->Which() &&
+ rEntry.m_aPtPos.m_nCntnt == aFltPos.m_nCntnt)
+ {
+ //potential candidate for merging with an identical
+ //property beginning at rPos
+ pRet = &rEntry;
+ }
+
+ ++aI;
+ continue;
+ }
}
- SetAttrInDoc(rPos, pEntry);
- DeleteAndDestroy(i); // loesche aus dem Stack
- i--; nCnt--; // Danach rutschen alle folgenden nach unten
+ SetAttrInDoc(rPos, rEntry);
+ aI = maEntries.erase(aI);
}
+
+ return pRet;
}
-static void MakePoint(SwFltStackEntry* pEntry, SwDoc* pDoc, SwPaM& rRegion)
+static void MakePoint(const SwFltStackEntry& rEntry, SwDoc* pDoc,
+ SwPaM& rRegion)
{
- // der Anker ist der Point vom Pam. Dieser wird beim Einfugen
- // von Text usw. veraendert; darum wird er auf dem Stack
- // gespeichert. Das Attribut muss nur noch im Format
- // gesetzt werden.
+ // der Anker ist der Point vom Pam. Dieser wird beim Einfugen von Text usw.
+ // veraendert; darum wird er auf dem Stack gespeichert. Das Attribut muss
+ // nur noch im Format gesetzt werden.
rRegion.DeleteMark();
- rRegion.GetPoint()->nNode = pEntry->nMkNode.GetIndex() + 1;
+ rRegion.GetPoint()->nNode = rEntry.m_aMkPos.m_nNode.GetIndex() + 1;
SwCntntNode* pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, sal_True);
- rRegion.GetPoint()->nContent.Assign(pCNd, pEntry->nMkCntnt);
+ rRegion.GetPoint()->nContent.Assign(pCNd, rEntry.m_aMkPos.m_nCntnt);
}
// MakeBookRegionOrPoint() ist wie MakeRegionOrPoint, aber die besonderen
// Beschraenkungen von Bookmarks in Tabellen werden beachtet.
// ( Anfang und Ende muessen in selber Zelle sein )
-static void MakeBookRegionOrPoint(SwFltStackEntry* pEntry, SwDoc* pDoc,
+static void MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc* pDoc,
SwPaM& rRegion, sal_Bool bCheck )
{
- if (pEntry->MakeRegion(pDoc, rRegion, bCheck )){
+ if (rEntry.MakeRegion(pDoc, rRegion, bCheck )){
// sal_Bool b1 = rNds[rRegion.GetPoint()->nNode]->FindTableNode() != 0;
if (rRegion.GetPoint()->nNode.GetNode().FindTableBoxStartNode()
!= rRegion.GetMark()->nNode.GetNode().FindTableBoxStartNode())
@@ -377,7 +430,7 @@ static void MakeBookRegionOrPoint(SwFltStackEntry* pEntry, SwDoc* pDoc,
rRegion.DeleteMark(); // -> beide auf Mark
}
}else{
- MakePoint(pEntry, pDoc, rRegion);
+ MakePoint(rEntry, pDoc, rRegion);
}
}
@@ -412,18 +465,19 @@ static sal_Bool IterateNumrulePiece( const SwNodeIndex& rEnd,
return rTmpStart <= rTmpEnd; // gueltig ?
}
-void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pEntry)
+void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
+ SwFltStackEntry& rEntry)
{
SwPaM aRegion( rTmpPos );
- switch(pEntry->pAttr->Which())
+ switch(rEntry.pAttr->Which())
{
case RES_FLTR_ANCHOR:
{
- SwFrmFmt* pFmt = ((SwFltAnchor*)pEntry->pAttr)->GetFrmFmt();
+ SwFrmFmt* pFmt = ((SwFltAnchor*)rEntry.pAttr)->GetFrmFmt();
if (pFmt != NULL)
{
- MakePoint(pEntry, pDoc, aRegion);
+ MakePoint(rEntry, pDoc, aRegion);
SwFmtAnchor aAnchor(pFmt->GetAnchor());
aAnchor.SetAnchor(aRegion.GetPoint());
pFmt->SetFmtAttr(aAnchor);
@@ -445,11 +499,11 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
break;
case RES_FLTR_NUMRULE: // Numrule 'reinsetzen
{
- const String& rNumNm = ((SfxStringItem*)pEntry->pAttr)->GetValue();
+ const String& rNumNm = ((SfxStringItem*)rEntry.pAttr)->GetValue();
SwNumRule* pRul = pDoc->FindNumRulePtr( rNumNm );
if( pRul )
{
- if( pEntry->MakeRegion(pDoc, aRegion, sal_True))
+ if( rEntry.MakeRegion(pDoc, aRegion, sal_True))
{
SwNodeIndex aTmpStart( aRegion.Start()->nNode );
SwNodeIndex aTmpEnd( aTmpStart );
@@ -474,15 +528,15 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
break;
case RES_FLTR_BOOKMARK: // eigentlich nur fuer den Ende-Stack
{
- SwFltBookmark* pB = (SwFltBookmark*)pEntry->pAttr;
- const String& rName = ((SwFltBookmark*)pEntry->pAttr)->GetName();
+ SwFltBookmark* pB = (SwFltBookmark*)rEntry.pAttr;
+ const String& rName = ((SwFltBookmark*)rEntry.pAttr)->GetName();
if (IsFlagSet(BOOK_TO_VAR_REF))
{
if (pB->IsPgRef() && !pB->IsRef())
{
// XRefs und Bookmarks sind bereits geUpcased
- MakeBookRegionOrPoint(pEntry, pDoc, aRegion, sal_True);
+ MakeBookRegionOrPoint(rEntry, pDoc, aRegion, sal_True);
pDoc->InsertPoolItem(aRegion, SwFmtRefMark(rName), 0);
}
else if( !pB->IsOnlyRef() )
@@ -496,26 +550,26 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
SwSetExpField aFld((SwSetExpFieldType*)pFT,
pB->GetValSys());
aFld.SetSubType( nsSwExtendedSubType::SUB_INVISIBLE );
- MakePoint(pEntry, pDoc, aRegion);
+ MakePoint(rEntry, pDoc, aRegion);
pDoc->InsertPoolItem(aRegion, SwFmtFld(aFld), 0);
MoveAttrs( *(aRegion.GetPoint()) );
}
}
if( !pB->IsOnlyRef() &&
- ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && !pEntry->bConsumedByField)
+ ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && !rEntry.bConsumedByField)
{
- MakeBookRegionOrPoint(pEntry, pDoc, aRegion, sal_True);
+ MakeBookRegionOrPoint(rEntry, pDoc, aRegion, sal_True);
pDoc->getIDocumentMarkAccess()->makeMark( aRegion, rName, IDocumentMarkAccess::BOOKMARK);
}
}
break;
case RES_FLTR_TOX:
{
- MakePoint(pEntry, pDoc, aRegion);
+ MakePoint(rEntry, pDoc, aRegion);
SwPosition* pPoint = aRegion.GetPoint();
- SwFltTOX* pTOXAttr = (SwFltTOX*)pEntry->pAttr;
+ SwFltTOX* pTOXAttr = (SwFltTOX*)rEntry.pAttr;
// test if on this node there had been a pagebreak BEFORE the
// tox attribut was put on the stack
@@ -554,20 +608,20 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
}
break;
case RES_FLTR_SECTION:
- MakePoint(pEntry, pDoc, aRegion); // bislang immer Point==Mark
+ MakePoint(rEntry, pDoc, aRegion); // bislang immer Point==Mark
pDoc->InsertSwSection(aRegion,
- *(static_cast<SwFltSection*>(pEntry->pAttr))->GetSectionData(),
+ *(static_cast<SwFltSection*>(rEntry.pAttr))->GetSectionData(),
0, 0, false);
- delete (((SwFltSection*)pEntry->pAttr)->GetSectionData());
+ delete (((SwFltSection*)rEntry.pAttr)->GetSectionData());
break;
case RES_FLTR_REDLINE:
{
- if (pEntry->MakeRegion(pDoc, aRegion, sal_True))
+ if (rEntry.MakeRegion(pDoc, aRegion, sal_True))
{
pDoc->SetRedlineMode((RedlineMode_t)( nsRedlineMode_t::REDLINE_ON
| nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE ));
- SwFltRedline& rFltRedline = *((SwFltRedline*)pEntry->pAttr);
+ SwFltRedline& rFltRedline = *((SwFltRedline*)rEntry.pAttr);
if( USHRT_MAX != rFltRedline.nAutorNoPrev )
{
@@ -593,9 +647,9 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
}
break;
default:
- if (pEntry->MakeRegion(pDoc, aRegion, sal_False))
+ if (rEntry.MakeRegion(pDoc, aRegion, sal_False))
{
- pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0);
+ pDoc->InsertPoolItem(aRegion, *rEntry.pAttr, 0);
}
break;
}
@@ -603,19 +657,18 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
SfxPoolItem* SwFltControlStack::GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos)
{
- SwFltStackEntry* pEntry;
- sal_uInt16 nSize = static_cast< sal_uInt16 >(Count());
+ size_t nSize = maEntries.size();
while (nSize)
{
// ist es das gesuchte Attribut ? (gueltig sind nur gelockte,
// also akt. gesetzte Attribute!!)
- if ((pEntry = (*this)[ --nSize ])->bLocked &&
- pEntry->pAttr->Which() == nWhich)
+ SwFltStackEntry &rEntry = maEntries[--nSize];
+ if (rEntry.bOpen && rEntry.pAttr->Which() == nWhich)
{
if (pPos)
*pPos = nSize;
- return (SfxPoolItem*)pEntry->pAttr; // Ok, dann Ende
+ return (SfxPoolItem*)rEntry.pAttr; // Ok, dann Ende
}
}
return 0;
@@ -652,25 +705,29 @@ void SwFltControlStack::Delete(const SwPaM &rPam)
if (aEndNode != aStartNode)
return;
- for (sal_uInt16 nSize = static_cast< sal_uInt16 >(Count()); nSize > 0;)
+ for (size_t nSize = maEntries.size(); nSize > 0;)
{
- SwFltStackEntry* pEntry = (*this)[--nSize];
+ SwFltStackEntry& rEntry = maEntries[--nSize];
bool bEntryStartAfterSelStart =
- (pEntry->nMkNode == aStartNode && pEntry->nMkCntnt >= nStartIdx);
+ (rEntry.m_aMkPos.m_nNode == aStartNode &&
+ rEntry.m_aMkPos.m_nCntnt >= nStartIdx);
bool bEntryStartBeforeSelEnd =
- (pEntry->nMkNode == aEndNode && pEntry->nMkCntnt <= nEndIdx);
+ (rEntry.m_aMkPos.m_nNode == aEndNode &&
+ rEntry.m_aMkPos.m_nCntnt <= nEndIdx);
bool bEntryEndAfterSelStart = false;
bool bEntryEndBeforeSelEnd = false;
- if (!pEntry->bLocked)
+ if (!rEntry.bOpen)
{
bEntryEndAfterSelStart =
- (pEntry->nPtNode == aStartNode && pEntry->nPtCntnt >= nStartIdx);
+ (rEntry.m_aPtPos.m_nNode == aStartNode &&
+ rEntry.m_aPtPos.m_nCntnt >= nStartIdx);
bEntryEndBeforeSelEnd =
- (pEntry->nPtNode == aEndNode && pEntry->nPtCntnt <= nEndIdx);
+ (rEntry.m_aPtPos.m_nNode == aEndNode &&
+ rEntry.m_aPtPos.m_nCntnt <= nEndIdx);
}
bool bTotallyContained = false;
@@ -697,27 +754,23 @@ void SwFltControlStack::Delete(const SwPaM &rPam)
if (bEntryStartBeforeSelEnd)
{
//move start to new start
- pEntry->nMkNode = aStartNode;
- pEntry->nMkCntnt = nStartIdx;
+ rEntry.m_aMkPos.SetPos(aStartNode, nStartIdx);
}
else
- pEntry->nMkCntnt = pEntry->nMkCntnt - nCntntDiff;
+ rEntry.m_aMkPos.m_nCntnt -= nCntntDiff;
}
if (bEntryEndAfterSelStart)
{
if (bEntryEndBeforeSelEnd)
- {
- pEntry->nPtNode = aStartNode;
- pEntry->nPtCntnt = nStartIdx;
- }
+ rEntry.m_aPtPos.SetPos(aStartNode, nStartIdx);
else
- pEntry->nPtCntnt = pEntry->nPtCntnt - nCntntDiff;
+ rEntry.m_aPtPos.m_nCntnt -= nCntntDiff;
}
- //That's what locked is, end equal to start, and nPtCntnt is invalid
- if (pEntry->bLocked)
- pEntry->nPtNode = pEntry->nMkNode;
+ //That's what Open is, end equal to start, and nPtCntnt is invalid
+ if (rEntry.bOpen)
+ rEntry.m_aPtPos = rEntry.m_aMkPos;
}
}
diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx b/sw/source/filter/ww8/WW8Sttbf.cxx
index 7d56e22b66c6..5074fe769e6f 100644
--- a/sw/source/filter/ww8/WW8Sttbf.cxx
+++ b/sw/source/filter/ww8/WW8Sttbf.cxx
@@ -29,7 +29,10 @@
#include <iostream>
#include <dbgoutsw.hxx>
#include "WW8Sttbf.hxx"
+#include "ww8scan.hxx"
#include <cstdio>
+#include <osl/endian.h>
+#include <rtl/ustrbuf.hxx>
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
@@ -38,17 +41,19 @@
namespace ww8
{
WW8Struct::WW8Struct(SvStream& rSt, sal_uInt32 nPos, sal_uInt32 nSize)
- : mn_offset(0), mn_size(nSize)
+ : mn_offset(0), mn_size(0)
{
- rSt.Seek(nPos);
-
- mp_data.reset(new sal_uInt8[nSize]);
- rSt.Read(mp_data.get(), nSize);
+ if (checkSeek(rSt, nPos))
+ {
+ mp_data.reset(new sal_uInt8[nSize]);
+ mn_size = rSt.Read(mp_data.get(), nSize);
+ }
+ OSL_ENSURE(mn_size == nSize, "short read in WW8Struct::WW8Struct");
}
WW8Struct::WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize)
- : mp_data(pStruct->mp_data), mn_offset(pStruct->mn_offset + nPos),
- mn_size(nSize)
+ : mp_data(pStruct->mp_data), mn_offset(pStruct->mn_offset + nPos)
+ , mn_size(nSize)
{
}
@@ -75,12 +80,22 @@ namespace ww8
if (nCount > 0)
{
- rtl_uString * pNew = 0;
- rtl_uString_newFromStr_WithLength
- (&pNew, reinterpret_cast<const sal_Unicode *>(&mp_data[mn_offset + nOffset]),
- nCount);
-
- aResult = rtl::OUString(pNew);
+ //clip to available
+ sal_uInt32 nStartOff = mn_offset + nOffset;
+ if (nStartOff >= mn_size)
+ return aResult;
+ sal_uInt32 nAvailable = (mn_size - nStartOff)/sizeof(sal_Unicode);
+ if (nCount > nAvailable)
+ nCount = nAvailable;
+#if defined OSL_LITTLEENDIAN
+ aResult = rtl::OUString(reinterpret_cast<const sal_Unicode *>(
+ mp_data.get() + nStartOff), nCount);
+#else
+ rtl::OUStringBuffer aBuf;
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ aBuf.append(static_cast<sal_Unicode>(getU16(nStartOff+i*2)));
+ aResult = aBuf.makeStringAndClear();
+#endif
}
#if OSL_DEBUG_LEVEL > 1
@@ -103,8 +118,17 @@ namespace ww8
if (nCount > 0)
{
- ::rtl::OString aOStr(reinterpret_cast<const sal_Char *>(&mp_data[mn_offset + nOffset]),
- nCount);
+ //clip to available
+ sal_uInt32 nStartOff = mn_offset + nOffset;
+ if (nStartOff >= mn_size)
+ return aResult;
+ sal_uInt32 nAvailable = (mn_size - nStartOff);
+ if (nCount > nAvailable)
+ nCount = nAvailable;
+
+ rtl::OString aOStr(reinterpret_cast<const sal_Char *>(
+ mp_data.get() + nStartOff), nCount);
+
::rtl::OUString aOUStr(rtl::OStringToOUString(aOStr, RTL_TEXTENCODING_ASCII_US));
aResult = rtl::OUString(aOUStr);
}
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index c002488ea9d8..1562a759d8a2 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -176,6 +176,9 @@ public:
/// for docx footnotePr/endnotePr inside sectPr
virtual void SectFootnoteEndnotePr() {};
+ /// for docx w:commentReference
+ virtual void WritePostitFieldReference() {};
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2f4921bbdaee..54f385fedc4e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -870,6 +870,9 @@ void DocxAttributeOutput::StartRunProperties()
m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
InitCollectedRunProperties();
+
+ OSL_ASSERT( m_postponedGraphic == NULL );
+ m_postponedGraphic = new std::list< PostponedGraphic >;
}
void DocxAttributeOutput::InitCollectedRunProperties()
@@ -974,11 +977,23 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*
// write footnotes/endnotes if we have any
FootnoteEndnoteReference();
+ WritePostponedGraphic();
+
// merge the properties _before_ the run text (strictly speaking, just
// after the start of the run)
m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
}
+void DocxAttributeOutput::WritePostponedGraphic()
+{
+ for( std::list< PostponedGraphic >::const_iterator it = m_postponedGraphic->begin();
+ it != m_postponedGraphic->end();
+ ++it )
+ FlyFrameGraphic( *( it->grfNode ), it->size );
+ delete m_postponedGraphic;
+ m_postponedGraphic = NULL;
+}
+
void DocxAttributeOutput::FootnoteEndnoteRefTag()
{
if( m_footnoteEndnoteRefTag == 0 )
@@ -2270,7 +2285,14 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
const SwNode *pNode = rFrame.GetContent();
const SwGrfNode *pGrfNode = pNode ? pNode->GetGrfNode() : 0;
if ( pGrfNode )
- FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ {
+ if( m_postponedGraphic == NULL )
+ FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ else // we are writting out attributes, but w:drawing should not be inside w:rPr,
+ { // so write it out later
+ m_postponedGraphic->push_back( PostponedGraphic( pGrfNode, rFrame.GetLayoutSize()));
+ }
+ }
}
break;
case sw::Frame::eDrawing:
@@ -3280,9 +3302,34 @@ void DocxAttributeOutput::HiddenField( const SwField& /*rFld*/ )
OSL_TRACE( "TODO DocxAttributeOutput::HiddenField()\n" );
}
-void DocxAttributeOutput::PostitField( const SwField* /* pFld*/ )
+void DocxAttributeOutput::PostitField( const SwField* pFld )
{
- OSL_TRACE( "TODO DocxAttributeOutput::PostitField()\n" );
+ assert( dynamic_cast< const SwPostItField* >( pFld ));
+ m_postitFields.push_back( static_cast< const SwPostItField* >( pFld ));
+}
+
+void DocxAttributeOutput::WritePostitFieldReference()
+{
+ while( m_postitFieldsMaxId < m_postitFields.size())
+ {
+ OString idstr = OString::valueOf( sal_Int32( m_postitFieldsMaxId ));
+ m_pSerializer->singleElementNS( XML_w, XML_commentReference, FSNS( XML_w, XML_id ), idstr.getStr(), FSEND );
+ ++m_postitFieldsMaxId;
+ }
+}
+
+void DocxAttributeOutput::WritePostitFields()
+{
+ for( unsigned int i = 0;
+ i < m_postitFields.size();
+ ++i )
+ {
+ OString idstr = OString::valueOf( sal_Int32( i ));
+// TODO const SwPostItField* f = m_postitFields[ i ];
+ m_pSerializer->startElementNS( XML_w, XML_comment, FSNS( XML_w, XML_id ), idstr.getStr(),
+ /*TODO*/ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_comment );
+ }
}
bool DocxAttributeOutput::DropdownField( const SwField* pFld )
@@ -4260,7 +4307,9 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_bParagraphOpened( false ),
m_nColBreakStatus( COLBRK_NONE ),
m_pParentFrame( NULL ),
- m_nCloseHyperlinkStatus( Undetected )
+ m_nCloseHyperlinkStatus( Undetected ),
+ m_postponedGraphic( NULL ),
+ m_postitFieldsMaxId( 0 )
{
}
@@ -4286,14 +4335,19 @@ DocxExport& DocxAttributeOutput::GetExport()
return m_rExport;
}
-bool DocxAttributeOutput::HasFootnotes()
+bool DocxAttributeOutput::HasFootnotes() const
{
return !m_pFootnotesList->isEmpty();
}
-bool DocxAttributeOutput::HasEndnotes()
+bool DocxAttributeOutput::HasEndnotes() const
{
return !m_pEndnotesList->isEmpty();
}
+bool DocxAttributeOutput::HasPostitFields() const
+{
+ return !m_postitFields.empty();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index b5a5243a9f7c..f875dc9dafd0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -105,6 +105,8 @@ public:
virtual void SectFootnoteEndnotePr();
+ virtual void WritePostitFieldReference();
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
@@ -525,6 +527,7 @@ protected:
private:
void DoWriteBookmarks( );
+ void WritePostponedGraphic();
void StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun = sal_False );
void DoWriteCmd( String& rCmd );
@@ -591,6 +594,16 @@ private:
};
HyperLinkCloseState m_nCloseHyperlinkStatus;
+ struct PostponedGraphic
+ {
+ PostponedGraphic( const SwGrfNode* n, Size s ) : grfNode( n ), size( s ) {};
+ const SwGrfNode* grfNode;
+ Size size;
+ };
+ std::list< PostponedGraphic >* m_postponedGraphic;
+ std::vector< const SwPostItField* > m_postitFields;
+ unsigned int m_postitFieldsMaxId;
+
public:
DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
@@ -607,16 +620,19 @@ public:
::sax_fastparser::FSHelperPtr GetSerializer( ) { return m_pSerializer; }
/// Do we have any footnotes?
- bool HasFootnotes();
+ bool HasFootnotes() const;
/// Do we have any endnotes?
- bool HasEndnotes();
+ bool HasEndnotes() const;
/// Output the content of the footnotes.xml resp. endnotes.xml
void FootnotesEndnotes( bool bFootnotes );
/// writes the footnotePr/endnotePr (depending on tag) section
void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info, int listtag );
+
+ bool HasPostitFields() const;
+ void WritePostitFields();
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index e851beaf26a3..9920350d66cd 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -339,6 +339,8 @@ void DocxExport::ExportDocument_Impl()
WriteFootnotesEndnotes();
+ WritePostitFields();
+
WriteNumbering();
WriteFonts();
@@ -516,6 +518,26 @@ void DocxExport::WriteFootnotesEndnotes()
}
}
+void DocxExport::WritePostitFields()
+{
+ if ( m_pAttrOutput->HasPostitFields() )
+ {
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" ),
+ S( "comments.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pPostitFS =
+ m_pFilter->openFragmentStreamWithSerializer( S( "word/comments.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ) );
+
+ pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces( pPostitFS ));
+ m_pAttrOutput->SetSerializer( pPostitFS );
+ m_pAttrOutput->WritePostitFields();
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+ pPostitFS->endElementNS( XML_w, XML_comments );
+ }
+}
+
void DocxExport::WriteNumbering()
{
if ( !pUsedNumTbl )
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index ee84dcd33b42..faed1e0cf7e9 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -190,6 +190,9 @@ private:
/// Write footnotes.xml and endnotes.xml.
void WriteFootnotesEndnotes();
+ /// Write comments.xml
+ void WritePostitFields();
+
/// Write the numbering table.
virtual void WriteNumbering();
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx
index b784e8404b8f..38faf1c41020 100644
--- a/sw/source/filter/ww8/docxexportfilter.cxx
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -123,15 +123,6 @@ uno::Reference< uno::XInterface > SAL_CALL DocxExport_createInstance(const uno::
extern "C"
{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-// ------------------------
-// - component_getFactory -
-// ------------------------
-
::cppu::ImplementationEntry entries [] =
{
{
@@ -152,7 +143,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const
{ 0, 0, 0, 0, 0, 0 }
};
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL msword_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
{
return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, entries );
}
diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx
index 076fd3bb9b07..550e22f61b90 100644
--- a/sw/source/filter/ww8/escher.hxx
+++ b/sw/source/filter/ww8/escher.hxx
@@ -139,7 +139,7 @@ private:
class SwEscherEx : public SwBasicEscherEx
{
private:
- SvULongs aFollowShpIds;
+ std::vector<sal_uLong> aFollowShpIds;
EscherExHostAppData aHostData;
WinwordAnchoring aWinwordAnchoring;
WW8_WrPlcTxtBoxes *pTxtBxs;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 99a166196d09..4f6eeba1dd70 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -441,13 +441,6 @@ void RtfSdrExport::AddRectangleDimensions( rtl::OStringBuffer& rBuffer, const Re
rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom());
}
-void RtfSdrExport::AddShapeAttribute( sal_Int32 /*nAttribute*/, const rtl::OString& /*rValue*/ )
-{
- OSL_TRACE("%s", OSL_THIS_FUNC);
-
- /* noop */
-}
-
extern const char* pShapeTypes[];
void lcl_AppendSP( ::rtl::OStringBuffer& rRunText, const char cName[], const ::rtl::OString& rValue)
diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx
index f461357e5c61..5834a238561c 100644
--- a/sw/source/filter/ww8/rtfsdrexport.hxx
+++ b/sw/source/filter/ww8/rtfsdrexport.hxx
@@ -72,12 +72,6 @@ public:
sal_uInt32 AddSdrObject( const SdrObject& rObj );
protected:
- /// Add an attribute to the generated shape element.
- ///
- /// This should be called from within StartShape() to ensure that the
- /// added attribute is preserved.
- void AddShapeAttribute( sal_Int32 nAttribute, const rtl::OString& sValue );
-
/// Start the shape for which we just collected the information.
///
/// Returns the element's tag number, -1 means we wrote nothing.
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index e4775d3ee7a1..dc6e688fa3e9 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -679,7 +679,7 @@ namespace sw
{
const SwFltRedline *pTest = static_cast<const SwFltRedline *>
(pEntry->pAttr);
- return (pEntry->bLocked && (pTest->eType == meType));
+ return (pEntry->bOpen && (pTest->eType == meType));
}
};
@@ -696,17 +696,14 @@ namespace sw
return false;
}
-
-
void RedlineStack::closeall(const SwPosition& rPos)
{
- std::for_each(maStack.begin(), maStack.end(), CloseIfOpen(rPos));
+ std::for_each(maStack.begin(), maStack.end(), SetEndIfOpen(rPos));
}
-
void SetInDocAndDelete::operator()(SwFltStackEntry *pEntry)
{
- SwPaM aRegion(pEntry->nMkNode);
+ SwPaM aRegion(pEntry->m_aMkPos.m_nNode);
if (
pEntry->MakeRegion(&mrDoc, aRegion, true) &&
(*aRegion.GetPoint() != *aRegion.GetMark())
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 878286ccbb23..5b56714accf5 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -467,13 +467,6 @@ namespace sw
msSecondary = GetFontToken(rFamilyName, 1);
}
- bool FontMapExport::HasDistinctSecondary() const
- {
- if (msSecondary.Len() && msSecondary != msPrimary)
- return true;
- return false;
- }
-
bool ItemSort::operator()(sal_uInt16 nA, sal_uInt16 nB) const
{
/*
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index d903c8d540c2..c92ebbc789ca 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -100,6 +100,16 @@
#include "escher.hxx"
#include <ndtxt.hxx>
#include "WW8FFData.hxx"
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <comphelper/processfactory.hxx>
+#include "docsh.hxx"
+#include <oox/ole/olehelper.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <fstream>
using ::editeng::SvxBorderLine;
using namespace com::sun::star;
@@ -2717,8 +2727,7 @@ void SwEscherEx::MakeZOrderArrAndFollowIds(
::lcl_makeZOrderArray(rWrt, rSrcArr, rDstArr);
//Now set up the follow IDs
- if (aFollowShpIds.Count())
- aFollowShpIds.Remove(0, aFollowShpIds.Count());
+ aFollowShpIds.clear();
for (size_t n = 0; n < rDstArr.size(); ++n)
{
@@ -2734,7 +2743,7 @@ void SwEscherEx::MakeZOrderArrAndFollowIds(
sal_uLong nShapeId = bNeedsShapeId ? GenerateShapeId() : 0;
- aFollowShpIds.Insert(nShapeId, n);
+ aFollowShpIds.push_back(nShapeId);
}
}
@@ -2769,6 +2778,34 @@ sal_uInt32 SwEscherEx::QueryTextID(
return nId;
}
+uno::Reference< uno::XComponentContext >
+lcl_getUnoCtx()
+{
+ comphelper::ComponentContext aCtx( ::comphelper::getProcessServiceFactory() );
+ return aCtx.getUNOContext();
+}
+
+
+SwMSConvertControls::SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) : SvxMSConvertOCXControls( pDSh,pP ), maFormCtrlHelper( pDocSh->GetMedium()->GetInputStream(), lcl_getUnoCtx(), pDocSh->GetModel() )
+{
+}
+
+// in transitioning away old filter for ole/ocx controls, ReadOCXStream has been made pure virtual in
+// filter/source/msocximex.cxx, so.. we need an implementation here
+sal_Bool SwMSConvertControls::ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShapeRef,
+ sal_Bool bFloatingCtrl )
+{
+ uno::Reference< form::XFormComponent > xFComp;
+ sal_Bool bRes = maFormCtrlHelper.importFormControlFromObjPool( xFComp, rtl::OUString( rSrc1->GetName() ) );
+ if ( bRes && xFComp.is() )
+ {
+ com::sun::star::awt::Size aSz; // not used in import
+ bRes = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl);
+ }
+ return bRes;
+}
+
bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pObj)
{
if (!rWW8Wrt.bWrtWW8)
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index a2ef19bf92d8..81b6ef74a575 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1618,7 +1618,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNo
xub_StrLen nNextPos = aAttrIter->WhereNext();
xub_StrLen nNextBookmark = nNextPos;
- if( nNextBookmark > nAktPos )//no need to search for bookmarks otherwise
+ if( nNextBookmark > nAktPos ) //no need to search for bookmarks otherwise (checked in UpdatePosition())
{
GetSortedBookmarks( rNode, nAktPos, nNextBookmark - nAktPos );
NearestBookmark( nNextBookmark, nAktPos, false );
@@ -1630,9 +1630,9 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt
{
xub_StrLen nNextPos;
- // go to next attribute if no bookmark is found and if the next attribute position if at the current position
+ // go to next attribute if no bookmark is found or if the bookmark is behind the next attribute position
bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true );
- if( !bNextBookmark && nAktPos >= aAttrIter->WhereNext() )
+ if( !bNextBookmark || nNextPos > aAttrIter->WhereNext() )
aAttrIter->NextPos();
}
@@ -2030,6 +2030,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
}
+ AttrOutput().WritePostitFieldReference();
+
AttrOutput().EndRun();
nAktPos = nNextAttr;
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 2aad7c34363c..da4cc9eb45d1 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2875,10 +2875,10 @@ namespace
rIn.Seek(0);
sal_uInt8 in[WW_BLOCKSIZE];
- for (sal_uLong nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock)
+ for (sal_Size nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock)
{
- sal_uLong nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI;
- rIn.Read(in, nBS);
+ sal_Size nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI;
+ nBS = rIn.Read(in, nBS);
rCtx.InitCipher(nBlock);
rCtx.Encode(in, nBS, in, nBS);
rOut.Write(in, nBS);
@@ -3510,8 +3510,9 @@ void WW8Export::RestoreMacroCmds()
pStream->Seek(0);
sal_uInt8 *pBuffer = new sal_uInt8[pFib->lcbCmds];
- pStream->Read(pBuffer, pFib->lcbCmds);
- pTableStrm->Write(pBuffer, pFib->lcbCmds);
+ bool bReadOk = checkRead(*pStream, pBuffer, pFib->lcbCmds);
+ if (bReadOk)
+ pTableStrm->Write(pBuffer, pFib->lcbCmds);
delete[] pBuffer;
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 2870fd0ddb8f..0ea9201d02dc 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1828,7 +1828,7 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType,
if ( bHandleBookmark )
{
- // retrieve reference destionation - the name of the bookmark
+ // retrieve reference destination - the name of the bookmark
String aLinkStr;
const sal_uInt16 nSubType = pFld->GetSubType();
const SwGetRefField& rRFld = *(static_cast<const SwGetRefField*>(pFld));
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 897ebf39bafa..ec8d8b3b0c3d 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -98,7 +98,7 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <editeng/editobj.hxx>
-
+#include <boost/scoped_ptr.hpp>
#include <math.h>
using ::editeng::SvxBorderLine;
@@ -182,7 +182,11 @@ bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz,
pStrm->SeekRel(SVBT16ToShort(pHd->cb) - sizeof(WW8_DPHEAD));
return false;
}
- pStrm->Read(pData, nDataSiz);
+
+ bool bCouldRead = checkRead(*pStrm, pData, nDataSiz);
+ OSL_ENSURE(bCouldRead, "Short Graphic header");
+ if (!bCouldRead)
+ return false;
RndStdIds eAnchor = (SVBT8ToByte(pDo->by) < 2) ? FLY_AT_PAGE : FLY_AT_PARA;
rSet.Put(SwFmtAnchor(eAnchor));
@@ -443,20 +447,24 @@ SdrObject* SwWW8ImplReader::ReadPolyLine( WW8_DPHEAD* pHd, const WW8_DO* pDo,
return 0;
sal_uInt16 nCount = SVBT16ToShort( aPoly.aBits1 ) >> 1 & 0x7fff;
- SVBT16 *pP = new SVBT16[nCount * 2];
- pStrm->Read( pP, nCount * 4 ); // Punkte einlesen
+ boost::scoped_array<SVBT16> xP(new SVBT16[nCount * 2]);
+
+ bool bCouldRead = checkRead(*pStrm, xP.get(), nCount * 4); // Punkte einlesen
+ OSL_ENSURE(bCouldRead, "Short PolyLine header");
+ if (!bCouldRead)
+ return 0;
+
Polygon aP( nCount );
Point aPt;
- sal_uInt16 i;
-
- for( i=0; i<nCount; i++ ){
- aPt.X() = SVBT16ToShort( pP[i << 1] ) + nDrawXOfs2
+ for (sal_uInt16 i=0; i<nCount; ++i)
+ {
+ aPt.X() = SVBT16ToShort( xP[i << 1] ) + nDrawXOfs2
+ (sal_Int16)SVBT16ToShort( pHd->xa );
- aPt.Y() = SVBT16ToShort( pP[( i << 1 ) + 1] ) + nDrawYOfs2
+ aPt.Y() = SVBT16ToShort( xP[( i << 1 ) + 1] ) + nDrawYOfs2
+ (sal_Int16)SVBT16ToShort( pHd->ya );
aP[i] = aPt;
}
- delete[] pP;
+ xP.reset();
SdrObject* pObj = new SdrPathObj(( SVBT16ToShort( aPoly.aBits1 ) & 0x1 ) ? OBJ_POLY : OBJ_PLIN, ::basegfx::B2DPolyPolygon(aP.getB2DPolygon()));
SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd );
@@ -627,7 +635,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
std::deque<Chunk> aChunks;
//Here store stack location
- sal_uInt16 nCurrentCount = static_cast< sal_uInt16 >(pCtrlStck->Count());
+ size_t nCurrentCount = pCtrlStck->size();
while (nStart < nEndCp)
{
//nStart is the beginning of the attributes for this range, and
@@ -685,13 +693,13 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
{
if (bStartAttr)
{
- sal_uInt16 nCount = static_cast< sal_uInt16 >(pCtrlStck->Count());
+ size_t nCount = pCtrlStck->size();
if (maFieldStack.empty() && Read_Field(&aRes))
{
String sURL;
- for (sal_uInt16 nI = static_cast< sal_uInt16 >(pCtrlStck->Count()); nI > nCount; --nI)
+ for (size_t nI = pCtrlStck->size(); nI > nCount; --nI)
{
- const SfxPoolItem *pItem = ((*pCtrlStck)[nI-1])->pAttr;
+ const SfxPoolItem *pItem = ((*pCtrlStck)[nI-1]).pAttr;
sal_uInt16 nWhich = pItem->Which();
if (nWhich == RES_TXTATR_INETFMT)
{
@@ -723,11 +731,11 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
//Here read current properties and convert them into pS
//and put those attrs into the draw box if they can be converted
//to draw attributes
- if (pCtrlStck->Count() - nCurrentCount)
+ if (pCtrlStck->size() - nCurrentCount)
{
- for (sal_uInt16 i = nCurrentCount; i < pCtrlStck->Count(); i++)
+ for (size_t i = nCurrentCount; i < pCtrlStck->size(); ++i)
{
- const SfxPoolItem *pItem = ((*pCtrlStck)[i])->pAttr;
+ const SfxPoolItem *pItem = ((*pCtrlStck)[i]).pAttr;
sal_uInt16 nWhich = pItem->Which();
if( nWhich < RES_FLTRATTR_BEGIN ||
nWhich >= RES_FLTRATTR_END )
@@ -764,7 +772,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
//pop off as far as recorded location just in case there were some left
//unclosed
- for (sal_uInt16 nI = static_cast< sal_uInt16 >(pCtrlStck->Count()); nI > nCurrentCount; --nI)
+ for (size_t nI = pCtrlStck->size(); nI > nCurrentCount; --nI)
pCtrlStck->DeleteAndDestroy(nI-1);
typedef std::deque<Chunk>::iterator myIter;
@@ -831,7 +839,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp,
bool bReusable = (0 != SVBT16ToShort( ((WW8_TXBXS*)pT0)->fReusable ));
while( bReusable )
{
- (*pT)++;
+ pT->advance();
if( !pT->Get( rStartCp, pT0 ) )
{
OSL_ENSURE( !this, "+Wo ist der Grafik-Text (2-a) ?" );
@@ -840,7 +848,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp,
bReusable = (0 != SVBT16ToShort( ((WW8_TXBXS*)pT0)->fReusable ));
}
}
- (*pT)++;
+ pT->advance();
if( !pT->Get( rEndCp, pT0 ) )
{
OSL_ENSURE( !this, "+Wo ist der Grafik-Text (3) ?" );
@@ -868,7 +876,8 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp,
return false;
}
// ggfs. entsprechende Anzahl Eintraege weitergehen
- for(sal_uInt16 iSequence = 0; iSequence < nSequence; iSequence++) (*pT)++;
+ for (sal_uInt16 iSequence = 0; iSequence < nSequence; ++iSequence)
+ pT->advance();
// dann die tatsaechlichen Start und Ende ermitteln
if( (!pT->Get( rStartCp, pT0 ))
|| ( nMinStartCp > rStartCp ) )
@@ -880,9 +889,8 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp,
rEndCp = rStartCp; // kein Error: leerer String!
else
{
- (*pT)++;
- if( (!pT->Get( rEndCp, pT0 ))
- || ( nMaxEndCp < rEndCp-1 ) )
+ pT->advance();
+ if ( (!pT->Get(rEndCp, pT0)) || (nMaxEndCp < rEndCp-1) )
{
OSL_ENSURE( !this, "+Wo ist der Grafik-Text (6) ?" );
return false;
@@ -1248,10 +1256,15 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox( WW8_DPHEAD* pHd, const WW8_DO* pDo,
return 0;
sal_uInt16 nCount = SVBT16ToShort( aCallB.dpPolyLine.aBits1 ) >> 1 & 0x7fff;
- SVBT16 *pP = new SVBT16[nCount * 2];
- pStrm->Read( pP, nCount * 4 ); // Punkte einlesen
+ boost::scoped_array<SVBT16> xP(new SVBT16[nCount * 2]);
+
+ bool bCouldRead = checkRead(*pStrm, xP.get(), nCount * 4); // Punkte einlesen
+ OSL_ENSURE(bCouldRead, "Short CaptionBox header");
+ if (!bCouldRead)
+ return 0;
+
sal_uInt8 nTyp = (sal_uInt8)nCount - 1;
- if( nTyp == 1 && SVBT16ToShort( pP[0] ) == SVBT16ToShort( pP[2] ) )
+ if( nTyp == 1 && SVBT16ToShort( xP[0] ) == SVBT16ToShort( xP[2] ) )
nTyp = 0;
Point aP0( (sal_Int16)SVBT16ToShort( pHd->xa ) +
@@ -1263,11 +1276,11 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox( WW8_DPHEAD* pHd, const WW8_DO* pDo,
aP1.Y() += (sal_Int16)SVBT16ToShort( aCallB.dpheadTxbx.dya );
Point aP2( (sal_Int16)SVBT16ToShort( pHd->xa )
+ (sal_Int16)SVBT16ToShort( aCallB.dpheadPolyLine.xa )
- + nDrawXOfs2 + (sal_Int16)SVBT16ToShort( pP[0] ),
+ + nDrawXOfs2 + (sal_Int16)SVBT16ToShort( xP[0] ),
(sal_Int16)SVBT16ToShort( pHd->ya )
+ (sal_Int16)SVBT16ToShort( aCallB.dpheadPolyLine.ya )
- + nDrawYOfs2 + (sal_Int16)SVBT16ToShort( pP[1] ) );
- delete[] pP;
+ + nDrawYOfs2 + (sal_Int16)SVBT16ToShort( xP[1] ) );
+ xP.reset();
SdrCaptionObj* pObj = new SdrCaptionObj( Rectangle( aP0, aP1 ), aP2 );
pObj->SetModel( pDrawModel );
@@ -1334,7 +1347,13 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive( short& rLeft, const WW8_DO* pDo,
//into an object hierarachy with a little effort.
SdrObject *pRet=0;
WW8_DPHEAD aHd; // Lese Draw-Primitive-Header
- pStrm->Read(&aHd, sizeof(WW8_DPHEAD));
+ bool bCouldRead = checkRead(*pStrm, &aHd, sizeof(WW8_DPHEAD));
+ OSL_ENSURE(bCouldRead, "Graphic Primitive header short read" );
+ if (!bCouldRead)
+ {
+ rLeft=0;
+ return pRet;
+ }
if( rLeft >= SVBT16ToShort(aHd.cb) ) // Vorsichtsmassmahme
{
@@ -1394,9 +1413,18 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp )
OSL_ENSURE( !this, "+Wo ist die Grafik (3) ?" );
return;
}
+
+ bool bCouldSeek = checkSeek(*pStrm, SVBT32ToUInt32(pF->fc));
+ OSL_ENSURE(bCouldSeek, "Invalid Graphic offset");
+ if (!bCouldSeek)
+ return;
+
+ // Lese Draw-Header
WW8_DO aDo;
- pStrm->Seek( SVBT32ToUInt32( pF->fc ) ); // Lese Draw-Header
- pStrm->Read( &aDo, sizeof( WW8_DO ) );
+ bool bCouldRead = checkRead(*pStrm, &aDo, sizeof(WW8_DO));
+ OSL_ENSURE(bCouldRead, "Short Graphic header");
+ if (!bCouldRead)
+ return;
short nLeft = SVBT16ToShort( aDo.cb ) - sizeof( WW8_DO );
while (nLeft > static_cast<short>(sizeof(WW8_DPHEAD)))
@@ -3057,12 +3085,12 @@ void SwWW8FltAnchorStack::AddAnchor(const SwPosition& rPos, SwFrmFmt *pFmt)
void SwWW8FltAnchorStack::Flush()
{
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
- for (sal_uInt16 i=0; i < nCnt; ++i)
+ size_t nCnt = size();
+ for (size_t i=0; i < nCnt; ++i)
{
- SwFltStackEntry *pEntry = (*this)[i];
- SwPosition aDummy(pEntry->nMkNode);
- SetAttrInDoc(aDummy,pEntry);
+ SwFltStackEntry &rEntry = (*this)[i];
+ SwPosition aDummy(rEntry.m_aMkPos.m_nNode);
+ SetAttrInDoc(aDummy, rEntry);
DeleteAndDestroy(i--);
--nCnt;
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2a55ad700d14..34106e4bb840 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -957,9 +957,9 @@ void SwWW8ImplReader::Read_StyleCode( sal_uInt16, const sal_uInt8* pData, short
nColl = *pData;
else
nColl = SVBT16ToShort(pData);
- if (nColl < nColls)
+ if (nColl < vColl.size())
{
- SetTxtFmtCollAndListLevel( *pPaM, pCollA[nColl] );
+ SetTxtFmtCollAndListLevel( *pPaM, vColl[nColl] );
bCpxStyle = true;
}
}
@@ -982,19 +982,20 @@ void SwWW8FltControlStack::NewAttr(const SwPosition& rPos,
SwFltControlStack::NewAttr(rPos, rAttr);
}
-void SwWW8FltControlStack::SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId,
+SwFltStackEntry* SwWW8FltControlStack::SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId,
sal_Bool bTstEnde, long nHand, sal_Bool )
{
+ SwFltStackEntry *pRet = NULL;
//Doing a textbox, and using the control stack only as a temporary
//collection point for properties which will are not to be set into
//the real document
if (rReader.pPlcxMan && rReader.pPlcxMan->GetDoingDrawTextBox())
{
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(Count());
- for (sal_uInt16 i=0; i < nCnt; ++i)
+ size_t nCnt = size();
+ for (size_t i=0; i < nCnt; ++i)
{
- SwFltStackEntry* pEntry = (*this)[i];
- if (nAttrId == pEntry->pAttr->Which())
+ SwFltStackEntry& rEntry = (*this)[i];
+ if (nAttrId == rEntry.pAttr->Which())
{
DeleteAndDestroy(i--);
--nCnt;
@@ -1002,7 +1003,8 @@ void SwWW8FltControlStack::SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId,
}
}
else //Normal case, set the attribute into the document
- SwFltControlStack::SetAttr(rPos, nAttrId, bTstEnde, nHand);
+ pRet = SwFltControlStack::SetAttr(rPos, nAttrId, bTstEnde, nHand);
+ return pRet;
}
long GetListFirstLineIndent(const SwNumFmt &rFmt)
@@ -1086,9 +1088,9 @@ const SwNumFmt* SwWW8FltControlStack::GetNumFmtFromStack(const SwPosition &rPos,
}
void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
- SwFltStackEntry* pEntry)
+ SwFltStackEntry& rEntry)
{
- switch( pEntry->pAttr->Which() )
+ switch (rEntry.pAttr->Which())
{
case RES_LR_SPACE:
{
@@ -1101,9 +1103,9 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
*/
using namespace sw::util;
SwPaM aRegion(rTmpPos);
- if (pEntry->MakeRegion(pDoc, aRegion, false))
+ if (rEntry.MakeRegion(pDoc, aRegion, false))
{
- SvxLRSpaceItem aNewLR( *(SvxLRSpaceItem*)pEntry->pAttr );
+ SvxLRSpaceItem aNewLR( *(SvxLRSpaceItem*)rEntry.pAttr );
sal_uLong nStart = aRegion.Start()->nNode.GetIndex();
sal_uLong nEnd = aRegion.End()->nNode.GetIndex();
for(; nStart <= nEnd; ++nStart)
@@ -1157,7 +1159,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
case RES_TXTATR_INETFMT:
{
SwPaM aRegion(rTmpPos);
- if (pEntry->MakeRegion(pDoc, aRegion, false))
+ if (rEntry.MakeRegion(pDoc, aRegion, false))
{
SwFrmFmt *pFrm;
//If we have just one single inline graphic then
@@ -1166,7 +1168,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
if (0 != (pFrm = rReader.ContainsSingleInlineGraphic(aRegion)))
{
const SwFmtINetFmt *pAttr = (const SwFmtINetFmt *)
- pEntry->pAttr;
+ rEntry.pAttr;
SwFmtURL aURL;
aURL.SetURL(pAttr->GetValue(), false);
aURL.SetTargetFrameName(pAttr->GetTargetFrame());
@@ -1174,13 +1176,13 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
}
else
{
- pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0);
+ pDoc->InsertPoolItem(aRegion, *rEntry.pAttr, 0);
}
}
}
break;
default:
- SwFltControlStack::SetAttrInDoc(rTmpPos, pEntry);
+ SwFltControlStack::SetAttrInDoc(rTmpPos, rEntry);
break;
}
}
@@ -1207,8 +1209,8 @@ const SfxPoolItem* SwWW8FltControlStack::GetFmtAttr(const SwPosition& rPos,
SfxItemState eState = SFX_ITEM_DEFAULT;
if (const SfxItemSet *pSet = pNd->GetpSwAttrSet())
eState = pSet->GetItemState(RES_LR_SPACE, false);
- if (eState != SFX_ITEM_SET && rReader.pCollA != NULL)
- pItem = &(rReader.pCollA[rReader.nAktColl].maWordLR);
+ if (eState != SFX_ITEM_SET && rReader.nAktColl < rReader.vColl.size())
+ pItem = &(rReader.vColl[rReader.nAktColl].maWordLR);
}
/*
@@ -1233,24 +1235,28 @@ const SfxPoolItem* SwWW8FltControlStack::GetFmtAttr(const SwPosition& rPos,
const SfxPoolItem* SwWW8FltControlStack::GetStackAttr(const SwPosition& rPos,
sal_uInt16 nWhich)
{
- SwNodeIndex aNode( rPos.nNode, -1 );
- sal_uInt16 nIdx = rPos.nContent.GetIndex();
+ SwFltPosition aFltPos(rPos);
- sal_uInt16 nSize = static_cast< sal_uInt16 >(Count());
+ size_t nSize = size();
while (nSize)
{
- const SwFltStackEntry* pEntry = (*this)[ --nSize ];
- if (pEntry->pAttr->Which() == nWhich)
+ const SwFltStackEntry& rEntry = (*this)[ --nSize ];
+ if (rEntry.pAttr->Which() == nWhich)
{
- if ( (pEntry->bLocked) || (
- (pEntry->nMkNode <= aNode) && (pEntry->nPtNode >= aNode) &&
- (pEntry->nMkCntnt <= nIdx) && (pEntry->nPtCntnt > nIdx) ) )
+ if ( (rEntry.bOpen) ||
+ (
+ (rEntry.m_aMkPos.m_nNode <= aFltPos.m_nNode) &&
+ (rEntry.m_aPtPos.m_nNode >= aFltPos.m_nNode) &&
+ (rEntry.m_aMkPos.m_nCntnt <= aFltPos.m_nCntnt) &&
+ (rEntry.m_aPtPos.m_nCntnt > aFltPos.m_nCntnt)
+ )
+ )
/*
* e.g. half-open range [0-3) so asking for properties at 3
* means props that end at 3 are not included
*/
{
- return (const SfxPoolItem*)pEntry->pAttr;
+ return rEntry.pAttr;
}
}
}
@@ -1279,9 +1285,9 @@ bool SwWW8FltRefStack::IsFtnEdnBkmField(const SwFmtFld& rFmtFld, sal_uInt16& rBk
}
void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
- SwFltStackEntry* pEntry)
+ SwFltStackEntry& rEntry)
{
- switch( pEntry->pAttr->Which() )
+ switch (rEntry.pAttr->Which())
{
/*
Look up these in our lists of bookmarks that were changed to
@@ -1290,14 +1296,14 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
*/
case RES_TXTATR_FIELD:
{
- SwNodeIndex aIdx(pEntry->nMkNode, 1);
- SwPaM aPaM(aIdx, pEntry->nMkCntnt);
+ SwNodeIndex aIdx(rEntry.m_aMkPos.m_nNode, 1);
+ SwPaM aPaM(aIdx, rEntry.m_aMkPos.m_nCntnt);
- SwFmtFld& rFmtFld = *(SwFmtFld*)pEntry->pAttr;
+ SwFmtFld& rFmtFld = *(SwFmtFld*)rEntry.pAttr;
SwField* pFld = rFmtFld.GetFld();
// <NOT> got lost from revision 1.128 to 1.129
- if (!RefToVar(pFld,pEntry))
+ if (!RefToVar(pFld, rEntry))
{
sal_uInt16 nBkmNo;
if( IsFtnEdnBkmField(rFmtFld, nBkmNo) )
@@ -1324,17 +1330,17 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
}
}
- pDoc->InsertPoolItem(aPaM, *pEntry->pAttr, 0);
+ pDoc->InsertPoolItem(aPaM, *rEntry.pAttr, 0);
MoveAttrs(*aPaM.GetPoint());
}
break;
case RES_FLTR_TOX:
- SwFltEndStack::SetAttrInDoc(rTmpPos, pEntry);
+ SwFltEndStack::SetAttrInDoc(rTmpPos, rEntry);
break;
default:
case RES_FLTR_BOOKMARK:
OSL_ENSURE(!this, "EndStck used with non field, not what we want");
- SwFltEndStack::SetAttrInDoc(rTmpPos, pEntry);
+ SwFltEndStack::SetAttrInDoc(rTmpPos, rEntry);
break;
}
}
@@ -1357,27 +1363,39 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
return;
}
- short i;
- const sal_uInt8* pDel = pData + 1; // Del - Array
- sal_uInt8 nDel = pData[0];
+ sal_uInt8 nDel = (nLen > 0) ? pData[0] : 0;
+ const sal_uInt8* pDel = pData + 1; // Del - Array
+
+ sal_uInt8 nIns = (nLen > nDel*2+1) ? pData[nDel*2+1] : 0;
const sal_uInt8* pIns = pData + 2*nDel + 2; // Ins - Array
- sal_uInt8 nIns = pData[nDel*2+1];
+
+ short nRequiredLength = 2 + 2*nDel + 2*nIns + 1*nIns;
+ if (nRequiredLength > nLen)
+ {
+ //would require more data than available to describe!, discard invalid
+ //record
+ nIns = 0;
+ nDel = 0;
+ }
+
WW8_TBD* pTyp = (WW8_TBD*)(pData + 2*nDel + 2*nIns + 2);// Typ - Array
SvxTabStopItem aAttr(0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP);
const SwTxtFmtColl* pSty = 0;
sal_uInt16 nTabBase;
- if (pAktColl) // StyleDef
+ if (pAktColl && nAktColl < vColl.size()) // StyleDef
{
- nTabBase = pCollA[nAktColl].nBase;
- if (nTabBase < nColls) // Based On
- pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
+ nTabBase = vColl[nAktColl].nBase;
+ if (nTabBase < vColl.size()) // Based On
+ pSty = (const SwTxtFmtColl*)vColl[nTabBase].pFmt;
}
else
{ // Text
nTabBase = nAktColl;
- pSty = (const SwTxtFmtColl*)pCollA[nAktColl].pFmt;
+ if (nAktColl < vColl.size())
+ pSty = (const SwTxtFmtColl*)vColl[nAktColl].pFmt;
+ //TODO figure else here
}
bool bFound = false;
@@ -1391,14 +1409,13 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
aAttr = *((const SvxTabStopItem*)pTabs);
else
{
-
sal_uInt16 nOldTabBase = nTabBase;
// If based on another
- if (nTabBase < nColls)
- nTabBase = pCollA[nTabBase].nBase;
+ if (nTabBase < vColl.size())
+ nTabBase = vColl[nTabBase].nBase;
if (
- nTabBase < nColls &&
+ nTabBase < vColl.size() &&
nOldTabBase != nTabBase &&
nTabBase != ww::stiNil
)
@@ -1406,7 +1423,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
// #i61789: Stop searching when next style is the same as the
// current one (prevent loop)
aLoopWatch.insert(reinterpret_cast<size_t>(pSty));
- pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
+ if (nTabBase < vColl.size())
+ pSty = (const SwTxtFmtColl*)vColl[nTabBase].pFmt;
+ //TODO figure out the else branch
if (aLoopWatch.find(reinterpret_cast<size_t>(pSty)) !=
aLoopWatch.end())
@@ -1418,14 +1437,14 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
}
SvxTabStop aTabStop;
- for (i=0; i < nDel; ++i)
+ for (short i=0; i < nDel; ++i)
{
sal_uInt16 nPos = aAttr.GetPos(SVBT16ToShort(pDel + i*2));
if( nPos != SVX_TAB_NOTFOUND )
aAttr.Remove( nPos, 1 );
}
- for (i=0; i < nIns; ++i)
+ for (short i=0; i < nIns; ++i)
{
short nPos = SVBT16ToShort(pIns + i*2);
aTabStop.GetTabPos() = nPos;
@@ -2389,10 +2408,10 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
{
if (!maFontSrcCharSets.empty())
eSrcCharSet = maFontSrcCharSets.top();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCharSet();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl))
- eSrcCharSet = pCollA[nAktColl].GetCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
+ eSrcCharSet = vColl[nCharFmt].GetCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl) && nAktColl < vColl.size())
+ eSrcCharSet = vColl[nAktColl].GetCharSet();
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
/*
@@ -2449,12 +2468,12 @@ CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
{
if (!maFontSrcCJKCharSets.empty())
eSrcCharSet = maFontSrcCJKCharSets.top();
- if (pCollA != NULL)
+ if (!vColl.empty())
{
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
- eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
+ eSrcCharSet = vColl[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW && nAktColl < vColl.size())
+ eSrcCharSet = vColl[nAktColl].GetCJKCharSet();
}
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
@@ -2616,20 +2635,41 @@ sal_Unicode SwWW8ImplReader::TranslateToHindiNumbers(sal_Unicode nChar)
// Returnwert: true for no Sonderzeichen
bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
{
+ sal_Size nRequestedStrLen = nEnd - rPos;
+
+ OSL_ENSURE(nRequestedStrLen, "String is 0");
+ if (!nRequestedStrLen)
+ return true;
+
+ sal_Size nRequestedPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode);
+ bool bValidPos = checkSeek(*pStrm, nRequestedPos);
+ OSL_ENSURE(bValidPos, "Document claimed to have more text than available");
+ if (!bValidPos)
+ {
+ //Swallow missing range, e.g. #i95550#
+ rPos+=nRequestedStrLen;
+ return true;
+ }
+
+ sal_Size nAvailableStrLen = pStrm->remainingSize() / (bIsUnicode ? 2 : 1);
+ OSL_ENSURE(nAvailableStrLen, "Document claimed to have more text than available");
+ if (!nAvailableStrLen)
+ {
+ //Swallow missing range, e.g. #i95550#
+ rPos+=nRequestedStrLen;
+ return true;
+ }
+
+ sal_Size nValidStrLen = std::min(nRequestedStrLen, nAvailableStrLen);
+
// Unicode-Flag neu setzen und notfalls File-Pos korrigieren
// merke: Seek kostet nicht viel, da inline geprueft wird,
// ob die korrekte FilePos nicht schon erreicht ist.
- WW8_FC nStreamPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode);
- pStrm->Seek( nStreamPos );
-
- xub_StrLen nLen;
- if (nEnd - rPos <= (STRING_MAXLEN-1))
- nLen = writer_cast<xub_StrLen>(nEnd - rPos);
+ xub_StrLen nStrLen;
+ if (nValidStrLen <= (STRING_MAXLEN-1))
+ nStrLen = writer_cast<xub_StrLen>(nValidStrLen);
else
- nLen = STRING_MAXLEN-1;
- OSL_ENSURE(nLen, "String is 0");
- if (!nLen)
- return true;
+ nStrLen = STRING_MAXLEN-1;
const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() :
RTL_TEXTENCODING_MS_1252;
@@ -2639,7 +2679,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
// (re)alloc UniString data
String sPlainCharsBuf;
- sal_Unicode* pBuffer = sPlainCharsBuf.AllocBuffer( nLen );
+ sal_Unicode* pBuffer = sPlainCharsBuf.AllocBuffer(nStrLen);
sal_Unicode* pWork = pBuffer;
sal_Char* p8Bits = NULL;
@@ -2649,7 +2689,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
hConverter = rtl_createTextToUnicodeConverter(eSrcCharSet);
if (!bIsUnicode)
- p8Bits = new sal_Char[nLen];
+ p8Bits = new sal_Char[nStrLen];
// read the stream data
sal_uInt8 nBCode = 0;
@@ -2661,7 +2701,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
if (pItem != NULL)
nCTLLang = dynamic_cast<const SvxLanguageItem *>(pItem)->GetLanguage();
- for( nL2 = 0; nL2 < nLen; ++nL2, ++pWork )
+ for( nL2 = 0; nL2 < nStrLen; ++nL2, ++pWork )
{
if (bIsUnicode)
*pStrm >> nUCode; // unicode --> read 2 bytes
@@ -2716,9 +2756,9 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
xub_StrLen nEndUsed = nL2;
if (!bIsUnicode)
- nEndUsed = Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nLen);
+ nEndUsed = Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nStrLen);
- for( xub_StrLen nI = 0; nI < nLen; ++nI, ++pBuffer )
+ for( xub_StrLen nI = 0; nI < nStrLen; ++nI, ++pBuffer )
if (m_bRegardHindiDigits && bBidi && LangUsesHindiNumbers(nCTLLang))
*pBuffer = TranslateToHindiNumbers(*pBuffer);
@@ -2733,7 +2773,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
if (hConverter)
rtl_destroyTextToUnicodeConverter(hConverter);
delete [] p8Bits;
- return nL2 >= nLen;
+ return nL2 >= nStrLen;
}
#define MSASCII SAL_MAX_INT16
@@ -2884,7 +2924,14 @@ void SwWW8ImplReader::simpleAddTextToParagraph(const String& rAddString)
<< ::std::endl;
}
#endif
- const SwTxtNode* pNd = pPaM->GetCntntNode()->GetTxtNode();
+
+ const SwCntntNode *pCntNd = pPaM->GetCntntNode();
+ const SwTxtNode* pNd = pCntNd ? pCntNd->GetTxtNode() : NULL;
+
+ OSL_ENSURE(pNd, "What the hell, where's my text node");
+
+ if (!pNd)
+ return;
if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN-1)
{
@@ -2996,10 +3043,12 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
// Unicode-Flag neu setzen und notfalls File-Pos korrigieren
// merke: Seek kostet nicht viel, da inline geprueft wird,
// ob die korrekte FilePos nicht schon erreicht ist.
- pStrm->Seek( pSBase->WW8Cp2Fc(nCpOfs+nPosCp, &bIsUnicode) );
+ sal_Size nRequestedPos = pSBase->WW8Cp2Fc(nCpOfs+nPosCp, &bIsUnicode);
+ if (!checkSeek(*pStrm, nRequestedPos))
+ return false;
- sal_uInt8 nBCode;
- sal_uInt16 nWCharVal;
+ sal_uInt8 nBCode(0);
+ sal_uInt16 nWCharVal(0);
if( bIsUnicode )
*pStrm >> nWCharVal; // unicode --> read 2 bytes
else
@@ -3175,7 +3224,7 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
nAktColl = pPlcxMan->GetColl();
// Invalid Style-Id
- if (nAktColl >= nColls || !pCollA[nAktColl].pFmt || !pCollA[nAktColl].bColl)
+ if (nAktColl >= vColl.size() || !vColl[nAktColl].pFmt || !vColl[nAktColl].bColl)
{
nAktColl = 0;
bParaAutoBefore = false;
@@ -3183,10 +3232,13 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
}
else
{
- bParaAutoBefore = pCollA[nAktColl].bParaAutoBefore;
- bParaAutoAfter = pCollA[nAktColl].bParaAutoAfter;
+ bParaAutoBefore = vColl[nAktColl].bParaAutoBefore;
+ bParaAutoAfter = vColl[nAktColl].bParaAutoAfter;
}
+ if (nOldColl >= vColl.size())
+ nOldColl = 0; //guess! TODO make sure this is what we want
+
bool bTabRowEnd = false;
if( pStartAttr && bCallProcessSpecial && !bInHyperlink )
{
@@ -3199,10 +3251,10 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
if (!bTabRowEnd && StyleExists(nAktColl))
{
- SetTxtFmtCollAndListLevel( *pPaM, pCollA[ nAktColl ]);
- ChkToggleAttr(pCollA[ nOldColl ].n81Flags, pCollA[ nAktColl ].n81Flags);
- ChkToggleBiDiAttr(pCollA[nOldColl].n81BiDiFlags,
- pCollA[nAktColl].n81BiDiFlags);
+ SetTxtFmtCollAndListLevel( *pPaM, vColl[ nAktColl ]);
+ ChkToggleAttr(vColl[ nOldColl ].n81Flags, vColl[ nAktColl ].n81Flags);
+ ChkToggleBiDiAttr(vColl[nOldColl].n81BiDiFlags,
+ vColl[nAktColl].n81BiDiFlags);
}
}
@@ -3338,8 +3390,8 @@ void SwWW8ImplReader::ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLin
// nicht im Plcx.Fkp.papx eingetragen, d.h. ( nFlags & MAN_MASK_NEW_PAP )
// ist false. Deshalb muss als Sonderbehandlung hier die Vorlage gesetzt
// werden.
- if (!bCpxStyle && nAktColl < nColls)
- SetTxtFmtCollAndListLevel(*pPaM, pCollA[nAktColl]);
+ if (!bCpxStyle && nAktColl < vColl.size())
+ SetTxtFmtCollAndListLevel(*pPaM, vColl[nAktColl]);
rbStartLine = false;
}
}
@@ -3522,7 +3574,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType)
// #i43118# - refine condition: the anchor
// control stack has to have entries, otherwise it's not needed
// to insert a text node.
- if ( !bStartLine && pAnchorStck->Count() > 0 )
+ if (!bStartLine && !pAnchorStck->empty())
{
AppendTxtNode(*pPaM->GetPoint());
}
@@ -3561,6 +3613,7 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pDataStream(0),
rDoc(rD),
maSectionManager(*this),
+ m_aExtraneousParas(rD),
maInsertedTables(rD),
maSectionNameGenerator(rD,CREATE_CONST_ASC("WW")),
maGrfNameGenerator(bNewDoc,String('G')),
@@ -3593,7 +3646,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pAktColl = 0;
pLstManager = 0;
pAktItemSet = 0;
- pCollA = 0;
pDfltTxtFmtColl = 0;
pStandardFmtColl = 0;
pHdFt = 0;
@@ -3603,7 +3655,7 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pFmtOfJustInsertedApo = 0;
pPreviousNumPaM = 0;
pPrevNumRule = 0;
- nColls = nAktColl = 0;
+ nAktColl = 0;
nObjLocFc = nPicLocFc = 0;
nInTable=0;
bReadNoTbl = bPgSecBreak = bSpec = bObj = bTxbxFlySection
@@ -4049,6 +4101,21 @@ void wwSectionManager::InsertSegments()
}
}
+void wwExtraneousParas::delete_all_from_doc()
+{
+ typedef std::vector<SwTxtNode*>::iterator myParaIter;
+ myParaIter aEnd = m_aTxtNodes.end();
+ for (myParaIter aI = m_aTxtNodes.begin(); aI != aEnd; ++aI)
+ {
+ SwTxtNode *pTxtNode = *aI;
+ SwNodeIndex aIdx(*pTxtNode);
+ SwPosition aPos(aIdx);
+ SwPaM aTest(aPos);
+ m_rDoc.DelFullPara(aTest);
+ }
+ m_aTxtNodes.clear();
+}
+
void SwWW8ImplReader::StoreMacroCmds()
{
if (pWwFib->lcbCmds)
@@ -4069,7 +4136,7 @@ void SwWW8ImplReader::StoreMacroCmds()
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xStream );
sal_uInt8 *pBuffer = new sal_uInt8[pWwFib->lcbCmds];
- pTableStream->Read(pBuffer, pWwFib->lcbCmds);
+ pWwFib->lcbCmds = pTableStream->Read(pBuffer, pWwFib->lcbCmds);
pStream->Write(pBuffer, pWwFib->lcbCmds);
delete[] pBuffer;
delete pStream;
@@ -4390,7 +4457,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
pWwFib->lcbSttbFnm, bVer67 ? 2 : 0, eStructCharSet,
aLinkStrings, &aStringIds);
- for (size_t i=0; i < aLinkStrings.size(); ++i)
+ for (size_t i=0; i < aLinkStrings.size() && i < aStringIds.size(); ++i)
{
ww::bytes stringId = aStringIds[i];
WW8_STRINGID *stringIdStruct = (WW8_STRINGID*)(&stringId[0]);
@@ -4422,7 +4489,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
::SetProgressState(nProgress, mpDocShell); // Update
pStyles->PostProcessStyles();
- if (pCollA)
+ if (!vColl.empty())
SetOutLineStyles();
pSBase = new WW8ScannerBase(pStrm,pTableStream,pDataStream,pWwFib);
@@ -4503,7 +4570,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
// loop for each glossary entry and add dummy section node
if (pGloss)
{
- WW8PLCF aPlc(pTableStream, pWwFib->fcPlcfglsy, pWwFib->lcbPlcfglsy, 0);
+ WW8PLCF aPlc(*pTableStream, pWwFib->fcPlcfglsy, pWwFib->lcbPlcfglsy, 0);
WW8_CP nStart, nEnd;
void* pDummy;
@@ -4649,8 +4716,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
maInsertedTables.DelAndMakeTblFrms();
maSectionManager.InsertSegments();
- if (pCollA)
- delete[] pCollA;
+ vColl.clear();
DELETEZ( pStyles );
@@ -4677,6 +4743,11 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
DeleteAnchorStk();
DeleteRefStks();
+ //remove extra paragraphs after attribute ctrl
+ //stacks etc. are destroyed, and before fields
+ //are updated
+ m_aExtraneousParas.delete_all_from_doc();
+
UpdateFields();
// delete the pam before the call for hide all redlines (Bug 73683)
@@ -4758,7 +4829,7 @@ namespace
for (sal_Size nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock)
{
sal_Size nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI;
- rIn.Read(in, nBS);
+ nBS = rIn.Read(in, nBS);
rCtx.InitCipher(nBlock);
rCtx.Decode(in, nBS, in, nBS);
rOut.Write(in, nBS);
@@ -4767,19 +4838,19 @@ namespace
void DecryptXOR(msfilter::MSCodec_XorWord95 &rCtx, SvStream &rIn, SvStream &rOut)
{
- sal_uLong nSt = rIn.Tell();
+ sal_Size nSt = rIn.Tell();
rIn.Seek(STREAM_SEEK_TO_END);
- sal_uLong nLen = rIn.Tell();
+ sal_Size nLen = rIn.Tell();
rIn.Seek(nSt);
rCtx.InitCipher();
rCtx.Skip(nSt);
sal_uInt8 in[0x4096];
- for (sal_uLong nI = nSt; nI < nLen; nI += 0x4096)
+ for (sal_Size nI = nSt; nI < nLen; nI += 0x4096)
{
- sal_uLong nBS = (nLen - nI > 0x4096 ) ? 0x4096 : nLen - nI;
- rIn.Read(in, nBS);
+ sal_Size nBS = (nLen - nI > 0x4096 ) ? 0x4096 : nLen - nI;
+ nBS = rIn.Read(in, nBS);
rCtx.Decode(in, nBS);
rOut.Write(in, nBS);
}
@@ -4834,23 +4905,24 @@ namespace
{
String sUniPassword = QueryPasswordForMedium( rMedium );
- ByteString sPassword(sUniPassword, WW8Fib::GetFIBCharset( pWwFib->chseTables ) );
+ rtl::OString sPassword(rtl::OUStringToOString(sUniPassword,
+ WW8Fib::GetFIBCharset(pWwFib->chseTables)));
- xub_StrLen nLen = sPassword.Len();
+ sal_Int32 nLen = sPassword.getLength();
if( nLen <= 15 )
{
sal_uInt8 pPassword[16];
- memset( pPassword, 0, sizeof( pPassword ) );
-
- for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar )
- pPassword[nChar] = sPassword.GetChar(nChar);
+ memcpy(pPassword, sPassword.getStr(), nLen);
+ memset(pPassword+nLen, 0, sizeof(pPassword)-nLen);
rCodec.InitKey( pPassword );
aEncryptionData = rCodec.GetEncryptionData();
- // the export supports RC4 algorithm only, so we have to generate the related EncryptionData as well,
- // so that Save can export the document without asking for a password;
- // as result there will be EncryptionData for both algorithms in the MediaDescriptor
+ // the export supports RC4 algorithm only, so we have to
+ // generate the related EncryptionData as well, so that Save
+ // can export the document without asking for a password;
+ // as result there will be EncryptionData for both algorithms
+ // in the MediaDescriptor
::msfilter::MSCodec_Std97 aCodec97;
// Generate random number with a seed of time as salt.
@@ -4984,7 +5056,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGlos
size_t nUnencryptedHdr =
(8 == pWwFib->nVersion) ? 0x44 : 0x34;
sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr];
- pStrm->Read(pIn, nUnencryptedHdr);
+ nUnencryptedHdr = pStrm->Read(pIn, nUnencryptedHdr);
aDecryptMain.Write(pIn, nUnencryptedHdr);
delete [] pIn;
@@ -5015,17 +5087,20 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGlos
break;
case RC4:
{
- msfilter::MSCodec_Std97 aCtx;
-
sal_uInt8 aDocId[ 16 ];
- pTableStream->Read(aDocId, 16);
sal_uInt8 aSaltData[ 16 ];
- pTableStream->Read(aSaltData, 16);
sal_uInt8 aSaltHash[ 16 ];
- pTableStream->Read(aSaltHash, 16);
+ bool bCouldReadHeaders =
+ checkRead(*pTableStream, aDocId, 16) &&
+ checkRead(*pTableStream, aSaltData, 16) &&
+ checkRead(*pTableStream, aSaltHash, 16);
+
+ msfilter::MSCodec_Std97 aCtx;
// if initialization has failed the EncryptionData should be empty
- uno::Sequence< beans::NamedValue > aEncryptionData = InitStd97Codec( aCtx, aDocId, *pMedium );
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ if (bCouldReadHeaders)
+ aEncryptionData = InitStd97Codec( aCtx, aDocId, *pMedium );
if ( aEncryptionData.getLength() && aCtx.VerifyKey( aSaltData, aSaltHash ) )
{
nErrRet = 0;
@@ -5033,9 +5108,9 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGlos
pTempMain = MakeTemp(aDecryptMain);
pStrm->Seek(0);
- const sal_Size nUnencryptedHdr = 0x44;
+ sal_Size nUnencryptedHdr = 0x44;
sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr];
- pStrm->Read(pIn, nUnencryptedHdr);
+ nUnencryptedHdr = pStrm->Read(pIn, nUnencryptedHdr);
DecryptRC4(aCtx, *pStrm, aDecryptMain);
@@ -5142,16 +5217,16 @@ void SwWW8ImplReader::SetOutLineStyles()
pick the one that affects most styles. If we're not importing a new
document, we got to stick with what is already there.
*/
- // use index in text format collection array <pCollA>
+ // use index in text format collection array <vColl>
// as key of the outline numbering map <aRuleMap>
// instead of the memory pointer of the outline numbering rule
// to assure that, if two outline numbering rule affect the same
// count of text formats, always the same outline numbering rule is chosen.
std::map<sal_uInt16, int>aRuleMap;
typedef std::map<sal_uInt16, int>::iterator myIter;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[ nI ];
+ SwWW8StyInf& rSI = vColl[ nI ];
if (
(MAXLEVEL > rSI.nOutlineLevel) && rSI.pOutlineNumrule &&
rSI.pFmt
@@ -5174,7 +5249,10 @@ void SwWW8ImplReader::SetOutLineStyles()
if (aIter->second > nMax)
{
nMax = aIter->second;
- mpChosenOutlineNumRule = pCollA[ aIter->first ].pOutlineNumrule;
+ if(aIter->first < vColl.size())
+ mpChosenOutlineNumRule = vColl[ aIter->first ].pOutlineNumrule;
+ else
+ mpChosenOutlineNumRule = 0; //TODO make sure this is what we want
}
}
@@ -5199,9 +5277,9 @@ void SwWW8ImplReader::SetOutLineStyles()
sal_uInt16 nOldFlags = nFlagsStyleOutlLevel;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[nI];
+ SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutlineNumbered())
{
@@ -5340,7 +5418,7 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss)
m_bRegardHindiDigits = aVal[ 12 ] > 0;
}
- sal_uInt16 nMagic;
+ sal_uInt16 nMagic(0);
*pStrm >> nMagic;
// beachte: 6 steht fuer "6 ODER 7", 7 steht fuer "NUR 7"
@@ -5634,6 +5712,8 @@ bool SwWW8ImplReader::InEqualApo(int nLvl) const
//the table.
if (nLvl)
--nLvl;
+ if (nLvl < 0 || static_cast<size_t>(nLvl) >= maApos.size())
+ return false;
return maApos[nLvl];
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 9d263d581c71..39b1b7e9848f 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -50,6 +50,15 @@
#include <xmloff/odffields.hxx>
#include <IMark.hxx>
+#include <swtypes.hxx> // enum RndStdIds
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <editeng/lrspitem.hxx>
+#include <oox/ole/olehelper.hxx>
+
+#include <boost/noncopyable.hpp>
+
class SwDoc;
class SwPaM;
class SfxPoolItem;
@@ -64,7 +73,6 @@ class SwNumRule;
class SwFrmFmt;
class Writer;
class SwFmtFld;
-class SwWW8StyInf;
class WW8Fib;
class WW8PLCFMan;
struct WW8PLCFManResult;
@@ -177,6 +185,7 @@ struct WW8OleMap
}
};
+
class SwWW8ImplReader;
struct WW8LSTInfo;
class WW8ListManager
@@ -223,6 +232,127 @@ private:
sal_uInt16 nLastLFOPosition;
};
+struct WW8FlyPara
+{ // WinWord-Attribute
+ // Achtung: *Nicht* umsortieren, da Teile mit
+ // memcmp verglichen werden
+ bool bVer67;
+ sal_Int16 nSp26, nSp27; // rohe Position
+ sal_Int16 nSp45, nSp28; // Breite / Hoehe
+ sal_Int16 nLeMgn, nRiMgn, nUpMgn, nLoMgn; // Raender
+ sal_uInt8 nSp29; // rohe Bindung + Alignment
+ sal_uInt8 nSp37; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
+ WW8_BRC5 brc; // Umrandung Top, Left, Bottom, Right, Between
+ bool bBorderLines; // Umrandungslinien
+ bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
+ // enthaltene Grafik anders als zeichengebunden
+ // zu positionieren
+ bool mbVertSet; // true if vertical positioning has been set
+
+ WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
+ bool operator==(const WW8FlyPara& rSrc) const;
+ void Read(sal_uInt8 nSprm29, WW8PLCFx_Cp_FKP* pPap);
+ void ReadFull(sal_uInt8 nSprm29, SwWW8ImplReader* pIo);
+ void Read(sal_uInt8 nSprm29, WW8RStyle* pStyle);
+ void ApplyTabPos(const WW8_TablePos *pTabPos);
+ bool IsEmpty() const;
+};
+
+class SwWW8StyInf
+{
+ String sWWStyleName;
+ sal_uInt16 nWWStyleId;
+public:
+ rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ rtl_TextEncoding eCJKFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ SwFmt* pFmt;
+ WW8FlyPara* pWWFly;
+ SwNumRule* pOutlineNumrule;
+ long nFilePos;
+ sal_uInt16 nBase;
+ sal_uInt16 nFollow;
+ sal_uInt16 nLFOIndex;
+ sal_uInt8 nListLevel;
+ sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
+ sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
+ sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
+ SvxLRSpaceItem maWordLR;
+ bool bValid; // leer oder Valid
+ bool bImported; // fuers rekursive Importieren
+ bool bColl; // true-> pFmt ist SwTxtFmtColl
+ bool bImportSkipped; // nur true bei !bNewDoc && vorh. Style
+ bool bHasStyNumRule; // true-> Benannter NumRule in Style
+ bool bHasBrokenWW6List; // true-> WW8+ style has a WW7- list
+ bool bListReleventIndentSet; //true if this style's indent has
+ //been explicitly set, it's set to the value
+ //of pFmt->GetItemState(RES_LR_SPACE, false)
+ //if it was possible to get the ItemState
+ //for L of the LR space independantly
+ bool bParaAutoBefore; // For Auto spacing before a paragraph
+ bool bParaAutoAfter; // For Auto Spacing after a paragraph
+
+ SwWW8StyInf() :
+ sWWStyleName( aEmptyStr ),
+ nWWStyleId( 0 ),
+ eLTRFontSrcCharSet(0),
+ eRTLFontSrcCharSet(0),
+ eCJKFontSrcCharSet(0),
+ pFmt( 0 ),
+ pWWFly( 0 ),
+ pOutlineNumrule( 0 ),
+ nFilePos( 0 ),
+ nBase( 0 ),
+ nFollow( 0 ),
+ nLFOIndex( USHRT_MAX ),
+ nListLevel(WW8ListManager::nMaxLevel),
+ nOutlineLevel( MAXLEVEL ),
+ n81Flags( 0 ),
+ n81BiDiFlags(0),
+ maWordLR( RES_LR_SPACE ),
+ bValid(false),
+ bImported(false),
+ bColl(false),
+ bImportSkipped(false),
+ bHasStyNumRule(false),
+ bHasBrokenWW6List(false),
+ bListReleventIndentSet(false),
+ bParaAutoBefore(false),
+ bParaAutoAfter(false)
+
+ {}
+
+ ~SwWW8StyInf()
+ {
+ delete pWWFly;
+ }
+
+ void SetOrgWWIdent( const String& rName, const sal_uInt16 nId )
+ {
+ sWWStyleName = rName;
+ nWWStyleId = nId;
+ }
+ sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
+ const String& GetOrgWWName() const
+ {
+ return sWWStyleName;
+ }
+ bool IsOutline() const
+ {
+ return (pFmt && (MAXLEVEL > nOutlineLevel));
+ }
+ bool IsOutlineNumbered() const
+ {
+ return pOutlineNumrule && IsOutline();
+ }
+ const SwNumRule* GetOutlineNumrule() const
+ {
+ return pOutlineNumrule;
+ }
+ CharSet GetCharSet() const;
+ CharSet GetCJKCharSet() const;
+};
+
//-----------------------------------------
// Stack
//-----------------------------------------
@@ -239,7 +369,7 @@ private:
const SwTxtNode &rTxtNode);
protected:
virtual void SetAttrInDoc(const SwPosition& rTmpPos,
- SwFltStackEntry* pEntry);
+ SwFltStackEntry& rEntry);
public:
SwWW8FltControlStack(SwDoc* pDo, sal_uLong nFieldFl, SwWW8ImplReader& rReader_ )
@@ -249,7 +379,7 @@ public:
void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr);
- virtual void SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand=LONG_MAX, sal_Bool consumedByField=sal_False);
+ virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand=LONG_MAX, sal_Bool consumedByField=sal_False);
void SetToggleAttr(sal_uInt8 nId, bool bOn)
{
@@ -329,9 +459,9 @@ public:
//an additional pseudo bookmark
std::map<String, String, ltstr> aFieldVarNames;
protected:
- SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry *pEntry);
+ SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry& rEntry);
virtual void SetAttrInDoc(const SwPosition& rTmpPos,
- SwFltStackEntry* pEntry);
+ SwFltStackEntry& rEntry);
private:
//No copying
SwWW8FltRefStack(const SwWW8FltRefStack&);
@@ -543,8 +673,7 @@ public:
class SwMSConvertControls: public SvxMSConvertOCXControls
{
public:
- SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) :
- SvxMSConvertOCXControls( pDSh,pP ) {}
+ SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP );
virtual sal_Bool InsertFormula( WW8FormulaControl &rFormula);
virtual sal_Bool InsertControl(const com::sun::star::uno::Reference<
com::sun::star::form::XFormComponent >& rFComp,
@@ -552,6 +681,12 @@ public:
com::sun::star::uno::Reference <
com::sun::star::drawing::XShape > *pShape,sal_Bool bFloatingCtrl);
bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
+ virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape > *pShapeRef=0,
+ sal_Bool bFloatingCtrl=false );
+private:
+ ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper;
};
class SwMSDffManager : public SvxMSDffManager
@@ -706,6 +841,33 @@ public:
sal_uInt32 GetTextAreaWidth() const;
};
+//Various writer elements like frames start off containing a blank paragraph,
+//sometimes this paragraph turns out to be extraneous, e.g. the frame should
+//only contain a table with no trailing paragraph.
+//
+//We want to remove these extra paragraphs, but removing them during the parse
+//is problematic, because we don't want to remove any paragraphs that are still
+//addressed by property entries in a SwFltControlStack which have not yet been
+//committed to the document.
+//
+//Safest thing is to not delete SwTxtNodes from a document during import, and
+//remove these extraneous paragraphs at the end after all SwFltControlStack are
+//destroyed.
+class wwExtraneousParas : private ::boost::noncopyable
+{
+private:
+ /*
+ A vector of SwTxtNodes to erase from a document after import is complete
+ */
+ std::vector<SwTxtNode*> m_aTxtNodes;
+ SwDoc& m_rDoc;
+public:
+ wwExtraneousParas(SwDoc &rDoc) : m_rDoc(rDoc) {}
+ ~wwExtraneousParas() { delete_all_from_doc(); }
+ void push_back(SwTxtNode *pTxtNode) { m_aTxtNodes.push_back(pTxtNode); }
+ void delete_all_from_doc();
+};
+
class wwFrameNamer
{
private:
@@ -751,14 +913,15 @@ struct ApoTestResults
{
bool mbStartApo;
bool mbStopApo;
- const sal_uInt8* mpSprm37;
- const sal_uInt8* mpSprm29;
+ bool m_bHasSprm37;
+ bool m_bHasSprm29;
+ sal_uInt8 m_nSprm29;
WW8FlyPara* mpStyleApo;
- ApoTestResults() :
- mbStartApo(false), mbStopApo(false), mpSprm37(0), mpSprm29(0),
- mpStyleApo(0) {}
+ ApoTestResults()
+ : mbStartApo(false), mbStopApo(false), m_bHasSprm37(false)
+ , m_bHasSprm29(false), m_nSprm29(0), mpStyleApo(0) {}
bool HasStartStop() const { return (mbStartApo || mbStopApo); }
- bool HasFrame() const { return (mpSprm29 || mpSprm37 || mpStyleApo); }
+ bool HasFrame() const { return (m_bHasSprm29 || m_bHasSprm37 || mpStyleApo); }
};
struct ANLDRuleMap
@@ -873,6 +1036,13 @@ private:
wwSectionManager maSectionManager;
/*
+ A vector of surplus-to-requirements paragraph in the final document,
+ that exist because of quirks of the SwDoc document model and/or API,
+ which need to be removed.
+ */
+ wwExtraneousParas m_aExtraneousParas;
+
+ /*
A map of of tables to their follow nodes for use in inserting tables into
already existing document, i.e. insert file
*/
@@ -947,7 +1117,7 @@ private:
// ( ist ausserhalb einer Style-Def immer 0 )
SfxItemSet* pAktItemSet;// gerade einzulesende Zeichenattribute
// (ausserhalb des WW8ListManager Ctor's immer 0)
- SwWW8StyInf* pCollA; // UEbersetzungs-Array der Styles
+ std::vector<SwWW8StyInf> vColl;
const SwTxtFmtColl* pDfltTxtFmtColl; // Default
SwFmt* pStandardFmtColl;// "Standard"
@@ -999,7 +1169,6 @@ private:
rtl_TextEncoding eStructCharSet; // rtl_TextEncoding for structures
rtl_TextEncoding eHardCharSet; // Hard rtl_TextEncoding-Attribute
sal_uInt16 nProgress; // %-Angabe fuer Progressbar
- sal_uInt16 nColls; // Groesse des Arrays
sal_uInt16 nAktColl; // gemaess WW-Zaehlung
sal_uInt16 nFldNum; // laufende Nummer dafuer
sal_uInt16 nLFOPosition;
@@ -1088,7 +1257,7 @@ private:
const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const;
- bool StyleExists(int nColl) const { return (nColl < nColls); }
+ bool StyleExists(unsigned int nColl) const { return (nColl < vColl.size()); }
SwWW8StyInf *GetStyle(sal_uInt16 nColl) const;
void AppendTxtNode(SwPosition& rPos);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index b5825c431e75..d504f2440cb5 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -526,8 +526,8 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
ApoTestResults aRet;
// Frame in Style Definition (word appears to ignore them if inside an
// text autoshape)
- if (!bTxbxFlySection)
- aRet.mpStyleApo = StyleExists(nAktColl) ? pCollA[nAktColl].pWWFly : 0;
+ if (!bTxbxFlySection && nAktColl < vColl.size())
+ aRet.mpStyleApo = StyleExists(nAktColl) ? vColl[nAktColl].pWWFly : 0;
/*
#i1140#
@@ -549,8 +549,10 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
to see if we are still in that frame.
*/
- aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
- aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+ aRet.m_bHasSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
+ const sal_uInt8 *pSrpm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+ aRet.m_bHasSprm29 = pSrpm29 != NULL;
+ aRet.m_nSprm29 = pSrpm29 ? *pSrpm29 : 0;
// Is there some frame data here
bool bNowApo = aRet.HasFrame() || pTopLevelTable;
@@ -3514,45 +3516,6 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
return bSuccess;
}
-bool lcl_PamContainsFly(SwPaM & rPam)
-{
- bool bResult = false;
- SwNodeRange aRg( rPam.Start()->nNode, rPam.End()->nNode );
- SwDoc * pDoc = rPam.GetDoc();
-
- sal_uInt16 n = 0;
- SwSpzFrmFmts * pSpzFmts = pDoc->GetSpzFrmFmts();
- sal_uInt16 nCount = pSpzFmts->Count();
- while (!bResult && n < nCount)
- {
- SwFrmFmt* pFly = (*pSpzFmts)[n];
- const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
-
- switch (pAnchor->GetAnchorId())
- {
- case FLY_AT_PARA:
- case FLY_AT_CHAR:
- {
- const SwPosition* pAPos = pAnchor->GetCntntAnchor();
-
- if (pAPos != NULL &&
- aRg.aStart <= pAPos->nNode &&
- pAPos->nNode <= aRg.aEnd)
- {
- bResult = true;
- }
- }
- break;
- default:
- break;
- }
-
- ++n;
- }
-
- return bResult;
-}
-
void SwWW8ImplReader::TabCellEnd()
{
if (nInTable && pTableDesc)
@@ -3652,11 +3615,11 @@ bool SwWW8ImplReader::IsInvalidOrToBeMergedTabCell() const
sal_uInt16 SwWW8ImplReader::StyleUsingLFO( sal_uInt16 nLFOIndex ) const
{
sal_uInt16 nRes = USHRT_MAX;
- if( pCollA )
+ if( !vColl.empty() )
{
for(sal_uInt16 nI = 0; nI < pStyles->GetCount(); nI++ )
- if( pCollA[ nI ].bValid
- && (nLFOIndex == pCollA[ nI ].nLFOIndex) )
+ if( vColl[ nI ].bValid
+ && (nLFOIndex == vColl[ nI ].nLFOIndex) )
nRes = nI;
}
return nRes;
@@ -3665,13 +3628,13 @@ sal_uInt16 SwWW8ImplReader::StyleUsingLFO( sal_uInt16 nLFOIndex ) const
const SwFmt* SwWW8ImplReader::GetStyleWithOrgWWName( String& rName ) const
{
SwFmt* pRet = 0;
- if( pCollA )
+ if( !vColl.empty() )
{
for(sal_uInt16 nI = 0; nI < pStyles->GetCount(); nI++ )
- if( pCollA[ nI ].bValid
- && (rName.Equals( pCollA[ nI ].GetOrgWWName())) )
+ if( vColl[ nI ].bValid
+ && (rName.Equals( vColl[ nI ].GetOrgWWName())) )
{
- pRet = pCollA[ nI ].pFmt;
+ pRet = vColl[ nI ].pFmt;
break;
}
}
@@ -3687,21 +3650,7 @@ const sal_uInt8* WW8RStyle::HasParaSprm( sal_uInt16 nId ) const
if( !pParaSprms || !nSprmsLen )
return 0;
- const sal_uInt8* pSprms = pParaSprms;
- sal_uInt16 i, x;
-
- for( i=0; i < nSprmsLen; )
- {
- sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
- // Sprm found ?
- if( nAktId == nId )
- return pSprms + maSprmParser.DistanceToData(nId);
-
- x = maSprmParser.GetSprmSize(nAktId, pSprms);
- i = i + x;
- pSprms += x;
- }
- return 0; // Sprm not found
+ return maSprmParser.findSprmData(nId, pParaSprms, nSprmsLen);
}
void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap)
@@ -3715,11 +3664,11 @@ void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap)
nSprmsLen = nLen;
}
- while ( nLen > 0 )
+ WW8SprmIter aSprmIter(pSprms, nLen, maSprmParser);
+ while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
{
- sal_uInt16 nL1 = pIo->ImportSprm(pSprms);
- nLen = nLen - nL1;
- pSprms += nL1;
+ pIo->ImportSprm(pSprm);
+ aSprmIter.advance();
}
pParaSprms = 0;
@@ -3731,14 +3680,13 @@ void WW8RStyle::ImportSprms(sal_Size nPosFc, short nLen, bool bPap)
if (!nLen)
return;
- sal_uInt8 *pSprms = new sal_uInt8[nLen];
-
- pStStrm->Seek(nPosFc);
- pStStrm->Read(pSprms, nLen);
-
- ImportSprms(pSprms, nLen, bPap);
-
- delete[] pSprms;
+ if (checkSeek(*pStStrm, nPosFc))
+ {
+ sal_uInt8 *pSprms = new sal_uInt8[nLen];
+ nLen = pStStrm->Read(pSprms, nLen);
+ ImportSprms(pSprms, nLen, bPap);
+ delete[] pSprms;
+ }
}
static inline short WW8SkipOdd(SvStream* pSt )
@@ -3746,8 +3694,7 @@ static inline short WW8SkipOdd(SvStream* pSt )
if ( pSt->Tell() & 0x1 )
{
sal_uInt8 c;
- pSt->Read( &c, 1 );
- return 1;
+ return pSt->Read( &c, 1 );
}
return 0;
}
@@ -3757,16 +3704,13 @@ static inline short WW8SkipEven(SvStream* pSt )
if (!(pSt->Tell() & 0x1))
{
sal_uInt8 c;
- pSt->Read( &c, 1 );
- return 1;
+ return pSt->Read( &c, 1 );
}
return 0;
}
short WW8RStyle::ImportUPX(short nLen, bool bPAP, bool bOdd)
{
- sal_Int16 cbUPX;
-
if( 0 < nLen ) // Empty ?
{
if (bOdd)
@@ -3774,6 +3718,7 @@ short WW8RStyle::ImportUPX(short nLen, bool bPAP, bool bOdd)
else
nLen = nLen - WW8SkipOdd( pStStrm );
+ sal_Int16 cbUPX(0);
*pStStrm >> cbUPX;
nLen-=2;
@@ -3826,8 +3771,7 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI)
: WW8Style(*pI->pTableStream, _rFib), maSprmParser(_rFib.GetFIBVersion()),
pIo(pI), pStStrm(pI->pTableStream), pStyRule(0), nWwNumLevel(0)
{
- pIo->nColls = cstd;
- pIo->pCollA = cstd ? new SwWW8StyInf[ cstd ] : NULL; // Style-UEbersetzung WW->SW
+ pIo->vColl.resize(cstd);
}
void WW8RStyle::Set1StyleDefaults()
@@ -3919,7 +3863,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
sal_uInt16 j = rSI.nBase;
if (j != nThisStyle && j < cstd )
{
- SwWW8StyInf* pj = &pIo->pCollA[j];
+ SwWW8StyInf* pj = &pIo->vColl[j];
if (rSI.pFmt && pj->pFmt && rSI.bColl == pj->bColl)
{
rSI.pFmt->SetDerivedFrom( pj->pFmt ); // ok, Based on eintragen
@@ -3959,7 +3903,7 @@ void WW8RStyle::PostStyle(SwWW8StyInf &rSI, bool bOldNoImp)
pIo->nCharFmt = -1;
// If Style basiert auf Nichts oder Basis ignoriert
- if ((rSI.nBase >= cstd || pIo->pCollA[rSI.nBase].bImportSkipped) && rSI.bColl)
+ if ((rSI.nBase >= cstd || pIo->vColl[rSI.nBase].bImportSkipped) && rSI.bColl)
{
//! Char-Styles funktionieren aus
// unerfindlichen Gruenden nicht
@@ -3980,7 +3924,10 @@ void WW8RStyle::PostStyle(SwWW8StyInf &rSI, bool bOldNoImp)
void WW8RStyle::Import1Style( sal_uInt16 nNr )
{
- SwWW8StyInf &rSI = pIo->pCollA[nNr];
+ if (nNr >= pIo->vColl.size())
+ return;
+
+ SwWW8StyInf &rSI = pIo->vColl[nNr];
if( rSI.bImported || !rSI.bValid )
return;
@@ -3990,7 +3937,7 @@ void WW8RStyle::Import1Style( sal_uInt16 nNr )
//
// gueltig und nicht NIL und noch nicht Importiert
- if( rSI.nBase < cstd && !pIo->pCollA[rSI.nBase].bImported )
+ if( rSI.nBase < cstd && !pIo->vColl[rSI.nBase].bImported )
Import1Style( rSI.nBase );
pStStrm->Seek( rSI.nFilePos );
@@ -4033,13 +3980,16 @@ void WW8RStyle::Import1Style( sal_uInt16 nNr )
void WW8RStyle::RecursiveReg(sal_uInt16 nNr)
{
- SwWW8StyInf &rSI = pIo->pCollA[nNr];
+ if (nNr >= pIo->vColl.size())
+ return;
+
+ SwWW8StyInf &rSI = pIo->vColl[nNr];
if( rSI.bImported || !rSI.bValid )
return;
rSI.bImported = true;
- if( rSI.nBase < cstd && !pIo->pCollA[rSI.nBase].bImported )
+ if( rSI.nBase < cstd && !pIo->vColl[rSI.nBase].bImported )
RecursiveReg(rSI.nBase);
pIo->RegisterNumFmtOnStyle(nNr);
@@ -4059,7 +4009,7 @@ void WW8RStyle::PostProcessStyles()
formats and use it to mark handled ones
*/
for (i=0; i < cstd; ++i)
- pIo->pCollA[i].bImported = false;
+ pIo->vColl[i].bImported = false;
/*
Register the num formats and tabstop changes on the styles recursively.
@@ -4074,7 +4024,7 @@ void WW8RStyle::PostProcessStyles()
*/
for (i=0; i < cstd; ++i)
{
- if (pIo->pCollA[i].bValid)
+ if (pIo->vColl[i].bValid)
{
RecursiveReg(i);
}
@@ -4086,7 +4036,7 @@ void WW8RStyle::ScanStyles() // untersucht Style-Abhaengigkeiten
for (sal_uInt16 i = 0; i < cstd; ++i)
{
short nSkip;
- SwWW8StyInf &rSI = pIo->pCollA[i];
+ SwWW8StyInf &rSI = pIo->vColl[i];
rSI.nFilePos = pStStrm->Tell(); // merke FilePos
WW8_STD* pStd = Read1Style( nSkip, 0, 0 ); // read STD
@@ -4343,9 +4293,9 @@ void WW8RStyle::ImportOldFormatStyles()
{
for (sal_uInt16 i=0; i < cstd; ++i)
{
- pIo->pCollA[i].bColl = true;
+ pIo->vColl[i].bColl = true;
//every chain must end eventually at the null style (style code 222)
- pIo->pCollA[i].nBase = 222;
+ pIo->vColl[i].nBase = 222;
}
rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(
@@ -4365,7 +4315,10 @@ void WW8RStyle::ImportOldFormatStyles()
nByteCount++;
sal_uInt8 stc = static_cast< sal_uInt8 >((stcp - cstcStd) & 255);
- SwWW8StyInf &rSI = pIo->pCollA[stc];
+ if (stc >=pIo->vColl.size())
+ continue;
+
+ SwWW8StyInf &rSI = pIo->vColl[stc];
if (nCount != 0xFF) // undefined style
{
String sName;
@@ -4495,7 +4448,7 @@ void WW8RStyle::ImportOldFormatStyles()
if (stc == stcBase)
stcBase = 222;
- SwWW8StyInf &rSI = pIo->pCollA[stc];
+ SwWW8StyInf &rSI = pIo->vColl[stc];
rSI.nBase = stcBase;
ww::sti eSti = ww::GetCanonicalStiFromStc(stc);
@@ -4506,7 +4459,7 @@ void WW8RStyle::ImportOldFormatStyles()
rSI.bValid = true;
if (ww::StandardStiIsCharStyle(eSti) && !aPAPXOffsets[stcp].mnSize)
- pIo->pCollA[stc].bColl = false;
+ pIo->vColl[stc].bColl = false;
bool bOldNoImp = PrepareStyle(rSI, eSti, stc, stcNext);
@@ -4527,7 +4480,7 @@ void WW8RStyle::ImportNewFormatStyles()
ScanStyles(); // Scanne Based On
for (sal_uInt16 i = 0; i < cstd; ++i) // import Styles
- if (pIo->pCollA[i].bValid)
+ if (pIo->vColl[i].bValid)
Import1Style( i );
}
@@ -4553,11 +4506,11 @@ void WW8RStyle::Import()
for (sal_uInt16 i = 0; i < cstd; ++i)
{
// Follow chain
- SwWW8StyInf* pi = &pIo->pCollA[i];
+ SwWW8StyInf* pi = &pIo->vColl[i];
sal_uInt16 j = pi->nFollow;
if( j < cstd )
{
- SwWW8StyInf* pj = &pIo->pCollA[j];
+ SwWW8StyInf* pj = &pIo->vColl[j];
if ( j != i // sinnvoller Index ?
&& pi->pFmt // Format ok ?
&& pj->pFmt // Derived-Format ok ?
@@ -4577,8 +4530,9 @@ void WW8RStyle::Import()
//
// fuer z.B. Tabellen wird ein immer gueltiger Std-Style gebraucht
- if( pIo->StyleExists(0) && pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
- pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->pCollA[0].pFmt;
+ if( pIo->StyleExists(0) && !pIo->vColl.empty() &&
+ pIo->vColl[0].pFmt && pIo->vColl[0].bColl && pIo->vColl[0].bValid )
+ pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->vColl[0].pFmt;
else
pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl();
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index 5e3e2a8cff10..1a837643446a 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -53,32 +53,6 @@ private:
SfxItemSet aChrSet,aParSet;
};
-struct WW8FlyPara
-{ // WinWord-Attribute
- // Achtung: *Nicht* umsortieren, da Teile mit
- // memcmp verglichen werden
- bool bVer67;
- sal_Int16 nSp26, nSp27; // rohe Position
- sal_Int16 nSp45, nSp28; // Breite / Hoehe
- sal_Int16 nLeMgn, nRiMgn, nUpMgn, nLoMgn; // Raender
- sal_uInt8 nSp29; // rohe Bindung + Alignment
- sal_uInt8 nSp37; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
- WW8_BRC5 brc; // Umrandung Top, Left, Bottom, Right, Between
- bool bBorderLines; // Umrandungslinien
- bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
- // enthaltene Grafik anders als zeichengebunden
- // zu positionieren
- bool mbVertSet; // true if vertical positioning has been set
- sal_uInt8 nOrigSp29;
-
- WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
- bool operator==(const WW8FlyPara& rSrc) const;
- void Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap);
- void ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo);
- void Read(const sal_uInt8* pSprm29, WW8RStyle* pStyle);
- void ApplyTabPos(const WW8_TablePos *pTabPos);
- bool IsEmpty() const;
-};
struct WW8SwFlyPara
{
@@ -122,101 +96,6 @@ struct WW8SwFlyPara
SwWW8FltAnchorStack *pOldAnchorStck;
};
-class SwWW8StyInf
-{
- String sWWStyleName;
- sal_uInt16 nWWStyleId;
-public:
- rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
- rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
- rtl_TextEncoding eCJKFontSrcCharSet; // rtl_TextEncoding fuer den Font
- SwFmt* pFmt;
- WW8FlyPara* pWWFly;
- SwNumRule* pOutlineNumrule;
- long nFilePos;
- sal_uInt16 nBase;
- sal_uInt16 nFollow;
- sal_uInt16 nLFOIndex;
- sal_uInt8 nListLevel;
- sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
- sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
- sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
- SvxLRSpaceItem maWordLR;
- bool bValid; // leer oder Valid
- bool bImported; // fuers rekursive Importieren
- bool bColl; // true-> pFmt ist SwTxtFmtColl
- bool bImportSkipped; // nur true bei !bNewDoc && vorh. Style
- bool bHasStyNumRule; // true-> Benannter NumRule in Style
- bool bHasBrokenWW6List; // true-> WW8+ style has a WW7- list
- bool bListReleventIndentSet; //true if this style's indent has
- //been explicitly set, it's set to the value
- //of pFmt->GetItemState(RES_LR_SPACE, false)
- //if it was possible to get the ItemState
- //for L of the LR space independantly
- bool bParaAutoBefore; // For Auto spacing before a paragraph
- bool bParaAutoAfter; // For Auto Spacing after a paragraph
-
- SwWW8StyInf() :
- sWWStyleName( aEmptyStr ),
- nWWStyleId( 0 ),
- eLTRFontSrcCharSet(0),
- eRTLFontSrcCharSet(0),
- eCJKFontSrcCharSet(0),
- pFmt( 0 ),
- pWWFly( 0 ),
- pOutlineNumrule( 0 ),
- nFilePos( 0 ),
- nBase( 0 ),
- nFollow( 0 ),
- nLFOIndex( USHRT_MAX ),
- nListLevel(WW8ListManager::nMaxLevel),
- nOutlineLevel( MAXLEVEL ),
- n81Flags( 0 ),
- n81BiDiFlags(0),
- maWordLR( RES_LR_SPACE ),
- bValid(false),
- bImported(false),
- bColl(false),
- bImportSkipped(false),
- bHasStyNumRule(false),
- bHasBrokenWW6List(false),
- bListReleventIndentSet(false),
- bParaAutoBefore(false),
- bParaAutoAfter(false)
-
- {}
-
- ~SwWW8StyInf()
- {
- delete pWWFly;
- }
-
- void SetOrgWWIdent( const String& rName, const sal_uInt16 nId )
- {
- sWWStyleName = rName;
- nWWStyleId = nId;
- }
- sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
- const String& GetOrgWWName() const
- {
- return sWWStyleName;
- }
- bool IsOutline() const
- {
- return (pFmt && (MAXLEVEL > nOutlineLevel));
- }
- bool IsOutlineNumbered() const
- {
- return pOutlineNumrule && IsOutline();
- }
- const SwNumRule* GetOutlineNumrule() const
- {
- return pOutlineNumrule;
- }
- CharSet GetCharSet() const;
- CharSet GetCJKCharSet() const;
-};
-
class WW8RStyle: public WW8Style
{
friend class SwWW8ImplReader;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 90dbc4bf3434..23afb6530d53 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -351,6 +351,8 @@ struct WW8LST // nur DIE Eintraege, die WIR benoetigen!
// true if the list should start numbering over
}; // at the beginning of each section
+const sal_uInt32 cbLSTF=28;
+
struct WW8LFO // nur DIE Eintraege, die WIR benoetigen!
{
SwNumRule* pNumRule; // Parent NumRule
@@ -470,20 +472,7 @@ SV_IMPL_PTRARR( WW8LFOInfos, WW8LFOInfo_Ptr );
sal_uInt8* WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms,
sal_uInt8 nLen)
{
- sal_uInt8* pSprms = &rSprms;
- sal_uInt16 nRemLen=nLen;
- while (nRemLen > (maSprmParser.getVersion()?1:0))
- {
- sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
- if( nAktId == nId ) // Sprm found
- return pSprms + maSprmParser.DistanceToData(nId);
-
- // gib Zeiger auf Daten
- sal_uInt16 nSize = maSprmParser.GetSprmSize(nAktId, pSprms);
- pSprms += nSize;
- nRemLen -= nSize;
- }
- return 0; // Sprm not found
+ return maSprmParser.findSprmData(nId, &rSprms, nLen);
}
class ListWithId : public std::unary_function<const WW8LSTInfo *, bool>
@@ -695,14 +684,15 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
// spezielle ItemSet relevant ist - und nicht ein Stack oder Style!
sal_uInt16 nOldFlags1 = rReader.GetToggleAttrFlags();
sal_uInt16 nOldFlags2 = rReader.GetToggleBiDiAttrFlags();
- short nLen = aLVL.nLenGrpprlChpx;
- sal_uInt8* pSprms1 = &aGrpprlChpx[0];
- while (0 < nLen)
+
+ WW8SprmIter aSprmIter(&aGrpprlChpx[0], aLVL.nLenGrpprlChpx,
+ maSprmParser);
+ while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
{
- sal_uInt16 nL1 = rReader.ImportSprm( pSprms1 );
- nLen = nLen - nL1;
- pSprms1 += nL1;
+ rReader.ImportSprm(pSprm);
+ aSprmIter.advance();
}
+
// Reader-ItemSet-Pointer und Reader-Style zuruecksetzen
rReader.SetAktItemSet( 0 );
rReader.SetNAktColl( nOldColl );
@@ -774,7 +764,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
for(nLevelB = 0; nLevelB <= nLevel; ++nLevelB)
{
sal_uInt8 nPos = aOfsNumsXCH[nLevelB];
- if (nPos && sNumString.GetChar(nPos-1) < nMaxLevel)
+ if (nPos && nPos < sNumString.Len() && sNumString.GetChar(nPos-1) < nMaxLevel)
{
if (rNotReallyThere[nLevelB])
aOfsNumsXCH[nLevelB] = 0;
@@ -1072,194 +1062,195 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
// LST und LFO gibts erst ab WW8
if( ( 8 > rFib.nVersion )
|| ( rFib.fcPlcfLst == rFib.fcPlfLfo )
- || ( !rFib.lcbPlcfLst )
- || ( !rFib.lcbPlfLfo ) ) return; // offensichtlich keine Listen da
+ || ( rFib.lcbPlcfLst < 2 )
+ || ( rFib.lcbPlfLfo < 2) ) return; // offensichtlich keine Listen da
// Arrays anlegen
pLFOInfos = new WW8LFOInfos;
bool bLVLOk = true;
- sal_uInt8 aBits1;
nLastLFOPosition = USHRT_MAX;
long nOriginalPos = rSt.Tell();
//
// 1. PLCF LST auslesen und die Listen Vorlagen im Writer anlegen
//
- rSt.Seek( rFib.fcPlcfLst );
- sal_uInt16 nListCount;
+ bool bOk = checkSeek(rSt, rFib.fcPlcfLst);
+
+ if (!bOk)
+ return;
+
+ sal_uInt32 nRemainingPlcfLst = rFib.lcbPlcfLst;
+
+ sal_uInt16 nListCount(0);
rSt >> nListCount;
- bool bOk = 0 < nListCount;
- if( bOk )
+ nRemainingPlcfLst -= 2;
+ bOk = nListCount > 0;
+
+ if (!bOk)
+ return;
+
+ //
+ // 1.1 alle LST einlesen
+ //
+ for (sal_uInt16 nList=0; nList < nListCount; ++nList)
{
+ if (nRemainingPlcfLst < cbLSTF)
+ break;
+
WW8LST aLST;
+ memset(&aLST, 0, sizeof( aLST ));
+
//
- // 1.1 alle LST einlesen
+ // 1.1.1 Daten einlesen
//
- for (sal_uInt16 nList=0; nList < nListCount; ++nList)
- {
- bOk = false;
- memset(&aLST, 0, sizeof( aLST ));
- sal_uInt16 nLevel;
- //
- // 1.1.1 Daten einlesen
- //
- rSt >> aLST.nIdLst;
- rSt >> aLST.nTplC;
- for (nLevel = 0; nLevel < nMaxLevel; ++nLevel)
- rSt >> aLST.aIdSty[ nLevel ];
-
+ rSt >> aLST.nIdLst;
+ rSt >> aLST.nTplC;
+ for (sal_uInt16 nLevel = 0; nLevel < nMaxLevel; ++nLevel)
+ rSt >> aLST.aIdSty[ nLevel ];
- rSt >> aBits1;
+ sal_uInt8 aBits1(0);
+ rSt >> aBits1;
- rSt.SeekRel( 1 );
+ rSt.SeekRel( 1 );
- if (rSt.GetError())
- break;
+ if( aBits1 & 0x01 )
+ aLST.bSimpleList = true;
+ if( aBits1 & 0x02 )
+ aLST.bRestartHdn = true;
- if( aBits1 & 0x01 )
- aLST.bSimpleList = true;
- if( aBits1 & 0x02 )
- aLST.bRestartHdn = true;
+ // 1.1.2 new NumRule inserted in Doc and WW8LSTInfo marked
- // 1.1.2 new NumRule inserted in Doc and WW8LSTInfo marked
+ /*
+ #i1869#
+ In word 2000 microsoft got rid of creating new "simple lists" with
+ only 1 level, all new lists are created with 9 levels. To hack it
+ so that the list types formerly known as simple lists still have
+ their own tab page to themselves one of the reserved bits is used
+ to show that a given list is to be in the simple list tabpage.
+ This has now nothing to do with the actual number of list level a
+ list has, only how many will be shown in the user interface.
+
+ i.e. create a simple list in 2000 and open it in 97 and 97 will
+ claim (correctly) that it is an outline list. We can set our
+ continous flag in these lists to store this information.
+ */
+ SwNumRule* pMyNumRule = CreateNextRule(
+ aLST.bSimpleList || (aBits1 & 0x10));
- /*
- #i1869#
- In word 2000 microsoft got rid of creating new "simple lists" with
- only 1 level, all new lists are created with 9 levels. To hack it
- so that the list types formerly known as simple lists still have
- their own tab page to themselves one of the reserved bits is used
- to show that a given list is to be in the simple list tabpage.
- This has now nothing to do with the actual number of list level a
- list has, only how many will be shown in the user interface.
-
- i.e. create a simple list in 2000 and open it in 97 and 97 will
- claim (correctly) that it is an outline list. We can set our
- continous flag in these lists to store this information.
- */
- SwNumRule* pMyNumRule = CreateNextRule(
- aLST.bSimpleList || (aBits1 & 0x10));
+ WW8LSTInfo* pLSTInfo = new WW8LSTInfo(pMyNumRule, aLST);
+ maLSTInfos.push_back(pLSTInfo);
- WW8LSTInfo* pLSTInfo = new WW8LSTInfo(pMyNumRule, aLST);
- maLSTInfos.push_back(pLSTInfo);
- bOk = true;
- }
+ nRemainingPlcfLst -= cbLSTF;
}
- if( bOk )
+ //
+ // 1.2 alle LVL aller aLST einlesen
+ //
+ sal_uInt16 nLSTInfos = static_cast< sal_uInt16 >(maLSTInfos.size());
+ for (sal_uInt16 nList = 0; nList < nLSTInfos; ++nList)
{
+ WW8LSTInfo* pListInfo = maLSTInfos[nList];
+ if( !pListInfo || !pListInfo->pNumRule ) break;
+ SwNumRule& rMyNumRule = *pListInfo->pNumRule;
//
- // 1.2 alle LVL aller aLST einlesen
+ // 1.2.1 betreffende(n) LVL(s) fuer diese aLST einlesen
//
- sal_uInt8 nLevel;
- sal_uInt16 nLSTInfos = static_cast< sal_uInt16 >(maLSTInfos.size());
- for (sal_uInt16 nList = 0; nList < nLSTInfos; ++nList)
+ sal_uInt16 nLvlCount = static_cast< sal_uInt16 >(pListInfo->bSimpleList ? nMinLevel : nMaxLevel);
+ std::deque<bool> aNotReallyThere;
+ aNotReallyThere.resize(nMaxLevel);
+ pListInfo->maParaSprms.resize(nMaxLevel);
+ for (sal_uInt8 nLevel = 0; nLevel < nLvlCount; ++nLevel)
{
- bOk = false;
- WW8LSTInfo* pListInfo = maLSTInfos[nList];
- if( !pListInfo || !pListInfo->pNumRule ) break;
- SwNumRule& rMyNumRule = *pListInfo->pNumRule;
- //
- // 1.2.1 betreffende(n) LVL(s) fuer diese aLST einlesen
- //
- sal_uInt16 nLvlCount = static_cast< sal_uInt16 >(pListInfo->bSimpleList ? nMinLevel : nMaxLevel);
- std::deque<bool> aNotReallyThere;
- aNotReallyThere.resize(nMaxLevel);
- pListInfo->maParaSprms.resize(nMaxLevel);
- for (nLevel = 0; nLevel < nLvlCount; ++nLevel)
- {
- SwNumFmt aNumFmt( rMyNumRule.Get( nLevel ) );
- // LVLF einlesen
- bLVLOk = ReadLVL( aNumFmt, pListInfo->aItemSet[nLevel],
- pListInfo->aIdSty[nLevel], true, aNotReallyThere, nLevel,
- pListInfo->maParaSprms[nLevel]);
- if( !bLVLOk )
- break;
- // und in die rMyNumRule aufnehmen
- rMyNumRule.Set( nLevel, aNumFmt );
- }
+ SwNumFmt aNumFmt( rMyNumRule.Get( nLevel ) );
+ // LVLF einlesen
+ bLVLOk = ReadLVL( aNumFmt, pListInfo->aItemSet[nLevel],
+ pListInfo->aIdSty[nLevel], true, aNotReallyThere, nLevel,
+ pListInfo->maParaSprms[nLevel]);
if( !bLVLOk )
break;
- //
- // 1.2.2 die ItemPools mit den CHPx Einstellungen der verschiedenen
- // Level miteinander vergleichen und ggfs. Style(s) erzeugen
- //
+ // und in die rMyNumRule aufnehmen
+ rMyNumRule.Set( nLevel, aNumFmt );
+ }
+ if( !bLVLOk )
+ break;
+ //
+ // 1.2.2 die ItemPools mit den CHPx Einstellungen der verschiedenen
+ // Level miteinander vergleichen und ggfs. Style(s) erzeugen
+ //
+ for (sal_uInt8 nLevel = 0; nLevel < nLvlCount; ++nLevel)
+ {
bool bDummy;
- for (nLevel = 0; nLevel < nLvlCount; ++nLevel)
- {
- AdjustLVL( nLevel, rMyNumRule, pListInfo->aItemSet,
- pListInfo->aCharFmt, bDummy );
- }
- //
- // 1.2.3 ItemPools leeren und loeschen
- //
- for (nLevel = 0; nLevel < nLvlCount; ++nLevel)
- delete pListInfo->aItemSet[ nLevel ];
- bOk = true;
+ AdjustLVL( nLevel, rMyNumRule, pListInfo->aItemSet,
+ pListInfo->aCharFmt, bDummy );
}
- }
- if( !bOk )
- {
- // Fehler aufgetreten - LSTInfos abraeumen !!!
-
- ;
+ //
+ // 1.2.3 ItemPools leeren und loeschen
+ //
+ for (sal_uInt8 nLevel = 0; nLevel < nLvlCount; ++nLevel)
+ delete pListInfo->aItemSet[ nLevel ];
}
//
// 2. PLF LFO auslesen und speichern
//
- long nLfoCount(0);
- if (bOk)
- {
- rSt.Seek(rFib.fcPlfLfo);
- rSt >> nLfoCount;
- if (0 >= nLfoCount)
- bOk = false;
- }
+ bOk = checkSeek(rSt, rFib.fcPlfLfo);
+
+ if (!bOk)
+ return;
+
+ sal_Int32 nLfoCount(0);
+ rSt >> nLfoCount;
+ bOk = nLfoCount > 0;
+
+ if (!bOk)
+ return;
- if(bOk)
+ //
+ // 2.1 alle LFO einlesen
+ //
+ for (sal_uInt16 nLfo = 0; nLfo < nLfoCount; ++nLfo)
{
+ bOk = false;
+
+ if (rSt.IsEof())
+ break;
+
WW8LFO aLFO;
- //
- // 2.1 alle LFO einlesen
- //
- for (sal_uInt16 nLfo = 0; nLfo < nLfoCount; ++nLfo)
- {
- bOk = false;
- memset(&aLFO, 0, sizeof( aLFO ));
- rSt >> aLFO.nIdLst;
- rSt.SeekRel( 8 );
- rSt >> aLFO.nLfoLvl;
- rSt.SeekRel( 3 );
- // soviele Overrides existieren
- if ((nMaxLevel < aLFO.nLfoLvl) || rSt.GetError())
- break;
+ memset(&aLFO, 0, sizeof( aLFO ));
+
+ rSt >> aLFO.nIdLst;
+ rSt.SeekRel( 8 );
+ rSt >> aLFO.nLfoLvl;
+ rSt.SeekRel( 3 );
+ // soviele Overrides existieren
+ if ((nMaxLevel < aLFO.nLfoLvl) || rSt.GetError())
+ break;
- // die Parent NumRule der entsprechenden Liste ermitteln
- WW8LSTInfo* pParentListInfo = GetLSTByListId(aLFO.nIdLst);
- if (pParentListInfo)
- {
- // hier, im ersten Schritt, erst mal diese NumRule festhalten
- aLFO.pNumRule = pParentListInfo->pNumRule;
+ // die Parent NumRule der entsprechenden Liste ermitteln
+ WW8LSTInfo* pParentListInfo = GetLSTByListId(aLFO.nIdLst);
+ if (pParentListInfo)
+ {
+ // hier, im ersten Schritt, erst mal diese NumRule festhalten
+ aLFO.pNumRule = pParentListInfo->pNumRule;
- // hat die Liste mehrere Level ?
- aLFO.bSimpleList = pParentListInfo->bSimpleList;
- }
- // und rein ins Merk-Array mit dem Teil
- WW8LFOInfo* pLFOInfo = new WW8LFOInfo(aLFO);
- if (pParentListInfo)
- {
- //Copy the basic paragraph properties for each level from the
- //original list into the list format override levels.
- int nMaxSize = pParentListInfo->maParaSprms.size();
- pLFOInfo->maParaSprms.resize(nMaxSize);
- for (int i = 0; i < nMaxSize; ++i)
- pLFOInfo->maParaSprms[i] = pParentListInfo->maParaSprms[i];
- }
- pLFOInfos->Insert(pLFOInfo, pLFOInfos->Count());
- bOk = true;
+ // hat die Liste mehrere Level ?
+ aLFO.bSimpleList = pParentListInfo->bSimpleList;
}
+ // und rein ins Merk-Array mit dem Teil
+ WW8LFOInfo* pLFOInfo = new WW8LFOInfo(aLFO);
+ if (pParentListInfo)
+ {
+ //Copy the basic paragraph properties for each level from the
+ //original list into the list format override levels.
+ int nMaxSize = pParentListInfo->maParaSprms.size();
+ pLFOInfo->maParaSprms.resize(nMaxSize);
+ for (int i = 0; i < nMaxSize; ++i)
+ pLFOInfo->maParaSprms[i] = pParentListInfo->maParaSprms[i];
+ }
+ pLFOInfos->Insert(pLFOInfo, pLFOInfos->Count());
+ bOk = true;
}
+
if( bOk )
{
//
@@ -1326,13 +1317,15 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
sal_uInt32 nTest;
rSt >> nTest;
do
+ {
+ nTest = 0;
rSt >> nTest;
+ }
while (nTest == 0xFFFFFFFF);
rSt.SeekRel(-4);
std::deque<bool> aNotReallyThere(WW8ListManager::nMaxLevel);
- sal_uInt8 nLevel = 0;
- for (nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
+ for (sal_uInt8 nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
{
WW8LFOLVL aLFOLVL;
bLVLOk = false;
@@ -1341,6 +1334,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
// 2.2.2.1 den LFOLVL einlesen
//
rSt >> aLFOLVL.nStartAt;
+ sal_uInt8 aBits1(0);
rSt >> aBits1;
rSt.SeekRel( 3 );
if (rSt.GetError())
@@ -1402,7 +1396,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
//
sal_uInt16 aFlagsNewCharFmt = 0;
bool bNewCharFmtCreated = false;
- for (nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
+ for (sal_uInt8 nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
{
AdjustLVL( nLevel, *pLFOInfo->pNumRule, aItemSet, aCharFmt,
bNewCharFmtCreated, sPrefix );
@@ -1412,17 +1406,12 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
//
// 2.2.4 ItemPools leeren und loeschen
//
- for (nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
+ for (sal_uInt8 nLevel = 0; nLevel < pLFOInfo->nLfoLvl; ++nLevel)
delete aItemSet[ nLevel ];
bOk = true;
}
}
}
- if( !bOk )
- {
- // Fehler aufgetreten - LSTInfos und LFOInfos abraeumen !!!
- ;
- }
// und schon sind wir fertig!
rSt.Seek( nOriginalPos );
}
@@ -1697,7 +1686,10 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt)
void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
sal_uInt8 nActLevel)
{
- SwWW8StyInf &rStyleInf = pCollA[nStyle];
+ if (nStyle >= vColl.size())
+ return;
+
+ SwWW8StyInf &rStyleInf = vColl[nStyle];
if (rStyleInf.bValid)
{
OSL_ENSURE(pAktColl, "Cannot be called outside of style import");
@@ -1733,7 +1725,11 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle)
{
- SwWW8StyInf &rStyleInf = pCollA[nStyle];
+
+ if (nStyle >= vColl.size())
+ return;
+
+ SwWW8StyInf &rStyleInf = vColl[nStyle];
if (rStyleInf.bValid && rStyleInf.pFmt)
{
//Save old pre-list modified indent, which are the word indent values
@@ -1781,10 +1777,12 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
if (pLstManager) // sind die Listendeklarationen gelesen?
{
- std::vector<sal_uInt8> aParaSprms;
SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
- OSL_ENSURE(pTxtNd, "Kein Text-Node an PaM-Position");
+ OSL_ENSURE(pTxtNd, "No Text-Node at PaM-Position");
+ if (!pTxtNd)
+ return;
+ std::vector<sal_uInt8> aParaSprms;
const SwNumRule* pRule = bSetAttr ?
pLstManager->GetNumRuleForActivation( nActLFO, nActLevel,
aParaSprms, pTxtNd) : 0;
@@ -2024,8 +2022,8 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
indentation. Setting this flag will allow us to recover from this
braindeadness
*/
- if (pAktColl && (nLFOPosition == 2047-1))
- pCollA[nAktColl].bHasBrokenWW6List = true;
+ if (pAktColl && (nLFOPosition == 2047-1) && nAktColl < vColl.size())
+ vColl[nAktColl].bHasBrokenWW6List = true;
// die Streamdaten sind hier 1 basiert, wir ziehen EINS ab
if (USHRT_MAX > nLFOPosition)
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index c28e1a22eeef..25c5cdaef20e 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -773,21 +773,24 @@ sal_uInt16 SwWW8ImplReader::End_Field()
// Store it now!
uno::Reference< embed::XStorage > xDocStg = GetDoc().GetDocStorage();
- uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
- SotStorageRef xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
-
- if ( xObjDst.Is() )
+ if (xDocStg.is())
{
- xSrc1->CopyTo( xObjDst );
+ uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
+ SotStorageRef xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
- if ( !xObjDst->GetError() )
- xObjDst->Commit();
- }
+ if ( xObjDst.Is() )
+ {
+ xSrc1->CopyTo( xObjDst );
- uno::Reference< embed::XTransactedObject > xTransact( xOleStg, uno::UNO_QUERY );
- if ( xTransact.is() )
- xTransact->commit();
+ if ( !xObjDst->GetError() )
+ xObjDst->Commit();
+ }
+
+ uno::Reference< embed::XTransactedObject > xTransact( xOleStg, uno::UNO_QUERY );
+ if ( xTransact.is() )
+ xTransact->commit();
+ }
// Store the OLE Id as a parameter
pFieldmark->GetParameters()->insert(
@@ -1416,7 +1419,7 @@ of a set or ask field, either by word, or in some special cases by the import
filter itself.
*/
SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pFld,
- SwFltStackEntry *pEntry)
+ SwFltStackEntry &rEntry)
{
SwFltStackEntry *pRet=0;
if (pFld && RES_GETREFFLD == pFld->Which())
@@ -1430,10 +1433,10 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pFld,
{
SwGetExpField aFld( (SwGetExpFieldType*)
pDoc->GetSysFldType(RES_GETEXPFLD), rName, nsSwGetSetExpType::GSE_STRING, 0);
- delete pEntry->pAttr;
+ delete rEntry.pAttr;
SwFmtFld aTmp(aFld);
- pEntry->pAttr = aTmp.Clone();
- pRet = pEntry;
+ rEntry.pAttr = aTmp.Clone();
+ pRet = &rEntry;
}
}
return pRet;
@@ -2775,9 +2778,9 @@ bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
bool bExtras = false;
//This is the case if the winword outline numbering is set while the
//writer one is not
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[nI];
+ SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutline())
{
const SwTxtFmtColl *pFmt = (const SwTxtFmtColl*)(rSI.pFmt);
@@ -3282,9 +3285,9 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
// the entry correctly, but I currently have no clue how to obtain
// the tab stop position. It is _not_ set at the paragraph style.
SwForm* pForm = 0;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- const SwWW8StyInf& rSI = pCollA[nI];
+ const SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutlineNumbered())
{
sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 04ef701f827a..5a2295a14499 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -284,10 +284,10 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
sal_uInt32 nCharWidth=240;
for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
{
- if (pCollA[nI].bValid && pCollA[nI].pFmt &&
- pCollA[nI].GetWWStyleId() == 0)
+ if (vColl[nI].bValid && vColl[nI].pFmt &&
+ vColl[nI].GetWWStyleId() == 0)
{
- nCharWidth = ItemGet<SvxFontHeightItem>(*(pCollA[nI].pFmt),
+ nCharWidth = ItemGet<SvxFontHeightItem>(*(vColl[nI].pFmt),
RES_CHRATR_CJK_FONTSIZE).GetHeight();
break;
}
@@ -915,6 +915,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
aNewSection.maSep.fEvenlySpaced =
ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false;
+ const sal_uInt8 numrgda = SAL_N_ELEMENTS(aNewSection.maSep.rgdxaColumnWidthSpacing);
if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
{
aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0;
@@ -928,7 +929,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440;
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ if (++nIdx < numrgda)
+ aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
if (i < nCols-1)
{
@@ -939,7 +941,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
if( pSD )
{
nWidth = SVBT16ToShort(pSD + 1);
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ if (++nIdx < numrgda)
+ aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
}
}
}
@@ -1614,11 +1617,8 @@ bool WW8FlyPara::operator==(const WW8FlyPara& rSrc) const
}
// Read fuer normalen Text
-void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap)
+void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8PLCFx_Cp_FKP* pPap)
{
- if (pSprm29)
- nOrigSp29 = *pSprm29; // PPC ( Bindung )
-
const sal_uInt8* pS = 0;
if( bVer67 )
{
@@ -1669,12 +1669,12 @@ void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap)
nSp29 = nOrigSp29;
}
-void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
+void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo)
{
WW8PLCFMan* pPlcxMan = pIo->pPlcxMan;
WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
- Read(pSprm29, pPap); // Lies Apo-Parameter
+ Read(nOrigSp29, pPap); // Lies Apo-Parameter
do{ // Block zum rausspringen
if( nSp45 != 0 /* || nSp28 != 0 */ )
@@ -1689,10 +1689,11 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
bGrafApo = false;
do{ // Block zum rausspringen
-
sal_uInt8 nTxt[2];
- pIoStrm->Read( nTxt, 2 ); // lies Text
+ if (!checkRead(*pIoStrm, nTxt, 2)) // lies Text
+ break;
+
if( nTxt[0] != 0x01 || nTxt[1] != 0x0d )// nur Grafik + CR ?
break; // Nein
@@ -1703,7 +1704,8 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
const sal_uInt8* pS = pPap->HasSprm( bVer67 ? 29 : 0x261B );
// Nein -> Grafik-Apo
- if( !pS ){
+ if (!pS)
+ {
bGrafApo = true;
break; // Ende des APO
}
@@ -1712,15 +1714,15 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
WW8FlyPara *pNowStyleApo=0;
sal_uInt16 nColl = pPap->GetIstd();
ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
- while (eSti != ww::stiNil && 0 == (pNowStyleApo = pIo->pCollA[nColl].pWWFly))
+ while (eSti != ww::stiNil && nColl < pIo->vColl.size() && 0 == (pNowStyleApo = pIo->vColl[nColl].pWWFly))
{
- nColl = pIo->pCollA[nColl].nBase;
+ nColl = pIo->vColl[nColl].nBase;
eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
}
WW8FlyPara aF(bVer67, pNowStyleApo);
// Neuer FlaPara zum Vergleich
- aF.Read( pS, pPap ); // WWPara fuer neuen Para
+ aF.Read( *pS, pPap ); // WWPara fuer neuen Para
if( !( aF == *this ) ) // selber APO ? ( oder neuer ? )
bGrafApo = true; // nein -> 1-zeiliger APO
// -> Grafik-APO
@@ -1734,11 +1736,8 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
// Read fuer Apo-Defs in Styledefs
-void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8RStyle* pStyle)
+void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8RStyle* pStyle)
{
- if (pSprm29)
- nOrigSp29 = *pSprm29; // PPC ( Bindung )
-
const sal_uInt8* pS = 0;
if (bVer67)
{
@@ -2183,20 +2182,20 @@ WW8DupProperties::WW8DupProperties(SwDoc &rDoc, SwWW8FltControlStack *pStk)
{
//Close any open character properties and duplicate them inside the
//first table cell
- sal_uInt16 nCnt = static_cast< sal_uInt16 >(pCtrlStck->Count());
- for (sal_uInt16 i=0; i < nCnt; i++)
+ size_t nCnt = pCtrlStck->size();
+ for (size_t i=0; i < nCnt; ++i)
{
- const SwFltStackEntry* pEntry = (*pCtrlStck)[ i ];
- if(pEntry->bLocked)
+ const SwFltStackEntry& rEntry = (*pCtrlStck)[ i ];
+ if (rEntry.bOpen)
{
- if (isCHRATR(pEntry->pAttr->Which()))
+ if (isCHRATR(rEntry.pAttr->Which()))
{
- aChrSet.Put( *pEntry->pAttr );
+ aChrSet.Put( *rEntry.pAttr );
}
- else if (isPARATR(pEntry->pAttr->Which()))
+ else if (isPARATR(rEntry.pAttr->Which()))
{
- aParSet.Put( *pEntry->pAttr );
+ aParSet.Put( *rEntry.pAttr );
}
}
}
@@ -2275,7 +2274,12 @@ SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrmFmt *pFlyFmt,
aIdx++;
if (aIdx == aEnd && pNd && !pNd->GetTxt().Len())
{
- rDoc.DelFullPara( *pPaM );
+ //An extra pre-created by writer unused paragraph
+ //
+ //delete after import is complete rather than now
+ //to avoid the complication of managing uncommitted
+ //ctrlstack properties that refer to it.
+ m_aExtraneousParas.push_back(pNd);
SwTable& rTable = pTable->GetTable();
SwFrmFmt* pTblFmt = rTable.GetFrmFmt();
@@ -2286,7 +2290,8 @@ SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrmFmt *pFlyFmt,
aSize.SetHeightSizeType(ATT_MIN_SIZE);
aSize.SetHeight(MINLAY);
pFlyFmt->SetFmtAttr(aSize);
- pTblFmt->SetFmtAttr(SwFmtHoriOrient(0,text::HoriOrientation::FULL));
+ SwFmtHoriOrient aHori = pTblFmt->GetHoriOrient();
+ pTblFmt->SetFmtAttr(SwFmtHoriOrient(0, aHori.GetHoriOrient() ) );
nRetWidth = aSize.GetWidth();
}
}
@@ -2312,7 +2317,7 @@ WW8FlyPara *SwWW8ImplReader::ConstructApo(const ApoTestResults &rApo,
// APO-Parameter ermitteln und Test auf bGrafApo
if (rApo.HasFrame())
- pRet->ReadFull(rApo.mpSprm29, this);
+ pRet->ReadFull(rApo.m_nSprm29, this);
pRet->ApplyTabPos(pTabPos);
@@ -2440,7 +2445,7 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
rPam.GetPoint()->nNode = aPref;
rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().Len());
if (bStealAttr)
- pCtrlStck->StealAttr(rPam.GetPoint());
+ pCtrlStck->StealAttr(rPam.GetPoint()->nNode);
pNode->JoinNext();
@@ -2589,7 +2594,7 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo,
WW8FlyPara aF(bVer67, rApo.mpStyleApo);
// WWPara fuer akt. Para
if (rApo.HasFrame())
- aF.Read(rApo.mpSprm29, pPlcxMan->GetPapPLCF());
+ aF.Read(rApo.m_nSprm29, pPlcxMan->GetPapPLCF());
aF.ApplyTabPos(pTabPos);
return aF == *pWFlyPara;
@@ -2659,10 +2664,10 @@ const SfxPoolItem* SwWW8ImplReader::GetFmtAttr( sal_uInt16 nWhich )
pRet = pCtrlStck->GetStackAttr(*pPaM->GetPoint(), nWhich);
if (!pRet)
{
- if (nAktColl < nColls && pCollA[nAktColl].pFmt &&
- pCollA[nAktColl].bColl)
+ if (nAktColl < vColl.size() && vColl[nAktColl].pFmt &&
+ vColl[nAktColl].bColl)
{
- pRet = &(pCollA[nAktColl].pFmt->GetFmtAttr(nWhich));
+ pRet = &(vColl[nAktColl].pFmt->GetFmtAttr(nWhich));
}
}
if (!pRet)
@@ -2785,7 +2790,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen
SwWW8StyInf *SwWW8ImplReader::GetStyle(sal_uInt16 nColl) const
{
- return nColl < nColls ? &pCollA[nColl] : 0;
+ return const_cast<SwWW8StyInf *>(nColl < vColl.size() ? &vColl[nColl] : 0);
}
/***************************************************************************
@@ -2869,8 +2874,8 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor
{
// The style based on has Bit 7 set ?
if (
- pSI->nBase < nColls && (*pData & 0x80) &&
- (pCollA[pSI->nBase].n81Flags & nMask)
+ pSI->nBase < vColl.size() && (*pData & 0x80) &&
+ (vColl[pSI->nBase].n81Flags & nMask)
)
{
bOn = !bOn; // umdrehen
@@ -2950,9 +2955,9 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData,
{
if (pSI)
{
- if( pSI->nBase < nColls // Style Based on
+ if( pSI->nBase < vColl.size() // Style Based on
&& ( *pData & 0x80 ) // Bit 7 gesetzt ?
- && ( pCollA[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
+ && ( vColl[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
bOn = !bOn; // umdrehen
if( bOn )
@@ -3171,12 +3176,12 @@ bool SwWW8ImplReader::ConvertSubToGraphicPlacement()
{
SwPaM aRegion(*pPaM->GetPoint());
- SwFltStackEntry aEntry = *((*pCtrlStck)[nPos]);
- aEntry.SetEndPos(*pPaM->GetPoint());
+ SwFltPosition aMkPos((*pCtrlStck)[nPos].m_aMkPos);
+ SwFltPosition aPtPos(*pPaM->GetPoint());
SwFrmFmt *pFlyFmt = 0;
if (
- aEntry.MakeRegion(&rDoc,aRegion,false) &&
+ SwFltStackEntry::MakeRegion(&rDoc,aRegion,false,aMkPos,aPtPos) &&
0 != (pFlyFmt = ContainsSingleInlineGraphic(aRegion))
)
{
@@ -3517,19 +3522,19 @@ bool SwWW8ImplReader::SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums,
if( bSetEnums )
{
- if( pAktColl ) // StyleDef
+ if( pAktColl && nAktColl < vColl.size() ) // StyleDef
{
switch(nWhich)
{
default:
case RES_CHRATR_FONT:
- pCollA[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
break;
case RES_CHRATR_CTL_FONT:
- pCollA[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
break;
case RES_CHRATR_CJK_FONT:
- pCollA[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
break;
}
}
@@ -3757,11 +3762,11 @@ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen
}
sal_uInt16 nId = SVBT16ToShort( pData ); // Style-Id (NICHT Sprm-Id!)
- if( nId >= nColls || !pCollA[nId].pFmt // ungueltige Id ?
- || pCollA[nId].bColl ) // oder Para-Style ?
+ if( nId >= vColl.size() || !vColl[nId].pFmt // ungueltige Id ?
+ || vColl[nId].bColl ) // oder Para-Style ?
return; // dann ignorieren
- NewAttr( SwFmtCharFmt( (SwCharFmt*)pCollA[nId].pFmt ) );
+ NewAttr( SwFmtCharFmt( (SwCharFmt*)vColl[nId].pFmt ) );
nCharFmt = (short) nId;
}
@@ -3956,9 +3961,9 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
case 0x840F:
case 0x845E:
aLR.SetTxtLeft( nPara );
- if (pAktColl)
+ if (pAktColl && nAktColl < vColl.size())
{
- pCollA[nAktColl].bListReleventIndentSet = true;
+ vColl[nAktColl].bListReleventIndentSet = true;
}
bLeftIndentSet = true; // #i105414#
break;
@@ -3977,22 +3982,22 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
been removed then we will factor the original list applied hanging
into our calculation.
*/
- if (pPlcxMan && pCollA[nAktColl].bHasBrokenWW6List)
+ if (pPlcxMan && nAktColl < vColl.size() && vColl[nAktColl].bHasBrokenWW6List)
{
const sal_uInt8 *pIsZeroed = pPlcxMan->GetPapPLCF()->HasSprm(0x460B);
if (pIsZeroed && *pIsZeroed == 0)
{
const SvxLRSpaceItem &rLR =
- ItemGet<SvxLRSpaceItem>(*(pCollA[nAktColl].pFmt),
+ ItemGet<SvxLRSpaceItem>(*(vColl[nAktColl].pFmt),
RES_LR_SPACE);
nPara = nPara - rLR.GetTxtFirstLineOfst();
}
}
aLR.SetTxtFirstLineOfst(nPara);
- if (pAktColl)
+ if (pAktColl && nAktColl < vColl.size())
{
- pCollA[nAktColl].bListReleventIndentSet = true;
+ vColl[nAktColl].bListReleventIndentSet = true;
}
bFirstLinOfstSet = true; // #i103711#
break;
@@ -4105,15 +4110,15 @@ void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, sh
SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
aUL.SetUpper(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
NewAttr(aUL);
- if (pAktColl)
- pCollA[nAktColl].bParaAutoBefore = true;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoBefore = true;
else
bParaAutoBefore = true;
}
else
{
- if (pAktColl)
- pCollA[nAktColl].bParaAutoBefore = false;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoBefore = false;
else
bParaAutoBefore = false;
}
@@ -4132,15 +4137,15 @@ void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, sho
SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
aUL.SetLower(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
NewAttr(aUL);
- if (pAktColl)
- pCollA[nAktColl].bParaAutoAfter = true;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoAfter = true;
else
bParaAutoAfter = true;
}
else
{
- if (pAktColl)
- pCollA[nAktColl].bParaAutoAfter = false;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoAfter = false;
else
bParaAutoAfter = false;
}
@@ -4857,14 +4862,14 @@ void SwWW8ImplReader::Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, shor
void SwWW8ImplReader::Read_ApoPPC( sal_uInt16, const sal_uInt8* pData, short )
{
- if (pAktColl) // only for Styledef, sonst anders geloest
+ if (pAktColl && nAktColl < vColl.size()) // only for Styledef, sonst anders geloest
{
- SwWW8StyInf& rSI = pCollA[nAktColl];
+ SwWW8StyInf& rSI = vColl[nAktColl];
WW8FlyPara* pFly = rSI.pWWFly ? rSI.pWWFly : new WW8FlyPara(bVer67);
- pCollA[nAktColl].pWWFly = pFly;
- pFly->Read(pData, pStyles);
+ vColl[nAktColl].pWWFly = pFly;
+ pFly->Read(*pData, pStyles);
if (pFly->IsEmpty())
- delete pCollA[nAktColl].pWWFly, pCollA[nAktColl].pWWFly = 0;
+ delete vColl[nAktColl].pWWFly, vColl[nAktColl].pWWFly = 0;
}
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 4a398995958c..6e7e132fc77c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -909,13 +909,18 @@ void WW8SprmIter::advance()
void WW8SprmIter::UpdateMyMembers()
{
- if (pSprms && nRemLen > (mrSprmParser.getVersion()?1:0))
+ bool bValid = (pSprms && nRemLen >= mrSprmParser.MinSprmLen());
+
+ if (bValid)
{
nAktId = mrSprmParser.GetSprmId(pSprms);
- pAktParams = pSprms + mrSprmParser.DistanceToData(nAktId);
nAktSize = mrSprmParser.GetSprmSize(nAktId, pSprms);
+ pAktParams = pSprms + mrSprmParser.DistanceToData(nAktId);
+ bValid = nAktSize <= nRemLen;
+ OSL_ENSURE(bValid, "sprm longer than remaining bytes");
}
- else
+
+ if (!bValid)
{
nAktId = 0;
pAktParams = 0;
@@ -926,9 +931,9 @@ void WW8SprmIter::UpdateMyMembers()
const sal_uInt8* WW8SprmIter::FindSprm(sal_uInt16 nId)
{
- while(GetSprms())
+ while (GetSprms())
{
- if( GetAktId() == nId )
+ if (GetAktId() == nId)
return GetAktParams(); // SPRM found!
advance();
}
@@ -1372,9 +1377,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
if( nFcPos == WW8_FC_MAX )
return nFallBackCpEnd;
+ bool bIsUnicode;
+ if (pWw8Fib->nVersion >= 8)
+ bIsUnicode = false;
+ else
+ bIsUnicode = pWw8Fib->fExtChar ? true : false;
+
if( pPieceIter ) // Complex File ?
{
- bool bIsUnicode = false;
sal_uLong nOldPos = pPieceIter->GetIdx();
for (pPieceIter->SetIdx(0);
@@ -1388,15 +1398,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
break;
}
sal_Int32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
- if( 8 <= pWw8Fib->nVersion )
+ if (pWw8Fib->nVersion >= 8)
{
nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart,
bIsUnicode );
}
else
{
- if (pWw8Fib->fExtChar)
- bIsUnicode=true;
+ bIsUnicode = pWw8Fib->fExtChar ? true : false;
}
sal_Int32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1);
@@ -1431,11 +1440,13 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
*/
return nFallBackCpEnd;
}
+
// No complex file
- if (!pWw8Fib->fExtChar)
+ if (!bIsUnicode)
nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin);
else
nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin + 1) / 2;
+
return nFallBackCpEnd;
}
@@ -1451,8 +1462,14 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
if( !pIsUnicode )
pIsUnicode = &bIsUnicode;
+ if (pWw8Fib->nVersion >= 8)
+ *pIsUnicode = false;
+ else
+ *pIsUnicode = pWw8Fib->fExtChar ? true : false;
+
if( pPieceIter )
- { // Complex File
+ {
+ // Complex File
if( pNextPieceCp )
*pNextPieceCp = WW8_CP_MAX;
@@ -1480,16 +1497,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
*pNextPieceCp = nCpEnd;
WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
- if (8 > pWw8Fib->nVersion)
- {
- if (pWw8Fib->fExtChar)
- *pIsUnicode=true;
- else
- *pIsUnicode = false;
- }
- else
+ if (pWw8Fib->nVersion >= 8)
nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode );
-
+ else
+ *pIsUnicode = pWw8Fib->fExtChar ? true : false;
nRet += (nCpPos - nCpStart) * (*pIsUnicode ? 2 : 1);
@@ -1497,10 +1508,6 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
}
// No complex file
- if (pWw8Fib->fExtChar)
- *pIsUnicode = true;
- else
- *pIsUnicode = false;
return pWw8Fib->fcMin + nCpPos * (*pIsUnicode ? 2 : 1);
}
@@ -1511,31 +1518,36 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
WW8PLCFpcd* WW8ScannerBase::OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF )
{
if ( ((8 > pWw8Fib->nVersion) && !pWwF->fComplex) || !pWwF->lcbClx )
- return 0;
+ return NULL;
WW8_FC nClxPos = pWwF->fcClx;
sal_Int32 nClxLen = pWwF->lcbClx;
sal_Int32 nLeft = nClxLen;
sal_Int16 nGrpprl = 0;
- sal_uInt8 clxt;
- pStr->Seek( nClxPos );
+ if (!checkSeek(*pStr, nClxPos))
+ return NULL;
+
while( 1 ) // Zaehle Zahl der Grpprls
{
+ sal_uInt8 clxt(2);
*pStr >> clxt;
nLeft--;
if( 2 == clxt ) // PLCFfpcd ?
break; // PLCFfpcd gefunden
if( 1 == clxt ) // clxtGrpprl ?
nGrpprl++;
- sal_uInt16 nLen;
+ sal_uInt16 nLen(0);
*pStr >> nLen;
nLeft -= 2 + nLen;
if( nLeft < 0 )
- return 0; // schiefgegangen
+ return NULL; // schiefgegangen
pStr->SeekRel( nLen ); // ueberlies grpprl
}
- pStr->Seek( nClxPos );
+
+ if (!checkSeek(*pStr, nClxPos))
+ return NULL;
+
nLeft = nClxLen;
pPieceGrpprls = new sal_uInt8*[nGrpprl + 1];
memset( pPieceGrpprls, 0, ( nGrpprl + 1 ) * sizeof(sal_uInt8 *) );
@@ -1543,30 +1555,35 @@ WW8PLCFpcd* WW8ScannerBase::OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF )
sal_Int16 nAktGrpprl = 0; // lies Grpprls ein
while( 1 )
{
+ sal_uInt8 clxt(2);
*pStr >> clxt;
nLeft--;
if( 2 == clxt) // PLCFfpcd ?
break; // PLCFfpcd gefunden
- sal_uInt16 nLen;
+ sal_uInt16 nLen(0);
*pStr >> nLen;
nLeft -= 2 + nLen;
if( nLeft < 0 )
- return 0; // schiefgegangen
+ return NULL; // schiefgegangen
if( 1 == clxt ) // clxtGrpprl ?
{
sal_uInt8* p = new sal_uInt8[nLen+2]; // alloziere
ShortToSVBT16(nLen, p); // trage Laenge ein
- pStr->Read( p+2, nLen ); // lies grpprl
+ if (!checkRead(*pStr, p+2, nLen)) // lies grpprl
+ {
+ delete[] p;
+ return NULL;
+ }
pPieceGrpprls[nAktGrpprl++] = p; // trage in Array ein
}
else
pStr->SeekRel( nLen ); // ueberlies nicht-Grpprl
}
// lies Piece Table PLCF ein
- sal_Int32 nPLCFfLen;
+ sal_Int32 nPLCFfLen(0);
if (pWwF->GetFIBVersion() <= ww::eWW2)
{
- sal_Int16 nWordTwoLen;
+ sal_Int16 nWordTwoLen(0);
*pStr >> nWordTwoLen;
nPLCFfLen = nWordTwoLen;
}
@@ -1588,7 +1605,7 @@ void WW8ScannerBase::DeletePieceTable()
}
WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTblSt,
- SvStream* pDataSt, const WW8Fib* pWwFib )
+ SvStream* pDataSt, WW8Fib* pWwFib )
: pWw8Fib(pWwFib), pMainFdoa(0), pHdFtFdoa(0), pMainTxbx(0),
pMainTxbxBkd(0), pHdFtTxbx(0), pHdFtTxbxBkd(0), pMagicTables(0),
pSubdocs(0), pExtendedAtrds(0), pPieceGrpprls(0)
@@ -1694,14 +1711,19 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTblSt,
pSubdocs = new WW8PLCFspecial( pTblSt,
pWwFib->fcPlcfwkb, pWwFib->lcbPlcfwkb, 12);
}
- // Extended ATRD
+ // Extended ATRD
if (pWwFib->fcAtrdExtra && pWwFib->lcbAtrdExtra)
{
- pExtendedAtrds = new sal_uInt8[pWwFib->lcbAtrdExtra];
- long nOldPos = pTblSt->Tell();
- pTblSt->Seek(pWwFib->fcAtrdExtra);
- pTblSt->Read(pExtendedAtrds, pWwFib->lcbAtrdExtra);
- pTblSt->Seek(nOldPos);
+ sal_Size nOldPos = pTblSt->Tell();
+ if (checkSeek(*pTblSt, pWwFib->fcAtrdExtra))
+ {
+ pExtendedAtrds = new sal_uInt8[pWwFib->lcbAtrdExtra];
+ pWwFib->lcbAtrdExtra = pTblSt->Read(pExtendedAtrds,
+ pWwFib->lcbAtrdExtra);
+ }
+ else
+ pWwFib->lcbAtrdExtra = 0;
+ pTblSt->Seek(nOldPos);
}
break;
@@ -1711,7 +1733,7 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTblSt,
}
// PLCF fuer TextBox-Stories im Maintext
- long nLenTxBxS = (8 > pWw8Fib->nVersion) ? 0 : 22;
+ sal_uInt32 nLenTxBxS = (8 > pWw8Fib->nVersion) ? 0 : 22;
if( pWwFib->fcPlcftxbxTxt && pWwFib->lcbPlcftxbxTxt )
{
pMainTxbx = new WW8PLCFspecial( pTblSt, pWwFib->fcPlcftxbxTxt,
@@ -1772,7 +1794,7 @@ static bool WW8SkipField(WW8PLCFspecial& rPLCF)
if (!rPLCF.Get(nP, pData)) // Ende des PLCFspecial ?
return false;
- rPLCF++;
+ rPLCF.advance();
if((((sal_uInt8*)pData)[0] & 0x1f ) != 0x13 ) // Kein Anfang ?
return true; // Bei Fehler nicht abbrechen
@@ -1793,7 +1815,7 @@ static bool WW8SkipField(WW8PLCFspecial& rPLCF)
{
// Field Separator ?
- rPLCF++;
+ rPLCF.advance();
if( !rPLCF.Get( nP, pData ) )
return false;
@@ -1806,7 +1828,7 @@ static bool WW8SkipField(WW8PLCFspecial& rPLCF)
return false;
}
}
- rPLCF++;
+ rPLCF.advance();
return true;
}
@@ -1821,7 +1843,7 @@ static bool WW8GetFieldPara(WW8PLCFspecial& rPLCF, WW8FieldDesc& rF)
if( !rPLCF.Get( rF.nSCode, pData ) ) // Ende des PLCFspecial ?
goto Err;
- rPLCF++;
+ rPLCF.advance();
if((((sal_uInt8*)pData)[0] & 0x1f ) != 0x13 ) // Kein Anfang ?
goto Err;
@@ -1844,8 +1866,9 @@ static bool WW8GetFieldPara(WW8PLCFspecial& rPLCF, WW8FieldDesc& rF)
goto Err;
}
- if((((sal_uInt8*)pData)[0] & 0x1f ) == 0x14 ){ // Field Separator ?
- rPLCF++;
+ if ((((sal_uInt8*)pData)[0] & 0x1f ) == 0x14 ) // Field Separator ?
+ {
+ rPLCF.advance();
if( !rPLCF.Get( rF.nLRes, pData ) )
goto Err;
@@ -1868,7 +1891,7 @@ static bool WW8GetFieldPara(WW8PLCFspecial& rPLCF, WW8FieldDesc& rF)
rF.nLen = rF.nSRes - rF.nSCode + 2; // Gesamtlaenge
}
- rPLCF++;
+ rPLCF.advance();
if((((sal_uInt8*)pData)[0] & 0x1f ) == 0x15 )
{
// Field Ende ?
@@ -2017,19 +2040,28 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr,
// WW8PLCFspecial
//-----------------------------------------
-// Bei nStartPos < 0 wird das erste Element des PLCFs genommen
-WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF,
- long nStruct, long nStartPos)
+WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos,
+ sal_uInt32 nPLCF, sal_uInt32 nStruct)
: nIdx(0), nStru(nStruct)
{
- nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
+ const sal_uInt32 nValidMin=4;
+
+ sal_Size nOldPos = pSt->Tell();
+ sal_Size nRemainingSize = pSt->remainingSize();
+
+ bool bValid = checkSeek(*pSt, nFilePos) && (nRemainingSize >= nValidMin) &&
+ (nPLCF >= nValidMin);
+ nPLCF = bValid ? std::min(nRemainingSize, static_cast<sal_Size>(nPLCF)) : nValidMin;
+
// Pointer auf Pos- u. Struct-Array
pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ];
+ pPLCF_PosArray[0] = 0;
+
+ nPLCF = bValid ? pSt->Read(pPLCF_PosArray, nPLCF) : nValidMin;
- long nOldPos = pSt->Tell();
+ nPLCF = std::max(nPLCF, nValidMin);
- pSt->Seek( nFilePos );
- pSt->Read( pPLCF_PosArray, nPLCF );
+ nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
#ifdef OSL_BIGENDIAN
for( nIdx = 0; nIdx <= nIMax; nIdx++ )
pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
@@ -2039,10 +2071,8 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF,
pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1];
else
pPLCF_Contents = 0; // kein Inhalt
- if( nStartPos >= 0 )
- SeekPos( nStartPos );
- pSt->Seek( nOldPos );
+ pSt->Seek(nOldPos);
}
// WW8PLCFspecial::SeekPos() stellt den WW8PLCFspecial auf die Stelle nPos, wobei auch noch der
@@ -2139,14 +2169,14 @@ bool WW8PLCFspecial::GetData(long nInIdx, WW8_CP& rPos, void*& rpValue) const
// Ctor fuer *andere* als Fkps
// Bei nStartPos < 0 wird das erste Element des PLCFs genommen
-WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
- WW8_CP nStartPos ) : pPLCF_PosArray(0), nIdx(0), nStru(nStruct)
+WW8PLCF::WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
+ WW8_CP nStartPos) : pPLCF_PosArray(0), nIdx(0), nStru(nStruct)
{
OSL_ENSURE( nPLCF, "WW8PLCF: nPLCF ist Null!" );
nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
- ReadPLCF( pSt, nFilePos, nPLCF );
+ ReadPLCF(rSt, nFilePos, nPLCF);
if( nStartPos >= 0 )
SeekPos( nStartPos );
@@ -2157,40 +2187,36 @@ WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
// != 0, dann wird ein unvollstaendiger PLCF vervollstaendigt. Das ist bei
// WW6 bei Resourcenmangel und bei WordPad (W95) immer noetig. Bei nStartPos
// < 0 wird das erste Element des PLCFs genommen
-WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
- WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN ) : pPLCF_PosArray(0), nIdx(0),
+WW8PLCF::WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
+ WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN): pPLCF_PosArray(0), nIdx(0),
nStru(nStruct)
{
nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
if( nIMax >= ncpN )
- ReadPLCF( pSt, nFilePos, nPLCF );
+ ReadPLCF(rSt, nFilePos, nPLCF);
else
- GeneratePLCF( pSt, nPN, ncpN );
+ GeneratePLCF(rSt, nPN, ncpN);
if( nStartPos >= 0 )
SeekPos( nStartPos );
}
-void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF )
+void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
{
- bool failure = false;
+ sal_Size nOldPos = rSt.Tell();
+ sal_Size nRemainingSize = rSt.remainingSize();
- // Pointer auf Pos-Array
- pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ];
-
- sal_Size nOldPos = pSt->Tell();
+ bool bValid = checkSeek(rSt, nFilePos) && (nRemainingSize >= nPLCF);
- pSt->Seek( nFilePos );
- failure = pSt->GetError();
-
- if (!failure)
+ if (bValid)
{
- pSt->Read( pPLCF_PosArray, nPLCF );
- failure = pSt->GetError();
+ // Pointer auf Pos-Array
+ pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ];
+ bValid = checkRead(rSt, pPLCF_PosArray, nPLCF);
}
- if (!failure)
+ if (bValid)
{
#ifdef OSL_BIGENDIAN
for( nIdx = 0; nIdx <= nIMax; nIdx++ )
@@ -2201,12 +2227,12 @@ void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF )
pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1];
}
- pSt->Seek( nOldPos );
-
- OSL_ENSURE( !failure, "Document has corrupt PLCF, ignoring it" );
+ OSL_ENSURE(bValid, "Document has corrupt PLCF, ignoring it");
- if (failure)
+ if (!bValid)
MakeFailedPLCF();
+
+ rSt.Seek(nOldPos);
}
void WW8PLCF::MakeFailedPLCF()
@@ -2218,7 +2244,7 @@ void WW8PLCF::MakeFailedPLCF()
pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1];
}
-void WW8PLCF::GeneratePLCF( SvStream* pSt, sal_Int32 nPN, sal_Int32 ncpN )
+void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN)
{
OSL_ENSURE( nIMax < ncpN, "Pcl.Fkp: Warum ist PLCF zu gross ?" );
@@ -2234,32 +2260,43 @@ void WW8PLCF::GeneratePLCF( SvStream* pSt, sal_Int32 nPN, sal_Int32 ncpN )
size_t nElems = ( nSiz + 3 ) / 4;
pPLCF_PosArray = new sal_Int32[ nElems ]; // Pointer auf Pos-Array
- for (sal_Int32 i = 0; i < ncpN && !pSt->GetError(); ++i)
+ for (sal_Int32 i = 0; i < ncpN && !failure; ++i)
{
+ failure = true;
// Baue FC-Eintraege
- pSt->Seek( ( nPN + i ) << 9 ); // erster FC-Eintrag jedes Fkp
- WW8_CP nFc;
- *pSt >> nFc;
+ // erster FC-Eintrag jedes Fkp
+ if (checkSeek(rSt, ( nPN + i ) << 9 ))
+ continue;
+ WW8_CP nFc(0);
+ rSt >> nFc;
pPLCF_PosArray[i] = nFc;
+ failure = rSt.GetError();
}
-
- failure = pSt->GetError();
}
if (!failure)
{
- sal_Size nLastFkpPos = ( ( nPN + nIMax - 1 ) << 9 );
- pSt->Seek( nLastFkpPos + 511 ); // Anz. Fkp-Eintraege des letzten Fkp
+ do
+ {
+ failure = true;
- sal_uInt8 nb;
- *pSt >> nb;
- pSt->Seek( nLastFkpPos + nb * 4 ); // letzer FC-Eintrag des letzten Fkp
+ sal_Size nLastFkpPos = ( ( nPN + nIMax - 1 ) << 9 );
+ // Anz. Fkp-Eintraege des letzten Fkp
+ if (!checkSeek(rSt, nLastFkpPos + 511))
+ break;
- WW8_CP nFc;
- *pSt >> nFc;
- pPLCF_PosArray[nIMax] = nFc; // Ende des letzten Fkp
+ sal_uInt8 nb(0);
+ rSt >> nb;
+ // letzer FC-Eintrag des letzten Fkp
+ if (!checkSeek(rSt, nLastFkpPos + nb * 4))
+ break;
+
+ WW8_CP nFc(0);
+ rSt >> nFc;
+ pPLCF_PosArray[nIMax] = nFc; // Ende des letzten Fkp
- failure = pSt->GetError();
+ failure = rSt.GetError();
+ } while(0);
}
if (!failure)
@@ -2342,16 +2379,26 @@ WW8_CP WW8PLCF::Where() const
// WW8PLCFpcd
//-----------------------------------------
-WW8PLCFpcd::WW8PLCFpcd( SvStream* pSt, long nFilePos, long nPLCF, long nStruct )
- :nStru( nStruct )
+WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
+ sal_uInt32 nPLCF, sal_uInt32 nStruct)
+ : nStru( nStruct )
{
- nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
+ const sal_uInt32 nValidMin=4;
+
+ sal_Size nOldPos = pSt->Tell();
+ sal_Size nRemainingSize = pSt->remainingSize();
+
+ bool bValid = checkSeek(*pSt, nFilePos) && (nRemainingSize >= nValidMin) &&
+ (nPLCF >= nValidMin);
+ nPLCF = bValid ? std::min(nRemainingSize, static_cast<sal_Size>(nPLCF)) : nValidMin;
+
pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ]; // Pointer auf Pos-Array
+ pPLCF_PosArray[0] = 0;
- long nOldPos = pSt->Tell();
+ nPLCF = bValid ? pSt->Read(pPLCF_PosArray, nPLCF) : nValidMin;
+ nPLCF = std::max(nPLCF, nValidMin);
- pSt->Seek( nFilePos );
- pSt->Read( pPLCF_PosArray, nPLCF );
+ nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
#ifdef OSL_BIGENDIAN
for( long nI = 0; nI <= nIMax; nI++ )
pPLCF_PosArray[nI] = SWAPLONG( pPLCF_PosArray[nI] );
@@ -2442,26 +2489,64 @@ bool IsExpandableSprm(sal_uInt16 nSpId)
return 0x646B == nSpId;
}
+void WW8PLCFx_Fc_FKP::WW8Fkp::FillEntry(WW8PLCFx_Fc_FKP::WW8Fkp::Entry &rEntry,
+ sal_Size nDataOffset, sal_uInt16 nLen)
+{
+ bool bValidPos = (nDataOffset < sizeof(maRawData));
+
+ OSL_ENSURE(bValidPos, "sprm sequence offset is out of range, ignoring");
+
+ if (!bValidPos)
+ {
+ rEntry.mnLen = 0;
+ return;
+ }
+
+ sal_uInt16 nAvailableData = sizeof(maRawData)-nDataOffset;
+ OSL_ENSURE(nLen <= nAvailableData, "srpm sequence len is out of range, clipping");
+ rEntry.mnLen = std::min(nLen, nAvailableData);
+ rEntry.mpData = maRawData + nDataOffset;
+}
+
WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
SvStream* pDataSt, long _nFilePos, long nItemSiz, ePLCFT ePl,
WW8_FC nStartFc)
: nItemSize(nItemSiz), nFilePos(_nFilePos), mnIdx(0), ePLCF(ePl),
maSprmParser(eVersion)
{
- long nOldPos = pSt->Tell();
-
- pSt->Seek(nFilePos);
memset(maRawData, 0, 512);
- pSt->Read(maRawData, 512);
- mnIMax = maRawData[511];
+
+ sal_Size nOldPos = pSt->Tell();
+
+ bool bCouldSeek = checkSeek(*pSt, nFilePos);
+ bool bCouldRead = bCouldSeek ? checkRead(*pSt, maRawData, 512) : false;
+
+ mnIMax = bCouldRead ? maRawData[511] : 0;
sal_uInt8 *pStart = maRawData;
- // Pointer to Offset-Location in maRawData
- sal_uInt8* pOfs = maRawData + (mnIMax + 1) * 4;
+ // Offset-Location in maRawData
+ const size_t nRawDataStart = (mnIMax + 1) * 4;
for (mnIdx = 0; mnIdx < mnIMax; ++mnIdx)
{
- unsigned int nOfs = (*(pOfs + mnIdx * nItemSize)) * 2;
+ const size_t nRawDataOffset = nRawDataStart + mnIdx * nItemSize;
+
+ //clip to available data, corrupt fkp
+ if (nRawDataOffset >= 511)
+ {
+ mnIMax = mnIdx;
+ break;
+ }
+
+ unsigned int nOfs = maRawData[nRawDataOffset] * 2;
+
+ //clip to available data, corrupt fkp
+ if (nOfs >= 511)
+ {
+ mnIMax = mnIdx;
+ break;
+ }
+
Entry aEntry(Get_Long(pStart));
if (nOfs)
@@ -2469,8 +2554,13 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
switch (ePLCF)
{
case CHP:
- aEntry.mnLen = maRawData[nOfs];
- aEntry.mpData = maRawData + nOfs + 1;
+ {
+ aEntry.mnLen = maRawData[nOfs];
+
+ //len byte
+ sal_Size nDataOffset = nOfs + 1;
+
+ FillEntry(aEntry, nDataOffset, aEntry.mnLen);
if (aEntry.mnLen && eVersion == ww::eWW2)
{
@@ -2484,8 +2574,8 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
aEntry.mbMustDelete = true;
}
}
-
break;
+ }
case PAP:
{
sal_uInt8 nDelta = 0;
@@ -2519,10 +2609,18 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
{
if (aEntry.mnLen >= 2)
{
- aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta);
+ //len byte + optional extra len byte
+ sal_Size nDataOffset = nOfs + 1 + nDelta;
+ aEntry.mnIStd = nDataOffset <= sizeof(maRawData)-sizeof(aEntry.mnIStd) ?
+ SVBT16ToShort(maRawData+nDataOffset) : 0;
aEntry.mnLen-=2; //istd
- //skip istd, len byte + optional extra len byte
- aEntry.mpData = maRawData + nOfs + 3 + nDelta;
+ if (aEntry.mnLen)
+ {
+ //additional istd
+ nDataOffset += sizeof(aEntry.mnIStd);
+
+ FillEntry(aEntry, nDataOffset, aEntry.mnLen);
+ }
}
else
aEntry.mnLen=0; //Too short, ignore
@@ -2538,26 +2636,28 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
bool bExpand = IsExpandableSprm(nSpId);
if (IsReplaceAllSprm(nSpId) || bExpand)
{
- sal_uInt16 nOrigLen = bExpand ? aEntry.mnLen : 0;
- sal_uInt8 *pOrigData = bExpand ? aEntry.mpData : 0;
-
sal_uInt32 nCurr = pDataSt->Tell();
-
sal_uInt32 nPos = SVBT32ToUInt32(aEntry.mpData + 2);
- pDataSt->Seek(nPos);
- *pDataSt >> aEntry.mnLen;
- aEntry.mpData =
- new sal_uInt8[aEntry.mnLen + nOrigLen];
- aEntry.mbMustDelete = true;
- pDataSt->Read(aEntry.mpData, aEntry.mnLen);
+ if (checkSeek(*pDataSt, nPos))
+ {
+ sal_uInt16 nOrigLen = bExpand ? aEntry.mnLen : 0;
+ sal_uInt8 *pOrigData = bExpand ? aEntry.mpData : 0;
- pDataSt->Seek( nCurr );
+ *pDataSt >> aEntry.mnLen;
+ aEntry.mpData =
+ new sal_uInt8[aEntry.mnLen + nOrigLen];
+ aEntry.mbMustDelete = true;
+ aEntry.mnLen =
+ pDataSt->Read(aEntry.mpData, aEntry.mnLen);
- if (pOrigData)
- {
- memcpy(aEntry.mpData + aEntry.mnLen,
- pOrigData, nOrigLen);
- aEntry.mnLen = aEntry.mnLen + nOrigLen;
+ pDataSt->Seek( nCurr );
+
+ if (pOrigData)
+ {
+ memcpy(aEntry.mpData + aEntry.mnLen,
+ pOrigData, nOrigLen);
+ aEntry.mnLen = aEntry.mnLen + nOrigLen;
+ }
}
}
}
@@ -2576,8 +2676,11 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
sal_uInt8* pSprms = GetLenAndIStdAndSprms( nLen );
WW8SprmIter aIter(pSprms, nLen, maSprmParser);
- while(aIter.GetSprms())
+ while (aIter.GetSprms())
+ {
+ fprintf(stderr, "id is %x\n", aIter.GetAktId());
aIter.advance();
+ }
}
#endif
}
@@ -2869,12 +2972,12 @@ WW8PLCFx_Fc_FKP::WW8PLCFx_Fc_FKP(SvStream* pSt, SvStream* pTblSt,
long nLenStruct = (8 > rFib.nVersion) ? 2 : 4;
if (ePl == CHP)
{
- pPLCF = new WW8PLCF(pTblSt, rFib.fcPlcfbteChpx, rFib.lcbPlcfbteChpx,
+ pPLCF = new WW8PLCF(*pTblSt, rFib.fcPlcfbteChpx, rFib.lcbPlcfbteChpx,
nLenStruct, GetStartFc(), rFib.pnChpFirst, rFib.cpnBteChp);
}
else
{
- pPLCF = new WW8PLCF(pTblSt, rFib.fcPlcfbtePapx, rFib.lcbPlcfbtePapx,
+ pPLCF = new WW8PLCF(*pTblSt, rFib.fcPlcfbtePapx, rFib.lcbPlcfbtePapx,
nLenStruct, GetStartFc(), rFib.pnPapFirst, rFib.cpnBtePap);
}
}
@@ -3298,8 +3401,14 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p)
if (nSmallest <= nLimitFC)
{
- p->nEndPos = nCpEnd -
+ WW8_CP nEndPos = nCpEnd -
(nLimitFC-nSmallest) / (bIsUnicode ? 2 : 1);
+
+ OSL_ENSURE(nEndPos >= p->nStartPos, "EndPos before StartPos");
+
+ if (nEndPos >= p->nStartPos)
+ p->nEndPos = nEndPos;
+
break;
}
}
@@ -3356,7 +3465,7 @@ WW8PLCFx_SEPX::WW8PLCFx_SEPX(SvStream* pSt, SvStream* pTblSt,
pStrm(pSt), nArrMax(256), nSprmSiz(0)
{
pPLCF = rFib.lcbPlcfsed
- ? new WW8PLCF(pTblSt, rFib.fcPlcfsed, rFib.lcbPlcfsed,
+ ? new WW8PLCF(*pTblSt, rFib.fcPlcfsed, rFib.lcbPlcfsed,
GetFIBVersion() <= ww::eWW2 ? 6 : 12, nStartCp)
: 0;
@@ -3431,7 +3540,7 @@ void WW8PLCFx_SEPX::GetSprms(WW8PLCFxDesc* p)
nArrMax = nSprmSiz; // Hole mehr Speicher
pSprms = new sal_uInt8[nArrMax];
}
- pStrm->Read( pSprms, nSprmSiz ); // read Sprms
+ nSprmSiz = pStrm->Read(pSprms, nSprmSiz); // read Sprms
p->nSprmsLen = nSprmSiz;
p->pMemPos = pSprms; // return Position
@@ -3536,8 +3645,8 @@ WW8PLCFx_SubDoc::WW8PLCFx_SubDoc(SvStream* pSt, ww::WordVersion eVersion,
{
if( nLenRef && nLenTxt )
{
- pRef = new WW8PLCF( pSt, nFcRef, nLenRef, nStruct, nStartCp );
- pTxt = new WW8PLCF( pSt, nFcTxt, nLenTxt, 0, nStartCp );
+ pRef = new WW8PLCF(*pSt, nFcRef, nLenRef, nStruct, nStartCp);
+ pTxt = new WW8PLCF(*pSt, nFcTxt, nLenTxt, 0, nStartCp);
}
}
@@ -3713,7 +3822,7 @@ bool WW8PLCFx_FLD::EndPosIsFieldEnd()
{
long n = pPLCF->GetIdx();
- (*pPLCF)++;
+ pPLCF->advance();
void* pData;
sal_Int32 nTest;
@@ -3751,7 +3860,7 @@ void WW8PLCFx_FLD::GetSprms(WW8PLCFxDesc* p)
p->nStartPos = nP;
- (*pPLCF)++;
+ pPLCF->advance();
if (!pPLCF->Get(nP, pData)) // Ende des PLCFspecial ?
{
p->nStartPos = WW8_CP_MAX; // PLCF fertig abgearbeitet
@@ -3767,7 +3876,7 @@ void WW8PLCFx_FLD::GetSprms(WW8PLCFxDesc* p)
WW8PLCFx& WW8PLCFx_FLD::operator ++( int )
{
- (*pPLCF)++;
+ pPLCF->advance();
return *this;
}
@@ -3795,122 +3904,126 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
sal_uInt16 nExtraLen, rtl_TextEncoding eCS, std::vector<String> &rArray,
std::vector<ww::bytes>* pExtraArray, ::std::vector<String>* pValueArray)
{
- if(nLen==0) // Handle Empty STTBF
+ if (nLen==0) // Handle Empty STTBF
return;
- sal_uLong nOldPos = rStrm.Tell();
- rStrm.Seek( nStart );
-
- sal_uInt16 nLen2;
- rStrm >> nLen2; // bVer67: total length of structure
- // bVer8 : count of strings
-
- if( bVer8 )
+ sal_Size nOldPos = rStrm.Tell();
+ if (checkSeek(rStrm, nStart))
{
- sal_uInt16 nStrings;
- bool bUnicode = (0xFFFF == nLen2);
- if( bUnicode )
- rStrm >> nStrings;
- else
- nStrings = nLen2;
+ sal_uInt16 nLen2(0);
+ rStrm >> nLen2; // bVer67: total length of structure
+ // bVer8 : count of strings
- rStrm >> nExtraLen;
-
- for( sal_uInt16 i=0; i < nStrings; i++ )
+ if( bVer8 )
{
- if( bUnicode )
- rArray.push_back(WW8Read_xstz(rStrm, 0, false));
+ sal_uInt16 nStrings(0);
+ bool bUnicode = (0xFFFF == nLen2);
+ if (bUnicode)
+ rStrm >> nStrings;
else
- {
- sal_uInt8 nBChar;
- rStrm >> nBChar;
- ByteString aTmp;
- SafeReadString(aTmp,nBChar,rStrm);
- rArray.push_back(String(aTmp, eCS));
- }
+ nStrings = nLen2;
+
+ rStrm >> nExtraLen;
- // Skip the extra data
- if( nExtraLen )
+ for (sal_uInt16 i=0; i < nStrings; ++i)
{
- if (pExtraArray)
+ if (bUnicode)
+ rArray.push_back(WW8Read_xstz(rStrm, 0, false));
+ else
+ {
+ sal_uInt8 nBChar(0);
+ rStrm >> nBChar;
+ ByteString aTmp;
+ SafeReadString(aTmp,nBChar,rStrm);
+ rArray.push_back(String(aTmp, eCS));
+ }
+
+ // Skip the extra data
+ if (nExtraLen)
{
- ww::bytes extraData;
- sal_uInt8 iTmp;
- for(int j = 0; j < nExtraLen; ++j)
+ if (pExtraArray)
{
- rStrm >> iTmp;
- extraData.push_back(iTmp);
+ ww::bytes extraData;
+ for (sal_uInt16 j = 0; j < nExtraLen; ++j)
+ {
+ sal_uInt8 iTmp(0);
+ rStrm >> iTmp;
+ extraData.push_back(iTmp);
+ }
+ pExtraArray->push_back(extraData);
}
- pExtraArray->push_back(extraData);
+ else
+ rStrm.SeekRel( nExtraLen );
}
- else
- rStrm.SeekRel( nExtraLen );
}
- }
- // read the value of the document variables, if requested.
- if (pValueArray)
- {
- for( sal_uInt16 i=0; i < nStrings; i++ )
+ // read the value of the document variables, if requested.
+ if (pValueArray)
+ {
+ for (sal_uInt16 i=0; i < nStrings; ++i)
{
- if( bUnicode )
- pValueArray->push_back(WW8Read_xstz(rStrm, 0, false));
- else
- {
- sal_uInt8 nBChar;
- rStrm >> nBChar;
- ByteString aTmp;
- SafeReadString(aTmp,nBChar,rStrm);
- pValueArray->push_back(String(aTmp, eCS));
- }
+ if( bUnicode )
+ pValueArray->push_back(WW8Read_xstz(rStrm, 0, false));
+ else
+ {
+ sal_uInt8 nBChar(0);
+ rStrm >> nBChar;
+ ByteString aTmp;
+ SafeReadString(aTmp,nBChar,rStrm);
+ pValueArray->push_back(String(aTmp, eCS));
+ }
}
+ }
}
- }
- else
- {
- sal_uInt8 nBChar;
- if( nLen2 != nLen )
- {
- OSL_ENSURE( nLen2 == nLen, "Fib length and read length are different" );
- if (nLen > USHRT_MAX)
- nLen = USHRT_MAX;
- else if (nLen < 2 )
- nLen = 2;
- nLen2 = static_cast<sal_uInt16>(nLen);
- }
- sal_uLong nRead = 0;
- for( nLen2 -= 2; nRead < nLen2; )
+ else
{
- rStrm >> nBChar; ++nRead;
- if (nBChar)
+ if( nLen2 != nLen )
{
- ByteString aTmp;
- nRead += SafeReadString(aTmp,nBChar,rStrm);
- rArray.push_back(String(aTmp, eCS));
+ OSL_ENSURE(nLen2 == nLen,
+ "Fib length and read length are different");
+ if (nLen > USHRT_MAX)
+ nLen = USHRT_MAX;
+ else if (nLen < 2 )
+ nLen = 2;
+ nLen2 = static_cast<sal_uInt16>(nLen);
}
- else
- rArray.push_back(aEmptyStr);
-
- // Skip the extra data (for bVer67 versions this must come from external knowledge)
- if (nExtraLen)
+ sal_uLong nRead = 0;
+ for( nLen2 -= 2; nRead < nLen2; )
{
- if (pExtraArray)
+ sal_uInt8 nBChar(0);
+ rStrm >> nBChar;
+ ++nRead;
+ if (nBChar)
+ {
+ ByteString aTmp;
+ nRead += SafeReadString(aTmp,nBChar,rStrm);
+ rArray.push_back(String(aTmp, eCS));
+ }
+ else
+ rArray.push_back(aEmptyStr);
+
+ // Skip the extra data (for bVer67 versions this must come from
+ // external knowledge)
+ if (nExtraLen)
{
- ww::bytes extraData;
- for(int i =0;i < nExtraLen;i++)
+ if (pExtraArray)
{
- sal_uInt8 iTmp;
- rStrm >> iTmp;
- extraData.push_back(iTmp);
+ ww::bytes extraData;
+ for (sal_uInt16 i=0;i < nExtraLen;++i)
+ {
+ sal_uInt8 iTmp(0);
+ rStrm >> iTmp;
+ extraData.push_back(iTmp);
+ }
+ pExtraArray->push_back(extraData);
}
- pExtraArray->push_back(extraData);
+ else
+ rStrm.SeekRel( nExtraLen );
+ nRead+=nExtraLen;
}
- else
- rStrm.SeekRel( nExtraLen );
- nRead+=nExtraLen;
}
}
}
- rStrm.Seek( nOldPos );
+ rStrm.Seek(nOldPos);
}
WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTblSt, const WW8Fib& rFib)
@@ -4025,7 +4138,7 @@ WW8PLCFx& WW8PLCFx_Book::operator ++( int )
{
if( pBook[0] && pBook[1] && nIMax )
{
- (*pBook[nIsEnd])++;
+ (*pBook[nIsEnd]).advance();
sal_uLong l0 = pBook[0]->Where();
sal_uLong l1 = pBook[1]->Where();
@@ -4277,7 +4390,7 @@ void WW8PLCFMan::GetNewNoSprms( WW8PLCFxDesc& rDesc )
sal_uInt16 WW8PLCFMan::GetId(const WW8PLCFxDesc* p) const
{
- sal_uInt16 nId;
+ sal_uInt16 nId = 0; // Id = 0 for empty attributes
if (p == pFld)
nId = eFLD;
@@ -4287,10 +4400,8 @@ sal_uInt16 WW8PLCFMan::GetId(const WW8PLCFxDesc* p) const
nId = eEDN;
else if (p == pAnd)
nId = eAND;
- else if (p->nSprmsLen > 0)
+ else if (p->nSprmsLen >= maSprmParser.MinSprmLen())
nId = maSprmParser.GetSprmId(p->pMemPos);
- else
- nId = 0; // Id = 0 for empty attributes
return nId;
}
@@ -4588,7 +4699,7 @@ void WW8PLCFMan::GetSprmStart( short nIdx, WW8PLCFManResult* pRes ) const
pRes->nCp2OrIdx = p->nCp2OrIdx;
if ((p == pFtn) || (p == pEdn) || (p == pAnd))
pRes->nMemLen = p->nSprmsLen;
- else if (p->nSprmsLen) //Normal
+ else if (p->nSprmsLen >= maSprmParser.MinSprmLen()) //Normal
{
// Length of actual sprm
pRes->nMemLen = maSprmParser.GetSprmSize(pRes->nSprmId, pRes->pMemPos);
@@ -5547,6 +5658,9 @@ WW8Fib::WW8Fib(sal_uInt8 nVer)
nProduct = 0xc02d;
}
+ //If nFib is 0x00D9 or greater, then cQuickSaves MUST be 0xF
+ cQuickSaves = nFib >= 0x00D9 ? 0xF : 0;
+
// --> #i90932#
lid = 0x409; // LANGUAGE_ENGLISH_US
@@ -5912,23 +6026,35 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
stiMaxWhenSaved(0), istdMaxFixedWhenSaved(0), nVerBuiltInNamesWhenSaved(0),
ftcAsci(0), ftcFE(0), ftcOther(0), ftcBi(0)
{
- nStyleStart = rFib.fcStshf;
- nStyleLen = rFib.lcbStshf;
-
- rSt.Seek(nStyleStart);
+ if (!checkSeek(rSt, rFib.fcStshf))
+ return;
sal_uInt16 cbStshi = 0; // 2 bytes size of the following STSHI structure
+ sal_uInt32 nRemaining = rFib.lcbStshf;
+ const sal_uInt32 nMinValidStshi = 4;
if (rFib.GetFIBVersion() <= ww::eWW2)
{
cbStshi = 0;
cstd = 256;
}
- else if (rFib.nFib < 67) // old Version ? (need to find this again to fix)
- cbStshi = 4; // -> Laengenfeld fehlt
- else // neue Version:
- // lies die Laenge der in der Datei gespeicherten Struktur
- rSt >> cbStshi;
+ else
+ {
+ if (rFib.nFib < 67) // old Version ? (need to find this again to fix)
+ cbStshi = nMinValidStshi;
+ else // new version
+ {
+ if (nRemaining < sizeof(cbStshi))
+ return;
+ // lies die Laenge der in der Datei gespeicherten Struktur
+ rSt >> cbStshi;
+ nRemaining-=2;
+ }
+ }
+
+ cbStshi = std::min(static_cast<sal_uInt32>(cbStshi), nRemaining);
+ if (cbStshi < nMinValidStshi)
+ return;
sal_uInt16 nRead = cbStshi;
do
@@ -5975,10 +6101,16 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
while( !this ); // Trick: obiger Block wird genau einmal durchlaufen
// und kann vorzeitig per "break" verlassen werden.
- if( 0 != rSt.GetError() )
- {
- // wie denn nun den Error melden?
- }
+ nRemaining -= cbStshi;
+
+ //There will be stshi.cstd (cbSTD, STD) pairs in the file following the
+ //STSHI. Note that styles can be empty, i.e. cbSTD == 0
+ const sal_uInt32 nMinRecordSize = sizeof(sal_uInt16);
+ sal_uInt16 nMaxPossibleRecords = nRemaining/nMinRecordSize;
+
+ OSL_ENSURE(cstd <= nMaxPossibleRecords,
+ "allegedly more styles that available data\n");
+ cstd = std::min(cstd, nMaxPossibleRecords);
}
// Read1STDFixed() liest ein Style ein. Wenn der Style vollstaendig vorhanden
@@ -5989,7 +6121,7 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
{
WW8_STD* pStd = 0;
- sal_uInt16 cbStd;
+ sal_uInt16 cbStd(0);
rSt >> cbStd; // lies Laenge
sal_uInt16 nRead = cbSTDBaseInFile;
@@ -6006,6 +6138,7 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
sal_uInt16 a16Bit;
if( 2 > nRead ) break;
+ a16Bit = 0;
rSt >> a16Bit;
pStd->sti = a16Bit & 0x0fff ;
pStd->fScratch = 0 != ( a16Bit & 0x1000 );
@@ -6014,20 +6147,24 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
pStd->fMassCopy = 0 != ( a16Bit & 0x8000 );
if( 4 > nRead ) break;
+ a16Bit = 0;
rSt >> a16Bit;
pStd->sgc = a16Bit & 0x000f ;
pStd->istdBase = ( a16Bit & 0xfff0 ) >> 4;
if( 6 > nRead ) break;
+ a16Bit = 0;
rSt >> a16Bit;
pStd->cupx = a16Bit & 0x000f ;
pStd->istdNext = ( a16Bit & 0xfff0 ) >> 4;
if( 8 > nRead ) break;
+ a16Bit = 0;
rSt >> pStd->bchUpe;
// ab Ver8 sollten diese beiden Felder dazukommen:
if(10 > nRead ) break;
+ a16Bit = 0;
rSt >> a16Bit;
pStd->fAutoRedef = a16Bit & 0x0001 ;
pStd->fHidden = ( a16Bit & 0x0002 ) >> 2;
@@ -6177,6 +6314,31 @@ void lcl_checkFontname( String& sString )
}
}
+namespace
+{
+ sal_uInt16 calcMaxFonts(sal_uInt8 *p, sal_Int32 nFFn)
+ {
+ // Figure out the max number of fonts defined here
+ sal_uInt16 nMax = 0;
+ sal_Int32 nRemaining = nFFn;
+ while (nRemaining)
+ {
+ //p[0] is cbFfnM1, the alleged total length of FFN - 1.
+ //i.e. length after cbFfnM1
+ sal_uInt16 cbFfnM1 = *p++;
+ --nRemaining;
+
+ if (cbFfnM1 > nRemaining)
+ break;
+
+ nMax++;
+ nRemaining -= cbFfnM1;
+ p += cbFfnM1;
+ }
+ return nMax;
+ }
+}
+
WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
: pFontA(0), nMax(0)
{
@@ -6185,19 +6347,17 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
if( rFib.lcbSttbfffn <= 2 )
{
OSL_ENSURE( !this, "Fonttabelle kaputt! (rFib.lcbSttbfffn < 2)" );
- pFontA = 0;
- nMax = 0;
return;
}
- rSt.Seek( rFib.fcSttbfffn );
+ if (!checkSeek(rSt, rFib.fcSttbfffn))
+ return;
sal_Int32 nFFn = rFib.lcbSttbfffn - 2;
// allocate Font Array
- sal_uInt8* pA = new sal_uInt8[ nFFn ];
+ sal_uInt8* pA = new sal_uInt8[nFFn];
memset(pA, 0, nFFn);
- WW8_FFN* p = (WW8_FFN*)pA;
ww::WordVersion eVersion = rFib.GetFIBVersion();
@@ -6213,37 +6373,26 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
rSt.SeekRel( 2 );
// read all font information
- nFFn = rSt.Read( pA, nFFn );
+ nFFn = rSt.Read(pA, nFFn);
+ sal_uInt16 nCalcMax = calcMaxFonts(pA, nFFn);
- if( eVersion < ww::eWW8 )
+ if (eVersion < ww::eWW8)
+ nMax = nCalcMax;
+ else
{
- // try to figure out how many fonts are defined here
- nMax = 0;
- long nLeft = nFFn;
- for(;;)
- {
- short nNextSiz;
-
- nNextSiz = p->cbFfnM1 + 1;
- if( nNextSiz > nLeft )
- break;
- nMax++;
- nLeft -= nNextSiz;
- if( nLeft < 1 ) // can we read the given ammount of bytes ?
- break;
- // increase p by nNextSiz Bytes
- p = (WW8_FFN *)( ( (sal_uInt8*)p ) + nNextSiz );
- }
+ //newer versions include purportive count of fonts, so take min of that
+ //and calced max
+ nMax = std::min(nMax, nCalcMax);
}
if( nMax )
{
// allocate Index Array
pFontA = new WW8_FFN[ nMax ];
- p = pFontA;
+ WW8_FFN* p = pFontA;
- if( eVersion <= ww::eWW2 )
- {
+ if( eVersion <= ww::eWW2 )
+ {
WW8_FFN_BASE* pVer2 = (WW8_FFN_BASE*)pA;
for(sal_uInt16 i=0; i<nMax; ++i, ++p)
{
@@ -6255,7 +6404,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
p->wWeight = ( *(((sal_uInt8*)pVer2) + 1) );
p->chs = ( *(((sal_uInt8*)pVer2) + 2) );
- /*
+ /*
#i8726# 7- seems to encode the name in the same encoding as
the font, e.g load the doc in 97 and save to see the unicode
ver of the asian fontnames in that example to confirm.
@@ -6267,7 +6416,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
p->sFontname = String ( (((const sal_Char*)pVer2) + 1 + 2), eEnc);
pVer2 = (WW8_FFN_BASE*)( ((sal_uInt8*)pVer2) + pVer2->cbFfnM1 + 1 );
}
- }
+ }
else if( eVersion < ww::eWW8 )
{
WW8_FFN_Ver6* pVer6 = (WW8_FFN_Ver6*)pA;
@@ -6315,48 +6464,80 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
}
else
{
- WW8_FFN_Ver8* pVer8 = (WW8_FFN_Ver8*)pA;
- sal_uInt8 c2;
- for(sal_uInt16 i=0; i<nMax; ++i, ++p)
+ //count of bytes in minimum FontFamilyInformation payload
+ const sal_uInt8 cbMinFFNPayload = 41;
+ sal_uInt16 nValidFonts = 0;
+ sal_Int32 nRemainingFFn = nFFn;
+ sal_uInt8* pRaw = pA;
+ for (sal_uInt16 i=0; i < nMax && nRemainingFFn; ++i, ++p)
{
- p->cbFfnM1 = pVer8->cbFfnM1;
- c2 = *(((sal_uInt8*)pVer8) + 1);
+ //pRaw[0] is cbFfnM1, the alleged total length of FFN - 1
+ //i.e. length after cbFfnM1
+ sal_uInt8 cbFfnM1 = *pRaw++;
+ --nRemainingFFn;
- p->prg = c2 & 0x02;
+ if (cbFfnM1 > nRemainingFFn)
+ break;
+
+ if (cbFfnM1 < cbMinFFNPayload)
+ break;
+
+ p->cbFfnM1 = cbFfnM1;
+
+ sal_uInt8 *pVer8 = pRaw;
+
+ sal_uInt8 c2 = *pVer8++;
+ --cbFfnM1;
+
+ p->prg = c2 & 0x02;
p->fTrueType = (c2 & 0x04) >> 2;
// ein Reserve-Bit ueberspringen
- p->ff = (c2 & 0x70) >> 4;
+ p->ff = (c2 & 0x70) >> 4;
- p->wWeight = SVBT16ToShort( *(SVBT16*)&pVer8->wWeight );
- p->chs = pVer8->chs;
- p->ibszAlt = pVer8->ibszAlt;
+ p->wWeight = SVBT16ToShort(*(SVBT16*)pVer8);
+ pVer8+=2;
+ cbFfnM1-=2;
-#ifdef __WW8_NEEDS_COPY
- {
- sal_uInt8 nLen = 0x28;
- sal_uInt8 nLength = sizeof( pVer8->szFfn ) / sizeof( SVBT16 );
- nLength = std::min( nLength, sal_uInt8( pVer8->cbFfnM1+1 ) );
- for( sal_uInt16* pTmp = pVer8->szFfn;
- nLen < nLength; ++pTmp, nLen+=2 )
- {
- *pTmp = SVBT16ToShort( *(SVBT16*)pTmp );
- }
- }
-#endif // defined __WW8_NEEDS_COPY
+ p->chs = *pVer8++;
+ --cbFfnM1;
- p->sFontname = pVer8->szFfn;
- if (p->ibszAlt)
+ p->ibszAlt = *pVer8++;
+ --cbFfnM1;
+
+ pVer8 += 10; //PANOSE
+ cbFfnM1-=10;
+ pVer8 += 24; //FONTSIGNATURE
+ cbFfnM1-=24;
+
+ OSL_ASSERT(cbFfnM1 >= 2);
+
+ sal_uInt8 nMaxNullTerminatedPossible = cbFfnM1/2 - 1;
+ sal_Unicode *pPrimary = reinterpret_cast<sal_Unicode*>(pVer8);
+ pPrimary[nMaxNullTerminatedPossible] = 0;
+#ifdef OSL_BIGENDIAN
+ swapEndian(pPrimary);
+#endif
+ p->sFontname = pPrimary;
+ if (p->ibszAlt && p->ibszAlt < nMaxNullTerminatedPossible)
{
p->sFontname.Append(';');
- p->sFontname.Append(pVer8->szFfn+p->ibszAlt);
+ sal_Unicode *pSecondary = pPrimary + p->ibszAlt;
+#ifdef OSL_BIGENDIAN
+ swapEndian(pSecondary);
+#endif
+ p->sFontname.Append(pSecondary);
}
// #i43762# check font name for illegal characters
lcl_checkFontname( p->sFontname );
// Zeiger auf Ursprungsarray einen Font nach hinten setzen
- pVer8 = (WW8_FFN_Ver8*)( ((sal_uInt8*)pVer8) + pVer8->cbFfnM1 + 1 );
+ pRaw += p->cbFfnM1;
+ nRemainingFFn -= p->cbFfnM1;
+ ++nValidFonts;
}
+ OSL_ENSURE(nMax == nValidFonts, "Font count differs with availability");
+ nMax = std::min(nMax, nValidFonts);
}
}
delete[] pA;
@@ -6389,7 +6570,7 @@ const WW8_FFN* WW8Fonts::GetFont( sal_uInt16 nNum ) const
// -> dann liefert GetTextPos() vielleicht auch ein richtiges Ergebnis
WW8PLCF_HdFt::WW8PLCF_HdFt( SvStream* pSt, WW8Fib& rFib, WW8Dop& rDop )
- : aPLCF( pSt, rFib.fcPlcfhdd , rFib.lcbPlcfhdd , 0 )
+ : aPLCF(*pSt, rFib.fcPlcfhdd , rFib.lcbPlcfhdd , 0)
{
nIdxOffset = 0;
@@ -7278,6 +7459,31 @@ sal_uInt16 wwSprmParser::DistanceToData(sal_uInt16 nId) const
return 1 + mnDelta + SprmDataOfs(nId);
}
+sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms,
+ sal_uInt16 nLen) const
+{
+ while (nLen >= MinSprmLen())
+ {
+ sal_uInt16 nAktId = GetSprmId(pSprms);
+ // gib Zeiger auf Daten
+ sal_uInt16 nSize = GetSprmSize(nAktId, pSprms);
+
+ bool bValid = nSize <= nLen;
+
+ OSL_ENSURE(bValid, "sprm longer than remaining bytes");
+
+ if (nAktId == nId && bValid) // Sprm found
+ return pSprms + DistanceToData(nId);
+
+ //Clip to available size if wrong
+ nSize = std::min(nSize, nLen);
+ pSprms += nSize;
+ nLen -= nSize;
+ }
+ // Sprm not found
+ return 0;
+}
+
SEPr::SEPr() :
bkc(2), fTitlePage(0), fAutoPgn(0), nfcPgn(0), fUnlocked(0), cnsPgn(0),
fPgnRestart(0), fEndNote(1), lnc(0), grpfIhdt(0), nLnnMod(0), dxaLnn(0),
@@ -7296,4 +7502,22 @@ SEPr::SEPr() :
memset(rgdxaColumnWidthSpacing, 0, sizeof(rgdxaColumnWidthSpacing));
}
+bool checkSeek(SvStream &rSt, sal_uInt32 nOffset)
+{
+ return (rSt.Seek(nOffset) == static_cast<sal_Size>(nOffset));
+}
+
+bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
+{
+ return (rSt.Read(pDest, nLength) == static_cast<sal_Size>(nLength));
+}
+
+#ifdef OSL_BIGENDIAN
+void swapEndian(sal_Unicode *pString)
+{
+ for (sal_Unicode *pWork = pString; *pWork; ++pWork)
+ *pWork = SWAPSHORT(*pWork);
+}
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 96300f4fbe5a..f02ddeccd2b1 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -145,7 +145,10 @@ public:
/// The minimum acceptable sprm len possible for this type of parser
int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; }
- inline int getVersion() const { return meVersion; } //cmc, I'm dubious about the usage of this, how can it be 0
+ /// Returns the offset to data of the first sprm of id nId, 0
+ // if not found. nLen must be the <= length of pSprms
+ sal_uInt8* findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen)
+ const;
};
//--Line abovewhich the code has meaningful comments
@@ -213,10 +216,10 @@ private:
sal_uInt8* pPLCF_Contents; ///< Pointer auf Inhalts-Array-Teil des Pos-Array
long nIMax; ///< Anzahl der Elemente
long nIdx; ///< Merker, wo wir gerade sind
- long nStru;
+ sal_uInt32 nStru;
public:
- WW8PLCFspecial( SvStream* pSt, long nFilePos, long nPLCF,
- long nStruct, long nStartPos = -1 );
+ WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
+ sal_uInt32 nStruct);
~WW8PLCFspecial() { delete[] pPLCF_PosArray; }
long GetIdx() const { return nIdx; }
void SetIdx( long nI ) { nIdx = nI; }
@@ -237,8 +240,11 @@ public:
sal_Int32 GetPos( long nInIdx ) const
{ return ( nInIdx >= nIMax ) ? SAL_MAX_INT32 : pPLCF_PosArray[nInIdx]; }
- WW8PLCFspecial& operator ++( int ) { nIdx++; return *this; }
- WW8PLCFspecial& operator --( int ) { nIdx--; return *this; }
+ void advance()
+ {
+ if (nIdx <= nIMax)
+ ++nIdx;
+ }
};
/** simple Iterator for SPRMs */
@@ -281,24 +287,24 @@ private:
sal_Int32 nIdx;
int nStru;
- void ReadPLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF );
+ void ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF);
/*
Falls im Dok ein PLC fehlt und die FKPs solo dastehen,
machen wir uns hiermit einen PLC:
*/
- void GeneratePLCF( SvStream* pSt, sal_Int32 nPN, sal_Int32 ncpN );
+ void GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN);
void MakeFailedPLCF();
public:
- WW8PLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
- WW8_CP nStartPos = -1 );
+ WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
+ WW8_CP nStartPos = -1);
/*
folgender Ctor generiert ggfs. einen PLC aus nPN und ncpN
*/
- WW8PLCF( SvStream* pSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
- WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN );
+ WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
+ WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN);
~WW8PLCF(){ delete[] pPLCF_PosArray; }
sal_Int32 GetIdx() const { return nIdx; }
@@ -323,9 +329,10 @@ friend class WW8PLCFpcd_Iter;
sal_Int32* pPLCF_PosArray; // Pointer auf Pos-Array und auf ganze Struktur
sal_uInt8* pPLCF_Contents; // Pointer auf Inhalts-Array-Teil des Pos-Array
long nIMax;
- long nStru;
+ sal_uInt32 nStru;
public:
- WW8PLCFpcd( SvStream* pSt, long nFilePos, long nPLCF, long nStruct );
+ WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
+ sal_uInt32 nStruct);
~WW8PLCFpcd(){ delete[] pPLCF_PosArray; }
};
@@ -501,6 +508,9 @@ public:
sal_uInt8 mnIMax; // Anzahl der Eintraege
wwSprmParser maSprmParser;
+
+ //Fill in an Entry with sanity testing
+ void FillEntry(Entry &rEntry, sal_Size nDataOffset, sal_uInt16 nLen);
public:
WW8Fkp (ww::WordVersion eVersion, SvStream* pFKPStrm,
SvStream* pDataStrm, long _nFilePos, long nItemSiz, ePLCFT ePl,
@@ -921,7 +931,7 @@ friend class SwWW8FltControlStack;
#endif
private:
- const WW8Fib* pWw8Fib;
+ WW8Fib* pWw8Fib;
WW8PLCFx_Cp_FKP* pChpPLCF; // Character-Attrs
WW8PLCFx_Cp_FKP* pPapPLCF; // Para-Attrs
WW8PLCFx_SEPX* pSepPLCF; // Section-Attrs
@@ -957,7 +967,7 @@ private:
void DeletePieceTable();
public:
WW8ScannerBase( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
- const WW8Fib* pWwF );
+ WW8Fib* pWwF );
~WW8ScannerBase();
bool AreThereFootnotes() const { return pFtnPLCF->Count() > 0; };
bool AreThereEndnotes() const { return pEdnPLCF->Count() > 0; };
@@ -1451,8 +1461,6 @@ class WW8Style
protected:
WW8Fib& rFib;
SvStream& rSt;
- long nStyleStart;
- long nStyleLen;
sal_uInt16 cstd; // Count of styles in stylesheet
sal_uInt16 cbSTDBaseInFile; // Length of STD Base as stored in a file
@@ -1775,11 +1783,18 @@ std::vector<sal_uInt8> ChpxToSprms(const Word2CHPX &rChpx);
sal_uLong SafeReadString(ByteString &rStr,sal_uInt16 nLen,SvStream &rStrm);
+bool checkSeek(SvStream &rSt, sal_uInt32 nOffset);
+bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength);
+
//MS has a (slightly) inaccurate view of how many twips
//are in the default letter size of a page
const sal_uInt16 lLetterWidth = 12242;
const sal_uInt16 lLetterHeight = 15842;
+#ifdef OSL_BIGENDIAN
+void swapEndian(sal_Unicode *pString);
+#endif
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 66c6feab5b33..57fd027b81bd 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -237,13 +237,20 @@ bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
{
for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
{
- uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
- CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
- helper.setMSOCommandMap( new MSOWordCommandConvertor() );
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
+ helper.setMSOCommandMap( new MSOWordCommandConvertor() );
- if ( !(*it).ImportCustomToolBar( *this, helper ) )
- return false;
+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
+ return false;
+ }
+ catch(...)
+ {
+ continue;
+ }
}
return false;
}
@@ -906,12 +913,13 @@ bool Tcg255::Read(SvStream *pS)
{
OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
nOffSet = pS->Tell();
- sal_uInt8 nId = 0; //
+ sal_uInt8 nId = 0x40;
*pS >> nId;
while ( nId != 0x40 )
{
if ( !processSubStruct( nId, pS ) )
return false;
+ nId = 0x40;
*pS >> nId;
}
return true;
@@ -948,9 +956,10 @@ bool Tcg255SubStruct::Read(SvStream *pS)
return true;
}
-PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), iMac(0), rgmcd( NULL )
{
}
+
PlfMcd::~PlfMcd()
{
if ( rgmcd )
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 5e5795efee24..7faeaa942494 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -82,7 +82,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport,
const SvXMLUnitConverter& rUnitConverter,
const SvXMLNamespaceMap& rNamespaceMap,
sal_uInt16 nFlags,
- SvUShorts* pIndexArray ) const
+ std::vector<sal_uInt16> *pIndexArray ) const
{
const sal_uInt16 nCount = mrMapEntries->getCount();
sal_uInt16 nIndex = 0;
@@ -104,7 +104,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport,
// element items do not add any properties,
// we export it later
if( pIndexArray )
- pIndexArray->Insert( nIndex, pIndexArray->Count() );
+ pIndexArray->push_back( nIndex );
}
else
@@ -240,14 +240,14 @@ void SvXMLExportItemMapper::exportElementItems(
const SvXMLUnitConverter& rUnitConverter,
const SfxItemSet &rSet,
sal_uInt16 nFlags,
- const SvUShorts& rIndexArray ) const
+ const std::vector<sal_uInt16> &rIndexArray ) const
{
- const sal_uInt16 nCount = rIndexArray.Count();
+ const sal_uInt16 nCount = rIndexArray.size();
sal_Bool bItemsExported = sal_False;
for( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
{
- const sal_uInt16 nElement = rIndexArray.GetObject( nIndex );
+ const sal_uInt16 nElement = rIndexArray[ nIndex ];
SvXMLItemMapEntry* pEntry = mrMapEntries->getByIndex( nElement );
OSL_ENSURE( 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT),
"wrong mid flag!" );
@@ -313,14 +313,14 @@ void SvXMLExportItemMapper::exportXML( SvXMLExport& rExport,
XMLTokenEnum ePropToken,
sal_uInt16 nFlags ) const
{
- SvUShorts aIndexArray;
+ std::vector<sal_uInt16> aIndexArray;
exportXML( rExport, rExport.GetAttrList(), rSet, rUnitConverter,
rExport.GetNamespaceMap(), nFlags, &aIndexArray );
if( rExport.GetAttrList().getLength() > 0L ||
(nFlags & XML_EXPORT_FLAG_EMPTY) != 0 ||
- aIndexArray.Count() != 0 )
+ !aIndexArray.empty() )
{
if( (nFlags & XML_EXPORT_FLAG_IGN_WS) != 0 )
{
diff --git a/sw/source/filter/xml/xmlexpit.hxx b/sw/source/filter/xml/xmlexpit.hxx
index 108d8a50f0bf..f08a64f3cd71 100644
--- a/sw/source/filter/xml/xmlexpit.hxx
+++ b/sw/source/filter/xml/xmlexpit.hxx
@@ -32,6 +32,7 @@
#include <tools/solar.h>
#include <tools/ref.hxx>
#include "xmlitmap.hxx"
+#include <vector>
#define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
#define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
@@ -46,7 +47,6 @@ class SfxPoolItem;
class SfxItemSet;
class SvXMLAttributeList;
class SvXMLNamespaceMap;
-class SvUShorts;
class SvXMLExport;
@@ -62,7 +62,7 @@ protected:
const SvXMLUnitConverter& rUnitConverter,
const SvXMLNamespaceMap& rNamespaceMap,
sal_uInt16 nFlags,
- SvUShorts* pIndexArray ) const;
+ std::vector<sal_uInt16> *pIndexArray ) const;
void exportXML( const SvXMLExport& rExport,
SvXMLAttributeList& rAttrList,
@@ -78,7 +78,7 @@ protected:
const SvXMLUnitConverter& rUnitConverter,
const SfxItemSet &rSet,
sal_uInt16 nFlags,
- const SvUShorts& rIndexArray ) const;
+ const std::vector<sal_uInt16> &rIndexArray ) const;
static const SfxPoolItem* GetItem( const SfxItemSet &rSet,
sal_uInt16 nWhichId,
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 7973181095a5..f47c9df7c9a0 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1442,26 +1442,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
OUString( RTL_CONSTASCII_USTRINGPARAM("SmallCapsPercentage66") ), makeAny( true ) );
}
- // Old LO versions had 66 as the value for small caps percentage, later changed to 80.
- // In order to keep backwards compatibility, SmallCapsPercentage66 option is written to .odt
- // files, and the default for new documents is 'false'. Files without this option
- // are considered to be old files, so set the compatibility option too.
- if ( !bSmallCapsPercentage66 )
- {
- xProps->setPropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM("SmallCapsPercentage66") ), makeAny( true ) );
- }
-
- // Old LO versions had 66 as the value for small caps percentage, later changed to 80.
- // In order to keep backwards compatibility, SmallCapsPercentage66 option is written to .odt
- // files, and the default for new documents is 'false'. Files without this option
- // are considered to be old files, so set the compatibility option too.
- if ( !bSmallCapsPercentage66 )
- {
- xProps->setPropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM("SmallCapsPercentage66") ), makeAny( true ) );
- }
-
Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
Reference < XText > xText = xTextDoc->getText();
Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 0646b1b19f0a..e85a5206d7be 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -506,7 +506,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
if ( bIsOwnLink )
sURL = xLinkage->getLinkURL();
}
- catch( uno::Exception )
+ catch(const uno::Exception&)
{
// TODO/LATER: error handling
OSL_FAIL( "Link detection or retrieving of the URL of OOo link is failed!\n" );
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 094d38bf372f..7736c575c081 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -410,6 +410,16 @@ String STR_EMPTYPAGE
Text [ en-US ] = "blank page" ;
};
+String STR_HEADER
+{
+ Text [ en-US ] = "Header: " ;
+};
+
+String STR_FOOTER
+{
+ Text [ en-US ] = "Footer: " ;
+};
+
QueryBox MSG_CLPBRD_CLEAR
{
BUTTONS = WB_YES_NO ;
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index c180168913fc..3101b11f893b 100755
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -830,7 +830,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
bool bError = false;
- // catch expception if wrong filter is selected - should not happen anymore
+ // catch exception if wrong filter is selected - should not happen anymore
try
{
xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() );
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 4d58c56e3594..182b7e137604 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -862,7 +862,6 @@ Menu MN_TAB_POPUPMENU
};
#define MN_WRAP_CONTOUR_1 MN_WRAP_CONTOUR
-#define MN_EDIT_CONTOUR_1 MN_EDIT_CONTOUR
#define MN_MOUSE_FRAME_BEGIN \
MenuItem\
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index 2d5acfa0c9a4..30acbbc80ad8 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -32,7 +32,6 @@
#include <tools/stream.hxx>
#include <unotools/syslocale.hxx>
-#include <svl/cjkoptions.hxx>
#include "swtypes.hxx"
#include "hintids.hxx"
@@ -74,17 +73,8 @@ SwMasterUsrPref::SwMasterUsrPref(sal_Bool bWeb) :
bApplyCharUnit(sal_False)
{
MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
- SvtCJKOptions aCJKOptions;
eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
- sal_Bool bCJKEnabled = aCJKOptions.IsAsianTypographyEnabled();
- bApplyCharUnit = bCJKEnabled;
- eHScrollMetric = bApplyCharUnit ? FUNIT_CHAR : eUserMetric;
- eVScrollMetric = bApplyCharUnit ? FUNIT_LINE : eUserMetric;
-
- bIsHScrollMetricSet = bApplyCharUnit;
- bIsVScrollMetricSet = bApplyCharUnit;
-
aContentConfig.Load();
aLayoutConfig.Load();
aGridConfig.Load();
@@ -260,7 +250,7 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
"Window/IsVerticalRulerRight", //16
"ViewLayout/Columns", //17
"ViewLayout/BookMode", //18
- "Other/IsSquaredPageMode" //19
+ "Other/IsSquaredPageMode", //19
"Other/ApplyCharUnit" //20
};
const int nCount = bWeb ? 15 : 21;
@@ -325,7 +315,7 @@ void SwLayoutViewConfig::Commit()
case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns",
case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
- case 20: rVal <<= (sal_Bool) rParent.IsApplyCharUnit(); break; // "Other/IsSquaredPageMode",
+ case 20: rVal <<= (sal_Bool) rParent.IsApplyCharUnit(); break; // "Other/ApplyCharUnit",
}
}
PutProperties(aNames, aValues);
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index d6b30b74a668..5ee9fca2f9c0 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -188,7 +188,7 @@ bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultS
if( aCount >>= rCount )
return true;
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -282,7 +282,7 @@ sal_Bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos)
OSL_FAIL("no absolute positioning available");
}
}
- catch(Exception aExcept)
+ catch(const Exception&)
{
}
return bRet;
@@ -297,7 +297,7 @@ sal_Bool lcl_GetColumnCnt(SwDSParam* pParam,
{
xCols = xColsSupp->getColumns();
}
- catch( lang::DisposedException& )
+ catch(const lang::DisposedException&)
{
}
if(!xCols.is() || !xCols->hasByName(rColumnName))
@@ -377,7 +377,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
if(xComponent.is())
xComponent->addEventListener(pImpl->xDisposeListener);
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -403,7 +403,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
pImpl->pMergeData->CheckEndOfDB();
}
}
- catch(Exception&)
+ catch(const Exception&)
{
pImpl->pMergeData->bEndOfDB = sal_True;
pImpl->pMergeData->CheckEndOfDB();
@@ -744,7 +744,7 @@ SwNewDBMgr::~SwNewDBMgr()
if(xComp.is())
xComp->dispose();
}
- catch(const RuntimeException& )
+ catch(const RuntimeException&)
{
//may be disposed already since multiple entries may have used the same connection
}
@@ -1427,7 +1427,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( const String& rDBName,
{
xCols = xColsSupp->getColumns();
}
- catch(Exception&)
+ catch(const Exception&)
{
OSL_FAIL("Exception in getColumns()");
}
@@ -1524,7 +1524,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource,
}
}
}
- catch( const Exception& )
+ catch(const Exception&)
{
OSL_FAIL("no FormatKey property found");
}
@@ -1595,7 +1595,9 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData
xConnection = xComplConnection->connectWithCompletion( xHandler );
}
}
- catch(Exception&) {}
+ catch(const Exception&)
+ {
+ }
return xConnection;
}
@@ -1641,7 +1643,7 @@ uno::Reference< sdbcx::XColumnsSupplier> SwNewDBMgr::GetColumnSupplier(uno::Refe
xRowSet->execute();
xRet = Reference<XColumnsSupplier>( xRowSet, UNO_QUERY );
}
- catch( const uno::Exception& )
+ catch(const uno::Exception&)
{
OSL_FAIL("Exception in SwDBMgr::GetColumnSupplier");
}
@@ -1671,7 +1673,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps,
{
sRet = xColumn->getString();
}
- catch( SQLException& )
+ catch(const SQLException&)
{
}
break;
@@ -1708,7 +1710,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps,
}
}
}
- catch(Exception& )
+ catch(const Exception&)
{
OSL_FAIL("exception caught");
}
@@ -1800,7 +1802,7 @@ sal_Bool SwNewDBMgr::GetColumnCnt(const String& rSourceName, const String& rTabl
{
nOldRow = pFound->xResultSet->getRow();
}
- catch(const Exception& )
+ catch(const Exception&)
{
return sal_False;
}
@@ -1895,7 +1897,7 @@ sal_Bool SwNewDBMgr::ToNextRecord(SwDSParam* pParam)
++pParam->nSelectionIndex;
}
}
- catch(Exception&)
+ catch(const Exception&)
{
}
return bRet;
@@ -1921,7 +1923,7 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId()
{
nRet = pImpl->pMergeData->xResultSet->getRow();
}
- catch(Exception& )
+ catch(const Exception&)
{
}
return nRet;
@@ -1975,7 +1977,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa
pFound->bScrollable = xMetaData
->supportsResultSetType((sal_Int32)ResultSetType::SCROLL_INSENSITIVE);
}
- catch(Exception&)
+ catch(const Exception&)
{
// DB driver may not be ODBC 3.0 compliant
pFound->bScrollable = sal_True;
@@ -1995,7 +1997,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa
pFound->CheckEndOfDB();
++pFound->nSelectionIndex;
}
- catch (Exception&)
+ catch (const Exception&)
{
pFound->xResultSet = 0;
pFound->xStatement = 0;
@@ -2018,7 +2020,7 @@ uno::Reference< XConnection> SwNewDBMgr::RegisterConnection(rtl::OUString& rData
if(xComponent.is())
xComponent->addEventListener(pImpl->xDisposeListener);
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -2057,7 +2059,9 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId(
else
nRet = pFound->xResultSet->getRow();
}
- catch(Exception&){}
+ catch(const Exception&)
+ {
+ }
}
}
return nRet;
@@ -2082,7 +2086,7 @@ void SwNewDBMgr::CloseAll(sal_Bool bIncludingMerge)
if(!bInMerge && pParam->xResultSet.is())
pParam->xResultSet->first();
}
- catch(Exception& )
+ catch(const Exception&)
{}
}
}
@@ -2129,7 +2133,7 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
if(xComponent.is())
xComponent->addEventListener(pImpl->xDisposeListener);
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -2166,7 +2170,7 @@ SwDSParam* SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
if(xComponent.is())
xComponent->addEventListener(pImpl->xDisposeListener);
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -2377,7 +2381,7 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
xNaming->registerObject( sFind, xNewInstance );
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -2459,9 +2463,8 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
sTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName() );
xStore->storeToURL( sTempURL, aValues );
}
- catch( const uno::Exception& rEx )
+ catch(const uno::Exception&)
{
- (void) rEx;
}
if( xDocShell->GetError() )
{
@@ -2507,7 +2510,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
//! I.e. now that object is responsible for closing the model and doc shell.
xClose->close( sal_True );
}
- catch ( const uno::Exception& )
+ catch (const uno::Exception&)
{
}
}
@@ -2535,7 +2538,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
if(xComp.is())
xComp->dispose();
}
- catch(const RuntimeException& )
+ catch(const RuntimeException&)
{
//may be disposed already since multiple entries may have used the same connection
}
@@ -2608,7 +2611,7 @@ void SwNewDBMgr::InsertText(SwWrtShell& rSh,
{
pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet);
}
- catch(Exception& )
+ catch(const Exception&)
{
OSL_FAIL("exception caught");
}
@@ -2721,7 +2724,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
pImpl->pMergeData->CheckEndOfDB();
}
}
- catch(Exception&)
+ catch(const Exception&)
{
pImpl->pMergeData->bEndOfDB = sal_True;
pImpl->pMergeData->CheckEndOfDB();
@@ -2945,9 +2948,8 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
pTargetShell->SttDoc();
}
- catch( Exception& rEx)
+ catch(const Exception&)
{
- (void)rEx;
OSL_FAIL("exception caught in SwNewDBMgr::MergeDocuments");
}
DELETEZ(pImpl->pMergeData);
diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx
index c5146db13c4a..089ccbff6666 100644
--- a/sw/source/ui/dbui/mailmergechildwindow.cxx
+++ b/sw/source/ui/dbui/mailmergechildwindow.cxx
@@ -115,10 +115,10 @@ IMPL_LINK( SwMailMergeChildWin, BackHdl, ToolBox *, EMPTYARG )
return 0;
}
-void SwMailMergeChildWin::FillInfo(SfxChildWinInfo& rInfo) const
+void SwMailMergeChildWin::FillInfo(SfxChildWinInfo& rInfo) const
{
SfxFloatingWindow::FillInfo(rInfo);
- rInfo.aWinState.Erase();
+ rInfo.aWinState = rtl::OString();
rInfo.bVisible = sal_False;
}
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index a7f86a6b6a0e..1f4a398b7f1f 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1252,6 +1252,8 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
void SwEditWin::KeyInput(const KeyEvent &rKEvt)
{
+ SwWrtShell &rSh = rView.GetWrtShell();
+
if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
pApplyTempl && pApplyTempl->pFormatClipboard )
{
@@ -1259,6 +1261,11 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
SetApplyTemplate(SwApplyTemplate());
rView.GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
}
+ else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
+ rSh.IsHeaderFooterEdit( ) )
+ {
+ rSh.ToggleHeaderFooterEdit();
+ }
SfxObjectShell *pObjSh = (SfxObjectShell*)rView.GetViewFrame()->GetObjectShell();
if ( bLockInput || (pObjSh && pObjSh->GetProgress()) )
@@ -1270,7 +1277,6 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
delete pShadCrsr, pShadCrsr = 0;
aKeyInputFlushTimer.Stop();
- SwWrtShell &rSh = rView.GetWrtShell();
sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
rSh.IsCrsrReadonly();
@@ -2596,6 +2602,16 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+ sal_Bool bOverHdrFtr = rSh.IsOverHeaderFooterPos( aDocPos );
+ if ( ( rSh.IsHeaderFooterEdit( ) && !bOverHdrFtr ) ||
+ ( !rSh.IsHeaderFooterEdit() && bOverHdrFtr ) )
+ {
+ if ( rMEvt.GetButtons() == MOUSE_LEFT && rMEvt.GetClicks( ) == 2 )
+ rSh.SwCrsrShell::SetCrsr( aDocPos );
+
+ return;
+ }
+
if ( IsChainMode() )
{
SetChainMode( sal_False );
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index afad6894d20f..f4900be44a48 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -150,8 +150,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
{
- sal_uInt16 nStyle = 0; // style of quick help
- switch( aCntntAtPos.eCntntAtPos )
+ sal_uInt16 nStyle = 0; // style of quick help
+ switch( aCntntAtPos.eCntntAtPos )
{
case SwContentAtPos::SW_TABLEBOXFML:
sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "= " ));
@@ -160,10 +160,9 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
#if OSL_DEBUG_LEVEL > 1
case SwContentAtPos::SW_TABLEBOXVALUE:
{
- sTxt = UniString(
- ByteString::CreateFromDouble(
- ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue() )
- , gsl_getSystemTextEncoding());
+ sTxt = rtl::OStringToOUString(rtl::OString::valueOf(
+ ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue()),
+ gsl_getSystemTextEncoding());
}
break;
case SwContentAtPos::SW_CURR_ATTRS:
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 86ddf85552d8..e127d095abdd 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -412,7 +412,7 @@ IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG )
aTypeBox.Clear();
aHiddenSortTypeBox.Clear();
- GetParent()->TypeIds().Remove( 0, GetParent()->TypeIds().Count() );
+ GetParent()->TypeIds().clear();
const String aMake = aMakeBox.GetSelectEntry();
GetParent()->ReplaceGroup( aMake );
@@ -443,9 +443,9 @@ IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG )
}
if(bInsert)
{
- GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count());
+ GetParent()->TypeIds().push_back(i);
if ( !nLstType && aType == String(aItem.aLstType) )
- nLstType = GetParent()->TypeIds().Count();
+ nLstType = GetParent()->TypeIds().size();
}
}
for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++)
diff --git a/sw/source/ui/inc/label.hxx b/sw/source/ui/inc/label.hxx
index 8a23e1e845ce..430d0e500fa7 100644
--- a/sw/source/ui/inc/label.hxx
+++ b/sw/source/ui/inc/label.hxx
@@ -30,12 +30,13 @@
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_STRINGSDTOR
-#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
#endif
#include <sfx2/tabdlg.hxx>
#include <com/sun/star/frame/XModel.hpp>
#include <labelcfg.hxx>
+#include <vector>
+
class SwLabRec;
class SwLabRecs;
class SwLabItem;
@@ -49,7 +50,7 @@ class SwLabDlg : public SfxTabDialog
SwNewDBMgr* pNewDBMgr;
SwLabPrtPage* pPrtPage;
- SvUShorts aTypeIds;
+ std::vector<sal_uInt16> aTypeIds;
SvStringsDtor aMakes;
SwLabRecs* pRecs;
@@ -73,8 +74,8 @@ public:
SwLabRecs &Recs() { return *pRecs; }
const SwLabRecs &Recs() const { return *pRecs; }
- SvUShorts &TypeIds() { return aTypeIds; }
- const SvUShorts &TypeIds() const { return aTypeIds; }
+ std::vector<sal_uInt16> &TypeIds() { return aTypeIds; }
+ const std::vector<sal_uInt16> &TypeIds() const { return aTypeIds; }
SvStringsDtor &Makes() { return aMakes; }
const SvStringsDtor &Makes() const { return aMakes; }
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 3fa31bb69d44..6e64655f3bad 100755
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -283,8 +283,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
bInDtor : 1, //detect destructor to prevent creating of sub shells while closing
bOldShellWasPagePreView : 1,
bIsPreviewDoubleClick : 1, // #i114045#
- bMakeSelectionVisible : 1 // transport the bookmark selection
- ;
+ bMakeSelectionVisible : 1; // transport the bookmark selection
// methods for searching
// set search context
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 3253f2c42549..10f12eee823f 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -146,11 +146,10 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
aPrintCB.SetClickHdl(aModifyLk);
aRubyBelowCB.SetClickHdl(aModifyLk);
-
aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
XColorTable& rColorTbl = XColorTable::GetStdColorTable();
- aColorLB.InsertAutomaticEntry();
+ aColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) );
for( sal_uInt16 i = 0; i < rColorTbl.Count(); ++i )
{
XColorEntry* pEntry = rColorTbl.GetColor( i );
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index f41bc49c9d63..6aac40567836 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -73,14 +73,6 @@ namespace
return bRet;
}
- bool lcl_SkipNPages(SwWrtShell *pSh, sal_uInt16 nNoPages)
- {
- bool bAllOk = true;
- for (sal_uInt16 nI = 0; nI < nNoPages && bAllOk; ++nI)
- bAllOk = pSh->SttNxtPg();
- return bAllOk;
- }
-
void lcl_ChangePage(SwWrtShell *pSh, sal_uInt16 nNewNumber,
const SwPageDesc *pNewDesc)
{
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 7ac1bc8f0f73..ddee23b81f65 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -703,4 +703,4 @@ SwGrfShell::SwGrfShell(SwView &_rView) :
SetHelpId(SW_GRFSHELL);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index f1c8c6ff9e06..a7ff27894579 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -819,6 +819,9 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
}
break;
+ case FN_EDIT_HEADER_FOOTER:
+ rWrtSh.ToggleHeaderFooterEdit();
+ break;
case SID_ATTR_BRUSH_CHAR :
case SID_ATTR_CHAR_SCALEWIDTH :
case SID_ATTR_CHAR_ROTATED :
@@ -1565,6 +1568,24 @@ void SwTextShell::GetState( SfxItemSet &rSet )
}
}
break;
+ case FN_EDIT_HEADER_FOOTER:
+ {
+ SfxBoolItem aBool( nWhich, rSh.IsHeaderFooterEdit() );
+ rSet.Put( aBool );
+
+ bool bHasHeaderFooter = false;
+ for ( sal_uInt16 i = 0; !bHasHeaderFooter && i < rSh.GetPageDescCnt(); i++ )
+ {
+ const SwPageDesc& rPageDesc = rSh.GetPageDesc( i );
+ bHasHeaderFooter = rPageDesc.GetMaster().GetHeader().IsActive() ||
+ rPageDesc.GetMaster().GetFooter().IsActive() ||
+ rPageDesc.GetLeft().GetHeader().IsActive() ||
+ rPageDesc.GetLeft().GetFooter().IsActive();
+ }
+ if ( !bHasHeaderFooter )
+ rSet.DisableItem( nWhich );
+ }
+ break;
case SID_TRANSLITERATE_HALFWIDTH:
case SID_TRANSLITERATE_FULLWIDTH:
case SID_TRANSLITERATE_HIRAGANA:
@@ -1698,7 +1719,7 @@ void SwTextShell::ChangeHeaderOrFooter(
{
if( (bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
(bHeader && aDesc.GetMaster().GetHeader().IsActive())) ||
- (!bHeader && aDesc.GetMaster().GetFooter().IsActive()))
+ (!bHeader && aDesc.GetMaster().GetFooter().IsActive()) )
{
bShowWarning = sal_False;
//Actions have to be closed while the dialog is showing
@@ -1732,9 +1753,13 @@ void SwTextShell::ChangeHeaderOrFooter(
rSh.ChgPageDesc( nFrom, aDesc );
if( !bCrsrSet && bOn )
+ {
+ if ( !rSh.IsHeaderFooterEdit() )
+ rSh.ToggleHeaderFooterEdit();
bCrsrSet = rSh.SetCrsrInHdFt(
!rStyleName.Len() ? USHRT_MAX : nFrom,
bHeader );
+ }
}
}
}
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index 6be88b8855a1..ac20c09956b9 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -589,17 +589,68 @@ void SwView::Replace()
{
if (GetPostItMgr()->HasActiveSidebarWin())
GetPostItMgr()->Replace(pSrchItem);
- sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
- pSrchItem->GetRegExp());
- if( bReplaced && pReplList && pReplList->Count() && pWrtShell->HasSelection() )
+ sal_Bool bReqReplace = true;
+
+ if(pWrtShell->HasSelection())
+ {
+ /* check that the selection match the search string*/
+ //save state
+ SwPosition aStartPos = (* pWrtShell->GetSwCrsr()->Start());
+ SwPosition aEndPos = (* pWrtShell->GetSwCrsr()->End());
+ sal_Bool bHasSelection = pSrchItem->GetSelection();
+ sal_uInt16 nOldCmd = pSrchItem->GetCommand();
+
+ //set state for checking if current selection has a match
+ pSrchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ pSrchItem->SetSelection(true);
+
+ //check if it matchs
+ SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
+ if( ! FUNC_Search(aOpts) )
+ {
+
+ //no matching therefore should not replace selection
+ // => remove selection
+
+ if(! pSrchItem->GetBackward() )
+ {
+ (* pWrtShell->GetSwCrsr()->Start()) = aStartPos;
+ (* pWrtShell->GetSwCrsr()->End()) = aEndPos;
+ }
+ else
+ {
+ (* pWrtShell->GetSwCrsr()->Start()) = aEndPos;
+ (* pWrtShell->GetSwCrsr()->End()) = aStartPos;
+ }
+ bReqReplace = false;
+ }
+
+ //set back old search state
+ pSrchItem->SetCommand( nOldCmd );
+ pSrchItem->SetSelection(bHasSelection);
+ }
+ /*
+ * remove current selection
+ * otherwise it is always replaced
+ * no matter if the search string exists or not in the selection
+ * Now the selection is removed and the next matching string is selected
+ */
+
+ if( bReqReplace )
{
- SfxItemSet aReplSet( pWrtShell->GetAttrPool(),
- aTxtFmtCollSetRange );
- if( pReplList->Get( aReplSet ).Count() )
+
+ sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
+ pSrchItem->GetRegExp());
+ if( bReplaced && pReplList && pReplList->Count() && pWrtShell->HasSelection() )
{
- ::SfxToSwPageDescAttr( *pWrtShell, aReplSet );
- pWrtShell->SwEditShell::SetAttr( aReplSet );
+ SfxItemSet aReplSet( pWrtShell->GetAttrPool(),
+ aTxtFmtCollSetRange );
+ if( pReplList->Get( aReplSet ).Count() )
+ {
+ ::SfxToSwPageDescAttr( *pWrtShell, aReplSet );
+ pWrtShell->SwEditShell::SetAttr( aReplSet );
+ }
}
}
}
diff --git a/sw/source/ui/uno/detreg.cxx b/sw/source/ui/uno/detreg.cxx
index 69cf4888eb74..c4c7b2be6e35 100644
--- a/sw/source/ui/uno/detreg.cxx
+++ b/sw/source/ui/uno/detreg.cxx
@@ -37,14 +37,7 @@ using namespace ::com::sun::star::lang;
extern "C" {
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
- const sal_Char** ppEnvironmentTypeName,
- uno_Environment** /*ppEnvironment*/ )
-{
- *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
-}
-
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL swd_component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
void* /*pRegistryKey*/ )
diff --git a/sw/source/ui/uno/unofreg.cxx b/sw/source/ui/uno/unofreg.cxx
index ebf6701154ae..e47f8964a8f0 100644
--- a/sw/source/ui/uno/unofreg.cxx
+++ b/sw/source/ui/uno/unofreg.cxx
@@ -152,13 +152,6 @@ extern "C"
{
#endif
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
- const sal_Char ** ppEnvTypeName,
- uno_Environment ** /*ppEnv*/ )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
static ::cppu::ImplementationEntry const entries[] = {
{ &comp_FinalThreadManager::_create,
&comp_FinalThreadManager::_getImplementationName,
@@ -167,7 +160,7 @@ static ::cppu::ImplementationEntry const entries[] = {
{ 0, 0, 0, 0, 0, 0 }
};
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory(
const sal_Char * pImplName,
void * pServiceManager,
void * pRegistryKey )
diff --git a/sw/source/ui/vba/service.cxx b/sw/source/ui/vba/service.cxx
index 3217c4cf7385..ed31ee19d822 100644
--- a/sw/source/ui/vba/service.cxx
+++ b/sw/source/ui/vba/service.cxx
@@ -63,25 +63,15 @@ namespace vbaeventshelper
extern sdecl::ServiceDecl const serviceDecl;
}
-extern "C"
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL vbaswobj_component_getFactory(
+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
+ registry::XRegistryKey * pRegistryKey )
{
- SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
- const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
- {
- OSL_TRACE("In component_getImplementationEnv");
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
-
- SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
- registry::XRegistryKey * pRegistryKey )
- {
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
+ void* pRet = component_getFactoryHelper(pImplName, pServiceManager,
+ pRegistryKey, globals::serviceDecl, document::serviceDecl,
+ wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
OSL_TRACE("Ret is 0x%x", pRet);
return pRet;
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 8c7e60e549fb..f43985ee3992 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -126,7 +126,7 @@ SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno
xStart = mxTextDocument->getText()->getStart();
xEnd = mxTextDocument->getText()->getEnd();
}
- catch( uno::Exception )
+ catch(const uno::Exception&)
{
DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
}
@@ -503,7 +503,7 @@ SwVbaDocument::getFormControls()
// implementation detail
xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
}
- catch( uno::Exception& )
+ catch(const uno::Exception&)
{
}
return xFormControls;
diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx
index 0ff4295a1218..27a682ebe762 100644
--- a/sw/source/ui/vba/vbafield.cxx
+++ b/sw/source/ui/vba/vbafield.cxx
@@ -556,7 +556,8 @@ sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException)
uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
xRef->refresh();
nUpdate = 0;
- }catch( uno::Exception )
+ }
+ catch(const uno::Exception&)
{
nUpdate = 1;
}
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index e643158b2506..9cd6d3cece53 100755
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -90,6 +90,7 @@
<menu:menuitem menu:id=".uno:EditGlossary"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
+ <menu:menuitem menu:id=".uno:EditHeaderFooter"/>
<menu:menuitem menu:id=".uno:FieldDialog"/>
<menu:menuitem menu:id=".uno:EditFootnote"/>
<menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/sglobal/toolbar/standardbar.xml b/sw/uiconfig/sglobal/toolbar/standardbar.xml
index 9132ae9e3ef2..c1b38e3870f6 100644
--- a/sw/uiconfig/sglobal/toolbar/standardbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/standardbar.xml
@@ -30,7 +30,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="20330"/>
<toolbar:toolbaritem xlink:href=".uno:InsertDraw" toolbar:helpid="10244"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/uiconfig/sweb/toolbar/standardbar.xml b/sw/uiconfig/sweb/toolbar/standardbar.xml
index cb803faa358f..a5d029920848 100644
--- a/sw/uiconfig/sweb/toolbar/standardbar.xml
+++ b/sw/uiconfig/sweb/toolbar/standardbar.xml
@@ -33,7 +33,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="10241"/>
<toolbar:toolbaritem xlink:href=".uno:Config" toolbar:helpid="10593"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml
index 7e5f14f5d58c..d5e073f1d843 100755
--- a/sw/uiconfig/swform/menubar/menubar.xml
+++ b/sw/uiconfig/swform/menubar/menubar.xml
@@ -90,6 +90,7 @@
<menu:menuitem menu:id=".uno:EditGlossary"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
+ <menu:menuitem menu:id=".uno:EditHeaderFooter"/>
<menu:menuitem menu:id=".uno:FieldDialog"/>
<menu:menuitem menu:id=".uno:EditFootnote"/>
<menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swform/toolbar/standardbar.xml b/sw/uiconfig/swform/toolbar/standardbar.xml
index 9132ae9e3ef2..c1b38e3870f6 100644
--- a/sw/uiconfig/swform/toolbar/standardbar.xml
+++ b/sw/uiconfig/swform/toolbar/standardbar.xml
@@ -30,7 +30,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="20330"/>
<toolbar:toolbaritem xlink:href=".uno:InsertDraw" toolbar:helpid="10244"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index 7e5f14f5d58c..d5e073f1d843 100755
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -90,6 +90,7 @@
<menu:menuitem menu:id=".uno:EditGlossary"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
+ <menu:menuitem menu:id=".uno:EditHeaderFooter"/>
<menu:menuitem menu:id=".uno:FieldDialog"/>
<menu:menuitem menu:id=".uno:EditFootnote"/>
<menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swreport/toolbar/standardbar.xml b/sw/uiconfig/swreport/toolbar/standardbar.xml
index 9132ae9e3ef2..c1b38e3870f6 100644
--- a/sw/uiconfig/swreport/toolbar/standardbar.xml
+++ b/sw/uiconfig/swreport/toolbar/standardbar.xml
@@ -30,7 +30,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="20330"/>
<toolbar:toolbaritem xlink:href=".uno:InsertDraw" toolbar:helpid="10244"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 02107d0088a2..e7b7d7f3bc25 100755
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -93,6 +93,7 @@
<menu:menuitem menu:id=".uno:EditGlossary"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
+ <menu:menuitem menu:id=".uno:EditHeaderFooter"/>
<menu:menuitem menu:id=".uno:FieldDialog"/>
<menu:menuitem menu:id=".uno:EditFootnote"/>
<menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml
index 9132ae9e3ef2..c1b38e3870f6 100644
--- a/sw/uiconfig/swriter/toolbar/standardbar.xml
+++ b/sw/uiconfig/swriter/toolbar/standardbar.xml
@@ -30,7 +30,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="20330"/>
<toolbar:toolbaritem xlink:href=".uno:InsertDraw" toolbar:helpid="10244"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index ff139ef3654d..584955e7aabc 100755
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -91,6 +91,7 @@
<menu:menuitem menu:id=".uno:EditGlossary"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
+ <menu:menuitem menu:id=".uno:EditHeaderFooter"/>
<menu:menuitem menu:id=".uno:FieldDialog"/>
<menu:menuitem menu:id=".uno:EditFootnote"/>
<menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swxform/toolbar/standardbar.xml b/sw/uiconfig/swxform/toolbar/standardbar.xml
index 0e24e932ee97..1da9beff4735 100644
--- a/sw/uiconfig/swxform/toolbar/standardbar.xml
+++ b/sw/uiconfig/swxform/toolbar/standardbar.xml
@@ -30,7 +30,7 @@
<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="20330"/>
<toolbar:toolbaritem xlink:href=".uno:InsertDraw" toolbar:helpid="10244"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="5961" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="5960"/>
<toolbar:toolbaritem xlink:href=".uno:ViewDataSourceBrowser" toolbar:helpid="6660"/>
diff --git a/sw/util/msword.component b/sw/util/msword.component
index 54e638ebf8d1..5457603dd91b 100644
--- a/sw/util/msword.component
+++ b/sw/util/msword.component
@@ -25,7 +25,8 @@
* for a copy of the LGPLv3 License.
*
**********************************************************************-->
-<component xmlns="http://openoffice.org/2010/uno-components" loader="com.sun.star.loader.SharedLibrary">
+<component loader="com.sun.star.loader.SharedLibrary" prefix="msword"
+ xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.Writer.RtfExport">
<service name="com.sun.star.comp.Writer.RtfExport"/>
</implementation>
diff --git a/sw/util/sw.component b/sw/util/sw.component
index 7f7377754af7..643576c53689 100644
--- a/sw/util/sw.component
+++ b/sw/util/sw.component
@@ -25,7 +25,8 @@
* for a copy of the LGPLv3 License.
*
**********************************************************************-->
-<component xmlns="http://openoffice.org/2010/uno-components" loader="com.sun.star.loader.SharedLibrary">
+<component loader="com.sun.star.loader.SharedLibrary" prefix="sw"
+ xmlns="http://openoffice.org/2010/uno-components">
<implementation name="SwXAutoTextContainer">
<service name="com.sun.star.text.AutoTextContainer"/>
</implementation>
diff --git a/sw/util/swd.component b/sw/util/swd.component
index c89c007ec30a..74182f74d1e6 100644
--- a/sw/util/swd.component
+++ b/sw/util/swd.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="swd"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.writer.FormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
diff --git a/sw/util/vbaswobj.component b/sw/util/vbaswobj.component
index e6c6fe4a4149..b281a4bb72b9 100644
--- a/sw/util/vbaswobj.component
+++ b/sw/util/vbaswobj.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="vbaswobj"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="SwVbaDocument">
<service name="ooo.vba.word.Document"/>