summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx4
-rw-r--r--accessibility/source/extended/AccessibleGridControlTableCell.cxx9
-rwxr-xr-xautogen.sh2
-rw-r--r--basctl/inc/basidesh.hrc1
-rw-r--r--basctl/source/basicide/baside2.hxx1
-rw-r--r--basctl/source/basicide/baside2b.cxx19
-rw-r--r--basctl/source/basicide/basidesh.src5
-rwxr-xr-xbin/lo-commit-stat45
-rw-r--r--cli_ure/source/native/native_bootstrap.cxx2
-rwxr-xr-xconfigure.in49
-rw-r--r--connectivity/source/parse/sqliterator.cxx4
-rw-r--r--extensions/source/ole/oleobjw.cxx11
-rw-r--r--extensions/source/ole/oleobjw.hxx4
-rw-r--r--extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ottbin47452 -> 48226 bytes
-rw-r--r--extras/source/templates/wizard/letter/lang/da/pri-mail_l.ottbin23344 -> 24245 bytes
-rw-r--r--extras/source/templates/wizard/letter/lang/da/pri-marine_l.ottbin18528 -> 19385 bytes
-rw-r--r--extras/source/templates/wizard/letter/lang/da/pri-redline_l.ottbin11639 -> 12348 bytes
-rwxr-xr-xg6
-rwxr-xr-xgit-hooks/pre-commit10
-rw-r--r--idl/source/objects/slot.cxx4
-rw-r--r--instsetoo_native/util/openoffice.lst16
-rw-r--r--lotuswordpro/source/filter/LotusWordProImportFilter.cxx47
-rw-r--r--lotuswordpro/source/filter/benlist.cxx5
-rw-r--r--lotuswordpro/source/filter/lwp9reader.cxx33
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx37
-rw-r--r--lotuswordpro/source/filter/lwpchangemgr.cxx40
-rw-r--r--lotuswordpro/source/filter/lwpchartstreamtools.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpcontent.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpdivinfo.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx98
-rw-r--r--lotuswordpro/source/filter/lwpdoc.hxx4
-rw-r--r--lotuswordpro/source/filter/lwpfilter.cxx92
-rw-r--r--lotuswordpro/source/filter/lwpfilter.hxx3
-rw-r--r--lotuswordpro/source/filter/lwpfont.cxx17
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx15
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.hxx1
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx15
-rw-r--r--lotuswordpro/source/filter/lwpfrib.cxx36
-rw-r--r--lotuswordpro/source/filter/lwpfribframe.cxx27
-rw-r--r--lotuswordpro/source/filter/lwpfribmark.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpfribptr.cxx30
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx48
-rw-r--r--lotuswordpro/source/filter/lwpidxmgr.cxx25
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx240
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpmarker.cxx5
-rw-r--r--lotuswordpro/source/filter/lwpmarker.hxx1
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.cxx54
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.hxx4
-rw-r--r--lotuswordpro/source/filter/lwpobjhdr.cxx7
-rw-r--r--lotuswordpro/source/filter/lwpobjhdr.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpobjstrm.cxx21
-rw-r--r--lotuswordpro/source/filter/lwpoverride.cxx2
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx42
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx36
-rw-r--r--lotuswordpro/source/filter/lwppara.hxx2
-rw-r--r--lotuswordpro/source/filter/lwppara1.cxx118
-rw-r--r--lotuswordpro/source/filter/lwpparaproperty.cxx86
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.cxx116
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.cxx18
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpsection.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpsilverbullet.cxx20
-rw-r--r--lotuswordpro/source/filter/lwpstory.cxx67
-rw-r--r--lotuswordpro/source/filter/lwptable.cxx4
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx40
-rw-r--r--lotuswordpro/source/filter/lwptabrack.cxx2
-rw-r--r--lotuswordpro/source/filter/lwptoc.cxx8
-rw-r--r--lotuswordpro/source/filter/lwptools.hxx13
-rw-r--r--lotuswordpro/source/filter/utlist.cxx7
-rw-r--r--lotuswordpro/source/filter/utlist.hxx5
-rw-r--r--lotuswordpro/source/filter/xfilter/xfimage.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsaxstream.cxx15
-rw-r--r--lotuswordpro/util/makefile.mk8
-rw-r--r--odk/cfgWin.js14
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheets.idl1
-rw-r--r--oox/source/drawingml/shape.cxx2
-rw-r--r--package/source/manifest/UnoRegister.cxx4
-rw-r--r--[-rwxr-xr-x]rhino/README0
-rw-r--r--[-rwxr-xr-x]rhino/makefile.mk8
-rw-r--r--sal/osl/unx/mutex.c6
-rw-r--r--sal/osl/unx/nlsupport.c36
-rw-r--r--sal/osl/unx/pipe.c4
-rw-r--r--sal/osl/unx/process.c15
-rw-r--r--sal/osl/unx/profile.c13
-rw-r--r--sal/osl/unx/socket.c12
-rw-r--r--sc/CppunitTest_sc_ucalc.mk90
-rw-r--r--sc/Module_sc.mk22
-rw-r--r--sc/Package_qa_unit.mk44
-rw-r--r--sc/inc/address.hxx2
-rw-r--r--sc/inc/dbcolect.hxx2
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/reffind.hxx5
-rw-r--r--sc/inc/table.hxx1
-rw-r--r--sc/qa/unit/Makefile53
-rw-r--r--sc/qa/unit/makefile.mk132
-rw-r--r--sc/qa/unit/ucalc.cxx123
-rw-r--r--sc/source/core/data/documen3.cxx8
-rw-r--r--sc/source/core/data/table2.cxx14
-rw-r--r--sc/source/core/data/table4.cxx263
-rw-r--r--sc/source/core/tool/compiler.cxx1
-rw-r--r--sc/source/core/tool/dbcolect.cxx26
-rw-r--r--sc/source/core/tool/reffind.cxx196
-rw-r--r--sc/source/filter/excel/excform.cxx19
-rw-r--r--sc/source/filter/excel/excform8.cxx83
-rw-r--r--sc/source/filter/excel/read.cxx4
-rw-r--r--sc/source/filter/excel/xilink.cxx234
-rw-r--r--sc/source/filter/excel/xistyle.cxx4
-rw-r--r--sc/source/filter/inc/excform.hxx11
-rw-r--r--sc/source/filter/inc/xilink.hxx23
-rw-r--r--sc/source/ui/docshell/impex.cxx13
-rw-r--r--sc/source/ui/vba/vbaworkbook.hxx2
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx117
-rw-r--r--sc/source/ui/vba/vbaworksheet.hxx4
-rw-r--r--sc/source/ui/vba/vbaworksheets.cxx39
-rw-r--r--sc/source/ui/vba/vbaworksheets.hxx1
-rw-r--r--sc/source/ui/view/editsh.cxx7
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx14
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx3
-rwxr-xr-xset_soenv.in13
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx4
-rw-r--r--sfx2/source/doc/guisaveas.cxx19
-rw-r--r--solenv/bin/modules/installer/worker.pm6
-rw-r--r--solenv/gbuild/CppunitTest.mk28
-rw-r--r--solenv/gbuild/Executable.mk2
-rw-r--r--solenv/gbuild/Library.mk5
-rw-r--r--solenv/gbuild/LinkTarget.mk37
-rw-r--r--solenv/gbuild/StaticLibrary.mk5
-rw-r--r--solenv/gbuild/TargetLocations.mk4
-rwxr-xr-xsolenv/gbuild/filter-showIncludes.pl62
-rwxr-xr-xsolenv/gbuild/platform/macosx.mk2
-rwxr-xr-xsolenv/gbuild/platform/openbsd.mk1
-rwxr-xr-xsolenv/gbuild/platform/solaris.mk1
-rwxr-xr-xsolenv/gbuild/platform/unxgcc.mk8
-rwxr-xr-xsolenv/gbuild/platform/windows.mk113
-rw-r--r--solenv/gbuild/platform/winmingw.mk6
-rw-r--r--solenv/inc/minor.mk4
-rw-r--r--solenv/inc/productversion.mk2
-rw-r--r--svl/source/items/cenumitm.cxx4
-rw-r--r--svl/source/items/visitem.cxx4
-rw-r--r--svl/source/numbers/zforscan.cxx4
-rw-r--r--svtools/source/filter.vcl/filter/exportdialog.cxx2
-rwxr-xr-xsvx/inc/svx/svxids.hrc1
-rw-r--r--sw/source/core/doc/docfld.cxx4
-rw-r--r--sw/source/core/doc/poolfmt.cxx8
-rw-r--r--sw/source/filter/html/htmlplug.cxx2
-rw-r--r--sw/source/filter/ww8/docxexport.cxx39
-rw-r--r--sw/source/filter/ww8/docxexport.hxx16
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx36
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx2
-rw-r--r--sw/source/ui/fldui/flddb.cxx2
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx1
-rw-r--r--vcl/source/gdi/gdimtf.cxx2
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx1
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx2
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx10
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx6
-rw-r--r--xmloff/source/text/txtfldi.cxx2
161 files changed, 2349 insertions, 1552 deletions
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
index 40ca8ef9fbe4..a8d1ac975ad5 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
@@ -40,13 +40,13 @@ namespace accessibility
{
namespace
{
- void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
{
if ( _nIndex >= _sText.getLength() )
throw ::com::sun::star::lang::IndexOutOfBoundsException();
}
- sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
+ static sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
{
return _nRow * _nColumnCount + _nColumn;
}
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
index 68bba16d6a3b..12a70990c41f 100644
--- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -40,16 +40,13 @@ namespace accessibility
{
namespace
{
- void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ // FIXME this is a copy'n'paste from
+ // source/extended/AccessibleBrowseBoxTableCell.cxx, get rid of that...
+ static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
{
if ( _nIndex >= _sText.getLength() )
throw ::com::sun::star::lang::IndexOutOfBoundsException();
}
-
- sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
- {
- return _nRow * _nColumnCount + _nColumn;
- }
}
using namespace ::com::sun::star::lang;
using namespace utl;
diff --git a/autogen.sh b/autogen.sh
index fcef75a5b2bf..cc7210006971 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -97,7 +97,7 @@ if (defined $ENV{NOCONFIGURE}) {
print "Skipping configure process.";
} else {
if ($#cmdline_args > 0) {
- print "writing args to autogen.lastrun\n";
+# print "writing args to autogen.lastrun\n";
my $fh;
open ($fh, ">autogen.lastrun") || die "can't open autogen.lastrun: $!";
for my $arg (@cmdline_args) {
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index 17c8fc8144a1..f3a1e641b8bb 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -53,7 +53,6 @@
#define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 )
#define RID_IMGBTN_REMOVEWATCH ( RID_BASICIDE_START + 8 )
-#define RID_IMGBTN_GOTOCALL ( RID_BASICIDE_START + 9 )
#define RID_IMG_INSTALLATION ( RID_BASICIDE_START + 20 )
#define RID_IMG_DOCUMENT ( RID_BASICIDE_START + 22 )
#define RID_IMG_MODLIB ( RID_BASICIDE_START + 24 )
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index c0a045e6382d..6af6c060411a 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -265,7 +265,6 @@ class StackWindow : public BasicDockingWindow
{
private:
SvTreeListBox aTreeListBox;
- ImageButton aGotoCallButton;
String aStackStr;
protected:
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 030a152f3509..7454b1b83358 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1497,7 +1497,6 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
StackWindow::StackWindow( Window* pParent ) :
BasicDockingWindow( pParent ),
aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
- aGotoCallButton( this, IDEResId( RID_IMGBTN_GOTOCALL ) ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
@@ -1512,14 +1511,6 @@ StackWindow::StackWindow( Window* pParent ) :
SetHelpId( HID_BASICIDE_STACKWINDOW );
- aGotoCallButton.SetClickHdl( LINK( this, StackWindow, ButtonHdl ) );
- aGotoCallButton.SetPosPixel( Point( DWBORDER, 2 ) );
- Size aSz( aGotoCallButton.GetModeImage().GetSizePixel() );
- aSz.Width() += 6;
- aSz.Height() += 6;
- aGotoCallButton.SetSizePixel( aSz );
- aGotoCallButton.Hide();
-
// make stack window keyboard accessible
GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
}
@@ -1560,16 +1551,6 @@ void StackWindow::Resize()
IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, pButton )
{
- if ( pButton == &aGotoCallButton )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_GOTOCALL );
- }
- }
return 0;
}
IMPL_LINK_INLINE_END( StackWindow, ButtonHdl, ImageButton *, pButton )
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index 32220753dd32..368bad4244de 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -324,11 +324,6 @@ ImageButton RID_IMGBTN_REMOVEWATCH
};
QuickHelpText [ en-US ] = "Remove Watch" ;
};
-ImageButton RID_IMGBTN_GOTOCALL
-{
- HelpId = HID_BASICIDE_GOTOALL ;
- SmallStyle = TRUE ;
-};
String RID_STR_REMOVEWATCH
{
diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 5cc772fa7f23..51029fff25cd 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -39,7 +39,7 @@ sub search_bugs($$$$)
$line =~ s/\s*-\s*$bug_orig\s*//;
$line =~ s/\(?$bug_orig\)?[:,]?\s*//;
- # bnc# is prefered over n# for novell bugs
+ # bnc# is preferred over n# for novell bugs
$bug =~ s/^n\#/bnc#/;
# save the bug number
%{$pdata->{$piece}{$commit_id}{'bugs'}} = () if (! defined %{$pdata->{$piece}{$commit_id}{'bugs'}});
@@ -69,9 +69,9 @@ sub standardize_summary($)
sub load_git_log($$$$)
{
- my ($pdata, $repo_dir, $piece, $pgit_args) = @_;
+ my ($pdata, $repo_dir, $piece, $git_command) = @_;
- my $cmd = "cd $repo_dir && git rev-list --pretty=medium " . join ' ', @{$pgit_args};
+ my $cmd = "cd $repo_dir; $git_command";
my $commit_id;
my $summary;
@@ -113,7 +113,7 @@ sub load_git_log($$$$)
}
$line = search_bugs($pdata, $piece, $commit_id, $line);
- # FIXME: need to be implemeted
+ # FIXME: need to be implemented
# search_keywords($pdata, $line);
unless (defined $pdata->{$piece}{$commit_id}{'summary'}) {
@@ -146,7 +146,7 @@ sub get_repo_name($)
sub load_data($$$$)
{
- my ($pdata, $top_dir, $piece, $pgit_args) = @_;
+ my ($pdata, $top_dir, $piece, $git_command) = @_;
if (defined $piece) {
my $piece_dir;
@@ -155,11 +155,11 @@ sub load_data($$$$)
} else {
$piece_dir = "$top_dir/clone/$piece";
}
- load_git_log($pdata, $piece_dir, $piece, $pgit_args);
+ load_git_log($pdata, $piece_dir, $piece, $git_command);
} else {
- load_git_log($pdata, $top_dir, $main_repo, $pgit_args);
+ load_git_log($pdata, $top_dir, $main_repo, $git_command);
foreach my $piece (@pieces) {
- load_git_log($pdata, "$top_dir/clone/$piece", $piece, $pgit_args);
+ load_git_log($pdata, "$top_dir/clone/$piece", $piece, $git_command);
}
}
}
@@ -201,7 +201,7 @@ sub open_log_file($$$)
if (-f $logfilename) {
print "WARNING: The log file already exists: $logfilename\n";
- print "Do you want to ovewrite it? (Y/n)?\n";
+ print "Do you want to overwrite it? (Y/n)?\n";
my $answer = <STDIN>;
chomp $answer;
$answer = "y" unless ($answer);
@@ -256,7 +256,7 @@ sub print_stat($$$)
my ($pdata, $pprint_filters, $log) = @_;
foreach my $piece ( sort { $a cmp $b } keys %{$pdata}) {
- # check if this peice has any entries at all
+ # check if this piece has any entries at all
my $piece_title = "+ $piece";
if ( %{$pdata->{$piece}} ) {
my $old_summary="";
@@ -298,21 +298,25 @@ sub usage()
{
print "This script generates LO git commit summary\n\n" .
- "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=<piece>] --log-suffix=<string> topdir [git_log_param...]\n\n" .
+ "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=<piece>] --log-suffix=<string> topdir [git_arg...]\n\n" .
"Options:\n" .
" --help print this help\n" .
" --no-pieces read changes just from the main repository, ignore other cloned repos\n" .
- " --piece=<piece> summarize just chnages from the given piece\n" .
+ " --piece=<piece> summarize just changes from the given piece\n" .
" --log-suffix=<string> suffix of the log file name; the result will be\n" .
" commit-log-<branch>-<log-name-suffix>.log; the branch name\n" .
- " is detected autoamtically\n" .
+ " is detected automatically\n" .
" --bugs print just bug fixes\n" .
+ " --rev-list use \"git rev-list\" instead of \"git log\"; useful to check\n" .
+ " differences between branches\n" .
" topdir directory with the libreoffice/bootstrap clone; the piece repos\n" .
" must be cloned in the main-repo-root/clone/<piece> subdirectories\n" .
- " git_log_param extra parameters passed to the git log command to define\n" .
- " the area of interest , e.g. --after=\"2010-09-27\" or\n" .
- " TAG..HEAD or origin/master ^origin/libreoffice-3-3";
+ " git_arg extra parameters passed to the git command to define\n" .
+ " the area of interest; The default command is \"git log\" and\n" .
+ " parameters might be, for example, --after=\"2010-09-27\" or\n" .
+ " TAG..HEAD; with the option --rev-list, useful might be, for\n" .
+ " example origin/master ^origin/libreoffice-3-3\n";
}
@@ -328,6 +332,7 @@ my $top_dir;
my $log_prefix = "commit-log";
my $log_suffix;
my $log;
+my $git_command = "git log";
my @git_args;
my %data;
my %print_filters = ();
@@ -345,6 +350,8 @@ foreach my $arg (@ARGV) {
} elsif ($arg eq '--bugs') {
$print_filters{'bug'} = 1;
$log_prefix = "bugfixes"
+ } elsif ($arg eq '--rev-list') {
+ $git_command = "git rev-list --pretty=medium"
} else {
if (! defined $top_dir) {
$top_dir=$arg;
@@ -354,13 +361,15 @@ foreach my $arg (@ARGV) {
}
}
-(defined $top_dir) || die "Error: top direcotry is not defined\n";
+$git_command .= " " . join ' ', @git_args if (@git_args);
+
+(defined $top_dir) || die "Error: top directory is not defined\n";
(-d "$top_dir") || die "Error: not a directory: $top_dir\n";
(-f "$top_dir/.git/config") || die "Error: can't find $top_dir/.git/config\n";
(defined $log_suffix) || die "Error: define log suffix using --log-suffix=<string>\n";
-load_data(\%data, $top_dir,$piece, \@git_args);
+load_data(\%data, $top_dir,$piece, $git_command);
$log = open_log_file($log_prefix, $log_suffix, $top_dir);
print_stat(\%data, \%print_filters, $log);
diff --git a/cli_ure/source/native/native_bootstrap.cxx b/cli_ure/source/native/native_bootstrap.cxx
index 61117f0b35f0..4c6be73c3a20 100644
--- a/cli_ure/source/native/native_bootstrap.cxx
+++ b/cli_ure/source/native/native_bootstrap.cxx
@@ -57,7 +57,7 @@ namespace cli_ure {
WCHAR * resolveLink(WCHAR * path);
}
-#define INSTALL_PATH L"Software\\OpenOffice.org\\UNO\\InstallPath"
+#define INSTALL_PATH L"Software\\LibreOffice\\UNO\\InstallPath"
#define BASIS_LINK L"\\basis-link"
#define URE_LINK L"\\ure-link"
#define URE_BIN L"\\bin"
diff --git a/configure.in b/configure.in
index 922e3eceac13..18de3ffa733b 100755
--- a/configure.in
+++ b/configure.in
@@ -2113,6 +2113,7 @@ fi
dnl ===================================================================
dnl Check which Microsoft C/C++ or MinGW compiler is used for WINNT
dnl ===================================================================
+SHOWINCLUDES_PREFIX=
if test "$_os" = "WINNT"; then
if test "$WITH_MINGW" != "yes"; then
AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
@@ -2130,7 +2131,7 @@ if test "$_os" = "WINNT"; then
else
with_cl_home=`cygpath -u "$with_cl_home"`
fi
- AC_MSG_RESULT([done])
+ AC_MSG_RESULT([$with_cl_home])
dnl ===========================================================
dnl Check for mspdb80.dll/mspdb100.dll
@@ -2163,7 +2164,7 @@ if test "$_os" = "WINNT"; then
fi
if test -z "$MSPDB_PATH"; then
- AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it's in the path or use --with-mspdb-path])
+ AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
fi
MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
@@ -2171,27 +2172,29 @@ if test "$_os" = "WINNT"; then
PATH="$MSPDB_PATH:$PATH"
AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
- if test "$CL_X64" = ""; then
- if test -x "$with_cl_home/bin/cl.exe"; then
- CC="$with_cl_home/bin/cl.exe"
+ if test -z "$CC"; then
+ if test "$CL_X64" = ""; then
+ if test -x "$with_cl_home/bin/cl.exe"; then
+ CC="$with_cl_home/bin/cl.exe"
+ fi
+ else
+ if test -x "$with_cl_home/bin/amd64/cl.exe"; then
+ CC="$with_cl_home/bin/amd64/cl.exe"
+ fi
fi
- else
- if test -x "$with_cl_home/bin/amd64/cl.exe"; then
- CC="$with_cl_home/bin/amd64/cl.exe"
+ if test -z "$CC"; then
+ AC_PATH_PROG(CC, cl.exe)
fi
- fi
- if test -z "$CC"; then
- AC_PATH_PROG(CC, cl.exe)
- fi
-
- if test -e "$CC"; then
# This gives us a posix path with 8.3 filename restrictions
CC=`cygpath -d "$CC"`
CC=`cygpath -u "$CC"`
+ fi
+
+ if test -n "$CC"; then
# Remove /cl.exe from CC case insensitive
AC_MSG_RESULT([found ($CC)])
if test "$CL_X64" = ""; then
- COMPATH=`echo $CC | $SED 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]]@@'`
+ COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
else
if test -n "$with_cl_home"; then
COMPATH=`echo $with_cl_home`
@@ -2222,6 +2225,19 @@ dnl The following find microsoft, matches nn.nn.nnnn then pulls numbers out
else
AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
fi
+
+ dnl We need to guess the prefix of the -showIncludes output, it can be
+ dnl localized
+ AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
+ echo "#include <stdlib.h>" > conftest.c
+ SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
+ grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
+ rm -f conftest.c conftest.obj
+ if test -z "$SHOWINCLUDES_PREFIX" ; then
+ AC_MSG_ERROR([cannot determine the -showIncludes prefix])
+ else
+ AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
+ fi
else
AC_MSG_CHECKING([the MinGW C++ Compiler])
if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
@@ -2239,6 +2255,7 @@ fi
AC_SUBST(COMEX)
AC_SUBST(MSPDB_PATH)
AC_SUBST(USE_MINGW)
+AC_SUBST(SHOWINCLUDES_PREFIX)
dnl ===================================================================
dnl .NET needs special treatment
@@ -2412,7 +2429,7 @@ dnl ===================================================================
dnl Testing for c++ compiler and version...
dnl ===================================================================
if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
- if test -e "$CC"; then
+ if test -n "$CC" -a -z "$CXX"; then
CXX="$CC"
fi
fi
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 59c7287fcdd8..82677e870aae 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1923,7 +1923,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumn
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
- << (bAscending ? "sal_True" : "sal_False")
+ << (bAscending ? "true" : "false")
<< "\n";
#endif
}
@@ -1945,7 +1945,7 @@ void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumn
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
- << (bAscending ? "sal_True" : "sal_False")
+ << (bAscending ? "true" : "false")
<< "\n";
#endif
}
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 6648d1773560..2b172854b041 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -160,9 +160,14 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t)
return Any();
if ( ( t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) || t == getCppuType(static_cast<Reference<XAutomationInvocation>*>( 0)) ) && !m_spDispatch)
return Any();
-
- return WeakImplHelper7<XInvocation, XBridgeSupplier2,
- XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation>::queryInterface(t);
+ // XDirectInvocation seems to be an oracle replacement for XAutomationInvocation, however it is flawed esecially wrt. assumptions about whether to invoke a
+ // Put or Get property, the implementation code has no business guessing that, it's up to the caller to decide that. Worse XDirectInvocation duplicates lots of code.
+ // XAutomationInvocation provides seperate calls for put& get
+ // properties. Note: Currently the basic runtime doesn't call put properties directly, it should... after all the basic runtime should know whether it is calling a put or get property.
+ // For the moment for ease of merging we will let the XDirectInvoke and XAuthomationInvocation interfaces stay side by side ( and for the momemnt at least I would prefer the basic
+ // runtime to call XAutomationInvocation instead of XDirectInvoke
+ return WeakImplHelper8<XInvocation, XBridgeSupplier2,
+ XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >::queryInterface(t);
}
Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void)
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 0be19ddc6cff..1297e1160ab4 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -51,7 +51,7 @@
#endif
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
-#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/implbase8.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
@@ -84,7 +84,7 @@ typedef boost::unordered_multimap<OUString, unsigned int, hashOUString_Impl, equ
// This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
// If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
// The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
-class IUnknownWrapper_Impl : public WeakImplHelper7< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation >,
+class IUnknownWrapper_Impl : public WeakImplHelper8< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >,
public UnoConversionUtilities<IUnknownWrapper_Impl>
diff --git a/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott
index b3219236bfab..20982ffe2acc 100644
--- a/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott
+++ b/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott
Binary files differ
diff --git a/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott
index cbd9f6a7ce64..e8af3babfa2b 100644
--- a/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott
+++ b/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott
Binary files differ
diff --git a/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott
index 621ab7725b26..23c7dee5a864 100644
--- a/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott
+++ b/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott
Binary files differ
diff --git a/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott
index a424b6db5159..4e3b151c8f5c 100644
--- a/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott
+++ b/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott
Binary files differ
diff --git a/g b/g
index 2d601b5e09f8..7fbf6834764d 100755
--- a/g
+++ b/g
@@ -38,12 +38,6 @@ function update_hooks()
if [ "$PWD" != "$RAWBUILDDIR" -a ! -e .gitattributes ]; then
ln -s $RAWBUILDDIR/.gitattributes .
fi
- if [ -z "$(git config filter.po.clean)" ] ; then
- git config filter.po.clean 'msgcat - --no-wrap'
- fi
- if [ -z "$(git config filter.po.smudge)" ] ; then
- git config filter.po.smudge cat
- fi
}
# extra params for some commands, like log
diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
index 6817990eeb98..bf4eef13440b 100755
--- a/git-hooks/pre-commit
+++ b/git-hooks/pre-commit
@@ -150,6 +150,16 @@ while (my $file = <FILES>) {
}
}
+# run 'msgcat --nowrap' when committing *.po files
+open(FILES, "git diff-index --cached --name-only $against |") || die "Cannot run git diff-index.";
+while (my $file = <FILES>) {
+ chomp($file);
+ if ($file =~ /\.po$/ && -e $file) {
+ system("msgcat --no-wrap $file > $file.KQnBbK6wQE;mv $file.KQnBbK6wQE $file;");
+ system("git add $file");
+ }
+}
+
# be strict about tabs - we don't want them at all, setup your editor
# correctly ;-)
my $err_ext = "";
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index 2f4f219c2e6c..8281bce12e61 100644
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -1577,9 +1577,9 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
void WriteBool( sal_Bool bSet, SvStream& rStream )
{
if ( bSet )
- rStream << "sal_True" << ',';
+ rStream << "TRUE" << ',';
else
- rStream << "sal_False" << ',';
+ rStream << "FALSE" << ',';
}
void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst
index 573ff7563a64..38a5cc5b4658 100644
--- a/instsetoo_native/util/openoffice.lst
+++ b/instsetoo_native/util/openoffice.lst
@@ -57,7 +57,7 @@ LibreOffice
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
POSTVERSIONEXTENSION
POSTVERSIONEXTENSIONUNIX
BRANDPACKAGEVERSION 3
@@ -125,7 +125,7 @@ LibreOffice_wJRE
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
POSTVERSIONEXTENSION
POSTVERSIONEXTENSIONUNIX
BRANDPACKAGEVERSION 3
@@ -189,7 +189,7 @@ LibreOffice_Dev
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
BASISROOTNAME LibO-dev
UNIXBASISROOTNAME lo-dev
POSTVERSIONEXTENSION
@@ -266,7 +266,7 @@ URE
PRODUCTEXTENSION
BRANDPACKAGEVERSION 3
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
LICENSENAME LGPL
SETSTATICPATH 1
NOVERSIONINDIRNAME 1
@@ -305,7 +305,7 @@ LibreOffice_SDK
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
POSTVERSIONEXTENSION SDK
POSTVERSIONEXTENSIONUNIX sdk
BRANDPACKAGEVERSION 3
@@ -351,7 +351,7 @@ LibreOffice_Dev_SDK
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
BASISROOTNAME LibO-dev
UNIXBASISROOTNAME lo-dev
POSTVERSIONEXTENSION SDK
@@ -404,7 +404,7 @@ OxygenOffice
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
POSTVERSIONEXTENSION
POSTVERSIONEXTENSIONUNIX
BRANDPACKAGEVERSION 3
@@ -473,7 +473,7 @@ OxygenOffice_wJRE
PRODUCTVERSION 3.4
PRODUCTEXTENSION
LONG_PRODUCTEXTENSION
- SHORT_PRODUCTEXTENSION beta1
+ SHORT_PRODUCTEXTENSION beta2
POSTVERSIONEXTENSION
POSTVERSIONEXTENSIONUNIX
BRANDPACKAGEVERSION 3
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index d0cb7b6fe065..f3eb30bf6537 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -256,23 +256,13 @@ sal_Bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::s
sal_Int32 nLength = aDescriptor.getLength();
const PropertyValue * pValue = aDescriptor.getConstArray();
OUString sURL;
- uno::Reference < XInputStream > xInputStream;
for ( sal_Int32 i = 0 ; i < nLength; i++)
{
- if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
- pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
- pValue[i].Value >>= sURL;
- }
- if ( !xInputStream.is() )
- {
- OSL_ASSERT( 0 );
- return sal_False;
+ //Note, we should attempt to use InputStream here first!
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+ pValue[i].Value >>= sURL;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
-
SvFileStream inputStream( sURL, STREAM_READ );
if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) )
return sal_False;
@@ -282,13 +272,10 @@ sal_Bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::s
uno::Reference< XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+ if (xImporter.is())
xImporter->setTargetDocument(mxDoc);
-/*
- SimpleXMLImporter xmlImporter( xInternalHandler, inputStream );
- xmlImporter.import();
- return sal_True;
-*/
- return ( ReadWordproFile( &inputStream, xInternalHandler) == 0 );
+
+ return ( ReadWordproFile( inputStream, xInternalHandler) == 0 );
}
@@ -333,18 +320,18 @@ OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequenc
uno::Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
if (!xInputStream.is())
{
- try
- {
- ::ucbhelper::Content aContent(sURL, xEnv);
- xInputStream = aContent.openStream();
- }
- catch ( Exception& )
- {
- return ::rtl::OUString();
- }
+ try
+ {
+ ::ucbhelper::Content aContent(sURL, xEnv);
+ xInputStream = aContent.openStream();
+ }
+ catch ( Exception& )
+ {
+ return ::rtl::OUString();
+ }
- if (!xInputStream.is())
- return ::rtl::OUString();
+ if (!xInputStream.is())
+ return ::rtl::OUString();
}
Sequence< ::sal_Int8 > aData;
diff --git a/lotuswordpro/source/filter/benlist.cxx b/lotuswordpro/source/filter/benlist.cxx
index 0ce4ac29cfb5..c2ec1235134a 100644
--- a/lotuswordpro/source/filter/benlist.cxx
+++ b/lotuswordpro/source/filter/benlist.cxx
@@ -68,14 +68,9 @@ FindNamedObject(pCUtList pList, const char * sName,
pCBenNamedObjectListElmt pCurrNamedObjectListElmt =
(pCBenNamedObjectListElmt) pCurr;
-
- //Old code
-// int Comp = strcmp(sName, pCurrNamedObjectListElmt->GetNamedObject()->
-// GetName());
int Comp = strcmp(sName, pCurrNamedObjectListElmt->GetNamedObject()->
GetNameCStr());
-
if (Comp == 0)
return pCurrNamedObjectListElmt->GetNamedObject();
else if (Comp < 0)
diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
index 16019b34de39..bd1a81dcfb09 100644
--- a/lotuswordpro/source/filter/lwp9reader.cxx
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -77,18 +77,22 @@ Lwp9Reader::Lwp9Reader (LwpSvStream* pInputStream, IXFStream* pStream)
void Lwp9Reader::Read()
{
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(m_pDocStream);
- m_pObjMgr = pGlobal->GetLwpObjFactory();
-
- //Commented out by , 10/26/2005
- //Read Ole object in LwpOleObject::XFConverter to support Ole in Linux
- //ReadOleObjects();
+ try
+ {
+ m_pObjMgr = pGlobal->GetLwpObjFactory();
- ReadFileHeader();
- //Does not support Word Pro 96 and previous versions
- if(LwpFileHeader::m_nFileRevision>=0x000B)
+ ReadFileHeader();
+ //Does not support Word Pro 96 and previous versions
+ if(LwpFileHeader::m_nFileRevision>=0x000B)
+ {
+ ReadIndex();
+ ParseDocument();
+ }
+ }
+ catch(...)
{
- ReadIndex();
- ParseDocument();
+ LwpGlobalMgr::DeleteInstance();
+ throw;
}
LwpGlobalMgr::DeleteInstance();
}
@@ -181,14 +185,15 @@ void Lwp9Reader::ParseDocument()
WriteDocHeader();
//Get root document
- LwpDocument* doc = static_cast<LwpDocument*> ( m_LwpFileHdr.GetDocID()->obj() );
+ LwpDocument* doc = dynamic_cast<LwpDocument*> ( m_LwpFileHdr.GetDocID()->obj() );
+
+ if (!doc)
+ return;
//Parse Doc Data
- LwpDocData *pDocData = static_cast<LwpDocData*>((doc->GetDocData())->obj());
+ LwpDocData *pDocData = dynamic_cast<LwpDocData*>((doc->GetDocData())->obj());
if (pDocData!=NULL)
- {
pDocData->Parse(m_pStream);
- }
//Register Styles
RegisteArrowStyles();
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 033a8c7f4427..81ebbd5f175e 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -547,7 +547,9 @@ rtl::OUString LwpBulletStyleMgr::GetDivisionName()
LwpObjectID* pID = pDoc->GetDivInfoID();
if (!pID->IsNull())
{
- aRet = static_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO))->GetDivName();
+ LwpDivInfo *pInfo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO));
+ if (pInfo)
+ aRet = pInfo->GetDivName();
}
}
@@ -562,7 +564,7 @@ rtl::OUString LwpBulletStyleMgr::GetSectionName(LwpPara* pPara)
return rtl::OUString();
}
- LwpStory* pStory = static_cast<LwpStory*>(pStoryID->obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pStoryID->obj(VO_STORY));
if (!pStory)
{
return rtl::OUString();
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index fcfccca88a98..03895d094670 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -91,7 +91,7 @@ LwpCellLayout::~LwpCellLayout()
*/
LwpTableLayout * LwpCellLayout::GetTableLayout()
{
- LwpRowLayout * pRow = static_cast<LwpRowLayout *>(GetParent()->obj());
+ LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(GetParent()->obj());
if(!pRow)
{
return NULL;
@@ -265,14 +265,14 @@ void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
*/
void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
{
- LwpLayoutNumerics* pLayoutNumerics =(LwpLayoutNumerics*)cLayNumerics.obj();
+ LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj());
if (!pLayoutNumerics)
{
// if current layout doesn't have format, go to based on layout
- LwpCellLayout* pCellLayout = (LwpCellLayout*)m_BasedOnStyle.obj();
+ LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj());
if (pCellLayout)
{
- pLayoutNumerics = (LwpLayoutNumerics*)pCellLayout->GetNumericsObject()->obj();
+ pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject()->obj());
}
}
@@ -314,7 +314,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
{
// if cell layout is aTableID's default cell layout
// it can't have any content, bypass these code
- LwpTable * pTable = static_cast<LwpTable *>(aTableID.obj());
+ LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj());
if (!pTable)
{
assert(sal_False);
@@ -331,7 +331,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
}
// content of cell
- LwpStory* pStory =(LwpStory*) m_Content.obj();
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj());
if (pStory)
{
pStory->XFConvert(pXFCell);
@@ -347,8 +347,8 @@ LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
LwpObjectID* pPreStoryID = this->GetPreviousCellStory();
if (pPreStoryID && !(pPreStoryID->IsNull()))
{
- LwpStory* pPreStory = static_cast<LwpStory*>(pPreStoryID->obj(VO_STORY));
- return static_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA));
+ LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY));
+ return dynamic_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA));
}
else
{
@@ -571,7 +571,7 @@ void LwpCellLayout::RegisterDefaultCell()
*/
void LwpCellLayout::RegisterStyle()
{
- LwpVirtualLayout * pParent = static_cast<LwpVirtualLayout *>(GetParent()->obj());
+ LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent()->obj());
if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
{
// default cell layout, we must register 4 styles for it
@@ -604,15 +604,6 @@ void LwpCellLayout::RegisterStyle()
//register child layout style
RegisterChildStyle();
- /*
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
- while(pLayout)
- {
- pLayout->SetFoundry(m_pFoundry);
- pLayout->RegisterStyle();
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
- }
- */
}
/**
* @short Read cell layout
@@ -687,7 +678,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
else
{
// judge base on
- LwpCellLayout * pBase = static_cast<LwpCellLayout *>(m_BasedOnStyle.obj());
+ LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj());
if (pBase && pBase->IsProtected())
{
bProtected = sal_True;
@@ -695,7 +686,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
else
{
// judge whole table
- LwpTable * pTable = static_cast<LwpTable *>(aTableID.obj());
+ LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj());
LwpTableLayout * pTableLayout = static_cast<LwpTableLayout *>(pTable->GetTableLayout());
LwpSuperTableLayout * pSuper = pTableLayout->GetSuperTableLayout();
if (pSuper && pSuper->IsProtected())
@@ -907,17 +898,17 @@ XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow,
{
if (!cconnectedlayout.obj())
return NULL;
- LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj());
+ LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj());
if (nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
return NULL;
// if the hidden cell should be displayed for limit of SODC
// use the default cell layout
XFCell* pXFCell = NULL;
- LwpTable *pTable = static_cast<LwpTable *>(aTableID.obj());
+ LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj());
if (pTable)
{
- LwpCellLayout *pDefault = static_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj());
+ LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj());
if (pDefault)
{
pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx
index 7afd992fda65..9e592b0dc8a4 100644
--- a/lotuswordpro/source/filter/lwpchangemgr.cxx
+++ b/lotuswordpro/source/filter/lwpchangemgr.cxx
@@ -229,45 +229,7 @@ void LwpChangeMgr::ConvertFribContent(XFContentContainer* pCont, LwpFrib* pFrib)
}
}
break;
-/* case FRIB_TAG_SECTION:
- {
- delete pXFPara;
- LwpFribSection* pSectionFrib = static_cast<LwpFribSection*>(pFrib);
- pSectionFrib->ParseSection();
- }
- break;
- case FRIB_TAG_PAGEBREAK:
- {
- LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
- LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
- if(pLayout)
- {
- pPageBreak->ParseLayout();
- }
- else
- {
- if (pPageBreak->IsLastFrib() == sal_True)
- {
- pXFPara->SetStyleName( pPageBreak->GetStyleName() );
- }
- else
- {
- //parse pagebreak
- XFParagraph *pNewPara = new XFParagraph();
- pNewPara->SetStyleName(pFrib->GetStyleName());
- pPara->AddXFContent(pNewPara);
- }
- }
- }
- break;
- case FRIB_TAG_COLBREAK:
- {
- XFParagraph *pNewPara = new XFParagraph();
- pNewPara->SetStyleName(pFrib->GetStyleName());
- pPara->AddXFContent(pNewPara);
- }
- break;
-*/ case FRIB_TAG_LINEBREAK:
+ case FRIB_TAG_LINEBREAK:
{
XFLineBreak *pLineBreak = new XFLineBreak();
pXFPara->Add(pLineBreak);
diff --git a/lotuswordpro/source/filter/lwpchartstreamtools.cxx b/lotuswordpro/source/filter/lwpchartstreamtools.cxx
index 41719587ed46..d2690c2401f9 100644
--- a/lotuswordpro/source/filter/lwpchartstreamtools.cxx
+++ b/lotuswordpro/source/filter/lwpchartstreamtools.cxx
@@ -85,11 +85,9 @@ SvStream* LwpChartStreamTools::GetChartStream(LwpSvStream* pDocStream, const cha
SvStream* pStream = NULL;
pSvStream->Seek(0);
OpenStormBento::LtcBenContainer* pContainer = NULL;;
- ULONG nRet = OpenStormBento::BenOpenContainer(pSvStream,&pContainer);
- if ( 0==nRet )
- {
+ sal_uLong nRet = OpenStormBento::BenOpenContainer(pSvStream,&pContainer);
+ if (nRet != OpenStormBento::BenErr_OK)
pStream = pContainer->FindValueStreamWithPropertyName(pChartName);
- }
return pStream;
}
diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx
index 0d64747f2446..61f07569dae6 100644
--- a/lotuswordpro/source/filter/lwpcontent.hxx
+++ b/lotuswordpro/source/filter/lwpcontent.hxx
@@ -141,7 +141,7 @@ inline OUString LwpContent::GetClassName()
inline LwpContent* LwpContent::GetNextEnumerated()
{
- return static_cast<LwpContent*>(m_NextEnumerated.obj());
+ return dynamic_cast<LwpContent*>(m_NextEnumerated.obj());
}
/**
* @brief
diff --git a/lotuswordpro/source/filter/lwpdivinfo.hxx b/lotuswordpro/source/filter/lwpdivinfo.hxx
index ec0e5968abda..abd247074980 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.hxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.hxx
@@ -162,7 +162,7 @@ inline sal_Bool LwpDivInfo::IsGotoable()
inline LwpDocument* LwpDivInfo::GetDivision()
{
- return static_cast<LwpDocument*>(m_ParentID.obj());
+ return dynamic_cast<LwpDocument*>(m_ParentID.obj());
}
#endif
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 13c2e76e0dad..5fab1b382662 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -71,7 +71,7 @@
#endif
LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
- : LwpDLNFPVList(objHdr, pStrm), m_pLnOpts(NULL)
+ : LwpDLNFPVList(objHdr, pStrm), m_pOwnedFoundry(NULL), m_pLnOpts(NULL)
{}
LwpDocument::~LwpDocument()
@@ -80,9 +80,9 @@ LwpDocument::~LwpDocument()
{
delete m_pLnOpts;
}
- if(m_pFoundry)
+ if(m_pOwnedFoundry)
{
- delete m_pFoundry;
+ delete m_pOwnedFoundry;
}
}
/**
@@ -115,7 +115,7 @@ void LwpDocument::Read()
LwpPrinterInfo m_PrtInfo( m_pObjStrm );
}
- m_pFoundry = new LwpFoundry(m_pObjStrm, this);
+ m_pFoundry = m_pOwnedFoundry = new LwpFoundry(m_pObjStrm, this);
m_DivOpts.ReadIndexed(m_pObjStrm);
@@ -171,7 +171,7 @@ sal_Bool LwpDocument::IsSkippedDivision()
{
OUString sDivName;
sal_uInt8 ret = sal_False;
- LwpDivInfo* pDiv = static_cast<LwpDivInfo*>(GetDivInfoID()->obj(VO_DIVISIONINFO));
+ LwpDivInfo* pDiv = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj(VO_DIVISIONINFO));
if (pDiv == NULL)
return sal_True;
sDivName = pDiv->GetDivName();
@@ -183,10 +183,10 @@ sal_Bool LwpDocument::IsSkippedDivision()
|| strClassName.equals(A2OUSTR(STR_DivisionGroupEndnote))
|| strClassName.equals(A2OUSTR(STR_DocumentEndnote)))
{
- LwpPageLayout* pPageLayout =static_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
if(pPageLayout)
{
- LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
if(pStory)
{
//This judgement maybe have problem. If there is only one para in the story,
@@ -230,15 +230,15 @@ void LwpDocument::RegisterStyle()
void LwpDocument::RegisterTextStyles()
{
//Register all text styles: para styles, character styles
- LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead()->obj());
+ LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead()->obj());
if(pParaStyleHolder)
{
- LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj());
+ LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj());
while(pParaStyle)
{
pParaStyle->SetFoundry(m_pFoundry);
pParaStyle->RegisterStyle();
- pParaStyle = static_cast<LwpParaStyle*>(pParaStyle->GetNext()->obj());
+ pParaStyle = dynamic_cast<LwpParaStyle*>(pParaStyle->GetNext()->obj());
}
}
ChangeStyleName();//add by ,for click here block,05/5/26
@@ -253,15 +253,15 @@ void LwpDocument::RegisterLayoutStyles()
m_pFoundry->RegisterAllLayouts();
//set initial pagelayout in story for parsing pagelayout
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO));
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO));
LwpPageLayout* pPageLayout = NULL;
if(pDivInfo)
{
- pPageLayout =static_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
+ pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
if(pPageLayout)
{
//In Ole division, the content of pagelayout is VO_OLEOBJECT
- LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
if(pStory)
{
//add all the pagelayout in order into the pagelayout list;
@@ -277,16 +277,16 @@ void LwpDocument::RegisterLayoutStyles()
void LwpDocument::RegisterStylesInPara()
{
//Register all automatic styles in para
- LwpHeadContent* pContent = static_cast<LwpHeadContent*> (m_pFoundry->GetContentManager()->GetContentList()->obj());
+ LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager()->GetContentList()->obj());
if(pContent)
{
- LwpStory* pStory = static_cast<LwpStory*>(pContent->GetChildHead()->obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead()->obj(VO_STORY));
while(pStory)
{
//Register the child para
pStory->SetFoundry(m_pFoundry);
pStory->RegisterStyle();
- pStory = static_cast<LwpStory*>(pStory->GetNext()->obj(VO_STORY));
+ pStory = dynamic_cast<LwpStory*>(pStory->GetNext()->obj(VO_STORY));
}
}
}
@@ -296,17 +296,17 @@ void LwpDocument::RegisterStylesInPara()
void LwpDocument::RegisterBulletStyles()
{
//Register bullet styles
- LwpDLVListHeadHolder* mBulletHead = static_cast<LwpDLVListHeadHolder*>
+ LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
(m_pFoundry->GetBulletManagerID()->obj(VO_HEADHOLDER));
if( mBulletHead )
{
- LwpSilverBullet* pBullet = static_cast<LwpSilverBullet*>
+ LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
(mBulletHead->GetHeadID()->obj());
while(pBullet)
{
pBullet->SetFoundry(m_pFoundry);
pBullet->RegisterStyle();
- pBullet = static_cast<LwpSilverBullet*> (pBullet->GetNext()->obj());
+ pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext()->obj());
}
}
}
@@ -341,7 +341,7 @@ void LwpDocument::RegisterFootnoteStyles()
//Register footnote and endnote configuration for the entire document
if(!m_FootnoteOpts.IsNull())
{
- LwpFootnoteOptions* pFootnoteOpts = static_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj());
+ LwpFootnoteOptions* pFootnoteOpts = dynamic_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj());
if (pFootnoteOpts)
{
pFootnoteOpts->SetMasterPage(A2OUSTR("Endnote"));
@@ -353,13 +353,13 @@ void LwpDocument::RegisterFootnoteStyles()
LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote();
if(this == pEndnoteDiv)
{
- LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID()->obj());
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID()->obj());
if(pHeadTail)
{
- LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail()->obj());
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail()->obj());
if(pPageHint && !pPageHint->GetPageLayoutID()->IsNull())
{
- LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID()->obj());
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID()->obj());
if(pPageLayout)
{
pPageLayout->SetFoundry(GetFoundry());
@@ -383,7 +383,7 @@ void LwpDocument::RegisterDefaultParaStyles()
LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
if(pFirstDoc)
{
- LwpVerDocument* pVerDoc = static_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc()->obj());
+ LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc()->obj());
if(pVerDoc)
{
pVerDoc->RegisterStyle();
@@ -400,7 +400,7 @@ void LwpDocument::RegisterDefaultParaStyles()
void LwpDocument::ParseDocContent(IXFStream* pOutputStream)
{
//Parse content in PageLayout
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj());
if(pDivInfo==NULL) return;
LwpObject* pLayoutObj = pDivInfo->GetInitialLayoutID()->obj();
@@ -419,7 +419,7 @@ void LwpDocument::ParseDocContent(IXFStream* pOutputStream)
*/
void LwpDocument::ParseMasterDoc(IXFStream* pOutputStream)
{
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj());
if(pDivInfo==NULL) return;
LwpAtomHolder* pExternal = pDivInfo->GetExternalName();
if(pExternal && pExternal->HasValue())
@@ -450,7 +450,7 @@ LwpObjectID* LwpDocument::GetValidFootnoteOpts()
*/
sal_uInt16 LwpDocument::GetEndnoteType()
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
if (!pDivInfo)
return FN_DONTCARE;
OUString strClassName = pDivInfo->GetClassName();
@@ -467,10 +467,10 @@ sal_uInt16 LwpDocument::GetEndnoteType()
*/
LwpDocument* LwpDocument::GetPreviousDivision()
{
- LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
if(pDocSock)
{
- return static_cast<LwpDocument*>(pDocSock->GetPrevious()->obj());
+ return dynamic_cast<LwpDocument*>(pDocSock->GetPrevious()->obj());
}
return NULL;
}
@@ -479,10 +479,10 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetNextDivision()
{
- LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
if(pDocSock)
{
- return static_cast<LwpDocument*>(pDocSock->GetNext()->obj());
+ return dynamic_cast<LwpDocument*>(pDocSock->GetNext()->obj());
}
return NULL;
}
@@ -491,10 +491,10 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetParentDivision()
{
- LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
if(pDocSock)
{
- return static_cast<LwpDocument*>(pDocSock->GetParent()->obj());
+ return dynamic_cast<LwpDocument*>(pDocSock->GetParent()->obj());
}
return NULL;
}
@@ -507,7 +507,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
for (pPrev = GetPreviousDivision(); pPrev; pPrev = pPrev->GetPreviousDivision())
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pPrev->GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pPrev->GetDivInfoID()->obj());
if(pDivInfo && pDivInfo->HasContents())
return pPrev;
}
@@ -522,7 +522,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
for (pNext = GetNextDivision(); pNext; pNext = pNext->GetNextDivision())
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
if(pDivInfo && pDivInfo->HasContents())
return pNext;
}
@@ -549,7 +549,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetLastDivisionWithContents()
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
if(pDivInfo && pDivInfo->HasContents())
{
return this;
@@ -580,7 +580,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
while (pNext)
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
if (pDivInfo && pDivInfo->HasContents())
pLast = pNext;
pNext = pNext->GetNextInGroup();
@@ -594,9 +594,9 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetLastDivision()
{
- LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
if(pDocSock)
- return static_cast<LwpDocument*>(pDocSock->GetChildTail()->obj());
+ return dynamic_cast<LwpDocument*>(pDocSock->GetChildTail()->obj());
return NULL;
}
@@ -605,9 +605,9 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetFirstDivision()
{
- LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
if(pDocSock)
- return static_cast<LwpDocument*>(pDocSock->GetChildHead()->obj());
+ return dynamic_cast<LwpDocument*>(pDocSock->GetChildHead()->obj());
return NULL;
}
@@ -630,7 +630,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE()
{
- LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
if(pDivInfo && pDivInfo->HasContents()
&& !pDivInfo->IsOleDivision())
return this;
@@ -669,7 +669,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
*/
LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout()
{
- LwpHeadLayout* pHeadLayout =static_cast<LwpHeadLayout*>(GetFoundry()->GetLayout()->obj());
+ LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout()->obj());
if(pHeadLayout)
{
return pHeadLayout->FindEnSuperTableLayout();
@@ -685,7 +685,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
if(this == pEndDivision)
return sal_True;
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*>(m_DivInfo.obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj());
if(pDivInfo)
{
pDivInfo->GetNumberOfPages(nCount);
@@ -728,7 +728,7 @@ sal_uInt16 LwpDocument::GetNumberOfPagesBefore()
{
LwpDocument* pDivision = GetFirstDivision();
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*>(m_DivInfo.obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj());
if(pDivInfo)
nNumPages += pDivInfo->GetMaxNumberOfPages();
while(pDivision)
@@ -761,13 +761,13 @@ void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont)
{
LwpDocument* pDivision = GetFirstDivision();
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (GetDivInfoID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (GetDivInfoID()->obj());
if(pDivInfo)
{
- LwpPageLayout* pPageLayout =static_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj());
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj());
if(pPageLayout)
{
- LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj());
if(pStory)
pStory->XFConvertFrameInPage(pCont);
}
@@ -784,7 +784,7 @@ void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont)
void LwpDocument::ChangeStyleName()
{
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
- XFTextStyle* pStyle = static_cast<XFTextStyle*>(pXFStyleManager->FindStyle(A2OUSTR("ClickHere")));
+ XFTextStyle* pStyle = dynamic_cast<XFTextStyle*>(pXFStyleManager->FindStyle(A2OUSTR("ClickHere")));
if (pStyle)
{
pStyle->SetStyleName(A2OUSTR("Placeholder"));
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
index 1995759de7bd..92b41c327a81 100644
--- a/lotuswordpro/source/filter/lwpdoc.hxx
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -89,6 +89,8 @@ public:
~LwpDocument();
private:
+ LwpFoundry* m_pOwnedFoundry;
+
//Data members in file format
LwpObjectID m_DocSockID;
sal_uInt16 m_nFlags;
@@ -185,7 +187,7 @@ private:
void MaxNumberOfPages(sal_uInt16& nNumPages);
void XFConvertFrameInPage(XFContentContainer* pCont);
void ChangeStyleName();
- sal_Bool IsSkippedDivision();//add by
+ sal_Bool IsSkippedDivision();
};
inline sal_Bool LwpDocument::IsChildDoc()
diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
index 0c4ef8229ff9..4abed4e5391f 100644
--- a/lotuswordpro/source/filter/lwpfilter.cxx
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -82,6 +82,8 @@
#include <tools/stream.hxx>
#include <sfx2/docfile.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::cppu;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
@@ -109,31 +111,19 @@ LWPFilterReader::~LWPFilterReader()
sal_Bool LWPFilterReader::filter( const Sequence< PropertyValue >& aDescriptor )
throw( RuntimeException )
{
- uno::Reference< XInputStream> xInputStream;
::rtl::OUString sURL;
for( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ )
{
- if( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) )
- aDescriptor[i].Value >>= xInputStream;
+ //Note we should attempt to use "InputStream" if it exists first!
if( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) )
aDescriptor[i].Value >>= sURL;
}
- if ( !xInputStream.is() )
- {
- OSL_ASSERT( 0 );
- return sal_False;
- }
-
- OString sFileName;
- sFileName = ::rtl::OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
-
SvFileStream inputStream( sURL, STREAM_READ );
if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) )
return sal_False;
-
- return (ReadWordproFile( &inputStream ,m_DocumentHandler) == 0);
+ return (ReadWordproFile(inputStream, m_DocumentHandler) == 0);
}
void LWPFilterReader::cancel() throw (com::sun::star::uno::RuntimeException)
@@ -332,41 +322,39 @@ Sequence< OUString> LWPFilterImportFilter::getSupportedServiceNames( void ) thro
#include "bento.hxx"
using namespace OpenStormBento;
#include "explode.hxx"
- sal_Bool Decompress(SvStream *pCompressed, SvStream * & pDecompressed)
+ sal_Bool Decompress(SvStream *pCompressed, SvStream * & pOutDecompressed)
{
pCompressed->Seek(0);
- pDecompressed = new SvMemoryStream(4096, 4096);
+ std::auto_ptr<SvStream> aDecompressed(new SvMemoryStream(4096, 4096));
unsigned char buffer[512];
pCompressed->Read(buffer, 16);
- pDecompressed->Write(buffer, 16);
+ aDecompressed->Write(buffer, 16);
- LwpSvStream * pLwpStream = new LwpSvStream(pCompressed);
+ boost::scoped_ptr<LwpSvStream> aLwpStream(new LwpSvStream(pCompressed));
LtcBenContainer* pBentoContainer;
- /*ULONG ulRet = */ BenOpenContainer(pLwpStream, &pBentoContainer);
- LtcUtBenValueStream * pWordProData = (LtcUtBenValueStream *)pBentoContainer->FindValueStreamWithPropertyName("WordProData");
+ sal_uLong ulRet = BenOpenContainer(aLwpStream.get(), &pBentoContainer);
+ if (ulRet != BenErr_OK)
+ return sal_False;
+
+ boost::scoped_ptr<LtcUtBenValueStream> aWordProData((LtcUtBenValueStream *)pBentoContainer->FindValueStreamWithPropertyName("WordProData"));
+
+ if (!aWordProData.get())
+ return sal_False;
// decompressing
- Decompression decompress(pWordProData, pDecompressed);
+ Decompression decompress(aWordProData.get(), aDecompressed.get());
if (0!= decompress.explode())
- {
- delete pDecompressed;
- pDecompressed = NULL;
- delete pWordProData;
- delete pLwpStream;
return sal_False;
- }
- sal_uInt32 nPos = pWordProData->GetSize();
+ sal_uInt32 nPos = aWordProData->GetSize();
nPos += 0x10;
pCompressed->Seek(nPos);
while (sal_uInt32 iRead = pCompressed->Read(buffer, 512))
- {
- pDecompressed->Write(buffer, iRead);
- }
+ aDecompressed->Write(buffer, iRead);
- delete pWordProData;
- delete pLwpStream;
+ //transfer ownership of aDecompressed's ptr
+ pOutDecompressed = aDecompressed.release();
return sal_True;
}
@@ -410,40 +398,38 @@ using namespace OpenStormBento;
}
return bCompressed;
}
-int ReadWordproFile(SvStream* pStream, uno::Reference<XDocumentHandler>& xHandler)
+int ReadWordproFile(SvStream &rStream, uno::Reference<XDocumentHandler>& xHandler)
{
try
{
- LwpSvStream *pLwpSvStream = NULL;
- SvStream * pDecompressed = NULL;
- if ( GetLwpSvStream(pStream, pLwpSvStream) && pLwpSvStream)
+ LwpSvStream *pRawLwpSvStream = NULL;
+ boost::scoped_ptr<LwpSvStream> aLwpSvStream;
+ boost::scoped_ptr<LwpSvStream> aCompressedLwpSvStream;
+ boost::scoped_ptr<SvStream> aDecompressed;
+ if (GetLwpSvStream(&rStream, pRawLwpSvStream) && pRawLwpSvStream)
{
- pDecompressed = pLwpSvStream->GetStream();
+ SvStream *pDecompressed = pRawLwpSvStream->GetStream();
+ if (pDecompressed)
+ {
+ aDecompressed.reset(pDecompressed);
+ aCompressedLwpSvStream.reset(pRawLwpSvStream->GetCompressedStream());
+ }
}
- if (!pLwpSvStream)
+
+ if (!pRawLwpSvStream)
{
// nothing returned, fail when uncompressing
return 1;
}
- IXFStream *pStrm = new XFSaxStream(xHandler);
- Lwp9Reader reader(pLwpSvStream, pStrm);
+ aLwpSvStream.reset(pRawLwpSvStream);
+
+ boost::scoped_ptr<IXFStream> pStrm(new XFSaxStream(xHandler));
+ Lwp9Reader reader(aLwpSvStream.get(), pStrm.get());
//Reset all static objects,because this function may be called many times.
XFGlobalReset();
reader.Read();
- // added by
-
- if (pDecompressed)
- {
- delete pDecompressed;
- LwpSvStream * pTemp = pLwpSvStream->GetCompressedStream();
- delete pTemp;
- }
- delete pLwpSvStream;
- // end added by
-
- delete pStrm;
return 0;
}
catch (...)
diff --git a/lotuswordpro/source/filter/lwpfilter.hxx b/lotuswordpro/source/filter/lwpfilter.hxx
index 0484f5178cd9..5653fd8d53f3 100644
--- a/lotuswordpro/source/filter/lwpfilter.hxx
+++ b/lotuswordpro/source/filter/lwpfilter.hxx
@@ -174,9 +174,8 @@ public:
uno::Reference< XImporter > rImporter;
};
-int ReadWordproFile(String& strName,uno::Reference<XDocumentHandler>& XDoc);
//test code
-int ReadWordproFile(SvStream* pStream, uno::Reference<XDocumentHandler>& XDoc);
+int ReadWordproFile(SvStream &rStream, uno::Reference<XDocumentHandler>& XDoc);
#endif
diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx
index 85eb7f76881a..e39f8f00cf09 100644
--- a/lotuswordpro/source/filter/lwpfont.cxx
+++ b/lotuswordpro/source/filter/lwpfont.cxx
@@ -247,7 +247,8 @@ void LwpFontTableEntry::RegisterFontDecl()
}
LwpFontTable::LwpFontTable()
- : m_pFontEntries(NULL)
+ : m_nCount(0)
+ , m_pFontEntries(NULL)
{}
void LwpFontTable::Read(LwpObjectStream *pStrm)
@@ -267,10 +268,8 @@ void LwpFontTable::Read(LwpObjectStream *pStrm)
OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1
{
- assert(index>0);
- if (index < 1)//add for fix crash
- return OUString();
- return m_pFontEntries[index-1].GetFaceName();
+ assert(index <= m_nCount && index > 0);
+ return (index <= m_nCount && index > 0) ? m_pFontEntries[index-1].GetFaceName() : OUString();
}
LwpFontTable::~LwpFontTable()
@@ -398,7 +397,9 @@ void LwpFontNameManager::Read(LwpObjectStream *pStrm)
void LwpFontNameManager::Override(sal_uInt16 index, XFFont* pFont)
//index: start from 1
{
- if(index<1) return;
+ if (index > m_nCount || index < 1)
+ return ;
+
m_pFontNames[index-1].Override(pFont);
if(m_pFontNames[index-1].IsFaceNameOverridden())
pFont->SetFontName(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetFaceID()));
@@ -436,7 +437,9 @@ void LwpFontAttrManager::Read(LwpObjectStream *pStrm) {
void LwpFontAttrManager::Override(sal_uInt16 index, XFFont* pFont)
//index: start from 1
{
- if(index<1) return;
+ if (index > m_nCount || index < 1)
+ return ;
+
m_pFontAttrs[index-1].Override(pFont);
}
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index e366bccbc10c..985e3f2b1532 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -141,7 +141,7 @@ void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
*/
LwpFootnote* LwpFribFootnote::GetFootnote()
{
- return static_cast<LwpFootnote*>(m_Footnote.obj());
+ return dynamic_cast<LwpFootnote*>(m_Footnote.obj());
}
@@ -211,7 +211,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout()
LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
if(pRowLayout)
{
- return static_cast<LwpCellLayout*>(pRowLayout->GetChildHead()->obj());
+ return dynamic_cast<LwpCellLayout*>(pRowLayout->GetChildHead()->obj());
}
}
}
@@ -410,7 +410,7 @@ LwpTable* LwpFootnote::GetFootnoteTable(LwpEnSuperTableLayout * pLayout)
{
LwpEndnoteLayout* pEndnoteLayout = static_cast<LwpEndnoteLayout*>(pLayout->GetMainTableLayout());
if(pEndnoteLayout)
- return static_cast<LwpTable*>(pEndnoteLayout->GetContent()->obj());
+ return dynamic_cast<LwpTable*>(pEndnoteLayout->GetContent()->obj());
}
return NULL;
}
@@ -420,7 +420,7 @@ LwpTable* LwpFootnote::GetFootnoteTable(LwpEnSuperTableLayout * pLayout)
*/
LwpContent* LwpFootnote::FindFootnoteContent()
{
- LwpContent* pContent = static_cast<LwpContent*>(m_Content.obj());
+ LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj());
//if the content has layout, the content has footnote contents;
//or looking for the celllayout and return the footnote contents.
if(pContent && pContent->GetLayout(NULL))
@@ -429,7 +429,7 @@ LwpContent* LwpFootnote::FindFootnoteContent()
LwpCellLayout* pCellLayout = GetCellLayout();
if(pCellLayout)
{
- pContent =static_cast<LwpContent*>(pCellLayout->GetContent()->obj());
+ pContent = dynamic_cast<LwpContent*>(pCellLayout->GetContent()->obj());
}
return pContent;
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 9f898d97a0b4..a2263d98ec91 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -75,7 +75,10 @@
#include "lwpglobalmgr.hxx"
LwpFoundry::LwpFoundry(LwpObjectStream *pStrm, LwpDocument* pDoc)
- : m_pDoc(pDoc), m_pPieceMgr(NULL), m_pStyleMgr(NULL)
+ : m_pDoc(pDoc)
+ , m_bRegisteredAll(false)
+ , m_pPieceMgr(NULL)
+ , m_pStyleMgr(NULL)
{
Read(pStrm);
m_pDropcapMgr = new LwpDropcapMgr;
@@ -184,6 +187,14 @@ void LwpFoundry::ReadStyles(LwpObjectStream *pStrm)
void LwpFoundry::RegisterAllLayouts()
{
+ if (m_bRegisteredAll)
+ {
+ OSL_FAIL("recursive LwpFoundry::RegisterAllLayouts!\n");
+ return;
+ }
+
+ m_bRegisteredAll = true;
+
//Register CellStyle
LwpObject* pStyle = m_CellStyle.obj();
if( pStyle )
@@ -193,7 +204,7 @@ void LwpFoundry::RegisterAllLayouts()
}
//register content page layout list: Layout
- pStyle = m_Layout.obj();
+ pStyle = m_Layout.obj();
if( pStyle )
{
pStyle->SetFoundry(this);
diff --git a/lotuswordpro/source/filter/lwpfoundry.hxx b/lotuswordpro/source/filter/lwpfoundry.hxx
index 765097ae10bd..8e5741c3cd93 100644
--- a/lotuswordpro/source/filter/lwpfoundry.hxx
+++ b/lotuswordpro/source/filter/lwpfoundry.hxx
@@ -221,6 +221,7 @@ public:
void RegisterAllLayouts();
private:
LwpDocument* m_pDoc;
+ bool m_bRegisteredAll;
private: //file members
LwpVersionManager m_VerMgr;
LwpObjectManager m_ObjMgr;
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index c90663abb2dd..e1f35522cd24 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -888,11 +888,16 @@ OUString LwpFrameLayout::GetNextLinkName()
LwpObjectID* pObjectID = m_Link.GetNextLayout();
if(!pObjectID->IsNull())
{
- LwpLayout* pLayout = static_cast<LwpLayout*>(pObjectID->obj());
- aName = pLayout->GetName()->str();
- //for division name confict
- if(pLayout->GetStyleName().getLength() > 0)
- aName = pLayout->GetStyleName();
+ LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pObjectID->obj());
+ if (pLayout)
+ {
+ LwpAtomHolder *pHolder = pLayout->GetName();
+ if (pHolder)
+ aName = pHolder->str();
+ //for division name confict
+ if(pLayout->GetStyleName().getLength() > 0)
+ aName = pLayout->GetStyleName();
+ }
}
return aName;
}
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index 398896fd7f2c..3deedc897777 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -337,26 +337,33 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
{
- sal_uInt8 Modifier;
- sal_uInt8 len;
-// sal_Bool ModifyFlag = sal_False;
-
for(;;)
{
+ sal_uInt8 Modifier(0);
+ sal_uInt8 len(0);
+
// Get the modifier type
- pObjStrm->QuickRead(&Modifier, sizeof(Modifier));
+ if (pObjStrm->QuickRead(&Modifier, sizeof(Modifier)) != sizeof(Modifier))
+ break;
// Stop when we hit the last modifier
if (Modifier == FRIB_MTAG_NONE)
break;
-// ModifyFlag = sal_True;
+
// Get the modifier length
- pObjStrm->QuickRead(&len, sizeof(len));
+ if (pObjStrm->QuickRead(&len, sizeof(len)) != sizeof(len))
+ break;
switch (Modifier)
{
case FRIB_MTAG_FONT:
- pObjStrm->QuickRead(&pModInfo->FontID,len);
+ if (len > sizeof(pModInfo->FontID))
+ {
+ OSL_FAIL("FRIB_MTAG_FONT entry wrong size\n");
+ pObjStrm->SeekRel(len);
+ }
+ else
+ pObjStrm->QuickRead(&pModInfo->FontID,len);
break;
case FRIB_MTAG_CHARSTYLE:
pModInfo->HasCharStyle = sal_True;
@@ -367,15 +374,19 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
pModInfo->Language.Read(pObjStrm);
break;
case FRIB_MTAG_CODEPAGE:
- pObjStrm->QuickRead(&pModInfo->CodePage,len);
+ if (len > sizeof(pModInfo->CodePage))
+ {
+ OSL_FAIL("FRIB_MTAG_CODEPAGE entry wrong size\n");
+ pObjStrm->SeekRel(len);
+ }
+ else
+ pObjStrm->QuickRead(&pModInfo->CodePage,len);
break;
- //add by , 02/22/2005
case FRIB_MTAG_ATTRIBUTE:
pModInfo->aTxtAttrOverride.Read(pObjStrm);
if (pModInfo->aTxtAttrOverride.IsHighLight())
pModInfo->HasHighLight = sal_True;
break;
- //end add
case FRIB_MTAG_REVISION:
pModInfo->RevisionType = pObjStrm->QuickReaduInt8();
pModInfo->RevisionFlag = sal_True;
@@ -385,10 +396,7 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
break;
}
// TODO: read the modifier data
- // pObjStrm->SeekRel(len);
-
}
-
}
//do nothing
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
index abf884bc4fbe..3e617da8cd68 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -92,14 +92,21 @@ LwpObject* LwpFribFrame::GetLayout()
*/
void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
{
- if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT)
+ LwpObject *pObject = m_objLayout.obj();
+
+ if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT)
{
- static_cast<LwpDropcapLayout*>(m_objLayout.obj())->RegisterStyle(pFoundry);
+ LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject);
+ if (!pLayout)
+ return;
+ pLayout->RegisterStyle(pFoundry);
}
else
{
- //register frame style, , 04/07/2005
- LwpPlacableLayout* pLayout = static_cast<LwpPlacableLayout*>(m_objLayout.obj());
+ //register frame style
+ LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject);
+ if (!pLayout)
+ return;
pLayout->SetFoundry(pFoundry);
pLayout->RegisterStyle();
@@ -125,10 +132,12 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
}
void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
{
- if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT)
+ LwpObject *pObject = m_objLayout.obj();
+
+ if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT)
{
pPara->SetParaDropcap(sal_True);
- pPara->SetDropcapLayout(static_cast<LwpDropcapLayout*>(m_objLayout.obj()));
+ pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject));
}
else
pPara->SetParaDropcap(sal_False);
@@ -141,7 +150,9 @@ void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
void LwpFribFrame::XFConvert(XFContentContainer* pCont)
{
XFContentContainer* pXFContentContainer = pCont;
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetLayout());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout());
+ if (!pLayout)
+ return;
sal_uInt8 nType = pLayout->GetRelativeType();
if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
{
@@ -232,7 +243,7 @@ void LwpFribRubyFrame::XFConvert(XFContentContainer* /*pCont*/)
LwpRubyLayout* LwpFribRubyFrame::GetLayout()
{
- return static_cast<LwpRubyLayout*>(m_objLayout.obj());
+ return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index fb2bd846edef..c2780816c232 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -94,7 +94,7 @@ void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
LwpCHBlkMarker* LwpFribCHBlock::GetMarker()
{
- return static_cast<LwpCHBlkMarker*>(m_objMarker.obj());
+ return dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj());
}
void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
@@ -147,7 +147,9 @@ void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
LwpObjectID* pID = pDoc->GetDivInfoID();
if (!pID->IsNull())
{
- sDivision = static_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO))->GetDivName();
+ LwpDivInfo *pDivInvo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO));
+ if (pDivInvo)
+ sDivision = pDivInvo->GetDivName();
}
}
@@ -230,7 +232,7 @@ void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
LwpFieldMark* LwpFribField::GetMarker()
{
- return static_cast<LwpFieldMark*>(m_objMarker.obj());
+ return dynamic_cast<LwpFieldMark*>(m_objMarker.obj());
}
void LwpFribField::XFConvert(XFContentContainer* pXFPara)
@@ -1421,7 +1423,7 @@ LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara ): LwpFrib(pPara)
LwpRubyMarker* LwpFribRubyMarker::GetMarker()
{
- return static_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER));
+ return dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER));
}
void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx
index 7815cc2c3d34..3511baf03a4f 100644
--- a/lotuswordpro/source/filter/lwpfribptr.cxx
+++ b/lotuswordpro/source/filter/lwpfribptr.cxx
@@ -90,7 +90,8 @@
LwpFribPtr::LwpFribPtr()
: m_pFribs(NULL),m_pXFPara(NULL),m_pPara(NULL)
-{}
+{
+}
LwpFribPtr::~LwpFribPtr()
{
@@ -226,7 +227,7 @@ void LwpFribPtr::XFConvert()
case FRIB_TAG_PAGEBREAK:
{
LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
- LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
+ LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
if(pLayout)
{
pPageBreak->ParseLayout();
@@ -291,13 +292,8 @@ void LwpFribPtr::XFConvert()
{
LwpFribFrame* frameFrib= static_cast<LwpFribFrame*>(pFrib);
LwpObject* pLayout = frameFrib->GetLayout();
- if (pLayout->GetTag() == VO_DROPCAPLAYOUT)
- {
+ if (pLayout && pLayout->GetTag() == VO_DROPCAPLAYOUT)
m_pPara->GetFoundry()->GetDropcapMgr()->SetXFPara(m_pXFPara);
- //LwpObject* pDropCap = frameFrib->GetLayout();
- //pDropCap ->XFConvert(m_pXFPara);
- }
- //pLayout->XFConvert(m_pXFPara);
frameFrib->XFConvert(m_pXFPara);
}
break;
@@ -406,8 +402,9 @@ void LwpFribPtr::FindLayouts()
//StartWithinColume type not support now
break;
}
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
- pStory->AddPageLayout(pSection->GetPageLayout());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+ if (pStory)
+ pStory->AddPageLayout(pSection->GetPageLayout());
}
}
@@ -416,11 +413,12 @@ void LwpFribPtr::FindLayouts()
case FRIB_TAG_PAGEBREAK:
{
LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
- LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
+ LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
if(pLayout)
{
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
- pStory->AddPageLayout(pLayout);
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+ if (pStory)
+ pStory->AddPageLayout(pLayout);
}
break;
}
@@ -614,9 +612,9 @@ void LwpFribPtr::ProcessDropcap(LwpStory* pStory,LwpFrib* pFrib,sal_uInt32 nLen)
XFTextStyle* pFribStyle = pXFStyleManager->FindTextStyle(pFrib->GetStyleName());
pFribStyle->GetFont()->SetFontSize(0);
- LwpObject* pObj= pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj();
+ LwpDropcapLayout* pObj = dynamic_cast<LwpDropcapLayout*>(pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj());
if (pObj)
- static_cast<LwpDropcapLayout*>(pObj)->SetChars(nLen);
+ pObj->SetChars(nLen);
}
}
}
@@ -649,7 +647,7 @@ sal_Bool LwpFribPtr::ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtua
case FRIB_TAG_PAGEBREAK:
{
LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
- pLayout = static_cast<LwpVirtualLayout*>(pPageBreak->GetLayout()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pPageBreak->GetLayout()->obj());
break;
}
default:
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 24f33125e6c7..83a3a1f3b9cf 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -94,6 +94,8 @@ LwpGraphicObject::LwpGraphicObject(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
, m_bIsLinked(0)
, m_bCompressed(0)
{
+ memset(m_sDataFormat, 0, sizeof(m_sDataFormat));
+ memset(m_sServerContextFormat, 0, sizeof(m_sServerContextFormat));
}
LwpGraphicObject::~LwpGraphicObject()
{
@@ -207,21 +209,6 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
{
if ((m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w'))
{
-/* LwpSvStream* pStream = m_pStrm;
- //test code
- OpenStormBento::LtcBenContainer* pBentoContainer;
- ULONG ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
- std::vector<SvStream*> vStream;
- std::vector<SvStream*>::iterator iter;
- pBentoContainer->CreateGraphicStreams(&vStream);
- for (iter=vStream.begin();iter!=vStream.end();iter++)
- {
- LwpSdwFileLoader fileLoader(*iter,pOutputStream);
- fileLoader.LoadObjectList();
- delete *iter;
- }
- vStream.clear();*/
-
//XFParagraph* pPara = new XFParagraph();
std::vector <XFFrame*>::iterator iter;
for (iter = m_vXFDrawObjects.begin(); iter != m_vXFDrawObjects.end(); ++iter)
@@ -375,24 +362,7 @@ void LwpGraphicObject::RegisterStyle()
{
this->CreateGrafObject();
}
-/* if (m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w')
- {
- LwpSvStream* pStream = m_pStrm;
- //test code
- OpenStormBento::LtcBenContainer* pBentoContainer;
- ULONG ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
- std::vector<SvStream*> vStream;
- std::vector<SvStream*>::iterator iter;
- pBentoContainer->CreateGraphicStreams(&vStream);
- for (iter=vStream.begin();iter!=vStream.end();iter++)
- {
- LwpSdwFileLoader fileLoader(*iter);
- fileLoader.RegisterStyle();
- delete *iter;
- }
- vStream.clear();
- }*/
if (m_sServerContextFormat[1]=='l'&&m_sServerContextFormat[2]=='c'&&m_sServerContextFormat[3]=='h')
{
LwpVirtualLayout* pMyLayout = GetLayout(NULL);
@@ -418,7 +388,10 @@ void LwpGraphicObject::CreateDrawObjects()
LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
OpenStormBento::LtcBenContainer* pBentoContainer;
- /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return;
+
SvStream* pDrawObjStream = NULL;
// get graphic object's bento objet name
@@ -463,7 +436,10 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData)
LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
OpenStormBento::LtcBenContainer* pBentoContainer;
- /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return 0;
+
SvStream* pGrafStream = NULL;
// get graphic object's bento objet name
@@ -503,7 +479,9 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
OpenStormBento::LtcBenContainer* pBentoContainer;
- /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return 0;
SvStream* pGrafStream = NULL;
diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx
index ba0192d56ee9..f798c29cfa08 100644
--- a/lotuswordpro/source/filter/lwpidxmgr.cxx
+++ b/lotuswordpro/source/filter/lwpidxmgr.cxx
@@ -69,6 +69,7 @@
**********************************************************************************************************************/
#include "lwpidxmgr.hxx"
+#include "lwptools.hxx"
const sal_uInt8 LwpIndexManager::MAXOBJECTIDS = 255;
@@ -122,8 +123,11 @@ void LwpIndexManager::Read(LwpSvStream* pStrm)
for (sal_uInt16 k = 0; k < m_nLeafCount; k++)
{
//Read leaf
- pStrm->Seek(m_ChildIndex[k]+LwpSvStream::LWP_STREAM_BASE);
+ sal_Int64 nPos = m_ChildIndex[k]+LwpSvStream::LWP_STREAM_BASE;
+ sal_Int64 nActualPos = pStrm->Seek(nPos);
+ if (nPos != nActualPos)
+ throw BadSeek();
//Old Code
//ReadLeafIndex(pStrm);
@@ -150,7 +154,7 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm)
sal_uInt16 KeyCount = 0;
pObjStrm->QuickRead(&KeyCount, sizeof(KeyCount));
- m_nLeafCount = KeyCount + 1;
+ m_nLeafCount = KeyCount ? KeyCount + 1 : 0;
if(KeyCount)
{
@@ -160,7 +164,6 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm)
m_RootObjs.push_back(akey);
- //sal_uInt8 k = 0;
sal_uInt16 k = 0;
for (k = 1; k < KeyCount; k++)
@@ -216,7 +219,9 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm)
}
for (k = 0; k < KeyCount; k++)
+ {
pObjStrm->QuickRead(&(vObjIndexs[k]->offset), sizeof(sal_uInt32));
+ }
for (k = 0; k < LeafCount; k++)
pObjStrm->QuickRead(&(m_TempVec[k]), sizeof(sal_uInt32));
@@ -224,7 +229,13 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm)
for( sal_uInt16 j=0; j<LeafCount; j++ )
{
- pObjStrm->GetStream()->Seek( m_TempVec[j]+LwpSvStream::LWP_STREAM_BASE);
+ sal_Int64 nPos = m_TempVec[j]+LwpSvStream::LWP_STREAM_BASE;
+ sal_Int64 nActualPos = pObjStrm->GetStream()->Seek(nPos);
+
+ if (nPos != nActualPos)
+ throw BadSeek();
+
+
ReadLeafIndex(pObjStrm->GetStream());
if(j!=LeafCount-1)
@@ -283,7 +294,7 @@ void LwpIndexManager::ReadLeafIndex( LwpSvStream *pStrm )
*/
void LwpIndexManager::ReadLeafData( LwpObjectStream *pObjStrm )
{
- sal_uInt16 KeyCount;
+ sal_uInt16 KeyCount=0;
pObjStrm->QuickRead(&KeyCount, sizeof(KeyCount));
if(KeyCount)
@@ -296,13 +307,13 @@ void LwpIndexManager::ReadLeafData( LwpObjectStream *pObjStrm )
for (sal_uInt8 k = 1; k < KeyCount; k++)
{
akey = new LwpKey();
- akey->id.ReadCompressed(pObjStrm, m_ObjectKeys[m_nKeyCount+k-1]->id);
+ akey->id.ReadCompressed(pObjStrm, m_ObjectKeys.at(m_nKeyCount+k-1)->id);
m_ObjectKeys.push_back(akey);
}
for (sal_uInt8 j = 0; j < KeyCount; j++)
{
- pObjStrm->QuickRead(&(m_ObjectKeys[m_nKeyCount+j]->offset), sizeof(sal_uInt32));
+ pObjStrm->QuickRead(&(m_ObjectKeys.at(m_nKeyCount+j)->offset), sizeof(sal_uInt32));
}
}
m_nKeyCount += KeyCount;
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index af6aa83f40af..1164aee1c707 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -80,7 +80,8 @@
LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
-{}
+{
+}
void LwpVirtualLayout::Read()
{
@@ -138,7 +139,7 @@ sal_Bool LwpVirtualLayout::HonorProtection()
if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
return sal_False;
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
return pParent->HonorProtection();
@@ -166,7 +167,7 @@ sal_Bool LwpVirtualLayout::IsProtected()
{
sal_Bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected))
@@ -198,7 +199,7 @@ sal_Bool LwpVirtualLayout::HasProtection()
if(m_nAttributes & STYLE_PROTECTED)
return sal_True;
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
return pParent->HasProtection();
@@ -229,7 +230,7 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
if(GetLayoutType()!=LWP_PAGE_LAYOUT)
{
//get parent
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT))
return pParent->GetUseWhen();
@@ -341,7 +342,7 @@ sal_Bool LwpVirtualLayout::IsMinimumHeight()
*/
LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
{
- return static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ return dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
}
/**
@@ -351,12 +352,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
void LwpVirtualLayout::RegisterChildStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLayout)
{
pLayout->SetFoundry(m_pFoundry);
pLayout->RegisterStyle();
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
}
}
@@ -370,7 +371,7 @@ sal_Bool LwpVirtualLayout::IsStyleLayout()
if (m_nAttributes3 & STYLE3_STYLELAYOUT)
return sal_True;
- LwpVirtualLayout* pParent =static_cast<LwpVirtualLayout*>(GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent()->obj());
if (pParent)
return pParent->IsStyleLayout();
return sal_False;
@@ -386,7 +387,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
while(pID && !pID->IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj());
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj());
if(!pLayout)
{
break;
@@ -446,30 +447,30 @@ LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout
if (!pStartLayout && !m_OnlyLayout.IsNull())
/* Looking for the first layout and there's only one layout in the list.*/
- return static_cast<LwpVirtualLayout*>(m_OnlyLayout.obj());
+ return dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj());
- LwpObjectHolder* pObjHolder =static_cast<LwpObjectHolder*>(m_Layouts.GetHead()->obj());
+ LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead()->obj());
if(pObjHolder)
{
- pLayout = static_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
if(!pStartLayout )
return pLayout;
while(pObjHolder && pStartLayout != pLayout)
{
- pObjHolder = static_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
+ pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
if(pObjHolder)
{
- pLayout = static_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
}
}
if(pObjHolder)
{
- pObjHolder = static_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
+ pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
if(pObjHolder)
{
- pLayout = static_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
return pLayout;
}
}
@@ -496,16 +497,27 @@ void LwpHeadLayout::Read()
void LwpHeadLayout::RegisterStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLayout)
{
pLayout->SetFoundry(m_pFoundry);
//if the layout is relative to para, the layout will be registered in para
if(!pLayout->IsRelativeAnchored())
{
+ if (pLayout == this)
+ {
+ OSL_FAIL("Layout points to itself");
+ break;
+ }
pLayout->RegisterStyle();
}
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+ LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+ if (pNext == pLayout)
+ {
+ OSL_FAIL("Layout points to itself");
+ break;
+ }
+ pLayout = pNext;
}
}
@@ -515,14 +527,14 @@ void LwpHeadLayout::RegisterStyle()
*/
LwpVirtualLayout* LwpHeadLayout::FindEnSuperTableLayout()
{
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLayout)
{
if(pLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
{
return pLayout;
}
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
}
return NULL;
}
@@ -645,12 +657,12 @@ LwpLayoutGeometry* LwpMiddleLayout::GetGeometry()
{
if( !m_LayGeometry.IsNull() )
{
- return ( static_cast<LwpLayoutGeometry*> (m_LayGeometry.obj()) );
+ return ( dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj()) );
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetGeometry();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetGeometry() : NULL;
}
return NULL;
}
@@ -697,8 +709,9 @@ sal_Bool LwpMiddleLayout::MarginsSameAsParent()
}
if(!m_BasedOnStyle.IsNull())
{
- LwpVirtualLayout* play = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
- play->MarginsSameAsParent();
+ LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ if (pLay)
+ pLay->MarginsSameAsParent();
}
return LwpVirtualLayout::MarginsSameAsParent();
@@ -715,7 +728,7 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
{
if ( MarginsSameAsParent() )
{
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
fValue = pParent->GetMarginsValue(nWhichSide);
@@ -726,14 +739,14 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
if(m_nOverrideFlag & OVER_MARGINS)
{
- LwpLayoutMargins* pMar1 = static_cast<LwpLayoutMargins*> (m_LayMargins.obj());
+ LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj());
if(pMar1)
{
fValue = pMar1->GetMargins()->GetMarginsValue(nWhichSide);
return fValue;
}
}
- LwpVirtualLayout* pStyle = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
if(pStyle)
{
fValue = pStyle->GetMarginsValue(nWhichSide);
@@ -752,14 +765,14 @@ double LwpMiddleLayout::GetExtMarginsValue(const sal_uInt8 &nWhichSide)
double fValue = 0;
if(m_nOverrideFlag & OVER_MARGINS)
{
- LwpLayoutMargins* pMar1 = static_cast<LwpLayoutMargins*> (m_LayMargins.obj());
+ LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj());
if(pMar1)
{
fValue = pMar1->GetExtMargins()->GetMarginsValue(nWhichSide);
return fValue;
}
}
- LwpVirtualLayout* pStyle = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
if(pStyle)
{
fValue = pStyle->GetExtMarginsValue(nWhichSide);
@@ -777,13 +790,13 @@ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff()
{
if(m_nOverrideFlag & OVER_BORDERS)
{
- LwpLayoutBorder* pLayoutBorder = static_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj());
- return pLayoutBorder->GetBorderStuff();
+ LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj());
+ return pLayoutBorder ? pLayoutBorder->GetBorderStuff() : NULL;
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetBorderStuff();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetBorderStuff() : NULL;
}
return NULL;
}
@@ -798,13 +811,13 @@ LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff()
{
if(m_nOverrideFlag & OVER_BACKGROUND)
{
- LwpLayoutBackground* pLayoutBackground = static_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj());
- return pLayoutBackground->GetBackgoudStuff();
+ LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj());
+ return pLayoutBackground ? pLayoutBackground->GetBackgoudStuff() : NULL;
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetBackgroundStuff();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetBackgroundStuff() : NULL;
}
return NULL;
}
@@ -905,13 +918,13 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride()
if(m_nAttributes & OVER_TABS)
{
if(!m_TabPiece.IsNull())
- return (LwpTabOverride*)static_cast<LwpTabPiece*>(m_TabPiece.obj())->GetOverride();
+ return (LwpTabOverride*) dynamic_cast<LwpTabPiece*>(m_TabPiece.obj())->GetOverride();
return NULL;
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetTabOverride();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetTabOverride() : NULL;
}
return NULL;
}
@@ -927,7 +940,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleMode(void)
if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
return GetLayoutScale()->GetScaleMode();
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleMode();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleMode();
else
return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO);
}
@@ -945,7 +958,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleTile(void)
return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED)
? 1 : 0;
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleTile();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleTile();
else
return 0;
}
@@ -965,7 +978,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleCenter(void)
return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED)
? 1 : 0;
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleCenter();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleCenter();
else
return 0;
}
@@ -984,7 +997,7 @@ sal_uInt32 LwpMiddleLayout::GetScalePercentage(void)
if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
return GetLayoutScale()->GetScalePercentage()/10;//m_nScalePercentage 1000 = 100%
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScalePercentage();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScalePercentage();
else
return 100;
}
@@ -1000,7 +1013,7 @@ double LwpMiddleLayout::GetScaleWidth(void)
if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleWidth());
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleWidth();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleWidth();
else
return 0;
}
@@ -1016,7 +1029,7 @@ double LwpMiddleLayout::GetScaleHeight(void)
if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleHeight());
else if (m_BasedOnStyle.obj())
- return static_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleHeight();
+ return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleHeight();
else
return 0;
}
@@ -1073,8 +1086,8 @@ sal_Bool LwpMiddleLayout::IsSizeRightToContainer(void)
}
else if (m_BasedOnStyle.obj())
{
- LwpMiddleLayout * pLayout = static_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
- return pLayout->IsSizeRightToContainer();
+ LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
+ return pLayout ? pLayout->IsSizeRightToContainer() : sal_False;
}
else
return sal_False;
@@ -1092,8 +1105,8 @@ sal_Bool LwpMiddleLayout::IsSizeRightToContent(void)
}
else if (m_BasedOnStyle.obj())
{
- LwpMiddleLayout * pLayout = static_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
- return pLayout->IsSizeRightToContent();
+ LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
+ return pLayout ? pLayout->IsSizeRightToContent() : sal_False;
}
else
return sal_False;
@@ -1191,8 +1204,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrow()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsAutoGrow();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->IsAutoGrow() : sal_False;
}
return LwpVirtualLayout::IsAutoGrow();
}
@@ -1209,8 +1222,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowDown()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsAutoGrowDown();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->IsAutoGrowDown() : sal_False;
}
return LwpVirtualLayout::IsAutoGrowDown();
}
@@ -1227,8 +1240,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowUp()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsAutoGrowUp();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->IsAutoGrowUp() : sal_False;
}
return LwpVirtualLayout::IsAutoGrowUp();
}
@@ -1245,8 +1258,9 @@ sal_Bool LwpMiddleLayout::IsAutoGrowLeft()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsAutoGrowLeft();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->IsAutoGrowLeft();
}
return LwpVirtualLayout::IsAutoGrowLeft();
}
@@ -1263,8 +1277,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowRight()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsAutoGrowRight();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->IsAutoGrowRight() : sal_False;
}
return LwpVirtualLayout::IsAutoGrowRight();
}
@@ -1279,13 +1293,15 @@ sal_uInt8 LwpMiddleLayout::GetContentOrientation()
//content orientation in Graphic objects and OLE objects not supported now
if((m_nOverrideFlag & OVER_ROTATION)&& !m_LayGeometry.IsNull())
{
- LwpLayoutGeometry* pLayGeometry = static_cast<LwpLayoutGeometry*> (m_LayGeometry.obj());
- return pLayGeometry->GetContentOrientation();
+ LwpLayoutGeometry* pLayGeometry = dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj());
+ if (pLayGeometry)
+ return pLayGeometry->GetContentOrientation();
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetContentOrientation();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->GetContentOrientation();
}
return LwpVirtualLayout::GetContentOrientation();
}
@@ -1301,7 +1317,7 @@ sal_Bool LwpMiddleLayout::HonorProtection()
if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
return sal_False;
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
return pParent->HonorProtection();
@@ -1318,8 +1334,9 @@ sal_Bool LwpMiddleLayout::HonorProtection()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->HonorProtection();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->HonorProtection();
}
return LwpVirtualLayout::HonorProtection();
@@ -1338,13 +1355,13 @@ sal_Bool LwpMiddleLayout::IsProtected()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- bProtected = pLay->IsProtected();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ bProtected = pLay ? pLay->IsProtected() : sal_False;
}
else
bProtected = LwpVirtualLayout::IsProtected();
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*> (GetParent()->obj());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
if(pParent && !pParent->IsHeader())
{
/* If a parent's protected then none of its children can be accessed. */
@@ -1380,14 +1397,14 @@ sal_Bool LwpMiddleLayout::IsProtected()
*/
LwpVirtualLayout* LwpMiddleLayout::GetWaterMarkLayout()
{
- LwpVirtualLayout* pLay = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLay)
{
if( pLay->IsForWaterMark())
{
return pLay;
}
- pLay = static_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
+ pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
}
return NULL;
}
@@ -1402,7 +1419,7 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage()
if(pLay)
{
//test BGImage
- LwpGraphicObject* pGrfObj = static_cast<LwpGraphicObject*>(pLay->GetContent()->obj());
+ LwpGraphicObject* pGrfObj = dynamic_cast<LwpGraphicObject*>(pLay->GetContent()->obj());
if(pGrfObj)
{
XFBGImage* pXFBGImage = new XFBGImage();
@@ -1465,8 +1482,8 @@ sal_Bool LwpMiddleLayout::GetUsePrinterSettings()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetUsePrinterSettings();
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetUsePrinterSettings() : sal_False;
}
return sal_False;
}
@@ -1541,14 +1558,14 @@ sal_uInt16 LwpLayout::GetNumCols()
{
if(m_nOverrideFlag & OVER_COLUMNS)
{
- LwpLayoutColumns* pLayColumns = static_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+ LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
if(pLayColumns)
{
return pLayColumns->GetNumCols();
}
}
- LwpVirtualLayout* pStyle = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
if(pStyle)
{
return pStyle->GetNumCols();
@@ -1566,14 +1583,14 @@ double LwpLayout::GetColWidth(sal_uInt16 nIndex)
{
if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO))
{
- LwpLayoutColumns* pLayColumns = static_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+ LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
if(pLayColumns)
{
return pLayColumns->GetColWidth(nIndex);
}
}
- LwpVirtualLayout* pStyle = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
if(pStyle)
{
return pStyle->GetColWidth(nIndex);
@@ -1591,14 +1608,14 @@ double LwpLayout::GetColGap(sal_uInt16 nIndex)
{
if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO))
{
- LwpLayoutColumns* pLayColumns = static_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+ LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
if(pLayColumns)
{
return pLayColumns->GetColGap(nIndex);
}
}
- LwpVirtualLayout* pStyle = static_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
if(pStyle)
{
return pStyle->GetColGap(nIndex);
@@ -1667,7 +1684,7 @@ XFColumnSep* LwpLayout::GetColumnSep()
{
//Get LwpLayoutGutters
- LwpLayoutGutters* pLayoutGutters = static_cast<LwpLayoutGutters*>(m_LayGutterStuff.obj());
+ LwpLayoutGutters* pLayoutGutters = dynamic_cast<LwpLayoutGutters*>(m_LayGutterStuff.obj());
if(!pLayoutGutters)
{
return NULL;
@@ -1750,8 +1767,8 @@ sal_uInt16 LwpLayout::GetUsePage()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetUsePage();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetUsePage() : 0;
}
return 0;
}
@@ -1768,8 +1785,8 @@ LwpUseWhen* LwpLayout::VirtualGetUseWhen()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->VirtualGetUseWhen();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->VirtualGetUseWhen() : NULL;
}
return LwpVirtualLayout::VirtualGetUseWhen();
}
@@ -1790,8 +1807,9 @@ sal_Bool LwpLayout::IsUseOnAllPages()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsUseOnAllPages();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->IsUseOnAllPages();
}
return LwpVirtualLayout::IsUseOnAllPages();
}
@@ -1812,8 +1830,9 @@ sal_Bool LwpLayout::IsUseOnAllEvenPages()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsUseOnAllEvenPages();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->IsUseOnAllEvenPages();
}
return LwpVirtualLayout::IsUseOnAllEvenPages();
}
@@ -1834,8 +1853,9 @@ sal_Bool LwpLayout::IsUseOnAllOddPages()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsUseOnAllOddPages();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->IsUseOnAllOddPages();
}
return LwpVirtualLayout::IsUseOnAllOddPages();
}
@@ -1856,8 +1876,9 @@ sal_Bool LwpLayout::IsUseOnPage()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->IsUseOnPage();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->IsUseOnPage();
}
return LwpVirtualLayout::IsUseOnPage();
}
@@ -1872,13 +1893,13 @@ LwpShadow* LwpLayout::GetShadow()
{
if(m_nOverrideFlag & OVER_SHADOW)
{
- LwpLayoutShadow* pLayoutShadow = static_cast<LwpLayoutShadow*>(m_LayShadow.obj());
- return pLayoutShadow->GetShadow();
+ LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj());
+ return pLayoutShadow ? pLayoutShadow->GetShadow() : NULL;
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpLayout* pLay = static_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetShadow();
+ LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetShadow() : NULL;
}
return NULL;
}
@@ -1946,11 +1967,11 @@ LwpVirtualLayout* LwpLayout::GetContainerLayout()
if(IsRelativeAnchored())
{
//get position
- LwpPara* pPara = static_cast<LwpPara*>(GetPosition()->obj());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj());
if(pPara)
{
LwpStory* pStory = pPara->GetStory();
- return pStory->GetTabLayout();
+ return pStory ? pStory->GetTabLayout() : NULL;
}
}
return GetParentLayout();
@@ -2022,8 +2043,9 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpPlacableLayout* pLay = static_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetWrapType();
+ LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+ if (pLay)
+ return pLay->GetWrapType();
}
return LAY_WRAP_AROUND;
}
@@ -2039,13 +2061,13 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
{
if(m_nOverrideFlag & OVER_PLACEMENT)
{
- return static_cast<LwpLayoutRelativity*>(m_LayRelativity.obj());
+ return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj());
}
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpPlacableLayout* pLay = static_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetRelativityPiece();
+ LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetRelativityPiece() : NULL;
}
return NULL;
}
@@ -2139,8 +2161,8 @@ sal_Int32 LwpPlacableLayout::GetBaseLineOffset()
}
else if( !m_BasedOnStyle.IsNull() )
{
- LwpPlacableLayout* pLay = static_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
- return pLay->GetBaseLineOffset();
+ LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+ return pLay ? pLay->GetBaseLineOffset() : 0;
}
return 0;
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 3e82247720a9..056cd6874fda 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -303,7 +303,7 @@ public:
XFBGImage* GetXFBGImage();
virtual sal_Bool GetUsePrinterSettings();
- LwpLayoutScale* GetLayoutScale(){return static_cast<LwpLayoutScale*>(m_LayScale.obj());}
+ LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj());}
sal_uInt16 GetScaleMode(void);
void SetScaleMode(sal_uInt16 nVal);
sal_uInt16 GetScaleTile(void);
diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx
index 48fbfabb7a9b..174ad2f4102e 100644
--- a/lotuswordpro/source/filter/lwpmarker.cxx
+++ b/lotuswordpro/source/filter/lwpmarker.cxx
@@ -137,7 +137,7 @@ OUString LwpCHBlkMarker::GetPromptText()
{
LwpStory* pStory = NULL;
if (m_objPromptStory.obj())
- pStory = static_cast<LwpStory*>(m_objPromptStory.obj());
+ pStory = dynamic_cast<LwpStory*>(m_objPromptStory.obj());
if (pStory)
return pStory->GetContentText();
return A2OUSTR("");
@@ -380,6 +380,9 @@ sal_Bool LwpBookMark::IsRightName(OUString sName)
LwpFieldMark::LwpFieldMark(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
: LwpStoryMarker(objHdr,pStrm)
+ , m_nExtra(0)
+ , m_nFlag(0)
+ , m_nFieldType(0)
, m_bHasStyle(sal_False)
, m_bHasStart(sal_False)
, m_pFrib(NULL)
diff --git a/lotuswordpro/source/filter/lwpmarker.hxx b/lotuswordpro/source/filter/lwpmarker.hxx
index 92e0541b02e2..c99643c080c9 100644
--- a/lotuswordpro/source/filter/lwpmarker.hxx
+++ b/lotuswordpro/source/filter/lwpmarker.hxx
@@ -203,7 +203,6 @@ public:
void Read();
void ParseIndex(OUString& sKey1,OUString& sKey2);
void ParseTOC(OUString& sLevel,OUString& sText);
-// sal_uInt8 ParseCrossRef(OUString& sMarkName);
sal_uInt16 GetFieldType(){return m_nFieldType;}
sal_Bool IsFormulaInsert();
sal_Bool IsDateTimeField(sal_uInt8& type,OUString& formula);
diff --git a/lotuswordpro/source/filter/lwpobjfactory.cxx b/lotuswordpro/source/filter/lwpobjfactory.cxx
index 0036727c03d3..4fddd8a819f6 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.cxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.cxx
@@ -110,44 +110,28 @@
LwpObjectFactory::LwpObjectFactory(LwpSvStream* pSvStream)
: m_nNumObjs(0), m_pSvStream(pSvStream)
{
- m_ObjList.clear();
+ m_IdToObjList.clear();
}
LwpObjectFactory::~LwpObjectFactory()
{
-// m_pMgr = NULL;
- if(!m_ObjList.empty())
+ if(!m_IdToObjList.empty())
ClearObjectMap();
}
/**
- * @descr create the single object factory
-*/
-/*
-LwpObjectFactory* LwpObjectFactory::Instance(LwpSvStream* pStream)
-{
- if(m_pMgr == NULL)
- {
- if(pStream)
- {
- m_pMgr = new LwpObjectFactory(pStream);
- }
- }
- return(m_pMgr);
-}*/
-/**
* @descr clear object map and delete all objects
*/
void LwpObjectFactory::ClearObjectMap()
{
- LwpObjMap::iterator it = m_ObjList.begin();
- while( it!=m_ObjList.end() )
+ LwpIdToObjMap::iterator it = m_IdToObjList.begin();
+ while( it!=m_IdToObjList.end() )
{
- delete (*it).second;
- (*it).second = NULL;
+ delete it->second;
+ it->second = NULL;
++it;
}
- m_ObjList.clear();
+ m_IdToObjList.clear();
}
/**
* @descr read the index manager
@@ -713,7 +697,7 @@ LwpObject* LwpObjectFactory::CreateObject(sal_uInt32 type, LwpObjectHeader &objH
if(newObj)
{
newObj->QuickRead();
- m_ObjList.insert(LwpObjMap::value_type(*objHdr.GetID(), newObj));
+ m_IdToObjList.insert(LwpIdToObjMap::value_type(*objHdr.GetID(), newObj));
}
return(newObj);
@@ -730,12 +714,22 @@ LwpObject* LwpObjectFactory::QueryObject(const LwpObjectID &objID)
//Read the object from file
sal_uInt32 nStreamOffset = m_IndexMgr.GetObjOffset(objID);
if(nStreamOffset == BAD_OFFSET) //does not find the offset in index manager
+ return NULL;
+
+ sal_Int64 nDesiredPos = nStreamOffset + LwpSvStream::LWP_STREAM_BASE;
+ if (nDesiredPos != m_pSvStream->Seek(nDesiredPos))
+ return NULL;
+ LwpObjectHeader objHdr;
+ if (!objHdr.Read(*m_pSvStream))
+ return NULL;
+
+ LwpObjectID* pId = objHdr.GetID();
+ if (pId && (*pId != objID))
{
+ OSL_FAIL("apparently incorrect objid, invalidating");
return NULL;
}
- m_pSvStream->Seek( nStreamOffset + LwpSvStream::LWP_STREAM_BASE );
- LwpObjectHeader objHdr;
- objHdr.Read(*m_pSvStream);
+
obj = CreateObject(objHdr.GetTag(), objHdr);
}
return obj;
@@ -746,8 +740,8 @@ LwpObject* LwpObjectFactory::QueryObject(const LwpObjectID &objID)
*/
LwpObject* LwpObjectFactory::FindObject(const LwpObjectID &objID)
{
- LwpObjMap::const_iterator it = m_ObjList.find(objID);
- if (it != m_ObjList.end()) {
+ LwpIdToObjMap::const_iterator it = m_IdToObjList.find(objID);
+ if (it != m_IdToObjList.end()) {
return((*it).second);
}
else
@@ -761,7 +755,7 @@ LwpObject* LwpObjectFactory::FindObject(const LwpObjectID &objID)
void LwpObjectFactory::ReleaseObject(const LwpObjectID &objID)
{
LwpObject* obj = FindObject( objID );
- m_ObjList.erase(objID);
+ m_IdToObjList.erase(objID);
if( obj )
delete obj;
}
diff --git a/lotuswordpro/source/filter/lwpobjfactory.hxx b/lotuswordpro/source/filter/lwpobjfactory.hxx
index 16c0cd13c9e9..83da5d24c8cd 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.hxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.hxx
@@ -101,8 +101,8 @@ private:
return(rKey1==rKey2);
}
};
- typedef boost::unordered_map<LwpObjectID, LwpObject *, hashFunc, eqFunc> LwpObjMap;
- LwpObjMap m_ObjList;
+ typedef boost::unordered_map<LwpObjectID, LwpObject *, hashFunc, eqFunc> LwpIdToObjMap;
+ LwpIdToObjMap m_IdToObjList;
LwpIndexManager m_IndexMgr;
void ClearObjectMap();
diff --git a/lotuswordpro/source/filter/lwpobjhdr.cxx b/lotuswordpro/source/filter/lwpobjhdr.cxx
index 271ee9babb84..ef6e253067d1 100644
--- a/lotuswordpro/source/filter/lwpobjhdr.cxx
+++ b/lotuswordpro/source/filter/lwpobjhdr.cxx
@@ -74,9 +74,8 @@ LwpObjectHeader::LwpObjectHeader()
/**
* @descr read header from stream
*/
-void LwpObjectHeader::Read(LwpSvStream &rStrm)
+bool LwpObjectHeader::Read(LwpSvStream &rStrm)
{
-
sal_uInt8 nFlagBits = 0;
sal_uInt32 nVersionID = 0;
sal_uInt32 nRefCount = 0;
@@ -84,6 +83,8 @@ void LwpObjectHeader::Read(LwpSvStream &rStrm)
sal_uInt32 nNextVersionID = 0;
sal_uInt32 nHeaderSize = 0;
+ sal_Int64 nStartPos = rStrm.Tell();
+
if ( LwpFileHeader::m_nFileRevision < 0x000B)
{
rStrm.Read(&m_nTag, sizeof(m_nTag));
@@ -196,6 +197,8 @@ void LwpObjectHeader::Read(LwpSvStream &rStrm)
m_bCompressed = sal_True;
}
}
+ sal_Int64 nEndPos = rStrm.Tell();
+ return (nStartPos + nHeaderSize == nEndPos);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobjhdr.hxx b/lotuswordpro/source/filter/lwpobjhdr.hxx
index a5fda95aca73..ac0068d7a251 100644
--- a/lotuswordpro/source/filter/lwpobjhdr.hxx
+++ b/lotuswordpro/source/filter/lwpobjhdr.hxx
@@ -112,7 +112,7 @@ private:
};
public:
- void Read(LwpSvStream &pStrm);
+ bool Read(LwpSvStream &pStrm);
inline sal_uInt32 GetTag();
inline sal_uInt32 GetSize();
inline LwpObjectID* GetID();
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
index 8d5567b84e34..2b7df1fae742 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.cxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -100,6 +100,7 @@ void LwpObjectStream::Read2Buffer()
if( m_bCompressed )
{
sal_uInt8* pCompressBuffer = new sal_uInt8[m_nBufSize];
+ memset(pCompressBuffer, 0, m_nBufSize);
m_pStrm->Read(pCompressBuffer, m_nBufSize);
sal_uInt8 pTempDst[IO_BUFFERSIZE];
@@ -165,6 +166,7 @@ void LwpObjectStream::ReleaseBuffer()
*/
sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len)
{
+ memset(buf, 0, len);
if( len > m_nBufSize - m_nReadPos )
{
assert(false);
@@ -304,6 +306,8 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s
// where zzzzzz is the count - 1 of compressed 0 bytes
Cnt = (*pSrc++ & 0x3F) + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
memset(pDst, 0, Cnt);
pDst += Cnt;
DstSize += Cnt;
@@ -317,15 +321,21 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s
// and nnn is the count - 1 of following non-zero bytes
Cnt = ((*pSrc & 0x38) >> 3) + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
memset(pDst, 0, Cnt);
pDst += Cnt;
DstSize += Cnt;
Cnt = (*pSrc++ & 0x07) + 1;
+ if (Size < Cnt + 1)
+ throw BadDecompress();
+ Size -= Cnt + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
memcpy(pDst, pSrc, Cnt);
pDst += Cnt;
DstSize += Cnt;
pSrc += Cnt;
- Size -= Cnt + 1;
break;
case 0x80:
@@ -344,14 +354,21 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s
// nnnnnn is the count less 1 of following non-zero bytes
Cnt = (*pSrc++ & 0x3F) + 1;
+ if (Size < Cnt + 1)
+ throw BadDecompress();
+ Size -= Cnt + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
memcpy(pDst, pSrc, Cnt);
pDst += Cnt;
DstSize += Cnt;
pSrc += Cnt;
- Size -= Cnt + 1;
break;
}
assert(DstSize < IO_BUFFERSIZE);
+ if (DstSize >= IO_BUFFERSIZE)
+ throw BadDecompress();
+
}
return(static_cast<sal_uInt16>(DstSize));
}
diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx
index af46e8dd16ed..6c39b477b9e1 100644
--- a/lotuswordpro/source/filter/lwpoverride.cxx
+++ b/lotuswordpro/source/filter/lwpoverride.cxx
@@ -612,8 +612,6 @@ void LwpIndentOverride::OverrideRelative(sal_uInt16 relative)
void LwpSpacingOverride::Override(LwpSpacingOverride* other)
{
-// if (IsAlwaysOverridden())
-// other->SetAlways(IsAlways());//To be done
if (other)
{
m_pSpacing->Override(other->GetSpacing());
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 76b2bb982a9f..d3eab7b9d6c3 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -269,7 +269,9 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
LwpDocument* pDocument = m_pFoundry->GetDocument();
if(pDocument)
{
- LwpFootnoteOptions* pFootnoteOpts = static_cast<LwpFootnoteOptions*>(pDocument->GetValidFootnoteOpts()->obj());
+ LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
+
+ LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj()) : NULL;
if(pFootnoteOpts)
{
LwpFootnoteSeparatorOptions* pFootnoteSep = pFootnoteOpts->GetFootnoteSeparator();
@@ -476,8 +478,8 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
{
//get filerpage story from division info
LwpDocument* pDoc = m_pFoundry->GetDocument();
- LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*>(pDoc->GetDivInfoID()->obj());
- LwpStory* pStory = static_cast<LwpStory*>(pDivInfo->GetFillerPageTextID()->obj());
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID()->obj());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID()->obj());
//parse fillerpage story
if(pStory)
@@ -500,24 +502,24 @@ void LwpPageLayout::ResetXFColumns()
LwpHeaderLayout* LwpPageLayout::GetHeaderLayout()
{
- LwpVirtualLayout* pLay = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLay)
{
if( pLay->GetLayoutType() == LWP_HEADER_LAYOUT )
return ( static_cast<LwpHeaderLayout*> (pLay) );
- pLay = static_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
+ pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
}
return NULL;
}
LwpFooterLayout* LwpPageLayout::GetFooterLayout()
{
- LwpVirtualLayout* pLay = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLay)
{
if( pLay->GetLayoutType() == LWP_FOOTER_LAYOUT )
return ( static_cast<LwpFooterLayout*> (pLay) );
- pLay = static_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
+ pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
}
return NULL;
}
@@ -530,7 +532,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout()
{
if(IsComplex())
{
- LwpVirtualLayout* pLay = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+ LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
while(pLay)
{
if( pLay->GetLayoutType() == LWP_PAGE_LAYOUT )
@@ -542,7 +544,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout()
return pPageLayout;
}
}
- pLay = static_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
+ pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
}
}
return NULL;
@@ -574,11 +576,11 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber)
sal_Int16 nPageNumber = -1;
LwpFoundry* pFoundry = this->GetFoundry();
LwpDocument* pDoc = pFoundry->GetDocument();
- LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID()->obj());
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID()->obj());
if(!pHeadTail) return nPageNumber;
//get first pagehint
- LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetHead()->obj());
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetHead()->obj());
while(pPageHint)
{
if(*(this->GetObjectID()) == *(pPageHint->GetPageLayoutID()))
@@ -608,7 +610,7 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber)
}
}
- pPageHint = static_cast<LwpPageHint*>(pPageHint->GetNext()->obj());
+ pPageHint = dynamic_cast<LwpPageHint*>(pPageHint->GetNext()->obj());
}
if(nPageNumber>=0)
{
@@ -709,7 +711,7 @@ sal_Bool LwpPageLayout::operator<(LwpPageLayout& Other)
*/
LwpPara* LwpPageLayout::GetPagePosition()
{
- LwpPara* pPara = static_cast<LwpPara*>(GetPosition()->obj());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj());
if(pPara)
return pPara;
//Get the position from its related section
@@ -720,7 +722,7 @@ LwpPara* LwpPageLayout::GetPagePosition()
while( (pSection = pFoundry->EnumSections(pSection)) )
{
if(pSection->GetPageLayout() == this)
- return static_cast<LwpPara*>(pSection->GetPosition()->obj());
+ return dynamic_cast<LwpPara*>(pSection->GetPosition()->obj());
}
}
@@ -784,15 +786,15 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1)
}
//Set left,right,bottom margins
- LwpMiddleLayout* parent = static_cast<LwpMiddleLayout*> (GetParent()->obj());
+ LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj());
//left margin in SODC: the space from the left edge of body to the left edge of header
- double left = GetMarginsValue(MARGIN_LEFT) - parent->GetMarginsValue(MARGIN_LEFT);
+ double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0);
if(left<=0) //The left margin in SODC can not be minus value
{
left = -1;
}
//left margin in SODC: the space from the right edge of header to the right edge of body
- double right = GetMarginsValue(MARGIN_RIGHT) - parent->GetMarginsValue(MARGIN_RIGHT);
+ double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0);
if(right<=0)//The right margin in SODC can not be minus value
{
right = -1;
@@ -952,13 +954,13 @@ void LwpFooterLayout::ParseMargins(XFFooterStyle* pFooterStyle)
}
//Set left,right,top margins
- LwpMiddleLayout* parent = static_cast<LwpMiddleLayout*> (GetParent()->obj());
- double left = GetMarginsValue(MARGIN_LEFT) - parent->GetMarginsValue(MARGIN_LEFT);
+ LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj());
+ double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0);
if(left<=0) //The left margin in SODC can not be minus value
{
left = -1;
}
- double right = GetMarginsValue(MARGIN_RIGHT) - parent->GetMarginsValue(MARGIN_RIGHT);
+ double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0);
if(right<=0)//The left margin in SODC can not be minus value
{
right = -1;
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 9255d889b007..2ca575028927 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -260,12 +260,11 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
{
m_pXFContainer = pCont;
- if (static_cast<LwpStory*>(m_Story.obj())->GetDropcapFlag() == sal_True)
+ LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj());
+
+ if (pStory && pStory->GetDropcapFlag() == sal_True)
{
ParseDropcapContent();
- /*LwpObject* pNextPara = GetNext()->obj();
- if(pNextPara)
- pNextPara->XFConvert(pCont);*/
return;
}
@@ -280,8 +279,8 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
if(m_SectionStyleName.getLength()>0)
{
XFSection* pSection = CreateXFSection();
- LwpStory* pStory = static_cast<LwpStory*> ( m_Story.obj() );
- pStory->AddXFContent(pSection);
+ if (pStory)
+ pStory->AddXFContent(pSection);
//pSection->Add(pPara);
m_pXFContainer = pSection;
}
@@ -310,24 +309,15 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
if (m_pBreaks)
AddBreakAfter(m_pXFContainer);
-
- // maybe useful for futer version
- // deleted by
- // AddTabStopForTOC();
-
- //Caller is responsible for calling the next para object
- /*LwpObject* pNextPara = GetNext()->obj();
- if(pNextPara)
- pNextPara->XFConvert( m_pXFContainer );*/
}
sal_Bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
{
sal_Bool bSuccess = sal_False;
//get story
- LwpStory* pStory = static_cast<LwpStory*>(m_Story.obj());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj());
//if pagelayout is modified, register the pagelayout
- if(pStory->IsPMModified())
+ if(pStory && pStory->IsPMModified())
{
sal_Bool bNewSection = sal_False;
bNewSection = pStory->IsNeedSection();
@@ -386,7 +376,7 @@ void LwpPara::RegisterStyle()
pOverStyle->SetStyleName(A2OUSTR(""));
LwpParaProperty* pProps = m_pProps;
sal_uInt32 PropType;
- LwpParaStyle* pParaStyle = static_cast<LwpParaStyle*>(m_ParaStyle.obj());
+ LwpParaStyle* pParaStyle = dynamic_cast<LwpParaStyle*>(m_ParaStyle.obj());
while(pProps)
{
PropType = pProps->GetType();
@@ -700,7 +690,7 @@ void LwpPara::RegisterStyle()
}
if (pPara && pPara->GetPrevious())
- pPrePara = static_cast<LwpPara*>(pPara->GetPrevious()->obj(VO_PARA));
+ pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious()->obj(VO_PARA));
else
pPrePara=NULL;
@@ -759,7 +749,7 @@ void LwpPara::RegisterStyle()
if (noSpacing && GetPrevious())
{
- LwpPara* pPrePara = static_cast<LwpPara*>(GetPrevious()->obj());
+ LwpPara* pPrePara = dynamic_cast<LwpPara*>(GetPrevious()->obj());
if (pPrePara && pPrePara->GetBelowSpacing()!=0)
{
pOverStyle = new XFParaStyle;
@@ -840,8 +830,8 @@ void LwpPara::RegisterTabStyle(XFParaStyle* pXFParaStyle)
LwpTabOverride aFinaOverride;
LwpTabOverride* pBase = NULL;
//get the tabrack from the current layout
- LwpStory* pStory = static_cast<LwpStory*>(m_Story.obj());
- LwpMiddleLayout* pLayout = pStory->GetTabLayout();
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj());
+ LwpMiddleLayout* pLayout = pStory ? pStory->GetTabLayout() : NULL;
if(pLayout)
{
pBase = pLayout->GetTabOverride();
@@ -925,7 +915,7 @@ LwpVirtualLayout* LwpPara::GetLayoutWithMyStory()
LwpStory* pMyStory = NULL;
if (!m_Story.IsNull())
{
- pMyStory = static_cast<LwpStory*>(m_Story.obj(VO_STORY));
+ pMyStory = dynamic_cast<LwpStory*>(m_Story.obj(VO_STORY));
if (!pMyStory)
{
return NULL;
diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx
index 3f8897339ca4..7540a6fa2534 100644
--- a/lotuswordpro/source/filter/lwppara.hxx
+++ b/lotuswordpro/source/filter/lwppara.hxx
@@ -386,7 +386,7 @@ inline LwpObjectID* LwpPara::GetStoryID()
inline LwpStory* LwpPara::GetStory()
{
if (m_Story.obj())
- return static_cast<LwpStory*>(m_Story.obj());
+ return dynamic_cast<LwpStory*>(m_Story.obj());
return NULL;
}
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
index 2c287a49265f..b9656ced1521 100644
--- a/lotuswordpro/source/filter/lwppara1.cxx
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -175,13 +175,13 @@ LwpPara* LwpPara::GetParent()
if (level != 1)
{
- pPara = static_cast<LwpPara*>(GetPrevious()->obj());
+ pPara = dynamic_cast<LwpPara*>(GetPrevious()->obj());
while (pPara)
{
otherlevel = pPara->GetLevel();
if ((otherlevel < level) || (otherlevel && (level == 0)))
return pPara;
- pPara = static_cast<LwpPara*>(pPara->GetPrevious()->obj());
+ pPara = dynamic_cast<LwpPara*>(pPara->GetPrevious()->obj());
}
}
return NULL;
@@ -237,12 +237,12 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
//get suffix text frib
if ( (pFrib = pFrib->GetNext()) )
{
-// if((pFrib->GetType() == FRIB_TAG_TEXT) &&
-// (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
if( pFrib->GetType() == FRIB_TAG_TEXT )
{
- if ((pFrib->GetNext()->GetType() == FRIB_TAG_TEXT ) ||
- (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
+ if (
+ (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) ||
+ (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)
+ )
{
pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
}
@@ -323,21 +323,21 @@ void LwpPara::OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,
{
if (base)//the latter two parameter never be null
{
- over->Override(base);
+ if (over)
+ over->Override(base);
LwpParaStyle::ApplySpacing(this,pOverStyle,base);
}
else
LwpParaStyle::ApplySpacing(this,pOverStyle,over);
}
-//add by , 01/25/2005
/**
* @short: Get parastyle object according to the objID.
* @return: pointer to the parastyle.
*/
LwpParaStyle* LwpPara::GetParaStyle()
{
- return static_cast<LwpParaStyle*>(m_ParaStyle.obj(VO_PARASTYLE));
+ return dynamic_cast<LwpParaStyle*>(m_ParaStyle.obj(VO_PARASTYLE));
}
/**
@@ -488,8 +488,9 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
m_pBullOver = pFinalBullet.release();
if (!aSilverBulletID.IsNull())
{
- m_pSilverBullet = static_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET));
- m_pSilverBullet->SetFoundry(m_pFoundry);
+ m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET));
+ if (m_pSilverBullet)
+ m_pSilverBullet->SetFoundry(m_pFoundry);
}
m_aSilverBulletID = aSilverBulletID;
@@ -506,8 +507,9 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
{
m_bHasBullet = sal_True;
- m_pSilverBullet = static_cast<LwpSilverBullet*>(m_aSilverBulletID.obj(VO_SILVERBULLET));
- m_pSilverBullet->SetFoundry(m_pFoundry);
+ m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(m_aSilverBulletID.obj(VO_SILVERBULLET));
+ if (m_pSilverBullet)
+ m_pSilverBullet->SetFoundry(m_pFoundry);
}
std::auto_ptr<LwpBulletOverride> pBulletOverride(pBullOver->clone());
@@ -578,7 +580,7 @@ void LwpPara::FindLayouts()
{
m_Fribs.SetPara(this);
m_Fribs.FindLayouts();
- LwpPara* pNextPara = static_cast<LwpPara*>(GetNext()->obj());
+ LwpPara* pNextPara = dynamic_cast<LwpPara*>(GetNext()->obj());
if(pNextPara)
{
pNextPara->FindLayouts();
@@ -640,96 +642,15 @@ sal_Bool LwpPara::ComparePagePosition(LwpVirtualLayout * pPreLayout, LwpVirtualL
m_Fribs.SetPara(this);
return m_Fribs.ComparePagePosition(pPreLayout, pNextLayout);
}
-/*
-sal_Bool LwpPara::IsNeedTabForTOC()
-{
- LwpStory* pStory = GetStory();
- if(pStory)
- {
- if(GetNext()->IsNull())
- {
- LwpVirtualLayout* pLayout = pStory->GetLayout(NULL);
- if(pLayout && pLayout->IsCell())
- {
- LwpCellLayout * pCell = static_cast<LwpCellLayout *>(pStory->GetLayout(NULL));
- if (pCell->GetLeaderChar() == 0)
- {
- return sal_False;
- }
- return sal_True;
- }
- }
- }
- return sal_False;
-}
-
-void LwpPara::AddTabStyleForTOC( )
-{
- if(IsNeedTabForTOC())
- {
- XFParaStyle* pParaStyle = new XFParaStyle;
- *pParaStyle = *GetXFParaStyle();
- pParaStyle->ClearTabStyles();
- //Add Tab Style;
- enumXFTab eType = enumXFTabRight;
-
- LwpCellLayout * pCell = static_cast<LwpCellLayout *>(GetStory()->GetLayout(NULL));
- double dLen = pCell->GetActualWidth(); /// todo: get from table
- sal_Unicode cLeader = static_cast<sal_Unicode>(pCell->GetLeaderChar());
- pParaStyle->AddTabStyle(eType, dLen, cLeader );
- m_StyleName = XFStyleManager::AddStyle(pParaStyle)->GetStyleName();
-
- // Get font info of default text style and set into tab style
- XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*m_pFoundry->GetDefaultTextStyle()));
- XFTextStyle*pTextStyle = new XFTextStyle;
- pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font?????
- m_TabStyleName = XFStyleManager::AddStyle(pTextStyle)->GetStyleName();
- }
-}
-void LwpPara::AddTabStopForTOC()
-{
- if(IsNeedTabForTOC())
- {
- XFParagraph* pXFPara = GetFribs()->GetXFPara();
- pXFPara->SetStyleName(m_StyleName);
-
- XFParaStyle* pParaStyle = static_cast<XFParaStyle*>(XFStyleManager::FindStyle(m_StyleName));
- if(pParaStyle)
- {
- XFTextSpan *pSpan = new XFTextSpan;
- XFTabStop *pTab = new XFTabStop;
- pSpan->Add(pTab);
- pSpan->SetStyleName(m_TabStyleName);
- enumXFAlignType eType = pParaStyle->GetAlighType();
-
- if(eType == enumXFAlignStart || eType == enumXFAlignJustify || eType == enumXFAlignNone)
- {
- pXFPara->Add(pSpan);
- }
- else if(eType == enumXFAlignEnd)
- {
- pXFPara->InsertAtBegin(pSpan);
- }
- else
- {
- delete pSpan; // pTabl will be delete inside XFTextSpan
- }
-
- }
-
- }
-}
-*/
/**
* @short check paragraph alignment
*/
sal_Bool LwpPara::IsNumberRight()
{
- LwpObject* pObj = m_ParaStyle.obj();
- if (pObj)
+ LwpParaStyle* pStyle = dynamic_cast<LwpParaStyle*>(m_ParaStyle.obj());
+ if (pStyle)
{
- LwpParaStyle* pStyle = static_cast<LwpParaStyle*>(pObj);
return pStyle->IsNumberRight();
}
else
@@ -740,7 +661,8 @@ sal_Bool LwpPara::IsNumberRight()
*/
sal_Bool LwpPara::IsInCell()
{
- LwpVirtualLayout* pLayout = GetStory()->GetLayout(NULL);
+ LwpStory *pStory = GetStory();
+ LwpVirtualLayout* pLayout = pStory ? pStory->GetLayout(NULL) : NULL;
if(pLayout && pLayout->IsCell())
return sal_True;
return sal_False;
diff --git a/lotuswordpro/source/filter/lwpparaproperty.cxx b/lotuswordpro/source/filter/lwpparaproperty.cxx
index b6d88b8d758c..dee3323cfb0c 100644
--- a/lotuswordpro/source/filter/lwpparaproperty.cxx
+++ b/lotuswordpro/source/filter/lwpparaproperty.cxx
@@ -74,13 +74,19 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj
for(;;)
{
- pFile->QuickRead(&tag,sizeof(sal_uInt32));
- // Keep reading properties until we hit the end tag
- if (tag == TAG_ENDSUBOBJ)
+ sal_uInt16 nRead;
+
+ nRead = pFile->QuickRead(&tag,sizeof(sal_uInt32));
+ // Keep reading properties until we hit the end tag or
+ // the stream ends
+ if (tag == TAG_ENDSUBOBJ || nRead != sizeof(sal_uInt32))
break;
// Get the length of this property
- pFile->QuickRead(&Len,sizeof(sal_uInt16));
+ nRead = pFile->QuickRead(&Len,sizeof(sal_uInt16));
+
+ if (nRead != sizeof(sal_uInt16))
+ break;
// Create whatever kind of tag we just found
switch (tag)
@@ -121,21 +127,8 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj
case TAG_PARA_TAB:
NewProp = new LwpParaTabRackProperty(pFile);
break;
-/*
-#ifdef KINSOKU
- case TAG_PARA_KINSOKU:
- NewProp = new CParaKinsokuProperty(pFile);
- break;
-#endif
- case TAG_PARA_PROPLIST:
- NewProp = new CParaPropListProperty(pFile,Whole);
- break;
-
- case TAG_PARA_SHOW:
- case TAG_PARA_HIDE:
- // Ignore these properties
-*/ default:
+ default:
pFile->SeekRel(Len);
NewProp = NULL;
break;
@@ -152,24 +145,12 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj
LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
{
-// pFile->SeekRel(3);
- LwpObjectID align;
- align.ReadIndexed(pFile);
- m_pAlignment =static_cast<LwpAlignmentOverride*>
- (static_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE))->GetOverride());
-/* if(pFile->GetFileRevision() < 0x000b)
- {
- CAlignmentPieceGuts guts;
- CAlignmentPiece::QuickReadGuts(pFile, &guts);
- cAlignment = GetPieceManager()->GetAlignmentPiece(&guts);
- }
- else
- {
- LwpFoundry* OldFoundry = pFile->GetFoundry();
- pFile->SetFoundry(GetPieceManager()->GetFoundry());
- cAlignment.QuickRead(pFile);
- pFile->SetFoundry(OldFoundry);
- } */
+ LwpObjectID align;
+ align.ReadIndexed(pFile);
+
+ LwpAlignmentPiece *pAlignmentPiece = dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE));
+ m_pAlignment = pAlignmentPiece ? dynamic_cast<LwpAlignmentOverride*>(pAlignmentPiece->GetOverride()) : NULL;
+
}
LwpParaAlignProperty::~LwpParaAlignProperty(void)
@@ -183,10 +164,10 @@ sal_uInt32 LwpParaAlignProperty::GetType(void)
LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile)
{
-// LwpObjectID indent;
m_aIndentID.ReadIndexed(pFile);
- m_pIndent = static_cast<LwpIndentOverride*>
- (static_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE))->GetOverride());
+
+ LwpIndentPiece *pIndentPiece = dynamic_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE));
+ m_pIndent = pIndentPiece ? dynamic_cast<LwpIndentOverride*>(pIndentPiece->GetOverride()) : NULL;
}
LwpParaIndentProperty::~LwpParaIndentProperty(void)
@@ -202,8 +183,9 @@ LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile)
{
LwpObjectID spacing;
spacing.ReadIndexed(pFile);
- m_pSpacing = static_cast<LwpSpacingOverride*>
- (static_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE))->GetOverride());
+
+ LwpSpacingPiece *pSpacingPiece = dynamic_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE));
+ m_pSpacing = pSpacingPiece ? dynamic_cast<LwpSpacingOverride*>(pSpacingPiece->GetOverride()) : NULL;
}
LwpParaSpacingProperty::~LwpParaSpacingProperty(void)
@@ -224,8 +206,8 @@ m_pParaBorderOverride(NULL)
if (!aParaBorder.IsNull())
{
- m_pParaBorderOverride = static_cast<LwpParaBorderOverride*>
- (static_cast<LwpParaBorderPiece*>(aParaBorder.obj())->GetOverride());
+ LwpParaBorderPiece *pParaBorderPiece = dynamic_cast<LwpParaBorderPiece*>(aParaBorder.obj());
+ m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast<LwpParaBorderOverride*>(pParaBorderPiece->GetOverride()) : NULL;
}
}
@@ -237,8 +219,8 @@ m_pBreaks(NULL)
if (!aBreaks.IsNull())
{
- m_pBreaks = static_cast<LwpBreaksOverride*>
- (static_cast<LwpBreaksPiece*>(aBreaks.obj())->GetOverride());
+ LwpBreaksPiece *pBreaksPiece = dynamic_cast<LwpBreaksPiece*>(aBreaks.obj());
+ m_pBreaks = pBreaksPiece ? dynamic_cast<LwpBreaksOverride*>(pBreaksPiece->GetOverride()) : NULL;
}
}
@@ -265,9 +247,8 @@ LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm)
return;
}
- m_pNumberingOverride = static_cast<LwpNumberingOverride*>
- (static_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE))->GetOverride());
-
+ LwpNumberingPiece *pNumberingPiece = dynamic_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE));
+ m_pNumberingOverride = pNumberingPiece ? dynamic_cast<LwpNumberingOverride*>(pNumberingPiece->GetOverride()) : NULL;
}
//end//////////////////////////////////////////////////////////////////////
@@ -275,7 +256,9 @@ LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile)
{
LwpObjectID aTabRack;
aTabRack.ReadIndexed(pFile);
- m_pTabOverride =static_cast<LwpTabOverride*>(static_cast<LwpTabPiece*>(aTabRack.obj())->GetOverride());
+
+ LwpTabPiece *pTabPiece = dynamic_cast<LwpTabPiece*>(aTabRack.obj());
+ m_pTabOverride = pTabPiece ? dynamic_cast<LwpTabOverride*>(pTabPiece->GetOverride()) : NULL;
}
LwpParaTabRackProperty::~LwpParaTabRackProperty()
@@ -286,8 +269,9 @@ LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile)
{
LwpObjectID background;
background.ReadIndexed(pFile);
- m_pBackground = static_cast<LwpBackgroundOverride*>(
- static_cast<LwpBackgroundPiece*>(background.obj())->GetOverride());
+
+ LwpBackgroundPiece *pBackgroundPiece = dynamic_cast<LwpBackgroundPiece*>(background.obj());
+ m_pBackground = pBackgroundPiece ? dynamic_cast<LwpBackgroundOverride*>(pBackgroundPiece->GetOverride()) : NULL;
}
LwpParaBackGroundProperty::~LwpParaBackGroundProperty()
diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
index a1fc2a3f6578..0d57b1dc9e7b 100644
--- a/lotuswordpro/source/filter/lwpparastyle.cxx
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -157,24 +157,27 @@ void LwpParaStyle::Read()
}
}
-void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
+void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
{
assert(pParaStyle);
+ if (!pParaStyle)
+ return;
+
LwpVirtualPiece *pPiece = NULL;
//alignment:
- pPiece = (LwpVirtualPiece*)m_AlignmentStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_AlignmentStyle.obj());
if( pPiece )
{
- LwpAlignmentOverride *pAlign = (LwpAlignmentOverride*)pPiece->GetOverride();
+ LwpAlignmentOverride *pAlign = dynamic_cast<LwpAlignmentOverride*>(pPiece->GetOverride());
if( pAlign )
ApplyAlignment(pParaStyle,pAlign);
}
//don't known top and bottom indent now.
- pPiece = (LwpVirtualPiece*)m_IndentStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_IndentStyle.obj());
if( pPiece )
{
- LwpIndentOverride *pIndent = (LwpIndentOverride*)pPiece->GetOverride();
+ LwpIndentOverride *pIndent = dynamic_cast<LwpIndentOverride*>(pPiece->GetOverride());
if( pIndent )
{
if (!m_pBulletOverride->IsInValid())//Add by ,for remove bullet indent in named bullet style
@@ -189,29 +192,29 @@ void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
}
}
//shadow & borders.
- pPiece = (LwpVirtualPiece*)m_BorderStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BorderStyle.obj());
if( pPiece )
{
- LwpParaBorderOverride *pBorder = (LwpParaBorderOverride*)pPiece->GetOverride();
+ LwpParaBorderOverride *pBorder = dynamic_cast<LwpParaBorderOverride*>(pPiece->GetOverride());
if( pBorder )
{
this->ApplyParaBorder(pParaStyle, pBorder);
}
}
- pPiece = (LwpVirtualPiece*)m_SpacingStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_SpacingStyle.obj());
if (pPiece)
{
- LwpSpacingOverride *pSpacing = (LwpSpacingOverride*)pPiece->GetOverride();
+ LwpSpacingOverride *pSpacing = dynamic_cast<LwpSpacingOverride*>(pPiece->GetOverride());
if( pSpacing)
ApplySpacing(NULL,pParaStyle,pSpacing);
}
//paragraph background.
- pPiece = (LwpVirtualPiece*)m_BackgroundStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BackgroundStyle.obj());
if( pPiece )
{
- LwpBackgroundOverride *pBack = (LwpBackgroundOverride*)pPiece->GetOverride();
+ LwpBackgroundOverride *pBack = dynamic_cast<LwpBackgroundOverride*>(pPiece->GetOverride());
if( pBack )
{
LwpColor color = pBack->GetBackColor();
@@ -222,19 +225,19 @@ void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
//add tab style
- pPiece = (LwpVirtualPiece*)m_TabStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_TabStyle.obj());
if( pPiece )
{
- LwpTabOverride *pTab=(LwpTabOverride*)pPiece->GetOverride();
+ LwpTabOverride *pTab = dynamic_cast<LwpTabOverride*>(pPiece->GetOverride());
if(pTab)
{
ApplyTab(pParaStyle,pTab);
}
}
- pPiece = (LwpVirtualPiece*)m_BreaksStyle.obj();
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BreaksStyle.obj());
if( pPiece )
{
- LwpBreaksOverride *pBreak=(LwpBreaksOverride*)pPiece->GetOverride();
+ LwpBreaksOverride *pBreak = dynamic_cast<LwpBreaksOverride*>(pPiece->GetOverride());
if(pBreak)
{
ApplyBreaks(pParaStyle,pBreak);
@@ -587,7 +590,7 @@ void LwpParaStyle::ApplySpacing(LwpPara* pPara, XFParaStyle* pParaStyle, LwpSpac
{
if (below_val != -1)
pPara->SetBelowSpacing(below_val);
- LwpPara* pPrePara = static_cast<LwpPara*>(pPara->GetPrevious()->obj());
+ LwpPara* pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious()->obj());
if (pPrePara && above_val != -1)
{
above_val += pPrePara->GetBelowSpacing();
@@ -613,7 +616,7 @@ void LwpParaStyle::ApplyTab(XFParaStyle *pParaStyle, LwpTabOverride *pTabOverRid
return;
}
- LwpTabRack* pTabRack = static_cast<LwpTabRack*>(pTabRackID->obj());
+ LwpTabRack* pTabRack = dynamic_cast<LwpTabRack*>(pTabRackID->obj());
if(!pTabRack)
{
//assert(false);
@@ -701,58 +704,61 @@ void LwpParaStyle::RegisterStyle()
//Add style
LwpStyleManager* pStyleMgr = m_pFoundry->GetStyleManager();
pStyleMgr->AddStyle(*GetObjectID(), pStyle);
-
-/* // add list style for bullet
- if (!m_pBulletOverride)
- {
- return;
- }
- LwpSilverBullet* pSilverBullet = static_cast<LwpSilverBullet*>(m_pBulletOverride->GetSilverBullet().obj());
- if (!pSilverBullet)
- {
- return;
- }
-
- pSilverBullet->SetFoundry(m_pFoundry);
- pSilverBullet->RegisterStyle();*/
}
LwpAlignmentOverride* LwpParaStyle::GetAlignment()
{
- if (m_AlignmentStyle.obj()!= NULL)
- return static_cast<LwpAlignmentOverride*>(static_cast<LwpAlignmentPiece*>(m_AlignmentStyle.obj())->GetOverride());
- else
+ if (m_AlignmentStyle.obj() == NULL)
return NULL;
+
+ LwpAlignmentPiece *pPiece = dynamic_cast<LwpAlignmentPiece*>(m_AlignmentStyle.obj());
+ if (pPiece)
+ return dynamic_cast<LwpAlignmentOverride*>(pPiece->GetOverride());
+ return NULL;
}
LwpIndentOverride* LwpParaStyle::GetIndent()
{
- if (m_IndentStyle.obj() != NULL)
- return static_cast<LwpIndentOverride*>(static_cast<LwpIndentPiece*>(m_IndentStyle.obj())->GetOverride());
- else
+ if (m_IndentStyle.obj() == NULL)
return NULL;
+
+ LwpIndentPiece *pPiece = dynamic_cast<LwpIndentPiece*>(m_IndentStyle.obj());
+ if (pPiece)
+ return dynamic_cast<LwpIndentOverride*>(pPiece->GetOverride());
+ return NULL;
}
LwpSpacingOverride* LwpParaStyle::GetSpacing()
{
- if (m_SpacingStyle.obj() != NULL)
- return static_cast<LwpSpacingOverride*>(static_cast<LwpSpacingPiece*>(m_SpacingStyle.obj())->GetOverride());
- else
+ if (m_SpacingStyle.obj() == NULL)
return NULL;
+
+ LwpSpacingPiece *pPiece = dynamic_cast<LwpSpacingPiece*>(m_SpacingStyle.obj());
+ if (pPiece)
+ return dynamic_cast<LwpSpacingOverride*>(pPiece->GetOverride());
+ return NULL;
}
LwpParaBorderOverride* LwpParaStyle::GetParaBorder() const
{
- if(m_BorderStyle.IsNull()) return NULL;
- return static_cast<LwpParaBorderOverride*>
- (static_cast<LwpParaBorderPiece*>(m_BorderStyle.obj(VO_PARABORDERPIECE))->GetOverride());
+ if(m_BorderStyle.IsNull())
+ return NULL;
+
+ LwpParaBorderPiece *pPiece = dynamic_cast<LwpParaBorderPiece*>(m_BorderStyle.obj(VO_PARABORDERPIECE));
+ if (pPiece)
+ return dynamic_cast<LwpParaBorderOverride*>(pPiece->GetOverride());
+ return NULL;
}
LwpBreaksOverride* LwpParaStyle::GetBreaks() const
{
- if(m_BreaksStyle.IsNull()) return NULL;
- return static_cast<LwpBreaksOverride*>
- (static_cast<LwpBreaksPiece*>(m_BreaksStyle.obj(VO_BREAKSPIECE))->GetOverride());
+ if(m_BreaksStyle.IsNull())
+ return NULL;
+
+ LwpBreaksPiece *pPiece = dynamic_cast<LwpBreaksPiece*>(m_BreaksStyle.obj(VO_BREAKSPIECE));
+ if (pPiece)
+ return dynamic_cast<LwpBreaksOverride*>(pPiece->GetOverride());
+ return NULL;
}
LwpBulletOverride* LwpParaStyle::GetBulletOverride() const
@@ -762,9 +768,13 @@ LwpBulletOverride* LwpParaStyle::GetBulletOverride() const
LwpNumberingOverride* LwpParaStyle::GetNumberingOverride() const
{
- if(m_NumberingStyle.IsNull()) return NULL;
- return static_cast<LwpNumberingOverride*>
- (static_cast<LwpNumberingPiece*>(m_NumberingStyle.obj(VO_NUMBERINGPIECE))->GetOverride());
+ if(m_NumberingStyle.IsNull())
+ return NULL;
+
+ LwpNumberingPiece *pPiece = dynamic_cast<LwpNumberingPiece*>(m_NumberingStyle.obj(VO_NUMBERINGPIECE));
+ if (pPiece)
+ return dynamic_cast<LwpNumberingOverride*>(pPiece->GetOverride());
+ return NULL;
}
@@ -777,10 +787,12 @@ LwpNumberingOverride* LwpParaStyle::GetNumberingOverride() const
**************************************************************************/
LwpTabOverride* LwpParaStyle::GetTabOverride() const
{
- if(m_TabStyle.obj() != NULL)
- return (LwpTabOverride*)static_cast<LwpTabPiece*>(m_TabStyle.obj())->GetOverride();
- else
+ if(m_TabStyle.obj() == NULL)
return NULL;
+ LwpTabPiece *pPiece = dynamic_cast<LwpTabPiece*>(m_TabStyle.obj());
+ if (pPiece)
+ return dynamic_cast<LwpTabOverride*>(pPiece->GetOverride());
+ return NULL;
}
sal_Bool LwpParaStyle::IsNumberRight()
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 5aeb99832a48..05ce115ad078 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -91,14 +91,14 @@ LwpRowLayout::~LwpRowLayout()
void LwpRowLayout::SetRowMap(void)
{
LwpObjectID *pCellID= GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
while(pCellLayout)
{
pCellLayout->SetCellMap();
pCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
}
}
/**
@@ -131,14 +131,14 @@ void LwpRowLayout::RegisterStyle()
}
// register cells' style
LwpObjectID *pCellID= GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
while(pCellLayout)
{
pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle();
pCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
}
}
@@ -375,7 +375,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI
{
// add row to table
LwpObjectID *pCellID= GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
nCellStartCol = i;//mark the begin position of cell
nCellEndCol = i;//mark the end position of cell
while(pCellLayout)
@@ -392,7 +392,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI
break;
}
pCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
}
if (!pCellLayout)
{
@@ -423,7 +423,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI
void LwpRowLayout::CollectMergeInfo()
{
LwpObjectID *pCellID= GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
while(pCellLayout)
{
@@ -433,7 +433,7 @@ void LwpRowLayout::CollectMergeInfo()
m_ConnCellList.push_back(pConnCell);
}
pCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj());
}
}
/**
@@ -481,7 +481,7 @@ void LwpRowHeadingLayout::Read()
LwpRowLayout * LwpRowHeadingLayout::GetRowLayout()
{
- LwpRowLayout * pRow = static_cast<LwpRowLayout *>(cRowLayout.obj());
+ LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(cRowLayout.obj());
return pRow;
}
diff --git a/lotuswordpro/source/filter/lwprowlayout.hxx b/lotuswordpro/source/filter/lwprowlayout.hxx
index edd28656b25f..a1693f864bca 100644
--- a/lotuswordpro/source/filter/lwprowlayout.hxx
+++ b/lotuswordpro/source/filter/lwprowlayout.hxx
@@ -85,7 +85,7 @@ public:
virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_ROW_LAYOUT;}
sal_uInt16 GetRowID() { return crowid;}
virtual void RegisterStyle();
- inline LwpTableLayout * GetParentTableLayout(){return static_cast<LwpTableLayout *>(GetParent()->obj());}
+ inline LwpTableLayout * GetParentTableLayout(){return dynamic_cast<LwpTableLayout *>(GetParent()->obj());}
void SetRowMap(void);
protected:
void Read();
diff --git a/lotuswordpro/source/filter/lwpsection.hxx b/lotuswordpro/source/filter/lwpsection.hxx
index 49532fe8f16b..3141d975b1e9 100644
--- a/lotuswordpro/source/filter/lwpsection.hxx
+++ b/lotuswordpro/source/filter/lwpsection.hxx
@@ -127,7 +127,7 @@ inline sal_uInt16 LwpSection::GetFlags()
*/
inline LwpPageLayout* LwpSection::GetPageLayout()
{
- return static_cast<LwpPageLayout*>(m_PageLayout.obj());
+ return dynamic_cast<LwpPageLayout*>(m_PageLayout.obj());
}
/**
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx
index 1ef84591788e..0f25dd1af125 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.cxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -245,13 +245,13 @@ LwpPara* LwpSilverBullet::GetBulletPara()
{
if (!m_pBulletPara)
{
- LwpStory* pStory = static_cast<LwpStory*>(m_aStory.obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY));
if (!pStory)
{
return NULL;
}
- m_pBulletPara = static_cast<LwpPara*>(pStory->GetFirstPara()->obj(VO_PARA));
+ m_pBulletPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara()->obj(VO_PARA));
}
return m_pBulletPara;
@@ -333,7 +333,15 @@ rtl::OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumbe
*/
sal_Bool LwpSilverBullet::IsBulletOrdered()
{
- return (sal_Bool)(m_pBulletPara->GetFribs()->HasFrib(FRIB_TAG_PARANUMBER) != NULL);
+ if (!m_pBulletPara)
+ return sal_False;
+
+ LwpFribPtr* pFribs = m_pBulletPara->GetFribs();
+
+ if (!pFribs)
+ return sal_False;
+
+ return (sal_Bool)(pFribs->HasFrib(FRIB_TAG_PARANUMBER) != NULL);
}
/**
@@ -434,7 +442,9 @@ rtl::OUString LwpSilverBullet::GetDivisionName()
LwpObjectID* pID = pDoc->GetDivInfoID();
if (!pID->IsNull())
{
- aRet = static_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO))->GetDivName();
+ LwpDivInfo *pInfo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO));
+ if (pInfo)
+ aRet = pInfo->GetDivName();
}
}
@@ -443,7 +453,7 @@ rtl::OUString LwpSilverBullet::GetDivisionName()
rtl::OUString LwpSilverBullet::GetSectionName()
{
- LwpStory* pStory = static_cast<LwpStory*>(m_aStory.obj(VO_STORY));
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY));
if (!pStory)
{
return rtl::OUString();
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 084bdc513bda..c9af88c2cfac 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -99,7 +99,7 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
XFConvertFrameInFrame(pCont);
//process para list
XFContentContainer* pParaCont = pCont;
- LwpPara* pPara = static_cast<LwpPara*> ( GetFirstPara()->obj() );
+ LwpPara* pPara = dynamic_cast<LwpPara*> ( GetFirstPara()->obj() );
while(pPara)
{
pPara->SetFoundry(m_pFoundry);
@@ -107,7 +107,7 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
//Get the xfcontainer for the next para
pParaCont = pPara->GetXFContainer();
- pPara = static_cast<LwpPara*> ( pPara->GetNext()->obj() );
+ pPara = dynamic_cast<LwpPara*> ( pPara->GetNext()->obj() );
}
//process frame which anchor is to cell after converter all the para
@@ -115,12 +115,12 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
XFConvertFrameInHeaderFooter(pCont);
//Release Lwp Objects
- LwpPara* pCur = static_cast<LwpPara*> (GetFirstPara()->obj());
+ LwpPara* pCur = dynamic_cast<LwpPara*> (GetFirstPara()->obj());
LwpPara* pNext;
while(pCur)
{
pCur->Release();
- pNext = static_cast<LwpPara*> ( pCur->GetNext()->obj() );
+ pNext = dynamic_cast<LwpPara*> ( pCur->GetNext()->obj() );
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
pObjMgr->ReleaseObject(*pCur->GetObjectID());
@@ -130,12 +130,12 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
void LwpStory::RegisterStyle()
{
- LwpPara* pPara = static_cast<LwpPara*>( GetFirstPara()->obj() );
+ LwpPara* pPara = dynamic_cast<LwpPara*>( GetFirstPara()->obj() );
while(pPara)
{
pPara->SetFoundry(m_pFoundry);
pPara->RegisterStyle();
- pPara = static_cast<LwpPara*>(pPara->GetNext()->obj());
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext()->obj());
}
}
@@ -232,7 +232,7 @@ void LwpStory::SortPageLayout()
LwpLayout::UseWhenType eSectionType = static_cast<LwpPageLayout*>(pLayout)->GetUseWhenType();
//for mirror page, the child is pagelayout
LwpVirtualLayout* pParent = pLayout->GetParentLayout();
- if(eSectionType != LwpLayout::StartWithinColume && !pParent->IsPage())
+ if(eSectionType != LwpLayout::StartWithinColume && pParent && !pParent->IsPage())
{
aLayoutList.push_back(static_cast<LwpPageLayout*>(pLayout));
}
@@ -240,22 +240,23 @@ void LwpStory::SortPageLayout()
pLayout = GetLayout(pLayout);
}
// sort the pagelayout according to their position
- LwpPageLayout* pTemp = NULL;
std::vector<LwpPageLayout*>::iterator aIt;
- std::vector<LwpPageLayout*>::iterator bIt;
- for( aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt)
+ if (!aLayoutList.empty())
{
- for( bIt = aIt +1; bIt != aLayoutList.end(); ++bIt )
+ for( aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt)
{
- if(**aIt < **bIt)
+ for( std::vector<LwpPageLayout*>::iterator bIt = aIt +1; bIt != aLayoutList.end(); ++bIt )
{
- continue;
- }
- else
- {
- pTemp = *aIt;
- *aIt = *bIt;
- *bIt = pTemp;
+ if(**aIt < **bIt)
+ {
+ continue;
+ }
+ else
+ {
+ LwpPageLayout* pTemp = *aIt;
+ *aIt = *bIt;
+ *bIt = pTemp;
+ }
}
}
}
@@ -333,7 +334,7 @@ void LwpStory::XFConvertFrame(XFContentContainer* pCont)
LwpVirtualLayout* pLayout = GetLayout(NULL);
while(pLayout)
{
- LwpVirtualLayout* pFrameLayout = static_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
+ LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
while(pFrameLayout)
{
if((pFrameLayout->IsAnchorPage()&&(pFrameLayout->IsFrame()||pFrameLayout->IsSuperTable()||pFrameLayout->IsGroupHead()))
@@ -341,7 +342,7 @@ void LwpStory::XFConvertFrame(XFContentContainer* pCont)
{
pFrameLayout->XFConvert(pCont);
}
- pFrameLayout = static_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
+ pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
}
pLayout = GetLayout(pLayout);
}
@@ -357,7 +358,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
LwpVirtualLayout* pLayout = GetLayout(NULL);
while(pLayout)
{
- LwpVirtualLayout* pFrameLayout = static_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
+ LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
while(pFrameLayout)
{
@@ -369,7 +370,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
if(pXFFirtPara)
pFrameLayout->XFConvert(pXFFirtPara);
}
- pFrameLayout = static_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
+ pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
}
pLayout = GetLayout(pLayout);
}
@@ -386,7 +387,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
LwpVirtualLayout* pLayout = GetLayout(NULL);
while(pLayout)
{
- LwpVirtualLayout* pFrameLayout = static_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
+ LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
while(pFrameLayout)
{
if((pFrameLayout->IsAnchorPage()
@@ -396,7 +397,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
{
pFrameLayout->XFConvert(pCont);
}
- pFrameLayout = static_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
+ pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
}
pLayout = GetLayout(pLayout);
}
@@ -412,14 +413,14 @@ void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
LwpVirtualLayout* pLayout = GetLayout(NULL);
while(pLayout)
{
- LwpVirtualLayout* pFrameLayout = static_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
+ LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
while(pFrameLayout)
{
if(pFrameLayout->IsAnchorFrame())
{
pFrameLayout->XFConvert(pCont);
}
- pFrameLayout = static_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
+ pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
}
pLayout = GetLayout(pLayout);
}
@@ -435,7 +436,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
LwpVirtualLayout* pLayout = GetLayout(NULL);
while(pLayout)
{
- LwpVirtualLayout* pFrameLayout = static_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
+ LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
while(pFrameLayout)
{
if(pFrameLayout->IsAnchorPage() && (pLayout->IsHeader() || pLayout->IsFooter()))
@@ -445,7 +446,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
if(pXFFirtPara)
pFrameLayout->XFConvert(pXFFirtPara);
}
- pFrameLayout = static_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
+ pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
}
pLayout = GetLayout(pLayout);
}
@@ -487,12 +488,12 @@ OUString LwpStory::GetContentText(sal_Bool bAllText)
{
OUString sText = A2OUSTR("");
//process para list
- LwpPara* pPara = static_cast<LwpPara*>(GetFirstPara()->obj());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara()->obj());
while (pPara)
{
pPara->SetFoundry(m_pFoundry);
sText += pPara->GetContentText(sal_True);
- pPara = static_cast<LwpPara*>(pPara->GetNext()->obj());
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext()->obj());
}
return sText;
}
@@ -501,7 +502,7 @@ OUString LwpStory::GetContentText(sal_Bool bAllText)
LwpObject* pObj = GetFirstPara()->obj();
if(pObj)
{
- LwpPara* pPara = static_cast<LwpPara*>(pObj);
+ LwpPara* pPara = dynamic_cast<LwpPara*>(pObj);
if (pPara->GetNext()->obj() != NULL)
return A2OUSTR("");
pPara->SetFoundry(m_pFoundry);
@@ -513,7 +514,7 @@ OUString LwpStory::GetContentText(sal_Bool bAllText)
}
OUString LwpStory::RegisterFirstFribStyle()
{
- LwpPara* pPara = static_cast<LwpPara*>(GetFirstPara()->obj());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara()->obj());
pPara->SetFoundry(m_pFoundry);
LwpFribPtr* pFribs = pPara->GetFribs();
if (pFribs)
diff --git a/lotuswordpro/source/filter/lwptable.cxx b/lotuswordpro/source/filter/lwptable.cxx
index 0584769c8e97..9e6c54b3f82a 100644
--- a/lotuswordpro/source/filter/lwptable.cxx
+++ b/lotuswordpro/source/filter/lwptable.cxx
@@ -135,9 +135,9 @@ void LwpTable::Parse(IXFStream* /*pOutputStream*/)
LwpSuperTableLayout* LwpTable::GetSuperTableLayout()
{
- LwpTableLayout* pLayout = static_cast<LwpTableLayout*>(m_Layout.obj());
+ LwpTableLayout* pLayout = dynamic_cast<LwpTableLayout*>(m_Layout.obj());
if(pLayout)
- return static_cast<LwpSuperTableLayout*>(pLayout->GetParent()->obj());
+ return dynamic_cast<LwpSuperTableLayout*>(pLayout->GetParent()->obj());
return NULL;
}
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index ffe00f33e17c..e36f9e8feb67 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -118,14 +118,14 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout()
while(pID && !pID->IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj());
+ LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pID->obj());
if (!pLayout)
{
break;
}
if (pLayout->GetLayoutType() == LWP_TABLE_LAYOUT)
{
- return static_cast<LwpTableLayout *>(pLayout);
+ return dynamic_cast<LwpTableLayout *>(pLayout);
}
pID = pLayout->GetPrevious();
}
@@ -142,7 +142,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout()
while(pID && !pID->IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj());
+ LwpLayout * pLayout = dynamic_cast<LwpLayout *>(pID->obj());
if (!pLayout)
{
break;
@@ -150,7 +150,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout()
if (pLayout->GetLayoutType() == LWP_TABLE_HEADING_LAYOUT)
{
- return static_cast<LwpTableHeadingLayout *>(pLayout);
+ return dynamic_cast<LwpTableHeadingLayout *>(pLayout);
}
pID = pLayout->GetPrevious();
}
@@ -235,7 +235,7 @@ double LwpSuperTableLayout::GetTableWidth()
for(sal_uInt16 i =0; i< nCol; i++)
{
LwpObjectID *pColumnID = pTableLayout->GetColumnLayoutHead();
- LwpColumnLayout * pColumnLayout = static_cast<LwpColumnLayout *>(pColumnID->obj());
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj());
double dColumnWidth = dDefaultWidth;
while (pColumnLayout)
{
@@ -245,7 +245,7 @@ double LwpSuperTableLayout::GetTableWidth()
break;
}
pColumnID = pColumnLayout->GetNext();
- pColumnLayout = static_cast<LwpColumnLayout *>(pColumnID->obj());
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj());
}
dWidth += dColumnWidth;
}
@@ -476,7 +476,7 @@ void LwpTableLayout::TraverseTable()
// set value
LwpObjectID *pRowID = GetChildHead();
- LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
while (pRowLayout)
{
pRowLayout->SetRowMap();
@@ -487,7 +487,7 @@ void LwpTableLayout::TraverseTable()
// end for 's analysis
pRowID = pRowLayout->GetNext();
- pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
}
}
@@ -525,7 +525,7 @@ LwpObjectID * LwpTableLayout::SearchCellStoryMap(sal_uInt16 nRow, sal_uInt16 nCo
*/
LwpSuperTableLayout * LwpTableLayout::GetSuperTableLayout()
{
- return static_cast<LwpSuperTableLayout *>(GetParent()->obj());
+ return dynamic_cast<LwpSuperTableLayout *>(GetParent()->obj());
}
/**
* @short Get table pointer
@@ -533,7 +533,7 @@ LwpSuperTableLayout * LwpTableLayout::GetSuperTableLayout()
*/
LwpTable * LwpTableLayout::GetTable()
{
- LwpTable *pTable = static_cast<LwpTable *>(m_Content.obj());
+ LwpTable *pTable = dynamic_cast<LwpTable *>(m_Content.obj());
return pTable;
}
/**
@@ -585,7 +585,7 @@ void LwpTableLayout::RegisterColumns()
// Get total width of justifiable columns
// NOTICE: all default columns are regarded as justifiable columns
LwpObjectID *pColumnID = GetColumnLayoutHead();
- LwpColumnLayout * pColumnLayout = static_cast<LwpColumnLayout *>(pColumnID->obj());
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj());
while (pColumnLayout)
{
m_pColumns[pColumnLayout->GetColumnID()] = pColumnLayout;
@@ -597,7 +597,7 @@ void LwpTableLayout::RegisterColumns()
}
pColumnID = pColumnLayout->GetNext();
- pColumnLayout = static_cast<LwpColumnLayout *>(pColumnID->obj());
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj());
}
// if all columns are not justifiable, the rightmost column will be changed to justifiable
@@ -676,14 +676,14 @@ void LwpTableLayout::RegisterRows()
// register style of rows
LwpObjectID * pRowID = GetChildHead();
- LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
while (pRowLayout)
{
pRowLayout->SetFoundry(m_pFoundry);
pRowLayout->RegisterStyle();
pRowID = pRowLayout->GetNext();
- pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
}
}
/**
@@ -716,7 +716,7 @@ void LwpTableLayout::RegisterStyle()
LwpObjectID * pID= pTable->GetDefaultCellStyle();
if (pID)
{
- m_pDefaultCellLayout = static_cast<LwpCellLayout *>(pID->obj());
+ m_pDefaultCellLayout = dynamic_cast<LwpCellLayout *>(pID->obj());
}
// register columns styles
@@ -1261,7 +1261,7 @@ void LwpTableLayout::ConvertColumn(XFTable *pXFTable,sal_uInt8 nStartCol,sal_uIn
{
// add row to table
LwpObjectID *pColID = GetColumnLayoutHead();
- LwpColumnLayout * pColumnLayout = static_cast<LwpColumnLayout *>(pColID->obj());
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj());
while (pColumnLayout)
{
if (pColumnLayout->GetColumnID() == (iLoop+nStartCol))
@@ -1270,7 +1270,7 @@ void LwpTableLayout::ConvertColumn(XFTable *pXFTable,sal_uInt8 nStartCol,sal_uIn
break;
}
pColID = pColumnLayout->GetNext();
- pColumnLayout = static_cast<LwpColumnLayout *>(pColID->obj());
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj());
}
if (!pColumnLayout)
{
@@ -1403,14 +1403,14 @@ XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol)
LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow)
{
LwpObjectID *pRowID = GetChildHead();
- LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
while (pRowLayout)
{
if(pRowLayout->GetRowID() == nRow)
return pRowLayout;
pRowID = pRowLayout->GetNext();
- pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj());
}
return NULL;
}
@@ -1488,7 +1488,7 @@ LwpRowHeadingLayout * LwpTableHeadingLayout::GetFirstRowHeadingLayout()
LwpObjectID *pID = GetChildHead();
if(pID && !pID->IsNull())
{
- LwpRowHeadingLayout * pHeadingRow = static_cast<LwpRowHeadingLayout *>(pID->obj());
+ LwpRowHeadingLayout * pHeadingRow = dynamic_cast<LwpRowHeadingLayout *>(pID->obj());
return pHeadingRow;
}
return NULL;
diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx
index 1659d80bea94..11f20a848fbb 100644
--- a/lotuswordpro/source/filter/lwptabrack.cxx
+++ b/lotuswordpro/source/filter/lwptabrack.cxx
@@ -116,7 +116,7 @@ LwpTab* LwpTabRack::Lookup(sal_uInt16 nIndex)
LwpTabRack* LwpTabRack::GetNext()
{
- LwpTabRack* pTabRack = static_cast<LwpTabRack*>(m_NextID.obj());
+ LwpTabRack* pTabRack = dynamic_cast<LwpTabRack*>(m_NextID.obj());
return pTabRack;
}
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
index 9f3f53b2d836..29d8955c41f4 100644
--- a/lotuswordpro/source/filter/lwptoc.cxx
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -377,7 +377,7 @@ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index)
LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
{
LwpObjectID * pID = m_SearchItems.GetHead(); // not necessary to check pID NULL or not
- LwpTocLevelData * pObj = static_cast<LwpTocLevelData *>(pID->obj());
+ LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj());
while(pObj)
{
@@ -387,7 +387,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
}
pID = pObj->GetNext(); // not necessary to check pID NULL or not
- pObj = static_cast<LwpTocLevelData *>(pID->obj());
+ pObj = dynamic_cast<LwpTocLevelData *>(pID->obj());
}
return NULL;
@@ -401,7 +401,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData)
{
LwpObjectID * pID = pCurData->GetNext();
- LwpTocLevelData * pObj = static_cast<LwpTocLevelData *>(pID->obj());
+ LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj());
while(pObj)
{
@@ -411,7 +411,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, Lwp
}
pID = pObj->GetNext(); // not necessary to check pID NULL or not
- pObj = static_cast<LwpTocLevelData *>(pID->obj());
+ pObj = dynamic_cast<LwpTocLevelData *>(pID->obj());
}
return NULL;
diff --git a/lotuswordpro/source/filter/lwptools.hxx b/lotuswordpro/source/filter/lwptools.hxx
index 913cc31b5232..5111582ed9b2 100644
--- a/lotuswordpro/source/filter/lwptools.hxx
+++ b/lotuswordpro/source/filter/lwptools.hxx
@@ -71,6 +71,7 @@
#include "xfilter/xfdatestyle.hxx"
#include "xfilter/xftimestyle.hxx"
#include <rtl/textenc.h>
+#include <stdexcept>
// 01/19/2005
const sal_uInt32 UNITS_PER_INCH = 65536L * 72L;
@@ -141,6 +142,18 @@ inline sal_Bool LwpTools::IsEvenNumber(sal_uInt16& nNumber)
return nNumber%2? sal_False : sal_True;
}
+class BadSeek : public std::runtime_error
+{
+public:
+ BadSeek() : std::runtime_error("Lotus Word Pro Bad Seek") { }
+};
+
+class BadDecompress : public std::runtime_error
+{
+public:
+ BadDecompress() : std::runtime_error("Lotus Word Pro Bad Decompress") { }
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/utlist.cxx b/lotuswordpro/source/filter/utlist.cxx
index 0acd2db39862..d68b49cbe20c 100644
--- a/lotuswordpro/source/filter/utlist.cxx
+++ b/lotuswordpro/source/filter/utlist.cxx
@@ -59,10 +59,11 @@ namespace OpenStormBento
{
CUtListElmt::CUtListElmt(pCUtList pList)
+ : cpNext(NULL)
+ , cpPrev(NULL)
{
- if (pList == NULL)
- cpNext = NULL;
- else InsertAfter(pList->GetLast());
+ if (pList != NULL)
+ InsertAfter(pList->GetLast());
}
CUtListElmt::~CUtListElmt()
diff --git a/lotuswordpro/source/filter/utlist.hxx b/lotuswordpro/source/filter/utlist.hxx
index ab53bfc52a8d..1e318bd9726b 100644
--- a/lotuswordpro/source/filter/utlist.hxx
+++ b/lotuswordpro/source/filter/utlist.hxx
@@ -69,7 +69,10 @@ UtDefClassP(CUtComparableListElmt);
class CUtListElmt
{
public: // Methods
- CUtListElmt() { cpNext = NULL; }
+ CUtListElmt()
+ : cpNext(NULL)
+ , cpPrev(NULL)
+ {}
CUtListElmt(pCUtListElmt pPrev) { InsertAfter(pPrev); }
CUtListElmt(pCUtList pList);
virtual ~CUtListElmt();
diff --git a/lotuswordpro/source/filter/xfilter/xfimage.cxx b/lotuswordpro/source/filter/xfilter/xfimage.cxx
index a7332bbacdc7..1bf7c112ee16 100644
--- a/lotuswordpro/source/filter/xfilter/xfimage.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfimage.cxx
@@ -60,7 +60,7 @@
#include "xfimage.hxx"
#include "xfbase64.hxx"
-XFImage::XFImage()
+XFImage::XFImage() : m_bUseLink(sal_False)
{
m_eType = enumXFFrameImage;
m_strName = XFGlobal::GenImageName();
diff --git a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
index 2b202bfd20c1..b9381d5d09ff 100644
--- a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
@@ -94,23 +94,27 @@ XFSaxStream::~XFSaxStream()
void XFSaxStream::StartDocument()
{
- m_aHandler->startDocument();
+ if (m_aHandler.is())
+ m_aHandler->startDocument();
}
void XFSaxStream::EndDocument()
{
- m_aHandler->endDocument();
+ if (m_aHandler.is())
+ m_aHandler->endDocument();
}
void XFSaxStream::StartElement(const rtl::OUString& oustr)
{
- m_aHandler->startElement( oustr, m_pAttrList->GetAttributeList() );
+ if (m_aHandler.is())
+ m_aHandler->startElement( oustr, m_pAttrList->GetAttributeList() );
m_pAttrList->Clear();
}
void XFSaxStream::EndElement(const rtl::OUString& oustr)
{
- m_aHandler->endElement(oustr);
+ if (m_aHandler.is())
+ m_aHandler->endElement(oustr);
if( m_pAttrList )
m_pAttrList->Clear();
@@ -118,7 +122,8 @@ void XFSaxStream::EndElement(const rtl::OUString& oustr)
void XFSaxStream::Characters(const rtl::OUString& oustr)
{
- m_aHandler->characters(oustr);
+ if (m_aHandler.is())
+ m_aHandler->characters(oustr);
}
IXFAttrList* XFSaxStream::GetAttrList()
diff --git a/lotuswordpro/util/makefile.mk b/lotuswordpro/util/makefile.mk
index 640ba297ae75..b150cc6736dd 100644
--- a/lotuswordpro/util/makefile.mk
+++ b/lotuswordpro/util/makefile.mk
@@ -36,10 +36,16 @@ DEF1NAME=$(SHL1TARGET)
.INCLUDE : target.mk
-ALLTAR : $(MISC)/lwpfilter.component
+ALLTAR : $(MISC)/lwpfilter.component $(MISC)/qa_lwpfilter.component
$(MISC)/lwpfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
lwpfilter.component
$(XSLTPROC) --nonet --stringparam uri \
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
$(SOLARENV)/bin/createcomponent.xslt lwpfilter.component
+
+$(MISC)/qa_lwpfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ lwpfilter.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt lwpfilter.component
diff --git a/odk/cfgWin.js b/odk/cfgWin.js
index ef4e0b6c9b1c..398599dd9eec 100644
--- a/odk/cfgWin.js
+++ b/odk/cfgWin.js
@@ -2,8 +2,8 @@
// examples of the Office Development Kit. The script duplicates the template
// script and inserts the variables into the copied script.
// The Script was developed for the operating systems Microsoft Windows.
-var regKeyOfficeCurrentUser = "HKEY_CURRENT_USER\\Software\\OpenOffice.org\\UNO\\InstallPath\\";
-var regKeyOfficeLocaleMachine = "HKEY_LOCAL_MACHINE\\Software\\OpenOffice.org\\UNO\\InstallPath\\";
+var regKeyOfficeCurrentUser = "HKEY_CURRENT_USER\\Software\\LibreOffice\\UNO\\InstallPath\\";
+var regKeyOfficeLocaleMachine = "HKEY_LOCAL_MACHINE\\Software\\LibreOffice\\UNO\\InstallPath\\";
var regKeyDotNetInstallRoot = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\.NETFramework\\InstallRoot";
var regKeyDotNet1_1 = "HKLM\\Software\\Microsoft\\.NETFramework\\policy\\v1.1\\4322";
var sDirDotNet1_1 = "v1.1.4322";
@@ -788,22 +788,22 @@ function writeBatFile(fdir, file)
"REM are necessary for building the examples of the Office Development Kit.\n" +
"REM The Script was developed for the operating systems Windows.\n" +
"REM The SDK name\n" +
- "REM Example: set OO_SDK_NAME=openoffice3.0_sdk\n" +
+ "REM Example: set OO_SDK_NAME=libreoffice3.4_sdk\n" +
"set OO_SDK_NAME=" + oo_sdk_name +
"\n\n" +
"REM Installation directory of the Software Development Kit.\n" +
- "REM Example: set OO_SDK_HOME=C:\\Program Files\\OpenOffice.org\\Basic 3.0\\sdk\n" +
+ "REM Example: set OO_SDK_HOME=C:\\Program Files\\LibreOffice 3\\Basis\\sdk\n" +
"set OO_SDK_HOME=" + oo_sdk_home +
"\n\n" +
"REM Office installation directory.\n" +
- "REM Example: set OFFICE_HOME=C:\\Program Files\\OpenOffice.org 3\n" +
+ "REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\n" +
"set OFFICE_HOME=" + office_home +
"\n\n" +
- "REM Example: set OFFICE_HOME=C:\\Program Files\\OpenOffice.org\\Basis 3.0\n" +
+ "REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\\Basis\n" +
"set OFFICE_BASE_HOME=" + office_base_home +
"\n\n" +
"REM URE installation directory.\n" +
- "REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\OpenOffice.org\\URE\n" +
+ "REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\LibreOffice 3\\URE\n" +
"set OO_SDK_URE_HOME=" + oo_sdk_ure_home +
"\n\n" +
"REM Directory of the make command.\n" +
diff --git a/oovbaapi/ooo/vba/excel/XWorksheets.idl b/oovbaapi/ooo/vba/excel/XWorksheets.idl
index 13b4f4faf745..17c80ce4547a 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheets.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheets.idl
@@ -44,6 +44,7 @@ interface XWorksheets
void Delete();
void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName );
void Select( [in] any Replace );
+ void Copy( [in] any Before, [in] any After);
};
}; }; };
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 18965ed78d1c..86dea33d8eac 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -198,7 +198,7 @@ void Shape::addShape(
void Shape::applyShapeReference( const Shape& rReferencedShape )
{
- mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) );
+ mpTextBody = TextBodyPtr( rReferencedShape.mpTextBody.get() ? new TextBody( *rReferencedShape.mpTextBody.get() ) : new TextBody() );
maShapeProperties = rReferencedShape.maShapeProperties;
mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
mpFillPropertiesPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) );
diff --git a/package/source/manifest/UnoRegister.cxx b/package/source/manifest/UnoRegister.cxx
index e8bf0e9604d3..e71f6fe99d6b 100644
--- a/package/source/manifest/UnoRegister.cxx
+++ b/package/source/manifest/UnoRegister.cxx
@@ -48,7 +48,7 @@ using rtl::OUString;
// C functions to implement this as a component
-extern "C" void SAL_CALL component_getImplementationEnvironment(
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
@@ -61,7 +61,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
* @param pRegistryKey registry data key to read and write component persistent data
* @return a component factory (generic uno interface)
*/
-extern "C" void * SAL_CALL component_getFactory(
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{
void * pRet = 0;
diff --git a/rhino/README b/rhino/README
index f8f47a186e20..f8f47a186e20 100755..100644
--- a/rhino/README
+++ b/rhino/README
diff --git a/rhino/makefile.mk b/rhino/makefile.mk
index 094e1102ad2f..d7888fc970be 100755..100644
--- a/rhino/makefile.mk
+++ b/rhino/makefile.mk
@@ -49,12 +49,18 @@ PATCH_FILES=rhino1_5R5.patch \
rhino1_5R5-find_swing.patch \
rhino1_5R5-updateToolTip.patch
+.IF "$(OS)"=="WNT"
+FIXED_TARFILE_LOCATION=`cygpath -m -s "$(TARFILE_LOCATION)"`
+.ELSE
+FIXED_TARFILE_LOCATION=$(TARFILE_LOCATION)
+.ENDIF
+
.IF "$(JAVACISGCJ)"=="yes"
JAVA_HOME=
.EXPORT : JAVA_HOME
BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj jar
.ELSE
-BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar
+BUILD_ACTION=TARFILE_LOCATION="$(FIXED_TARFILE_LOCATION)" $(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar
.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index 9eaa8b598ca1..f10244d7c5ed 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -72,11 +72,11 @@ oslMutex SAL_CALL osl_createMutex()
pthread_mutexattr_init(&aMutexAttr);
nRet = pthread_mutexattr_settype(&aMutexAttr, PTHREAD_MUTEX_RECURSIVE);
-
- nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
+ if( nRet == 0 )
+ nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
if ( nRet != 0 )
{
- OSL_TRACE("osl_createMutex : mutex init failed. Errno: %d; %s\n",
+ OSL_TRACE("osl_createMutex : mutex init/setattr failed. Errno: %d; %s\n",
nRet, strerror(nRet));
free(pMutex);
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index d1c2c984bd9a..6312cc956392 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -942,6 +942,12 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
set the current process locale
*****************************************************************************/
+static int
+_setenv (const char* name, const char* value)
+{
+ return setenv (name, value, 1);
+}
+
int _imp_setProcessLocale( rtl_Locale * pLocale )
{
char locale_buf[64];
@@ -950,32 +956,14 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
if( NULL != _compose_locale( pLocale, locale_buf, 64 ) )
{
/* only change env vars that exist already */
- if( getenv( "LC_ALL" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY )
- setenv( "LC_ALL", locale_buf, 1);
-#else
- setenv( "LC_ALL", locale_buf );
-#endif
- }
+ if( getenv( "LC_ALL" ) )
+ _setenv( "LC_ALL", locale_buf );
- if( getenv( "LC_CTYPE" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY )
- setenv("LC_CTYPE", locale_buf, 1 );
-#else
- setenv( "LC_CTYPE", locale_buf );
-#endif
- }
+ if( getenv( "LC_CTYPE" ) )
+ _setenv("LC_CTYPE", locale_buf );
- if( getenv( "LANG" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD) || defined( DRAGONFLY )
- setenv("LC_CTYPE", locale_buf, 1 );
-#else
- setenv( "LANG", locale_buf );
-#endif
- }
+ if( getenv( "LANG" ) )
+ _setenv( "LANG", locale_buf );
}
return 0;
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index e8ab52431744..0622fc52d35d 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -359,12 +359,10 @@ void SAL_CALL osl_closePipe( oslPipe pPipe )
len = sizeof(addr);
nRet = connect( fd, (struct sockaddr *)&addr, len);
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("connect in osl_destroyPipe");
+ OSL_TRACE("connect in osl_destroyPipe failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
close(fd);
}
#endif /* LINUX */
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index d16c025ddc36..e458124e1a73 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -376,6 +376,16 @@ static oslSocket receiveFdPipe(int PipeFD)
OSL_TRACE("receiveFdPipe : writing back %i",nRetCode);
nRead=write(PipeFD,&nRetCode,sizeof(nRetCode));
+ if ( nRead < 0 )
+ {
+ OSL_TRACE("write failed (%s)", strerror(errno));
+ }
+ else if ( nRead != sizeof(nRetCode) )
+ {
+ // TODO: Handle this case.
+ OSL_TRACE("partial write: wrote %d out of %d)", nRead, sizeof(nRetCode));
+ }
+
#if defined(IOCHANNEL_TRANSFER_BSD_RENO)
free(cmptr);
#endif
@@ -534,8 +544,9 @@ static void ChildStatusProc(void *pData)
if (stdError[1] != -1) close( stdError[1] );
}
- pid=execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
-
+ // No need to check the return value of execv. If we return from
+ // it, an error has occurred.
+ execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
}
OSL_TRACE("Failed to exec, errno=%d (%s)\n", errno, strerror(errno));
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index c2a0cc490af9..8a76018635a1 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -274,6 +274,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o
sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
{
osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile;
+ osl_TProfileImpl* pTmpProfile;
#ifdef TRACE_OSL_PROFILE
OSL_TRACE("In osl_closeProfile\n");
@@ -303,22 +304,22 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
if ( ! ( pProfile->m_Flags & osl_Profile_READLOCK ) && ( pProfile->m_Flags & FLG_MODIFIED ) )
{
- pProfile = acquireProfile(Profile,sal_True);
+ pTmpProfile = acquireProfile(Profile,sal_True);
- if ( pProfile != 0 )
+ if ( pTmpProfile != 0 )
{
- sal_Bool bRet = storeProfile(pProfile, sal_True);
+ sal_Bool bRet = storeProfile(pTmpProfile, sal_True);
OSL_ASSERT(bRet);
(void)bRet;
}
}
else
{
- pProfile = acquireProfile(Profile,sal_False);
+ pTmpProfile = acquireProfile(Profile,sal_False);
}
- if ( pProfile == 0 )
+ if ( pTmpProfile == 0 )
{
pthread_mutex_unlock(&(pProfile->m_AccessLock));
#ifdef TRACE_OSL_PROFILE
@@ -327,6 +328,8 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
return sal_False;
}
+ pProfile = pTmpProfile;
+
if (pProfile->m_pFile != NULL)
closeFileImpl(pProfile->m_pFile,pProfile->m_Flags);
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index a8e91236b02e..6c102a4b3f9f 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -1705,12 +1705,10 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
socklen_t nSockLen = sizeof(s.aSockAddr);
nRet = getsockname(nFD, &s.aSockAddr, &nSockLen);
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("getsockname");
+ OSL_TRACE("getsockname call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
if ( s.aSockAddr.sa_family == AF_INET )
{
@@ -1720,20 +1718,16 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
}
nConnFD = socket(AF_INET, SOCK_STREAM, 0);
-#if OSL_DEBUG_LEVEL > 1
if ( nConnFD < 0 )
{
- perror("socket");
+ OSL_TRACE("socket call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr));
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("connect");
+ OSL_TRACE("connect call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
close(nConnFD);
}
pSocket->m_bIsAccepting = sal_False;
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
new file mode 100644
index 000000000000..5a92c164b2a7
--- /dev/null
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_ucalc))
+
+$(eval $(call gb_CppunitTest_add_package_headers,sc_ucalc,sc_qa_unit))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \
+ sc/qa/unit/ucalc \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_ucalc,\
+ --headless \
+ --invisible \
+ "-env:UNO_TYPES=$(foreach binrdb,udkapi.rdb types.rdb,\
+ file://$(if $(filter WNT,$(OS)),/)$(OUTDIR)/bin/$(binrdb))" \
+ "-env:UNO_SERVICES=$(foreach rdb,$(OUTDIR)/xml/ure/services.rdb $(WORKDIR)/CustomTarget/sc/qa/unit/services.rdb,\
+ file://$(if $(filter WNT,$(OS)),/)$(rdb))" \
+ $(foreach dir,URE_INTERNAL_LIB_DIR OOO_BASE_DIR BRAND_BASE_DIR, \
+ -env:$(dir)=file://$(if $(filter WNT,$(OS)),/$(OUTDIR)/bin,$(OUTDIR)/lib)) \
+))
+
+$(eval $(call gb_CppunitTest_add_library_objects,sc_ucalc,sc))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nisolang1 \
+ sal \
+ salhelper \
+ sb \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_ucalc,\
+ -I$(realpath $(SRCDIR)/sc/inc/pch) \
+ -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+ -I$(realpath $(SRCDIR)/sc/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc \
+))
+
+# vim: set noet sw=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 6878587be498..7cd8ba891ac7 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -23,13 +23,19 @@
$(eval $(call gb_Module_Module,sc))
$(eval $(call gb_Module_add_targets,sc,\
- AllLangResTarget_sc \
- Library_sc \
- Library_scd \
- Library_scfilt \
- Library_scui \
- Library_vbaobj \
- Package_uiconfig \
- Package_xml \
+ AllLangResTarget_sc \
+ Library_sc \
+ Library_scd \
+ Library_scfilt \
+ Library_scui \
+ Library_vbaobj \
+ Package_uiconfig \
+ Package_xml \
))
+$(eval $(call gb_Module_add_check_targets,sc,\
+ CppunitTest_sc_ucalc \
+ Package_qa_unit \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/sc/Package_qa_unit.mk b/sc/Package_qa_unit.mk
new file mode 100644
index 000000000000..8db8cb798f07
--- /dev/null
+++ b/sc/Package_qa_unit.mk
@@ -0,0 +1,44 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.)
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s): Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Package_Package,sc_qa_unit,$(WORKDIR)/CustomTarget/sc/qa/unit))
+$(eval $(call gb_Package_add_customtarget,sc_qa_unit,sc/qa/unit))
+
+# dependencies that cause the CustomTarget Makefile to be called recursively for
+# (re)build
+$(eval $(call gb_CustomTarget_add_outdir_dependencies,sc/qa/unit,\
+ $(foreach newcomponentfile,\
+ framework/util/fwk \
+ sfx2/util/sfx \
+ unoxml/source/service/unoxml,\
+ $(OUTDIR)/xml/component/$(newcomponentfile).component) \
+ $(foreach oldcomponentfile, \
+ i18npool \
+ ucb1 \
+ ucpfile1, \
+ $(OUTDIR)/xml/$(oldcomponentfile).component) \
+))
+
+# vim: set noet sw=4:
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 96842785c8f3..74920c7575b7 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -487,7 +487,7 @@ public:
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL );
- sal_uInt16 ParseAny( const String&, ScDocument* = NULL,
+ SC_DLLPUBLIC sal_uInt16 ParseAny( const String&, ScDocument* = NULL,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
SC_DLLPUBLIC sal_uInt16 ParseCols( const String&, ScDocument* = NULL,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx
index 8583b710e437..8f26f667f5f8 100644
--- a/sc/inc/dbcolect.hxx
+++ b/sc/inc/dbcolect.hxx
@@ -122,6 +122,7 @@ public:
bool operator== (const ScDBData& rData) const;
+ SCTAB GetTable() const;
const String& GetName() const { return aName; }
void GetName(String& rName) const { rName = aName; }
void SetName(const String& rName) { aName = rName; }
@@ -214,6 +215,7 @@ public:
virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const;
ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
+ ScDBData* GetFilterDBAtTable(SCTAB nTab) const;
ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab );
sal_Bool SearchName( const String& rName, sal_uInt16& rIndex ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f41edffbe291..901bc3615ac2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -484,6 +484,8 @@ public:
ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
sal_Bool bStartOnly = false) const;
ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
+ ScDBData* GetFilterDBAtTable(SCTAB nTab) const;
+
SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx
index cc2f330194e9..63dcf12c65e8 100644
--- a/sc/inc/reffind.hxx
+++ b/sc/inc/reffind.hxx
@@ -42,14 +42,13 @@ private:
String aFormula;
formula::FormulaGrammar::AddressConvention eConv;
ScDocument* pDoc;
+ ScAddress maPos;
xub_StrLen nFound;
xub_StrLen nSelStart;
xub_StrLen nSelEnd;
public:
- static const sal_Unicode pDelimiters[];
-
- ScRefFinder( const String& rFormula,
+ ScRefFinder( const String& rFormula, const ScAddress& rPos,
ScDocument* pDocument = NULL,
formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO );
~ScRefFinder();
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 14f8ddf821bb..5e22e5b1c9b8 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -690,6 +690,7 @@ public:
/// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
SCROW GetLastChangedRow() const;
+ bool IsDataFiltered() const;
sal_uInt8 GetColFlags( SCCOL nCol ) const;
sal_uInt8 GetRowFlags( SCROW nRow ) const;
diff --git a/sc/qa/unit/Makefile b/sc/qa/unit/Makefile
new file mode 100644
index 000000000000..87694f116f34
--- /dev/null
+++ b/sc/qa/unit/Makefile
@@ -0,0 +1,53 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.)
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s): Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+MYDIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
+
+all : services.rdb
+
+services.rdb : $(foreach newcomponentfile,\
+ framework/util/fwk \
+ sfx2/util/sfx \
+ unoxml/source/service/unoxml,\
+ $(OUTDIR)/xml/component/$(newcomponentfile).component \
+)
+
+services.rdb : $(foreach oldcomponentfile, \
+ i18npool \
+ ucb1 \
+ ucpfile1, \
+ $(OUTDIR)/xml/$(oldcomponentfile).component \
+)
+
+services.rdb :
+ echo '<?xml version="1.0"?><components xmlns="http://openoffice.org/2010/uno-components">' > $@
+ $(gb_AWK) -- \
+ '/^<\?xml version.*/ { next; } \
+ { gsub(/vnd.sun.star.expand:\$$OOO_BASE_DIR\/program/, "vnd.sun.star.expand:$$OOO_BASE_DIR",$$0); gsub(/vnd.sun.star.expand:\$$BRAND_BASE_DIR\/program/, "vnd.sun.star.expand:$$BRAND_BASE_DIR",$$0); print; }' \
+ $^ >> $@
+ echo '</components>' >> $@
+
+.PHONY : all
+# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/unit/makefile.mk b/sc/qa/unit/makefile.mk
deleted file mode 100644
index d252433fd56b..000000000000
--- a/sc/qa/unit/makefile.mk
+++ /dev/null
@@ -1,132 +0,0 @@
-# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Initial Developer of the Original Code is
-# Novell, Inc.
-# Portions created by the Initial Developer are Copyright (C) 2010 the
-# Initial Developer. All Rights Reserved.
-#
-# Contributor(s): Michael Meeks <michael.meeks@novell.com>
-# Caolan McNamara <caolanm@redhat.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-#
-
-PRJ=..$/..
-PRJNAME=sc
-TARGET=qa_unit
-
-ENABLE_EXCEPTIONS=TRUE
-
-.INCLUDE : settings.mk
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS) -I../../source/ui/inc
-
-SHL1TARGET = $(TARGET)
-SHL1OBJS = $(SLO)$/ucalc.obj
-SHL1STDLIBS= \
- $(BASICLIB) \
- $(VBAHELPERLIB) \
- $(SFXLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(SVXCORELIB) \
- $(EDITENGLIB) \
- $(SVXLIB) \
- $(BASEGFXLIB) \
- $(DRAWINGLAYERLIB) \
- $(VCLLIB) \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(COMPHELPERLIB) \
- $(UCBHELPERLIB) \
- $(TKLIB) \
- $(VOSLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(TOOLSLIB) \
- $(I18NISOLANGLIB) \
- $(UNOTOOLSLIB) \
- $(SOTLIB) \
- $(XMLOFFLIB) \
- $(AVMEDIALIB) \
- $(FORLIB) \
- $(FORUILIB) \
- $(CPPUNITLIB)
-SHL1IMPLIB = i$(SHL1TARGET)
-SHL1LIBS=$(SLB)$/scalc3.lib $(SLB)$/scalc3c.lib
-DEF1NAME = $(SHL1TARGET)
-SHL1VERSIONMAP=version.map
-
-.INCLUDE: target.mk
-
-.IF "$(OS)" == "WNT"
-my_file = file:///
-.ELSE
-my_file = file://
-.END
-
-ALLTAR: test
-
-test_components = \
- component/framework/util/fwk \
- component/sfx2/util/sfx \
- component/unoxml/source/service/unoxml \
- ucb1 \
- ucpfile1 \
- i18npool
-
-#Make a services.rdb with the services we know we need to get up and running
-$(MISC)/$(TARGET)/services.input : makefile.mk
- $(MKDIRHIER) $(@:d)
- echo \
- '<list>$(test_components:^"<filename>":+".component</filename>")</list>' \
- > $@
-
-$(MISC)/$(TARGET)/services.rdb .ERRREMOVE : makefile.mk $(MISC)/$(TARGET)/services.input
- $(MKDIRHIER) $(@:d)
- $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@.tmp \
- $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
- cat $(MISC)/$@.tmp | sed 's|/program/|/|g' > $@
-
-#Tweak things so that we use the .res files in the solver
-STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR)
-.EXPORT : STAR_RESOURCEPATH
-
-.IF "$(OS)" != "DRAGONFLY"
-
-test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb
- @echo ----------------------------------------------------------
- @echo - start unit test \#1 on library $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- $(CPPUNITTESTER) $(SHL1TARGETN) --headless --invisible \
- '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(SOLARBINDIR)$/types.rdb' \
- '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\
- -env:URE_INTERNAL_LIB_DIR="$(my_file)$(SOLARSHAREDBIN)" \
- -env:OOO_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)" \
- -env:BRAND_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)"
-
-.ELSE
-
-test .PHONY: $(SHL1TARGETN)
- @echo ----------------------------------------------------------
- @echo - WARNING!!, test disabled on your platform
- @echo - Please test manually, and enable if it works
- @echo ----------------------------------------------------------
-
-.ENDIF
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d742718417ad..4d15f31a6371 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -39,12 +39,8 @@
// the need for manually calling regcomp and knowing what
// services we need, and in what .so they are implemented
-#include "precompiled_sc.hxx"
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
+#include <sal/cppunit.h>
#include <sal/config.h>
#include <osl/file.hxx>
@@ -61,6 +57,7 @@
#include "scmatrix.hxx"
#include "drwlayer.hxx"
#include "scitems.hxx"
+#include "reffind.hxx"
#include "docsh.hxx"
#include "funcdesc.hxx"
@@ -229,6 +226,7 @@ public:
void testInput();
void testSUM();
void testVolatileFunc();
+ void testFuncParam();
void testNamedRange();
void testCSV();
void testMatrix();
@@ -255,11 +253,19 @@ public:
*/
void testCVEs();
+ /**
+ * Test toggling relative/absolute flag of cell and cell range references.
+ * This corresponds with hitting Shift-F4 while the cursor is on a formula
+ * cell.
+ */
+ void testToggleRefFlag();
+
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testCollator);
CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testSUM);
CPPUNIT_TEST(testVolatileFunc);
+ CPPUNIT_TEST(testFuncParam);
CPPUNIT_TEST(testNamedRange);
CPPUNIT_TEST(testCSV);
CPPUNIT_TEST(testMatrix);
@@ -271,6 +277,7 @@ public:
CPPUNIT_TEST(testStreamValid);
CPPUNIT_TEST(testFunctionLists);
CPPUNIT_TEST(testCVEs);
+ CPPUNIT_TEST(testToggleRefFlag);
CPPUNIT_TEST_SUITE_END();
private:
@@ -412,6 +419,29 @@ void Test::testVolatileFunc()
m_pDoc->DeleteTab(0);
}
+void Test::testFuncParam()
+{
+ rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo"));
+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
+ m_pDoc->InsertTab (0, aTabName));
+
+ // First, the normal case, with no missing parameters.
+ m_pDoc->SetString(0, 0, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=AVERAGE(1;2;3)")));
+ m_pDoc->CalcFormulaTree(false, true);
+ double val;
+ m_pDoc->GetValue(0, 0, 0, val);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 2);
+
+ // Now function with missing parameters. Missing values should be treated
+ // as zeros.
+ m_pDoc->SetString(0, 0, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=AVERAGE(1;;;)")));
+ m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->GetValue(0, 0, 0, val);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 0.25);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testNamedRange()
{
rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("Sheet1"));
@@ -491,15 +521,15 @@ void Test::testCVEs()
bool bResult;
bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")),
- m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5745-1.wb2")));
+ m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5745-1.wb2")));
CPPUNIT_ASSERT_MESSAGE("CVE-2007-5745 regression", bResult == true);
bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")),
- m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5745-2.wb2")));
+ m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5745-2.wb2")));
CPPUNIT_ASSERT_MESSAGE("CVE-2007-5745 regression", bResult == true);
bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")),
- m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5747-1.wb2")));
+ m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5747-1.wb2")));
CPPUNIT_ASSERT_MESSAGE("CVE-2007-5747 regression", bResult == false);
}
@@ -1619,6 +1649,83 @@ void Test::testGraphicsInGroup()
m_pDoc->DeleteTab(0);
}
+void Test::testToggleRefFlag()
+{
+ // In this test, there is no need to insert formula string into a cell in
+ // the document, as ScRefFinder does not depend on the content of the
+ // document except for the sheet names.
+
+ OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("Test"));
+ m_pDoc->InsertTab(0, aTabName);
+
+ {
+ // Calc A1: basic 2D reference
+
+ OUString aFormula(RTL_CONSTASCII_USTRINGPARAM("=B100"));
+ ScAddress aPos(1, 5, 0);
+ ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_OOO);
+
+ // Original
+ CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equals(aFinder.GetText()));
+
+ // column relative / row relative -> column absolute / row absolute
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=$B$100"));
+
+ // column absolute / row absolute -> column relative / row absolute
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=B$100"));
+
+ // column relative / row absolute -> column absolute / row relative
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=$B100"));
+
+ // column absolute / row relative -> column relative / row relative
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=B100"));
+ }
+
+ {
+ // Excel R1C1: basic 2D reference
+
+ OUString aFormula(RTL_CONSTASCII_USTRINGPARAM("=R2C1"));
+ ScAddress aPos(3, 5, 0);
+ ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
+
+ // Original
+ CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equals(aFinder.GetText()));
+
+ // column absolute / row absolute -> column relative / row absolute
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R2C[-3]"));
+
+ // column relative / row absolute - > column absolute / row relative
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R[-4]C1"));
+
+ // column absolute / row relative -> column relative / row relative
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R[-4]C[-3]"));
+
+ // column relative / row relative -> column absolute / row absolute
+ aFinder.ToggleRel(0, aFormula.getLength());
+ aFormula = aFinder.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R2C1"));
+ }
+
+ // TODO: Add more test cases esp. for 3D references, Excel A1 syntax, and
+ // partial selection within formula string.
+
+ m_pDoc->DeleteTab(0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 888b1a16d551..583ea6cc8956 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -238,6 +238,14 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nC
return NULL;
}
+ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
+{
+ if (pDBCollection)
+ return pDBCollection->GetFilterDBAtTable(nTab);
+ else
+ return NULL;
+}
+
ScDPCollection* ScDocument::GetDPCollection()
{
if (!pDPCollection)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 7293cf1eed04..646be060b6a9 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2628,6 +2628,20 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
DecRecalcLevel();
}
+bool ScTable::IsDataFiltered() const
+{
+ bool bAnyQuery = false;
+ ScDBData* pDBData = pDocument->GetFilterDBAtTable(nTab);
+ if ( pDBData )
+ {
+ ScQueryParam aParam;
+ pDBData->GetQueryParam( aParam );
+ if ( aParam.GetEntry(0).bDoQuery )
+ bAnyQuery = true;
+ }
+ return bAnyQuery;
+}
+
void ScTable::SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags )
{
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index e7ba2153a3f1..55b4da849665 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -79,6 +79,7 @@
#include "rangenam.hxx"
#include "docpool.hxx"
#include "progress.hxx"
+#include "segmenttree.hxx"
#include <math.h>
@@ -199,7 +200,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
rMinDigits = 0;
rListData = NULL;
rCmd = FILL_SIMPLE;
- if ( nScFillModeMouseModifier & KEY_MOD1 )
+ if ( (nScFillModeMouseModifier & KEY_MOD1) || IsDataFiltered() )
return ; // Ctrl-Taste: Copy
SCCOL nAddX;
@@ -525,10 +526,15 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
sal_uLong nIMin = nIStart;
sal_uLong nIMax = nIEnd;
PutInOrder(nIMin,nIMax);
- if (bVertical)
- DeleteArea(nCol1, static_cast<SCROW>(nIMin), nCol2, static_cast<SCROW>(nIMax), IDF_AUTOFILL);
- else
- DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_AUTOFILL);
+ sal_Bool bHasFiltered = IsDataFiltered();
+
+ if (!bHasFiltered)
+ {
+ if (bVertical)
+ DeleteArea(nCol1, static_cast<SCROW>(nIMin), nCol2, static_cast<SCROW>(nIMax), IDF_AUTOFILL);
+ else
+ DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_AUTOFILL);
+ }
sal_uLong nProgress = rProgress.GetState();
@@ -575,7 +581,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pNewPattern = NULL;
}
- if ( bVertical && nISrcStart == nISrcEnd )
+ if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered )
{
// Attribute komplett am Stueck setzen
if (pNewPattern || pSrcPattern != pDocument->GetDefPattern())
@@ -593,37 +599,44 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
break; // Schleife abbrechen
}
- if ( pSrcPattern != aCol[nCol].GetPattern( static_cast<SCROW>(nRow) ) )
+ if (!RowFiltered( nRow ))
{
- // Vorlage auch uebernehmen
- //! am AttrArray mit ApplyPattern zusammenfassen ??
- if ( pStyleSheet )
- aCol[nCol].ApplyStyle( static_cast<SCROW>(nRow), *pStyleSheet );
+ if ( bHasFiltered )
+ DeleteArea(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow),
+ static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), IDF_AUTOFILL);
- // ApplyPattern statt SetPattern um alte MergeFlags stehenzulassen
- if ( pNewPattern )
- aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pNewPattern );
- else
- aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pSrcPattern );
- }
+ if ( pSrcPattern != aCol[nCol].GetPattern( static_cast<SCROW>(nRow) ) )
+ {
+ // Vorlage auch uebernehmen
+ //! am AttrArray mit ApplyPattern zusammenfassen ??
+ if ( pStyleSheet )
+ aCol[nCol].ApplyStyle( static_cast<SCROW>(nRow), *pStyleSheet );
- if (nAtSrc==nISrcEnd)
- {
- if ( nAtSrc != nISrcStart )
- { // mehr als eine Source-Zelle
- nAtSrc = nISrcStart;
+ // ApplyPattern statt SetPattern um alte MergeFlags stehenzulassen
+ if ( pNewPattern )
+ aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pNewPattern );
+ else
+ aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pSrcPattern );
+ }
+
+ if (nAtSrc==nISrcEnd)
+ {
+ if ( nAtSrc != nISrcStart )
+ { // mehr als eine Source-Zelle
+ nAtSrc = nISrcStart;
+ bGetPattern = sal_True;
+ }
+ }
+ else if (bPositive)
+ {
+ ++nAtSrc;
+ bGetPattern = sal_True;
+ }
+ else
+ {
+ --nAtSrc;
bGetPattern = sal_True;
}
- }
- else if (bPositive)
- {
- ++nAtSrc;
- bGetPattern = sal_True;
- }
- else
- {
- --nAtSrc;
- bGetPattern = sal_True;
}
if (rInner == nIEnd) break;
@@ -691,7 +704,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
sal_uLong nSource = nISrcStart;
double nDelta;
- if ( nScFillModeMouseModifier & KEY_MOD1 )
+ if ( (nScFillModeMouseModifier & KEY_MOD1) || bHasFiltered )
nDelta = 0.0;
else if ( bPositive )
nDelta = 1.0;
@@ -708,6 +721,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScBaseCell* pSrcCell = NULL;
CellType eCellType = CELLTYPE_NONE;
sal_Bool bIsOrdinalSuffix = false;
+ sal_Bool bRowFiltered = false;
rInner = nIStart;
while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
@@ -733,7 +747,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
((ScStringCell*)pSrcCell)->GetString( aValue );
else
((ScEditCell*)pSrcCell)->GetString( aValue );
- if ( !(nScFillModeMouseModifier & KEY_MOD1) )
+ if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
{
nCellDigits = 0; // look at each source cell individually
nHeadNoneTail = lcl_DecompValueString(
@@ -752,94 +766,103 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
else
eCellType = CELLTYPE_NONE;
}
- switch (eCellType)
- {
- case CELLTYPE_VALUE:
- aCol[nCol].Insert(static_cast<SCROW>(nRow), new ScValueCell(nVal + nDelta));
- break;
- case CELLTYPE_STRING:
- case CELLTYPE_EDIT:
- if ( nHeadNoneTail )
- {
- // #i48009# with the "nStringValue+(long)nDelta" expression within the
- // lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3),
- // so nNextValue is now calculated ahead.
- sal_Int32 nNextValue = nStringValue+(sal_Int32)nDelta;
- String aStr;
- if ( nHeadNoneTail < 0 )
+ bRowFiltered = mpFilteredRows->getValue(nRow);
+
+ if (!bRowFiltered)
+ {
+ switch (eCellType)
+ {
+ case CELLTYPE_VALUE:
+ aCol[nCol].Insert(static_cast<SCROW>(nRow), new ScValueCell(nVal + nDelta));
+ break;
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ if ( nHeadNoneTail )
{
- aCol[nCol].Insert( static_cast<SCROW>(nRow),
- lcl_getSuffixCell( pDocument,
- nNextValue, nCellDigits, aValue,
- eCellType, bIsOrdinalSuffix));
+ // #i48009# with the "nStringValue+(long)nDelta" expression within the
+ // lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3),
+ // so nNextValue is now calculated ahead.
+ sal_Int32 nNextValue = nStringValue+(sal_Int32)nDelta;
+
+ String aStr;
+ if ( nHeadNoneTail < 0 )
+ {
+ aCol[nCol].Insert( static_cast<SCROW>(nRow),
+ lcl_getSuffixCell( pDocument,
+ nNextValue, nCellDigits, aValue,
+ eCellType, bIsOrdinalSuffix));
+ }
+ else
+ {
+ aStr = aValue;
+ aStr += lcl_ValueString( nNextValue, nCellDigits );
+ aCol[nCol].Insert( static_cast<SCROW>(nRow),
+ new ScStringCell( aStr));
+ }
}
else
{
- aStr = aValue;
- aStr += lcl_ValueString( nNextValue, nCellDigits );
- aCol[nCol].Insert( static_cast<SCROW>(nRow),
- new ScStringCell( aStr));
- }
- }
- else
- {
- ScAddress aDestPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), nTab );
- switch ( eCellType )
- {
- case CELLTYPE_STRING:
- case CELLTYPE_EDIT:
- aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) );
- break;
- default:
+ ScAddress aDestPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), nTab );
+ switch ( eCellType )
{
- // added to avoid warnings
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) );
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
}
}
+ break;
+ case CELLTYPE_FORMULA :
+ FillFormula( nFormulaCounter, bFirst,
+ (ScFormulaCell*) pSrcCell,
+ static_cast<SCCOL>(nCol),
+ static_cast<SCROW>(nRow), (rInner == nIEnd) );
+ if (nFormulaCounter - nActFormCnt > nMaxFormCnt)
+ nMaxFormCnt = nFormulaCounter - nActFormCnt;
+ break;
+ default:
+ {
+ // added to avoid warnings
}
- break;
- case CELLTYPE_FORMULA :
- FillFormula( nFormulaCounter, bFirst,
- (ScFormulaCell*) pSrcCell,
- static_cast<SCCOL>(nCol),
- static_cast<SCROW>(nRow), (rInner == nIEnd) );
- if (nFormulaCounter - nActFormCnt > nMaxFormCnt)
- nMaxFormCnt = nFormulaCounter - nActFormCnt;
- break;
- default:
- {
- // added to avoid warnings
}
- }
- if (nSource==nISrcEnd)
- {
- if ( nSource != nISrcStart )
- { // mehr als eine Source-Zelle
- nSource = nISrcStart;
+ if (nSource==nISrcEnd)
+ {
+ if ( nSource != nISrcStart )
+ { // mehr als eine Source-Zelle
+ nSource = nISrcStart;
+ bGetCell = sal_True;
+ }
+ if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
+ {
+ if ( bPositive )
+ nDelta += 1.0;
+ else
+ nDelta -= 1.0;
+ }
+ nFormulaCounter = nActFormCnt;
+ bFirst = false;
+ }
+ else if (bPositive)
+ {
+ ++nSource;
bGetCell = sal_True;
}
- if ( !(nScFillModeMouseModifier & KEY_MOD1) )
+ else
{
- if ( bPositive )
- nDelta += 1.0;
- else
- nDelta -= 1.0;
+ --nSource;
+ bGetCell = sal_True;
}
- nFormulaCounter = nActFormCnt;
- bFirst = false;
- }
- else if (bPositive)
- {
- ++nSource;
- bGetCell = sal_True;
- }
- else
- {
- --nSource;
- bGetCell = sal_True;
}
+ if (rInner == nIEnd) break;
+ if (bPositive) ++rInner; else --rInner;
+
// Progress in der inneren Schleife nur bei teuren Zellen,
// und auch dann nicht fuer jede einzelne
@@ -847,8 +870,6 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ( eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT )
rProgress.SetStateOnPercent( nProgress );
- if (rInner == nIEnd) break;
- if (bPositive) ++rInner; else --rInner;
}
rProgress.SetStateOnPercent( nProgress );
}
@@ -936,6 +957,30 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n
}
else if ( eFillCmd == FILL_SIMPLE ) // Auffuellen mit Muster
{
+ if ((eFillDir == FILL_TO_BOTTOM)||(eFillDir == FILL_TO_TOP))
+ {
+ long nBegin = 0;
+ long nEnd = 0;
+ if (nEndY > nRow1)
+ {
+ nBegin = nRow2+1;
+ nEnd = nEndY;
+ }
+ else
+ {
+ nBegin = nEndY;
+ nEnd = nRow1 -1;
+ }
+
+ long nNonFiltered = CountNonFilteredRows(nBegin, nEnd);
+ long nFiltered = nEnd + 1 - nBegin - nNonFiltered;
+
+ if (nIndex > 0)
+ nIndex = nIndex - nFiltered;
+ else
+ nIndex = nIndex + nFiltered;
+ }
+
long nPosIndex = nIndex;
while ( nPosIndex < 0 )
nPosIndex += nSrcCount;
@@ -966,7 +1011,7 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n
((ScStringCell*)pCell)->GetString( aValue );
else
((ScEditCell*)pCell)->GetString( aValue );
- if ( !(nScFillModeMouseModifier & KEY_MOD1) )
+ if ( !(nScFillModeMouseModifier & KEY_MOD1) && !IsDataFiltered() )
{
sal_Int32 nVal;
sal_uInt16 nCellDigits = 0; // look at each source cell individually
@@ -987,7 +1032,7 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n
{
// dabei kann's keinen Ueberlauf geben...
double nVal = ((ScValueCell*)pCell)->GetValue();
- if ( !(nScFillModeMouseModifier & KEY_MOD1) )
+ if ( !(nScFillModeMouseModifier & KEY_MOD1) && !IsDataFiltered() )
nVal += (double) nDelta;
Color* pColor;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c30f57a03a99..ad3052585784 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3788,6 +3788,7 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula )
eLastOp == ocArrayColSep ||
eLastOp == ocArrayOpen) &&
(eOp == ocSep ||
+ eOp == ocClose ||
eOp == ocArrayRowSep ||
eOp == ocArrayColSep ||
eOp == ocArrayClose) )
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index 89234f9d4b37..4118f9dcd7f9 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -222,6 +222,11 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
return *this;
}
+SCTAB ScDBData::GetTable() const
+{
+ return nTable;
+}
+
bool ScDBData::operator== (const ScDBData& rData) const
{
// Daten, die nicht in den Params sind
@@ -820,6 +825,27 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
return NULL;
}
+ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const
+{
+ ScDBData* pDataEmpty = NULL;
+ if (pItems)
+ {
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ ScDBData* pDBTemp = (ScDBData*)pItems[i];
+ if ( pDBTemp->GetTable() == nTab )
+ {
+ sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam();
+
+ if ( bFilter )
+ return pDBTemp;
+ }
+ }
+ }
+
+ return pDataEmpty;
+}
+
sal_Bool ScDBCollection::SearchName( const String& rName, sal_uInt16& rIndex ) const
{
if (rtl::OUString(rName)==rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME)))
diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index a3b2ce55585d..b6061bc7f230 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -42,16 +42,18 @@
// STATIC DATA -----------------------------------------------------------
+namespace {
+
// incl. Doppelpunkt -> Doppelte Referenzen werden einzeln behandelt
-const sal_Unicode ScRefFinder::pDelimiters[] = {
+const sal_Unicode pDelimiters[] = {
'=','(',')','+','-','*','/','^','&',' ','{','}','<','>',':', 0
};
// =======================================================================
-inline sal_Bool IsText( sal_Unicode c )
+inline bool IsText( sal_Unicode c )
{
- bool bFound = ScGlobal::UnicodeStrChr( ScRefFinder::pDelimiters, c );
+ bool bFound = ScGlobal::UnicodeStrChr( pDelimiters, c );
if (bFound)
// This is one of delimiters, therefore not text.
return false;
@@ -61,23 +63,160 @@ inline sal_Bool IsText( sal_Unicode c )
return c != sep;
}
-inline sal_Bool IsText( sal_Bool& bQuote, sal_Unicode c )
+inline bool IsText( bool& bQuote, sal_Unicode c )
{
- if ( c == '\'' )
+ if (c == '\'')
{
bQuote = !bQuote;
- return sal_True;
+ return true;
+ }
+ if (bQuote)
+ return true;
+
+ return IsText(c);
+}
+
+/**
+ * Find first character position that is considered text. A character is
+ * considered a text when it's within the ascii range and when it's not a
+ * delimiter.
+ */
+xub_StrLen FindStartPos(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos)
+{
+ while (nStartPos <= nEndPos && !IsText(p[nStartPos]))
+ ++nStartPos;
+
+ return nStartPos;
+}
+
+xub_StrLen FindEndPosA1(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos)
+{
+ bool bQuote = false;
+ xub_StrLen nNewEnd = nStartPos;
+ while (nNewEnd <= nEndPos && IsText(bQuote, p[nNewEnd]))
+ ++nNewEnd;
+
+ return nNewEnd;
+}
+
+xub_StrLen FindEndPosR1C1(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos)
+{
+ xub_StrLen nNewEnd = nStartPos;
+ p = &p[nStartPos];
+ for (; nNewEnd <= nEndPos; ++p, ++nNewEnd)
+ {
+ if (*p == '\'')
+ {
+ // Skip until the closing quote.
+ for (; nNewEnd <= nEndPos; ++p, ++nNewEnd)
+ if (*p == '\'')
+ break;
+ }
+ else if (*p == '[')
+ {
+ // Skip until the closing braket.
+ for (; nNewEnd <= nEndPos; ++p, ++nNewEnd)
+ if (*p == ']')
+ break;
+ }
+ else if (!IsText(*p))
+ break;
+ }
+
+ return nNewEnd;
+}
+
+/**
+ * Find last character position that is considred text, from the specified
+ * start position.
+ */
+xub_StrLen FindEndPos(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos,
+ formula::FormulaGrammar::AddressConvention eConv)
+{
+ switch (eConv)
+ {
+ case formula::FormulaGrammar::CONV_XL_R1C1:
+ return FindEndPosR1C1(p, nStartPos, nEndPos);
+ case formula::FormulaGrammar::CONV_OOO:
+ case formula::FormulaGrammar::CONV_XL_A1:
+ default:
+ return FindEndPosA1(p, nStartPos, nEndPos);
}
- if ( bQuote )
- return sal_True;
- return IsText( c );
}
-ScRefFinder::ScRefFinder(const String& rFormula, ScDocument* pDocument,
- formula::FormulaGrammar::AddressConvention eConvP) :
+void ExpandToTextA1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos)
+{
+ while (rStartPos > 0 && IsText(p[rStartPos - 1]) )
+ --rStartPos;
+ if (rEndPos)
+ --rEndPos;
+ while (rEndPos+1 < nLen && IsText(p[rEndPos + 1]) )
+ ++rEndPos;
+}
+
+void ExpandToTextR1C1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos)
+{
+ // move back the start position to the first text character.
+ if (rStartPos > 0)
+ {
+ for (--rStartPos; rStartPos > 0; --rStartPos)
+ {
+ sal_Unicode c = p[rStartPos];
+ if (c == '\'')
+ {
+ // Skip until the opening quote.
+ for (--rStartPos; rStartPos > 0; --rStartPos)
+ {
+ c = p[rStartPos];
+ if (c == '\'')
+ break;
+ }
+ }
+ else if (c == ']')
+ {
+ // Skip until the opening braket.
+ for (--rStartPos; rStartPos > 0; --rStartPos)
+ {
+ if (c == '[')
+ break;
+ }
+ }
+ else if (!IsText(c))
+ {
+ ++rStartPos;
+ break;
+ }
+ }
+ }
+
+ // move forward the end position to the last text character.
+ rEndPos = FindEndPosR1C1(p, rEndPos, nLen-1);
+}
+
+void ExpandToText(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos,
+ formula::FormulaGrammar::AddressConvention eConv)
+{
+ switch (eConv)
+ {
+ case formula::FormulaGrammar::CONV_XL_R1C1:
+ ExpandToTextR1C1(p, nLen, rStartPos, rEndPos);
+ break;
+ case formula::FormulaGrammar::CONV_OOO:
+ case formula::FormulaGrammar::CONV_XL_A1:
+ default:
+ ExpandToTextA1(p, nLen, rStartPos, rEndPos);
+ }
+}
+
+}
+
+ScRefFinder::ScRefFinder(
+ const String& rFormula, const ScAddress& rPos,
+ ScDocument* pDocument, formula::FormulaGrammar::AddressConvention eConvP) :
aFormula( rFormula ),
eConv( eConvP ),
- pDoc( pDocument )
+ pDoc( pDocument ),
+ maPos(rPos)
{
nSelStart = nSelEnd = nFound = 0;
}
@@ -107,15 +246,9 @@ void ScRefFinder::ToggleRel( xub_StrLen nStartPos, xub_StrLen nEndPos )
// Selektion erweitern, und statt Selektion Start- und Endindex
if ( nEndPos < nStartPos )
- {
- xub_StrLen nTemp = nStartPos; nStartPos = nEndPos; nEndPos = nTemp;
- }
- while (nStartPos > 0 && IsText(pSource[nStartPos - 1]) )
- --nStartPos;
- if (nEndPos)
- --nEndPos;
- while (nEndPos+1 < nLen && IsText(pSource[nEndPos + 1]) )
- ++nEndPos;
+ ::std::swap(nEndPos, nStartPos);
+
+ ExpandToText(pSource, nLen, nStartPos, nEndPos, eConv);
String aResult;
String aExpr;
@@ -126,27 +259,20 @@ void ScRefFinder::ToggleRel( xub_StrLen nStartPos, xub_StrLen nEndPos )
xub_StrLen nLoopStart = nStartPos;
while ( nLoopStart <= nEndPos )
{
- // Formel zerlegen
-
- xub_StrLen nEStart = nLoopStart;
- while ( nEStart <= nEndPos && !IsText(pSource[nEStart]) )
- ++nEStart;
-
- sal_Bool bQuote = false;
- xub_StrLen nEEnd = nEStart;
- while ( nEEnd <= nEndPos && IsText(bQuote,pSource[nEEnd]) )
- ++nEEnd;
+ // Determine the stard and end positions of a text segment.
+ xub_StrLen nEStart = FindStartPos(pSource, nLoopStart, nEndPos);
+ xub_StrLen nEEnd = FindEndPos(pSource, nEStart, nEndPos, eConv);
aSep = aFormula.Copy( nLoopStart, nEStart-nLoopStart );
aExpr = aFormula.Copy( nEStart, nEEnd-nEStart );
- // Test, ob aExpr eine Referenz ist
-
- sal_uInt16 nResult = aAddr.Parse( aExpr, pDoc, pDoc->GetAddressConvention() );
+ // Check the validity of the expression, and toggle the relative flag.
+ ScAddress::Details aDetails(eConv, maPos.Row(), maPos.Col());
+ sal_uInt16 nResult = aAddr.Parse(aExpr, pDoc, aDetails);
if ( nResult & SCA_VALID )
{
sal_uInt16 nFlags = lcl_NextFlags( nResult );
- aAddr.Format( aExpr, nFlags, pDoc, pDoc->GetAddressConvention() );
+ aAddr.Format(aExpr, nFlags, pDoc, aDetails);
xub_StrLen nAbsStart = nStartPos+aResult.Len()+aSep.Len();
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 62f3622cd87a..949cb0fb0615 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -480,7 +480,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
else
aIn >> nXclFunc;
if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) )
- DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount, pFuncInfo->mnMinParamCount );
+ DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount );
else
DoMulArgs( ocNoName, 0 );
}
@@ -498,7 +498,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
else
aIn >> nXclFunc;
if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) )
- DoMulArgs( pFuncInfo->meOpCode, nParamCount, pFuncInfo->mnMinParamCount );
+ DoMulArgs( pFuncInfo->meOpCode, nParamCount );
else
DoMulArgs( ocNoName, 0 );
}
@@ -1525,7 +1525,7 @@ sal_Bool ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sa
return !rRangeList.empty();
}
-void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCount )
+void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz )
{
TokenId eParam[ 256 ];
sal_Int32 nLauf;
@@ -1589,19 +1589,6 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo
}
}
- // FIXME: ideally we'd want to import all missing args, but this
- // conflicts with lots of fn's understanding of nParams - we need
- // a function table, and pre-call argument normalisation 1st.
- sal_Int16 nLastRemovable = nLast - nMinParamCount;
-
- // skip missing parameters at end of parameter list
- while( nSkipEnd < nLastRemovable &&
- aPool.IsSingleOp( eParam[ nSkipEnd + 1 ], ocMissing ) )
- nSkipEnd++;
-
-// fprintf (stderr, "Fn %d nSkipEnd %d nLast %d nMinParamCnt %d %d\n",
-// eId, nSkipEnd, nLast, nMinParamCount, nLastRemovable);
-
// [Parameter{;Parameter}]
if( nLast > nSkipEnd )
{
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index aebb75418f36..f989abc3c196 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -42,9 +42,51 @@
#include "externalrefmgr.hxx"
#include <vector>
+#include <cstring>
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
using ::std::vector;
+namespace {
+
+/**
+ * Extract a file path from OLE link path. An OLE link path is expected to
+ * be in the following format:
+ *
+ * Excel.Sheet.8 \3 [file path]
+ */
+bool extractFilePath(const OUString& rUrl, OUString& rPath)
+{
+ const char* prefix = "Excel.Sheet.8\3";
+ size_t nPrefixLen = ::std::strlen(prefix);
+
+ sal_Int32 n = rUrl.getLength();
+ if (n <= static_cast<sal_Int32>(nPrefixLen))
+ // needs to have the specified prefix.
+ return false;
+
+ OUStringBuffer aBuf;
+ const sal_Unicode* p = rUrl.getStr();
+ for (size_t i = 0; i < static_cast<size_t>(n); ++i, ++p)
+ {
+ if (i < nPrefixLen)
+ {
+ sal_Unicode pc = static_cast<sal_Unicode>(*prefix++);
+ if (pc != *p)
+ return false;
+
+ continue;
+ }
+ aBuf.append(*p);
+ }
+
+ rPath = aBuf.makeStringAndClear();
+ return true;
+}
+
+}
+
ExcelToSc8::ExternalTabInfo::ExternalTabInfo() :
mnFileId(0), mbExternal(false)
{
@@ -92,6 +134,20 @@ bool ExcelToSc8::Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB&
return GetExternalFileIdFromXti(nIxti, rExtInfo.mnFileId);
}
+bool ExcelToSc8::HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo)
+{
+ const String* pUrl = rLinkMan.GetSupbookUrl(nXtiIndex);
+ if (!pUrl)
+ return false;
+
+ OUString aPath;
+ if (!extractFilePath(*pUrl, aPath))
+ // file path extraction failed.
+ return false;
+
+ OUString aFileUrl = ScGlobal::GetAbsDocName(aPath, GetDocShell());
+ return rExtName.CreateOleData(GetDoc(), aFileUrl, rExtInfo.mnFileId, rExtInfo.maTabName, rExtInfo.maRange);
+}
// if bAllowArrays is false stream seeks to first byte after <nFormulaLen>
// otherwise it will seek to the first byte past additional content after <nFormulaLen>
@@ -419,7 +475,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
aIn >> nParamCount >> nXclFunc;
nParamCount &= 0x7F;
if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) )
- DoMulArgs( pFuncInfo->meOpCode, nParamCount, pFuncInfo->mnMinParamCount );
+ DoMulArgs( pFuncInfo->meOpCode, nParamCount );
else
DoMulArgs( ocNoName, 0 );
}
@@ -682,8 +738,29 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
aStack << aPool.Store( ocEuroConvert, String() );
}
break;
-
- default: // OLE link
+ case xlExtOLE:
+ {
+ ExternalTabInfo aExtInfo;
+ if (HandleOleLink(nXtiIndex, *pExtName, aExtInfo))
+ {
+ if (aExtInfo.maRange.aStart == aExtInfo.maRange.aEnd)
+ {
+ // single cell
+ aSRD.InitAddress(aExtInfo.maRange.aStart);
+ aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aSRD);
+ }
+ else
+ {
+ // range
+ aCRD.InitRange(aExtInfo.maRange);
+ aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aCRD);
+ }
+ }
+ else
+ aStack << aPool.Store(ocNoName, pExtName->GetName());
+ }
+ break;
+ default:
{
aPool << ocBad;
aPool >> aStack;
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 70feaa4e4e22..96e68a9df01f 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -1125,8 +1125,8 @@ FltError ImportExcel8::Read( void )
case 0x9D: AutoFilterInfo(); break;// AUTOFILTERINFO
case 0x9E: AutoFilter(); break; // AUTOFILTER
case 0x0208: Row34(); break; // ROW [ 34 ]
- case 0x0021:
- case 0x0221: Array34(); break; // ARRAY [ 34 ]
+ case EXC_ID2_ARRAY:
+ case EXC_ID3_ARRAY: Array34(); break; // ARRAY [ 34 ]
case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
case 0x04BC: Shrfmla(); break; // SHRFMLA [ 5 ]
case 0x0867: SheetProtection(); break; // SHEETPROTECTION
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 634a723238a6..492fe5d2033c 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -44,6 +44,9 @@
#include <boost/ptr_container/ptr_vector.hpp>
using ::std::vector;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
// ============================================================================
// *** Helper classes ***
@@ -284,7 +287,61 @@ sal_uInt16 XclImpTabInfo::GetCurrentIndex( sal_uInt16 nCreatedId, sal_uInt16 nMa
// External names =============================================================
-XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, XclSupbookType eSubType, ExcelToSc* pFormulaConv )
+XclImpExtName::MOper::MOper(XclImpStream& rStrm) :
+ mxCached(new ScMatrix(0,0))
+{
+ SCSIZE nLastCol = rStrm.ReaduInt8();
+ SCSIZE nLastRow = rStrm.ReaduInt16();
+ mxCached->Resize(nLastCol+1, nLastRow+1);
+ for (SCSIZE nRow = 0; nRow <= nLastRow; ++nRow)
+ {
+ for (SCSIZE nCol = 0; nCol <= nLastCol; ++nCol)
+ {
+ sal_uInt8 nOp;
+ rStrm >> nOp;
+ switch (nOp)
+ {
+ case 0x01:
+ {
+ double fVal = rStrm.ReadDouble();
+ mxCached->PutDouble(fVal, nCol, nRow);
+ }
+ break;
+ case 0x02:
+ {
+ OUString aStr = rStrm.ReadUniString();
+ mxCached->PutString(aStr, nCol, nRow);
+ }
+ break;
+ case 0x04:
+ {
+ bool bVal = rStrm.ReaduInt8();
+ mxCached->PutBoolean(bVal, nCol, nRow);
+ rStrm.Ignore(7);
+ }
+ break;
+ case 0x10:
+ {
+ sal_uInt8 nErr = rStrm.ReaduInt8();
+ // TODO: Map the error code from xls to calc.
+ mxCached->PutError(nErr, nCol, nRow);
+ rStrm.Ignore(7);
+ }
+ break;
+ default:
+ rStrm.Ignore(8);
+ }
+ }
+ }
+}
+
+const ScMatrix& XclImpExtName::MOper::GetCache() const
+{
+ return *mxCached;
+}
+
+XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, XclSupbookType eSubType, ExcelToSc* pFormulaConv ) :
+ mpMOper(NULL)
{
sal_uInt16 nFlags;
sal_uInt8 nLen;
@@ -312,36 +369,45 @@ XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm
meType = ::get_flagvalue( nFlags, EXC_EXTN_OLE, xlExtOLE, xlExtDDE );
}
- if( (meType == xlExtDDE) && (rStrm.GetRecLeft() > 1) )
- mxDdeMatrix.reset( new XclImpCachedMatrix( rStrm ) );
-
- if (meType == xlExtName)
+ switch (meType)
{
- // TODO: For now, only global external names are supported. In future
- // we should extend this to supporting per-sheet external names.
- if (mnStorageId == 0)
- {
- if (pFormulaConv)
+ case xlExtDDE:
+ if (rStrm.GetRecLeft() > 1)
+ mxDdeMatrix.reset(new XclImpCachedMatrix(rStrm));
+ break;
+ case xlExtName:
+ // TODO: For now, only global external names are supported. In future
+ // we should extend this to supporting per-sheet external names.
+ if (mnStorageId == 0)
{
- const ScTokenArray* pArray = NULL;
- sal_uInt16 nFmlaLen;
- rStrm >> nFmlaLen;
- vector<String> aTabNames;
- sal_uInt16 nCount = rSupbook.GetTabCount();
- aTabNames.reserve(nCount);
- for (sal_uInt16 i = 0; i < nCount; ++i)
- aTabNames.push_back(rSupbook.GetTabName(i));
-
- pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames);
- if (pArray)
- mxArray.reset(pArray->Clone());
+ if (pFormulaConv)
+ {
+ const ScTokenArray* pArray = NULL;
+ sal_uInt16 nFmlaLen;
+ rStrm >> nFmlaLen;
+ vector<String> aTabNames;
+ sal_uInt16 nCount = rSupbook.GetTabCount();
+ aTabNames.reserve(nCount);
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ aTabNames.push_back(rSupbook.GetTabName(i));
+
+ pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames);
+ if (pArray)
+ mxArray.reset(pArray->Clone());
+ }
}
- }
+ break;
+ case xlExtOLE:
+ mpMOper = new MOper(rStrm);
+ break;
+ default:
+ ;
}
}
XclImpExtName::~XclImpExtName()
{
+ delete mpMOper;
}
void XclImpExtName::CreateDdeData( ScDocument& rDoc, const String& rApplic, const String& rTopic ) const
@@ -361,6 +427,124 @@ void XclImpExtName::CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) co
pRefMgr->storeRangeNameTokens(nFileId, maName, *mxArray);
}
+namespace {
+
+/**
+ * Decompose the name into sheet name and range name. An OLE link name is
+ * always formatted like this [ !Sheet1!R1C1:R5C2 ] and it always uses R1C1
+ * notation.
+ */
+bool extractSheetAndRange(const OUString& rName, OUString& rSheet, OUString& rRange)
+{
+ sal_Int32 n = rName.getLength();
+ const sal_Unicode* p = rName.getStr();
+ OUStringBuffer aBuf;
+ bool bInSheet = true;
+ for (sal_Int32 i = 0; i < n; ++i, ++p)
+ {
+ if (i == 0)
+ {
+ // first character must be '!'.
+ if (*p != '!')
+ return false;
+ continue;
+ }
+
+ if (*p == '!')
+ {
+ // sheet name to range separator.
+ if (!bInSheet)
+ return false;
+ rSheet = aBuf.makeStringAndClear();
+ bInSheet = false;
+ continue;
+ }
+
+ aBuf.append(*p);
+ }
+
+ rRange = aBuf.makeStringAndClear();
+ return true;
+}
+
+}
+
+bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl,
+ sal_uInt16& rFileId, OUString& rTabName, ScRange& rRange) const
+{
+ if (!mpMOper)
+ return false;
+
+ OUString aSheet, aRangeStr;
+ if (!extractSheetAndRange(maName, aSheet, aRangeStr))
+ return false;
+
+ ScRange aRange;
+ sal_uInt16 nRes = aRange.ParseAny(aRangeStr, &rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
+ if ((nRes & SCA_VALID) != SCA_VALID)
+ return false;
+
+ if (aRange.aStart.Tab() != aRange.aEnd.Tab())
+ // We don't support multi-sheet range for this.
+ return false;
+
+ const ScMatrix& rCache = mpMOper->GetCache();
+ SCSIZE nC, nR;
+ rCache.GetDimensions(nC, nR);
+ if (!nC || !nR)
+ // cache matrix is empty.
+ return false;
+
+ ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(rUrl);
+ ScExternalRefCache::TableTypeRef xTab = pRefMgr->getCacheTable(nFileId, aSheet, true, NULL);
+ if (!xTab)
+ // cache table creation failed.
+ return false;
+
+ xTab->setWholeTableCached();
+ for (SCSIZE i = 0; i < nR; ++i)
+ {
+ for (SCSIZE j = 0; j < nC; ++j)
+ {
+ SCCOL nCol = aRange.aStart.Col() + j;
+ SCROW nRow = aRange.aStart.Row() + i;
+
+ ScMatrixValue aVal = rCache.Get(j, i);
+ switch (aVal.nType)
+ {
+ case SC_MATVAL_BOOLEAN:
+ {
+ bool b = aVal.GetBoolean();
+ ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(b ? 1.0 : 0.0));
+ xTab->setCell(nCol, nRow, pToken, 0, false);
+ }
+ break;
+ case SC_MATVAL_VALUE:
+ {
+ ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(aVal.fVal));
+ xTab->setCell(nCol, nRow, pToken, 0, false);
+ }
+ break;
+ case SC_MATVAL_STRING:
+ {
+ const String& rStr = aVal.GetString();
+ ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(rStr));
+ xTab->setCell(nCol, nRow, pToken, 0, false);
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ }
+
+ rFileId = nFileId;
+ rTabName = aSheet;
+ rRange = aRange;
+ return true;
+}
+
bool XclImpExtName::HasFormulaTokens() const
{
return (mxArray.get() != NULL);
@@ -516,9 +700,9 @@ void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv
const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
{
DBG_ASSERT( nXclIndex > 0, "XclImpSupbook::GetExternName - index must be >0" );
- if (meType == EXC_SBTYPE_SELF || nXclIndex >= maExtNameList.size())
+ if (meType == EXC_SBTYPE_SELF || nXclIndex > maExtNameList.size())
return NULL;
- return &maExtNameList.at( nXclIndex - 1 );
+ return &maExtNameList[nXclIndex-1];
}
bool XclImpSupbook::GetLinkData( String& rApplic, String& rTopic ) const
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index d4eb332b2fb0..11381e54bb4e 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1321,8 +1321,8 @@ void XclImpXF::ApplyPatternToAttrList(
pPat = static_cast<const ScPatternAttr*>(&aCache.ApplyTo(*pPat, true));
}
-
- if (pPat)
+ // Make sure we skip unnamed styles.
+ if (pPat && pPat->GetStyleName())
{
// Check for a gap between the last entry and this one.
bool bHasGap = false;
diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx
index 0744bdf52c64..ebc3696e9a0f 100644
--- a/sc/source/filter/inc/excform.hxx
+++ b/sc/source/filter/inc/excform.hxx
@@ -52,7 +52,7 @@ protected:
const XclBiff meBiff;
// ---------------------------------------------------------------
- void DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs, sal_uInt8 mnMinParamCount = 0 );
+ void DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs );
void ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const sal_Bool bName );
@@ -104,6 +104,7 @@ inline sal_Bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uI
// ============================================================================
class XclImpLinkManager;
+class XclImpExtName;
class ExcelToSc8 : public ExcelToSc
{
@@ -111,9 +112,10 @@ public:
struct ExternalTabInfo
{
- String maTabName;
- sal_uInt16 mnFileId;
- bool mbExternal;
+ ScRange maRange;
+ ::rtl::OUString maTabName;
+ sal_uInt16 mnFileId;
+ bool mbExternal;
ExternalTabInfo();
};
@@ -128,6 +130,7 @@ private:
virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
+ bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
public:
ExcelToSc8( const XclImpRoot& rRoot );
virtual ~ExcelToSc8();
diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx
index 2f06ddb2f7b0..2b2e9ac8a03c 100644
--- a/sc/source/filter/inc/xilink.hxx
+++ b/sc/source/filter/inc/xilink.hxx
@@ -32,6 +32,7 @@
#include <map>
#include "xllink.hxx"
#include "xiroot.hxx"
+#include "scmatrix.hxx"
/* ============================================================================
Classes for import of different kinds of internal/external references.
@@ -113,6 +114,19 @@ class XclImpSupbook;
@descr Supported: External defined names, AddIn names, DDE links and OLE objects. */
class XclImpExtName
{
+ /**
+ * MOper, multiple operands, stores cached values of external range
+ * specified in the record.
+ */
+ class MOper
+ {
+ public:
+ MOper(XclImpStream& rStrm);
+ const ScMatrix& GetCache() const;
+ private:
+ ScMatrixRef mxCached;
+ };
+
public:
/** Reads the external name from the stream. */
explicit XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm,
@@ -125,6 +139,14 @@ public:
void CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) const;
+ /**
+ * Create OLE link data. OLE link data is converted to external
+ * reference, since OLE link doesn't work cross-platform, and is not very
+ * reliable even on Windows.
+ */
+ bool CreateOleData(ScDocument& rDoc, const ::rtl::OUString& rUrl,
+ sal_uInt16& rFileId, ::rtl::OUString& rTabName, ScRange& rRange) const;
+
bool HasFormulaTokens() const;
inline XclImpExtNameType GetType() const { return meType; }
@@ -136,6 +158,7 @@ private:
typedef ::std::auto_ptr< ScTokenArray > TokenArrayPtr;
XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link.
+ MOper* mpMOper; /// Cached values for OLE link
TokenArrayPtr mxArray; /// Formula tokens for external name.
String maName; /// The name of the external name.
sal_uInt32 mnStorageId; /// Storage ID for OLE object storages.
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 133cb368e117..6fabe3684d6c 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2084,13 +2084,16 @@ ScFormatFilterPlugin &ScFormatFilter::Get()
if (plugin != NULL)
return *plugin;
+ ::rtl::OUString sFilterLib(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("scfilt")));
static ::osl::Module aModule;
- if ( aModule.loadRelative( &thisModule,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "scfilt" ) ) ) ) )
+ bool bLoaded = aModule.loadRelative(&thisModule, sFilterLib);
+ if (!bLoaded)
+ bLoaded = aModule.load(sFilterLib);
+ if (bLoaded)
{
- oslGenericFunction fn = aModule.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScFilterCreate" )) );
- if (fn != NULL)
- plugin = reinterpret_cast<FilterFn>(fn)();
+ oslGenericFunction fn = aModule.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScFilterCreate" )) );
+ if (fn != NULL)
+ plugin = reinterpret_cast<FilterFn>(fn)();
}
if (plugin == NULL)
plugin = new ScFormatFilterMissing();
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 0ec3604da2a6..f51ce051d1a7 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -86,7 +86,7 @@ public:
virtual css::uno::Reference< css::frame::XModel > getDocModel() { return mxModel; }
// XUnoTunnel
- virtual ::sal_Int64 getSomething(const css::uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException);
};
#endif /* SC_VBA_WORKBOOK_HXX */
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 9348f928f13f..f3c5bb18efe2 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -229,6 +229,72 @@ const uno::Sequence<sal_Int8>& ScVbaWorksheet::getUnoTunnelId()
return aSeq;
}
+uno::Reference< ov::excel::XWorksheet >
+ScVbaWorksheet::createSheetCopyInNewDoc(rtl::OUString aCurrSheetName)
+{
+ uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
+ uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
+ uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY);
+ uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
+ if (xRange.is())
+ xRange->Select();
+ excel::implnCopy(mxModel);
+ uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
+ if (xModel.is())
+ {
+ excel::implnPaste(xModel);
+ }
+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
+ uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW);
+ //#TODO #FIXME
+ //get proper parent for Worksheet
+ return new ScVbaWorksheet( NULL, mxContext, xSheet, xModel );
+}
+
+css::uno::Reference< ov::excel::XWorksheet >
+ScVbaWorksheet::createSheetCopy(uno::Reference<excel::XWorksheet> xSheet, bool bAfter)
+{
+ rtl::OUString aCurrSheetName = getName();
+ ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
+
+ uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
+ uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
+
+ SCTAB nDest = 0;
+ SCTAB nSrc = 0;
+ rtl::OUString aSheetName = xSheet->getName();
+ bool bSameDoc = ( pDestSheet->getModel() == getModel() );
+ bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest );
+ bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc );
+
+ // set sheet name to be newSheet name
+ aSheetName = aCurrSheetName;
+ if ( bSheetExists && bDestSheetExists )
+ {
+ SCTAB nDummy=0;
+ if(bAfter)
+ nDest++;
+ uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
+ if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) )
+ getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
+ if ( bSameDoc )
+ xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
+ else
+ {
+ ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
+ ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
+ if ( pDestDocShell && pSrcDocShell )
+ pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), true, true );
+ }
+ }
+ // return new sheet
+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
+ uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
+ return xNewSheet;
+}
+
::rtl::OUString
ScVbaWorksheet::getName() throw (uno::RuntimeException)
{
@@ -571,60 +637,13 @@ void
ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException)
{
uno::Reference<excel::XWorksheet> xSheet;
- rtl::OUString aCurrSheetName =getName();
if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
{
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
- uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
- uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY);
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
- excel::implnCopy(mxModel);
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
- excel::implnPaste(xModel);
- }
+ createSheetCopyInNewDoc(getName());
return;
}
- ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
-
- uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
- uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
-
- SCTAB nDest = 0;
- SCTAB nSrc = 0;
- rtl::OUString aSheetName = xSheet->getName();
- bool bSameDoc = ( pDestSheet->getModel() == getModel() );
- bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest );
- bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc );
-
- // set sheet name to be newSheet name
- aSheetName = aCurrSheetName;
- if ( bSheetExists && bDestSheetExists )
- {
- SCTAB nDummy=0;
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
- uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
- if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) )
- getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
- if ( bSameDoc )
- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
- else
- {
- ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
- ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
- if ( pDestDocShell && pSrcDocShell )
- pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), true, true );
- }
- }
- // active the new sheet
- uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
- uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
+ uno::Reference<excel::XWorksheet> xNewSheet = createSheetCopy(xSheet, After.hasValue());
xNewSheet->Activate();
}
diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx
index 1affb7f4cbdc..2736083a8561 100644
--- a/sc/source/ui/vba/vbaworksheet.hxx
+++ b/sc/source/ui/vba/vbaworksheet.hxx
@@ -91,6 +91,8 @@ public:
virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet()
{ return mxSheet; }
static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ css::uno::Reference< ov::excel::XWorksheet > createSheetCopyInNewDoc( rtl::OUString);
+ css::uno::Reference< ov::excel::XWorksheet > createSheetCopy(css::uno::Reference< ov::excel::XWorksheet> xSheet, bool bAfter);
// Attributes
virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
@@ -173,7 +175,7 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XUnoTunnel
- virtual ::sal_Int64 getSomething(const css::uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException);
};
#endif /* SC_VBA_WORKSHEET_HXX */
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 6a2902a40810..80b6537d865c 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -55,6 +55,8 @@
#include "vbaworkbook.hxx"
#include "unonames.hxx"
+#include <vector>
+
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -420,6 +422,43 @@ ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException)
}
+void SAL_CALL
+ScVbaWorksheets::Copy ( const uno::Any& Before, const uno::Any& After) throw (css::uno::RuntimeException)
+{
+ uno::Reference<excel::XWorksheet> xSheet;
+ sal_Int32 nElems = getCount();
+ bool bAfter = After.hasValue();
+ std::vector< uno::Reference< excel::XWorksheet > > Sheets;
+ sal_Int32 nItem = 0;
+
+ for ( nItem = 1; nItem <= nElems; ++nItem)
+ {
+ uno::Reference<excel::XWorksheet> xWorksheet(Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
+ Sheets.push_back(xWorksheet);
+ }
+ bool bNewDoc = (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()));
+
+ uno::Reference< excel::XWorksheet > xSrcSheet;
+ if ( bNewDoc )
+ {
+ bAfter = true;
+ xSrcSheet = Sheets.at(0);
+ ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSrcSheet );
+ xSheet = pSrcSheet->createSheetCopyInNewDoc(xSrcSheet->getName());
+ nItem = 1;
+ }
+
+ for (nItem = 0; nItem < nElems; ++nItem )
+ {
+ xSrcSheet = Sheets[nItem];
+ ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSrcSheet );
+ if ( bAfter )
+ xSheet = pSrcSheet->createSheetCopy(xSheet, bAfter);
+ else
+ pSrcSheet->createSheetCopy(xSheet, bAfter);
+ }
+}
+
//ScVbaCollectionBaseImpl
uno::Any SAL_CALL
ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException)
diff --git a/sc/source/ui/vba/vbaworksheets.hxx b/sc/source/ui/vba/vbaworksheets.hxx
index 9854c0447c1d..c15d713e1230 100644
--- a/sc/source/ui/vba/vbaworksheets.hxx
+++ b/sc/source/ui/vba/vbaworksheets.hxx
@@ -72,6 +72,7 @@ public:
virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::uno::RuntimeException);
virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Copy ( const css::uno::Any& Before, const css::uno::Any& After) throw (css::uno::RuntimeException);
// ScVbaWorksheets_BASE
virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw
(css::uno::RuntimeException);
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 515b2fc514a9..5464a0f13f52 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -484,13 +484,14 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_TOGGLE_REL:
{
- sal_Bool bOk = false;
+ bool bOk = false;
if (pEngine->GetParagraphCount() == 1)
{
String aText = pEngine->GetText();
ESelection aSel = pEditView->GetSelection(); // aktuelle View
- ScRefFinder aFinder( aText, pViewData->GetDocument() );
+ ScDocument* pDoc = pViewData->GetDocument();
+ ScRefFinder aFinder(aText, pViewData->GetCurPos(), pDoc, pDoc->GetAddressConvention());
aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
if (aFinder.GetFound())
{
@@ -503,7 +504,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
pTopView->GetEditEngine()->SetText( aNew );
pTopView->SetSelection( aNewSel );
}
- bOk = sal_True;
+ bOk = true;
// Referenz wird selektiert -> beim Tippen nicht ueberschreiben
bSetSelIsRef = sal_True;
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index a9d9364a7208..0ccabacf3e67 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -259,7 +259,7 @@ void ScViewFunc::DoRefConversion( sal_Bool bRecord )
String aOld;
((ScFormulaCell*)pCell)->GetFormula(aOld);
xub_StrLen nLen = aOld.Len();
- ScRefFinder aFinder( aOld, pDoc );
+ ScRefFinder aFinder( aOld, aIter.GetPos(), pDoc, pDoc->GetAddressConvention() );
aFinder.ToggleRel( 0, nLen );
if (aFinder.GetFound())
{
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index a4e6eae35faa..44476979b782 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -94,6 +94,7 @@ public:
DECL_LINK(SelectionChangeListener, void*);
DECL_LINK(BroadcastSelectionChange, void*);
DECL_LINK(FocusChangeListener, void*);
+ DECL_LINK(VisibilityChangeListener, void*);
DECL_LINK(UpdateChildrenCallback, void*);
private:
@@ -970,7 +971,7 @@ void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
mrSlideSorter.GetView().AddVisibilityChangeListener(
- LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback));
+ LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
}
@@ -983,7 +984,7 @@ void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
mrSlideSorter.GetView().RemoveVisibilityChangeListener(
- LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback));
+ LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
if (mpWindow != NULL)
mpWindow->RemoveEventListener(
@@ -1132,6 +1133,15 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, voi
+IMPL_LINK(AccessibleSlideSorterView::Implementation, VisibilityChangeListener, void*, EMPTYARG )
+{
+ UpdateChildren();
+ return 1;
+}
+
+
+
+
} // end of namespace ::accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 11c002c97d1f..7719008b3fe2 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -279,12 +279,13 @@ Reference<drawing::XDrawSubController> SlideSorterViewShell::CreateSubController
::com::sun::star::accessibility::XAccessible>
SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
{
- OSL_ASSERT(mpSlideSorter.get()!=NULL);
// When the view is not set then the initialization is not yet complete
// and we can not yet provide an accessibility object.
if (mpView == NULL || mpSlideSorter.get() == NULL)
return NULL;
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+
::accessibility::AccessibleSlideSorterView *pAccessibleView =
new ::accessibility::AccessibleSlideSorterView(
*mpSlideSorter.get(),
diff --git a/set_soenv.in b/set_soenv.in
index 2303ef62b55b..01865ded5f8a 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -78,7 +78,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
$SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV, $SOLARDEFIMG,
$STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI,
$DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH,
- $MSPDB_PATH, $MIDL_PATH, $CSC_PATH,
+ $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $SHOWINCLUDES_PREFIX,
$PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB, $JAVALIB,
$SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL,
$COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME,
@@ -125,12 +125,8 @@ $JDK = '@JDK@';
$JAVAFLAGS = '@JAVAFLAGS@';
$MINGW = '@WITH_MINGW@'; # use MinGW for Windows build
$USE_MINGW = '@USE_MINGW@'; # use MinGW in cygwin or pure-mingw
-if ( $MINGW eq "yes" )
-{ $CC = '@CC@'; # C compiler
- $CXX = '@CXX@'; } # C++ compiler
-else
-{ $CC = PathFormat('@CC@'); # C compiler
- $CXX = PathFormat('@CXX@'); } # C++ compiler
+$CC = '@CC@'; # C compiler
+$CXX = '@CXX@'; # C++ compiler
$MOZILLA_VERSION = '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla
$MOZILLA_TOOLKIT = '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla
$FLIPCMD = ""; # Flip '/' to '\' wrapper (only for winnt)
@@ -659,6 +655,7 @@ elsif ( $platform =~ m/cygwin/ )
$MSPDB_PATH = PathFormat('@MSPDB_PATH@');
$MIDL_PATH = PathFormat('@MIDL_PATH@');
$CSC_PATH = PathFormat('@CSC_PATH@');
+ $SHOWINCLUDES_PREFIX = '@SHOWINCLUDES_PREFIX@';
$PSDK_HOME = PathFormat('@PSDK_HOME@');
$DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
$USE_DIRECTX5 = "";
@@ -2341,7 +2338,7 @@ sub PathFormat
# Replace absolute paths or DOS paths with ...
if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) {
# mixed mode paths
- chomp( $variable = qx{realpath "$variable"} );
+ chomp( $variable = qx{realpath "$variable"} ) unless ($variable =~ m/:/);
chomp( $variable = qx{cygpath -m "$variable"} );
}
}
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 21bd787d6c61..106633b0a9d5 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2230,8 +2230,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
if ( pLine->m_bIsRemoved )
continue;
- Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField,
- &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
+ &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
Window** pCurrent = pWindows;
while ( *pCurrent )
{
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index f6d3fb221b0a..87fb028cd1f3 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -311,8 +311,7 @@ public:
sal_Bool ShowDocumentInfoDialog();
- ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir,
- const sfx2::FileDialogHelper::Context& aCtxt );
+ ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir );
::rtl::OUString GetReccomendedName( const ::rtl::OUString& aSuggestedName,
const ::rtl::OUString& aTypeName );
@@ -884,10 +883,10 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
}
if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) )
- eCtxt = sfx2::FileDialogHelper::SD_EXPORT;
- if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) )
- eCtxt = sfx2::FileDialogHelper::SI_EXPORT;
- if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) )
+ eCtxt = sfx2::FileDialogHelper::SD_EXPORT;
+ else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) )
+ eCtxt = sfx2::FileDialogHelper::SI_EXPORT;
+ else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) )
eCtxt = sfx2::FileDialogHelper::SW_EXPORT;
if ( eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT )
@@ -959,7 +958,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
}
}
- ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir, eCtxt );
+ ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir );
if ( aReccomendedDir.getLength() )
pFileDlg->SetDisplayDirectory( aReccomendedDir );
::rtl::OUString aReccomendedName = GetReccomendedName( aSuggestedName, aAdjustToType );
@@ -1144,7 +1143,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
}
//-------------------------------------------------------------------------
-::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& aCtxt )
+::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir )
{
::rtl::OUString aReccomendedDir;
@@ -1175,9 +1174,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
}
else
{
- // pb: set graphic path if context == SD_EXPORT or SI_EXPORT else work path
- ::rtl::OUString aConfigSuggestion( ( aCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) ? SvtPathOptions().GetGraphicPath() : SvtPathOptions().GetWorkPath() );
- aReccomendedDir = INetURLObject( aConfigSuggestion ).GetMainURL( INetURLObject::NO_DECODE );
+ aReccomendedDir = INetURLObject( SvtPathOptions().GetWorkPath() ).GetMainURL( INetURLObject::NO_DECODE );
}
return aReccomendedDir;
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index c50813f4ee27..ad4ac9d47de8 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -547,7 +547,7 @@ sub clean_jds_temp_dirs
###########################################################
# Setting one language in the language independent
-# array of include pathes with $(LANG)
+# array of include paths with $(LANG)
###########################################################
sub get_language_specific_include_pathes
@@ -2314,7 +2314,7 @@ sub add_variables_from_inc_to_hashref
}
##############################################
-# Collecting all files from include pathes
+# Collecting all files from include paths
##############################################
sub collect_all_files_from_includepathes
@@ -2322,7 +2322,7 @@ sub collect_all_files_from_includepathes
my ($patharrayref) = @_;
installer::logger::globallog("Reading all directories: Start");
- installer::logger::print_message( "... reading include pathes ...\n" );
+ installer::logger::print_message( "... reading include paths ...\n" );
# empty the global
@installer::globals::allincludepathes =();
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 59f6f332b3cf..d7ec6f04ad1f 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -36,7 +36,7 @@ export DBGSV_ERROR_OUT
# gb_CppunitTest_TARGETTYPE
# gb_CppunitTest_get_filename
gb_CppunitTest_CPPTESTTARGET := $(call gb_Executable_get_target,cppunit/cppunittester)
-gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_CPPTESTTARGET)
+gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_GDBTRACE) STAR_RESOURCEPATH=$(dir $(call gb_ResTarget_get_outdir_target,example)) $(gb_CppunitTest_CPPTESTTARGET)
gb_CppunitTest__get_linktargetname = CppunitTest/$(call gb_CppunitTest_get_filename,$(1))
.PHONY : $(call gb_CppunitTest_get_clean_target,%)
@@ -49,7 +49,7 @@ $(call gb_CppunitTest_get_target,%) : $(gb_CppunitTest_CPPTESTTARGET)
$(call gb_Output_announce,$*,$(true),CUT,2)
$(call gb_Helper_abbreviate_dirs_native,\
mkdir -p $(dir $@) && \
- $(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) > $@.log 2>&1 || (cat $@.log && false))
+ $(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) $(ARGS) > $@.log 2>&1 || (cat $@.log && false))
define gb_CppunitTest_CppunitTest
$(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest__get_linktargetname,$(1)))
@@ -68,10 +68,16 @@ $(call gb_LinkTarget_set_defs,$(2), \
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
$(call gb_CppunitTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_CppunitTest_CppunitTest_platform,$(1),$(2),$(gb_CppunitTest_DLLDIR)/$(call gb_CppunitTest_get_libfilename,$(1)))
+$(call gb_CppunitTest_get_target,$(1)) : ARGS :=
$$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
endef
+define gb_CppunitTest_set_args
+$(call gb_CppunitTest_get_target,$(1)) : ARGS := $(2)
+
+endef
+
define gb_CppunitTest__forward_to_Linktarget
gb_CppunitTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CppunitTest__get_linktargetname,$$(1)),$$(2),$$(3))
@@ -82,22 +88,24 @@ $(eval $(foreach method,\
add_cobjects \
add_cxxobject \
add_cxxobjects \
- add_objcxxobject \
- add_objcxxobjects \
add_exception_objects \
+ add_executable_objects \
+ add_library_objects \
+ add_linked_libs \
+ add_linked_static_libs \
add_noexception_objects \
+ add_objcxxobject \
+ add_objcxxobjects \
+ add_package_headers \
+ add_precompiled_header \
+ add_sdi_headers \
set_cflags \
set_cxxflags \
- set_objcxxflags \
set_defs \
set_include \
set_ldflags \
set_library_path_flags \
- add_linked_libs \
- add_linked_static_libs \
- add_package_headers \
- add_sdi_headers \
- add_precompiled_header \
+ set_objcxxflags \
,\
$(call gb_CppunitTest__forward_to_Linktarget,$(method))\
))
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 90519f91b382..1ffb1ef09b9f 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -58,7 +58,7 @@ $(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)),$(call g
endef
define gb_Executable_forward_to_Linktarget
-gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),Executable/$$(1)$$(gb_Executable_EXT),$$(2),$$(3))
+gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Executable_get_linktargetname,$$(1)),$$(2),$$(3))
endef
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 3c8d2f5def81..e6f358a9ef30 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -39,7 +39,6 @@
# gb_Library_Library_platform
# gb_Library_TARGETS
-gb_Library__get_linktargetname = Library/$(call gb_Library_get_filename,$(1))
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT)
@@ -60,7 +59,7 @@ $$(eval $$(call gb_Output_info,Currently known libraries are: $(sort $(gb_Librar
$$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk))
endif
$(call gb_Library_get_target,$(1)) : AUXTARGETS :=
-$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1)))
+$(call gb_Library__Library_impl,$(1),$(call gb_Library_get_linktargetname,$(1)))
endef
@@ -97,7 +96,7 @@ gb_Library__get_layer_componentprefix = \
define gb_Library__forward_to_Linktarget
-gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3))
+gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library_get_linktargetname,$$(1)),$$(2),$$(3))
endef
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 3572b10a6e30..b71a05de0f17 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -262,6 +262,7 @@ $(call gb_LinkTarget_get_clean_target,%) :
$(call gb_LinkTarget_get_dep_target,$*) \
$(call gb_LinkTarget_get_headers_target,$*) \
$(call gb_LinkTarget_get_external_headers_target,$*) \
+ $(call gb_LinkTarget_get_objects_list,$*) \
$(DLLTARGET) \
$(AUXTARGETS)) && \
cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -f && \
@@ -284,8 +285,20 @@ $(call gb_Helper_abbreviate_dirs,\
endef
+define gb_LinkTarget__command_objectlist
+TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
+ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
+ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
+ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object)))) && \
+$(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \
+mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
+
+endef
+
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
$(call gb_LinkTarget__command,$@,$*)
+ $(call gb_LinkTarget__command_objectlist,$@,$*)
ifeq ($(gb_FULLDEPS),$(true))
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%)
@@ -387,6 +400,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
$(call gb_LinkTarget_get_headers_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
+$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
ifeq ($(gb_FULLDEPS),$(true))
ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),)
@@ -408,6 +422,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE :=
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME :=
+$(call gb_LinkTarget_get_dep_target,$(1)) : EXTRAOBJECTLISTS :=
endif
endef
@@ -575,6 +590,28 @@ define gb_LinkTarget_add_cobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3)))
endef
+define gb_LinkTarget_add_linktarget_objects
+$(call gb_LinkTarget_get_target,$(1)) : $(foreach linktarget,$(2),$(call gb_LinkTarget_get_target,$(linktarget)))
+$(info gb_LinkTarget_add_linktarget_objects,$(1),$(2))
+$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS += $(foreach linktarget,$(2),$(call gb_LinkTarget_get_objects_list,$(linktarget)))
+
+endef
+
+define gb_LinkTarget_add_library_objects
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
+$$(eval $$(call gb_Output_error,Cannot import objects library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
+endif
+$(info gb_LinkTarget_add_library_objects,$(1),$(2))
+$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach lib,$(2),$(call gb_Library_get_linktargetname,$(lib))))
+
+endef
+
+define gb_LinkTarget_add_executable_objects
+$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach exe,$(2),$(call gb_Executable_get_linktargetname,$(lib))))
+
+endef
+
define gb_LinkTarget_add_cxxobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
endef
diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk
index 717b4717c4d8..d217f584bc80 100644
--- a/solenv/gbuild/StaticLibrary.mk
+++ b/solenv/gbuild/StaticLibrary.mk
@@ -35,7 +35,6 @@
# gb_StaticLibrary_FILENAMES
# gb_StaticLibrary_TARGETS
-gb_StaticLibrary__get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1))
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT)
@@ -56,7 +55,7 @@ $$(eval $$(call gb_Output_info,Currently known static libraries are: $(sort $(gb
$$(eval $$(call gb_Output_error,Static library $(1) must be registered in Repository.mk))
endif
$(call gb_StaticLibrary_get_target,$(1)) : AUXTARGETS :=
-$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary__get_linktargetname,$(1)))
+$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary_get_linktargetname,$(1)))
endef
@@ -76,7 +75,7 @@ $(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(cal
endef
define gb_StaticLibrary_forward_to_Linktarget
-gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary__get_linktargetname,$$(1)),$$(2),$$(3))
+gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary_get_linktargetname,$$(1)),$$(2),$$(3))
endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 23df7b159611..486a5b6d1218 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -65,6 +65,7 @@ gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user
gb_LinkTarget_get_external_headers_target = $(WORKDIR)/ExternalHeaders/$(1)
gb_LinkTarget_get_headers_target = $(WORKDIR)/Headers/$(1)
gb_LinkTarget_get_target = $(WORKDIR)/LinkTarget/$(1)
+gb_LinkTarget_get_objects_list = $(WORKDIR)/LinkTarget/$(1).objectlist
gb_Module_get_check_target = $(WORKDIR)/Module/check/$(1)
gb_Module_get_subsequentcheck_target = $(WORKDIR)/Module/subsequentcheck/$(1)
gb_Module_get_target = $(WORKDIR)/Module/$(1)
@@ -151,6 +152,9 @@ define gb_StaticLibrary_get_filename
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_StaticLibrary_FILENAMES)))
endef
+gb_Executable_get_linktargetname = Executable/$(1)$(gb_Executable_EXT)
+gb_Library_get_linktargetname = Library/$(call gb_Library_get_filename,$(1))
+gb_StaticLibrary_get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1))
# static members declared here because they are used globally
diff --git a/solenv/gbuild/filter-showIncludes.pl b/solenv/gbuild/filter-showIncludes.pl
new file mode 100755
index 000000000000..f72a9eb07fd8
--- /dev/null
+++ b/solenv/gbuild/filter-showIncludes.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/env perl
+#
+# filter-showIncludes.pl depfile.d objfile.o orginal.cxx
+#
+# Create dependency information from the output of cl.exe's showInclude. It
+# needs additional information - the output name to which to write, objfile
+# that depends on the includes, and the original file name.
+#
+# It also consolidates the file names to a canonical form, and filters out
+# duplicates.
+#
+# LGPL v3 / GPL v3 / MPL 1.1
+#
+# Original author: Jan Holesovsky <kendy@suse.cz>
+
+my $outfile = $ARGV[0];
+my $objfile = $ARGV[1];
+my $srcfile = $ARGV[2];
+if ( !defined $outfile || !defined $objfile || !defined $srcfile ) {
+ die "Not enough parameters to create dependencies.";
+}
+
+my $showincludes_prefix = $ENV{'SHOWINCLUDES_PREFIX'};
+if ( !defined( $showincludes_prefix ) || $showincludes_prefix eq "" ) {
+ $showincludes_prefix = 'Note: including file:';
+}
+
+open( OUT, "> $outfile" ) or die "Cannot open $outfile for writing.";
+print OUT "$objfile: \\\n $srcfile";
+
+my %seen;
+my $first_line = 1;
+while ( <STDIN> ) {
+ if ( /^$showincludes_prefix/ ) {
+ s/^$showincludes_prefix\s*//;
+ s/\r$//;
+
+ chomp;
+ s/\\/\//g;
+
+ # X: -> /cygdrive/x/
+ s/^(.):/\/cygdrive\/\l\1/;
+
+ s/ /\\ /g;
+
+ if ( !defined $seen{$_} ) {
+ $seen{$_} = 1;
+ print OUT " \\\n $_";
+ }
+ }
+ else {
+ # skip the first line, it always just duplicates what is being
+ # compiled
+ print unless ( $first_line );
+ }
+ $first_line = 0;
+}
+
+print OUT "\n";
+close( OUT ) or die "Cannot close $outfile.";
+
+# vim: shiftwidth=4 softtabstop=4 expandtab:
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index cc577cbef1ff..2def0c9828f0 100755
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -270,6 +270,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
-o $(1) \
`cat $${DYLIB_FILE}` && \
@@ -288,6 +289,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
2> /dev/null)
endef
diff --git a/solenv/gbuild/platform/openbsd.mk b/solenv/gbuild/platform/openbsd.mk
index 7386eea20bcc..92654afa5923 100755
--- a/solenv/gbuild/platform/openbsd.mk
+++ b/solenv/gbuild/platform/openbsd.mk
@@ -50,6 +50,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
-Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \
$(subst -lpthread,$(PTHREAD_LIBS),$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \
-o $(1))
diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk
index 65b71a3b27cb..9095d609f8e4 100755
--- a/solenv/gbuild/platform/solaris.mk
+++ b/solenv/gbuild/platform/solaris.mk
@@ -206,6 +206,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
-o $(1))
endef
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index e52684f61ca4..d3b63edc0185 100755
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -222,13 +222,15 @@ gb_LinkTarget_CFLAGS += -finline-limit=0 -fno-inline -fno-default-inline
endif
ifeq ($(gb_SYMBOL),$(true))
-gb_LinkTarget_CXXFLAGS += -ggdb3
-gb_LinkTarget_CFLAGS += -ggdb3
+gb_LinkTarget_CXXFLAGS += -ggdb2
+gb_LinkTarget_CFLAGS += -ggdb2
endif
gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
+# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10
+# we want to use @$(extraobjectlist) in the long run
define gb_LinkTarget__command_dynamiclink
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(1)) && \
@@ -238,6 +240,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
-Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \
$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \
-o $(1))
@@ -250,6 +253,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
2> /dev/null)
endef
diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk
index 52dffb4e77c6..f9182c8f30ee 100755
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -213,6 +213,16 @@ endif
gb_COMPILERNOOPTFLAGS := -Od
+ifeq ($(gb_FULLDEPS),$(true))
+gb_COMPILERDEPFLAGS := -showIncludes
+define gb_create_deps
+| $(GBUILDDIR)/filter-showIncludes.pl $(2) $(1) $(3)
+endef
+else
+gb_COMPILERDEPFLAGS :=
+define gb_create_deps
+endef
+endif
# Helper class
gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
@@ -241,27 +251,6 @@ endef
# CObject class
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_CObject__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
- $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
- $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
- -I$(dir $(3)) \
- $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
- $(3) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(1) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- -v REPODIR=$(REPODIR)/ \
- > $(call gb_CObject_get_dep_target,$(2)))
-endef
-else
-CObject__command_deponcompile =
-endif
-
define gb_CObject__command
$(call gb_Output_announce,$(2),$(true),C ,3)
$(call gb_Helper_abbreviate_dirs_native,\
@@ -270,37 +259,16 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(gb_CC) \
$(DEFS) $(CFLAGS) -Fd$(PDBFILE) \
$(PCHFLAGS) \
+ $(gb_COMPILERDEPFLAGS) \
-I$(realpath $(dir $(3))) \
$(INCLUDE) \
-c $(realpath $(3)) \
- -Fo$(1))
-$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
+ -Fo$(1)) $(call gb_create_deps,$(1),$(call gb_CObject_get_dep_target,$(2)),$(realpath $(3)))
endef
# CxxObject class
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_CxxObject__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
- $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
- $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
- -I$(dir $(3)) \
- $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
- $(3) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(1) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- -v REPODIR=$(REPODIR)/ \
- > $(call gb_CxxObject_get_dep_target,$(2)))
- endef
-else
-gb_CxxObject__command_deponcompile =
-endif
-
define gb_CxxObject__command
$(call gb_Output_announce,$(2),$(true),CXX,3)
$(call gb_Helper_abbreviate_dirs_native,\
@@ -309,11 +277,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(gb_CXX) \
$(DEFS) $(CXXFLAGS) -Fd$(PDBFILE)\
$(PCHFLAGS) \
+ $(gb_COMPILERDEPFLAGS) \
-I$(realpath $(dir $(3))) \
$(INCLUDE_STL) $(INCLUDE) \
-c $(realpath $(3)) \
- -Fo$(1))
-$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
+ -Fo$(1)) $(call gb_create_deps,$(1),$(call gb_CxxObject_get_dep_target,$(2)),$(realpath $(3)))
endef
@@ -322,28 +290,6 @@ endef
gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
-Fp$(call gb_PrecompiledHeader_get_target,$(1))
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_PrecompiledHeader__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
- $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
- $(4) $(5) \
- -I$(dir $(3)) \
- $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
- $(3) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(1) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- -v REPODIR=$(REPODIR)/ \
- > $(call gb_PrecompiledHeader_get_dep_target,$(2)))
-endef
-else
-gb_PrecompiledHeader__command_deponcompile =
-endif
-
-
define gb_PrecompiledHeader__command
$(call gb_Output_announce,$(2),$(true),PCH,1)
$(call gb_Helper_abbreviate_dirs_native,\
@@ -351,11 +297,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
unset INCLUDE && \
$(gb_CXX) \
$(4) $(5) -Fd$(PDBFILE) \
+ $(gb_COMPILERDEPFLAGS) \
-I$(realpath $(dir $(3))) \
$(6) \
-c $(realpath $(3)) \
- -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
-$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
+ -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(1),$(call gb_PrecompiledHeader_get_dep_target,$(2)),$(realpath $(3)))
endef
# NoexPrecompiledHeader class
@@ -363,28 +309,6 @@ endef
gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \
-Fp$(call gb_NoexPrecompiledHeader_get_target,$(1))
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_NoexPrecompiledHeader__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
- $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
- $(4) $(5) \
- -I$(dir $(3)) \
- $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
- $(3) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(1) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- -v REPODIR=$(REPODIR)/ \
- > $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
-endef
-else
-gb_NoexPrecompiledHeader__command_deponcompile =
-endif
-
-
define gb_NoexPrecompiledHeader__command
$(call gb_Output_announce,$(2),$(true),PCH,1)
$(call gb_Helper_abbreviate_dirs_native,\
@@ -392,11 +316,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
unset INCLUDE && \
$(gb_CXX) \
$(4) $(5) -Fd$(PDBFILE) \
+ $(gb_COMPILERDEPFLAGS) \
-I$(realpath $(dir $(3))) \
$(6) \
-c $(realpath $(3)) \
- -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
-$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
+ -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(1),$(call gb_NoexPrecompiledHeader,$(2)),$(realpath $(3)))
endef
@@ -422,6 +346,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(call gb_Helper_convert_native,$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \
$(PCHOBJS))) && \
$(gb_LINK) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
diff --git a/solenv/gbuild/platform/winmingw.mk b/solenv/gbuild/platform/winmingw.mk
index 2ad299ded609..4b223b45af97 100644
--- a/solenv/gbuild/platform/winmingw.mk
+++ b/solenv/gbuild/platform/winmingw.mk
@@ -376,8 +376,8 @@ gb_LinkTarget_CFLAGS += -finline-limit=0 -fno-inline -fno-default-inline
endif
ifeq ($(gb_SYMBOL),$(true))
-gb_LinkTarget_CXXFLAGS += -ggdb3
-gb_LinkTarget_CFLAGS += -ggdb3
+gb_LinkTarget_CXXFLAGS += -ggdb2
+gb_LinkTarget_CFLAGS += -ggdb2
endif
gb_LinkTarget_INCLUDE :=\
@@ -400,6 +400,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(gb_MINGWLIBDIR)/crt2.o \
$(MINGW_CLIB_DIR)/crtbegin.o \
@$${RESPONSEFILE} \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
$(MINGW_CLIB_DIR)/crtend.o \
@@ -423,6 +424,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(gb_MINGWLIBDIR)/dllcrt2.o \
$(MINGW_CLIB_DIR)/crtbegin.o \
@$${RESPONSEFILE} \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
$(MINGW_CLIB_DIR)/crtend.o \
diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk
index e33ce16abc3f..6d45a96930c9 100644
--- a/solenv/inc/minor.mk
+++ b/solenv/inc/minor.mk
@@ -1,5 +1,5 @@
RSCVERSION=300
-RSCREVISION=300m103(Build:1)
-BUILD=1
+RSCREVISION=300m103(Build:2)
+BUILD=2
LAST_MINOR=m103
SOURCEVERSION=DEV300
diff --git a/solenv/inc/productversion.mk b/solenv/inc/productversion.mk
index bba3d4c14d27..002c63ad71d6 100644
--- a/solenv/inc/productversion.mk
+++ b/solenv/inc/productversion.mk
@@ -28,5 +28,5 @@
PRODUCTLIST = libreoffice broffice
# default values to minimize maintainance effort
-PRODUCTVERSION = 3.3
+PRODUCTVERSION = 3.4
PRODUCTVERSIONSHORT = 3
diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index 1c302f962431..03f3ae784da9 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -287,8 +287,8 @@ UniString CntBoolItem::GetValueTextByVal(sal_Bool bTheValue) const
{
return
bTheValue ?
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_True")) :
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_False"));
+ UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) :
+ UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx
index 13f19a48800e..599709d70938 100644
--- a/svl/source/items/visitem.cxx
+++ b/svl/source/items/visitem.cxx
@@ -141,8 +141,8 @@ UniString SfxVisibilityItem::GetValueTextByVal(sal_Bool bTheValue) const
{
return
bTheValue ?
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_True")) :
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_False"));
+ UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) :
+ UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index b7077b00e134..d87157b211d2 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -143,7 +143,7 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
if ( !sKeyword[NF_KEY_TRUE].Len() )
{
DBG_ERRORFILE( "InitSpecialKeyword: TRUE_WORD?" );
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "sal_True" ) );
+ ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) );
}
break;
case NF_KEY_FALSE :
@@ -153,7 +153,7 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
if ( !sKeyword[NF_KEY_FALSE].Len() )
{
DBG_ERRORFILE( "InitSpecialKeyword: FALSE_WORD?" );
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "sal_False" ) );
+ ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) );
}
break;
default:
diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx
index 701619d31f6c..12415a943b91 100644
--- a/svtools/source/filter.vcl/filter/exportdialog.cxx
+++ b/svtools/source/filter.vcl/filter/exportdialog.cxx
@@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream )
Bitmap aRet;
Graphic aGraphic;
GraphicFilter aFilter( sal_False );
- if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK )
+ if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast<com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*>(NULL) ) == GRFILTER_OK )
{
aRet = aGraphic.GetBitmap();
}
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index ff960db1bcb7..0aa6db4e7fb1 100755
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -237,7 +237,6 @@
#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 )
#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 )
#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 )
-#define SID_BASICIDE_GOTOCALL ( SID_BASICIDE_START + 8 )
#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 )
#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 )
#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 )
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 62cc8b4763b5..16e5a7680da7 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -2288,9 +2288,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
}
String sTrue( String::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM( "sal_True" ))),
+ RTL_CONSTASCII_STRINGPARAM( "TRUE" ))),
sFalse( String::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM( "sal_False" )));
+ RTL_CONSTASCII_STRINGPARAM( "FALSE" )));
sal_Bool bIsDBMgr = 0 != rDoc.GetNewDBMgr();
sal_uInt16 nWhich, n;
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 1fbe5340b7bc..ca115007c9eb 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1520,7 +1520,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
aSet.Put( aUL );
bSetLeft = sal_False;
if( pNewPgDsc )
+ {
pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
+ // this relies on GetPageDescFromPool() not going into infinite recursion
+ // (by this point RES_POOLPAGE_LEFT will not reach this place again)
+ pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT ));
+ }
}
break;
case RES_POOLPAGE_RIGHT: // Rechte Seite
@@ -1530,7 +1535,10 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
aSet.Put( aUL );
bSetLeft = sal_False;
if( pNewPgDsc )
+ {
pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
+ pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT ));
+ }
}
break;
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 6c82e8141d88..e559b937a93d 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -78,7 +78,7 @@ using namespace com::sun::star;
namespace {
-static char const sHTML_O_Hidden_False[] = "sal_False";
+static char const sHTML_O_Hidden_False[] = "FALSE";
}
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 0bd0908ed9e5..9f0489716fc0 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -215,6 +215,9 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST )
WriteHeaderFooter( rFirstPageFmt, false, "first" );
+ if ( nHeadFootFlags & ( nsHdFtFlags::WW8_FOOTER_EVEN | nsHdFtFlags::WW8_HEADER_EVEN ))
+ settings.evenAndOddHeaders = true;
+
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "DocxExport::WriteHeadersFooters() - nBreakCode introduced, but ignored\n" );
#endif
@@ -339,6 +342,8 @@ void DocxExport::ExportDocument_Impl()
WriteFonts();
+ WriteSettings();
+
delete pStyles, pStyles = NULL;
delete m_pSections, m_pSections = NULL;
}
@@ -642,6 +647,28 @@ void DocxExport::WriteProperties( )
m_pFilter->exportDocumentProperties( xDocProps );
}
+void DocxExport::WriteSettings()
+{
+ if( !settings.hasData())
+ return;
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" ),
+ S( "settings.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer(
+ S( "word/settings.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ) );
+
+ pFS->startElementNS( XML_w, XML_settings,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+
+ if( settings.evenAndOddHeaders )
+ pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
+
+ pFS->endElementNS( XML_w, XML_settings );
+}
+
VMLExport& DocxExport::VMLExporter()
{
return *m_pVMLExport;
@@ -726,4 +753,16 @@ DocxExport::~DocxExport()
delete m_pDrawingML, m_pDrawingML = NULL;
}
+DocxSettingsData::DocxSettingsData()
+: evenAndOddHeaders( false )
+{
+}
+
+bool DocxSettingsData::hasData() const
+{
+ if( evenAndOddHeaders )
+ return true;
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 4838d55868c4..ee84dcd33b42 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -58,6 +58,14 @@ namespace com { namespace sun { namespace star {
namespace frame { class XModel; }
} } }
+/// Data to be written in the document settings part of the document
+struct DocxSettingsData
+{
+ DocxSettingsData();
+ bool hasData() const; /// returns true if there are any non-default settings (i.e. something to write)
+ bool evenAndOddHeaders;
+};
+
/// The class that does all the actual DOCX export-related work.
class DocxExport : public MSWordExportBase
{
@@ -85,6 +93,8 @@ class DocxExport : public MSWordExportBase
/// Exporter of the VML shapes.
oox::vml::VMLExport *m_pVMLExport;
+ DocxSettingsData settings;
+
public:
DocxExportFilter& GetFilter() { return *m_pFilter; };
@@ -192,6 +202,9 @@ private:
/// Write docProps/core.xml
void WriteProperties();
+ /// Write word/settings.xml
+ void WriteSettings();
+
/// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...)
sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer );
@@ -210,6 +223,9 @@ public:
/// Reference to the VMLExport instance for the main document.
oox::vml::VMLExport& VMLExporter();
+ /// Data to be exported in the settings part of the document
+ DocxSettingsData& settingsData();
+
private:
/// No copying.
DocxExport( const DocxExport& );
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 83cece4881dc..17716b65cc05 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1594,6 +1594,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
}
}
+ bool titlePage = false;
if ( bOutPgDscSet )
{
// es ist ein Follow gesetzt und dieser zeigt nicht auf sich
@@ -1620,10 +1621,19 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
pPdFmt = &rFollowFmt;
// has different headers/footers for the title page
- AttrOutput().SectionTitlePage();
+ titlePage = true;
}
}
+ // The code above tries to detect if this is first page headers/footers,
+ // but it doesn't work even for quite trivial testcases. As I don't actually
+ // understand that code, I'll keep it. The simple and (at least for me) reliable way
+ // to detect for first page seems to be just RES_POOLPAGE_FIRST.
+ if( pPd->GetPoolFmtId() == RES_POOLPAGE_FIRST )
+ titlePage = true;
+ if( titlePage )
+ AttrOutput().SectionTitlePage();
+
const SfxItemSet* pOldI = pISet;
AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt );
@@ -1698,22 +1708,26 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
if ( nBreakCode != 0 )
{
- MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
- MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
-
- if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
- MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
-
- if ( !pPd->IsFooterShared() || bLeftRightPgChain )
- MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
-
- if ( pPdFmt != pPdFirstPgFmt )
+ if ( titlePage )
{
// es gibt eine ErsteSeite:
MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
}
+ // write other headers/footers only if it's not the first page - I'm not quite sure
+ // this is technically correct, but it avoids first-page headers/footers
+ // extending to all pages (bnc#654230)
+ if( pPdFmt != pPdFirstPgFmt )
+ {
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
+ if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
+
+ if ( !pPd->IsFooterShared() || bLeftRightPgChain )
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
+ }
AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags );
}
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 42ca75e60e95..6d014a08a61a 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2158,7 +2158,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich,
nType=1;
}
fUnknown = nHeaderByte & 0x3;
- fDropdownIndex = (nHeaderByte & 0xFC) >> 2;
+ fDropdownIndex = (nHeaderByte & 0x7C) >> 2;
*pDataStream >> nField;
fToolTip = nField & 0x01;
fNoMark = (nField & 0x02)>>1;
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 9d1ac103ae29..d6f57df395ef 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -385,7 +385,7 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
aValueED.SetText(aEmptyStr);
if (bCond)
aConditionED.SetText( String::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM( "sal_True" )));
+ RTL_CONSTASCII_STRINGPARAM( "TRUE" )));
else
aConditionED.SetText(aEmptyStr);
}
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 4eadc86ff15d..c64601ba48a3 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -154,6 +154,7 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
return mpCharMap;
mpCharMap = new ImplFontCharMap( aCmapResult );
+ mpCharMap->AddReference();
return mpCharMap;
}
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 849750ea20a9..79b8f417891b 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -439,8 +439,6 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos )
rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas );
- rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas );
-
if( nPos > nObjCount )
nPos = nObjCount;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index bd038cc55966..8eb88aaee105 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -568,6 +568,7 @@ GtkXLib::~GtkXLib()
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "GtkXLib::~GtkXLib()\n" );
#endif
+ Yield( true, true );
StopTimer();
// sanity check: at this point nobody should be yielding, but wake them
// up anyway before the condition they're waiting on gets destroyed.
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 16cb27744394..04f71bfbed3d 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -418,8 +418,6 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
QRect rect( 0, 0, width, widgetRect.height());
clipRegion = new QRegion( widgetRect.x(), widgetRect.y(), width, widgetRect.height());
- XRectangle xRect = { widgetRect.x(), widgetRect.y(), width, widgetRect.height() };
- XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion );
QStyleOption option;
option.state = QStyle::State_Horizontal;
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 03bcfca8e47e..ce4ea14dadb5 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -219,16 +219,6 @@ static bool qt_event_filter( void* m )
return false;
}
-static bool ( *old_qt_event_filter )( void* );
-static bool qt_event_filter( void* m )
-{
- if( old_qt_event_filter != NULL && old_qt_event_filter( m ))
- return true;
- if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m )))
- return true;
- return false;
-}
-
void KDEXLib::setupEventLoop()
{
old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter );
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index c938e25c0aec..f4b690a4fed7 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -49,6 +49,12 @@ using namespace psp;
#ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97
#define FC_FAMILYLANG "familylang"
#endif
+ #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_CAPABILITY "capability"
+ #endif
+ #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_STYLELANG "stylelang"
+ #endif
#ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91
#define FC_HINT_STYLE "hintstyle"
#define FC_HINT_NONE 0
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index ca45f0159367..af7677a2cdc6 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -210,7 +210,7 @@ const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
const sal_Char sAPI_is_visible[] = "IsVisible";
const sal_Char sAPI_TextRange[] = "TextRange";
-const sal_Char sAPI_true[] = "sal_True";
+const sal_Char sAPI_true[] = "TRUE";
TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext);