diff options
author | Mihaela Kedikova <misheto@openoffice.org> | 2010-03-23 15:28:55 +0100 |
---|---|---|
committer | Mihaela Kedikova <misheto@openoffice.org> | 2010-03-23 15:28:55 +0100 |
commit | d979d618f87a06795d8138eaaacc85f4852db0fd (patch) | |
tree | e45f7937f92ef0cdb9a5f8dc9702288e12441828 /svtools/source | |
parent | 0f1df8f471390de177610ee2bb9cc2f424d740c2 (diff) | |
parent | f099cd4586bf41f30dea8190dbd2bd7b4234cf60 (diff) |
gridcontrol_03: merge with DEV300_m75
Diffstat (limited to 'svtools/source')
331 files changed, 11305 insertions, 2424 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 4ebed0d70f3f..9a4903b1e093 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: brwbox1.cxx,v $ - * $Revision: 1.47 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index daf8d080dac2..da07415dfee8 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: brwbox2.cxx,v $ - * $Revision: 1.39 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index cc1816551237..449d5642e034 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: brwbox3.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx index 46eca0758e06..39845b84f7e0 100644 --- a/svtools/source/brwbox/brwhead.cxx +++ b/svtools/source/brwbox/brwhead.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: brwhead.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx index 7eed15d165b4..3c9ddb2876f7 100644 --- a/svtools/source/brwbox/brwimpl.hxx +++ b/svtools/source/brwbox/brwimpl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: brwimpl.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 633989ba0140..cb43e4989355 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: datwin.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx index b01c39832a32..e068f669e46e 100644 --- a/svtools/source/brwbox/datwin.hxx +++ b/svtools/source/brwbox/datwin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: datwin.hxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index da8068a314a0..edf56f0b9b34 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ebbcontrols.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 09d1f5c869b9..817ab743140a 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editbrowsebox.cxx,v $ - * $Revision: 1.33 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/editbrowsebox.hrc b/svtools/source/brwbox/editbrowsebox.hrc index 438d240e6e4e..5902365b1b05 100644 --- a/svtools/source/brwbox/editbrowsebox.hrc +++ b/svtools/source/brwbox/editbrowsebox.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editbrowsebox.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src index c04e1294c0af..8c00c673c32b 100644 --- a/svtools/source/brwbox/editbrowsebox.src +++ b/svtools/source/brwbox/editbrowsebox.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editbrowsebox.src,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx index c0658bc2b7dd..ed62b2cb1520 100644 --- a/svtools/source/brwbox/editbrowsebox2.cxx +++ b/svtools/source/brwbox/editbrowsebox2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editbrowsebox2.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/editbrowseboximpl.hxx b/svtools/source/brwbox/editbrowseboximpl.hxx index 8b4390bc6a7a..724da694b9c1 100644 --- a/svtools/source/brwbox/editbrowseboximpl.hxx +++ b/svtools/source/brwbox/editbrowseboximpl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editbrowseboximpl.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/brwbox/makefile.mk b/svtools/source/brwbox/makefile.mk index 4f539b4cb45b..e195e0ef4859 100644 --- a/svtools/source/brwbox/makefile.mk +++ b/svtools/source/brwbox/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.16 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 4077231c5c84..b2d2c54232b0 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: accessibilityoptions.cxx,v $ - * $Revision: 1.15.74.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 0d4865ee563e..316e6ab34656 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: apearcfg.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 9008d7a27ee1..7a151d609e6e 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: colorcfg.cxx,v $ - * $Revision: 1.20.82.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 89bf41ac9f58..993025b22884 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: extcolorcfg.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index dc9bfa64e6d4..7bcbc1e4be82 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fontsubstconfig.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 16982a695e11..091bf50c4787 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpopt.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx new file mode 100644 index 000000000000..b8a9660ee8dc --- /dev/null +++ b/svtools/source/config/htmlcfg.cxx @@ -0,0 +1,523 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <svtools/htmlcfg.hxx> +#include <svtools/parhtml.hxx> +#include <unotools/syslocale.hxx> +#include <tools/debug.hxx> +#include <tools/list.hxx> +#include <tools/link.hxx> + +// ----------------------------------------------------------------------- +#define HTMLCFG_UNKNOWN_TAGS 0x01 +//#define HTMLCFG_STYLE_SHEETS 0x02 +//#define HTMLCFG_NETSCAPE3 0x04 +#define HTMLCFG_STAR_BASIC 0x08 +#define HTMLCFG_LOCAL_GRF 0x10 +#define HTMLCFG_PRINT_LAYOUT_EXTENSION 0x20 +#define HTMLCFG_IGNORE_FONT_FAMILY 0x40 +#define HTMLCFG_IS_BASIC_WARNING 0x80 +#define HTMLCFG_NUMBERS_ENGLISH_US 0x100 + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; + +static SvxHtmlOptions* pOptions = 0; + +DECLARE_LIST( LinkList, Link * ) + +#define C2U(cChar) OUString::createFromAscii(cChar) +/* -----------------------------23.11.00 11:39-------------------------------- + + ---------------------------------------------------------------------------*/ +struct HtmlOptions_Impl +{ + LinkList aList; + sal_Int32 nFlags; + sal_Int32 nExportMode; + sal_Int32 aFontSizeArr[HTML_FONT_COUNT]; + sal_Int32 eEncoding; + sal_Bool bIsEncodingDefault; + + HtmlOptions_Impl() : + nFlags(HTMLCFG_LOCAL_GRF|HTMLCFG_IS_BASIC_WARNING), + nExportMode(HTML_CFG_NS40), + eEncoding( gsl_getSystemTextEncoding() ), + bIsEncodingDefault(sal_True) + { + aFontSizeArr[0] = HTMLFONTSZ1_DFLT; + aFontSizeArr[1] = HTMLFONTSZ2_DFLT; + aFontSizeArr[2] = HTMLFONTSZ3_DFLT; + aFontSizeArr[3] = HTMLFONTSZ4_DFLT; + aFontSizeArr[4] = HTMLFONTSZ5_DFLT; + aFontSizeArr[5] = HTMLFONTSZ6_DFLT; + aFontSizeArr[6] = HTMLFONTSZ7_DFLT; + } +}; + +/* -----------------------------23.11.00 11:39-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames() +{ + static Sequence<OUString> aNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "Import/UnknownTag", // 0 + "Import/FontSetting", // 1 + "Import/FontSize/Size_1", // 2 + "Import/FontSize/Size_2", // 3 + "Import/FontSize/Size_3", // 4 + "Import/FontSize/Size_4", // 5 + "Import/FontSize/Size_5", // 6 + "Import/FontSize/Size_6", // 7 + "Import/FontSize/Size_7", // 8 + "Export/Browser", // 9 + "Export/Basic", // 0 + "Export/PrintLayout", // 11 + "Export/LocalGraphic", // 12 + "Export/Warning", // 13 + "Export/Encoding", // 14 + "Import/NumbersEnglishUS" // 15 + }; + const int nCount = sizeof(aPropNames) / sizeof(aPropNames[0]); + aNames.realloc(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = C2U(aPropNames[i]); + } + return aNames; +} +// ----------------------------------------------------------------------- +SvxHtmlOptions::SvxHtmlOptions() : + ConfigItem(C2U("Office.Common/Filter/HTML")) +{ + pImp = new HtmlOptions_Impl; + Load( GetPropertyNames() ); +} + +// ----------------------------------------------------------------------- +SvxHtmlOptions::~SvxHtmlOptions() +{ + delete pImp; +} + +void SvxHtmlOptions::Load( const Sequence< OUString >& aNames ) +{ + Sequence<Any> aValues = GetProperties(aNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == aNames.getLength()) + { + pImp->nFlags = 0; + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS; + break;//"Import/UnknownTag", + case 1: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY; + break;//"Import/FontSetting", + case 2: pValues[nProp] >>= pImp->aFontSizeArr[0]; break;//"Import/FontSize/Size_1", + case 3: pValues[nProp] >>= pImp->aFontSizeArr[1]; break;//"Import/FontSize/Size_2", + case 4: pValues[nProp] >>= pImp->aFontSizeArr[2]; break;//"Import/FontSize/Size_3", + case 5: pValues[nProp] >>= pImp->aFontSizeArr[3]; break;//"Import/FontSize/Size_4", + case 6: pValues[nProp] >>= pImp->aFontSizeArr[4]; break;//"Import/FontSize/Size_5", + case 7: pValues[nProp] >>= pImp->aFontSizeArr[5]; break;//"Import/FontSize/Size_6", + case 8: pValues[nProp] >>= pImp->aFontSizeArr[6]; break;//"Import/FontSize/Size_7", + case 9://"Export/Browser", + { + sal_Int32 nExpMode = 0; +// pValues[nProp] >>= pImp->nExportMode; + pValues[nProp] >>= nExpMode; + switch( nExpMode ) + { + case 0: nExpMode = HTML_CFG_HTML32; break; + case 1: nExpMode = HTML_CFG_MSIE_40; break; +// case 2: nExpMode = HTML_CFG_NS30; break; depricated + case 3: nExpMode = HTML_CFG_WRITER; break; + case 4: nExpMode = HTML_CFG_NS40; break; + case 5: nExpMode = HTML_CFG_MSIE_40_OLD;break; + default: nExpMode = HTML_CFG_NS40; break; + } + + pImp->nExportMode = nExpMode; + } + break; + case 10: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_STAR_BASIC; + break;//"Export/Basic", + case 11: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION; + break;//"Export/PrintLayout", + case 12: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_LOCAL_GRF; + break;//"Export/LocalGraphic", + case 13: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_IS_BASIC_WARNING; + break;//"Export/Warning" + + case 14: pValues[nProp] >>= pImp->eEncoding; + pImp->bIsEncodingDefault = sal_False; + break;//"Export/Encoding" + + case 15: + if(*(sal_Bool*)pValues[nProp].getValue()) + pImp->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US; + break;//"Import/NumbersEnglishUS" + } + } + } + } +} + +// ----------------------------------------------------------------------- +void SvxHtmlOptions::Commit() +{ + const Sequence<OUString>& aNames = GetPropertyNames(); + +// const OUString* pNames = aNames.getConstArray(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + +// const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + sal_Bool bSet = sal_False; + switch(nProp) + { + case 0: bSet = 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS);break;//"Import/UnknownTag", + case 1: bSet = 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY);break;//"Import/FontSetting", + case 2: pValues[nProp] <<= pImp->aFontSizeArr[0];break;//"Import/FontSize/Size_1", + case 3: pValues[nProp] <<= pImp->aFontSizeArr[1];break;//"Import/FontSize/Size_2", + case 4: pValues[nProp] <<= pImp->aFontSizeArr[2];break;//"Import/FontSize/Size_3", + case 5: pValues[nProp] <<= pImp->aFontSizeArr[3];break;//"Import/FontSize/Size_4", + case 6: pValues[nProp] <<= pImp->aFontSizeArr[4];break;//"Import/FontSize/Size_5", + case 7: pValues[nProp] <<= pImp->aFontSizeArr[5];break;//"Import/FontSize/Size_6", + case 8: pValues[nProp] <<= pImp->aFontSizeArr[6];break;//"Import/FontSize/Size_7", + case 9: //"Export/Browser", + { + sal_Int32 nExpMode = pImp->nExportMode; + + switch( nExpMode ) + { + case HTML_CFG_HTML32: nExpMode = 0; break; + case HTML_CFG_MSIE_40: nExpMode = 1; break; +// case HTML_CFG_NS30: nExpMode = 2; break; depricated + case HTML_CFG_WRITER: nExpMode = 3; break; + case HTML_CFG_NS40: nExpMode = 4; break; + case HTML_CFG_MSIE_40_OLD: nExpMode = 5; break; + default: nExpMode = 4; break; // NS40 + } + + pValues[nProp] <<= nExpMode; + break; + } + case 10: bSet = 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC);break;//"Export/Basic", + case 11: bSet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);break;//"Export/PrintLayout", + case 12: bSet = 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF);break;//"Export/LocalGraphic", + case 13: bSet = 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING);break;//"Export/Warning" + case 14: + if(!pImp->bIsEncodingDefault) + pValues[nProp] <<= pImp->eEncoding; + break;//"Export/Encoding", + case 15: bSet = 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US);break;//"Import/NumbersEnglishUS" + } + if(nProp < 2 || ( nProp > 9 && nProp < 14 ) || nProp == 15) + pValues[nProp].setValue(&bSet, ::getCppuBooleanType()); + } + PutProperties(aNames, aValues); +} + +void SvxHtmlOptions::AddListenerLink( const Link& rLink ) +{ + pImp->aList.Insert( new Link( rLink ) ); +} + +void SvxHtmlOptions::RemoveListenerLink( const Link& rLink ) +{ + for ( USHORT n=0; n<pImp->aList.Count(); n++ ) + { + if ( (*pImp->aList.GetObject(n) ) == rLink ) + { + delete pImp->aList.Remove(n); + break; + } + } +} + +void SvxHtmlOptions::CallListeners() +{ + for ( USHORT n = 0; n < pImp->aList.Count(); ++n ) + pImp->aList.GetObject(n)->Call( this ); +} + + +void SvxHtmlOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ + Load( GetPropertyNames() ); + CallListeners(); +} + +// ----------------------------------------------------------------------- +USHORT SvxHtmlOptions::GetFontSize(USHORT nPos) const +{ + if(nPos < HTML_FONT_COUNT) + return (USHORT)pImp->aFontSizeArr[nPos]; + return 0; +} +// ----------------------------------------------------------------------- +void SvxHtmlOptions::SetFontSize(USHORT nPos, USHORT nSize) +{ + if(nPos < HTML_FONT_COUNT) + { + pImp->aFontSizeArr[nPos] = nSize; + SetModified(); + } +} + +// ----------------------------------------------------------------------- + +// ----------------------------------------------------------------------- + + +BOOL SvxHtmlOptions::IsImportUnknown() const +{ + return 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS) ; +} + +// ----------------------------------------------------------------------- + + +void SvxHtmlOptions::SetImportUnknown(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS; + else + pImp->nFlags &= ~HTMLCFG_UNKNOWN_TAGS; + SetModified(); +} + +// ----------------------------------------------------------------------- + + +USHORT SvxHtmlOptions::GetExportMode() const +{ + return (USHORT)pImp->nExportMode; +} + +// ----------------------------------------------------------------------- + + +void SvxHtmlOptions::SetExportMode(USHORT nSet) +{ + if(nSet <= HTML_CFG_MAX ) + { + pImp->nExportMode = nSet; + SetModified(); + CallListeners(); + } +} + +// ----------------------------------------------------------------------- + + +BOOL SvxHtmlOptions::IsStarBasic() const +{ + return 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC) ; +} + +// ----------------------------------------------------------------------- + + +void SvxHtmlOptions::SetStarBasic(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_STAR_BASIC; + else + pImp->nFlags &= ~HTMLCFG_STAR_BASIC; + SetModified(); +} + +/*-----------------14.02.97 08.34------------------- + +--------------------------------------------------*/ + +BOOL SvxHtmlOptions::IsSaveGraphicsLocal() const +{ + return 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF) ; +} +/*-----------------14.02.97 08.34------------------- + +--------------------------------------------------*/ +void SvxHtmlOptions::SetSaveGraphicsLocal(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_LOCAL_GRF; + else + pImp->nFlags &= ~HTMLCFG_LOCAL_GRF; + SetModified(); +} + +/*-----------------10/21/97 08:34am----------------- + +--------------------------------------------------*/ + +BOOL SvxHtmlOptions::IsPrintLayoutExtension() const +{ + BOOL bRet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION); + switch( pImp->nExportMode ) + { + case HTML_CFG_MSIE_40: + case HTML_CFG_NS40 : + case HTML_CFG_WRITER : + break; + default: + bRet = FALSE; + } + return bRet; +} +/*-----------------10/21/97 08:34am----------------- + +--------------------------------------------------*/ +void SvxHtmlOptions::SetPrintLayoutExtension(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION; + else + pImp->nFlags &= ~HTMLCFG_PRINT_LAYOUT_EXTENSION; + SetModified(); +} + +/*-----------------10.07.98 10.02------------------- + +--------------------------------------------------*/ + +BOOL SvxHtmlOptions::IsIgnoreFontFamily() const +{ + return 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY) ; +} +/*-----------------10.07.98 10.02------------------- + +--------------------------------------------------*/ +void SvxHtmlOptions::SetIgnoreFontFamily(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY; + else + pImp->nFlags &= ~HTMLCFG_IGNORE_FONT_FAMILY; + SetModified(); +} +/* -----------------05.02.99 09:03------------------- + * + * --------------------------------------------------*/ +BOOL SvxHtmlOptions::IsStarBasicWarning() const +{ + return 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING) ; +} +/* -----------------05.02.99 09:03------------------- + * + * --------------------------------------------------*/ +void SvxHtmlOptions::SetStarBasicWarning(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_IS_BASIC_WARNING; + else + pImp->nFlags &= ~HTMLCFG_IS_BASIC_WARNING; + SetModified(); +} + +/*-----------------19.02.2001 18:40----------------- + * + * --------------------------------------------------*/ +rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const +{ + rtl_TextEncoding eRet; + if(pImp->bIsEncodingDefault) + eRet = SvtSysLocale::GetBestMimeEncoding(); + else + eRet = (rtl_TextEncoding)pImp->eEncoding; + return eRet; +} + +/*-----------------19.02.2001 18:40----------------- + * + * --------------------------------------------------*/ +void SvxHtmlOptions::SetTextEncoding( rtl_TextEncoding eEnc ) +{ + pImp->eEncoding = eEnc; + pImp->bIsEncodingDefault = sal_False; + SetModified(); +} +/* -----------------------------15.08.2001 12:01------------------------------ + + ---------------------------------------------------------------------------*/ +sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const +{ + return pImp->bIsEncodingDefault; +} + +SvxHtmlOptions* SvxHtmlOptions::Get() +{ + if ( !pOptions ) + pOptions = new SvxHtmlOptions; + return pOptions; +} + + +/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */ +BOOL SvxHtmlOptions::IsNumbersEnglishUS() const +{ + return 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US) ; +} + + +/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */ +void SvxHtmlOptions::SetNumbersEnglishUS(BOOL bSet) +{ + if(bSet) + pImp->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US; + else + pImp->nFlags &= ~HTMLCFG_NUMBERS_ENGLISH_US; + SetModified(); +} diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 759fabbee686..8e971a1629bf 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: itemholder2.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx index 192df8f746c9..9314021b5750 100644 --- a/svtools/source/config/itemholder2.hxx +++ b/svtools/source/config/itemholder2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: itemholder2.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index 9de32bd9e43d..d3ba43de68ef 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.61 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,6 +45,7 @@ SLOFILES= \ $(SLO)$/extcolorcfg.obj \ $(SLO)$/fontsubstconfig.obj \ $(SLO)$/helpopt.obj \ + $(SLO)$/htmlcfg.obj \ $(SLO)$/itemholder2.obj \ $(SLO)$/menuoptions.obj \ $(SLO)$/miscopt.obj \ diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 8c00d7165ba5..70d9d1623ef2 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: menuoptions.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index af6861a5104f..7b04b56104e0 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: miscopt.cxx,v $ - * $Revision: 1.26 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 43490c5ea79e..57cf1cd8ad5b 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: optionsdrawinglayer.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 9627a2ce10d9..46e1f737d347 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printoptions.cxx,v $ - * $Revision: 1.14.236.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/test/makefile.mk b/svtools/source/config/test/makefile.mk index 01d6752a2850..71bea788d8de 100644 --- a/svtools/source/config/test/makefile.mk +++ b/svtools/source/config/test/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx index 1ac0038b5131..ea4e0c0ec942 100644 --- a/svtools/source/config/test/test.cxx +++ b/svtools/source/config/test/test.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/cont_pch.cxx b/svtools/source/contnr/cont_pch.cxx index fb711ff12e7d..4661a08162a2 100644 --- a/svtools/source/contnr/cont_pch.cxx +++ b/svtools/source/contnr/cont_pch.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cont_pch.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index a0e6b353dfb6..93f328ae2028 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contentenumeration.cxx,v $ - * $Revision: 1.11.104.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx index dd6c3e727f05..16db279ad547 100644 --- a/svtools/source/contnr/contentenumeration.hxx +++ b/svtools/source/contnr/contentenumeration.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contentenumeration.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/ctrdll.cxx b/svtools/source/contnr/ctrdll.cxx index 1607cd1727f9..463c6ccc8b35 100644 --- a/svtools/source/contnr/ctrdll.cxx +++ b/svtools/source/contnr/ctrdll.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrdll.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 7fddf18ee266..8538e344bdc1 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fileview.cxx,v $ - * $Revision: 1.73.104.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/fileview.hrc b/svtools/source/contnr/fileview.hrc index 791945595229..bbf340148fc9 100644 --- a/svtools/source/contnr/fileview.hrc +++ b/svtools/source/contnr/fileview.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fileview.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index 9d1cdb618cda..e45f35fc1927 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fileview.src,v $ - * $Revision: 1.35 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index d443beb7fff9..cc7aa4e05ee1 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imivctl.hxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 954c8a7ca179..dd2ed992536e 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imivctl1.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 5d602143b810..7cb92e8cef07 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imivctl2.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index 916738af70ae..dae3abbac966 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ivctrl.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/makefile.mk b/svtools/source/contnr/makefile.mk index ded62752330a..232665c88c9c 100644 --- a/svtools/source/contnr/makefile.mk +++ b/svtools/source/contnr/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src index f81bc3fdfa9b..c296cc686c1d 100644 --- a/svtools/source/contnr/svcontnr.src +++ b/svtools/source/contnr/svcontnr.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svcontnr.src,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx index 978a50395e8e..20bcfe0fe33a 100644 --- a/svtools/source/contnr/svicnvw.cxx +++ b/svtools/source/contnr/svicnvw.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svicnvw.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index f2674279f4df..426f55be5b93 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svimpbox.cxx,v $ - * $Revision: 1.57 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index 8d7a79701d27..2d4c9cf2df0e 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svimpicn.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index e9125b7fb2e1..82321b53259e 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svlbitm.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index 77a9a3798d6d..2752e813052e 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svlbox.cxx,v $ - * $Revision: 1.33 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 3b4907e7a80d..9d4ad1ba15b5 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtabbx.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 503325ddf802..143ac922eebc 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtreebx.cxx,v $ - * $Revision: 1.56 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 06de35ba19aa..ab4bda64a652 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templwin.cxx,v $ - * $Revision: 1.82.58.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/templwin.hrc b/svtools/source/contnr/templwin.hrc index ebf756e17799..5a0d84f1d377 100644 --- a/svtools/source/contnr/templwin.hrc +++ b/svtools/source/contnr/templwin.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templwin.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index 050ba7ab6739..acb7c602ad30 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templwin.hxx,v $ - * $Revision: 1.38 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index f7f42b7e176b..636c54ef6632 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templwin.src,v $ - * $Revision: 1.65 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/tooltiplbox.cxx b/svtools/source/contnr/tooltiplbox.cxx index f33b7e4c24ea..6aae495bd504 100644 --- a/svtools/source/contnr/tooltiplbox.cxx +++ b/svtools/source/contnr/tooltiplbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tooltiplbox.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index c1491571dd1c..3395dffc28f5 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: treelist.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx index 1e47c71de5d4..04b2b58367ee 100644 --- a/svtools/source/control/asynclink.cxx +++ b/svtools/source/control/asynclink.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: asynclink.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 481f6f2ceeae..c83ffa3ed70f 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: calendar.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src index 043dd9808663..15c82cfdd184 100644 --- a/svtools/source/control/calendar.src +++ b/svtools/source/control/calendar.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: calendar.src,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx index c976d7442bc0..23a84e757ebe 100644 --- a/svtools/source/control/collatorres.cxx +++ b/svtools/source/control/collatorres.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: collatorres.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 1a6465bd5c5d..2f692944d3c7 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrlbox.cxx,v $ - * $Revision: 1.27 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 05c75577cdbf..0c63aef259b3 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrlbox.src,v $ - * $Revision: 1.59 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ctrldll.cxx b/svtools/source/control/ctrldll.cxx index 084d76125088..2f3ff037be31 100644 --- a/svtools/source/control/ctrldll.cxx +++ b/svtools/source/control/ctrldll.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrldll.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 1573ed531662..9abd14331fe4 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrltool.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src index ab8005cd9698..3e1c1ba884f8 100644 --- a/svtools/source/control/ctrltool.src +++ b/svtools/source/control/ctrltool.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrltool.src,v $ - * $Revision: 1.36 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index f00cf45be0e6..14c0478f5327 100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filectrl.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/filectrl.src b/svtools/source/control/filectrl.src index 3a051e8196e1..dc8bbb5905d6 100644 --- a/svtools/source/control/filectrl.src +++ b/svtools/source/control/filectrl.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filectrl.src,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/filectrl2.cxx b/svtools/source/control/filectrl2.cxx index 0ea28fbf96bd..2a75c5d3d7e8 100644 --- a/svtools/source/control/filectrl2.cxx +++ b/svtools/source/control/filectrl2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filectrl2.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index 554f713fd4d6..476b2864a117 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fileurlbox.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/fixedhyper.cxx b/svtools/source/control/fixedhyper.cxx index 5525333e083c..a8877d240d4e 100644 --- a/svtools/source/control/fixedhyper.cxx +++ b/svtools/source/control/fixedhyper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fixedhyper.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index bbf00329cf93..5b986dc10f9d 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fmtfield.cxx,v $ - * $Revision: 1.40 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index ffef998d7aad..1ae223bebf06 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: headbar.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx index 7d7477130e0d..10ef8cdcfadf 100644 --- a/svtools/source/control/hyperlabel.cxx +++ b/svtools/source/control/hyperlabel.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hyperlabel.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx index f69e9b34e5ea..32e3aa14c0dc 100644 --- a/svtools/source/control/indexentryres.cxx +++ b/svtools/source/control/indexentryres.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: indexentryres.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index b4904afee418..8aadbb9028b0 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: inettbc.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk index eecf983ab756..a40a81163eb3 100644 --- a/svtools/source/control/makefile.mk +++ b/svtools/source/control/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,6 +45,7 @@ SRC1FILES=\ filectrl.src EXCEPTIONSFILES=\ + $(SLO)$/svxbox.obj \ $(SLO)$/filectrl2.obj \ $(SLO)$/roadmap.obj \ $(SLO)$/scriptedtext.obj\ diff --git a/svtools/source/control/prgsbar.cxx b/svtools/source/control/prgsbar.cxx index b6702e93af4d..b67202e9c1fc 100644 --- a/svtools/source/control/prgsbar.cxx +++ b/svtools/source/control/prgsbar.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prgsbar.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 693bca733813..7cf88816199f 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: roadmap.cxx,v $ - * $Revision: 1.16.56.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index c3f10f1866aa..6fcbd92597ba 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ruler.cxx,v $ - * $Revision: 1.27 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx index 04f3d55c35b0..2067e6d245f0 100644 --- a/svtools/source/control/scriptedtext.cxx +++ b/svtools/source/control/scriptedtext.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: scriptedtext.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index 162f23948385..eb47d2c780ad 100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: scrwin.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/stdctrl.cxx b/svtools/source/control/stdctrl.cxx index ddfb607d8064..14c8cade3092 100644 --- a/svtools/source/control/stdctrl.cxx +++ b/svtools/source/control/stdctrl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stdctrl.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 35250753de1e..95b6d3fbd5c6 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stdmenu.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/svxbox.cxx b/svtools/source/control/svxbox.cxx new file mode 100644 index 000000000000..d1ea47d110cd --- /dev/null +++ b/svtools/source/control/svxbox.cxx @@ -0,0 +1,617 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include <tools/debug.hxx> +#include <vcl/svapp.hxx> +#include <svtools/svxbox.hxx> +#include <unotools/charclass.hxx> + +// ----------------------------------------------------------------------- + +SV_IMPL_PTRARR(SvxEntryLst, SvxBoxEntry*) + +/*-------------------------------------------------------------------- + Beschreibung: Ein ListboxElement + --------------------------------------------------------------------*/ + +SvxBoxEntry::SvxBoxEntry() : + nId(LISTBOX_ENTRY_NOTFOUND), + bModified(FALSE), + bNew(FALSE) +{ +} + + +SvxBoxEntry::SvxBoxEntry(const String& aNam, USHORT nIdx) : + aName(aNam), + nId(nIdx), + bModified(FALSE), + bNew(FALSE) +{ +} + + +SvxBoxEntry::SvxBoxEntry(const SvxBoxEntry& rOld) : + aName(rOld.aName), + nId(rOld.nId), + bModified(rOld.bModified), + bNew(rOld.bNew) +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SvxListBox::SvxListBox(Window* pParent, WinBits nBits) : + ListBox(pParent, nBits) +{ + InitListBox(); +} + + +SvxListBox::SvxListBox(Window* pParent, const ResId& rId): + ListBox(pParent, rId) +{ + InitListBox(); +} + +/*-------------------------------------------------------------------- + Beschreibung: Basisklasse Dtor + --------------------------------------------------------------------*/ + +__EXPORT SvxListBox::~SvxListBox() +{ + aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); + aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); +} + +/*-------------------------------------------------------------------- + Beschreibung: Evtl. Liste aus der Ressource beachten + --------------------------------------------------------------------*/ + +void SvxListBox::InitListBox() +{ + // Verwaltung fuer die Stringlist aus der Resource aufbauen + USHORT nSize = GetEntryCount(); + for(USHORT i=0; i < nSize; ++i) + { const SvxBoxEntry* pTmp = new SvxBoxEntry(ListBox::GetEntry(i), i); + const SvxBoxEntry* &rpTmp = pTmp; + aEntryLst.Insert(rpTmp, aEntryLst.Count()); + } +} + +/*-------------------------------------------------------------------- + Beschreibung: neue Eintraege verwalten + --------------------------------------------------------------------*/ + +void SvxListBox::InsertNewEntry(const SvxBoxEntry& rEntry) +{ + SvxBoxEntry* pNew = new SvxBoxEntry(rEntry); + pNew->bNew = TRUE; + InsertSorted(pNew); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag in die ListBox aufnehmen + --------------------------------------------------------------------*/ + +void SvxListBox::InsertEntry(const SvxBoxEntry& rEntry, USHORT nPos) +{ + if(nPos != LISTBOX_ENTRY_NOTFOUND) + { + SvxBoxEntry* pEntry = new SvxBoxEntry(rEntry); + ListBox::InsertEntry(pEntry->aName, nPos); + //const SvxBoxEntry* &rpEntry = pEntry; + aEntryLst.C40_INSERT(SvxBoxEntry, pEntry, nPos); + } + else + InsertSorted(new SvxBoxEntry(rEntry)); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag aus der Liste loeschen + --------------------------------------------------------------------*/ + +void SvxListBox::RemoveEntry(USHORT nPos) +{ + if(nPos >= aEntryLst.Count()) + return; + + // Altes Element austragen + SvxBoxEntry* pEntry = aEntryLst[nPos]; + aEntryLst.Remove(nPos, 1); + ListBox::RemoveEntry(nPos); + + // keine neuen Eintraege in die Liste mit aufnehmen + if(pEntry->bNew) + return; + + // in DeleteListe eintragen + aDelEntryLst.C40_INSERT(SvxBoxEntry, pEntry, aDelEntryLst.Count()); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag ueber konkretes Obkjekt loeschen + --------------------------------------------------------------------*/ + +void SvxListBox::RemoveEntry(const SvxBoxEntry& rEntry) +{ + USHORT nPos = ListBox::GetEntryPos(rEntry.aName); + RemoveEntry(nPos); +} + +/*-------------------------------------------------------------------- + Beschreibung: Listen loeschen und Anzeige loeschen + --------------------------------------------------------------------*/ + +void SvxListBox::Clear() +{ + ListBox::Clear(); + aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); + aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); +} + +/*-------------------------------------------------------------------- + Beschreibung: Position by Name + --------------------------------------------------------------------*/ + +USHORT SvxListBox::GetEntryPos(const SvxBoxEntry& rEntry) const +{ + return ListBox::GetEntryPos(rEntry.aName); +} + +/*-------------------------------------------------------------------- + Beschreibung: Rund um die Entries + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxListBox::GetSvxBoxEntry(USHORT nPos) const +{ + if(nPos < aEntryLst.Count()) + return *aEntryLst[nPos]; + else + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: aktullen Eintrag zurueckgeben + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxListBox::GetSelectSvxBoxEntry(USHORT nSelId) const +{ + String aName(ListBox::GetSelectEntry(nSelId)); + + if(aName.Len() > 0) + { + for (USHORT i=0; i < aEntryLst.Count(); i++) + { + if(aEntryLst[i]->aName == aName ) + return *aEntryLst[i]; + } + } + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: modifizierte Eintraege + --------------------------------------------------------------------*/ + +USHORT SvxListBox::GetModifiedCount() const +{ + USHORT nMod = 0; + USHORT nSize = aEntryLst.Count(); + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bModified) + nMod++; + } + return nMod; +} + +/*-------------------------------------------------------------------- + Beschreibung: Modifizierte Eintraege behandeln + --------------------------------------------------------------------*/ + +void SvxListBox::ModifyEntry(USHORT nPos, const String& rName) +{ + if(nPos >= aEntryLst.Count()) + return; + + SvxBoxEntry* pEntry = aEntryLst[nPos]; + aEntryLst.Remove(nPos, 1); + aEntryLst[nPos]->aName = rName; + aEntryLst[nPos]->bModified = TRUE; + ListBox::RemoveEntry(nPos); + + InsertSorted(pEntry); +} + +/*-------------------------------------------------------------------- + Beschreibung: alle modifizierten Eintraege bahandeln + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxListBox::GetModifiedEntry(USHORT nPos) const +{ + USHORT nSize = aEntryLst.Count(); + USHORT nMod = 0; + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bModified) + { if(nMod == nPos) + return *aEntryLst[i]; + nMod++; + } + } + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: geloeschte Eintraege + --------------------------------------------------------------------*/ + +USHORT SvxListBox::GetRemovedCount() const +{ + return aDelEntryLst.Count(); +} + + +const SvxBoxEntry& SvxListBox::GetRemovedEntry(USHORT nPos) const +{ + if(nPos < aDelEntryLst.Count()) + return *aDelEntryLst[nPos]; + + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: Neue Entries begutachten + --------------------------------------------------------------------*/ + +USHORT SvxListBox::GetNewCount() const +{ + USHORT nNew = 0; + USHORT nSize = aEntryLst.Count(); + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bNew) + nNew++; + } + return nNew; +} + +/*-------------------------------------------------------------------- + Beschreibung: Alle neuen Eintraege ueberpruefen + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxListBox::GetNewEntry(USHORT nPos) const +{ + USHORT nSize = aEntryLst.Count(); + USHORT nNew = 0; + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bNew) + { if(nNew == nPos) + return *aEntryLst[i]; + nNew++; + } + } + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: Sortiert einfuegen + --------------------------------------------------------------------*/ + +void SvxListBox::InsertSorted(SvxBoxEntry* pEntry) +{ + ListBox::InsertEntry(pEntry->aName); + USHORT nPos = ListBox::GetEntryPos(pEntry->aName); + aEntryLst.C40_INSERT(SvxBoxEntry, pEntry, nPos); +} + +/*-------------------------------------------------------------------- + Beschreibung: ComboBoxen mit Verwaltungseinheit + --------------------------------------------------------------------*/ + +SvxComboBox::SvxComboBox(Window* pParent, WinBits nBits, USHORT nStyleBits) : + ComboBox(pParent, nBits), + nStyle(nStyleBits) +{ + InitComboBox(); +} + + +SvxComboBox::SvxComboBox(Window* pParent, const ResId& rId, USHORT nStyleBits ): + ComboBox(pParent, rId), + nStyle(nStyleBits) +{ + InitComboBox(); +} + +/*-------------------------------------------------------------------- + Beschreibung: Basisklasse Dtor + --------------------------------------------------------------------*/ + +__EXPORT SvxComboBox::~SvxComboBox() +{ + aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); + aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); +} + +/*-------------------------------------------------------------------- + Beschreibung: Evtl. Liste aus der Ressource beachten + --------------------------------------------------------------------*/ + +void SvxComboBox::InitComboBox() +{ + // Verwaltung fuer die Stringlist aus der Resource aufbauen + USHORT nSize = GetEntryCount(); + for(USHORT i=0; i < nSize; ++i) + { const SvxBoxEntry* pTmp = new SvxBoxEntry(ComboBox::GetEntry(i), i); + const SvxBoxEntry* &rpTmp = pTmp; + aEntryLst.Insert(rpTmp, aEntryLst.Count()); + } +} + +/*-------------------------------------------------------------------- + Beschreibung: neue Eintraege verwalten + --------------------------------------------------------------------*/ + +void SvxComboBox::InsertNewEntry(const SvxBoxEntry& rEntry) +{ + SvxBoxEntry* pNew = new SvxBoxEntry(rEntry); + pNew->bNew = TRUE; + InsertSorted(pNew); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag in die ComboBox aufnehmen + --------------------------------------------------------------------*/ + +void SvxComboBox::InsertEntry(const SvxBoxEntry& rEntry) +{ + InsertSorted(new SvxBoxEntry(rEntry)); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag aus der Liste loeschen + --------------------------------------------------------------------*/ + +void SvxComboBox::RemoveEntry(USHORT nPos) +{ + if(nPos >= aEntryLst.Count()) + return; + + // Altes Element austragen + SvxBoxEntry* pEntry = aEntryLst[nPos]; + aEntryLst.Remove(nPos, 1); + ComboBox::RemoveEntry(nPos); + + // keine neuen Eintraege in die Liste mit aufnehmen + if(pEntry->bNew) + return; + + // in DeleteListe eintragen + aDelEntryLst.C40_INSERT(SvxBoxEntry, pEntry, aDelEntryLst.Count()); +} + +/*-------------------------------------------------------------------- + Beschreibung: Eintrag ueber konkretes Obkjekt loeschen + --------------------------------------------------------------------*/ + +void SvxComboBox::RemoveEntry(const SvxBoxEntry& rEntry) +{ + USHORT nPos = ComboBox::GetEntryPos(rEntry.aName); + RemoveEntry(nPos); +} + +/*-------------------------------------------------------------------- + Beschreibung: Listen loeschen und Anzeige loeschen + --------------------------------------------------------------------*/ + +void SvxComboBox::Clear() +{ + ComboBox::Clear(); + aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); + aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); +} + + +/*-------------------------------------------------------------------- + Beschreibung: Position by Name + --------------------------------------------------------------------*/ + +USHORT SvxComboBox::GetEntryPos(const SvxBoxEntry& rEntry) const +{ + return ComboBox::GetEntryPos(rEntry.aName); +} + +/*-------------------------------------------------------------------- + Beschreibung: Rund um die Entries + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxComboBox::GetEntry(USHORT nPos) const +{ + if(nPos < aEntryLst.Count()) + return *aEntryLst[nPos]; + else + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: modifizierte Eintraege + --------------------------------------------------------------------*/ + +USHORT SvxComboBox::GetModifiedCount() const +{ + USHORT nMod = 0; + USHORT nSize = aEntryLst.Count(); + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bModified) + nMod++; + } + return nMod; +} + +/*-------------------------------------------------------------------- + Beschreibung: Modifizierte Eintraege behandeln + --------------------------------------------------------------------*/ + +void SvxComboBox::ModifyEntry(USHORT nPos, const String& rName) +{ + if(nPos >= aEntryLst.Count()) + return; + + SvxBoxEntry* pEntry = aEntryLst[nPos]; + aEntryLst.Remove(nPos, 1); + aEntryLst[nPos]->aName = rName; + aEntryLst[nPos]->bModified = TRUE; + ComboBox::RemoveEntry(nPos); + + InsertSorted(pEntry); +} + +/*-------------------------------------------------------------------- + Beschreibung: alle modifizierten Eintraege bahandeln + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxComboBox::GetModifiedEntry(USHORT nPos) const +{ + USHORT nSize = aEntryLst.Count(); + USHORT nMod = 0; + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bModified) + { if(nMod == nPos) + return *aEntryLst[i]; + nMod++; + } + } + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: geloeschte Eintraege + --------------------------------------------------------------------*/ + +USHORT SvxComboBox::GetRemovedCount() const +{ + return aDelEntryLst.Count(); +} + + +const SvxBoxEntry& SvxComboBox::GetRemovedEntry(USHORT nPos) const +{ + if(nPos < aDelEntryLst.Count()) + return *aDelEntryLst[nPos]; + + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: Neue Entries begutachten + --------------------------------------------------------------------*/ + +USHORT SvxComboBox::GetNewCount() const +{ + USHORT nNew = 0; + USHORT nSize = aEntryLst.Count(); + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bNew) + nNew++; + } + return nNew; +} + +/*-------------------------------------------------------------------- + Beschreibung: Alle neuen Eintraege ueberpruefen + --------------------------------------------------------------------*/ + +const SvxBoxEntry& SvxComboBox::GetNewEntry(USHORT nPos) const +{ + USHORT nSize = aEntryLst.Count(); + USHORT nNew = 0; + for(USHORT i=0; i < nSize; ++i) + { if(aEntryLst[i]->bNew) + { if(nNew == nPos) + return *aEntryLst[i]; + nNew++; + } + } + return aDefault; +} + +/*-------------------------------------------------------------------- + Beschreibung: Sortiert einfuegen + --------------------------------------------------------------------*/ + +void SvxComboBox::InsertSorted(SvxBoxEntry* pEntry) +{ + ComboBox::InsertEntry(pEntry->aName); + USHORT nPos = ComboBox::GetEntryPos(pEntry->aName); + aEntryLst.C40_INSERT(SvxBoxEntry, pEntry, nPos); +} + + +/*-------------------------------------------------------------------- + Beschreibung: Je nach Option bestimmte Zeichen ausblenden + --------------------------------------------------------------------*/ + +void __EXPORT SvxComboBox::KeyInput( const KeyEvent& rKEvt ) +{ + sal_Unicode cChar = rKEvt.GetCharCode(); + + if(nStyle & SVX_CBS_FILENAME) + { +#if defined UNX + if( cChar == sal_Unicode( '/' ) || cChar == sal_Unicode( ' ' ) ) + return; +#else + if( cChar == sal_Unicode( ':' ) || cChar == sal_Unicode( '\\' ) || + cChar == sal_Unicode( '.' ) || cChar == sal_Unicode( ' ' ) ) + return; +#endif + } + ComboBox::KeyInput(rKEvt); +} + +/*-------------------------------------------------------------------- + Beschreibung: Text nach Option konvertieren + --------------------------------------------------------------------*/ + +String SvxComboBox::GetText() const +{ + String aTxt(ComboBox::GetText()); + CharClass aCharClass( Application::GetSettings().GetLocale() ); + + if(nStyle & SVX_CBS_LOWER) + return aCharClass.lower(aTxt); + + if(nStyle & SVX_CBS_UPPER) + return aCharClass.upper(aTxt); + + return aTxt; +} + + diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index ed1abbe53a2a..c4896ba8b812 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tabbar.cxx,v $ - * $Revision: 1.21.100.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx index 146fa4933af3..e84c934ef0d8 100644 --- a/svtools/source/control/taskbar.cxx +++ b/svtools/source/control/taskbar.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: taskbar.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/taskbox.cxx b/svtools/source/control/taskbox.cxx index 72a7345f1660..8e5ff6de8def 100644 --- a/svtools/source/control/taskbox.cxx +++ b/svtools/source/control/taskbox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: taskbox.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx index bada5926d639..4c9fda217258 100644 --- a/svtools/source/control/taskmisc.cxx +++ b/svtools/source/control/taskmisc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: taskmisc.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index 82165a711285..2fdab63be37f 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: taskstat.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx index 899867414e2f..788948355965 100644 --- a/svtools/source/control/urlcontrol.cxx +++ b/svtools/source/control/urlcontrol.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: urlcontrol.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 96eb8bb39e99..6712e75aa9b4 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: valueacc.cxx,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index c176629953ae..f74cdf00a4db 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: valueimp.hxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 4033a9df7bb5..bb48c11c7c0b 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: valueset.cxx,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index aa18a3683916..6647b9eee608 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: addresstemplate.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/addresstemplate.hrc b/svtools/source/dialogs/addresstemplate.hrc index 8c4a6b9fbd27..5fb89cd567fc 100644 --- a/svtools/source/dialogs/addresstemplate.hrc +++ b/svtools/source/dialogs/addresstemplate.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: addresstemplate.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src index 63c0e6475597..f4812f8b7566 100644 --- a/svtools/source/dialogs/addresstemplate.src +++ b/svtools/source/dialogs/addresstemplate.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: addresstemplate.src,v $ - * $Revision: 1.55 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/colctrl.cxx b/svtools/source/dialogs/colctrl.cxx index 06fb689cd2ce..4456fe2f1268 100644 --- a/svtools/source/dialogs/colctrl.cxx +++ b/svtools/source/dialogs/colctrl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: colctrl.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index 3b40f498c656..a52cc4b0834c 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: colrdlg.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/colrdlg.hrc b/svtools/source/dialogs/colrdlg.hrc index 8ffad0ea544e..41329df6e366 100644 --- a/svtools/source/dialogs/colrdlg.hrc +++ b/svtools/source/dialogs/colrdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: colrdlg.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/colrdlg.src b/svtools/source/dialogs/colrdlg.src index 1425f0f28962..ad9a5c1aa015 100644 --- a/svtools/source/dialogs/colrdlg.src +++ b/svtools/source/dialogs/colrdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: colrdlg.src,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/filedlg.cxx b/svtools/source/dialogs/filedlg.cxx index b543aa895a8e..5567651c0480 100644 --- a/svtools/source/dialogs/filedlg.cxx +++ b/svtools/source/dialogs/filedlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlg.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index 5a03ab3885b5..b0e77d658931 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlg2.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/filedlg2.hxx b/svtools/source/dialogs/filedlg2.hxx index fffa318e2529..4d32565a2775 100644 --- a/svtools/source/dialogs/filedlg2.hxx +++ b/svtools/source/dialogs/filedlg2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlg2.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/filedlg2.src b/svtools/source/dialogs/filedlg2.src index ecbabc79941b..977a0d6f430b 100644 --- a/svtools/source/dialogs/filedlg2.src +++ b/svtools/source/dialogs/filedlg2.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlg2.src,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/formats.src b/svtools/source/dialogs/formats.src index a3a738a705fb..f8ce80f62f2f 100644 --- a/svtools/source/dialogs/formats.src +++ b/svtools/source/dialogs/formats.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: formats.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index a1bbbd9b9edb..3f7700805995 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: insdlg.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx index 791e373086af..c9edf632d2ec 100644 --- a/svtools/source/dialogs/logindlg.cxx +++ b/svtools/source/dialogs/logindlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: logindlg.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/logindlg.hrc b/svtools/source/dialogs/logindlg.hrc index 1998c55ebce4..7baf6010f531 100644 --- a/svtools/source/dialogs/logindlg.hrc +++ b/svtools/source/dialogs/logindlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: logindlg.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src index b3ef357bbae4..338b608ab0e4 100644 --- a/svtools/source/dialogs/logindlg.src +++ b/svtools/source/dialogs/logindlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: logindlg.src,v $ - * $Revision: 1.43 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/makefile.mk b/svtools/source/dialogs/makefile.mk index 6abf15732b8e..16528ee7d4cd 100644 --- a/svtools/source/dialogs/makefile.mk +++ b/svtools/source/dialogs/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.16 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index fef27c4c9a62..d07c41acba04 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mcvmath.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index cd021559c780..67d54fd80cf0 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mcvmath.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index a006f209af18..532fd3f61bb2 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printdlg.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc index 2f2f43e3ba10..ef780acbb47c 100644 --- a/svtools/source/dialogs/printdlg.hrc +++ b/svtools/source/dialogs/printdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printdlg.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/printdlg.src b/svtools/source/dialogs/printdlg.src index c3ab39564d75..405accc63344 100644 --- a/svtools/source/dialogs/printdlg.src +++ b/svtools/source/dialogs/printdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printdlg.src,v $ - * $Revision: 1.49 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 74cfe7b1286a..ceef2a88642b 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prnsetup.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc index 00623d97084c..7d10c4652d45 100644 --- a/svtools/source/dialogs/prnsetup.hrc +++ b/svtools/source/dialogs/prnsetup.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prnsetup.hrc,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/prnsetup.src b/svtools/source/dialogs/prnsetup.src index 9f8731742c84..1443a35e0f39 100644 --- a/svtools/source/dialogs/prnsetup.src +++ b/svtools/source/dialogs/prnsetup.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prnsetup.src,v $ - * $Revision: 1.40 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/propctrl.cxx b/svtools/source/dialogs/propctrl.cxx index 40fd55fb1586..675a93ca728b 100644 --- a/svtools/source/dialogs/propctrl.cxx +++ b/svtools/source/dialogs/propctrl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: propctrl.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/propctrl.hxx b/svtools/source/dialogs/propctrl.hxx index 59019fc21b90..949873ceb1b7 100644 --- a/svtools/source/dialogs/propctrl.hxx +++ b/svtools/source/dialogs/propctrl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: propctrl.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/property.cxx b/svtools/source/dialogs/property.cxx index a0d2c557a3f6..3b081ce2f520 100644 --- a/svtools/source/dialogs/property.cxx +++ b/svtools/source/dialogs/property.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: property.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index c7473e446986..2c71e60e8101 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: roadmapwizard.cxx,v $ - * $Revision: 1.19.10.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/so3res.src b/svtools/source/dialogs/so3res.src index c99b917d891e..524b58e0a5df 100644 --- a/svtools/source/dialogs/so3res.src +++ b/svtools/source/dialogs/so3res.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: so3res.src,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 602c2e3e6f8a..bac18a2932dc 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wizardmachine.cxx,v $ - * $Revision: 1.21.10.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src index 2fa50ef20bf6..c3570335773f 100644 --- a/svtools/source/dialogs/wizardmachine.src +++ b/svtools/source/dialogs/wizardmachine.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wizardmachine.src,v $ - * $Revision: 1.37 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index aa0e62046ea6..f06b4f53ce7c 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wizdlg.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 990e3041d903..01bb7ad41682 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editsyntaxhighlighter.cxx,v $ - * $Revision: 1.44.108.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/makefile.mk b/svtools/source/edit/makefile.mk index 0cb429a9b5b1..58a63be58f78 100644 --- a/svtools/source/edit/makefile.mk +++ b/svtools/source/edit/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.15.108.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 8c60a62063df..daaff472d1cc 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svmedit.cxx,v $ - * $Revision: 1.44.108.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx index c990ed9f004e..19eba618a828 100644 --- a/svtools/source/edit/svmedit2.cxx +++ b/svtools/source/edit/svmedit2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svmedit2.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/sychconv.cxx b/svtools/source/edit/sychconv.cxx index 0a394207d051..3efa510bfc5a 100644 --- a/svtools/source/edit/sychconv.cxx +++ b/svtools/source/edit/sychconv.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sychconv.cxx,v $ - * $Revision: 1.5.136.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index 7e2f98d0d37f..5729eb712bfe 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: syntaxhighlight.cxx,v $ - * $Revision: 1.1.2.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx index 7ee667db2305..222e8abee5a4 100644 --- a/svtools/source/edit/textdat2.hxx +++ b/svtools/source/edit/textdat2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textdat2.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx index 4e90e37a075b..32bdfe40a3fb 100644 --- a/svtools/source/edit/textdata.cxx +++ b/svtools/source/edit/textdata.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textdata.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index 09fd6b36fdb2..d4470904077e 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textdoc.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index b940bb6f4da7..0c875b4fe07f 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textdoc.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 596ca89054e7..e0e136089d78 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: texteng.cxx,v $ - * $Revision: 1.52 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textund2.hxx b/svtools/source/edit/textund2.hxx index c1ebfe9e4af1..18cf9331328e 100644 --- a/svtools/source/edit/textund2.hxx +++ b/svtools/source/edit/textund2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textund2.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx index d16c1441c5d1..4c243de16c31 100644 --- a/svtools/source/edit/textundo.cxx +++ b/svtools/source/edit/textundo.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textundo.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx index 7ce7169e1563..cc26c0b51ef6 100644 --- a/svtools/source/edit/textundo.hxx +++ b/svtools/source/edit/textundo.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textundo.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index 99b6fc900885..48cd23bdcc6f 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textview.cxx,v $ - * $Revision: 1.59 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/textwindowpeer.cxx b/svtools/source/edit/textwindowpeer.cxx index 8a9c168653e6..7f31e95c75a7 100644 --- a/svtools/source/edit/textwindowpeer.cxx +++ b/svtools/source/edit/textwindowpeer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textwindowpeer.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx index e860a3a0cfd4..e7466cbe1d85 100644 --- a/svtools/source/edit/txtattr.cxx +++ b/svtools/source/edit/txtattr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: txtattr.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/edit/xtextedt.cxx b/svtools/source/edit/xtextedt.cxx index b3d17d80b567..0a4907edcadd 100644 --- a/svtools/source/edit/xtextedt.cxx +++ b/svtools/source/edit/xtextedt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xtextedt.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx index d28fb78dcad1..4c8023bed883 100644 --- a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx +++ b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FilterConfigCache.cxx,v $ - * $Revision: 1.24.100.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.hxx b/svtools/source/filter.vcl/filter/FilterConfigCache.hxx index 76c3976763e9..2c6b7361e540 100644 --- a/svtools/source/filter.vcl/filter/FilterConfigCache.hxx +++ b/svtools/source/filter.vcl/filter/FilterConfigCache.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FilterConfigCache.hxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/FilterConfigItem.cxx b/svtools/source/filter.vcl/filter/FilterConfigItem.cxx index b336ed1adf07..765711ad8d4a 100644 --- a/svtools/source/filter.vcl/filter/FilterConfigItem.cxx +++ b/svtools/source/filter.vcl/filter/FilterConfigItem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FilterConfigItem.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index 584814dd9e92..038930ef80ee 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SvFilterOptionsDialog.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx index 2828c6268c17..a55fc4c84520 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SvFilterOptionsDialog.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgejpg.cxx b/svtools/source/filter.vcl/filter/dlgejpg.cxx index a892a9012bba..377697023de3 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.cxx +++ b/svtools/source/filter.vcl/filter/dlgejpg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgejpg.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc index 67ac915df367..523a1d9553f1 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgejpg.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hxx b/svtools/source/filter.vcl/filter/dlgejpg.hxx index 4fe06e254c8c..d80682574a54 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.hxx +++ b/svtools/source/filter.vcl/filter/dlgejpg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgejpg.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgejpg.src b/svtools/source/filter.vcl/filter/dlgejpg.src index 9a7c637d4d9c..fd224f22c409 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.src +++ b/svtools/source/filter.vcl/filter/dlgejpg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgejpg.src,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgepng.cxx b/svtools/source/filter.vcl/filter/dlgepng.cxx index 04ad01c5a89c..bd551e9a4bda 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.cxx +++ b/svtools/source/filter.vcl/filter/dlgepng.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgepng.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc index d687141abf56..4a05771534ab 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ b/svtools/source/filter.vcl/filter/dlgepng.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgepng.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgepng.hxx b/svtools/source/filter.vcl/filter/dlgepng.hxx index ad8536532a29..469985afee59 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.hxx +++ b/svtools/source/filter.vcl/filter/dlgepng.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgepng.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgepng.src b/svtools/source/filter.vcl/filter/dlgepng.src index d4010b0acdd7..aa778842dc48 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.src +++ b/svtools/source/filter.vcl/filter/dlgepng.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgepng.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgexpor.cxx b/svtools/source/filter.vcl/filter/dlgexpor.cxx index 3dd75b53598a..b4b7c0fc949d 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.cxx +++ b/svtools/source/filter.vcl/filter/dlgexpor.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgexpor.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc index cae15d7276d2..2e5377ce4fcb 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgexpor.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hxx b/svtools/source/filter.vcl/filter/dlgexpor.hxx index 8797cbec48c9..8c7b2d462e70 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.hxx +++ b/svtools/source/filter.vcl/filter/dlgexpor.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgexpor.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/dlgexpor.src b/svtools/source/filter.vcl/filter/dlgexpor.src index 63fb3ccff729..7573b394d72f 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.src +++ b/svtools/source/filter.vcl/filter/dlgexpor.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgexpor.src,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index 306307a0bf91..e8121f1d7e94 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filter.cxx,v $ - * $Revision: 1.77 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -2129,3 +2126,42 @@ GraphicFilter* GraphicFilter::GetGraphicFilter() } return pGraphicFilter; } + +int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, + Graphic& rGraphic, GraphicFilter* pFilter, + USHORT* pDeterminedFormat ) +{ + if ( !pFilter ) + pFilter = GetGraphicFilter(); + + const USHORT nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() + ? pFilter->GetImportFormatNumber( rFilterName ) + : GRFILTER_FORMAT_DONTKNOW; + + SvStream* pStream = NULL; + INetURLObject aURL( rPath ); + + if ( aURL.HasError() || INET_PROT_NOT_VALID == aURL.GetProtocol() ) + { + aURL.SetSmartProtocol( INET_PROT_FILE ); + aURL.SetSmartURL( rPath ); + } + else if ( INET_PROT_FILE != aURL.GetProtocol() ) + { + pStream = ::utl::UcbStreamHelper::CreateStream( rPath, STREAM_READ ); + } + + int nRes = GRFILTER_OK; + if ( !pStream ) + nRes = pFilter->ImportGraphic( rGraphic, aURL, nFilter, pDeterminedFormat ); + else + nRes = pFilter->ImportGraphic( rGraphic, rPath, *pStream, nFilter, pDeterminedFormat ); + +#ifdef DBG_UTIL + if( nRes ) + DBG_WARNING2( "GrafikFehler [%d] - [%s]", nRes, rPath.GetBuffer() ); +#endif + + return nRes; +} + diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx index 9e0e3ba43d54..de2bef64ba6e 100644 --- a/svtools/source/filter.vcl/filter/filter2.cxx +++ b/svtools/source/filter.vcl/filter/filter2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filter2.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/fldll.cxx b/svtools/source/filter.vcl/filter/fldll.cxx index 96125e63a5e2..b44e08835f34 100644 --- a/svtools/source/filter.vcl/filter/fldll.cxx +++ b/svtools/source/filter.vcl/filter/fldll.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fldll.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/gradwrap.cxx b/svtools/source/filter.vcl/filter/gradwrap.cxx index d13767f494ef..be5dade03313 100644 --- a/svtools/source/filter.vcl/filter/gradwrap.cxx +++ b/svtools/source/filter.vcl/filter/gradwrap.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gradwrap.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk index ecdf48ba5671..272bb9a76b03 100644 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ b/svtools/source/filter.vcl/filter/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.13 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/sgfbram.cxx b/svtools/source/filter.vcl/filter/sgfbram.cxx index 7da9304a8266..43cf0fbbacd3 100644 --- a/svtools/source/filter.vcl/filter/sgfbram.cxx +++ b/svtools/source/filter.vcl/filter/sgfbram.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgfbram.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/sgvmain.cxx b/svtools/source/filter.vcl/filter/sgvmain.cxx index da466140a01e..e175380244b3 100644 --- a/svtools/source/filter.vcl/filter/sgvmain.cxx +++ b/svtools/source/filter.vcl/filter/sgvmain.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgvmain.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/sgvspln.cxx b/svtools/source/filter.vcl/filter/sgvspln.cxx index afe4f318cbf1..7a23e85f4dbe 100644 --- a/svtools/source/filter.vcl/filter/sgvspln.cxx +++ b/svtools/source/filter.vcl/filter/sgvspln.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgvspln.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/sgvtext.cxx b/svtools/source/filter.vcl/filter/sgvtext.cxx index 6ff019fee1ee..4a0be80b55be 100644 --- a/svtools/source/filter.vcl/filter/sgvtext.cxx +++ b/svtools/source/filter.vcl/filter/sgvtext.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgvtext.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc index a3356982609a..ac162bff09f4 100644 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ b/svtools/source/filter.vcl/filter/strings.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: strings.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/filter/strings.src b/svtools/source/filter.vcl/filter/strings.src index 79a039355cb7..60e628ee0b5c 100644 --- a/svtools/source/filter.vcl/filter/strings.src +++ b/svtools/source/filter.vcl/filter/strings.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: strings.src,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx index 9babc02665a3..bfe77319b81a 100644 --- a/svtools/source/filter.vcl/igif/decode.cxx +++ b/svtools/source/filter.vcl/igif/decode.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: decode.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/igif/decode.hxx b/svtools/source/filter.vcl/igif/decode.hxx index 8584a852e169..3c6a61e7508d 100644 --- a/svtools/source/filter.vcl/igif/decode.hxx +++ b/svtools/source/filter.vcl/igif/decode.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: decode.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/igif/gifread.cxx b/svtools/source/filter.vcl/igif/gifread.cxx index 792befd17157..e4020c727ff4 100644 --- a/svtools/source/filter.vcl/igif/gifread.cxx +++ b/svtools/source/filter.vcl/igif/gifread.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gifread.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk index 49e2461bd7a8..0821591e0178 100644 --- a/svtools/source/filter.vcl/igif/makefile.mk +++ b/svtools/source/filter.vcl/igif/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk index 41d6f7425474..55708d2f2630 100644 --- a/svtools/source/filter.vcl/ixbm/makefile.mk +++ b/svtools/source/filter.vcl/ixbm/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/ixbm/xbmread.cxx b/svtools/source/filter.vcl/ixbm/xbmread.cxx index 32f73d62c195..9c7faaafa88c 100644 --- a/svtools/source/filter.vcl/ixbm/xbmread.cxx +++ b/svtools/source/filter.vcl/ixbm/xbmread.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xbmread.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk index 10792f41ab3a..98f93290d325 100644 --- a/svtools/source/filter.vcl/ixpm/makefile.mk +++ b/svtools/source/filter.vcl/ixpm/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/ixpm/rgbtable.hxx b/svtools/source/filter.vcl/ixpm/rgbtable.hxx index fea528a25de7..afdab883b369 100644 --- a/svtools/source/filter.vcl/ixpm/rgbtable.hxx +++ b/svtools/source/filter.vcl/ixpm/rgbtable.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: rgbtable.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx index 1a667908f2f1..7575c94e3ed9 100644 --- a/svtools/source/filter.vcl/ixpm/xpmread.cxx +++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xpmread.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx index ee2b2baebee0..7fd2e09a82dd 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.cxx +++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: jpeg.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,22 +30,16 @@ #include <tools/solar.h> -#ifdef SYSTEM_JPEG -#define INT32 JPEG_INT32 -#endif - extern "C" { + #define INT32 JPEG_INT32 #include "stdio.h" #include "jpeg.h" #include "jpeglib.h" #include "jerror.h" + #undef INT32 } -#ifdef SYSTEM_JPEG -#undef INT32 -#endif - #define _JPEGPRIVATE #include <vcl/bmpacc.hxx> #include "jpeg.hxx" @@ -399,11 +390,7 @@ void* JPEGReader::CreateBitmap( void* pParam ) if( ( bGray && ( BMP_FORMAT_8BIT_PAL == nFormat ) ) || -#ifndef SYSTEM_JPEG - ( !bGray && ( BMP_FORMAT_24BIT_TC_BGR == nFormat ) ) -#else ( !bGray && ( BMP_FORMAT_24BIT_TC_RGB == nFormat ) ) -#endif ) { pBmpBuf = pAcc->GetBuffer(); @@ -466,15 +453,9 @@ void JPEGReader::FillBitmap() for( long nX = 0L; nX < nWidth; nX++ ) { -#ifndef SYSTEM_JPEG - aColor.SetBlue( *pTmp++ ); - aColor.SetGreen( *pTmp++ ); - aColor.SetRed( *pTmp++ ); -#else aColor.SetRed( *pTmp++ ); aColor.SetGreen( *pTmp++ ); aColor.SetBlue( *pTmp++ ); -#endif pAcc->SetPixel( nY, nX, aColor ); } } @@ -654,19 +635,11 @@ void* JPEGWriter::GetScanline( long nY ) for( long nX = 0L; nX < nWidth; nX++ ) { aColor = pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) ); -#ifndef SYSTEM_JPEG - *pTmp++ = aColor.GetBlue(); - if ( bGreys ) - continue; - *pTmp++ = aColor.GetGreen(); - *pTmp++ = aColor.GetRed(); -#else *pTmp++ = aColor.GetRed(); if ( bGreys ) continue; *pTmp++ = aColor.GetGreen(); *pTmp++ = aColor.GetBlue(); -#endif } } else @@ -674,19 +647,11 @@ void* JPEGWriter::GetScanline( long nY ) for( long nX = 0L; nX < nWidth; nX++ ) { aColor = pAcc->GetPixel( nY, nX ); -#ifndef SYSTEM_JPEG - *pTmp++ = aColor.GetBlue(); - if ( bGreys ) - continue; - *pTmp++ = aColor.GetGreen(); - *pTmp++ = aColor.GetRed(); -#else *pTmp++ = aColor.GetRed(); if ( bGreys ) continue; *pTmp++ = aColor.GetGreen(); *pTmp++ = aColor.GetBlue(); -#endif } } @@ -741,14 +706,7 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) if( pAcc ) { - if ( bGreys ) - bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ); - else -#ifndef SYSTEM_JPEG - bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR ); -#else - bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); -#endif + bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); if( !bNative ) pBuffer = new BYTE[ AlignedWidth4Bytes( bGreys ? pAcc->Width() * 8L : pAcc->Width() * 24L ) ]; diff --git a/svtools/source/filter.vcl/jpeg/jpeg.h b/svtools/source/filter.vcl/jpeg/jpeg.h index 4d5aafe413bb..deb06600474c 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.h +++ b/svtools/source/filter.vcl/jpeg/jpeg.h @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: jpeg.h,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/jpeg/jpegc.c b/svtools/source/filter.vcl/jpeg/jpegc.c index 0525877f2614..29b4749a7b51 100644 --- a/svtools/source/filter.vcl/jpeg/jpegc.c +++ b/svtools/source/filter.vcl/jpeg/jpegc.c @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: jpegc.c,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -34,7 +31,8 @@ #include "jpeglib.h" #include "jerror.h" #include "jpeg.h" - +#include "rtl/alloc.h" +#include "osl/diagnose.h" struct my_error_mgr { @@ -81,6 +79,9 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) long nWidth; long nHeight; long nAlignedWidth; + JSAMPLE * range_limit; + HPBYTE pScanLineBuffer = NULL; + long nScanLineBufferComponents = 0; // declare bDecompCreated volatile because of gcc // warning: variable 'bDecompCreated' might be clobbered by `longjmp' or `vfork' volatile long bDecompCreated = 0; @@ -106,8 +107,12 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) cinfo.output_gamma = 1.0; cinfo.raw_data_out = FALSE; cinfo.quantize_colors = FALSE; - if ( cinfo.jpeg_color_space != JCS_GRAYSCALE ) + if ( cinfo.jpeg_color_space == JCS_YCbCr ) cinfo.out_color_space = JCS_RGB; + else if ( cinfo.jpeg_color_space == JCS_YCCK ) + cinfo.out_color_space = JCS_CMYK; + + OSL_ASSERT(cinfo.out_color_space == JCS_CMYK || cinfo.out_color_space == JCS_GRAYSCALE || cinfo.out_color_space == JCS_RGB); /* change scale for preview import */ if( nPreviewWidth || nPreviewHeight ) @@ -151,6 +156,14 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) aCreateBitmapParam.bGray = cinfo.output_components == 1; pDIB = CreateBitmap( pJPEGReader, &aCreateBitmapParam ); nAlignedWidth = aCreateBitmapParam.nAlignedWidth; + range_limit=cinfo.sample_range_limit; + + if ( cinfo.out_color_space == JCS_CMYK ) + { + nScanLineBufferComponents = cinfo.output_width * 4; + pScanLineBuffer = rtl_allocateMemory( nScanLineBufferComponents ); + } + if( pDIB ) { if( aCreateBitmapParam.bTopDown ) @@ -163,17 +176,37 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) for ( *pLines = 0; *pLines < nHeight; (*pLines)++ ) { + if (pScanLineBuffer!=NULL) { // in other words cinfo.out_color_space == JCS_CMYK + int i; + int j; + jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pScanLineBuffer, 1 ); + // convert CMYK to RGB + for( i=0, j=0; i < nScanLineBufferComponents; i+=4, j+=3 ) + { + int c_=255-pScanLineBuffer[i+0]; + int m_=255-pScanLineBuffer[i+1]; + int y_=255-pScanLineBuffer[i+2]; + int k_=255-pScanLineBuffer[i+3]; + pTmp[j+0]=range_limit[ 255L - ( c_ + k_ ) ]; + pTmp[j+1]=range_limit[ 255L - ( m_ + k_ ) ]; + pTmp[j+2]=range_limit[ 255L - ( y_ + k_ ) ]; + } + } else { jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pTmp, 1 ); - + } /* PENDING ??? */ if ( cinfo.err->msg_code == 113 ) - break; + break; pTmp += nAlignedWidth; } } jpeg_finish_decompress( &cinfo ); + if (pScanLineBuffer!=NULL) { + rtl_freeMemory( pScanLineBuffer ); + pScanLineBuffer=NULL; + } Exit: diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk index 7a9b5fc509c9..c782c520324c 100644 --- a/svtools/source/filter.vcl/jpeg/makefile.mk +++ b/svtools/source/filter.vcl/jpeg/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,10 +35,6 @@ TARGET=jpeg .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk -.IF "$(SYSTEM_JPEG)" == "YES" -CFLAGS+=-DSYSTEM_JPEG -.ENDIF - SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx index 1bc5364a191a..f31fd4439e9f 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.cxx +++ b/svtools/source/filter.vcl/wmf/emfwr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: emfwr.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx index 29715c59df0f..6334b5dfe16f 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.hxx +++ b/svtools/source/filter.vcl/wmf/emfwr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: emfwr.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/enhwmf.cxx b/svtools/source/filter.vcl/wmf/enhwmf.cxx index db12dab82cbd..1e49e0d61446 100644 --- a/svtools/source/filter.vcl/wmf/enhwmf.cxx +++ b/svtools/source/filter.vcl/wmf/enhwmf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: enhwmf.cxx,v $ - * $Revision: 1.39 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/makefile.mk b/svtools/source/filter.vcl/wmf/makefile.mk index d0354924f483..5c9412bc8387 100644 --- a/svtools/source/filter.vcl/wmf/makefile.mk +++ b/svtools/source/filter.vcl/wmf/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx index 58dfdec45ee1..21f6e69c8d9e 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.cxx +++ b/svtools/source/filter.vcl/wmf/winmtf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winmtf.cxx,v $ - * $Revision: 1.54.136.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx index f3b2482f63bc..beb1f62e22d6 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.hxx +++ b/svtools/source/filter.vcl/wmf/winmtf.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winmtf.hxx,v $ - * $Revision: 1.34.134.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx index f9ae46e98e12..f7c4f51ce1e2 100644 --- a/svtools/source/filter.vcl/wmf/winwmf.cxx +++ b/svtools/source/filter.vcl/wmf/winwmf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winwmf.cxx,v $ - * $Revision: 1.36.136.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/wmf.cxx b/svtools/source/filter.vcl/wmf/wmf.cxx index 97e77d3256ac..25ca9f721b33 100644 --- a/svtools/source/filter.vcl/wmf/wmf.cxx +++ b/svtools/source/filter.vcl/wmf/wmf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wmf.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index c4f53046c29a..4dff9732c7d0 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wmfwr.cxx,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx index 6b2ff0b04e0a..9fe698b22c2e 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.hxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wmfwr.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx new file mode 100644 index 000000000000..5db73e6cc2f3 --- /dev/null +++ b/svtools/source/graphic/descriptor.cxx @@ -0,0 +1,498 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "descriptor.hxx" + +#include <rtl/uuid.h> +#include <vos/mutex.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <svtools/filter.hxx> +#include <svl/itemprop.hxx> + +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/graphic/GraphicType.hpp> + +#include "vcl/graph.hxx" +#include "vcl/svapp.hxx" + +#define UNOGRAPHIC_GRAPHICTYPE 1 +#define UNOGRAPHIC_MIMETYPE 2 +#define UNOGRAPHIC_SIZEPIXEL 3 +#define UNOGRAPHIC_SIZE100THMM 4 +#define UNOGRAPHIC_BITSPERPIXEL 5 +#define UNOGRAPHIC_TRANSPARENT 6 +#define UNOGRAPHIC_ALPHA 7 +#define UNOGRAPHIC_ANIMATED 8 + +using namespace ::com::sun::star; + +namespace unographic { + +// --------------------- +// - GraphicDescriptor - +// --------------------- + +GraphicDescriptor::GraphicDescriptor() : + ::comphelper::PropertySetHelper( createPropertySetInfo(), SAL_NO_ACQUIRE ), + mpGraphic( NULL ), + meType( GRAPHIC_NONE ), + mnBitsPerPixel ( 0 ), + mbTransparent ( false ), + mbAlpha( false ), + mbAnimated( false ) +{ +} + +// ------------------------------------------------------------------------------ + +GraphicDescriptor::~GraphicDescriptor() + throw() +{ +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::init( const ::Graphic& rGraphic ) + throw() +{ + mpGraphic = &rGraphic; +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::init( const ::rtl::OUString& rURL ) + throw() +{ + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rURL, STREAM_READ ); + + if( pIStm ) + { + implCreate( *pIStm, &rURL ); + delete pIStm; + } +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) + throw() +{ + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rxIStm ); + + if( pIStm ) + { + implCreate( *pIStm, &rURL ); + delete pIStm; + } +} + +// ------------------------------------------------------------------------------ + +bool GraphicDescriptor::isValid() const +{ + return( mpGraphic ? ( mpGraphic->GetType() != GRAPHIC_NONE ) : ( meType != GRAPHIC_NONE ) ); +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL ) +{ + String aURL; + if( pURL ) + aURL = *pURL; + ::GraphicDescriptor aDescriptor( rIStm, &aURL ); + + mpGraphic = NULL; + maMimeType = ::rtl::OUString(); + meType = GRAPHIC_NONE; + mnBitsPerPixel = 0; + mbTransparent = false; + + if( aDescriptor.Detect( true ) && aDescriptor.GetFileFormat() != GFF_NOT ) + { + const char* pMimeType = NULL; + sal_uInt8 cType = graphic::GraphicType::EMPTY; + + switch( aDescriptor.GetFileFormat() ) + { + case( GFF_BMP ): pMimeType = MIMETYPE_BMP; cType = graphic::GraphicType::PIXEL; break; + case( GFF_GIF ): pMimeType = MIMETYPE_GIF; cType = graphic::GraphicType::PIXEL; break; + case( GFF_JPG ): pMimeType = MIMETYPE_JPG; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PCD ): pMimeType = MIMETYPE_PCD; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PCX ): pMimeType = MIMETYPE_PCX; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PNG ): pMimeType = MIMETYPE_PNG; cType = graphic::GraphicType::PIXEL; break; + case( GFF_TIF ): pMimeType = MIMETYPE_TIF; cType = graphic::GraphicType::PIXEL; break; + case( GFF_XBM ): pMimeType = MIMETYPE_XBM; cType = graphic::GraphicType::PIXEL; break; + case( GFF_XPM ): pMimeType = MIMETYPE_XPM; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PBM ): pMimeType = MIMETYPE_PBM; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PGM ): pMimeType = MIMETYPE_PGM; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PPM ): pMimeType = MIMETYPE_PPM; cType = graphic::GraphicType::PIXEL; break; + case( GFF_RAS ): pMimeType = MIMETYPE_RAS; cType = graphic::GraphicType::PIXEL; break; + case( GFF_TGA ): pMimeType = MIMETYPE_TGA; cType = graphic::GraphicType::PIXEL; break; + case( GFF_PSD ): pMimeType = MIMETYPE_PSD; cType = graphic::GraphicType::PIXEL; break; + + case( GFF_EPS ): pMimeType = MIMETYPE_EPS; cType = graphic::GraphicType::VECTOR; break; + case( GFF_DXF ): pMimeType = MIMETYPE_DXF; cType = graphic::GraphicType::VECTOR; break; + case( GFF_MET ): pMimeType = MIMETYPE_MET; cType = graphic::GraphicType::VECTOR; break; + case( GFF_PCT ): pMimeType = MIMETYPE_PCT; cType = graphic::GraphicType::VECTOR; break; + case( GFF_SGF ): pMimeType = MIMETYPE_SGF; cType = graphic::GraphicType::VECTOR; break; + case( GFF_SVM ): pMimeType = MIMETYPE_SVM; cType = graphic::GraphicType::VECTOR; break; + case( GFF_WMF ): pMimeType = MIMETYPE_WMF; cType = graphic::GraphicType::VECTOR; break; + case( GFF_SGV ): pMimeType = MIMETYPE_SGV; cType = graphic::GraphicType::VECTOR; break; + case( GFF_EMF ): pMimeType = MIMETYPE_EMF; cType = graphic::GraphicType::VECTOR; break; + + default: + break; + } + + if( graphic::GraphicType::EMPTY != cType ) + { + meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GRAPHIC_BITMAP : GRAPHIC_GDIMETAFILE ); + maMimeType = String( pMimeType, RTL_TEXTENCODING_ASCII_US ); + maSizePixel = aDescriptor.GetSizePixel(); + maSize100thMM = aDescriptor.GetSize_100TH_MM(); + mnBitsPerPixel = aDescriptor.GetBitsPerPixel(); + mbTransparent = ( graphic::GraphicType::VECTOR == cType ); + mbAlpha = mbAnimated = false; + } + } +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString GraphicDescriptor::getImplementationName_Static() + throw() +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.GraphicDescriptor" ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > GraphicDescriptor::getSupportedServiceNames_Static() + throw( ) +{ + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicDescriptor" ) ); + + return aSeq; +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + uno::Any aAny; + + if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) ) + aAny <<= uno::Reference< lang::XServiceInfo >(this); + else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) ) + aAny <<= uno::Reference< lang::XTypeProvider >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ) + aAny <<= uno::Reference< beans::XPropertySet >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) ) + aAny <<= uno::Reference< beans::XPropertyState >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) ) + aAny <<= uno::Reference< beans::XMultiPropertySet >(this); + else + aAny <<= OWeakAggObject::queryAggregation( rType ); + + return aAny; +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + return OWeakAggObject::queryInterface( rType ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicDescriptor::acquire() + throw() +{ + OWeakAggObject::acquire(); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicDescriptor::release() + throw() +{ + OWeakAggObject::release(); +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL GraphicDescriptor::getImplementationName() + throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL GraphicDescriptor::supportsService( const rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< rtl::OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes() + throw( uno::RuntimeException ) +{ + uno::Sequence< uno::Type > aTypes( 6 ); + uno::Type* pTypes = aTypes.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0); + + return aTypes; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() + throw( uno::RuntimeException ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + static uno::Sequence< sal_Int8 > aId; + + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); + } + + return aId; +} + +// ------------------------------------------------------------------------------ + +::comphelper::PropertySetInfo* GraphicDescriptor::createPropertySetInfo() +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); + + static ::comphelper::PropertyMapEntry aEntries[] = + { + { MAP_CHAR_LEN( "GraphicType" ), UNOGRAPHIC_GRAPHICTYPE, &::getCppuType( (const sal_Int8*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "MimeType" ), UNOGRAPHIC_MIMETYPE, &::getCppuType( (const ::rtl::OUString*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "SizePixel" ), UNOGRAPHIC_SIZEPIXEL, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "Size100thMM" ), UNOGRAPHIC_SIZE100THMM, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "BitsPerPixel" ), UNOGRAPHIC_BITSPERPIXEL, &::getCppuType( (const sal_uInt8*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "Transparent" ), UNOGRAPHIC_TRANSPARENT, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "Alpha" ), UNOGRAPHIC_ALPHA, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "Animated" ), UNOGRAPHIC_ANIMATED, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, + + { 0,0,0,0,0,0 } + }; + + pRet->acquire(); + pRet->add( aEntries ); + + return pRet; +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::_setPropertyValues( const comphelper::PropertyMapEntry** /*ppEntries*/, const uno::Any* /*pValues*/ ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException ) +{ + // we only have readonly attributes +} + +// ------------------------------------------------------------------------------ + +void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) + throw( beans::UnknownPropertyException, lang::WrappedTargetException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + while( *ppEntries ) + { + switch( (*ppEntries)->mnHandle ) + { + case( UNOGRAPHIC_GRAPHICTYPE ): + { + const GraphicType eType( mpGraphic ? mpGraphic->GetType() : meType ); + + *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL : + ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR : + graphic::GraphicType::EMPTY ) ) ); + } + break; + + case( UNOGRAPHIC_MIMETYPE ): + { + ::rtl::OUString aMimeType; + + if( mpGraphic ) + { + if( mpGraphic->IsLink() ) + { + const char* pMimeType; + + switch( const_cast< Graphic* >( mpGraphic )->GetLink().GetType() ) + { + case( GFX_LINK_TYPE_NATIVE_GIF ): pMimeType = MIMETYPE_GIF; break; + case( GFX_LINK_TYPE_NATIVE_JPG ): pMimeType = MIMETYPE_JPG; break; + case( GFX_LINK_TYPE_NATIVE_PNG ): pMimeType = MIMETYPE_PNG; break; + case( GFX_LINK_TYPE_NATIVE_WMF ): pMimeType = MIMETYPE_WMF; break; + case( GFX_LINK_TYPE_NATIVE_MET ): pMimeType = MIMETYPE_MET; break; + case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT ; break; + + default: + pMimeType = NULL; + break; + } + + if( pMimeType ) + aMimeType = ::rtl::OUString::createFromAscii( pMimeType ); + } + + if( !aMimeType.getLength() && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + aMimeType = ::rtl::OUString::createFromAscii( MIMETYPE_VCLGRAPHIC ); + } + else + aMimeType = maMimeType; + + *pValues <<= aMimeType; + } + break; + + case( UNOGRAPHIC_SIZEPIXEL ): + { + awt::Size aAWTSize( 0, 0 ); + + if( mpGraphic ) + { + if( mpGraphic->GetType() == GRAPHIC_BITMAP ) + { + const Size aSizePix( mpGraphic->GetBitmapEx().GetSizePixel() ); + aAWTSize = awt::Size( aSizePix.Width(), aSizePix.Height() ); + } + } + else + aAWTSize = awt::Size( maSizePixel.Width(), maSizePixel.Height() ); + + *pValues <<= aAWTSize; + } + break; + + case( UNOGRAPHIC_SIZE100THMM ): + { + awt::Size aAWTSize( 0, 0 ); + + if( mpGraphic ) + { + if( mpGraphic->GetPrefMapMode().GetMapUnit() != MAP_PIXEL ) + { + const Size aSizeLog( OutputDevice::LogicToLogic( mpGraphic->GetPrefSize(), mpGraphic->GetPrefMapMode(), MAP_100TH_MM ) ); + aAWTSize = awt::Size( aSizeLog.Width(), aSizeLog.Height() ); + } + } + else + aAWTSize = awt::Size( maSize100thMM.Width(), maSize100thMM.Height() ); + + *pValues <<= aAWTSize; + } + break; + + case( UNOGRAPHIC_BITSPERPIXEL ): + { + USHORT nBitsPerPixel = 0; + + if( mpGraphic ) + { + if( mpGraphic->GetType() == GRAPHIC_BITMAP ) + nBitsPerPixel = mpGraphic->GetBitmapEx().GetBitmap().GetBitCount(); + } + else + nBitsPerPixel = mnBitsPerPixel; + + *pValues <<= sal::static_int_cast< sal_Int8 >(nBitsPerPixel); + } + break; + + case( UNOGRAPHIC_TRANSPARENT ): + { + *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsTransparent() : mbTransparent ); + } + break; + + case( UNOGRAPHIC_ALPHA ): + { + *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAlpha() : mbAlpha ); + } + break; + + case( UNOGRAPHIC_ANIMATED ): + { + *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAnimated() : mbAnimated ); + } + break; + } + + ++ppEntries; + ++pValues; + } +} + +} diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx new file mode 100644 index 000000000000..bed7c64c0411 --- /dev/null +++ b/svtools/source/graphic/descriptor.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GOODIES_DESCRIPTOR_HXX +#define _GOODIES_DESCRIPTOR_HXX + +#include <comphelper/propertysethelper.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <comphelper/propertysetinfo.hxx> +#include <vcl/graph.hxx> + +#define MIMETYPE_BMP "image/x-MS-bmp" +#define MIMETYPE_GIF "image/gif" +#define MIMETYPE_JPG "image/jpeg" +#define MIMETYPE_PCD "image/x-photo-cd" +#define MIMETYPE_PCX "image/x-pcx" +#define MIMETYPE_PNG "image/png" +#define MIMETYPE_TIF "image/tiff" +#define MIMETYPE_XBM "image/x-xbitmap" +#define MIMETYPE_XPM "image/x-xpixmap" +#define MIMETYPE_PBM "image/x-portable-bitmap" +#define MIMETYPE_PGM "image/x-portable-graymap" +#define MIMETYPE_PPM "image/x-portable-pixmap" +#define MIMETYPE_RAS "image/x-cmu-raster" +#define MIMETYPE_TGA "image/x-targa" +#define MIMETYPE_PSD "image/vnd.adobe.photoshop" +#define MIMETYPE_EPS "image/x-eps" +#define MIMETYPE_DXF "image/vnd.dxf" +#define MIMETYPE_MET "image/x-met" +#define MIMETYPE_PCT "image/x-pict" +#define MIMETYPE_SGF "image/x-sgf" +#define MIMETYPE_SVM "image/x-svm" +#define MIMETYPE_WMF "image/x-wmf" +#define MIMETYPE_SGV "image/x-sgv" +#define MIMETYPE_EMF "image/x-emf" +#define MIMETYPE_SVG "image/svg+xml" +#define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic" + +using namespace com::sun::star; + +namespace comphelper { class PropertySetInfo; } +namespace com { namespace sun { namespace star { namespace io { class XInputStream; } } } } + +class Graphic; + +namespace unographic { + +// ------------------- +// - GraphicProvider - +// ------------------- + +class GraphicDescriptor : public ::cppu::OWeakAggObject, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::comphelper::PropertySetHelper +{ +public: + + GraphicDescriptor(); + ~GraphicDescriptor() throw(); + + void init( const ::Graphic& rGraphic ) throw(); + void init( const ::rtl::OUString& rURL ) throw(); + void init( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) throw(); + + bool isValid() const; + + static ::rtl::OUString getImplementationName_Static() throw(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + +protected: + + static ::comphelper::PropertySetInfo* createPropertySetInfo(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // PropertySetHelper + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); + +private: + + const ::Graphic* mpGraphic; + GraphicType meType; + ::rtl::OUString maMimeType; + Size maSizePixel; + Size maSize100thMM; + USHORT mnBitsPerPixel; + bool mbTransparent; + bool mbAlpha; + bool mbAnimated; + + GraphicDescriptor( const GraphicDescriptor& rDescriptor ); + + GraphicDescriptor& operator=( const GraphicDescriptor& ); + + void implCreate( SvStream& rIStm, const ::rtl::OUString* pPath ); +}; + +} + +#endif diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx new file mode 100644 index 000000000000..52c03c611241 --- /dev/null +++ b/svtools/source/graphic/graphic.cxx @@ -0,0 +1,300 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <rtl/uuid.h> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <com/sun/star/graphic/GraphicType.hpp> +#include <com/sun/star/graphic/XGraphicTransformer.hpp> +#include <vcl/graph.hxx> +#include "graphic.hxx" + +using namespace com::sun::star; + +namespace unographic { + +// ------------------- +// - GraphicProvider - +// ------------------- + +Graphic::Graphic() : + mpGraphic( NULL ) +{ +} + +// ------------------------------------------------------------------------------ + +Graphic::~Graphic() + throw() +{ + delete mpGraphic; +} + +// ------------------------------------------------------------------------------ + +void Graphic::init( const ::Graphic& rGraphic ) + throw() +{ + delete mpGraphic; + mpGraphic = new ::Graphic( rGraphic ); + ::unographic::GraphicDescriptor::init( *mpGraphic ); +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType ) + throw( uno::RuntimeException ) +{ + uno::Any aAny; + if( rType == ::getCppuType((const uno::Reference< graphic::XGraphic >*)0) ) + aAny <<= uno::Reference< graphic::XGraphic >( this ); + else if( rType == ::getCppuType((const uno::Reference< awt::XBitmap >*)0) ) + aAny <<= uno::Reference< awt::XBitmap >( this ); + else if( rType == ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0) ) + aAny <<= uno::Reference< lang::XUnoTunnel >(this); + else + aAny <<= ::unographic::GraphicDescriptor::queryAggregation( rType ); + + return aAny ; +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + ::com::sun::star::uno::Any aReturn = ::unographic::GraphicDescriptor::queryInterface( rType ); + if ( !aReturn.hasValue() ) + aReturn = ::cppu::queryInterface ( rType, static_cast< graphic::XGraphicTransformer*>( this ) ); + return aReturn; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Graphic::acquire() + throw() +{ + ::unographic::GraphicDescriptor::acquire(); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Graphic::release() throw() +{ + ::unographic::GraphicDescriptor::release(); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static() + throw(uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + static uno::Sequence< sal_Int8 > aId; + + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); + } + + return aId; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString Graphic::getImplementationName_Static() + throw() +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.Graphic" ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > Graphic::getSupportedServiceNames_Static() + throw() +{ + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.Graphic" ) ); + + return aSeq; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Graphic::getImplementationName() + throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Graphic::supportsService( const ::rtl::OUString& rServiceName ) + throw( uno::RuntimeException ) +{ + if( ::unographic::GraphicDescriptor::supportsService( rServiceName ) ) + return true; + else + { + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); + + for( int i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == rServiceName ) + return true; + + return false; + } +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL Graphic::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aRet( ::unographic::GraphicDescriptor::getSupportedServiceNames() ); + uno::Sequence< ::rtl::OUString > aNew( getSupportedServiceNames_Static() ); + sal_Int32 nOldCount = aRet.getLength(); + + aRet.realloc( nOldCount + aNew.getLength() ); + + for( sal_Int32 i = 0; i < aNew.getLength(); ++i ) + aRet[ nOldCount++ ] = aNew[ i ]; + + return aRet; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes() + throw(uno::RuntimeException) +{ + uno::Sequence< uno::Type > aRet( ::unographic::GraphicDescriptor::getTypes() ); + sal_Int32 nOldCount = aRet.getLength(); + + aRet.realloc( nOldCount + 2 ); + aRet[ nOldCount ] = ::getCppuType((const uno::Reference< graphic::XGraphic>*)0); + aRet[ nOldCount+1 ] = ::getCppuType((const uno::Reference< awt::XBitmap>*)0); + + return aRet; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() + throw(uno::RuntimeException) +{ + return getImplementationId_Static(); +} + +// ------------------------------------------------------------------------------ + +::sal_Int8 SAL_CALL Graphic::getType() + throw (uno::RuntimeException) +{ + ::sal_Int8 cRet = graphic::GraphicType::EMPTY; + + if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + cRet = ( ( mpGraphic->GetType() == GRAPHIC_BITMAP ) ? graphic::GraphicType::PIXEL : graphic::GraphicType::VECTOR ); + + return cRet; +} + +//---------------------------------------------------------------------- +// XBitmap +//---------------------------------------------------------------------- + +awt::Size SAL_CALL Graphic::getSize( ) throw (uno::RuntimeException) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + ::Size aVclSize; + if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + aVclSize = mpGraphic->GetSizePixel(); + + return awt::Size( aVclSize.Width(), aVclSize.Height() ); +} + +//---------------------------------------------------------------------- + +uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeException) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + { + SvMemoryStream aMem; + aMem << mpGraphic->GetBitmapEx().GetBitmap(); + return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() ); + } + else + { + return uno::Sequence<sal_Int8>(); + } +} + +//---------------------------------------------------------------------- + +uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getMaskDIB( ) throw (uno::RuntimeException) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + { + SvMemoryStream aMem; + aMem << mpGraphic->GetBitmapEx().GetMask(); + return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() ); + } + else + { + return uno::Sequence<sal_Int8>(); + } +} + +//---------------------------------------------------------------------- +const ::Graphic* Graphic::getImplementation( const uno::Reference< uno::XInterface >& rxIFace ) + throw() +{ + uno::Reference< lang::XUnoTunnel > xTunnel( rxIFace, uno::UNO_QUERY ); + return( xTunnel.is() ? reinterpret_cast< ::Graphic* >( xTunnel->getSomething( getImplementationId_Static() ) ) : NULL ); +} + +//---------------------------------------------------------------------- +sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId ) + throw( uno::RuntimeException ) +{ + return( ( rId.getLength() == 16 && 0 == rtl_compareMemory( getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? + reinterpret_cast< sal_Int64 >( mpGraphic ) : + 0 ); +} + +} diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx new file mode 100644 index 000000000000..1a6594a3e543 --- /dev/null +++ b/svtools/source/graphic/graphic.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GOODIES_GRAPHIC_HXX +#define _GOODIES_GRAPHIC_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/awt/XBitmap.hpp> + +#include "descriptor.hxx" +#include "transformer.hxx" + +using namespace com::sun::star; + +class Graphic; + +namespace unographic { + +// ------------------- +// - GraphicProvider - +// ------------------- + +class Graphic : public ::com::sun::star::graphic::XGraphic, + public ::com::sun::star::awt::XBitmap, + public ::com::sun::star::lang::XUnoTunnel, + public ::unographic::GraphicDescriptor, + public ::unographic::GraphicTransformer +{ +public: + + Graphic(); + ~Graphic() throw(); + + using unographic::GraphicDescriptor::init; + void init( const ::Graphic& rGraphic ) throw(); + + static const ::Graphic* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + static ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::rtl::OUString getImplementationName_Static() throw(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + +protected: + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XGraphic + virtual ::sal_Int8 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException); + + // XBitmap + virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getDIB( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getMaskDIB( ) throw (::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException); + +private: + + ::Graphic* mpGraphic; +}; + +} + +#endif diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx new file mode 100644 index 000000000000..f29b34b66743 --- /dev/null +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <comphelper/servicedecl.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/graphic/XGraphicObject.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <svtools/grfmgr.hxx> + +using namespace com::sun::star; + +namespace unographic { + +typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE; + // Simple uno wrapper around the GraphicObject class to allow basic + // access. ( and solves a horrible cyclic link problem between + // goodies/toolkit/extensions ) +class GObjectImpl : public GObjectAccess_BASE +{ + ::osl::Mutex m_aMutex; + std::auto_ptr< GraphicObject > mpGObject; +public: + GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException); + + // XGraphicObject + virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException); + virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException); + ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException); +}; + +GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException) +{ + if ( args.getLength() == 1 ) + { + rtl::OUString sId; + if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 ) + throw lang::IllegalArgumentException(); + ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 ); + mpGObject.reset( new GraphicObject( bsId ) ); + } + else + mpGObject.reset( new GraphicObject() ); +} + +uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !mpGObject.get() ) + throw uno::RuntimeException(); + return mpGObject->GetGraphic().GetXGraphic(); +} + +void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !mpGObject.get() ) + throw uno::RuntimeException(); + Graphic aGraphic( _graphic ); + mpGObject->SetGraphic( aGraphic ); +} + +::rtl::OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + rtl::OUString sId; + if ( mpGObject.get() ) + sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US ); + return sId; +} + + +namespace sdecl = comphelper::service_decl; +sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI; +extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" ); + +} diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx new file mode 100644 index 000000000000..757be42a104c --- /dev/null +++ b/svtools/source/graphic/grfattr.cxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <tools/vcompat.hxx> +#include <svtools/grfmgr.hxx> + +// --------------- +// - GraphicAttr - +// --------------- + +GraphicAttr::GraphicAttr() : + mfGamma ( 1.0 ), + mnMirrFlags ( 0 ), + mnLeftCrop ( 0 ), + mnTopCrop ( 0 ), + mnRightCrop ( 0 ), + mnBottomCrop ( 0 ), + mnRotate10 ( 0 ), + mnContPercent ( 0 ), + mnLumPercent ( 0 ), + mnRPercent ( 0 ), + mnGPercent ( 0 ), + mnBPercent ( 0 ), + mbInvert ( FALSE ), + mcTransparency ( 0 ), + meDrawMode ( GRAPHICDRAWMODE_STANDARD ) +{ +} + +// ------------------------------------------------------------------------ + +GraphicAttr::~GraphicAttr() +{ +} + +// ------------------------------------------------------------------------ + +BOOL GraphicAttr::operator==( const GraphicAttr& rAttr ) const +{ + return( ( mfGamma == rAttr.mfGamma ) && + ( mnMirrFlags == rAttr.mnMirrFlags ) && + ( mnLeftCrop == rAttr.mnLeftCrop ) && + ( mnTopCrop == rAttr.mnTopCrop ) && + ( mnRightCrop == rAttr.mnRightCrop ) && + ( mnBottomCrop == rAttr.mnBottomCrop ) && + ( mnRotate10 == rAttr.mnRotate10 ) && + ( mnContPercent == rAttr.mnContPercent ) && + ( mnLumPercent == rAttr.mnLumPercent ) && + ( mnRPercent == rAttr.mnRPercent ) && + ( mnGPercent == rAttr.mnGPercent ) && + ( mnBPercent == rAttr.mnBPercent ) && + ( mbInvert == rAttr.mbInvert ) && + ( mcTransparency == rAttr.mcTransparency ) && + ( meDrawMode == rAttr.meDrawMode ) ); +} + +// ------------------------------------------------------------------------ + +SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr ) +{ + VersionCompat aCompat( rIStm, STREAM_READ ); + sal_uInt32 nTmp32; + UINT16 nTmp16; + + rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10; + rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent; + rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16; + rAttr.meDrawMode = (GraphicDrawMode) nTmp16; + + if( aCompat.GetVersion() >= 2 ) + { + rIStm >> rAttr.mnLeftCrop >> rAttr.mnTopCrop >> rAttr.mnRightCrop >> rAttr.mnBottomCrop; + } + + return rIStm; +} + +// ------------------------------------------------------------------------ + +SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr ) +{ + VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); + const sal_uInt32 nTmp32 = 0; + + rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10; + rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent; + rOStm << rAttr.mbInvert << rAttr.mcTransparency << (UINT16) rAttr.meDrawMode; + rOStm << rAttr.mnLeftCrop << rAttr.mnTopCrop << rAttr.mnRightCrop << rAttr.mnBottomCrop; + + return rOStm; +} diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx new file mode 100644 index 000000000000..41240c95d113 --- /dev/null +++ b/svtools/source/graphic/grfcache.cxx @@ -0,0 +1,1062 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <vos/timer.hxx> +#include <tools/debug.hxx> +#include <vcl/outdev.hxx> +#include <tools/poly.hxx> +#include "grfcache.hxx" + +#include <memory> + +// ----------- +// - Defines - +// ----------- + +#define RELEASE_TIMEOUT 10000 +#define MAX_BMP_EXTENT 4096 + +// ----------- +// - statics - +// ----------- + +static const char aHexData[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + +// ------------- +// - GraphicID - +// ------------- + +class GraphicID +{ +private: + + sal_uInt32 mnID1; + sal_uInt32 mnID2; + sal_uInt32 mnID3; + sal_uInt32 mnID4; + + GraphicID(); + +public: + + + GraphicID( const GraphicObject& rObj ); + ~GraphicID() {} + + BOOL operator==( const GraphicID& rID ) const + { + return( rID.mnID1 == mnID1 && rID.mnID2 == mnID2 && + rID.mnID3 == mnID3 && rID.mnID4 == mnID4 ); + } + + ByteString GetIDString() const; + BOOL IsEmpty() const { return( 0 == mnID4 ); } +}; + +// ----------------------------------------------------------------------------- + +GraphicID::GraphicID( const GraphicObject& rObj ) +{ + const Graphic& rGraphic = rObj.GetGraphic(); + + mnID1 = ( (ULONG) rGraphic.GetType() ) << 28; + + switch( rGraphic.GetType() ) + { + case( GRAPHIC_BITMAP ): + { + if( rGraphic.IsAnimated() ) + { + const Animation aAnimation( rGraphic.GetAnimation() ); + + mnID1 |= ( aAnimation.Count() & 0x0fffffff ); + mnID2 = aAnimation.GetDisplaySizePixel().Width(); + mnID3 = aAnimation.GetDisplaySizePixel().Height(); + mnID4 = rGraphic.GetChecksum(); + } + else + { + const BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + + mnID1 |= ( ( ( (ULONG) aBmpEx.GetTransparentType() << 8 ) | ( aBmpEx.IsAlpha() ? 1 : 0 ) ) & 0x0fffffff ); + mnID2 = aBmpEx.GetSizePixel().Width(); + mnID3 = aBmpEx.GetSizePixel().Height(); + mnID4 = rGraphic.GetChecksum(); + } + } + break; + + case( GRAPHIC_GDIMETAFILE ): + { + const GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); + + mnID1 |= ( aMtf.GetActionCount() & 0x0fffffff ); + mnID2 = aMtf.GetPrefSize().Width(); + mnID3 = aMtf.GetPrefSize().Height(); + mnID4 = rGraphic.GetChecksum(); + } + break; + + default: + mnID2 = mnID3 = mnID4 = 0; + break; + } +} + +// ----------------------------------------------------------------------------- + +ByteString GraphicID::GetIDString() const +{ + ByteString aHexStr; + sal_Char* pStr = aHexStr.AllocBuffer( 32 ); + sal_Int32 nShift; + + for( nShift = 28; nShift >= 0; nShift -= 4 ) + *pStr++ = aHexData[ ( mnID1 >> (sal_uInt32) nShift ) & 0xf ]; + + for( nShift = 28; nShift >= 0; nShift -= 4 ) + *pStr++ = aHexData[ ( mnID2 >> (sal_uInt32) nShift ) & 0xf ]; + + for( nShift = 28; nShift >= 0; nShift -= 4 ) + *pStr++ = aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ]; + + for( nShift = 28; nShift >= 0; nShift -= 4 ) + *pStr++ = aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ]; + + return aHexStr; +} + +// --------------------- +// - GraphicCacheEntry - +// --------------------- + +class GraphicCacheEntry +{ +private: + + List maGraphicObjectList; + GraphicID maID; + GfxLink maGfxLink; + BitmapEx* mpBmpEx; + GDIMetaFile* mpMtf; + Animation* mpAnimation; + BOOL mbSwappedAll; + + BOOL ImplInit( const GraphicObject& rObj ); + BOOL ImplMatches( const GraphicObject& rObj ) const { return( GraphicID( rObj ) == maID ); } + void ImplFillSubstitute( Graphic& rSubstitute ); + +public: + + GraphicCacheEntry( const GraphicObject& rObj ); + ~GraphicCacheEntry(); + + const GraphicID& GetID() const { return maID; } + + void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ); + BOOL ReleaseGraphicObjectReference( const GraphicObject& rObj ); + ULONG GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); } + BOOL HasGraphicObjectReference( const GraphicObject& rObj ); + + void TryToSwapIn(); + void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); + BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); +}; + +// ----------------------------------------------------------------------------- + +GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) : + maID ( rObj ), + mpBmpEx ( NULL ), + mpMtf ( NULL ), + mpAnimation ( NULL ), + mbSwappedAll ( !ImplInit( rObj ) ) +{ + maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); +} + +// ----------------------------------------------------------------------------- + +GraphicCacheEntry::~GraphicCacheEntry() +{ + DBG_ASSERT( !maGraphicObjectList.Count(), "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" ); + + delete mpBmpEx; + delete mpMtf; + delete mpAnimation; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) +{ + BOOL bRet; + + if( !rObj.IsSwappedOut() ) + { + const Graphic& rGraphic = rObj.GetGraphic(); + + if( mpBmpEx ) + delete mpBmpEx, mpBmpEx = NULL; + + if( mpMtf ) + delete mpMtf, mpMtf = NULL; + + if( mpAnimation ) + delete mpAnimation, mpAnimation = NULL; + + switch( rGraphic.GetType() ) + { + case( GRAPHIC_BITMAP ): + { + if( rGraphic.IsAnimated() ) + mpAnimation = new Animation( rGraphic.GetAnimation() ); + else + mpBmpEx = new BitmapEx( rGraphic.GetBitmapEx() ); + } + break; + + case( GRAPHIC_GDIMETAFILE ): + { + mpMtf = new GDIMetaFile( rGraphic.GetGDIMetaFile() ); + } + break; + + default: + DBG_ASSERT( GetID().IsEmpty(), "GraphicCacheEntry::ImplInit: Could not initialize graphic! (=>KA)" ); + break; + } + + if( rGraphic.IsLink() ) + maGfxLink = ( (Graphic&) rGraphic ).GetLink(); + else + maGfxLink = GfxLink(); + + bRet = TRUE; + } + else + bRet = FALSE; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) +{ + // create substitute for graphic; + const Size aPrefSize( rSubstitute.GetPrefSize() ); + const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); + const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); + const String aDocFileName( rSubstitute.GetDocFileName() ); + const ULONG nDocFilePos = rSubstitute.GetDocFilePos(); + const GraphicType eOldType = rSubstitute.GetType(); + const BOOL bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); + + if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) ) + maGfxLink = rSubstitute.GetLink(); + + if( mpBmpEx ) + rSubstitute = *mpBmpEx; + else if( mpAnimation ) + rSubstitute = *mpAnimation; + else if( mpMtf ) + rSubstitute = *mpMtf; + else + rSubstitute.Clear(); + + if( eOldType != GRAPHIC_NONE ) + { + rSubstitute.SetPrefSize( aPrefSize ); + rSubstitute.SetPrefMapMode( aPrefMapMode ); + rSubstitute.SetAnimationNotifyHdl( aAnimationNotifyHdl ); + rSubstitute.SetDocFileName( aDocFileName, nDocFilePos ); + } + + if( GFX_LINK_TYPE_NONE != maGfxLink.GetType() ) + rSubstitute.SetLink( maGfxLink ); + + if( bDefaultType ) + rSubstitute.SetDefaultType(); +} + +// ----------------------------------------------------------------------------- + +void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ) +{ + if( mbSwappedAll ) + mbSwappedAll = !ImplInit( rObj ); + + ImplFillSubstitute( rSubstitute ); + maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) +{ + BOOL bRet = FALSE; + + for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) + { + if( &rObj == (GraphicObject*) pObj ) + { + maGraphicObjectList.Remove( pObj ); + bRet = TRUE; + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj ) +{ + BOOL bRet = FALSE; + + for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) + if( &rObj == (GraphicObject*) pObj ) + bRet = TRUE; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicCacheEntry::TryToSwapIn() +{ + if( mbSwappedAll && maGraphicObjectList.Count() ) + ( (GraphicObject*) maGraphicObjectList.First() )->FireSwapInRequest(); +} + +// ----------------------------------------------------------------------------- + +void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*/ ) +{ + mbSwappedAll = TRUE; + + for( void* pObj = maGraphicObjectList.First(); mbSwappedAll && pObj; pObj = maGraphicObjectList.Next() ) + if( !( (GraphicObject*) pObj )->IsSwappedOut() ) + mbSwappedAll = FALSE; + + if( mbSwappedAll ) + { + delete mpBmpEx, mpBmpEx = NULL; + delete mpMtf, mpMtf = NULL; + delete mpAnimation, mpAnimation = NULL; + } +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) +{ + BOOL bRet; + + if( !mbSwappedAll && rObj.IsSwappedOut() ) + { + ImplFillSubstitute( rSubstitute ); + bRet = TRUE; + } + else + bRet = FALSE; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicCacheEntry::GraphicObjectWasSwappedIn( const GraphicObject& rObj ) +{ + if( mbSwappedAll ) + mbSwappedAll = !ImplInit( rObj ); +} + +// ---------------------------- +// - GraphicDisplayCacheEntry - +// ---------------------------- + +class GraphicDisplayCacheEntry +{ +private: + + ::vos::TTimeValue maReleaseTime; + const GraphicCacheEntry* mpRefCacheEntry; + GDIMetaFile* mpMtf; + BitmapEx* mpBmpEx; + GraphicAttr maAttr; + Size maOutSizePix; + ULONG mnCacheSize; + ULONG mnOutDevDrawMode; + USHORT mnOutDevBitCount; + +public: + + static ULONG GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ); + +public: + + GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry, + OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const BitmapEx& rBmpEx ) : + mpRefCacheEntry( pRefCacheEntry ), + mpMtf( NULL ), mpBmpEx( new BitmapEx( rBmpEx ) ), + maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ), + mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ), + mnOutDevDrawMode( pOut->GetDrawMode() ), + mnOutDevBitCount( pOut->GetBitCount() ) + { + } + + GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry, + OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const GDIMetaFile& rMtf ) : + mpRefCacheEntry( pRefCacheEntry ), + mpMtf( new GDIMetaFile( rMtf ) ), mpBmpEx( NULL ), + maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ), + mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ), + mnOutDevDrawMode( pOut->GetDrawMode() ), + mnOutDevBitCount( pOut->GetBitCount() ) + { + } + + + ~GraphicDisplayCacheEntry(); + + const GraphicAttr& GetAttr() const { return maAttr; } + const Size& GetOutputSizePixel() const { return maOutSizePix; } + ULONG GetCacheSize() const { return mnCacheSize; } + const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; } + ULONG GetOutDevDrawMode() const { return mnOutDevDrawMode; } + USHORT GetOutDevBitCount() const { return mnOutDevBitCount; } + + void SetReleaseTime( const ::vos::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; } + const ::vos::TTimeValue& GetReleaseTime() const { return maReleaseTime; } + + BOOL Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel, + const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const + { + // #i46805# Additional match + // criteria: outdev draw mode and + // bit count. One cannot reuse + // this cache object, if it's + // e.g. generated for + // DRAWMODE_GRAYBITMAP. + return( ( pCacheEntry == mpRefCacheEntry ) && + ( maAttr == rAttr ) && + ( ( maOutSizePix == rSzPixel ) || ( !maOutSizePix.Width() && !maOutSizePix.Height() ) ) && + ( pOut->GetBitCount() == mnOutDevBitCount ) && + ( pOut->GetDrawMode() == mnOutDevDrawMode ) ); + } + + void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const; +}; + +// ----------------------------------------------------------------------------- + +ULONG GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Point& /*rPt*/, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) +{ + const Graphic& rGraphic = rObj.GetGraphic(); + const GraphicType eType = rGraphic.GetType(); + ULONG nNeededSize; + + if( GRAPHIC_BITMAP == eType ) + { + const Size aOutSizePix( pOut->LogicToPixel( rSz ) ); + const long nBitCount = pOut->GetBitCount(); + + if( ( aOutSizePix.Width() > MAX_BMP_EXTENT ) || + ( aOutSizePix.Height() > MAX_BMP_EXTENT ) ) + { + nNeededSize = ULONG_MAX; + } + else if( nBitCount ) + { + nNeededSize = aOutSizePix.Width() * aOutSizePix.Height() * nBitCount / 8; + + if( rObj.IsTransparent() || ( rAttr.GetRotation() % 3600 ) ) + nNeededSize += nNeededSize / nBitCount; + } + else + { + DBG_ERROR( "GraphicDisplayCacheEntry::GetNeededSize(): pOut->GetBitCount() == 0" ); + nNeededSize = 256000; + } + } + else if( GRAPHIC_GDIMETAFILE == eType ) + nNeededSize = rGraphic.GetSizeBytes(); + else + nNeededSize = 0; + + return nNeededSize; +} + +// ----------------------------------------------------------------------------- + +GraphicDisplayCacheEntry::~GraphicDisplayCacheEntry() +{ + if( mpMtf ) + delete mpMtf; + + if( mpBmpEx ) + delete mpBmpEx; +} + +// ----------------------------------------------------------------------------- + +void GraphicDisplayCacheEntry::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const +{ + if( mpMtf ) + GraphicManager::ImplDraw( pOut, rPt, rSz, *mpMtf, maAttr ); + else if( mpBmpEx ) + { + if( maAttr.IsRotated() ) + { + Polygon aPoly( Rectangle( rPt, rSz ) ); + + aPoly.Rotate( rPt, maAttr.GetRotation() % 3600 ); + const Rectangle aRotBoundRect( aPoly.GetBoundRect() ); + pOut->DrawBitmapEx( aRotBoundRect.TopLeft(), aRotBoundRect.GetSize(), *mpBmpEx ); + } + else + pOut->DrawBitmapEx( rPt, rSz, *mpBmpEx ); + } +} + +// ----------------------- +// - GraphicCache - +// ----------------------- + +GraphicCache::GraphicCache( GraphicManager& rMgr, ULONG nDisplayCacheSize, ULONG nMaxObjDisplayCacheSize ) : + mrMgr ( rMgr ), + mnReleaseTimeoutSeconds ( 0UL ), + mnMaxDisplaySize ( nDisplayCacheSize ), + mnMaxObjDisplaySize ( nMaxObjDisplayCacheSize ), + mnUsedDisplaySize ( 0UL ) +{ + maReleaseTimer.SetTimeoutHdl( LINK( this, GraphicCache, ReleaseTimeoutHdl ) ); + maReleaseTimer.SetTimeout( RELEASE_TIMEOUT ); + maReleaseTimer.Start(); +} + +// ----------------------------------------------------------------------------- + +GraphicCache::~GraphicCache() +{ + DBG_ASSERT( !maGraphicCache.Count(), "GraphicCache::~GraphicCache(): there are some GraphicObjects in cache" ); + DBG_ASSERT( !maDisplayCache.Count(), "GraphicCache::~GraphicCache(): there are some GraphicObjects in display cache" ); +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, + const ByteString* pID, const GraphicObject* pCopyObj ) +{ + BOOL bInserted = FALSE; + + if( !rObj.IsSwappedOut() && + ( pID || ( pCopyObj && ( pCopyObj->GetType() != GRAPHIC_NONE ) ) || ( rObj.GetType() != GRAPHIC_NONE ) ) ) + { + if( pCopyObj ) + { + GraphicCacheEntry* pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.First() ); + + while( !bInserted && pEntry ) + { + if( pEntry->HasGraphicObjectReference( *pCopyObj ) ) + { + pEntry->AddGraphicObjectReference( rObj, rSubstitute ); + bInserted = TRUE; + } + else + { + pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.Next() ); + } + } + } + + if( !bInserted ) + { + GraphicCacheEntry* pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.First() ); + ::std::auto_ptr< GraphicID > apID; + + if( !pID ) + { + apID.reset( new GraphicID( rObj ) ); + } + + while( !bInserted && pEntry ) + { + const GraphicID& rEntryID = pEntry->GetID(); + + if( pID ) + { + if( rEntryID.GetIDString() == *pID ) + { + pEntry->TryToSwapIn(); + + // since pEntry->TryToSwapIn can modify our current list, we have to + // iterate from beginning to add a reference to the appropriate + // CacheEntry object; after this, quickly jump out of the outer iteration + for( pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.First() ); + !bInserted && pEntry; + pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.Next() ) ) + { + const GraphicID& rID = pEntry->GetID(); + + if( rID.GetIDString() == *pID ) + { + pEntry->AddGraphicObjectReference( rObj, rSubstitute ); + bInserted = TRUE; + } + } + + if( !bInserted ) + { + maGraphicCache.Insert( new GraphicCacheEntry( rObj ), LIST_APPEND ); + bInserted = TRUE; + } + } + } + else + { + if( rEntryID == *apID ) + { + pEntry->AddGraphicObjectReference( rObj, rSubstitute ); + bInserted = TRUE; + } + } + + if( !bInserted ) + pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.Next() ); + } + } + } + + if( !bInserted ) + maGraphicCache.Insert( new GraphicCacheEntry( rObj ), LIST_APPEND ); +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) +{ + // Release cached object + GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First(); + BOOL bRemoved = FALSE; + + while( !bRemoved && pEntry ) + { + bRemoved = pEntry->ReleaseGraphicObjectReference( rObj ); + + if( bRemoved ) + { + if( 0 == pEntry->GetGraphicObjectReferenceCount() ) + { + // if graphic cache entry has no more references, + // the corresponding display cache object can be removed + GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + + while( pDisplayEntry ) + { + if( pDisplayEntry->GetReferencedCacheEntry() == pEntry ) + { + mnUsedDisplaySize -= pDisplayEntry->GetCacheSize(); + maDisplayCache.Remove( pDisplayEntry ); + delete pDisplayEntry; + pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.GetCurObject(); + } + else + pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.Next(); + } + + // delete graphic cache entry + maGraphicCache.Remove( (void*) pEntry ); + delete pEntry; + } + } + else + pEntry = (GraphicCacheEntry*) maGraphicCache.Next(); + } + + DBG_ASSERT( bRemoved, "GraphicCache::ReleaseGraphicObject(...): GraphicObject not found in cache" ); +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::GraphicObjectWasSwappedOut( const GraphicObject& rObj ) +{ + // notify cache that rObj is swapped out (and can thus be pruned + // from the cache) + GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj ); + + if( pEntry ) + pEntry->GraphicObjectWasSwappedOut( rObj ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) +{ + GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj ); + + if( !pEntry ) + return FALSE; + + return pEntry->FillSwappedGraphicObject( rObj, rSubstitute ); +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::GraphicObjectWasSwappedIn( const GraphicObject& rObj ) +{ + GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj ); + + if( pEntry ) + { + if( pEntry->GetID().IsEmpty() ) + { + ReleaseGraphicObject( rObj ); + AddGraphicObject( rObj, (Graphic&) rObj.GetGraphic(), NULL, NULL ); + } + else + pEntry->GraphicObjectWasSwappedIn( rObj ); + } +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::SetMaxDisplayCacheSize( ULONG nNewCacheSize ) +{ + mnMaxDisplaySize = nNewCacheSize; + + if( GetMaxDisplayCacheSize() < GetUsedDisplayCacheSize() ) + ImplFreeDisplayCacheSpace( GetUsedDisplayCacheSize() - GetMaxDisplayCacheSize() ); +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::SetMaxObjDisplayCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached ) +{ + const BOOL bDestroy = ( bDestroyGreaterCached && ( nNewMaxObjSize < mnMaxObjDisplaySize ) ); + + mnMaxObjDisplaySize = Min( nNewMaxObjSize, mnMaxDisplaySize ); + + if( bDestroy ) + { + GraphicDisplayCacheEntry* pCacheObj = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + + while( pCacheObj ) + { + if( pCacheObj->GetCacheSize() > mnMaxObjDisplaySize ) + { + mnUsedDisplaySize -= pCacheObj->GetCacheSize(); + maDisplayCache.Remove( pCacheObj ); + delete pCacheObj; + pCacheObj = (GraphicDisplayCacheEntry*) maDisplayCache.GetCurObject(); + } + else + pCacheObj = (GraphicDisplayCacheEntry*) maDisplayCache.Next(); + } + } +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::SetCacheTimeout( ULONG nTimeoutSeconds ) +{ + if( mnReleaseTimeoutSeconds != nTimeoutSeconds ) + { + GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + ::vos::TTimeValue aReleaseTime; + + if( ( mnReleaseTimeoutSeconds = nTimeoutSeconds ) != 0 ) + { + osl_getSystemTime( &aReleaseTime ); + aReleaseTime.addTime( ::vos::TTimeValue( nTimeoutSeconds, 0 ) ); + } + + while( pDisplayEntry ) + { + pDisplayEntry->SetReleaseTime( aReleaseTime ); + pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.Next(); + } + } +} + +// ----------------------------------------------------------------------------- + +void GraphicCache::ClearDisplayCache() +{ + for( void* pObj = maDisplayCache.First(); pObj; pObj = maDisplayCache.Next() ) + delete (GraphicDisplayCacheEntry*) pObj; + + maDisplayCache.Clear(); + mnUsedDisplaySize = 0UL; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) const +{ + return( GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) <= + GetMaxObjDisplayCacheSize() ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) const +{ + const Point aPtPixel( pOut->LogicToPixel( rPt ) ); + const Size aSzPixel( pOut->LogicToPixel( rSz ) ); + const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + //GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) ( (GraphicCache*) this )->maDisplayCache.First(); // -Wall removed .... + BOOL bFound = FALSE; + + if( pCacheEntry ) + { + for( long i = 0, nCount = maDisplayCache.Count(); !bFound && ( i < nCount ); i++ ) + if( ( (GraphicDisplayCacheEntry*) maDisplayCache.GetObject( i ) )->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) + bFound = TRUE; + } + + return bFound; +} + +// ----------------------------------------------------------------------------- + +ByteString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const +{ + ByteString aRet; + GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + + // ensure that the entry is correctly initialized (it has to be read at least once) + if( pEntry && pEntry->GetID().IsEmpty() ) + pEntry->TryToSwapIn(); + + // do another call to ImplGetCacheEntry in case of modified entry list + pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + + if( pEntry ) + aRet = pEntry->GetID().GetIDString(); + + return aRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const BitmapEx& rBmpEx ) +{ + const ULONG nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ); + BOOL bRet = FALSE; + + if( nNeededSize <= GetMaxObjDisplayCacheSize() ) + { + if( nNeededSize > GetFreeDisplayCacheSize() ) + ImplFreeDisplayCacheSpace( nNeededSize - GetFreeDisplayCacheSize() ); + + GraphicDisplayCacheEntry* pNewEntry = new GraphicDisplayCacheEntry( ImplGetCacheEntry( rObj ), + pOut, rPt, rSz, rObj, rAttr, rBmpEx ); + + if( GetCacheTimeout() ) + { + ::vos::TTimeValue aReleaseTime; + + osl_getSystemTime( &aReleaseTime ); + aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + pNewEntry->SetReleaseTime( aReleaseTime ); + } + + maDisplayCache.Insert( pNewEntry, LIST_APPEND ); + mnUsedDisplaySize += pNewEntry->GetCacheSize(); + bRet = TRUE; + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const GDIMetaFile& rMtf ) +{ + const ULONG nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ); + BOOL bRet = FALSE; + + if( nNeededSize <= GetMaxObjDisplayCacheSize() ) + { + if( nNeededSize > GetFreeDisplayCacheSize() ) + ImplFreeDisplayCacheSpace( nNeededSize - GetFreeDisplayCacheSize() ); + + GraphicDisplayCacheEntry* pNewEntry = new GraphicDisplayCacheEntry( ImplGetCacheEntry( rObj ), + pOut, rPt, rSz, rObj, rAttr, rMtf ); + + if( GetCacheTimeout() ) + { + ::vos::TTimeValue aReleaseTime; + + osl_getSystemTime( &aReleaseTime ); + aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + pNewEntry->SetReleaseTime( aReleaseTime ); + } + + maDisplayCache.Insert( pNewEntry, LIST_APPEND ); + mnUsedDisplaySize += pNewEntry->GetCacheSize(); + bRet = TRUE; + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) +{ + const Point aPtPixel( pOut->LogicToPixel( rPt ) ); + const Size aSzPixel( pOut->LogicToPixel( rSz ) ); + const GraphicCacheEntry* pCacheEntry = ImplGetCacheEntry( rObj ); + GraphicDisplayCacheEntry* pDisplayCacheEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + BOOL bRet = FALSE; + + while( !bRet && pDisplayCacheEntry ) + { + if( pDisplayCacheEntry->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) + { + ::vos::TTimeValue aReleaseTime; + + // put found object at last used position + maDisplayCache.Insert( maDisplayCache.Remove( pDisplayCacheEntry ), LIST_APPEND ); + + if( GetCacheTimeout() ) + { + osl_getSystemTime( &aReleaseTime ); + aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + } + + pDisplayCacheEntry->SetReleaseTime( aReleaseTime ); + bRet = TRUE; + } + else + pDisplayCacheEntry = (GraphicDisplayCacheEntry*) maDisplayCache.Next(); + } + + if( bRet ) + pDisplayCacheEntry->Draw( pOut, rPt, rSz ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicCache::ImplFreeDisplayCacheSpace( ULONG nSizeToFree ) +{ + ULONG nFreedSize = 0UL; + + if( nSizeToFree ) + { + void* pObj = maDisplayCache.First(); + + if( nSizeToFree > mnUsedDisplaySize ) + nSizeToFree = mnUsedDisplaySize; + + while( pObj ) + { + GraphicDisplayCacheEntry* pCacheObj = (GraphicDisplayCacheEntry*) pObj; + + nFreedSize += pCacheObj->GetCacheSize(); + mnUsedDisplaySize -= pCacheObj->GetCacheSize(); + maDisplayCache.Remove( pObj ); + delete pCacheObj; + + if( nFreedSize >= nSizeToFree ) + break; + else + pObj = maDisplayCache.GetCurObject(); + } + } + + return( nFreedSize >= nSizeToFree ); +} + +// ----------------------------------------------------------------------------- + +GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const GraphicObject& rObj ) +{ + GraphicCacheEntry* pRet = NULL; + + for( void* pObj = maGraphicCache.First(); !pRet && pObj; pObj = maGraphicCache.Next() ) + if( ( (GraphicCacheEntry*) pObj )->HasGraphicObjectReference( rObj ) ) + pRet = (GraphicCacheEntry*) pObj; + + return pRet; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer ) +{ + pTimer->Stop(); + + ::vos::TTimeValue aCurTime; + GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + + osl_getSystemTime( &aCurTime ); + + while( pDisplayEntry ) + { + const ::vos::TTimeValue& rReleaseTime = pDisplayEntry->GetReleaseTime(); + + if( !rReleaseTime.isEmpty() && ( rReleaseTime < aCurTime ) ) + { + mnUsedDisplaySize -= pDisplayEntry->GetCacheSize(); + maDisplayCache.Remove( pDisplayEntry ); + delete pDisplayEntry; + pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.GetCurObject(); + } + else + pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.Next(); + } + + pTimer->Start(); + + return 0; +} diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx new file mode 100644 index 000000000000..55309a00827d --- /dev/null +++ b/svtools/source/graphic/grfcache.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GRFCACHE_HXX +#define _GRFCACHE_HXX + +#include <tools/list.hxx> +#include <vcl/graph.hxx> +#include <vcl/timer.hxx> +#include <svtools/grfmgr.hxx> + +// ----------------------- +// - GraphicManagerCache - +// ----------------------- + +class GraphicCacheEntry; + +class GraphicCache +{ +private: + + GraphicManager& mrMgr; + Timer maReleaseTimer; + List maGraphicCache; + List maDisplayCache; + ULONG mnReleaseTimeoutSeconds; + ULONG mnMaxDisplaySize; + ULONG mnMaxObjDisplaySize; + ULONG mnUsedDisplaySize; + + BOOL ImplFreeDisplayCacheSpace( ULONG nSizeToFree ); + GraphicCacheEntry* ImplGetCacheEntry( const GraphicObject& rObj ); + + + DECL_LINK( ReleaseTimeoutHdl, Timer* pTimer ); + +public: + + GraphicCache( GraphicManager& rMgr, + ULONG nDisplayCacheSize = 10000000UL, + ULONG nMaxObjDisplayCacheSize = 2400000UL ); + ~GraphicCache(); + +public: + + void AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, + const ByteString* pID, const GraphicObject* pCopyObj ); + void ReleaseGraphicObject( const GraphicObject& rObj ); + + void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); + BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); + + ByteString GetUniqueID( const GraphicObject& rObj ) const; + +public: + + void SetMaxDisplayCacheSize( ULONG nNewCacheSize ); + ULONG GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; }; + + void SetMaxObjDisplayCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached = FALSE ); + ULONG GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; } + + ULONG GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; } + ULONG GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); } + + void SetCacheTimeout( ULONG nTimeoutSeconds ); + ULONG GetCacheTimeout() const { return mnReleaseTimeoutSeconds; } + + void ClearDisplayCache(); + BOOL IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) const; + BOOL IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ) const; + BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const BitmapEx& rBmpEx ); + BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr, + const GDIMetaFile& rMtf ); + BOOL DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicObject& rObj, const GraphicAttr& rAttr ); +}; + +#endif // _GRFCACHE_HXX diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx new file mode 100644 index 000000000000..53f4a3ed2515 --- /dev/null +++ b/svtools/source/graphic/grfmgr.cxx @@ -0,0 +1,1316 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define ENABLE_BYTESTRING_STREAM_OPERATORS + +#include <algorithm> + +#include <tools/vcompat.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/localfilehelper.hxx> +#include <unotools/tempfile.hxx> +#include <vcl/svapp.hxx> +#include <vcl/cvtgrf.hxx> +#include <vcl/metaact.hxx> +#include <vcl/virdev.hxx> +#include <vcl/salbtype.hxx> +#include <unotools/cacheoptions.hxx> +#include <svtools/grfmgr.hxx> + +// ----------- +// - Defines - +// ----------- + +#define WATERMARK_LUM_OFFSET 50 +#define WATERMARK_CON_OFFSET -70 + +// ----------- +// - statics - +// ----------- + +GraphicManager* GraphicObject::mpGlobalMgr = NULL; + +// --------------------- +// - GrfDirectCacheObj - +// --------------------- + +struct GrfSimpleCacheObj +{ + Graphic maGraphic; + GraphicAttr maAttr; + + GrfSimpleCacheObj( const Graphic& rGraphic, const GraphicAttr& rAttr ) : + maGraphic( rGraphic ), maAttr( rAttr ) {} +}; + +// ----------------- +// - GraphicObject - +// ----------------- + +TYPEINIT1_AUTOFACTORY( GraphicObject, SvDataCopyStream ); + +// ----------------------------------------------------------------------------- + +GraphicObject::GraphicObject( const GraphicManager* pMgr ) : + mpLink ( NULL ), + mpUserData ( NULL ) +{ + ImplConstruct(); + ImplAssignGraphicData(); + ImplSetGraphicManager( pMgr ); +} + +// ----------------------------------------------------------------------------- + +GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr ) : + maGraphic ( rGraphic ), + mpLink ( NULL ), + mpUserData ( NULL ) +{ + ImplConstruct(); + ImplAssignGraphicData(); + ImplSetGraphicManager( pMgr ); +} + +// ----------------------------------------------------------------------------- + +GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, const GraphicManager* pMgr ) : + maGraphic ( rGraphic ), + mpLink ( rLink.Len() ? ( new String( rLink ) ) : NULL ), + mpUserData ( NULL ) +{ + ImplConstruct(); + ImplAssignGraphicData(); + ImplSetGraphicManager( pMgr ); +} + +// ----------------------------------------------------------------------------- + +GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicManager* pMgr ) : + SvDataCopyStream(), + maGraphic ( rGraphicObj.GetGraphic() ), + maAttr ( rGraphicObj.maAttr ), + mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ), + mpUserData ( rGraphicObj.mpUserData ? ( new String( *rGraphicObj.mpUserData ) ) : NULL ) +{ + ImplConstruct(); + ImplAssignGraphicData(); + ImplSetGraphicManager( pMgr, NULL, &rGraphicObj ); +} + +// ----------------------------------------------------------------------------- + +GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr ) : + mpLink ( NULL ), + mpUserData ( NULL ) +{ + ImplConstruct(); + + // assign default properties + ImplAssignGraphicData(); + + ImplSetGraphicManager( pMgr, &rUniqueID ); + + // update properties + ImplAssignGraphicData(); +} + +// ----------------------------------------------------------------------------- + +GraphicObject::~GraphicObject() +{ + if( mpMgr ) + { + mpMgr->ImplUnregisterObj( *this ); + + if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() ) + delete mpGlobalMgr, mpGlobalMgr = NULL; + } + + delete mpSwapOutTimer; + delete mpSwapStreamHdl; + delete mpLink; + delete mpUserData; + delete mpSimpleCache; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ImplConstruct() +{ + mpMgr = NULL; + mpSwapStreamHdl = NULL; + mpSwapOutTimer = NULL; + mpSimpleCache = NULL; + mnAnimationLoopCount = 0; + mbAutoSwapped = FALSE; + mbIsInSwapIn = FALSE; + mbIsInSwapOut = FALSE; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ImplAssignGraphicData() +{ + maPrefSize = maGraphic.GetPrefSize(); + maPrefMapMode = maGraphic.GetPrefMapMode(); + mnSizeBytes = maGraphic.GetSizeBytes(); + meType = maGraphic.GetType(); + mbTransparent = maGraphic.IsTransparent(); + mbAlpha = maGraphic.IsAlpha(); + mbAnimated = maGraphic.IsAnimated(); + mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 ); + + if( maGraphic.GetType() == GRAPHIC_GDIMETAFILE ) + { + const GDIMetaFile& rMtf = GetGraphic().GetGDIMetaFile(); + mbEPS = ( rMtf.GetActionCount() >= 1 ) && ( META_EPS_ACTION == rMtf.GetAction( 0 )->GetType() ); + } + else + mbEPS = FALSE; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const ByteString* pID, const GraphicObject* pCopyObj ) +{ + if( !mpMgr || ( pMgr != mpMgr ) ) + { + if( !pMgr && mpMgr && ( mpMgr == mpGlobalMgr ) ) + return; + else + { + if( mpMgr ) + { + mpMgr->ImplUnregisterObj( *this ); + + if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() ) + delete mpGlobalMgr, mpGlobalMgr = NULL; + } + + if( !pMgr ) + { + if( !mpGlobalMgr ) + { + SvtCacheOptions aCacheOptions; + + mpGlobalMgr = new GraphicManager( aCacheOptions.GetGraphicManagerTotalCacheSize(), + aCacheOptions.GetGraphicManagerObjectCacheSize() ); + mpGlobalMgr->SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() ); + } + + mpMgr = mpGlobalMgr; + } + else + mpMgr = (GraphicManager*) pMgr; + + mpMgr->ImplRegisterObj( *this, maGraphic, pID, pCopyObj ); + } + } +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ImplAutoSwapIn() +{ + if( IsSwappedOut() ) + { + if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) + mbAutoSwapped = FALSE; + else + { + mbIsInSwapIn = TRUE; + + if( maGraphic.SwapIn() ) + mbAutoSwapped = FALSE; + else + { + SvStream* pStream = GetSwapStream(); + + if( GRFMGR_AUTOSWAPSTREAM_NONE != pStream ) + { + if( GRFMGR_AUTOSWAPSTREAM_LINK == pStream ) + { + if( HasLink() ) + { + String aURLStr; + + if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( GetLink(), aURLStr ) ) + { + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURLStr, STREAM_READ ); + + if( pIStm ) + { + (*pIStm) >> maGraphic; + mbAutoSwapped = ( maGraphic.GetType() != GRAPHIC_NONE ); + delete pIStm; + } + } + } + } + else if( GRFMGR_AUTOSWAPSTREAM_TEMP == pStream ) + mbAutoSwapped = !maGraphic.SwapIn(); + else if( GRFMGR_AUTOSWAPSTREAM_LOADED == pStream ) + mbAutoSwapped = maGraphic.IsSwapOut(); + else + { + mbAutoSwapped = !maGraphic.SwapIn( pStream ); + delete pStream; + } + } + else + { + DBG_ASSERT( ( GRAPHIC_NONE == meType ) || ( GRAPHIC_DEFAULT == meType ), + "GraphicObject::ImplAutoSwapIn: could not get stream to swap in graphic! (=>KA)" ); + } + } + + mbIsInSwapIn = FALSE; + + if( !mbAutoSwapped && mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedIn( *this ); + } + } +} + +// ----------------------------------------------------------------------------- +BOOL GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr, + PolyPolygon& rClipPolyPoly, BOOL& bRectClipRegion ) const +{ + BOOL bRet = FALSE; + + if( GetType() != GRAPHIC_NONE ) + { + Polygon aClipPoly( Rectangle( rPt, rSz ) ); + const USHORT nRot10 = pAttr->GetRotation() % 3600; + const Point aOldOrigin( rPt ); + // --> OD 2005-09-30 #i54875# - It's not needed to get the graphic again. +// const Graphic& rGraphic = GetGraphic(); + // <-- + const MapMode aMap100( MAP_100TH_MM ); + Size aSize100; + long nTotalWidth, nTotalHeight; + long nNewLeft, nNewTop, nNewRight, nNewBottom; + double fScale; + + if( nRot10 ) + { + aClipPoly.Rotate( rPt, nRot10 ); + bRectClipRegion = FALSE; + } + else + bRectClipRegion = TRUE; + + rClipPolyPoly = aClipPoly; + + // --> OD 2005-09-30 #i54875# - directly access member <maGraphic> to + // get <PrefSize> and <PrefMapMode>. +// if( rGraphic.GetPrefMapMode() == MAP_PIXEL ) +// aSize100 = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), aMap100 ); +// else +// aSize100 = pOut->LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), aMap100 ); + if( maGraphic.GetPrefMapMode() == MAP_PIXEL ) + aSize100 = Application::GetDefaultDevice()->PixelToLogic( maGraphic.GetPrefSize(), aMap100 ); + else + { + MapMode m(maGraphic.GetPrefMapMode()); + aSize100 = pOut->LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 ); + } + // <-- + + nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop(); + nTotalHeight = aSize100.Height() - pAttr->GetTopCrop() - pAttr->GetBottomCrop(); + + if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) + { + fScale = (double) aSize100.Width() / nTotalWidth; + nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); + nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; + + fScale = (double) rSz.Width() / aSize100.Width(); + rPt.X() += FRound( nNewLeft * fScale ); + rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale ); + + fScale = (double) aSize100.Height() / nTotalHeight; + nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); + nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; + + fScale = (double) rSz.Height() / aSize100.Height(); + rPt.Y() += FRound( nNewTop * fScale ); + rSz.Height() = FRound( ( nNewBottom - nNewTop + 1 ) * fScale ); + + if( nRot10 ) + { + Polygon aOriginPoly( 1 ); + + aOriginPoly[ 0 ] = rPt; + aOriginPoly.Rotate( aOldOrigin, nRot10 ); + rPt = aOriginPoly[ 0 ]; + } + + bRet = TRUE; + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) +{ + if( &rGraphicObj != this ) + { + mpMgr->ImplUnregisterObj( *this ); + + delete mpSwapStreamHdl, mpSwapStreamHdl = NULL; + delete mpSimpleCache, mpSimpleCache = NULL; + delete mpLink; + delete mpUserData; + + maGraphic = rGraphicObj.GetGraphic(); + maAttr = rGraphicObj.maAttr; + mpLink = rGraphicObj.mpLink ? new String( *rGraphicObj.mpLink ) : NULL; + mpUserData = rGraphicObj.mpUserData ? new String( *rGraphicObj.mpUserData ) : NULL; + ImplAssignGraphicData(); + mbAutoSwapped = FALSE; + mpMgr = rGraphicObj.mpMgr; + + mpMgr->ImplRegisterObj( *this, maGraphic, NULL, &rGraphicObj ); + } + + return *this; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::operator==( const GraphicObject& rGraphicObj ) const +{ + return( ( rGraphicObj.maGraphic == maGraphic ) && + ( rGraphicObj.maAttr == maAttr ) && + ( rGraphicObj.GetLink() == GetLink() ) ); +} + +// ------------------------------------------------------------------------ + +void GraphicObject::Load( SvStream& rIStm ) +{ + rIStm >> *this; +} + +// ------------------------------------------------------------------------ + +void GraphicObject::Save( SvStream& rOStm ) +{ + rOStm << *this; +} + +// ------------------------------------------------------------------------ + +void GraphicObject::Assign( const SvDataCopyStream& rCopyStream ) +{ + *this = (const GraphicObject& ) rCopyStream; +} + +// ----------------------------------------------------------------------------- + +ByteString GraphicObject::GetUniqueID() const +{ + if ( !IsInSwapIn() && IsEPS() ) + const_cast<GraphicObject*>(this)->FireSwapInRequest(); + + ByteString aRet; + + if( mpMgr ) + aRet = mpMgr->ImplGetUniqueID( *this ); + + return aRet; +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicObject::GetChecksum() const +{ + return( ( maGraphic.IsSupportedGraphic() && !maGraphic.IsSwapOut() ) ? maGraphic.GetChecksum() : 0 ); +} + +// ----------------------------------------------------------------------------- + +SvStream* GraphicObject::GetSwapStream() const +{ + return( HasSwapStreamHdl() ? (SvStream*) mpSwapStreamHdl->Call( (void*) this ) : GRFMGR_AUTOSWAPSTREAM_NONE ); +} + +// ----------------------------------------------------------------------------- + +// !!! to be removed +ULONG GraphicObject::GetReleaseFromCache() const +{ + return 0; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetAttr( const GraphicAttr& rAttr ) +{ + maAttr = rAttr; + + if( mpSimpleCache && ( mpSimpleCache->maAttr != rAttr ) ) + delete mpSimpleCache, mpSimpleCache = NULL; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetLink() +{ + if( mpLink ) + delete mpLink, mpLink = NULL; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetLink( const String& rLink ) +{ + delete mpLink, mpLink = new String( rLink ); +} + +// ----------------------------------------------------------------------------- + +String GraphicObject::GetLink() const +{ + if( mpLink ) + return *mpLink; + else + return String(); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetUserData() +{ + if( mpUserData ) + delete mpUserData, mpUserData = NULL; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetUserData( const String& rUserData ) +{ + delete mpUserData, mpUserData = new String( rUserData ); +} + +// ----------------------------------------------------------------------------- + +String GraphicObject::GetUserData() const +{ + if( mpUserData ) + return *mpUserData; + else + return String(); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetSwapStreamHdl() +{ + if( mpSwapStreamHdl ) + { + delete mpSwapOutTimer, mpSwapOutTimer = NULL; + delete mpSwapStreamHdl, mpSwapStreamHdl = NULL; + } +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const ULONG nSwapOutTimeout ) +{ + delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl ); + + if( nSwapOutTimeout ) + { + if( !mpSwapOutTimer ) + { + mpSwapOutTimer = new Timer; + mpSwapOutTimer->SetTimeoutHdl( LINK( this, GraphicObject, ImplAutoSwapOutHdl ) ); + } + + mpSwapOutTimer->SetTimeout( nSwapOutTimeout ); + mpSwapOutTimer->Start(); + } + else + delete mpSwapOutTimer, mpSwapOutTimer = NULL; +} + +// ----------------------------------------------------------------------------- + +Link GraphicObject::GetSwapStreamHdl() const +{ + if( mpSwapStreamHdl ) + return *mpSwapStreamHdl; + else + return Link(); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::FireSwapInRequest() +{ + ImplAutoSwapIn(); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::FireSwapOutRequest() +{ + ImplAutoSwapOutHdl( NULL ); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::GraphicManagerDestroyed() +{ + // we're alive, but our manager doesn't live anymore ==> connect to default manager + mpMgr = NULL; + ImplSetGraphicManager( NULL ); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetGraphicManager( const GraphicManager& rMgr ) +{ + ImplSetGraphicManager( &rMgr ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicAttr* pAttr, ULONG nFlags ) const +{ + BOOL bRet; + + if( nFlags & GRFMGR_DRAW_CACHED ) + { + // --> OD 2005-10-11 #i54875# - Consider cropped graphics. + // Note: The graphic manager caches a cropped graphic with its + // uncropped position and size. +// bRet = mpMgr->IsInCache( pOut, rPt, rSz, *this, ( pAttr ? *pAttr : GetAttr() ) ); + Point aPt( rPt ); + Size aSz( rSz ); + if ( pAttr->IsCropped() ) + { + PolyPolygon aClipPolyPoly; + BOOL bRectClip; + ImplGetCropParams( pOut, aPt, aSz, pAttr, aClipPolyPoly, bRectClip ); + } + bRet = mpMgr->IsInCache( pOut, aPt, aSz, *this, ( pAttr ? *pAttr : GetAttr() ) ); + } + else + bRet = FALSE; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ReleaseFromCache() +{ + + mpMgr->ReleaseFromCache( *this ); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetAnimationNotifyHdl( const Link& rLink ) +{ + maGraphic.SetAnimationNotifyHdl( rLink ); +} + +// ----------------------------------------------------------------------------- + +List* GraphicObject::GetAnimationInfoList() const +{ + return maGraphic.GetAnimationInfoList(); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GraphicAttr* pAttr, ULONG nFlags ) +{ + GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); + Point aPt( rPt ); + Size aSz( rSz ); + const sal_uInt32 nOldDrawMode = pOut->GetDrawMode(); + BOOL bCropped = aAttr.IsCropped(); + BOOL bCached = FALSE; + BOOL bRet; + + // #i29534# Provide output rects for PDF writer + Rectangle aCropRect; + + if( !( GRFMGR_DRAW_USE_DRAWMODE_SETTINGS & nFlags ) ) + pOut->SetDrawMode( nOldDrawMode & ( ~( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ) ) ); + + // mirrored horizontically + if( aSz.Width() < 0L ) + { + aPt.X() += aSz.Width() + 1; + aSz.Width() = -aSz.Width(); + aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_HORZ ); + } + + // mirrored vertically + if( aSz.Height() < 0L ) + { + aPt.Y() += aSz.Height() + 1; + aSz.Height() = -aSz.Height(); + aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_VERT ); + } + + if( bCropped ) + { + PolyPolygon aClipPolyPoly; + BOOL bRectClip; + const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); + + pOut->Push( PUSH_CLIPREGION ); + + if( bCrop ) + { + if( bRectClip ) + { + // #i29534# Store crop rect for later forwarding to + // PDF writer + aCropRect = aClipPolyPoly.GetBoundRect(); + pOut->IntersectClipRegion( aCropRect ); + } + else + { + pOut->IntersectClipRegion( aClipPolyPoly ); + } + } + } + + bRet = mpMgr->DrawObj( pOut, aPt, aSz, *this, aAttr, nFlags, bCached ); + + if( bCropped ) + pOut->Pop(); + + pOut->SetDrawMode( nOldDrawMode ); + + // #i29534# Moved below OutDev restoration, to avoid multiple swap-ins + // (code above needs to call GetGraphic twice) + if( bCached ) + { + if( mpSwapOutTimer ) + mpSwapOutTimer->Start(); + else + FireSwapOutRequest(); + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, + const Size& rOffset, const GraphicAttr* pAttr, ULONG nFlags, int nTileCacheSize1D ) +{ + if( pOut == NULL || rSize.Width() == 0 || rSize.Height() == 0 ) + return FALSE; + + const MapMode aOutMapMode( pOut->GetMapMode() ); + const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); + // #106258# Clamp size to 1 for zero values. This is okay, since + // logical size of zero is handled above already + const Size aOutTileSize( ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), + ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); + + //#i69780 clip final tile size to a sane max size + while (((sal_Int64)rSize.Width() * nTileCacheSize1D) > SAL_MAX_UINT16) + nTileCacheSize1D /= 2; + while (((sal_Int64)rSize.Height() * nTileCacheSize1D) > SAL_MAX_UINT16) + nTileCacheSize1D /= 2; + + return ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, pAttr, nFlags, nTileCacheSize1D ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, + long nExtraData, const GraphicAttr* pAttr, ULONG /*nFlags*/, + OutputDevice* pFirstFrameOutDev ) +{ + BOOL bRet = FALSE; + + GetGraphic(); + + if( !IsSwappedOut() ) + { + const GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); + + if( mbAnimated ) + { + Point aPt( rPt ); + Size aSz( rSz ); + BOOL bCropped = aAttr.IsCropped(); + + if( bCropped ) + { + PolyPolygon aClipPolyPoly; + BOOL bRectClip; + const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); + + pOut->Push( PUSH_CLIPREGION ); + + if( bCrop ) + { + if( bRectClip ) + pOut->IntersectClipRegion( aClipPolyPoly.GetBoundRect() ); + else + pOut->IntersectClipRegion( aClipPolyPoly ); + } + } + + if( !mpSimpleCache || ( mpSimpleCache->maAttr != aAttr ) || pFirstFrameOutDev ) + { + if( mpSimpleCache ) + delete mpSimpleCache; + + mpSimpleCache = new GrfSimpleCacheObj( GetTransformedGraphic( &aAttr ), aAttr ); + mpSimpleCache->maGraphic.SetAnimationNotifyHdl( GetAnimationNotifyHdl() ); + } + + mpSimpleCache->maGraphic.StartAnimation( pOut, aPt, aSz, nExtraData, pFirstFrameOutDev ); + + if( bCropped ) + pOut->Pop(); + + bRet = TRUE; + } + else + bRet = Draw( pOut, rPt, rSz, &aAttr, GRFMGR_DRAW_STANDARD ); + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData ) +{ + if( mpSimpleCache ) + mpSimpleCache->maGraphic.StopAnimation( pOut, nExtraData ); +} + +// ----------------------------------------------------------------------------- + +const Graphic& GraphicObject::GetGraphic() const +{ + if( mbAutoSwapped ) + ( (GraphicObject*) this )->ImplAutoSwapIn(); + + return maGraphic; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj ) +{ + mpMgr->ImplUnregisterObj( *this ); + + if( mpSwapOutTimer ) + mpSwapOutTimer->Stop(); + + maGraphic = rGraphic; + mbAutoSwapped = FALSE; + ImplAssignGraphicData(); + delete mpLink, mpLink = NULL; + delete mpSimpleCache, mpSimpleCache = NULL; + + mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj); + + if( mpSwapOutTimer ) + mpSwapOutTimer->Start(); +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink ) +{ + SetGraphic( rGraphic ); + mpLink = new String( rLink ); +} + +// ----------------------------------------------------------------------------- + +Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const +{ + // #104550# Extracted from svx/source/svdraw/svdograf.cxx + Graphic aTransGraphic( maGraphic ); + const GraphicType eType = GetType(); + const Size aSrcSize( aTransGraphic.GetPrefSize() ); + + // #104115# Convert the crop margins to graphic object mapmode + const MapMode aMapGraph( aTransGraphic.GetPrefMapMode() ); + const MapMode aMap100( MAP_100TH_MM ); + + Size aCropLeftTop; + Size aCropRightBottom; + + if( GRAPHIC_GDIMETAFILE == eType ) + { + GDIMetaFile aMtf( aTransGraphic.GetGDIMetaFile() ); + + if( aMapGraph == MAP_PIXEL ) + { + aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetLeftCrop(), + rAttr.GetTopCrop() ), + aMap100 ); + aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetRightCrop(), + rAttr.GetBottomCrop() ), + aMap100 ); + } + else + { + aCropLeftTop = OutputDevice::LogicToLogic( Size( rAttr.GetLeftCrop(), + rAttr.GetTopCrop() ), + aMap100, + aMapGraph ); + aCropRightBottom = OutputDevice::LogicToLogic( Size( rAttr.GetRightCrop(), + rAttr.GetBottomCrop() ), + aMap100, + aMapGraph ); + } + + // #104115# If the metafile is cropped, give it a special + // treatment: clip against the remaining area, scale up such + // that this area later fills the desired size, and move the + // origin to the upper left edge of that area. + if( rAttr.IsCropped() ) + { + const MapMode aMtfMapMode( aMtf.GetPrefMapMode() ); + + Rectangle aClipRect( aMtfMapMode.GetOrigin().X() + aCropLeftTop.Width(), + aMtfMapMode.GetOrigin().Y() + aCropLeftTop.Height(), + aMtfMapMode.GetOrigin().X() + aSrcSize.Width() - aCropRightBottom.Width(), + aMtfMapMode.GetOrigin().Y() + aSrcSize.Height() - aCropRightBottom.Height() ); + + // #104115# To correctly crop rotated metafiles, clip by view rectangle + aMtf.AddAction( new MetaISectRectClipRegionAction( aClipRect ), 0 ); + + // #104115# To crop the metafile, scale larger than the output rectangle + aMtf.Scale( (double)rDestSize.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()), + (double)rDestSize.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) ); + + // #104115# Adapt the pref size by hand (scale changes it + // proportionally, but we want it to be smaller than the + // former size, to crop the excess out) + aMtf.SetPrefSize( Size( (long)((double)rDestSize.Width() * (1.0 + (aCropLeftTop.Width() + aCropRightBottom.Width()) / aSrcSize.Width()) + .5), + (long)((double)rDestSize.Height() * (1.0 + (aCropLeftTop.Height() + aCropRightBottom.Height()) / aSrcSize.Height()) + .5) ) ); + + // #104115# Adapt the origin of the new mapmode, such that it + // is shifted to the place where the cropped output starts + Point aNewOrigin( (long)((double)aMtfMapMode.GetOrigin().X() + rDestSize.Width() * aCropLeftTop.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()) + .5), + (long)((double)aMtfMapMode.GetOrigin().Y() + rDestSize.Height() * aCropLeftTop.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) + .5) ); + MapMode aNewMap( rDestMap ); + aNewMap.SetOrigin( OutputDevice::LogicToLogic(aNewOrigin, aMtfMapMode, rDestMap) ); + aMtf.SetPrefMapMode( aNewMap ); + } + else + { + aMtf.Scale( Fraction( rDestSize.Width(), aSrcSize.Width() ), Fraction( rDestSize.Height(), aSrcSize.Height() ) ); + aMtf.SetPrefMapMode( rDestMap ); + } + + aTransGraphic = aMtf; + } + else if( GRAPHIC_BITMAP == eType ) + { + BitmapEx aBitmapEx( aTransGraphic.GetBitmapEx() ); + + // convert crops to pixel + aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetLeftCrop(), + rAttr.GetTopCrop() ), + aMap100 ); + aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetRightCrop(), + rAttr.GetBottomCrop() ), + aMap100 ); + + // convert from prefmapmode to pixel + const Size aSrcSizePixel( Application::GetDefaultDevice()->LogicToPixel( aSrcSize, + aMapGraph ) ); + + // setup crop rectangle in pixel + Rectangle aCropRect( aCropLeftTop.Width(), aCropLeftTop.Height(), + aSrcSizePixel.Width() - aCropRightBottom.Width(), + aSrcSizePixel.Height() - aCropRightBottom.Height() ); + + // #105641# Also crop animations + if( aTransGraphic.IsAnimated() ) + { + USHORT nFrame; + Animation aAnim( aTransGraphic.GetAnimation() ); + + for( nFrame=0; nFrame<aAnim.Count(); ++nFrame ) + { + AnimationBitmap aAnimBmp( aAnim.Get( nFrame ) ); + + if( !aCropRect.IsInside( Rectangle(aAnimBmp.aPosPix, aAnimBmp.aSizePix) ) ) + { + // setup actual cropping (relative to frame position) + Rectangle aCropRectRel( aCropRect ); + aCropRectRel.Move( -aAnimBmp.aPosPix.X(), + -aAnimBmp.aPosPix.Y() ); + + // cropping affects this frame, apply it then + // do _not_ apply enlargement, this is done below + ImplTransformBitmap( aAnimBmp.aBmpEx, rAttr, Size(), Size(), + aCropRectRel, rDestSize, FALSE ); + + aAnim.Replace( aAnimBmp, nFrame ); + } + // else: bitmap completely within crop area, + // i.e. nothing is cropped away + } + + // now, apply enlargement (if any) through global animation size + if( aCropLeftTop.Width() < 0 || + aCropLeftTop.Height() < 0 || + aCropRightBottom.Width() < 0 || + aCropRightBottom.Height() < 0 ) + { + Size aNewSize( aAnim.GetDisplaySizePixel() ); + aNewSize.Width() += aCropRightBottom.Width() < 0 ? -aCropRightBottom.Width() : 0; + aNewSize.Width() += aCropLeftTop.Width() < 0 ? -aCropLeftTop.Width() : 0; + aNewSize.Height() += aCropRightBottom.Height() < 0 ? -aCropRightBottom.Height() : 0; + aNewSize.Height() += aCropLeftTop.Height() < 0 ? -aCropLeftTop.Height() : 0; + aAnim.SetDisplaySizePixel( aNewSize ); + } + + // if topleft has changed, we must move all frames to the + // right and bottom, resp. + if( aCropLeftTop.Width() < 0 || + aCropLeftTop.Height() < 0 ) + { + Point aPosOffset( aCropLeftTop.Width() < 0 ? -aCropLeftTop.Width() : 0, + aCropLeftTop.Height() < 0 ? -aCropLeftTop.Height() : 0 ); + + for( nFrame=0; nFrame<aAnim.Count(); ++nFrame ) + { + AnimationBitmap aAnimBmp( aAnim.Get( nFrame ) ); + + aAnimBmp.aPosPix += aPosOffset; + + aAnim.Replace( aAnimBmp, nFrame ); + } + } + + aTransGraphic = aAnim; + } + else + { + BitmapEx aBmpEx( aTransGraphic.GetBitmapEx() ); + + ImplTransformBitmap( aBmpEx, rAttr, aCropLeftTop, aCropRightBottom, + aCropRect, rDestSize, TRUE ); + + aTransGraphic = aBmpEx; + } + + aTransGraphic.SetPrefSize( rDestSize ); + aTransGraphic.SetPrefMapMode( rDestMap ); + } + + GraphicObject aGrfObj( aTransGraphic ); + aTransGraphic = aGrfObj.GetTransformedGraphic( &rAttr ); + + return aTransGraphic; +} + +// ----------------------------------------------------------------------------- + +Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const // TODO: Change to Impl +{ + GetGraphic(); + + Graphic aGraphic; + GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); + + if( maGraphic.IsSupportedGraphic() && !maGraphic.IsSwapOut() ) + { + if( aAttr.IsSpecialDrawMode() || aAttr.IsAdjusted() || aAttr.IsMirrored() || aAttr.IsRotated() || aAttr.IsTransparent() ) + { + if( GetType() == GRAPHIC_BITMAP ) + { + if( IsAnimated() ) + { + Animation aAnimation( maGraphic.GetAnimation() ); + GraphicManager::ImplAdjust( aAnimation, aAttr, ADJUSTMENT_ALL ); + aAnimation.SetLoopCount( mnAnimationLoopCount ); + aGraphic = aAnimation; + } + else + { + BitmapEx aBmpEx( maGraphic.GetBitmapEx() ); + GraphicManager::ImplAdjust( aBmpEx, aAttr, ADJUSTMENT_ALL ); + aGraphic = aBmpEx; + } + } + else + { + GDIMetaFile aMtf( maGraphic.GetGDIMetaFile() ); + GraphicManager::ImplAdjust( aMtf, aAttr, ADJUSTMENT_ALL ); + aGraphic = aMtf; + } + } + else + { + if( ( GetType() == GRAPHIC_BITMAP ) && IsAnimated() ) + { + Animation aAnimation( maGraphic.GetAnimation() ); + aAnimation.SetLoopCount( mnAnimationLoopCount ); + aGraphic = aAnimation; + } + else + aGraphic = maGraphic; + } + } + + return aGraphic; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ResetAnimationLoopCount() +{ + if( IsAnimated() && !IsSwappedOut() ) + { + maGraphic.ResetAnimationLoopCount(); + + if( mpSimpleCache ) + mpSimpleCache->maGraphic.ResetAnimationLoopCount(); + } +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::SwapOut() +{ + BOOL bRet = ( !mbAutoSwapped ? maGraphic.SwapOut() : FALSE ); + + if( bRet && mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedOut( *this ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::SwapOut( SvStream* pOStm ) +{ + BOOL bRet = ( !mbAutoSwapped ? maGraphic.SwapOut( pOStm ) : FALSE ); + + if( bRet && mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedOut( *this ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::SwapIn() +{ + BOOL bRet; + + if( mbAutoSwapped ) + { + ImplAutoSwapIn(); + bRet = TRUE; + } + else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) + bRet = TRUE; + else + { + bRet = maGraphic.SwapIn(); + + if( bRet && mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedIn( *this ); + } + + if( bRet ) + ImplAssignGraphicData(); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicObject::SwapIn( SvStream* pIStm ) +{ + BOOL bRet; + + if( mbAutoSwapped ) + { + ImplAutoSwapIn(); + bRet = TRUE; + } + else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) + bRet = TRUE; + else + { + bRet = maGraphic.SwapIn( pIStm ); + + if( bRet && mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedIn( *this ); + } + + if( bRet ) + ImplAssignGraphicData(); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::SetSwapState() +{ + if( !IsSwappedOut() ) + { + mbAutoSwapped = TRUE; + + if( mpMgr ) + mpMgr->ImplGraphicObjectWasSwappedOut( *this ); + } +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( GraphicObject, ImplAutoSwapOutHdl, void*, EMPTYARG ) +{ + if( !IsSwappedOut() ) + { + mbIsInSwapOut = TRUE; + + SvStream* pStream = GetSwapStream(); + + if( GRFMGR_AUTOSWAPSTREAM_NONE != pStream ) + { + if( GRFMGR_AUTOSWAPSTREAM_LINK == pStream ) + mbAutoSwapped = SwapOut( NULL ); + else + { + if( GRFMGR_AUTOSWAPSTREAM_TEMP == pStream ) + mbAutoSwapped = SwapOut(); + else + { + mbAutoSwapped = SwapOut( pStream ); + delete pStream; + } + } + } + + mbIsInSwapOut = FALSE; + } + + if( mpSwapOutTimer ) + mpSwapOutTimer->Start(); + + return 0L; +} + +// ------------------------------------------------------------------------ + +SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) +{ + VersionCompat aCompat( rIStm, STREAM_READ ); + Graphic aGraphic; + GraphicAttr aAttr; + ByteString aLink; + BOOL bLink; + + rIStm >> aGraphic >> aAttr >> bLink; + + rGraphicObj.SetGraphic( aGraphic ); + rGraphicObj.SetAttr( aAttr ); + + if( bLink ) + { + rIStm >> aLink; + rGraphicObj.SetLink( UniString( aLink, RTL_TEXTENCODING_UTF8 ) ); + } + else + rGraphicObj.SetLink(); + + rGraphicObj.SetSwapStreamHdl(); + + return rIStm; +} + +// ------------------------------------------------------------------------ + +SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) +{ + VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); + const BOOL bLink = rGraphicObj.HasLink(); + + rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink; + + if( bLink ) + rOStm << ByteString( rGraphicObj.GetLink(), RTL_TEXTENCODING_UTF8 ); + + return rOStm; +} + +#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" + +GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ) +{ + const String aURL( rURL ), aPrefix( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) ); + if( aURL.Search( aPrefix ) == 0 ) + { + // graphic manager url + ByteString aUniqueID( String(rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 )), RTL_TEXTENCODING_UTF8 ); + return GraphicObject( aUniqueID ); + } + else + { + Graphic aGraphic; + if ( aURL.Len() ) + { + SvStream* pStream = utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ ); + if( pStream ) + GraphicConverter::Import( *pStream, aGraphic ); + } + + return GraphicObject( aGraphic ); + } +} + diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx new file mode 100644 index 000000000000..7e1255aabc56 --- /dev/null +++ b/svtools/source/graphic/grfmgr2.cxx @@ -0,0 +1,2382 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <vos/macros.hxx> +#include <vcl/bmpacc.hxx> +#include <tools/poly.hxx> +#include <vcl/outdev.hxx> +#include <vcl/window.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/metaact.hxx> +#include <vcl/metric.hxx> +#include <vcl/animate.hxx> +#include <vcl/alpha.hxx> +#include <vcl/virdev.hxx> +#include "grfcache.hxx" +#include <svtools/grfmgr.hxx> + +// ----------- +// - defines - +// ----------- + +#define MAX_PRINTER_EXT 1024 +#define MAP( cVal0, cVal1, nFrac ) ((BYTE)((((long)(cVal0)<<20L)+nFrac*((long)(cVal1)-(cVal0)))>>20L)) +#define WATERMARK_LUM_OFFSET 50 +#define WATERMARK_CON_OFFSET -70 + +// ----------- +// - helpers - +// ----------- + +namespace { + +void muckWithBitmap( const Point& rDestPoint, + const Size& rDestSize, + const Size& rRefSize, + bool& o_rbNonBitmapActionEncountered ) +{ + const Point aEmptyPoint; + + if( aEmptyPoint != rDestPoint || + rDestSize != rRefSize ) + { + // non-fullscale, or offsetted bmp -> fallback to mtf + // rendering + o_rbNonBitmapActionEncountered = true; + } +} + +BitmapEx muckWithBitmap( const BitmapEx& rBmpEx, + const Point& rSrcPoint, + const Size& rSrcSize, + const Point& rDestPoint, + const Size& rDestSize, + const Size& rRefSize, + bool& o_rbNonBitmapActionEncountered ) +{ + BitmapEx aBmpEx; + + muckWithBitmap(rDestPoint, + rDestSize, + rRefSize, + o_rbNonBitmapActionEncountered); + + if( o_rbNonBitmapActionEncountered ) + return aBmpEx; + + aBmpEx = rBmpEx; + + if( (rSrcPoint.X() != 0 && rSrcPoint.Y() != 0) || + rSrcSize != rBmpEx.GetSizePixel() ) + { + // crop bitmap to given source rectangle (no + // need to copy and convert the whole bitmap) + const Rectangle aCropRect( rSrcPoint, + rSrcSize ); + aBmpEx.Crop( aCropRect ); + } + + return aBmpEx; +} + +} // namespace { + + +// ------------------ +// - GraphicManager - +// ------------------ + +GraphicManager::GraphicManager( ULONG nCacheSize, ULONG nMaxObjCacheSize ) : + mpCache( new GraphicCache( *this, nCacheSize, nMaxObjCacheSize ) ) +{ +} + +// ----------------------------------------------------------------------------- + +GraphicManager::~GraphicManager() +{ + for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() ) + ( (GraphicObject*) pObj )->GraphicManagerDestroyed(); + + delete mpCache; +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::SetMaxCacheSize( ULONG nNewCacheSize ) +{ + mpCache->SetMaxDisplayCacheSize( nNewCacheSize ); +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicManager::GetMaxCacheSize() const +{ + return mpCache->GetMaxDisplayCacheSize(); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::SetMaxObjCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached ) +{ + mpCache->SetMaxObjDisplayCacheSize( nNewMaxObjSize, bDestroyGreaterCached ); +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicManager::GetMaxObjCacheSize() const +{ + return mpCache->GetMaxObjDisplayCacheSize(); +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicManager::GetUsedCacheSize() const +{ + return mpCache->GetUsedDisplayCacheSize(); +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicManager::GetFreeCacheSize() const +{ + return mpCache->GetFreeDisplayCacheSize(); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::SetCacheTimeout( ULONG nTimeoutSeconds ) +{ + mpCache->SetCacheTimeout( nTimeoutSeconds ); +} + +// ----------------------------------------------------------------------------- + +ULONG GraphicManager::GetCacheTimeout() const +{ + return mpCache->GetCacheTimeout(); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ClearCache() +{ + mpCache->ClearDisplayCache(); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ReleaseFromCache( const GraphicObject& /*rObj*/ ) +{ + // !!! +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::IsInCache( OutputDevice* pOut, const Point& rPt, + const Size& rSz, const GraphicObject& rObj, + const GraphicAttr& rAttr ) const +{ + return mpCache->IsInDisplayCache( pOut, rPt, rSz, rObj, rAttr ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + GraphicObject& rObj, const GraphicAttr& rAttr, + const ULONG nFlags, BOOL& rCached ) +{ + Point aPt( rPt ); + Size aSz( rSz ); + BOOL bRet = FALSE; + + rCached = FALSE; + + if( ( rObj.GetType() == GRAPHIC_BITMAP ) || ( rObj.GetType() == GRAPHIC_GDIMETAFILE ) ) + { + // create output and fill cache + const Size aOutSize( pOut->GetOutputSizePixel() ); + + if( rObj.IsAnimated() || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) || + ( !( nFlags & GRFMGR_DRAW_NO_SUBSTITUTE ) && + ( ( nFlags & GRFMGR_DRAW_SUBSTITUTE ) || + !( nFlags & GRFMGR_DRAW_CACHED ) || + ( pOut->GetConnectMetaFile() && !pOut->IsOutputEnabled() ) ) ) ) + { + // simple output of transformed graphic + const Graphic aGraphic( rObj.GetTransformedGraphic( &rAttr ) ); + + if( aGraphic.IsSupportedGraphic() ) + { + const USHORT nRot10 = rAttr.GetRotation() % 3600; + + if( nRot10 ) + { + Polygon aPoly( Rectangle( aPt, aSz ) ); + + aPoly.Rotate( aPt, nRot10 ); + const Rectangle aRotBoundRect( aPoly.GetBoundRect() ); + aPt = aRotBoundRect.TopLeft(); + aSz = aRotBoundRect.GetSize(); + } + + aGraphic.Draw( pOut, aPt, aSz ); + } + + bRet = TRUE; + } + + if( !bRet ) + { + // cached/direct drawing + if( !mpCache->DrawDisplayCacheObj( pOut, aPt, aSz, rObj, rAttr ) ) + bRet = ImplDraw( pOut, aPt, aSz, rObj, rAttr, nFlags, rCached ); + else + bRet = rCached = TRUE; + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, + const ByteString* pID, const GraphicObject* pCopyObj ) +{ + maObjList.Insert( (void*) &rObj, LIST_APPEND ); + mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj ) +{ + mpCache->ReleaseGraphicObject( rObj ); + maObjList.Remove( (void*) &rObj ); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ) +{ + mpCache->GraphicObjectWasSwappedOut( rObj ); +} + +// ----------------------------------------------------------------------------- + +ByteString GraphicManager::ImplGetUniqueID( const GraphicObject& rObj ) const +{ + return mpCache->GetUniqueID( rObj ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplFillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) +{ + return( mpCache->FillSwappedGraphicObject( rObj, rSubstitute ) ); +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ) +{ + mpCache->GraphicObjectWasSwappedIn( rObj ); +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, + const Size& rSz, GraphicObject& rObj, + const GraphicAttr& rAttr, + const ULONG nFlags, BOOL& rCached ) +{ + const Graphic& rGraphic = rObj.GetGraphic(); + BOOL bRet = FALSE; + + if( rGraphic.IsSupportedGraphic() && !rGraphic.IsSwapOut() ) + { + if( GRAPHIC_BITMAP == rGraphic.GetType() ) + { + const BitmapEx aSrcBmpEx( rGraphic.GetBitmapEx() ); + + // #i46805# No point in caching a bitmap that is rendered + // via RectFill on the OutDev + if( !(pOut->GetDrawMode() & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP )) && + mpCache->IsDisplayCacheable( pOut, rPt, rSz, rObj, rAttr ) ) + { + BitmapEx aDstBmpEx; + + if( ImplCreateOutput( pOut, rPt, rSz, aSrcBmpEx, rAttr, nFlags, &aDstBmpEx ) ) + { + rCached = mpCache->CreateDisplayCacheObj( pOut, rPt, rSz, rObj, rAttr, aDstBmpEx ); + bRet = TRUE; + } + } + + if( !bRet ) + bRet = ImplCreateOutput( pOut, rPt, rSz, aSrcBmpEx, rAttr, nFlags ); + } + else + { + const GDIMetaFile& rSrcMtf = rGraphic.GetGDIMetaFile(); + + if( mpCache->IsDisplayCacheable( pOut, rPt, rSz, rObj, rAttr ) ) + { + GDIMetaFile aDstMtf; + BitmapEx aContainedBmpEx; + + if( ImplCreateOutput( pOut, rPt, rSz, rSrcMtf, rAttr, nFlags, aDstMtf, aContainedBmpEx ) ) + { + if( !!aContainedBmpEx ) + { + // #117889# Use bitmap output method, if + // metafile basically contains only a single + // bitmap + BitmapEx aDstBmpEx; + + if( ImplCreateOutput( pOut, rPt, rSz, aContainedBmpEx, rAttr, nFlags, &aDstBmpEx ) ) + { + rCached = mpCache->CreateDisplayCacheObj( pOut, rPt, rSz, rObj, rAttr, aDstBmpEx ); + bRet = TRUE; + } + } + else + { + rCached = mpCache->CreateDisplayCacheObj( pOut, rPt, rSz, rObj, rAttr, aDstMtf ); + bRet = TRUE; + } + } + } + + if( !bRet ) + { + const Graphic aGraphic( rObj.GetTransformedGraphic( &rAttr ) ); + + if( aGraphic.IsSupportedGraphic() ) + { + aGraphic.Draw( pOut, rPt, rSz ); + bRet = TRUE; + } + } + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, + const Point& rPt, const Size& rSz, + const BitmapEx& rBmpEx, const GraphicAttr& rAttr, + const ULONG nFlags, BitmapEx* pBmpEx ) +{ + USHORT nRot10 = rAttr.GetRotation() % 3600; + Point aOutPtPix; + Size aOutSzPix; + Size aUnrotatedSzPix( pOut->LogicToPixel( rSz ) ); + BOOL bRet = FALSE; + + if( nRot10 ) + { + Polygon aPoly( Rectangle( rPt, rSz ) ); + + aPoly.Rotate( rPt, nRot10 ); + const Rectangle aRotBoundRect( aPoly.GetBoundRect() ); + aOutPtPix = pOut->LogicToPixel( aRotBoundRect.TopLeft() ); + aOutSzPix = pOut->LogicToPixel( aRotBoundRect.GetSize() ); + } + else + { + aOutPtPix = pOut->LogicToPixel( rPt ); + aOutSzPix = aUnrotatedSzPix; + } + + if( aUnrotatedSzPix.Width() && aUnrotatedSzPix.Height() ) + { + BitmapEx aBmpEx( rBmpEx ); + BitmapEx aOutBmpEx; + Point aOutPt; + Size aOutSz; + const Size& rBmpSzPix = rBmpEx.GetSizePixel(); + const long nW = rBmpSzPix.Width(); + const long nH = rBmpSzPix.Height(); + const long nNewW = aUnrotatedSzPix.Width(); + const long nNewH = aUnrotatedSzPix.Height(); + double fTmp; + long* pMapIX = new long[ nNewW ]; + long* pMapFX = new long[ nNewW ]; + long* pMapIY = new long[ nNewH ]; + long* pMapFY = new long[ nNewH ]; + long nStartX = -1, nStartY = -1, nEndX = -1, nEndY = -1; + long nX, nY, nTmp, nTmpX, nTmpY; + BOOL bHMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_HORZ ) != 0; + BOOL bVMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_VERT ) != 0; + + if( nFlags & GRFMGR_DRAW_BILINEAR ) + { + const double fRevScaleX = ( nNewW > 1L ) ? ( (double) ( nW - 1L ) / ( nNewW - 1L ) ) : 0.0; + const double fRevScaleY = ( nNewH > 1L ) ? ( (double) ( nH - 1L ) / ( nNewH - 1L ) ) : 0.0; + + // create horizontal mapping table + for( nX = 0L, nTmpX = nW - 1L, nTmp = nW - 2L; nX < nNewW; nX++ ) + { + fTmp = nX * fRevScaleX; + + if( bHMirr ) + fTmp = nTmpX - fTmp; + + pMapFX[ nX ] = (long) ( ( fTmp - ( pMapIX[ nX ] = MinMax( (long) fTmp, 0, nTmp ) ) ) * 1048576. ); + } + + // create vertical mapping table + for( nY = 0L, nTmpY = nH - 1L, nTmp = nH - 2L; nY < nNewH; nY++ ) + { + fTmp = nY * fRevScaleY; + + if( bVMirr ) + fTmp = nTmpY - fTmp; + + pMapFY[ nY ] = (long) ( ( fTmp - ( pMapIY[ nY ] = MinMax( (long) fTmp, 0, nTmp ) ) ) * 1048576. ); + } + } + else + { + // #98290# Use a different mapping for non-interpolating mode, to avoid missing rows/columns + const double fRevScaleX = ( nNewW > 1L ) ? ( (double) nW / nNewW ) : 0.0; + const double fRevScaleY = ( nNewH > 1L ) ? ( (double) nH / nNewH ) : 0.0; + + // create horizontal mapping table + for( nX = 0L, nTmpX = nW - 1L, nTmp = nW - 2L; nX < nNewW; nX++ ) + { + fTmp = nX * fRevScaleX; + + if( bHMirr ) + fTmp = nTmpX - fTmp; + + // #98290# Do not use round to zero, otherwise last column will be missing + pMapIX[ nX ] = MinMax( (long) fTmp, 0, nTmp ); + pMapFX[ nX ] = fTmp >= nTmp+1 ? 1048576 : 0; + } + + // create vertical mapping table + for( nY = 0L, nTmpY = nH - 1L, nTmp = nH - 2L; nY < nNewH; nY++ ) + { + fTmp = nY * fRevScaleY; + + if( bVMirr ) + fTmp = nTmpY - fTmp; + + // #98290# Do not use round to zero, otherwise last row will be missing + pMapIY[ nY ] = MinMax( (long) fTmp, 0, nTmp ); + pMapFY[ nY ] = fTmp >= nTmp+1 ? 1048576 : 0; + } + } + + // calculate output sizes + if( !pBmpEx ) + { + Point aPt; + Rectangle aOutRect( aPt, pOut->GetOutputSizePixel() ); + Rectangle aBmpRect( aOutPtPix, aOutSzPix ); + + if( pOut->GetOutDevType() == OUTDEV_WINDOW ) + { + const Region aPaintRgn( ( (Window*) pOut )->GetPaintRegion() ); + if( !aPaintRgn.IsNull() ) + aOutRect.Intersection( pOut->LogicToPixel( aPaintRgn.GetBoundRect() ) ); + } + + aOutRect.Intersection( aBmpRect ); + + if( !aOutRect.IsEmpty() ) + { + aOutPt = pOut->PixelToLogic( aOutRect.TopLeft() ); + aOutSz = pOut->PixelToLogic( aOutRect.GetSize() ); + nStartX = aOutRect.Left() - aBmpRect.Left(); + nStartY = aOutRect.Top() - aBmpRect.Top(); + nEndX = aOutRect.Right() - aBmpRect.Left(); + nEndY = aOutRect.Bottom() - aBmpRect.Top(); + } + else + nStartX = -1L; // invalid + } + else + { + aOutPt = pOut->PixelToLogic( aOutPtPix ); + aOutSz = pOut->PixelToLogic( aOutSzPix ); + nStartX = nStartY = 0; + nEndX = aOutSzPix.Width() - 1L; + nEndY = aOutSzPix.Height() - 1L; + } + + // do transformation + if( nStartX >= 0L ) + { + const BOOL bSimple = ( 1 == nW || 1 == nH ); + + if( nRot10 ) + { + if( bSimple ) + { + bRet = ( aOutBmpEx = aBmpEx ).Scale( aUnrotatedSzPix ); + + if( bRet ) + aOutBmpEx.Rotate( nRot10, COL_TRANSPARENT ); + } + else + { + bRet = ImplCreateRotatedScaled( aBmpEx, + nRot10, aOutSzPix, aUnrotatedSzPix, + pMapIX, pMapFX, pMapIY, pMapFY, nStartX, nEndX, nStartY, nEndY, + aOutBmpEx ); + } + } + else + { + // #105229# Don't scale if output size equals bitmap size + // #107226# Copy through only if we're not mirroring + if( !bHMirr && !bVMirr && aOutSzPix == rBmpSzPix ) + { + // #107226# Use original dimensions when just copying through + aOutPt = pOut->PixelToLogic( aOutPtPix ); + aOutSz = pOut->PixelToLogic( aOutSzPix ); + aOutBmpEx = aBmpEx; + bRet = TRUE; + } + else + { + if( bSimple ) + bRet = ( aOutBmpEx = aBmpEx ).Scale( Size( nEndX - nStartX + 1, nEndY - nStartY + 1 ) ); + else + { + bRet = ImplCreateScaled( aBmpEx, + pMapIX, pMapFX, pMapIY, pMapFY, + nStartX, nEndX, nStartY, nEndY, + aOutBmpEx ); + } + } + } + + if( bRet ) + { + // attribute adjustment if neccessary + if( rAttr.IsSpecialDrawMode() || rAttr.IsAdjusted() || rAttr.IsTransparent() ) + ImplAdjust( aOutBmpEx, rAttr, ADJUSTMENT_DRAWMODE | ADJUSTMENT_COLORS | ADJUSTMENT_TRANSPARENCY ); + + // OutDev adjustment if neccessary + if( pOut->GetOutDevType() != OUTDEV_PRINTER && pOut->GetBitCount() <= 8 && aOutBmpEx.GetBitCount() >= 8 ) + aOutBmpEx.Dither( BMP_DITHER_MATRIX ); + } + } + + // delete lookup tables + delete[] pMapIX; + delete[] pMapFX; + delete[] pMapIY; + delete[] pMapFY; + + // create output + if( bRet ) + { + if( !pBmpEx ) + pOut->DrawBitmapEx( aOutPt, aOutSz, aOutBmpEx ); + else + { + if( !rAttr.IsTransparent() && !aOutBmpEx.IsAlpha() ) + aOutBmpEx = BitmapEx( aOutBmpEx.GetBitmap().CreateDisplayBitmap( pOut ), aOutBmpEx.GetMask() ); + + pOut->DrawBitmapEx( aOutPt, aOutSz, *pBmpEx = aOutBmpEx ); + } + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, + const Point& rPt, const Size& rSz, + const GDIMetaFile& rMtf, const GraphicAttr& rAttr, + const ULONG /*nFlags*/, GDIMetaFile& rOutMtf, BitmapEx& rOutBmpEx ) +{ + const Size aNewSize( rMtf.GetPrefSize() ); + + rOutMtf = rMtf; + + // #117889# count bitmap actions, and flag actions that paint, but + // are no bitmaps. + sal_Int32 nNumBitmaps(0); + bool bNonBitmapActionEncountered(false); + if( aNewSize.Width() && aNewSize.Height() && rSz.Width() && rSz.Height() ) + { + const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height(); + const double fOutWH = (double) rSz.Width() / rSz.Height(); + + const double fScaleX = fOutWH / fGrfWH; + const double fScaleY = 1.0; + + const MapMode& rPrefMapMode( rMtf.GetPrefMapMode() ); + const Size& rSizePix( pOut->LogicToPixel( aNewSize, + rPrefMapMode ) ); + + // taking care of font width default if scaling metafile. + // #117889# use existing metafile scan, to determine whether + // the metafile basically displays a single bitmap. Note that + // the solution, as implemented here, is quite suboptimal (the + // cases where a mtf consisting basically of a single bitmap, + // that fail to pass the test below, are probably frequent). A + // better solution would involve FSAA, but that's currently + // expensive, and might trigger bugs on display drivers, if + // VDevs get bigger than the actual screen. + sal_uInt32 nCurPos; + MetaAction* pAct; + for( nCurPos = 0, pAct = (MetaAction*)rOutMtf.FirstAction(); pAct; + pAct = (MetaAction*)rOutMtf.NextAction(), nCurPos++ ) + { + MetaAction* pModAct = NULL; + switch( pAct->GetType() ) + { + case META_FONT_ACTION: + { + MetaFontAction* pA = (MetaFontAction*)pAct; + Font aFont( pA->GetFont() ); + if ( !aFont.GetWidth() ) + { + FontMetric aFontMetric( pOut->GetFontMetric( aFont ) ); + aFont.SetWidth( aFontMetric.GetWidth() ); + pModAct = new MetaFontAction( aFont ); + } + } + // FALLTHROUGH intended + case META_NULL_ACTION: + // FALLTHROUGH intended + + // OutDev state changes (which don't affect bitmap + // output) + case META_LINECOLOR_ACTION: + // FALLTHROUGH intended + case META_FILLCOLOR_ACTION: + // FALLTHROUGH intended + case META_TEXTCOLOR_ACTION: + // FALLTHROUGH intended + case META_TEXTFILLCOLOR_ACTION: + // FALLTHROUGH intended + case META_TEXTALIGN_ACTION: + // FALLTHROUGH intended + case META_TEXTLINECOLOR_ACTION: + // FALLTHROUGH intended + case META_TEXTLINE_ACTION: + // FALLTHROUGH intended + case META_PUSH_ACTION: + // FALLTHROUGH intended + case META_POP_ACTION: + // FALLTHROUGH intended + case META_LAYOUTMODE_ACTION: + // FALLTHROUGH intended + case META_TEXTLANGUAGE_ACTION: + // FALLTHROUGH intended + case META_COMMENT_ACTION: + break; + + // bitmap output methods + case META_BMP_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpAction* pAction = (MetaBmpAction*)pAct; + + rOutBmpEx = BitmapEx( pAction->GetBitmap() ); + muckWithBitmap( pOut->LogicToPixel( pAction->GetPoint(), + rPrefMapMode ), + pAction->GetBitmap().GetSizePixel(), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + case META_BMPSCALE_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpScaleAction* pAction = (MetaBmpScaleAction*)pAct; + + rOutBmpEx = BitmapEx( pAction->GetBitmap() ); + muckWithBitmap( pOut->LogicToPixel( pAction->GetPoint(), + rPrefMapMode ), + pOut->LogicToPixel( pAction->GetSize(), + rPrefMapMode ), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + case META_BMPSCALEPART_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpScalePartAction* pAction = (MetaBmpScalePartAction*)pAct; + + rOutBmpEx = muckWithBitmap( BitmapEx( pAction->GetBitmap() ), + pAction->GetSrcPoint(), + pAction->GetSrcSize(), + pOut->LogicToPixel( pAction->GetDestPoint(), + rPrefMapMode ), + pOut->LogicToPixel( pAction->GetDestSize(), + rPrefMapMode ), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + case META_BMPEX_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpExAction* pAction = (MetaBmpExAction*)pAct; + + rOutBmpEx = pAction->GetBitmapEx(); + muckWithBitmap( pOut->LogicToPixel( pAction->GetPoint(), + rPrefMapMode ), + pAction->GetBitmapEx().GetSizePixel(), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + case META_BMPEXSCALE_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpExScaleAction* pAction = (MetaBmpExScaleAction*)pAct; + + rOutBmpEx = pAction->GetBitmapEx(); + muckWithBitmap( pOut->LogicToPixel( pAction->GetPoint(), + rPrefMapMode ), + pOut->LogicToPixel( pAction->GetSize(), + rPrefMapMode ), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + case META_BMPEXSCALEPART_ACTION: + if( !nNumBitmaps && !bNonBitmapActionEncountered ) + { + MetaBmpExScalePartAction* pAction = (MetaBmpExScalePartAction*)pAct; + + rOutBmpEx = muckWithBitmap( pAction->GetBitmapEx(), + pAction->GetSrcPoint(), + pAction->GetSrcSize(), + pOut->LogicToPixel( pAction->GetDestPoint(), + rPrefMapMode ), + pOut->LogicToPixel( pAction->GetDestSize(), + rPrefMapMode ), + rSizePix, + bNonBitmapActionEncountered ); + ++nNumBitmaps; + } + break; + + // these actions actually output something (that's + // different from a bitmap) + case META_RASTEROP_ACTION: + if( ((MetaRasterOpAction*)pAct)->GetRasterOp() == ROP_OVERPAINT ) + break; + // FALLTHROUGH intended + case META_PIXEL_ACTION: + // FALLTHROUGH intended + case META_POINT_ACTION: + // FALLTHROUGH intended + case META_LINE_ACTION: + // FALLTHROUGH intended + case META_RECT_ACTION: + // FALLTHROUGH intended + case META_ROUNDRECT_ACTION: + // FALLTHROUGH intended + case META_ELLIPSE_ACTION: + // FALLTHROUGH intended + case META_ARC_ACTION: + // FALLTHROUGH intended + case META_PIE_ACTION: + // FALLTHROUGH intended + case META_CHORD_ACTION: + // FALLTHROUGH intended + case META_POLYLINE_ACTION: + // FALLTHROUGH intended + case META_POLYGON_ACTION: + // FALLTHROUGH intended + case META_POLYPOLYGON_ACTION: + // FALLTHROUGH intended + + case META_TEXT_ACTION: + // FALLTHROUGH intended + case META_TEXTARRAY_ACTION: + // FALLTHROUGH intended + case META_STRETCHTEXT_ACTION: + // FALLTHROUGH intended + case META_TEXTRECT_ACTION: + // FALLTHROUGH intended + + case META_MASK_ACTION: + // FALLTHROUGH intended + case META_MASKSCALE_ACTION: + // FALLTHROUGH intended + case META_MASKSCALEPART_ACTION: + // FALLTHROUGH intended + + case META_GRADIENT_ACTION: + // FALLTHROUGH intended + case META_HATCH_ACTION: + // FALLTHROUGH intended + case META_WALLPAPER_ACTION: + // FALLTHROUGH intended + + case META_TRANSPARENT_ACTION: + // FALLTHROUGH intended + case META_EPS_ACTION: + // FALLTHROUGH intended + case META_FLOATTRANSPARENT_ACTION: + // FALLTHROUGH intended + case META_GRADIENTEX_ACTION: + // FALLTHROUGH intended + + // OutDev state changes that _do_ affect bitmap + // output + case META_CLIPREGION_ACTION: + // FALLTHROUGH intended + case META_ISECTRECTCLIPREGION_ACTION: + // FALLTHROUGH intended + case META_ISECTREGIONCLIPREGION_ACTION: + // FALLTHROUGH intended + case META_MOVECLIPREGION_ACTION: + // FALLTHROUGH intended + + case META_MAPMODE_ACTION: + // FALLTHROUGH intended + case META_REFPOINT_ACTION: + // FALLTHROUGH intended + default: + bNonBitmapActionEncountered = true; + break; + } + if ( pModAct ) + { + rOutMtf.ReplaceAction( pModAct, nCurPos ); + pAct->Delete(); + } + else + { + if( pAct->GetRefCount() > 1 ) + { + rOutMtf.ReplaceAction( pModAct = pAct->Clone(), nCurPos ); + pAct->Delete(); + } + else + pModAct = pAct; + } + pModAct->Scale( fScaleX, fScaleY ); + } + rOutMtf.SetPrefSize( Size( FRound( aNewSize.Width() * fScaleX ), + FRound( aNewSize.Height() * fScaleY ) ) ); + } + + if( nNumBitmaps != 1 || bNonBitmapActionEncountered ) + { + if( rAttr.IsSpecialDrawMode() || rAttr.IsAdjusted() || rAttr.IsMirrored() || rAttr.IsRotated() || rAttr.IsTransparent() ) + ImplAdjust( rOutMtf, rAttr, ADJUSTMENT_ALL ); + + ImplDraw( pOut, rPt, rSz, rOutMtf, rAttr ); + rOutBmpEx = BitmapEx(); + } + + return TRUE; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, + long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, + long nStartX, long nEndX, long nStartY, long nEndY, + BitmapEx& rOutBmpEx ) +{ + Bitmap aBmp( rBmpEx.GetBitmap() ); + Bitmap aOutBmp; + BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); + BitmapWriteAccess* pWAcc; + BitmapColor aCol0, aCol1, aColRes; + const long nDstW = nEndX - nStartX + 1L; + const long nDstH = nEndY - nStartY + 1L; + long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY; + long nXDst, nYDst; + BYTE cR0, cG0, cB0, cR1, cG1, cB1; + BOOL bRet = FALSE; + + DBG_ASSERT( aBmp.GetSizePixel() == rBmpEx.GetSizePixel(), + "GraphicManager::ImplCreateScaled(): bmp size inconsistent" ); + + if( pAcc ) + { + aOutBmp = Bitmap( Size( nDstW, nDstH ), 24 ); + pWAcc = aOutBmp.AcquireWriteAccess(); + + if( pWAcc ) + { + if( pAcc->HasPalette() ) + { + if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + { + Scanline pLine0, pLine1; + + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ]; nTmpFY = pMapFY[ nY ]; + pLine0 = pAcc->GetScanline( nTmpY ); + pLine1 = pAcc->GetScanline( ++nTmpY ); + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; + + const BitmapColor& rCol0 = pAcc->GetPaletteColor( pLine0[ nTmpX ] ); + const BitmapColor& rCol2 = pAcc->GetPaletteColor( pLine1[ nTmpX ] ); + const BitmapColor& rCol1 = pAcc->GetPaletteColor( pLine0[ ++nTmpX ] ); + const BitmapColor& rCol3 = pAcc->GetPaletteColor( pLine1[ nTmpX ] ); + + cR0 = MAP( rCol0.GetRed(), rCol1.GetRed(), nTmpFX ); + cG0 = MAP( rCol0.GetGreen(), rCol1.GetGreen(), nTmpFX ); + cB0 = MAP( rCol0.GetBlue(), rCol1.GetBlue(), nTmpFX ); + + cR1 = MAP( rCol2.GetRed(), rCol3.GetRed(), nTmpFX ); + cG1 = MAP( rCol2.GetGreen(), rCol3.GetGreen(), nTmpFX ); + cB1 = MAP( rCol2.GetBlue(), rCol3.GetBlue(), nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aColRes ); + } + } + } + else + { + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ], nTmpFY = pMapFY[ nY ]; + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; + + aCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, nTmpX ) ); + aCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, ++nTmpX ) ); + cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( ++nTmpY, nTmpX ) ); + aCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY--, --nTmpX ) ); + cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aColRes ); + } + } + } + } + else + { + if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR ) + { + Scanline pLine0, pLine1, pTmp0, pTmp1; + long nOff; + + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ]; nTmpFY = pMapFY[ nY ]; + pLine0 = pAcc->GetScanline( nTmpY ); + pLine1 = pAcc->GetScanline( ++nTmpY ); + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nOff = 3L * ( nTmpX = pMapIX[ nX ] ); + nTmpFX = pMapFX[ nX ]; + + pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L; + cB0 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cG0 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cR0 = MAP( *pTmp0, *pTmp1, nTmpFX ); + + pTmp1 = ( pTmp0 = pLine1 + nOff ) + 3L; + cB1 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cG1 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cR1 = MAP( *pTmp0, *pTmp1, nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aColRes ); + } + } + } + else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) + { + Scanline pLine0, pLine1, pTmp0, pTmp1; + long nOff; + + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ]; nTmpFY = pMapFY[ nY ]; + pLine0 = pAcc->GetScanline( nTmpY ); + pLine1 = pAcc->GetScanline( ++nTmpY ); + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nOff = 3L * ( nTmpX = pMapIX[ nX ] ); + nTmpFX = pMapFX[ nX ]; + + pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L; + cR0 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cG0 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cB0 = MAP( *pTmp0, *pTmp1, nTmpFX ); + + pTmp1 = ( pTmp0 = pLine1 + nOff ) + 3L; + cR1 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cG1 = MAP( *pTmp0, *pTmp1, nTmpFX ); pTmp0++; pTmp1++; + cB1 = MAP( *pTmp0, *pTmp1, nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aColRes ); + } + } + } + else + { + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ]; nTmpFY = pMapFY[ nY ]; + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; + + aCol0 = pAcc->GetPixel( nTmpY, nTmpX ); + aCol1 = pAcc->GetPixel( nTmpY, ++nTmpX ); + cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aCol1 = pAcc->GetPixel( ++nTmpY, nTmpX ); + aCol0 = pAcc->GetPixel( nTmpY--, --nTmpX ); + cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aColRes ); + } + } + } + } + + aOutBmp.ReleaseAccess( pWAcc ); + bRet = TRUE; + } + + aBmp.ReleaseAccess( pAcc ); + } + + if( bRet && rBmpEx.IsTransparent() ) + { + bRet = FALSE; + + if( rBmpEx.IsAlpha() ) + { + DBG_ASSERT( rBmpEx.GetAlpha().GetSizePixel() == rBmpEx.GetSizePixel(), + "GraphicManager::ImplCreateScaled(): alpha mask size inconsistent" ); + + AlphaMask aAlpha( rBmpEx.GetAlpha() ); + AlphaMask aOutAlpha; + + pAcc = aAlpha.AcquireReadAccess(); + + if( pAcc ) + { + aOutAlpha = AlphaMask( Size( nDstW, nDstH ) ); + pWAcc = aOutAlpha.AcquireWriteAccess(); + + if( pWAcc ) + { + if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL && + pWAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + { + Scanline pLine0, pLine1, pLineW; + + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ]; nTmpFY = pMapFY[ nY ]; + pLine0 = pAcc->GetScanline( nTmpY ); + pLine1 = pAcc->GetScanline( ++nTmpY ); + pLineW = pWAcc->GetScanline( nYDst ); + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++, nXDst++ ) + { + nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; + + const long nAlpha0 = pLine0[ nTmpX ]; + const long nAlpha2 = pLine1[ nTmpX ]; + const long nAlpha1 = pLine0[ ++nTmpX ]; + const long nAlpha3 = pLine1[ nTmpX ]; + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + + *pLineW++ = MAP( n0, n1, nTmpFY ); + } + } + } + else + { + BitmapColor aAlphaValue( 0 ); + + for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) + { + nTmpY = pMapIY[ nY ], nTmpFY = pMapFY[ nY ]; + + for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) + { + nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; + + long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); + long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + + nAlpha1 = pAcc->GetPixel( ++nTmpY, nTmpX ).GetIndex(); + nAlpha0 = pAcc->GetPixel( nTmpY--, --nTmpX ).GetIndex(); + const long n1 = MAP( nAlpha0, nAlpha1, nTmpFX ); + + aAlphaValue.SetIndex( MAP( n0, n1, nTmpFY ) ); + pWAcc->SetPixel( nYDst, nXDst++, aAlphaValue ); + } + } + } + + aOutAlpha.ReleaseAccess( pWAcc ); + bRet = TRUE; + } + + aAlpha.ReleaseAccess( pAcc ); + + if( bRet ) + rOutBmpEx = BitmapEx( aOutBmp, aOutAlpha ); + } + } + else + { + DBG_ASSERT( rBmpEx.GetMask().GetSizePixel() == rBmpEx.GetSizePixel(), + "GraphicManager::ImplCreateScaled(): mask size inconsistent" ); + + Bitmap aMsk( rBmpEx.GetMask() ); + Bitmap aOutMsk; + + pAcc = aMsk.AcquireReadAccess(); + + if( pAcc ) + { + // #i40115# Use the same palette for destination + // bitmap. Otherwise, we'd have to color-map even the + // case below, when both masks are one bit deep. + if( pAcc->HasPalette() ) + aOutMsk = Bitmap( Size( nDstW, nDstH ), + 1, + &pAcc->GetPalette() ); + else + aOutMsk = Bitmap( Size( nDstW, nDstH ), 1 ); + + pWAcc = aOutMsk.AcquireWriteAccess(); + + if( pWAcc ) + { + long* pMapLX = new long[ nDstW ]; + long* pMapLY = new long[ nDstH ]; + + // create new horizontal mapping table + for( nX = 0UL, nTmpX = nStartX; nX < nDstW; nTmpX++ ) + pMapLX[ nX++ ] = FRound( (double) pMapIX[ nTmpX ] + pMapFX[ nTmpX ] / 1048576. ); + + // create new vertical mapping table + for( nY = 0UL, nTmpY = nStartY; nY < nDstH; nTmpY++ ) + pMapLY[ nY++ ] = FRound( (double) pMapIY[ nTmpY ] + pMapFY[ nTmpY ] / 1048576. ); + + // do normal scaling + if( pAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && + pWAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL ) + { + // optimized + for( nY = 0; nY < nDstH; nY++ ) + { + Scanline pSrc = pAcc->GetScanline( pMapLY[ nY ] ); + Scanline pDst = pWAcc->GetScanline( nY ); + + for( nX = 0L; nX < nDstW; nX++ ) + { + const long nSrcX = pMapLX[ nX ]; + + if( pSrc[ nSrcX >> 3 ] & ( 1 << ( 7 - ( nSrcX & 7 ) ) ) ) + pDst[ nX >> 3 ] |= 1 << ( 7 - ( nX & 7 ) ); + else + pDst[ nX >> 3 ] &= ~( 1 << ( 7 - ( nX & 7 ) ) ); + } + } + } + else + { + const BitmapColor aB( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); + const BitmapColor aWB( pWAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); + const BitmapColor aWW( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + + if( pAcc->HasPalette() ) + { + for( nY = 0L; nY < nDstH; nY++ ) + { + for( nX = 0L; nX < nDstW; nX++ ) + { + if( pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( pMapLY[ nY ], pMapLX[ nX ] ) ) == aB ) + pWAcc->SetPixel( nY, nX, aWB ); + else + pWAcc->SetPixel( nY, nX, aWW ); + } + } + } + else + { + for( nY = 0L; nY < nDstH; nY++ ) + { + for( nX = 0L; nX < nDstW; nX++ ) + { + if( pAcc->GetPixel( pMapLY[ nY ], pMapLX[ nX ] ) == aB ) + pWAcc->SetPixel( nY, nX, aWB ); + else + pWAcc->SetPixel( nY, nX, aWW ); + } + } + } + } + + delete[] pMapLX; + delete[] pMapLY; + aOutMsk.ReleaseAccess( pWAcc ); + bRet = TRUE; + } + + aMsk.ReleaseAccess( pAcc ); + + if( bRet ) + rOutBmpEx = BitmapEx( aOutBmp, aOutMsk ); + } + } + + if( !bRet ) + rOutBmpEx = aOutBmp; + } + else + rOutBmpEx = aOutBmp; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, + USHORT nRot10, const Size& /*rOutSzPix*/, const Size& rUnrotatedSzPix, + long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, + long nStartX, long nEndX, long nStartY, long nEndY, + BitmapEx& rOutBmpEx ) +{ + Point aPt; + Bitmap aBmp( rBmpEx.GetBitmap() ); + Bitmap aOutBmp; + BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); + BitmapWriteAccess* pWAcc; + Polygon aPoly( Rectangle( aPt, rUnrotatedSzPix ) ); aPoly.Rotate( Point(), nRot10 ); + Rectangle aNewBound( aPoly.GetBoundRect() ); + const double fCosAngle = cos( nRot10 * F_PI1800 ), fSinAngle = sin( nRot10 * F_PI1800 ); + double fTmp; + const long nDstW = nEndX - nStartX + 1L; + const long nDstH = nEndY - nStartY + 1L; + const long nUnRotW = rUnrotatedSzPix.Width(); + const long nUnRotH = rUnrotatedSzPix.Height(); + long* pCosX = new long[ nDstW ]; + long* pSinX = new long[ nDstW ]; + long* pCosY = new long[ nDstH ]; + long* pSinY = new long[ nDstH ]; + long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY, nUnRotX, nUnRotY, nSinY, nCosY; + BYTE cR0, cG0, cB0, cR1, cG1, cB1; + BOOL bRet = FALSE; + + // create horizontal mapping table + for( nX = 0L, nTmpX = aNewBound.Left() + nStartX; nX < nDstW; nX++ ) + { + pCosX[ nX ] = FRound( fCosAngle * ( fTmp = nTmpX++ << 8 ) ); + pSinX[ nX ] = FRound( fSinAngle * fTmp ); + } + + // create vertical mapping table + for( nY = 0L, nTmpY = aNewBound.Top() + nStartY; nY < nDstH; nY++ ) + { + pCosY[ nY ] = FRound( fCosAngle * ( fTmp = nTmpY++ << 8 ) ); + pSinY[ nY ] = FRound( fSinAngle * fTmp ); + } + + if( pAcc ) + { + aOutBmp = Bitmap( Size( nDstW, nDstH ), 24 ); + pWAcc = aOutBmp.AcquireWriteAccess(); + + if( pWAcc ) + { + BitmapColor aColRes; + + if( pAcc->HasPalette() ) + { + for( nY = 0; nY < nDstH; nY++ ) + { + nSinY = pSinY[ nY ]; + nCosY = pCosY[ nY ]; + + for( nX = 0; nX < nDstW; nX++ ) + { + nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; + nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; + + if( ( nUnRotX >= 0L ) && ( nUnRotX < nUnRotW ) && + ( nUnRotY >= 0L ) && ( nUnRotY < nUnRotH ) ) + { + nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ]; + nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ]; + + const BitmapColor& rCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, nTmpX ) ); + const BitmapColor& rCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, ++nTmpX ) ); + cR0 = MAP( rCol0.GetRed(), rCol1.GetRed(), nTmpFX ); + cG0 = MAP( rCol0.GetGreen(), rCol1.GetGreen(), nTmpFX ); + cB0 = MAP( rCol0.GetBlue(), rCol1.GetBlue(), nTmpFX ); + + const BitmapColor& rCol3 = pAcc->GetPaletteColor( pAcc->GetPixel( ++nTmpY, nTmpX ) ); + const BitmapColor& rCol2 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, --nTmpX ) ); + cR1 = MAP( rCol2.GetRed(), rCol3.GetRed(), nTmpFX ); + cG1 = MAP( rCol2.GetGreen(), rCol3.GetGreen(), nTmpFX ); + cB1 = MAP( rCol2.GetBlue(), rCol3.GetBlue(), nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nY, nX, aColRes ); + } + } + } + } + else + { + BitmapColor aCol0, aCol1; + + for( nY = 0; nY < nDstH; nY++ ) + { + nSinY = pSinY[ nY ]; + nCosY = pCosY[ nY ]; + + for( nX = 0; nX < nDstW; nX++ ) + { + nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; + nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; + + if( ( nUnRotX >= 0L ) && ( nUnRotX < nUnRotW ) && + ( nUnRotY >= 0L ) && ( nUnRotY < nUnRotH ) ) + { + nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ]; + nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ]; + + aCol0 = pAcc->GetPixel( nTmpY, nTmpX ); + aCol1 = pAcc->GetPixel( nTmpY, ++nTmpX ); + cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aCol1 = pAcc->GetPixel( ++nTmpY, nTmpX ); + aCol0 = pAcc->GetPixel( nTmpY, --nTmpX ); + cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX ); + cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX ); + cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX ); + + aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); + aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); + aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); + pWAcc->SetPixel( nY, nX, aColRes ); + } + } + } + } + + aOutBmp.ReleaseAccess( pWAcc ); + bRet = TRUE; + } + + aBmp.ReleaseAccess( pAcc ); + } + + // mask processing + if( bRet && ( rBmpEx.IsTransparent() || ( nRot10 != 900 && nRot10 != 1800 && nRot10 != 2700 ) ) ) + { + bRet = FALSE; + + if( rBmpEx.IsAlpha() ) + { + AlphaMask aAlpha( rBmpEx.GetAlpha() ); + AlphaMask aOutAlpha; + + pAcc = aAlpha.AcquireReadAccess(); + + if( pAcc ) + { + aOutAlpha = AlphaMask( Size( nDstW, nDstH ) ); + pWAcc = aOutAlpha.AcquireWriteAccess(); + + if( pWAcc ) + { + if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL && + pWAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + { + Scanline pLine0, pLine1, pLineW; + + for( nY = 0; nY < nDstH; nY++ ) + { + nSinY = pSinY[ nY ], nCosY = pCosY[ nY ]; + pLineW = pWAcc->GetScanline( nY ); + + for( nX = 0; nX < nDstW; nX++ ) + { + nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; + nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; + + if( ( nUnRotX >= 0L ) && ( nUnRotX < nUnRotW ) && + ( nUnRotY >= 0L ) && ( nUnRotY < nUnRotH ) ) + { + nTmpX = pMapIX[ nUnRotX ], nTmpFX = pMapFX[ nUnRotX ]; + nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ]; + + pLine0 = pAcc->GetScanline( nTmpY++ ); + pLine1 = pAcc->GetScanline( nTmpY ); + + const long nAlpha0 = pLine0[ nTmpX ]; + const long nAlpha2 = pLine1[ nTmpX++ ]; + const long nAlpha1 = pLine0[ nTmpX ]; + const long nAlpha3 = pLine1[ nTmpX ]; + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + + *pLineW++ = MAP( n0, n1, nTmpFY ); + } + else + *pLineW++ = 255; + } + } + } + else + { + const BitmapColor aTrans( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + BitmapColor aAlphaVal( 0 ); + + for( nY = 0; nY < nDstH; nY++ ) + { + nSinY = pSinY[ nY ], nCosY = pCosY[ nY ]; + + for( nX = 0; nX < nDstW; nX++ ) + { + nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; + nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; + + if( ( nUnRotX >= 0L ) && ( nUnRotX < nUnRotW ) && + ( nUnRotY >= 0L ) && ( nUnRotY < nUnRotH ) ) + { + nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ]; + nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ]; + + const long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); + const long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); + const long nAlpha3 = pAcc->GetPixel( ++nTmpY, nTmpX ).GetIndex(); + const long nAlpha2 = pAcc->GetPixel( nTmpY, --nTmpX ).GetIndex(); + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + + aAlphaVal.SetIndex( MAP( n0, n1, nTmpFY ) ); + pWAcc->SetPixel( nY, nX, aAlphaVal ); + } + else + pWAcc->SetPixel( nY, nX, aTrans ); + } + } + } + + aOutAlpha.ReleaseAccess( pWAcc ); + bRet = TRUE; + } + + aAlpha.ReleaseAccess( pAcc ); + } + + if( bRet ) + rOutBmpEx = BitmapEx( aOutBmp, aOutAlpha ); + } + else + { + Bitmap aOutMsk( Size( nDstW, nDstH ), 1 ); + pWAcc = aOutMsk.AcquireWriteAccess(); + + if( pWAcc ) + { + Bitmap aMsk( rBmpEx.GetMask() ); + const BitmapColor aB( pWAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); + const BitmapColor aW( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + BitmapReadAccess* pMAcc = NULL; + + if( !aMsk || ( ( pMAcc = aMsk.AcquireReadAccess() ) != NULL ) ) + { + long* pMapLX = new long[ nUnRotW ]; + long* pMapLY = new long[ nUnRotH ]; + BitmapColor aTestB; + + if( pMAcc ) + aTestB = pMAcc->GetBestMatchingColor( Color( COL_BLACK ) ); + + // create new horizontal mapping table + for( nX = 0UL; nX < nUnRotW; nX++ ) + pMapLX[ nX ] = FRound( (double) pMapIX[ nX ] + pMapFX[ nX ] / 1048576. ); + + // create new vertical mapping table + for( nY = 0UL; nY < nUnRotH; nY++ ) + pMapLY[ nY ] = FRound( (double) pMapIY[ nY ] + pMapFY[ nY ] / 1048576. ); + + // do mask rotation + for( nY = 0; nY < nDstH; nY++ ) + { + nSinY = pSinY[ nY ]; + nCosY = pCosY[ nY ]; + + for( nX = 0; nX < nDstW; nX++ ) + { + nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; + nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; + + if( ( nUnRotX >= 0L ) && ( nUnRotX < nUnRotW ) && + ( nUnRotY >= 0L ) && ( nUnRotY < nUnRotH ) ) + { + if( pMAcc ) + { + if( pMAcc->GetPixel( pMapLY[ nUnRotY ], pMapLX[ nUnRotX ] ) == aTestB ) + pWAcc->SetPixel( nY, nX, aB ); + else + pWAcc->SetPixel( nY, nX, aW ); + } + else + pWAcc->SetPixel( nY, nX, aB ); + } + else + pWAcc->SetPixel( nY, nX, aW ); + } + } + + delete[] pMapLX; + delete[] pMapLY; + + if( pMAcc ) + aMsk.ReleaseAccess( pMAcc ); + + bRet = TRUE; + } + + aOutMsk.ReleaseAccess( pWAcc ); + } + + if( bRet ) + rOutBmpEx = BitmapEx( aOutBmp, aOutMsk ); + } + + if( !bRet ) + rOutBmpEx = aOutBmp; + } + else + rOutBmpEx = aOutBmp; + + delete[] pSinX; + delete[] pCosX; + delete[] pSinY; + delete[] pCosY; + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, ULONG nAdjustmentFlags ) +{ + GraphicAttr aAttr( rAttr ); + + if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + { + switch( aAttr.GetDrawMode() ) + { + case( GRAPHICDRAWMODE_MONO ): + rBmpEx.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); + break; + + case( GRAPHICDRAWMODE_GREYS ): + rBmpEx.Convert( BMP_CONVERSION_8BIT_GREYS ); + break; + + case( GRAPHICDRAWMODE_WATERMARK ): + { + aAttr.SetLuminance( aAttr.GetLuminance() + WATERMARK_LUM_OFFSET ); + aAttr.SetContrast( aAttr.GetContrast() + WATERMARK_CON_OFFSET ); + } + break; + + default: + break; + } + } + + if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + { + rBmpEx.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), + aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), + aAttr.GetGamma(), aAttr.IsInvert() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + { + rBmpEx.Mirror( aAttr.GetMirrorFlags() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + { + rBmpEx.Rotate( aAttr.GetRotation(), Color( COL_TRANSPARENT ) ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + { + AlphaMask aAlpha; + BYTE cTrans = aAttr.GetTransparency(); + + if( !rBmpEx.IsTransparent() ) + aAlpha = AlphaMask( rBmpEx.GetSizePixel(), &cTrans ); + else if( !rBmpEx.IsAlpha() ) + { + aAlpha = rBmpEx.GetMask(); + aAlpha.Replace( 0, cTrans ); + } + else + { + aAlpha = rBmpEx.GetAlpha(); + BitmapWriteAccess* pA = aAlpha.AcquireWriteAccess(); + + if( pA ) + { + ULONG nTrans = cTrans, nNewTrans; + const long nWidth = pA->Width(), nHeight = pA->Height(); + + if( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + { + for( long nY = 0; nY < nHeight; nY++ ) + { + Scanline pAScan = pA->GetScanline( nY ); + + for( long nX = 0; nX < nWidth; nX++ ) + { + nNewTrans = nTrans + *pAScan; + *pAScan++ = (BYTE) ( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ); + } + } + } + else + { + BitmapColor aAlphaValue( 0 ); + + for( long nY = 0; nY < nHeight; nY++ ) + { + for( long nX = 0; nX < nWidth; nX++ ) + { + nNewTrans = nTrans + pA->GetPixel( nY, nX ).GetIndex(); + aAlphaValue.SetIndex( (BYTE) ( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) ); + pA->SetPixel( nY, nX, aAlphaValue ); + } + } + } + + aAlpha.ReleaseAccess( pA ); + } + } + + rBmpEx = BitmapEx( rBmpEx.GetBitmap(), aAlpha ); + } +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, ULONG nAdjustmentFlags ) +{ + GraphicAttr aAttr( rAttr ); + + if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + { + switch( aAttr.GetDrawMode() ) + { + case( GRAPHICDRAWMODE_MONO ): + rMtf.Convert( MTF_CONVERSION_1BIT_THRESHOLD ); + break; + + case( GRAPHICDRAWMODE_GREYS ): + rMtf.Convert( MTF_CONVERSION_8BIT_GREYS ); + break; + + case( GRAPHICDRAWMODE_WATERMARK ): + { + aAttr.SetLuminance( aAttr.GetLuminance() + WATERMARK_LUM_OFFSET ); + aAttr.SetContrast( aAttr.GetContrast() + WATERMARK_CON_OFFSET ); + } + break; + + default: + break; + } + } + + if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + { + rMtf.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), + aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), + aAttr.GetGamma(), aAttr.IsInvert() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + { + rMtf.Mirror( aAttr.GetMirrorFlags() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + { + rMtf.Rotate( aAttr.GetRotation() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + { + DBG_ERROR( "Missing implementation: Mtf-Transparency" ); + } +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, ULONG nAdjustmentFlags ) +{ + GraphicAttr aAttr( rAttr ); + + if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + { + switch( aAttr.GetDrawMode() ) + { + case( GRAPHICDRAWMODE_MONO ): + rAnimation.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); + break; + + case( GRAPHICDRAWMODE_GREYS ): + rAnimation.Convert( BMP_CONVERSION_8BIT_GREYS ); + break; + + case( GRAPHICDRAWMODE_WATERMARK ): + { + aAttr.SetLuminance( aAttr.GetLuminance() + WATERMARK_LUM_OFFSET ); + aAttr.SetContrast( aAttr.GetContrast() + WATERMARK_CON_OFFSET ); + } + break; + + default: + break; + } + } + + if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + { + rAnimation.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), + aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), + aAttr.GetGamma(), aAttr.IsInvert() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + { + rAnimation.Mirror( aAttr.GetMirrorFlags() ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + { + DBG_ERROR( "Missing implementation: Animation-Rotation" ); + } + + if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + { + DBG_ERROR( "Missing implementation: Animation-Transparency" ); + } +} + +// ----------------------------------------------------------------------------- + +void GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz, + const GDIMetaFile& rMtf, const GraphicAttr& rAttr ) +{ + USHORT nRot10 = rAttr.GetRotation() % 3600; + Point aOutPt( rPt ); + Size aOutSz( rSz ); + + if( nRot10 ) + { + Polygon aPoly( Rectangle( aOutPt, aOutSz ) ); + + aPoly.Rotate( aOutPt, nRot10 ); + const Rectangle aRotBoundRect( aPoly.GetBoundRect() ); + aOutPt = aRotBoundRect.TopLeft(); + aOutSz = aRotBoundRect.GetSize(); + } + + pOut->Push( PUSH_CLIPREGION ); + pOut->IntersectClipRegion( Rectangle( aOutPt, aOutSz ) ); + + ( (GDIMetaFile&) rMtf ).WindStart(); + ( (GDIMetaFile&) rMtf ).Play( pOut, aOutPt, aOutSz ); + ( (GDIMetaFile&) rMtf ).WindStart(); + + pOut->Pop(); +} + +// ----------------------------------------------------------------------------- + +struct ImplTileInfo +{ + ImplTileInfo() : aTileTopLeft(), aNextTileTopLeft(), aTileSizePixel(), nTilesEmptyX(0), nTilesEmptyY(0) {} + + Point aTileTopLeft; // top, left position of the rendered tile + Point aNextTileTopLeft; // top, left position for next recursion + // level's tile + Size aTileSizePixel; // size of the generated tile (might + // differ from + // aNextTileTopLeft-aTileTopLeft, because + // this is nExponent*prevTileSize. The + // generated tile is always nExponent + // times the previous tile, such that it + // can be used in the next stage. The + // required area coverage is often + // less. The extraneous area covered is + // later overwritten by the next stage) + int nTilesEmptyX; // number of original tiles empty right of + // this tile. This counts from + // aNextTileTopLeft, i.e. the additional + // area covered by aTileSizePixel is not + // considered here. This is for + // unification purposes, as the iterative + // calculation of the next level's empty + // tiles has to be based on this value. + int nTilesEmptyY; // as above, for Y +}; + + +bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, + int nNumTilesX, int nNumTilesY, + const Size& rTileSizePixel, + const GraphicAttr* pAttr, ULONG nFlags ) +{ + if( nExponent <= 1 ) + return false; + + // determine MSB factor + int nMSBFactor( 1 ); + while( nNumTilesX / nMSBFactor != 0 || + nNumTilesY / nMSBFactor != 0 ) + { + nMSBFactor *= nExponent; + } + + // one less + nMSBFactor /= nExponent; + + ImplTileInfo aTileInfo; + + // #105229# Switch off mapping (converting to logic and back to + // pixel might cause roundoff errors) + BOOL bOldMap( rVDev.IsMapModeEnabled() ); + rVDev.EnableMapMode( FALSE ); + + bool bRet( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor, nNumTilesX, nNumTilesY, + nNumTilesX, nNumTilesY, rTileSizePixel, pAttr, nFlags, aTileInfo ) ); + + rVDev.EnableMapMode( bOldMap ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +// define for debug drawings +//#define DBG_TEST + +// see header comment. this works similar to base conversion of a +// number, i.e. if the exponent is 10, then the number for every tile +// size is given by the decimal place of the corresponding decimal +// representation. +bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent, int nMSBFactor, + int nNumOrigTilesX, int nNumOrigTilesY, + int nRemainderTilesX, int nRemainderTilesY, + const Size& rTileSizePixel, const GraphicAttr* pAttr, + ULONG nFlags, ImplTileInfo& rTileInfo ) +{ + // gets loaded with our tile bitmap + GraphicObject aTmpGraphic; + + // stores a flag that renders the zero'th tile position + // (i.e. (0,0)+rCurrPos) only if we're at the bottom of the + // recursion stack. All other position already have that tile + // rendered, because the lower levels painted their generated tile + // there. + bool bNoFirstTileDraw( false ); + + // what's left when we're done with our tile size + const int nNewRemainderX( nRemainderTilesX % nMSBFactor ); + const int nNewRemainderY( nRemainderTilesY % nMSBFactor ); + + // gets filled out from the recursive call with info of what's + // been generated + ImplTileInfo aTileInfo; + + // current output position while drawing + Point aCurrPos; + int nX, nY; + + // check for recursion's end condition: LSB place reached? + if( nMSBFactor == 1 ) + { + aTmpGraphic = *this; + + // set initial tile size -> orig size + aTileInfo.aTileSizePixel = rTileSizePixel; + aTileInfo.nTilesEmptyX = nNumOrigTilesX; + aTileInfo.nTilesEmptyY = nNumOrigTilesY; + } + else if( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor/nExponent, + nNumOrigTilesX, nNumOrigTilesY, + nNewRemainderX, nNewRemainderY, + rTileSizePixel, pAttr, nFlags, aTileInfo ) ) + { + // extract generated tile -> see comment on the first loop below + BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) ); + + aTmpGraphic = GraphicObject( aTileBitmap ); + + // fill stripes left over from upstream levels: + // + // x0000 + // 0 + // 0 + // 0 + // 0 + // + // where x denotes the place filled by our recursive predecessors + + // check whether we have to fill stripes here. Although not + // obvious, there is one case where we can skip this step: if + // the previous recursion level (the one who filled our + // aTileInfo) had zero area to fill, then there are no white + // stripes left, naturally. This happens if the digit + // associated to that level has a zero, and can be checked via + // aTileTopLeft==aNextTileTopLeft. + if( aTileInfo.aTileTopLeft != aTileInfo.aNextTileTopLeft ) + { + // now fill one row from aTileInfo.aNextTileTopLeft.X() all + // the way to the right + aCurrPos.X() = aTileInfo.aNextTileTopLeft.X(); + aCurrPos.Y() = aTileInfo.aTileTopLeft.Y(); + for( nX=0; nX < aTileInfo.nTilesEmptyX; nX += nMSBFactor ) + { + if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) ) + return false; + + aCurrPos.X() += aTileInfo.aTileSizePixel.Width(); + } + +#ifdef DBG_TEST +// rVDev.SetFillColor( COL_WHITE ); + rVDev.SetFillColor(); + rVDev.SetLineColor( Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) ); + rVDev.DrawEllipse( Rectangle(aTileInfo.aNextTileTopLeft.X(), aTileInfo.aTileTopLeft.Y(), + aTileInfo.aNextTileTopLeft.X() - 1 + (aTileInfo.nTilesEmptyX/nMSBFactor)*aTileInfo.aTileSizePixel.Width(), + aTileInfo.aTileTopLeft.Y() + aTileInfo.aTileSizePixel.Height() - 1) ); +#endif + + // now fill one column from aTileInfo.aNextTileTopLeft.Y() all + // the way to the bottom + aCurrPos.X() = aTileInfo.aTileTopLeft.X(); + aCurrPos.Y() = aTileInfo.aNextTileTopLeft.Y(); + for( nY=0; nY < aTileInfo.nTilesEmptyY; nY += nMSBFactor ) + { + if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) ) + return false; + + aCurrPos.Y() += aTileInfo.aTileSizePixel.Height(); + } + +#ifdef DBG_TEST + rVDev.DrawEllipse( Rectangle(aTileInfo.aTileTopLeft.X(), aTileInfo.aNextTileTopLeft.Y(), + aTileInfo.aTileTopLeft.X() + aTileInfo.aTileSizePixel.Width() - 1, + aTileInfo.aNextTileTopLeft.Y() - 1 + (aTileInfo.nTilesEmptyY/nMSBFactor)*aTileInfo.aTileSizePixel.Height()) ); +#endif + } + else + { + // Thought that aTileInfo.aNextTileTopLeft tile has always + // been drawn already, but that's wrong: typically, + // _parts_ of that tile have been drawn, since the + // previous level generated the tile there. But when + // aTileInfo.aNextTileTopLeft!=aTileInfo.aTileTopLeft, the + // difference between these two values is missing in the + // lower right corner of this first tile. So, can do that + // only here. + bNoFirstTileDraw = true; + } + } + else + { + return false; + } + + // calc number of original tiles in our drawing area without + // remainder + nRemainderTilesX -= nNewRemainderX; + nRemainderTilesY -= nNewRemainderY; + + // fill tile info for calling method + rTileInfo.aTileTopLeft = aTileInfo.aNextTileTopLeft; + rTileInfo.aNextTileTopLeft = Point( rTileInfo.aTileTopLeft.X() + rTileSizePixel.Width()*nRemainderTilesX, + rTileInfo.aTileTopLeft.Y() + rTileSizePixel.Height()*nRemainderTilesY ); + rTileInfo.aTileSizePixel = Size( rTileSizePixel.Width()*nMSBFactor*nExponent, + rTileSizePixel.Height()*nMSBFactor*nExponent ); + rTileInfo.nTilesEmptyX = aTileInfo.nTilesEmptyX - nRemainderTilesX; + rTileInfo.nTilesEmptyY = aTileInfo.nTilesEmptyY - nRemainderTilesY; + + // init output position + aCurrPos = aTileInfo.aNextTileTopLeft; + + // fill our drawing area. Fill possibly more, to create the next + // bigger tile size -> see bitmap extraction above. This does no + // harm, since everything right or below our actual area is + // overdrawn by our caller. Just in case we're in the last level, + // we don't draw beyond the right or bottom border. + for( nY=0; nY < aTileInfo.nTilesEmptyY && nY < nExponent*nMSBFactor; nY += nMSBFactor ) + { + aCurrPos.X() = aTileInfo.aNextTileTopLeft.X(); + + for( nX=0; nX < aTileInfo.nTilesEmptyX && nX < nExponent*nMSBFactor; nX += nMSBFactor ) + { + if( bNoFirstTileDraw ) + bNoFirstTileDraw = false; // don't draw first tile position + else if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) ) + return false; + + aCurrPos.X() += aTileInfo.aTileSizePixel.Width(); + } + + aCurrPos.Y() += aTileInfo.aTileSizePixel.Height(); + } + +#ifdef DBG_TEST +// rVDev.SetFillColor( COL_WHITE ); + rVDev.SetFillColor(); + rVDev.SetLineColor( Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) ); + rVDev.DrawRect( Rectangle((rTileInfo.aTileTopLeft.X())*rTileSizePixel.Width(), + (rTileInfo.aTileTopLeft.Y())*rTileSizePixel.Height(), + (rTileInfo.aNextTileTopLeft.X())*rTileSizePixel.Width()-1, + (rTileInfo.aNextTileTopLeft.Y())*rTileSizePixel.Height()-1) ); +#endif + + return true; +} + +// ----------------------------------------------------------------------------- + +bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSizePixel, + const Size& rOffset, const GraphicAttr* pAttr, ULONG nFlags, int nTileCacheSize1D ) +{ + // how many tiles to generate per recursion step + enum{ SubdivisionExponent=2 }; + + const MapMode aOutMapMode( pOut->GetMapMode() ); + const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); + bool bRet( false ); + + // #i42643# Casting to Int64, to avoid integer overflow for + // huge-DPI output devices + if( GetGraphic().GetType() == GRAPHIC_BITMAP && + static_cast<sal_Int64>(rSizePixel.Width()) * rSizePixel.Height() < + static_cast<sal_Int64>(nTileCacheSize1D)*nTileCacheSize1D ) + { + // First combine very small bitmaps into a larger tile + // =================================================== + + VirtualDevice aVDev; + const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.Width()-1) / rSizePixel.Width() ); + const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.Height()-1) / rSizePixel.Height() ); + + aVDev.SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(), + nNumTilesInCacheY*rSizePixel.Height() ) ); + aVDev.SetMapMode( aMapMode ); + + // draw bitmap content + if( ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, + nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) ) + { + BitmapEx aTileBitmap( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ); + + // draw alpha content, if any + if( IsTransparent() ) + { + GraphicObject aAlphaGraphic; + + if( GetGraphic().IsAlpha() ) + aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() ); + else + aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() ); + + if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, + nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) ) + { + // Combine bitmap and alpha/mask + if( GetGraphic().IsAlpha() ) + aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), + AlphaMask( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ) ); + else + aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), + aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ).CreateMask( Color(COL_WHITE) ) ); + } + } + + // paint generated tile + GraphicObject aTmpGraphic( aTileBitmap ); + bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea, + aTileBitmap.GetSizePixel(), + rOffset, pAttr, nFlags, nTileCacheSize1D ); + } + } + else + { + const Size aOutOffset( pOut->LogicToPixel( rOffset, aOutMapMode ) ); + const Rectangle aOutArea( pOut->LogicToPixel( rArea, aOutMapMode ) ); + + // number of invisible (because out-of-area) tiles + int nInvisibleTilesX; + int nInvisibleTilesY; + + // round towards -infty for negative offset + if( aOutOffset.Width() < 0 ) + nInvisibleTilesX = (aOutOffset.Width() - rSizePixel.Width() + 1) / rSizePixel.Width(); + else + nInvisibleTilesX = aOutOffset.Width() / rSizePixel.Width(); + + // round towards -infty for negative offset + if( aOutOffset.Height() < 0 ) + nInvisibleTilesY = (aOutOffset.Height() - rSizePixel.Height() + 1) / rSizePixel.Height(); + else + nInvisibleTilesY = aOutOffset.Height() / rSizePixel.Height(); + + // origin from where to 'virtually' start drawing in pixel + const Point aOutOrigin( pOut->LogicToPixel( Point( rArea.Left() - rOffset.Width(), + rArea.Top() - rOffset.Height() ) ) ); + // position in pixel from where to really start output + const Point aOutStart( aOutOrigin.X() + nInvisibleTilesX*rSizePixel.Width(), + aOutOrigin.Y() + nInvisibleTilesY*rSizePixel.Height() ); + + pOut->Push( PUSH_CLIPREGION ); + pOut->IntersectClipRegion( rArea ); + + // Paint all tiles + // =============== + + bRet = ImplDrawTiled( *pOut, aOutStart, + (aOutArea.GetWidth() + aOutArea.Left() - aOutStart.X() + rSizePixel.Width() - 1) / rSizePixel.Width(), + (aOutArea.GetHeight() + aOutArea.Top() - aOutStart.Y() + rSizePixel.Height() - 1) / rSizePixel.Height(), + rSizePixel, pAttr, nFlags ); + + pOut->Pop(); + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, + int nNumTilesX, int nNumTilesY, + const Size& rTileSizePixel, const GraphicAttr* pAttr, ULONG nFlags ) +{ + Point aCurrPos( rPosPixel ); + Size aTileSizeLogic( rOut.PixelToLogic( rTileSizePixel ) ); + int nX, nY; + + // #107607# Use logical coordinates for metafile playing, too + bool bDrawInPixel( rOut.GetConnectMetaFile() == NULL && GRAPHIC_BITMAP == GetType() ); + BOOL bRet( FALSE ); + + // #105229# Switch off mapping (converting to logic and back to + // pixel might cause roundoff errors) + BOOL bOldMap( rOut.IsMapModeEnabled() ); + + if( bDrawInPixel ) + rOut.EnableMapMode( FALSE ); + + for( nY=0; nY < nNumTilesY; ++nY ) + { + aCurrPos.X() = rPosPixel.X(); + + for( nX=0; nX < nNumTilesX; ++nX ) + { + // #105229# work with pixel coordinates here, mapping is disabled! + // #104004# don't disable mapping for metafile recordings + // #108412# don't quit the loop if one draw fails + + // update return value. This method should return true, if + // at least one of the looped Draws succeeded. + bRet |= Draw( &rOut, + bDrawInPixel ? aCurrPos : rOut.PixelToLogic( aCurrPos ), + bDrawInPixel ? rTileSizePixel : aTileSizeLogic, + pAttr, nFlags ); + + aCurrPos.X() += rTileSizePixel.Width(); + } + + aCurrPos.Y() += rTileSizePixel.Height(); + } + + if( bDrawInPixel ) + rOut.EnableMapMode( bOldMap ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + const Size& rCropLeftTop, + const Size& rCropRightBottom, + const Rectangle& rCropRect, + const Size& rDstSize, + BOOL bEnlarge ) const +{ + // #107947# Extracted from svdograf.cxx + + // #104115# Crop the bitmap + if( rAttr.IsCropped() ) + { + rBmpEx.Crop( rCropRect ); + + // #104115# Negative crop sizes mean: enlarge bitmap and pad + if( bEnlarge && ( + rCropLeftTop.Width() < 0 || + rCropLeftTop.Height() < 0 || + rCropRightBottom.Width() < 0 || + rCropRightBottom.Height() < 0 ) ) + { + Size aBmpSize( rBmpEx.GetSizePixel() ); + sal_Int32 nPadLeft( rCropLeftTop.Width() < 0 ? -rCropLeftTop.Width() : 0 ); + sal_Int32 nPadTop( rCropLeftTop.Height() < 0 ? -rCropLeftTop.Height() : 0 ); + sal_Int32 nPadTotalWidth( aBmpSize.Width() + nPadLeft + (rCropRightBottom.Width() < 0 ? -rCropRightBottom.Width() : 0) ); + sal_Int32 nPadTotalHeight( aBmpSize.Height() + nPadTop + (rCropRightBottom.Height() < 0 ? -rCropRightBottom.Height() : 0) ); + + BitmapEx aBmpEx2; + + if( rBmpEx.IsTransparent() ) + { + if( rBmpEx.IsAlpha() ) + aBmpEx2 = BitmapEx( rBmpEx.GetBitmap(), rBmpEx.GetAlpha() ); + else + aBmpEx2 = BitmapEx( rBmpEx.GetBitmap(), rBmpEx.GetMask() ); + } + else + { + // #104115# Generate mask bitmap and init to zero + Bitmap aMask( aBmpSize, 1 ); + aMask.Erase( Color(0,0,0) ); + + // #104115# Always generate transparent bitmap, we need the border transparent + aBmpEx2 = BitmapEx( rBmpEx.GetBitmap(), aMask ); + + // #104115# Add opaque mask to source bitmap, otherwise the destination remains transparent + rBmpEx = aBmpEx2; + } + + aBmpEx2.SetSizePixel( Size(nPadTotalWidth, nPadTotalHeight) ); + aBmpEx2.Erase( Color(0xFF,0,0,0) ); + aBmpEx2.CopyPixel( Rectangle( Point(nPadLeft, nPadTop), aBmpSize ), Rectangle( Point(0, 0), aBmpSize ), &rBmpEx ); + rBmpEx = aBmpEx2; + } + } + + const Size aSizePixel( rBmpEx.GetSizePixel() ); + + if( rAttr.GetRotation() != 0 && !IsAnimated() ) + { + if( aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height() ) + { + double fSrcWH = (double) aSizePixel.Width() / aSizePixel.Height(); + double fDstWH = (double) rDstSize.Width() / rDstSize.Height(); + double fScaleX = 1.0, fScaleY = 1.0; + + // always choose scaling to shrink bitmap + if( fSrcWH < fDstWH ) + fScaleY = aSizePixel.Width() / ( fDstWH * aSizePixel.Height() ); + else + fScaleX = fDstWH * aSizePixel.Height() / aSizePixel.Width(); + + rBmpEx.Scale( fScaleX, fScaleY ); + } + } +} + diff --git a/svtools/source/graphic/makefile.mk b/svtools/source/graphic/makefile.mk new file mode 100644 index 000000000000..37870b46b80b --- /dev/null +++ b/svtools/source/graphic/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=graphic + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +.IF "$(GUI)"=="WIN" +LINKFLAGS=$(LINKFLAGS) /PACKC:32768 +.ENDIF + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/grfattr.obj \ + $(SLO)$/grfmgr.obj \ + $(SLO)$/grfmgr2.obj \ + $(SLO)$/grfcache.obj \ + $(SLO)$/descriptor.obj \ + $(SLO)$/provider.obj \ + $(SLO)$/graphic.obj \ + $(SLO)$/renderer.obj \ + $(SLO)$/graphicunofactory.obj \ + $(SLO)$/transformer.obj + +EXCEPTIONSFILES= \ + $(SLO)$/descriptor.obj \ + $(SLO)$/provider.obj \ + $(SLO)$/graphic.obj \ + $(SLO)$/renderer.obj \ + $(SLO)$/graphicunofactory.obj \ + $(SLO)$/transformer.obj + +# --- Target ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx new file mode 100644 index 000000000000..fbf95406a63a --- /dev/null +++ b/svtools/source/graphic/provider.cxx @@ -0,0 +1,861 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <rtl/uuid.h> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <vcl/image.hxx> +#include <vcl/metaact.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/imagerepository.hxx> +#include <tools/rcid.h> +#include <tools/resid.hxx> +#include <tools/resmgr.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <svtools/filter.hxx> +#include <svl/solar.hrc> +#include <vcl/salbtype.hxx> +#include <vcl/virdev.hxx> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> + +#include "descriptor.hxx" +#include "graphic.hxx" +#include <svtools/grfmgr.hxx> +#include "provider.hxx" + +using namespace com::sun::star; + +namespace unographic { + +#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" + +// ------------------- +// - GraphicProvider - +// ------------------- + +uno::Reference< uno::XInterface > SAL_CALL GraphicProvider_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) +{ + return SAL_STATIC_CAST( ::cppu::OWeakObject*, new GraphicProvider ); +} + +GraphicProvider::GraphicProvider() +{ +} + +// ------------------------------------------------------------------------------ + +GraphicProvider::~GraphicProvider() +{ +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString GraphicProvider::getImplementationName_Static() + throw() +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.GraphicProvider" ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > GraphicProvider::getSupportedServiceNames_Static() + throw() +{ + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ); + + return aSeq; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL GraphicProvider::getImplementationName() + throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL GraphicProvider::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); + + for( int i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() + throw(uno::RuntimeException) +{ + uno::Sequence< uno::Type > aTypes( 3 ); + uno::Type* pTypes = aTypes.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< graphic::XGraphicProvider>*)0); + + return aTypes; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() + throw(uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + static uno::Sequence< sal_Int8 > aId; + + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); + } + + return aId; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) + { + // graphic manager url + String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) ); + ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 ); + GraphicObject aGrafObj( aUniqueID ); + // I don't call aGrafObj.GetXGraphic because it will call us back + // into implLoadMemory ( with "private:memorygraphic" test ) + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + pUnoGraphic->init( aGrafObj.GetGraphic() ); + xRet = pUnoGraphic; + } + return xRet; +} + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:memorygraphic" ) ) ) + { + sal_Int64 nGraphicAddress = rResourceURL.getToken( 0, '/', nIndex ).toInt64(); + + if( nGraphicAddress ) + { + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + + pUnoGraphic->init( *reinterpret_cast< ::Graphic* >( nGraphicAddress ) ); + xRet = pUnoGraphic; + } + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:graphicrepository" ) ) ) + { + String sPathName( rResourceURL.copy( nIndex ) ); + BitmapEx aBitmap; + if ( ::vcl::ImageRepository::loadImage( sPathName, aBitmap, false ) ) + { + Image aImage( aBitmap ); + xRet = aImage.GetXGraphic(); + } + } + return xRet; +} + + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:standardimage" ) ) ) + { + rtl::OUString sImageName( rResourceURL.copy( nIndex ) ); + if ( sImageName.compareToAscii( "info" ) ) + { + xRet = InfoBox::GetStandardImage().GetXGraphic(); + } + else if ( sImageName.compareToAscii( "warning" ) ) + { + xRet = WarningBox::GetStandardImage().GetXGraphic(); + } + else if ( sImageName.compareToAscii( "error" ) ) + { + xRet = ErrorBox::GetStandardImage().GetXGraphic(); + } + else if ( sImageName.compareToAscii( "query" ) ) + { + xRet = QueryBox::GetStandardImage().GetXGraphic(); + } + } + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadBitmap( const uno::Reference< awt::XBitmap >& xBtm ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + uno::Sequence< sal_Int8 > aBmpSeq( xBtm->getDIB() ); + uno::Sequence< sal_Int8 > aMaskSeq( xBtm->getMaskDIB() ); + SvMemoryStream aBmpStream( aBmpSeq.getArray(), aBmpSeq.getLength(), STREAM_READ ); + Bitmap aBmp; + aBmpStream >> aBmp; + + BitmapEx aBmpEx; + + if( aMaskSeq.getLength() ) + { + SvMemoryStream aMaskStream( aMaskSeq.getArray(), aMaskSeq.getLength(), STREAM_READ ); + Bitmap aMask; + aMaskStream >> aMask; + aBmpEx = BitmapEx( aBmp, aMask ); + } + else + aBmpEx = BitmapEx( aBmp ); + + if( !aBmpEx.IsEmpty() ) + { + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + + pUnoGraphic->init( aBmpEx ); + xRet = pUnoGraphic; + } + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:resource" ) ) ) + { + ByteString aResMgrName( String( rResourceURL.getToken( 0, '/', nIndex ) ), RTL_TEXTENCODING_ASCII_US ); + + ResMgr* pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + const ::rtl::OUString aResourceType( rResourceURL.getToken( 0, '/', nIndex ) ); + const ResId aResId( rResourceURL.getToken( 0, '/', nIndex ).toInt32(), *pResMgr ); + + if( aResourceType.getLength() ) + { + BitmapEx aBmpEx; + + if( ( 0 == aResourceType.compareToAscii( "bitmap" ) ) || + ( 0 == aResourceType.compareToAscii( "bitmapex" ) ) ) + { + aResId.SetRT( RSC_BITMAP ); + + if( pResMgr->IsAvailable( aResId ) ) + { + aBmpEx = BitmapEx( aResId ); + } + } + else if( 0 == aResourceType.compareToAscii( "image" ) ) + { + aResId.SetRT( RSC_IMAGE ); + + if( pResMgr->IsAvailable( aResId ) ) + { + const Image aImage( aResId ); + aBmpEx = aImage.GetBitmapEx(); + } + } + else if( 0 == aResourceType.compareToAscii( "imagelist" ) ) + { + aResId.SetRT( RSC_IMAGELIST ); + + if( pResMgr->IsAvailable( aResId ) ) + { + const ImageList aImageList( aResId ); + sal_Int32 nImageId = ( nIndex > -1 ) ? rResourceURL.getToken( 0, '/', nIndex ).toInt32() : 0; + + if( 0 < nImageId ) + { + const Image aImage( aImageList.GetImage( sal::static_int_cast< USHORT >(nImageId) ) ); + aBmpEx = aImage.GetBitmapEx(); + } + else + { + aBmpEx = aImageList.GetAsHorizontalStrip(); + } + } + } + + if( !aBmpEx.IsEmpty() ) + { + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + + pUnoGraphic->init( aBmpEx ); + xRet = pUnoGraphic; + } + } + + delete pResMgr; + } + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDescriptor( const uno::Sequence< beans::PropertyValue >& rMediaProperties ) + throw ( io::IOException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xRet; + + ::rtl::OUString aURL; + uno::Reference< io::XInputStream > xIStm; + uno::Reference< awt::XBitmap >xBtm; + + for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i ) + { + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) + { + aValue >>= aURL; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "InputStream" ) ) + { + aValue >>= xIStm; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "Bitmap" ) ) + { + aValue >>= xBtm; + } + } + + if( xIStm.is() ) + { + GraphicDescriptor* pDescriptor = new GraphicDescriptor; + pDescriptor->init( xIStm, aURL ); + xRet = pDescriptor; + } + else if( aURL.getLength() ) + { + uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) ); + if( !xGraphic.is() ) + xGraphic = implLoadResource( aURL ); + if( !xGraphic.is() ) + xGraphic = implLoadGraphicObject( aURL ); + + if ( !xGraphic.is() ) + xGraphic = implLoadRepositoryImage( aURL ); + + if ( !xGraphic.is() ) + xGraphic = implLoadStandardImage( aURL ); + + if( xGraphic.is() ) + { + xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); + } + else + { + GraphicDescriptor* pDescriptor = new GraphicDescriptor; + pDescriptor->init( aURL ); + xRet = pDescriptor; + } + } + else if( xBtm.is() ) + { + uno::Reference< ::graphic::XGraphic > xGraphic( implLoadBitmap( xBtm ) ); + if( xGraphic.is() ) + xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( const uno::Sequence< ::beans::PropertyValue >& rMediaProperties ) + throw ( io::IOException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + uno::Reference< ::graphic::XGraphic > xRet; + String aPath; + SvStream* pIStm = NULL; + + uno::Reference< io::XInputStream > xIStm; + uno::Reference< awt::XBitmap >xBtm; + + for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !pIStm && !xRet.is(); ++i ) + { + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) + { + ::rtl::OUString aURL; + aValue >>= aURL; + aPath = aURL; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "InputStream" ) ) + { + aValue >>= xIStm; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "Bitmap" ) ) + { + aValue >>= xBtm; + } + } + + if( xIStm.is() ) + { + pIStm = ::utl::UcbStreamHelper::CreateStream( xIStm ); + } + else if( aPath.Len() ) + { + xRet = implLoadMemory( aPath ); + + if( !xRet.is() ) + xRet = implLoadGraphicObject( aPath ); + + if( !xRet.is() ) + xRet = implLoadResource( aPath ); + + if ( !xRet.is() ) + xRet = implLoadRepositoryImage( aPath ); + + if ( !xRet.is() ) + xRet = implLoadStandardImage( aPath ); + + if( !xRet.is() ) + pIStm = ::utl::UcbStreamHelper::CreateStream( aPath, STREAM_READ ); + } + else if( xBtm.is() ) + { + xRet = implLoadBitmap( xBtm ); + } + + if( pIStm ) + { + ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + + if( pFilter ) + { + ::Graphic aVCLGraphic; + + if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && + ( aVCLGraphic.GetType() != GRAPHIC_NONE ) ) + { + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + + pUnoGraphic->init( aVCLGraphic ); + xRet = pUnoGraphic; + } + } + + delete pIStm; + } + + return xRet; +} + +void ImplCalculateCropRect( ::Graphic& rGraphic, const text::GraphicCrop& rGraphicCropLogic, Rectangle& rGraphicCropPixel ) +{ + if ( rGraphicCropLogic.Left || rGraphicCropLogic.Top || rGraphicCropLogic.Right || rGraphicCropLogic.Bottom ) + { + Size aSourceSizePixel( rGraphic.GetSizePixel() ); + if ( aSourceSizePixel.Width() && aSourceSizePixel.Height() ) + { + if ( rGraphicCropLogic.Left || rGraphicCropLogic.Top || rGraphicCropLogic.Right || rGraphicCropLogic.Bottom ) + { + Size aSize100thMM( 0, 0 ); + if( rGraphic.GetPrefMapMode().GetMapUnit() != MAP_PIXEL ) + { + aSize100thMM = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), MAP_100TH_MM ); + } + else + { + aSize100thMM = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM ); + } + if ( aSize100thMM.Width() && aSize100thMM.Height() ) + { + double fSourceSizePixelWidth = static_cast<double>(aSourceSizePixel.Width()); + double fSourceSizePixelHeight= static_cast<double>(aSourceSizePixel.Height()); + rGraphicCropPixel.Left() = static_cast< sal_Int32 >((fSourceSizePixelWidth * rGraphicCropLogic.Left ) / aSize100thMM.Width()); + rGraphicCropPixel.Top() = static_cast< sal_Int32 >((fSourceSizePixelHeight * rGraphicCropLogic.Top ) / aSize100thMM.Height()); + rGraphicCropPixel.Right() = static_cast< sal_Int32 >(( fSourceSizePixelWidth * ( aSize100thMM.Width() - rGraphicCropLogic.Right ) ) / aSize100thMM.Width() ); + rGraphicCropPixel.Bottom() = static_cast< sal_Int32 >(( fSourceSizePixelHeight * ( aSize100thMM.Height() - rGraphicCropLogic.Bottom ) ) / aSize100thMM.Height() ); + } + } + } + } +} + +void ImplApplyBitmapScaling( ::Graphic& rGraphic, sal_Int32 nPixelWidth, sal_Int32 nPixelHeight ) +{ + if ( nPixelWidth && nPixelHeight ) + { + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + MapMode aPrefMapMode( aBmpEx.GetPrefMapMode() ); + Size aPrefSize( aBmpEx.GetPrefSize() ); + aBmpEx.Scale( Size( nPixelWidth, nPixelHeight ) ); + aBmpEx.SetPrefMapMode( aPrefMapMode ); + aBmpEx.SetPrefSize( aPrefSize ); + rGraphic = aBmpEx; + } +} + +void ImplApplyBitmapResolution( ::Graphic& rGraphic, sal_Int32 nImageResolution, const Size& rVisiblePixelSize, const awt::Size& rLogicalSize ) +{ + if ( nImageResolution && rLogicalSize.Width && rLogicalSize.Height ) + { + const double fImageResolution = static_cast<double>( nImageResolution ); + const double fSourceDPIX = ( static_cast<double>(rVisiblePixelSize.Width()) * 2540.0 ) / static_cast<double>(rLogicalSize.Width); + const double fSourceDPIY = ( static_cast<double>(rVisiblePixelSize.Height()) * 2540.0 ) / static_cast<double>(rLogicalSize.Height); + const sal_Int32 nSourcePixelWidth( rGraphic.GetSizePixel().Width() ); + const sal_Int32 nSourcePixelHeight( rGraphic.GetSizePixel().Height() ); + const double fSourcePixelWidth = static_cast<double>( nSourcePixelWidth ); + const double fSourcePixelHeight= static_cast<double>( nSourcePixelHeight ); + + sal_Int32 nDestPixelWidth = nSourcePixelWidth; + sal_Int32 nDestPixelHeight = nSourcePixelHeight; + + // check, if the bitmap DPI exceeds the maximum DPI + if( fSourceDPIX > fImageResolution ) + { + nDestPixelWidth = static_cast<sal_Int32>(( fSourcePixelWidth * fImageResolution ) / fSourceDPIX); + if ( !nDestPixelWidth || ( nDestPixelWidth > nSourcePixelWidth ) ) + nDestPixelWidth = nSourcePixelWidth; + } + if ( fSourceDPIY > fImageResolution ) + { + nDestPixelHeight= static_cast<sal_Int32>(( fSourcePixelHeight* fImageResolution ) / fSourceDPIY); + if ( !nDestPixelHeight || ( nDestPixelHeight > nSourcePixelHeight ) ) + nDestPixelHeight = nSourcePixelHeight; + } + if ( ( nDestPixelWidth != nSourcePixelWidth ) || ( nDestPixelHeight != nSourcePixelHeight ) ) + ImplApplyBitmapScaling( rGraphic, nDestPixelWidth, nDestPixelHeight ); + } +} + +void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyValue >& rFilterData ) +{ + /* this method applies following attributes to the graphic, in the first step the + cropping area (logical size in 100thmm) is applied, in the second step the resolution + is applied, in the third step the graphic is scaled to the corresponding pixelsize. + if a parameter value is zero or not available the corresponding step will be skipped */ + + sal_Int32 nPixelWidth = 0; + sal_Int32 nPixelHeight= 0; + sal_Int32 nImageResolution = 0; + awt::Size aLogicalSize( 0, 0 ); + text::GraphicCrop aCropLogic( 0, 0, 0, 0 ); + sal_Bool bRemoveCropArea = sal_True; + + for( sal_Int32 i = 0; i < rFilterData.getLength(); ++i ) + { + const ::rtl::OUString aName( rFilterData[ i ].Name ); + const uno::Any aValue( rFilterData[ i ].Value ); + + if( COMPARE_EQUAL == aName.compareToAscii( "PixelWidth" ) ) + aValue >>= nPixelWidth; + else if( COMPARE_EQUAL == aName.compareToAscii( "PixelHeight" ) ) + aValue >>= nPixelHeight; + else if( COMPARE_EQUAL == aName.compareToAscii( "LogicalSize" ) ) + aValue >>= aLogicalSize; + else if (COMPARE_EQUAL == aName.compareToAscii( "GraphicCropLogic" ) ) + aValue >>= aCropLogic; + else if (COMPARE_EQUAL == aName.compareToAscii( "RemoveCropArea" ) ) + aValue >>= bRemoveCropArea; + else if (COMPARE_EQUAL == aName.compareToAscii( "ImageResolution" ) ) + aValue >>= nImageResolution; + } + if ( rGraphic.GetType() == GRAPHIC_BITMAP ) + { + Rectangle aCropPixel( Point( 0, 0 ), rGraphic.GetSizePixel() ); + ImplCalculateCropRect( rGraphic, aCropLogic, aCropPixel ); + if ( bRemoveCropArea ) + { + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + aBmpEx.Crop( aCropPixel ); + rGraphic = aBmpEx; + } + Size aVisiblePixelSize( bRemoveCropArea ? rGraphic.GetSizePixel() : aCropPixel.GetSize() ); + ImplApplyBitmapResolution( rGraphic, nImageResolution, aVisiblePixelSize, aLogicalSize ); + ImplApplyBitmapScaling( rGraphic, nPixelWidth, nPixelHeight ); + } + else if ( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && nImageResolution ) + { + VirtualDevice aDummyVDev; + GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); + Size aMtfSize( aDummyVDev.LogicToLogic( aMtf.GetPrefSize(), aMtf.GetPrefMapMode(), MAP_100TH_MM ) ); + if ( aMtfSize.Width() && aMtfSize.Height() ) + { + MapMode aNewMapMode( MAP_100TH_MM ); + aNewMapMode.SetScaleX( static_cast< double >( aLogicalSize.Width ) / static_cast< double >( aMtfSize.Width() ) ); + aNewMapMode.SetScaleY( static_cast< double >( aLogicalSize.Height ) / static_cast< double >( aMtfSize.Height() ) ); + aDummyVDev.EnableOutput( sal_False ); + aDummyVDev.SetMapMode( aNewMapMode ); + + for( sal_uInt32 i = 0, nObjCount = aMtf.GetActionCount(); i < nObjCount; i++ ) + { + MetaAction* pAction = aMtf.GetAction( i ); + switch( pAction->GetType() ) + { + // only optimizing common bitmap actions: + case( META_MAPMODE_ACTION ): + { + const_cast< MetaAction* >( pAction )->Execute( &aDummyVDev ); + break; + } + case( META_PUSH_ACTION ): + { + const MetaPushAction* pA = (const MetaPushAction*)pAction; + aDummyVDev.Push( pA->GetFlags() ); + break; + } + case( META_POP_ACTION ): + { + aDummyVDev.Pop(); + break; + } + case( META_BMPSCALE_ACTION ): + case( META_BMPEXSCALE_ACTION ): + { + BitmapEx aBmpEx; + Point aPos; + Size aSize; + if ( pAction->GetType() == META_BMPSCALE_ACTION ) + { + MetaBmpScaleAction* pScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction ); + aBmpEx = pScaleAction->GetBitmap(); + aPos = pScaleAction->GetPoint(); + aSize = pScaleAction->GetSize(); + } + else + { + MetaBmpExScaleAction* pScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction ); + aBmpEx = pScaleAction->GetBitmapEx(); + aPos = pScaleAction->GetPoint(); + aSize = pScaleAction->GetSize(); + } + ::Graphic aGraphic( aBmpEx ); + const Size aSize100thmm( aDummyVDev.LogicToPixel( aSize ) ); + Size aSize100thmm2( aDummyVDev.PixelToLogic( aSize100thmm, MAP_100TH_MM ) ); + + ImplApplyBitmapResolution( aGraphic, nImageResolution, + aGraphic.GetSizePixel(), awt::Size( aSize100thmm2.Width(), aSize100thmm2.Height() ) ); + + MetaAction* pNewAction; + if ( pAction->GetType() == META_BMPSCALE_ACTION ) + pNewAction = new MetaBmpScaleAction ( aPos, aSize, aGraphic.GetBitmap() ); + else + pNewAction = new MetaBmpExScaleAction( aPos, aSize, aGraphic.GetBitmapEx() ); + + aMtf.ReplaceAction( pNewAction, i ); + pAction->Delete(); + break; + } + default: + case( META_BMP_ACTION ): + case( META_BMPSCALEPART_ACTION ): + case( META_BMPEX_ACTION ): + case( META_BMPEXSCALEPART_ACTION ): + case( META_MASK_ACTION ): + case( META_MASKSCALE_ACTION ): + break; + } + } + rGraphic = aMtf; + } + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XGraphic >& rxGraphic, const uno::Sequence< beans::PropertyValue >& rMediaProperties ) + throw ( io::IOException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + SvStream* pOStm = NULL; + String aPath; + sal_Int32 i; + + for( i = 0; ( i < rMediaProperties.getLength() ) && !pOStm; ++i ) + { + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) + { + ::rtl::OUString aURL; + + aValue >>= aURL; + pOStm = ::utl::UcbStreamHelper::CreateStream( aURL, STREAM_WRITE | STREAM_TRUNC ); + aPath = aURL; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "OutputStream" ) ) + { + uno::Reference< io::XStream > xOStm; + + aValue >>= xOStm; + + if( xOStm.is() ) + pOStm = ::utl::UcbStreamHelper::CreateStream( xOStm ); + } + } + + if( pOStm ) + { + uno::Sequence< beans::PropertyValue > aFilterDataSeq; + const char* pFilterShortName = NULL; + + for( i = 0; i < rMediaProperties.getLength(); ++i ) + { + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + + if( COMPARE_EQUAL == aName.compareToAscii( "FilterData" ) ) + { + aValue >>= aFilterDataSeq; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "MimeType" ) ) + { + ::rtl::OUString aMimeType; + + aValue >>= aMimeType; + + if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_BMP ) ) + pFilterShortName = "bmp"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_EPS ) ) + pFilterShortName = "eps"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_GIF ) ) + pFilterShortName = "gif"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_JPG ) ) + pFilterShortName = "jpg"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_MET ) ) + pFilterShortName = "met"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_PNG ) ) + pFilterShortName = "png"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_PCT ) ) + pFilterShortName = "pct"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_PBM ) ) + pFilterShortName = "pbm"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_PGM ) ) + pFilterShortName = "pgm"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_PPM ) ) + pFilterShortName = "ppm"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_RAS ) ) + pFilterShortName = "ras"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_SVM ) ) + pFilterShortName = "svm"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_TIF ) ) + pFilterShortName = "tif"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_EMF ) ) + pFilterShortName = "emf"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_WMF ) ) + pFilterShortName = "wmf"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_XPM ) ) + pFilterShortName = "xpm"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_SVG ) ) + pFilterShortName = "svg"; + else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_VCLGRAPHIC ) ) + pFilterShortName = MIMETYPE_VCLGRAPHIC; + } + } + + if( pFilterShortName ) + { + ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + + if( pFilter ) + { + const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); + + if( pGraphic && ( pGraphic->GetType() != GRAPHIC_NONE ) ) + { + ::Graphic aGraphic( *pGraphic ); + ImplApplyFilterData( aGraphic, aFilterDataSeq ); + + /* sj: using a temporary memory stream, because some graphic filters are seeking behind + stream end (which leads to an invalid argument exception then). */ + SvMemoryStream aMemStrm; + aMemStrm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + if( 0 == strcmp( pFilterShortName, MIMETYPE_VCLGRAPHIC ) ) + aMemStrm << aGraphic; + else + { + pFilter->ExportGraphic( aGraphic, aPath, aMemStrm, + pFilter->GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), + ( aFilterDataSeq.getLength() ? &aFilterDataSeq : NULL ) ); + } + aMemStrm.Seek( STREAM_SEEK_TO_END ); + pOStm->Write( aMemStrm.GetData(), aMemStrm.Tell() ); + } + } + } + delete pOStm; + } +} + +} diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx new file mode 100644 index 000000000000..b8a0ea73b92c --- /dev/null +++ b/svtools/source/graphic/renderer.cxx @@ -0,0 +1,345 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <rtl/uuid.h> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/propertysetinfo.hxx> +#include <svl/itemprop.hxx> +#include <svtools/grfmgr.hxx> +#include "graphic.hxx" +#include "renderer.hxx" + +#define UNOGRAPHIC_DEVICE 1 +#define UNOGRAPHIC_DESTINATIONRECT 2 +#define UNOGRAPHIC_RENDERDATA 3 + +using namespace ::com::sun::star; + +namespace unographic { + +// --------------------- +// - GraphicRendererVCL - +// --------------------- + +uno::Reference< uno::XInterface > SAL_CALL GraphicRendererVCL_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) +{ + return SAL_STATIC_CAST( ::cppu::OWeakObject*, new GraphicRendererVCL ); +} + + +GraphicRendererVCL::GraphicRendererVCL() : + ::comphelper::PropertySetHelper( createPropertySetInfo() ), + mpOutDev( NULL ) +{ +} + +// ------------------------------------------------------------------------------ + +GraphicRendererVCL::~GraphicRendererVCL() + throw() +{ +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString GraphicRendererVCL::getImplementationName_Static() + throw() +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.GraphicRendererVCL" ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > GraphicRendererVCL::getSupportedServiceNames_Static() + throw( ) +{ + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicRendererVCL" ) ); + + return aSeq; +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL GraphicRendererVCL::queryAggregation( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + uno::Any aAny; + + if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) ) + aAny <<= uno::Reference< lang::XServiceInfo >(this); + else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) ) + aAny <<= uno::Reference< lang::XTypeProvider >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ) + aAny <<= uno::Reference< beans::XPropertySet >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) ) + aAny <<= uno::Reference< beans::XPropertyState >(this); + else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) ) + aAny <<= uno::Reference< beans::XMultiPropertySet >(this); + else if( rType == ::getCppuType((const uno::Reference< graphic::XGraphicRenderer >*)0) ) + aAny <<= uno::Reference< graphic::XGraphicRenderer >(this); + else + aAny <<= OWeakAggObject::queryAggregation( rType ); + + return aAny; +} + +// ------------------------------------------------------------------------------ + +uno::Any SAL_CALL GraphicRendererVCL::queryInterface( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + return OWeakAggObject::queryInterface( rType ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicRendererVCL::acquire() + throw() +{ + OWeakAggObject::acquire(); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicRendererVCL::release() + throw() +{ + OWeakAggObject::release(); +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL GraphicRendererVCL::getImplementationName() + throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL GraphicRendererVCL::supportsService( const rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< rtl::OUString > SAL_CALL GraphicRendererVCL::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() + throw( uno::RuntimeException ) +{ + uno::Sequence< uno::Type > aTypes( 7 ); + uno::Type* pTypes = aTypes.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0); + *pTypes++ = ::getCppuType((const uno::Reference< graphic::XGraphicRenderer>*)0); + + return aTypes; +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() + throw( uno::RuntimeException ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + static uno::Sequence< sal_Int8 > aId; + + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); + } + + return aId; +} + +// ------------------------------------------------------------------------------ + +::comphelper::PropertySetInfo* GraphicRendererVCL::createPropertySetInfo() +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); + + static ::comphelper::PropertyMapEntry aEntries[] = + { + { MAP_CHAR_LEN( "Device" ), UNOGRAPHIC_DEVICE, &::getCppuType( (const uno::Any*)(0)), 0, 0 }, + { MAP_CHAR_LEN( "DestinationRect" ), UNOGRAPHIC_DESTINATIONRECT, &::getCppuType( (const awt::Rectangle*)(0)), 0, 0 }, + { MAP_CHAR_LEN( "RenderData" ), UNOGRAPHIC_RENDERDATA, &::getCppuType( (const uno::Any*)(0)), 0, 0 }, + + { 0,0,0,0,0,0 } + }; + + pRet->acquire(); + pRet->add( aEntries ); + + return pRet; +} + +// ------------------------------------------------------------------------------ + +void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + while( *ppEntries ) + { + switch( (*ppEntries)->mnHandle ) + { + case( UNOGRAPHIC_DEVICE ): + { + uno::Reference< awt::XDevice > xDevice; + + if( ( *pValues >>= xDevice ) && xDevice.is() ) + { + mxDevice = xDevice; + mpOutDev = VCLUnoHelper::GetOutputDevice( xDevice ); + } + else + { + mxDevice.clear(); + mpOutDev = NULL; + } + } + break; + + case( UNOGRAPHIC_DESTINATIONRECT ): + { + awt::Rectangle aAWTRect; + + if( *pValues >>= aAWTRect ) + { + maDestRect = Rectangle( Point( aAWTRect.X, aAWTRect.Y ), + Size( aAWTRect.Width, aAWTRect.Height ) ); + } + } + break; + + case( UNOGRAPHIC_RENDERDATA ): + { + *pValues >>= maRenderData; + } + break; + } + + ++ppEntries; + ++pValues; + } +} + +// ------------------------------------------------------------------------------ + +void GraphicRendererVCL::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) + throw( beans::UnknownPropertyException, lang::WrappedTargetException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + while( *ppEntries ) + { + switch( (*ppEntries)->mnHandle ) + { + case( UNOGRAPHIC_DEVICE ): + { + if( mxDevice.is() ) + *pValues <<= mxDevice; + } + break; + + case( UNOGRAPHIC_DESTINATIONRECT ): + { + const awt::Rectangle aAWTRect( maDestRect.Left(), maDestRect.Top(), + maDestRect.GetWidth(), maDestRect.GetHeight() ); + + *pValues <<= aAWTRect; + } + break; + + case( UNOGRAPHIC_RENDERDATA ): + { + *pValues <<= maRenderData; + } + break; + } + + ++ppEntries; + ++pValues; + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphic >& rxGraphic ) + throw (uno::RuntimeException) +{ + if( mpOutDev && mxDevice.is() && rxGraphic.is() ) + { + const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); + + if( pGraphic ) + { + GraphicObject aGraphicObject( *pGraphic ); + aGraphicObject.Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() ); + } + } +} + +} diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx new file mode 100644 index 000000000000..5c234c8d5ecb --- /dev/null +++ b/svtools/source/graphic/transformer.cxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <rtl/uuid.h> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <vcl/image.hxx> +#include <vcl/metaact.hxx> +#include <tools/rcid.h> +#include <tools/resid.hxx> +#include <tools/resmgr.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <svl/solar.hrc> +#include <vcl/salbtype.hxx> +#include <vcl/virdev.hxx> +#include <vcl/bmpacc.hxx> +#include <com/sun/star/text/GraphicCrop.hpp> + +#include "graphic.hxx" +#include "transformer.hxx" + +using namespace com::sun::star; + +namespace unographic { + +// ---------------------- +// - GraphicTransformer - +// ---------------------- + +GraphicTransformer::GraphicTransformer() +{ +} + +// ------------------------------------------------------------------------------ + +GraphicTransformer::~GraphicTransformer() +{ +} + +// ------------------------------------------------------------------------------ + +void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_Int32 nColorFrom, sal_Int8 nAlphaTo ) +{ + BitmapWriteAccess* pWriteAccess = rAlpha.AcquireWriteAccess(); + BitmapReadAccess* pReadAccess = rBitmap.AcquireReadAccess(); + BitmapColor aColorFrom( static_cast< sal_uInt8 >( nColorFrom >> 16 ), + static_cast< sal_uInt8 >( nColorFrom >> 8 ), + static_cast< sal_uInt8 >( nColorFrom ) ); + if ( pReadAccess && pWriteAccess ) + { + for ( sal_Int32 nY = 0; nY < pReadAccess->Height(); nY++ ) + { + for ( sal_Int32 nX = 0; nX < pReadAccess->Width(); nX++ ) + { + BitmapColor aColor( pReadAccess->GetPixel( nY, nX ) ); + if ( aColor == aColorFrom ) + pWriteAccess->SetPixel( nY, nX, nAlphaTo ); + } + } + } + rBitmap.ReleaseAccess( pReadAccess ); + rAlpha.ReleaseAccess( pWriteAccess ); +} + +// XGraphicTransformer +uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( + const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) + throw ( lang::IllegalArgumentException, uno::RuntimeException) +{ + const uno::Reference< uno::XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + ::Graphic aGraphic( *::unographic::Graphic::getImplementation( xIFace ) ); + + BitmapColor aColorFrom( static_cast< sal_uInt8 >( nColorFrom ), static_cast< sal_uInt8 >( nColorFrom >> 8 ), static_cast< sal_uInt8 >( nColorFrom >> 16 ) ); + BitmapColor aColorTo( static_cast< sal_uInt8 >( nColorTo ), static_cast< sal_uInt8 >( nColorTo >> 8 ), static_cast< sal_uInt8 >( nColorTo >> 16 ) ); + + if ( aGraphic.GetType() == GRAPHIC_BITMAP ) + { + BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); + Bitmap aBitmap( aBitmapEx.GetBitmap() ); + + if ( aBitmapEx.IsAlpha() ) + { + AlphaMask aAlphaMask( aBitmapEx.GetAlpha() ); + setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo ); + aBitmap.Replace( aColorFrom, aColorTo, nTolerance ); + aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) ); + } + else if ( aBitmapEx.IsTransparent() ) + { + if ( ( nAlphaTo == 0 ) || ( nAlphaTo == sal::static_int_cast<sal_Int8>(0xff) ) ) + { + Bitmap aMask( aBitmapEx.GetMask() ); + Bitmap aMask2( aBitmap.CreateMask( aColorFrom, nTolerance ) ); + aMask.CombineSimple( aMask2, BMP_COMBINE_OR ); + aBitmap.Replace( aColorFrom, aColorTo, nTolerance ); + aGraphic = ::Graphic( BitmapEx( aBitmap, aMask ) ); + } + else + { + AlphaMask aAlphaMask( aBitmapEx.GetMask() ); + setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo ); + aBitmap.Replace( aColorFrom, aColorTo, nTolerance ); + aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) ); + } + } + else + { + if ( ( nAlphaTo == 0 ) || ( nAlphaTo == sal::static_int_cast<sal_Int8>(0xff) ) ) + { + Bitmap aMask( aBitmap.CreateMask( aColorFrom, nTolerance ) ); + aBitmap.Replace( aColorFrom, aColorTo, nTolerance ); + aGraphic = ::Graphic( BitmapEx( aBitmap, aMask ) ); + } + else + { + AlphaMask aAlphaMask( aBitmapEx.GetSizePixel() ); + setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo ); + aBitmap.Replace( aColorFrom, aColorTo, nTolerance ); + aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) ); + } + } + } + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic(); + pUnoGraphic->init( aGraphic ); + uno::Reference< graphic::XGraphic > xRet( pUnoGraphic ); + return xRet; +} + +} diff --git a/svtools/source/graphic/transformer.hxx b/svtools/source/graphic/transformer.hxx new file mode 100644 index 000000000000..c4002bb4bbae --- /dev/null +++ b/svtools/source/graphic/transformer.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GOODIES_GRAPHICTRANSFORMER_HXX +#define _GOODIES_GRAPHICTRANSFORMER_HXX + +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/graphic/XGraphicTransformer.hpp> + +using namespace com::sun::star; + +namespace unographic { + +// ---------------------- +// - GraphicTransformer - +// ---------------------- + +typedef ::cppu::WeakAggImplHelper1< + ::com::sun::star::graphic::XGraphicTransformer + > GraphicTransformer_UnoImplHelper1; +class GraphicTransformer : public GraphicTransformer_UnoImplHelper1 +{ + public: + + GraphicTransformer(); + ~GraphicTransformer(); + + // XGraphicTransformer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL colorChange( + const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rGraphic, + sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + +}; + +} + +#endif diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index f850b4b5b542..09dc7018dc42 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: documentcloser.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/documentcloser.hxx b/svtools/source/hatchwindow/documentcloser.hxx index 14198197b589..98e30b4d1683 100644 --- a/svtools/source/hatchwindow/documentcloser.hxx +++ b/svtools/source/hatchwindow/documentcloser.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: documentcloser.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx index 3e0703d9b8ad..1b84206d6696 100644 --- a/svtools/source/hatchwindow/hatchwindow.cxx +++ b/svtools/source/hatchwindow/hatchwindow.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hatchwindow.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/hatchwindow.hxx b/svtools/source/hatchwindow/hatchwindow.hxx index 4395784ce41c..fa3e70ee8901 100644 --- a/svtools/source/hatchwindow/hatchwindow.hxx +++ b/svtools/source/hatchwindow/hatchwindow.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hatchwindow.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index ced54dfd460a..f8dbddff3761 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hatchwindowfactory.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/hatchwindowfactory.hxx b/svtools/source/hatchwindow/hatchwindowfactory.hxx index 72eaa58bb16d..9a59c7a95f6d 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.hxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hatchwindowfactory.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx index 2e8c763b666a..1beae4a54355 100644 --- a/svtools/source/hatchwindow/ipwin.cxx +++ b/svtools/source/hatchwindow/ipwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ipwin.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/ipwin.hxx b/svtools/source/hatchwindow/ipwin.hxx index 996e9713eccd..4c7cb6d88d36 100644 --- a/svtools/source/hatchwindow/ipwin.hxx +++ b/svtools/source/hatchwindow/ipwin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ipwin.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/hatchwindow/makefile.mk b/svtools/source/hatchwindow/makefile.mk index 8366763a81f9..c5a4dab09762 100644 --- a/svtools/source/hatchwindow/makefile.mk +++ b/svtools/source/hatchwindow/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx index 07dff55591a6..177edce8c3f0 100644 --- a/svtools/source/inc/configitems/accessibilityoptions_const.hxx +++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx @@ -1,35 +1,27 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile: accessibilityoptions_const.hxx,v $ + * Copyright 2000, 2010 Oracle and/or its affiliates. * - * $Revision: 1.1.4.2 $ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. * ************************************************************************/ diff --git a/svtools/source/inc/filectrl.hrc b/svtools/source/inc/filectrl.hrc index 13fb89afd382..1707e306e1b0 100644 --- a/svtools/source/inc/filectrl.hrc +++ b/svtools/source/inc/filectrl.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filectrl.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/gifread.hxx b/svtools/source/inc/gifread.hxx index 8a9d299930c9..de4c6935ef67 100644 --- a/svtools/source/inc/gifread.hxx +++ b/svtools/source/inc/gifread.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gifread.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/gradwrap.hxx b/svtools/source/inc/gradwrap.hxx index 28c9d8db1fcd..41887b67822a 100644 --- a/svtools/source/inc/gradwrap.hxx +++ b/svtools/source/inc/gradwrap.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gradwrap.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc index 9c41e06a2b6c..918e47f849b4 100644 --- a/svtools/source/inc/iodlg.hrc +++ b/svtools/source/inc/iodlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iodlg.hrc,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx index d8de26c31009..906bcd9ea2de 100644 --- a/svtools/source/inc/jpeg.hxx +++ b/svtools/source/inc/jpeg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: jpeg.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/msgrd.hxx b/svtools/source/inc/msgrd.hxx index 381ae71c7b83..2d3dcccb1244 100644 --- a/svtools/source/inc/msgrd.hxx +++ b/svtools/source/inc/msgrd.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msgrd.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/msgwr.hxx b/svtools/source/inc/msgwr.hxx index c347938fd34d..7e72e98c124c 100644 --- a/svtools/source/inc/msgwr.hxx +++ b/svtools/source/inc/msgwr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msgwr.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/property.hxx b/svtools/source/inc/property.hxx index 2a756f177608..689da1faf140 100644 --- a/svtools/source/inc/property.hxx +++ b/svtools/source/inc/property.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: property.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/provider.hxx b/svtools/source/inc/provider.hxx new file mode 100644 index 000000000000..c54215482a0e --- /dev/null +++ b/svtools/source/inc/provider.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GOODIES_PROVIDER_HXX +#define _GOODIES_PROVIDER_HXX + +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/awt/XBitmap.hpp> + +using namespace com::sun::star; + +namespace unographic { + +// ------------------- +// - GraphicProvider - +// ------------------- + +class GraphicProvider : public ::cppu::WeakImplHelper1< ::com::sun::star::graphic::XGraphicProvider > +{ +public: + + GraphicProvider(); + ~GraphicProvider(); + + static ::rtl::OUString getImplementationName_Static() throw(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + +protected: + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XGraphicProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL queryGraphicDescriptor( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& MediaProperties ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL queryGraphic( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& MediaProperties ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeGraphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& Graphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& MediaProperties ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +private: + + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadMemory( const ::rtl::OUString& rResourceURL ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadResource( const ::rtl::OUString& rResourceURL ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rBitmap ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadStandardImage( const ::rtl::OUString& rResourceURL ) const; +}; + +} + +#endif diff --git a/svtools/source/inc/renderer.hxx b/svtools/source/inc/renderer.hxx new file mode 100644 index 000000000000..b58bd065245b --- /dev/null +++ b/svtools/source/inc/renderer.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GOODIES_RENDERER_HXX +#define _GOODIES_RENDERER_HXX + +#include <tools/gen.hxx> +#include <comphelper/propertysethelper.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/graphic/XGraphicRenderer.hpp> + + +using namespace com::sun::star; + +class OutputDevice; + +namespace unographic { + +// ------------------- +// - GraphicRenderer - +// ------------------- + +class GraphicRendererVCL : public ::cppu::OWeakAggObject, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::comphelper::PropertySetHelper, + public ::com::sun::star::graphic::XGraphicRenderer +{ +public: + + GraphicRendererVCL(); + ~GraphicRendererVCL() throw(); + + static ::rtl::OUString getImplementationName_Static() throw(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + +protected: + + static ::comphelper::PropertySetInfo* createPropertySetInfo(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // PropertySetHelper + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); + + // XGraphicRenderer + virtual void SAL_CALL render( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& Graphic ) throw (::com::sun::star::uno::RuntimeException); + +private: + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxDevice; + + OutputDevice* mpOutDev; + Rectangle maDestRect; + ::com::sun::star::uno::Any maRenderData; +}; + +} + +#endif diff --git a/svtools/source/inc/sgfbram.hxx b/svtools/source/inc/sgfbram.hxx index ca7e90b59cd4..2acab5445a8c 100644 --- a/svtools/source/inc/sgfbram.hxx +++ b/svtools/source/inc/sgfbram.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgfbram.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/sgffilt.hxx b/svtools/source/inc/sgffilt.hxx index a93522fcf590..1c75917b8f73 100644 --- a/svtools/source/inc/sgffilt.hxx +++ b/svtools/source/inc/sgffilt.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgffilt.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx index 58e43e0a00b2..6f69908865c5 100644 --- a/svtools/source/inc/sgvmain.hxx +++ b/svtools/source/inc/sgvmain.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgvmain.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/sgvspln.hxx b/svtools/source/inc/sgvspln.hxx index 7e9976eaf25b..29df09247f22 100644 --- a/svtools/source/inc/sgvspln.hxx +++ b/svtools/source/inc/sgvspln.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sgvspln.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index 10463fc05906..cde986b3cb7d 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svimpbox.hxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx index 724a92543700..20f98d2bcbbd 100644 --- a/svtools/source/inc/svimpicn.hxx +++ b/svtools/source/inc/svimpicn.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svimpicn.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/svtaccessiblefactory.hxx b/svtools/source/inc/svtaccessiblefactory.hxx index d4a0a5b518e8..7760b6427da4 100644 --- a/svtools/source/inc/svtaccessiblefactory.hxx +++ b/svtools/source/inc/svtaccessiblefactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtaccessiblefactory.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx index 80ceda96fab5..5d34ea6f47ed 100644 --- a/svtools/source/inc/unoiface.hxx +++ b/svtools/source/inc/unoiface.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoiface.hxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/xbmread.hxx b/svtools/source/inc/xbmread.hxx index c9623fbb2cda..aab52eeffa63 100644 --- a/svtools/source/inc/xbmread.hxx +++ b/svtools/source/inc/xbmread.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xbmread.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/inc/xpmread.hxx b/svtools/source/inc/xpmread.hxx index f1a76c9bc62f..29edd15a3b1c 100644 --- a/svtools/source/inc/xpmread.hxx +++ b/svtools/source/inc/xpmread.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xpmread.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/java/javacontext.cxx b/svtools/source/java/javacontext.cxx index 399cf041d915..7ebd3ea76d1f 100644 --- a/svtools/source/java/javacontext.cxx +++ b/svtools/source/java/javacontext.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: javacontext.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index 3460df859c2b..e16992a3473d 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: javaerror.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index a7808c80992b..3dde9c33cd48 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: javainteractionhandler.cxx,v $ - * $Revision: 1.7.152.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/java/makefile.mk b/svtools/source/java/makefile.mk index 9d9679644685..6db57388dca0 100644 --- a/svtools/source/java/makefile.mk +++ b/svtools/source/java/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src index 2d2ad06a9592..e16992a3473d 100644 --- a/svtools/source/java/patchjavaerror.src +++ b/svtools/source/java/patchjavaerror.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: patchjavaerror.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 16bc8339a0d9..6458e359a49c 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: acceleratorexecute.cxx,v $ - * $Revision: 1.14.90.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/chartprettypainter.cxx b/svtools/source/misc/chartprettypainter.cxx index 7e9a16879789..bc2d02384816 100644 --- a/svtools/source/misc/chartprettypainter.cxx +++ b/svtools/source/misc/chartprettypainter.cxx @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: chartprettypainter.cxx,v $ - * - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/cliplistener.cxx b/svtools/source/misc/cliplistener.cxx index c8c6428233e8..8fb61a5a1cb9 100644 --- a/svtools/source/misc/cliplistener.cxx +++ b/svtools/source/misc/cliplistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cliplistener.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/dialogclosedlistener.cxx b/svtools/source/misc/dialogclosedlistener.cxx index 582d2bbf4879..a08c8a3b6dd5 100644 --- a/svtools/source/misc/dialogclosedlistener.cxx +++ b/svtools/source/misc/dialogclosedlistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialogclosedlistener.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index d461e5898227..7565dad731f7 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialogcontrolling.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 3a31c1b812a6..cf476098056b 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ehdl.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src index 5267d13765c3..55ab99b93bdf 100644 --- a/svtools/source/misc/ehdl.src +++ b/svtools/source/misc/ehdl.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ehdl.src,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 3554f6955171..f606e1e2e4b1 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -2,12 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: embedhlp.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index d667580b41fb..cbf87f40b7fc 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: embedtransfer.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 3ab58ef92dbf..4e9a316308e0 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: errtxt.src,v $ - * $Revision: 1.63 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src index 181583bc8f6d..c649c1f17a40 100644 --- a/svtools/source/misc/helpagent.src +++ b/svtools/source/misc/helpagent.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpagent.src,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx index 51cd7ebfb740..55800a213a2e 100644 --- a/svtools/source/misc/helpagentwindow.cxx +++ b/svtools/source/misc/helpagentwindow.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpagentwindow.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 76752b27354e..e57c0d21d98a 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imagemgr.cxx,v $ - * $Revision: 1.52 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src index e082398beaa1..0664cdc6bc87 100644 --- a/svtools/source/misc/imagemgr.src +++ b/svtools/source/misc/imagemgr.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imagemgr.src,v $ - * $Revision: 1.69 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index b27bf6fa0174..a4f19d9e004a 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imageresourceaccess.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index b0aaee113c20..25f23e2ef00b 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imap.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 1dd10c36c81a..9834fe0fcb76 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imap2.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/imap3.cxx b/svtools/source/misc/imap3.cxx index 7e0dd4d4c5f1..76763ae422f2 100644 --- a/svtools/source/misc/imap3.cxx +++ b/svtools/source/misc/imap3.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imap3.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/itemdel.cxx b/svtools/source/misc/itemdel.cxx index 9db70f852d30..559d31cdeb1d 100644 --- a/svtools/source/misc/itemdel.cxx +++ b/svtools/source/misc/itemdel.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: itemdel.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index ef2cedcc50c2..b656dbf501c4 100644..100755 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: langtab.cxx,v $ - * $Revision: 1.3.140.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -166,6 +163,12 @@ const String& SvtLanguageTable::GetString( const LanguageType eType ) const return aEmptyStr; } +String SvtLanguageTable::GetLanguageString( const LanguageType eType ) +{ + static const SvtLanguageTable aLangTable; + return aLangTable.GetString( eType ); +} + //------------------------------------------------------------------------ LanguageType SvtLanguageTable::GetType( const String& rStr ) const diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 0aa90f8e96b9..929276cfbdb5 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: langtab.src,v $ - * $Revision: 1.6.126.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk index 77cf8a41a8bd..65e43747a586 100644 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.45 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -78,6 +74,7 @@ SLOFILES=\ $(SLO)$/templatefoldercache.obj \ $(SLO)$/transfer.obj \ $(SLO)$/transfer2.obj \ + $(SLO)$/unitconv.obj \ $(SLO)$/wallitem.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index 323093ae76a2..fa216b27f99c 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stringtransfer.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index a4b3cc1e8ecc..1a8284642698 100644 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtaccessiblefactory.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/svtdata.cxx b/svtools/source/misc/svtdata.cxx index 2bc1977e9197..65715f635883 100644 --- a/svtools/source/misc/svtdata.cxx +++ b/svtools/source/misc/svtdata.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtdata.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 348a9638399b..62f3ec39eb6f 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templatefoldercache.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4a814637e1af..4628c0d4b846 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: transfer.cxx,v $ - * $Revision: 1.81 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 027dbc31572d..dcd0f81b2758 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: transfer2.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx new file mode 100644 index 000000000000..612bcb4f0221 --- /dev/null +++ b/svtools/source/misc/unitconv.cxx @@ -0,0 +1,763 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dlgutil.cxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +// include --------------------------------------------------------------- + +#include <svtools/unitconv.hxx> + +// ----------------------------------------------------------------------- + +void SetFieldUnit( MetricField& rField, FieldUnit eUnit, BOOL bAll ) +{ + sal_Int64 nFirst = rField.Denormalize( rField.GetFirst( FUNIT_TWIP ) ); + sal_Int64 nLast = rField.Denormalize( rField.GetLast( FUNIT_TWIP ) ); + sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ); + sal_Int64 nMax = rField.Denormalize( rField.GetMax( FUNIT_TWIP ) ); + + if ( !bAll ) + { + switch ( eUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eUnit = FUNIT_CM; + break; + + case FUNIT_FOOT: + case FUNIT_MILE: + eUnit = FUNIT_INCH; + break; + default: ;//prevent warning + } + } + rField.SetUnit( eUnit ); + switch( eUnit ) + { + case FUNIT_MM: + rField.SetSpinSize( 50 ); + break; + + case FUNIT_INCH: + rField.SetSpinSize( 2 ); + break; + + default: + rField.SetSpinSize( 10 ); + } + + if ( FUNIT_POINT == eUnit ) + { + if( rField.GetDecimalDigits() > 1 ) + rField.SetDecimalDigits( 1 ); + } + else + rField.SetDecimalDigits( 2 ); + + if ( !bAll ) + { + rField.SetFirst( rField.Normalize( nFirst ), FUNIT_TWIP ); + rField.SetLast( rField.Normalize( nLast ), FUNIT_TWIP ); + rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP ); + rField.SetMax( rField.Normalize( nMax ), FUNIT_TWIP ); + } +} + +// ----------------------------------------------------------------------- + +void SetFieldUnit( MetricBox& rBox, FieldUnit eUnit, BOOL bAll ) +{ + sal_Int64 nMin = rBox.Denormalize( rBox.GetMin( FUNIT_TWIP ) ); + sal_Int64 nMax = rBox.Denormalize( rBox.GetMax( FUNIT_TWIP ) ); + + if ( !bAll ) + { + switch ( eUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eUnit = FUNIT_CM; + break; + + case FUNIT_FOOT: + case FUNIT_MILE: + eUnit = FUNIT_INCH; + break; + default: ;//prevent warning + } + } + rBox.SetUnit( eUnit ); + + if ( FUNIT_POINT == eUnit && rBox.GetDecimalDigits() > 1 ) + rBox.SetDecimalDigits( 1 ); + else + rBox.SetDecimalDigits( 2 ); + + if ( !bAll ) + { + rBox.SetMin( rBox.Normalize( nMin ), FUNIT_TWIP ); + rBox.SetMax( rBox.Normalize( nMax ), FUNIT_TWIP ); + } +} + +// ----------------------------------------------------------------------- +void SetMetricValue( MetricField& rField, long nCoreValue, SfxMapUnit eUnit ) +{ + sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, (MapUnit)eUnit, MAP_100TH_MM ); + nVal = rField.Normalize( nVal ); + rField.SetValue( nVal, FUNIT_100TH_MM ); + +} + +// ----------------------------------------------------------------------- + +long GetCoreValue( const MetricField& rField, SfxMapUnit eUnit ) +{ + sal_Int64 nVal = rField.GetValue( FUNIT_100TH_MM ); + // avoid rounding issues + const sal_Int64 nSizeMask = 0xffffffffff000000LL; + bool bRoundBefore = true; + if( nVal >= 0 ) + { + if( (nVal & nSizeMask) == 0 ) + bRoundBefore = false; + } + else + { + if( ((-nVal) & nSizeMask ) == 0 ) + bRoundBefore = false; + } + if( bRoundBefore ) + nVal = rField.Denormalize( nVal ); + sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MAP_100TH_MM, (MapUnit)eUnit ); + if( ! bRoundBefore ) + nUnitVal = rField.Denormalize( nUnitVal ); + return static_cast<long>(nUnitVal); +} + +// ----------------------------------------------------------------------- + +long CalcToUnit( float nIn, SfxMapUnit eUnit ) +{ + // nIn ist in Points + + DBG_ASSERT( eUnit == SFX_MAPUNIT_TWIP || + eUnit == SFX_MAPUNIT_100TH_MM || + eUnit == SFX_MAPUNIT_10TH_MM || + eUnit == SFX_MAPUNIT_MM || + eUnit == SFX_MAPUNIT_CM, "this unit is not implemented" ); + + float nTmp = nIn; + + if ( SFX_MAPUNIT_TWIP != eUnit ) + nTmp = nIn * 10 / 567; + + switch ( eUnit ) + { + case SFX_MAPUNIT_100TH_MM: nTmp *= 100; break; + case SFX_MAPUNIT_10TH_MM: nTmp *= 10; break; + case SFX_MAPUNIT_MM: break; + case SFX_MAPUNIT_CM: nTmp /= 10; break; + default: ;//prevent warning + } + + nTmp *= 20; + long nRet = (long)nTmp; + return nRet; +//! return (long)(nTmp * 20); +} + +// ----------------------------------------------------------------------- + +long ItemToControl( long nIn, SfxMapUnit eItem, SfxFieldUnit eCtrl ) +{ + long nOut = 0; + + switch ( eItem ) + { + case SFX_MAPUNIT_100TH_MM: + case SFX_MAPUNIT_10TH_MM: + case SFX_MAPUNIT_MM: + { + if ( eItem == SFX_MAPUNIT_10TH_MM ) + nIn /= 10; + else if ( eItem == SFX_MAPUNIT_100TH_MM ) + nIn /= 100; + nOut = TransformMetric( nIn, FUNIT_MM, (FieldUnit)eCtrl ); + } + break; + + case SFX_MAPUNIT_CM: + { + nOut = TransformMetric( nIn, FUNIT_CM, (FieldUnit)eCtrl ); + } + break; + + case SFX_MAPUNIT_1000TH_INCH: + case SFX_MAPUNIT_100TH_INCH: + case SFX_MAPUNIT_10TH_INCH: + case SFX_MAPUNIT_INCH: + { + if ( eItem == SFX_MAPUNIT_10TH_INCH ) + nIn /= 10; + else if ( eItem == SFX_MAPUNIT_100TH_INCH ) + nIn /= 100; + else if ( eItem == SFX_MAPUNIT_1000TH_INCH ) + nIn /= 1000; + nOut = TransformMetric( nIn, FUNIT_INCH, (FieldUnit)eCtrl ); + } + break; + + case SFX_MAPUNIT_POINT: + { + nOut = TransformMetric( nIn, FUNIT_POINT, (FieldUnit)eCtrl ); + } + break; + + case SFX_MAPUNIT_TWIP: + { + nOut = TransformMetric( nIn, FUNIT_TWIP, (FieldUnit)eCtrl ); + } + break; + default: ;//prevent warning + } + return nOut; +} + +// ----------------------------------------------------------------------- + +long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit eItem ) +{ + return ItemToControl( nIn, eItem, eCtrl ); +} + +// ----------------------------------------------------------------------- + +FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ) +{ + switch ( eUnit ) + { + case SFX_MAPUNIT_100TH_MM: + case SFX_MAPUNIT_10TH_MM: + case SFX_MAPUNIT_MM: + return FUNIT_MM; + + case SFX_MAPUNIT_CM: + return FUNIT_CM; + + case SFX_MAPUNIT_1000TH_INCH: + case SFX_MAPUNIT_100TH_INCH: + case SFX_MAPUNIT_10TH_INCH: + case SFX_MAPUNIT_INCH: + return FUNIT_INCH; + + case SFX_MAPUNIT_POINT: + return FUNIT_POINT; + + case SFX_MAPUNIT_TWIP: + return FUNIT_TWIP; + default: ;//prevent warning + } + return FUNIT_NONE; +} + +// ----------------------------------------------------------------------- + +MapUnit FieldToMapUnit( const SfxFieldUnit /*eUnit*/ ) +{ + return MAP_APPFONT; +} + +// ----------------------------------------------------------------------- + +long ConvertValueToMap( long nVal, SfxMapUnit eUnit ) +{ + long nNew = nVal; + + switch ( eUnit ) + { + case SFX_MAPUNIT_10TH_MM: + case SFX_MAPUNIT_10TH_INCH: + nNew *= 10; + break; + + case SFX_MAPUNIT_100TH_MM: + case SFX_MAPUNIT_100TH_INCH: + nNew *= 100; + break; + + case SFX_MAPUNIT_1000TH_INCH: + nNew *= 1000; + default: ;//prevent warning + } + return nNew; +} + +// ----------------------------------------------------------------------- + +long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ) +{ + long nNew = nVal; + + switch ( eUnit ) + { + case SFX_MAPUNIT_10TH_MM: + case SFX_MAPUNIT_10TH_INCH: + nNew /= 10; + break; + + case SFX_MAPUNIT_100TH_MM: + case SFX_MAPUNIT_100TH_INCH: + nNew /= 100; + break; + + case SFX_MAPUNIT_1000TH_INCH: + nNew /= 1000; + break; + default: ;//prevent warning + } + return nNew; +} + +// ----------------------------------------------------------------------- + +long CalcToPoint( long nIn, SfxMapUnit eUnit, USHORT nFaktor ) +{ + DBG_ASSERT( eUnit == SFX_MAPUNIT_TWIP || + eUnit == SFX_MAPUNIT_100TH_MM || + eUnit == SFX_MAPUNIT_10TH_MM || + eUnit == SFX_MAPUNIT_MM || + eUnit == SFX_MAPUNIT_CM, "this unit is not implemented" ); + + long nRet = 0; + + if ( SFX_MAPUNIT_TWIP == eUnit ) + nRet = nIn; + else + nRet = nIn * 567; + + switch ( eUnit ) + { + case SFX_MAPUNIT_100TH_MM: nRet /= 100; break; + case SFX_MAPUNIT_10TH_MM: nRet /= 10; break; + case SFX_MAPUNIT_MM: break; + case SFX_MAPUNIT_CM: nRet *= 10; break; + default: ;//prevent warning + } + + // ggf. aufrunden + if ( SFX_MAPUNIT_TWIP != eUnit ) + { + long nMod = 10; + long nTmp = nRet % nMod; + + if ( nTmp >= 4 ) + nRet += 10 - nTmp; + nRet /= 10; + } + return nRet * nFaktor / 20; +} + +// ----------------------------------------------------------------------- + +long CMToTwips( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long MMToTwips( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567 / 10; + return nRet; +} + +// ----------------------------------------------------------------------- + +long InchToTwips( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 1440 ) && nIn >= ( LONG_MIN / 1440 ) ) + nRet = nIn * 1440; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PointToTwips( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 20 ) && nIn >= ( LONG_MIN / 20 ) ) + nRet = nIn * 20; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PicaToTwips( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 240 ) && nIn >= ( LONG_MIN / 240 ) ) + nRet = nIn * 240; + return nRet; +} + +// ----------------------------------------------------------------------- + +long TwipsToCM( long nIn ) +{ + long nRet = nIn / 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long InchToCM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 254 ) && nIn >= ( LONG_MIN / 254 ) ) + nRet = nIn * 254 / 100; + return nRet; +} + +// ----------------------------------------------------------------------- + +long MMToCM( long nIn ) +{ + long nRet = nIn / 10; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PointToCM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 20 ) && nIn >= ( LONG_MIN / 20 ) ) + nRet = nIn * 20 / 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PicaToCM( long nIn) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 12 / 20 ) && nIn >= ( LONG_MIN / 12 / 20 ) ) + nRet = nIn * 12 * 20 / 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long TwipsToMM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) + nRet = nIn * 10 / 566; + return nRet; +} + +// ----------------------------------------------------------------------- + +long CMToMM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) + nRet = nIn * 10; + return nRet; +} + +// ----------------------------------------------------------------------- + +long InchToMM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 254 ) && nIn >= ( LONG_MIN / 254 ) ) + nRet = nIn * 254 / 10; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PointToMM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 200 ) && nIn >= ( LONG_MIN / 200 ) ) + nRet = nIn * 200 / 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PicaToMM( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 12 / 200 ) && nIn >= ( LONG_MIN / 12 / 200 ) ) + nRet = nIn * 12 * 200 / 567; + return nRet; +} + +// ----------------------------------------------------------------------- + +long TwipsToInch( long nIn ) +{ + long nRet = nIn / 1440; + return nRet; +} + +// ----------------------------------------------------------------------- + +long CMToInch( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 100 ) && nIn >= ( LONG_MIN / 100 ) ) + nRet = nIn * 100 / 254; + return nRet; +} + +// ----------------------------------------------------------------------- + +long MMToInch( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) + nRet = nIn * 10 / 254; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PointToInch( long nIn ) +{ + long nRet = nIn / 72; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PicaToInch( long nIn ) +{ + long nRet = nIn / 6; + return nRet; +} + +// ----------------------------------------------------------------------- + +long TwipsToPoint( long nIn ) +{ + long nRet = nIn / 20; + return nRet; +} + +// ----------------------------------------------------------------------- + +long InchToPoint( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 72 ) && nIn >= ( LONG_MIN / 72 ) ) + nRet = nIn * 72; + return nRet; +} + +// ----------------------------------------------------------------------- + +long CMToPoint( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567 / 20; + return nRet; +} + +// ----------------------------------------------------------------------- + +long MMToPoint( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567 / 200; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PicaToPoint( long nIn ) +{ + long nRet = nIn / 12; + return nRet; +} + +// ----------------------------------------------------------------------- + +long TwipsToPica( long nIn ) +{ + long nRet = nIn / 240; + return nRet; +} + +// ----------------------------------------------------------------------- + +long InchToPica( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 6 ) && nIn >= ( LONG_MIN / 6 ) ) + nRet = nIn * 6; + return nRet; +} + +// ----------------------------------------------------------------------- + +long PointToPica( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 12 ) && nIn >= ( LONG_MIN / 12 ) ) + nRet = nIn * 12; + return nRet; +} + +// ----------------------------------------------------------------------- + +long CMToPica( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567 / 20 / 12; + return nRet; +} + +// ----------------------------------------------------------------------- + +long MMToPica( long nIn ) +{ + long nRet = 0; + + if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) + nRet = nIn * 567 / 200 / 12; + return nRet; +} + +// ----------------------------------------------------------------------- + +long Nothing( long nIn ) +{ + long nRet = nIn; + return nRet; +} + +FUNC_CONVERT ConvertTable[6][6] = +{ +// CM, MM INCH POINT PICAS=32 TWIPS + { Nothing, CMToMM, CMToInch, CMToPoint, CMToPica, CMToTwips }, + { MMToCM, Nothing, MMToInch, MMToPoint, MMToPica, MMToTwips }, + { InchToCM, InchToMM, Nothing, InchToPoint, InchToPica, InchToTwips }, + { PointToCM, PointToMM, PointToInch, Nothing, PointToPica, PointToTwips }, + { PicaToCM, PicaToMM, PicaToInch, PicaToPoint, Nothing, PicaToTwips }, + { TwipsToCM, TwipsToMM, TwipsToInch, TwipsToPoint,TwipsToPica, Nothing } +}; + +// ----------------------------------------------------------------------- + +long TransformMetric( long nVal, FieldUnit aOld, FieldUnit aNew ) +{ + if ( aOld == FUNIT_NONE || aNew == FUNIT_NONE || + aOld == FUNIT_CUSTOM || aNew == FUNIT_CUSTOM ) + { + return nVal; + } + + USHORT nOld = 0; + USHORT nNew = 0; + + switch ( aOld ) + { + case FUNIT_CM: + nOld = 0; break; + case FUNIT_MM: + nOld = 1; break; + case FUNIT_INCH: + nOld = 2; break; + case FUNIT_POINT: + nOld = 3; break; + case FUNIT_PICA: + nOld = 4; break; + case FUNIT_TWIP: + nOld = 5; break; + default: ;//prevent warning + } + + switch ( aNew ) + { + case FUNIT_CM: + nNew = 0; break; + case FUNIT_MM: + nNew = 1; break; + case FUNIT_INCH: + nNew = 2; break; + case FUNIT_POINT: + nNew = 3; break; + case FUNIT_PICA: + nNew = 4; break; + case FUNIT_TWIP: + nNew = 5; break; + default: ;//prevent warning + } + return ConvertTable[nOld][nNew]( nVal ); +} + diff --git a/svtools/source/misc/wallitem.cxx b/svtools/source/misc/wallitem.cxx index 6ceb414db003..505af52c9908 100644 --- a/svtools/source/misc/wallitem.cxx +++ b/svtools/source/misc/wallitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wallitem.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/commtest.cxx b/svtools/source/plugapp/commtest.cxx index 7ae43194c2c9..3a235afcc61b 100644 --- a/svtools/source/plugapp/commtest.cxx +++ b/svtools/source/plugapp/commtest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: commtest.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/commtest.hrc b/svtools/source/plugapp/commtest.hrc index c2e1db262e6a..f0f646b49bfc 100644 --- a/svtools/source/plugapp/commtest.hrc +++ b/svtools/source/plugapp/commtest.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: commtest.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/commtest.src b/svtools/source/plugapp/commtest.src index beb9be750eb1..7073699f4956 100644 --- a/svtools/source/plugapp/commtest.src +++ b/svtools/source/plugapp/commtest.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: commtest.src,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/makefile.mk b/svtools/source/plugapp/makefile.mk index d37e374917ac..f1dd0a4a8334 100644 --- a/svtools/source/plugapp/makefile.mk +++ b/svtools/source/plugapp/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/testtool.hrc b/svtools/source/plugapp/testtool.hrc index a1f539c64bd6..d6a234b74236 100644 --- a/svtools/source/plugapp/testtool.hrc +++ b/svtools/source/plugapp/testtool.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: testtool.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src index 78b63c2fb819..9cc52c58f013 100644 --- a/svtools/source/plugapp/testtool.src +++ b/svtools/source/plugapp/testtool.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: testtool.src,v $ - * $Revision: 1.36 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/plugapp/ttprops.cxx b/svtools/source/plugapp/ttprops.cxx index 2cbb86938836..2ae41a4c50c1 100644 --- a/svtools/source/plugapp/ttprops.cxx +++ b/svtools/source/plugapp/ttprops.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ttprops.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk index 1892f1600dd8..0b970b651059 100644 --- a/svtools/source/productregistration/makefile.mk +++ b/svtools/source/productregistration/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index f5fc03337cd6..4a5db9cf47c4 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: productregistration.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/productregistration.hxx b/svtools/source/productregistration/productregistration.hxx index 6dc3dbe253e5..efaa624887b0 100644 --- a/svtools/source/productregistration/productregistration.hxx +++ b/svtools/source/productregistration/productregistration.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: productregistration.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx index d3969828cb1f..93b7e5c88462 100644 --- a/svtools/source/productregistration/registrationdlg.cxx +++ b/svtools/source/productregistration/registrationdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registrationdlg.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/registrationdlg.hrc b/svtools/source/productregistration/registrationdlg.hrc index d62e5b1dfcca..cfcde5f8c9b3 100644 --- a/svtools/source/productregistration/registrationdlg.hrc +++ b/svtools/source/productregistration/registrationdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registrationdlg.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/registrationdlg.hxx b/svtools/source/productregistration/registrationdlg.hxx index ce1bf08ac950..16761aff08fc 100644 --- a/svtools/source/productregistration/registrationdlg.hxx +++ b/svtools/source/productregistration/registrationdlg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registrationdlg.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src index f9462a420061..e0598ab05e60 100644 --- a/svtools/source/productregistration/registrationdlg.src +++ b/svtools/source/productregistration/registrationdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registrationdlg.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx index 052b10d2c564..96377a1b7efb 100644 --- a/svtools/source/svhtml/htmlkywd.cxx +++ b/svtools/source/svhtml/htmlkywd.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: htmlkywd.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 5bb26367075e..af0d0dff9667 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: htmlout.cxx,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 9103161afb51..4c08d9c41ec9 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: htmlsupp.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svhtml/makefile.mk b/svtools/source/svhtml/makefile.mk index b597763ac390..7a8552f2b672 100644 --- a/svtools/source/svhtml/makefile.mk +++ b/svtools/source/svhtml/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index b4eb6c05cffd..67fc5f619fdf 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: parhtml.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -2341,3 +2338,38 @@ rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime ) return RTL_TEXTENCODING_DONTKNOW; } +rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader ) +{ + rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW; + if( pHTTPHeader ) + { + SvKeyValue aKV; + for( BOOL bCont = pHTTPHeader->GetFirst( aKV ); bCont; + bCont = pHTTPHeader->GetNext( aKV ) ) + { + if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) + { + if( aKV.GetValue().Len() ) + { + eRet = HTMLParser::GetEncodingByMIME( aKV.GetValue() ); + } + } + } + } + return eRet; +} + +BOOL HTMLParser::SetEncodingByHTTPHeader( + SvKeyValueIterator *pHTTPHeader ) +{ + BOOL bRet = FALSE; + rtl_TextEncoding eEnc = HTMLParser::GetEncodingByHttpHeader( pHTTPHeader ); + if(RTL_TEXTENCODING_DONTKNOW != eEnc) + { + SetSrcEncoding( eEnc ); + bRet = TRUE; + } + return bRet; +} + + diff --git a/svtools/source/svrtf/makefile.mk b/svtools/source/svrtf/makefile.mk index 549b67897ecb..5ebb0e28c69e 100644 --- a/svtools/source/svrtf/makefile.mk +++ b/svtools/source/svrtf/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index cb40b1d1f4e9..1c578d160307 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: parrtf.cxx,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svrtf/rtfkey2.cxx b/svtools/source/svrtf/rtfkey2.cxx index 5c4e1039d92c..03a7667f48e2 100644 --- a/svtools/source/svrtf/rtfkey2.cxx +++ b/svtools/source/svrtf/rtfkey2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: rtfkey2.cxx,v $ - * $Revision: 1.14.134.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index 0dc90d0da8ab..27ce3643f8cf 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: rtfkeywd.cxx,v $ - * $Revision: 1.18.134.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 21dfefb14232..d97e838d2450 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: rtfout.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index 2af7af71adac..53b7ee497754 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svparser.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index d85ab643bdb0..6a33b96b2742 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove @@ -90,13 +91,10 @@ namespace svt { namespace table bHandled = true; } else - { bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt); - } } return bHandled; } - //-------------------------------------------------------------------- bool DefaultInputHandler::MouseButtonUp( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt ) { @@ -128,7 +126,6 @@ namespace svt { namespace table } return bHandled; } - //-------------------------------------------------------------------- bool DefaultInputHandler::KeyInput( IAbstractTableControl& _rControl, const KeyEvent& rKEvt ) { @@ -156,11 +153,11 @@ namespace svt { namespace table { KEY_PAGEDOWN, KEY_MOD1, cursorToLastLine }, { KEY_HOME, KEY_MOD1, cursorTopLeft }, { KEY_END, KEY_MOD1, cursorBottomRight }, - { KEY_SPACE, KEY_MOD1, cursorSelectRow }, - { KEY_UP, KEY_SHIFT, cursorSelectRowUp }, - { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown }, - { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom }, - { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop }, + { KEY_SPACE, KEY_MOD1, cursorSelectRow }, + { KEY_UP, KEY_SHIFT, cursorSelectRowUp }, + { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown }, + { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom }, + { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop }, { 0, 0, invalidTableControlAction } }; diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 5438a8a62d43..5c7a8dbd6832 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove @@ -80,32 +81,32 @@ namespace svt { namespace table // fill the rows with alternating background colors _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - if( background != 0xFFFFFF && line == 0xFFFFFF) - { - _rDevice.SetLineColor(background); - _rDevice.SetFillColor(background); - } - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - _rDevice.SetFillColor(background); - } + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + if( background != 0xFFFFFF && line == 0xFFFFFF) + { + _rDevice.SetLineColor(background); + _rDevice.SetFillColor(background); + } + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + _rDevice.SetFillColor(background); + } _rDevice.DrawRect( _rArea ); // delimiter lines at bottom/right _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); _rDevice.Pop(); - (void)_rStyle; - (void)_bIsColHeaderArea; - (void)_bIsRowHeaderArea; + (void)_rStyle; + (void)_bIsColHeaderArea; + (void)_bIsRowHeaderArea; } //-------------------------------------------------------------------- @@ -113,17 +114,17 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) { _rDevice.Push( PUSH_LINECOLOR); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetShadowColor()); - else - // if Line color is set, then it was user defined and should be visible - // if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + _rDevice.SetLineColor(_rStyle.GetShadowColor()); + else + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight()); String sHeaderText; @@ -132,22 +133,22 @@ namespace svt { namespace table DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); if ( !!pColumn ) sHeaderText = pColumn->getName(); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); - ULONG nHorFlag = TEXT_DRAW_LEFT; - ULONG nVerFlag = TEXT_DRAW_TOP; - if(m_pImpl->rModel.getVerticalAlign() == 1) - nVerFlag = TEXT_DRAW_VCENTER; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - nVerFlag = TEXT_DRAW_BOTTOM; - if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1) - nHorFlag = TEXT_DRAW_CENTER; - else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) - nHorFlag = TEXT_DRAW_RIGHT; - Rectangle aRect(_rArea); - aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=4; aRect.Bottom()-=4; + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=4; aRect.Bottom()-=4; _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); - _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); + _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.Pop(); (void)_bActive; @@ -167,54 +168,53 @@ namespace svt { namespace table _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - //if row is selected background color becomes blue, and lines should be also blue - //if they aren't user defined - if(_bSelected) + Color line = m_pImpl->rModel.getLineColor(); + Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + //if row is selected background color becomes blue, and lines should be also blue + //if they aren't user defined + if(_bSelected) + { + Color aSelected(_rStyle.GetHighlightColor()); + aRowBackground = aSelected; + if(line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + _rDevice.SetLineColor(line); + } + //if row not selected, check the cases whether user defined backgrounds are set + //and set line color to be the same + else + { + if(aRowBackground2 != 0xFFFFFF && _nRow%2) { - Color aSelected(_rStyle.GetHighlightColor()); - aRowBackground = aSelected; + aRowBackground = aRowBackground2; if(line == 0xFFFFFF) _rDevice.SetLineColor(aRowBackground); else _rDevice.SetLineColor(line); } - //if row not selected, check the cases whether user defined backgrounds are set - //and set line color to be the same + //fill the rows with alternating background colors if second background color is specified + else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); else { - if(aRowBackground2 != 0xFFFFFF && _nRow%2) - { - aRowBackground = aRowBackground2; - if(line == 0xFFFFFF) - _rDevice.SetLineColor(aRowBackground); - else - _rDevice.SetLineColor(line); - } - - //fill the rows with alternating background colors if second background color is specified - else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(aRowBackground); - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - } + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); } - Rectangle aRect(_rRowArea); - if(m_pImpl->rModel.hasColumnHeaders() || _nRow != 0) - --aRect.Top(); - if(m_pImpl->rModel.hasRowHeaders()) - --aRect.Left(); + } + Rectangle aRect(_rRowArea); + if(m_pImpl->rModel.hasColumnHeaders() || _nRow != 0) + --aRect.Top(); + if(m_pImpl->rModel.hasRowHeaders()) + --aRect.Left(); _rDevice.SetFillColor( aRowBackground ); _rDevice.DrawRect( aRect ); // TODO: active? _rDevice.Pop(); - (void)_bActive; + (void)_bActive; } //-------------------------------------------------------------------- @@ -222,41 +222,41 @@ namespace svt { namespace table const StyleSettings& _rStyle, rtl::OUString& _rText ) { _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); if(background != 0xFFFFFF && line == 0xFFFFFF) - { - _rDevice.SetLineColor(background); - } - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - } + { + _rDevice.SetLineColor(background); + } + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); - ULONG nHorFlag = TEXT_DRAW_LEFT; - ULONG nVerFlag = TEXT_DRAW_TOP; - if(m_pImpl->rModel.getVerticalAlign() == 1) - nVerFlag = TEXT_DRAW_VCENTER; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - nVerFlag = TEXT_DRAW_BOTTOM; - if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1) - nHorFlag = TEXT_DRAW_CENTER; - else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) - nHorFlag = TEXT_DRAW_RIGHT; - Rectangle aRect(_rArea); - aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=4; aRect.Bottom()-=4; + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=4; aRect.Bottom()-=4; _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); // TODO: active? selected? (void)_bActive; (void)_bSelected; - (void)_rStyle; + (void)_rStyle; //at the moment no special paint for selected row header _rDevice.Pop(); } @@ -266,74 +266,71 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION); - _rDevice.IntersectClipRegion( _rArea ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) + _rDevice.IntersectClipRegion( _rArea ); + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + else + _rDevice.SetLineColor(line); + } + //else set line color to the color of row background + else + { + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + _rDevice.SetLineColor(background2); else _rDevice.SetLineColor(line); } - //else set line color to the color of row background + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); else { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); - else - _rDevice.SetLineColor(line); - } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); - else - { - //if line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - } + //if line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - { + } + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + { // TODO: remove those temporary place holders Rectangle aRect( _rArea ); ++aRect.Left(); --aRect.Right(); aRect.Top(); aRect.Bottom(); - Point imagePos(Point(aRect.Left(), aRect.Top())); - Size imageSize = _pCellData->GetSizePixel(); - - if(aRect.GetWidth() > imageSize.Width()) - { - if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) - imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2; - else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) - imagePos.X() = aRect.Right() - imageSize.Width(); - } - else - imageSize.Width() = aRect.GetWidth(); - if(aRect.GetHeight() > imageSize.Height()) - { - if(m_pImpl->rModel.getVerticalAlign() == 1) - imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - imagePos.Y() = aRect.Bottom() - imageSize.Height(); - } - else - imageSize.Height() = aRect.GetHeight()-1; - Image& image (*_pCellData); - _rDevice.DrawImage(imagePos, imageSize, image, 0); + Point imagePos(Point(aRect.Left(), aRect.Top())); + Size imageSize = _pCellData->GetSizePixel(); + if(aRect.GetWidth() > imageSize.Width()) + { + if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) + imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2; + else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) + imagePos.X() = aRect.Right() - imageSize.Width(); } - - _rDevice.Pop(); + else + imageSize.Width() = aRect.GetWidth(); + if(aRect.GetHeight() > imageSize.Height()) + { + if(m_pImpl->rModel.getVerticalAlign() == 1) + imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + imagePos.Y() = aRect.Bottom() - imageSize.Height(); + } + else + imageSize.Height() = aRect.GetHeight()-1; + Image& image (*_pCellData); + _rDevice.DrawImage(imagePos, imageSize, image, 0); + } + _rDevice.Pop(); (void)_bActive; -// // no special painting for the active cell at the moment - (void)_rStyle; -// // TODO: do we need this? + // no special painting for the active cell at the moment + (void)_rStyle; } //-------------------------------------------------------------------- @@ -341,71 +338,67 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + else + _rDevice.SetLineColor(line); + } + //else set line color to the color of row background + else + { + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + _rDevice.SetLineColor(background2); else _rDevice.SetLineColor(line); } - //else set line color to the color of row background + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); else { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); - else - _rDevice.SetLineColor(line); - } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - } + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + } + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); { // TODO: remove those temporary place holders Rectangle aRect( _rArea ); ++aRect.Left(); --aRect.Right(); aRect.Top(); aRect.Bottom(); - if(_bSelected) - { - _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); - } - else - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); - //_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - //(void)_nColumn; - ULONG nHorFlag = TEXT_DRAW_LEFT; - ULONG nVerFlag = TEXT_DRAW_TOP; - if(m_pImpl->rModel.getVerticalAlign() == 1) - nVerFlag = TEXT_DRAW_VCENTER; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - nVerFlag = TEXT_DRAW_BOTTOM; - if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) - nHorFlag = TEXT_DRAW_CENTER; - else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) - nHorFlag = TEXT_DRAW_RIGHT; - Rectangle textRect(_rArea); - textRect.Left()+=4; textRect.Right()-=4; - textRect.Top()+=4; textRect.Bottom()-=4; + if(_bSelected) + { + _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); + } + else + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + Rectangle textRect(_rArea); + textRect.Left()+=4; textRect.Right()-=4; + textRect.Top()+=4; textRect.Bottom()-=4; _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); } _rDevice.Pop(); - (void)_bActive; // no special painting for the active cell at the moment - (void)_rStyle; - // TODO: do we need this? + (void)_rStyle; } //-------------------------------------------------------------------- @@ -417,7 +410,7 @@ namespace svt { namespace table //-------------------------------------------------------------------- void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) { - (void)_rCursorRect; + (void)_rCursorRect; _rView.HideFocus(); } diff --git a/svtools/source/table/makefile.mk b/svtools/source/table/makefile.mk index 8feb7fee10d8..cf1adc76fe92 100644 --- a/svtools/source/table/makefile.mk +++ b/svtools/source/table/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.16 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index f4d328261cba..4785248fbea6 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove @@ -564,7 +565,6 @@ void TableControl::selectionChanged(bool _bChanged) m_bSelectionChanged = _bChanged; } // ----------------------------------------------------------------------- - IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) { Select(); diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 39286903b11f..f391a9912e2e 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove @@ -170,95 +171,82 @@ namespace svt { namespace table { return 0; } - virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const + virtual ScrollbarVisibility getVerticalScrollbarVisibility(int , int ) const { - (void)overAllHeight; - (void)actHeight; - return ScrollbarShowNever; + return ScrollbarShowNever; } - virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const + virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int , int ) const { - (void)overAllWidth; - (void)actWidth; - return ScrollbarShowNever; + return ScrollbarShowNever; } - virtual bool hasVerticalScrollbar() - { - return false; - } - virtual bool hasHorizontalScrollbar() - { - return false; - } - virtual void setCellContent(const std::vector<std::vector< ::com::sun::star::uno::Any > >& ) - { - } - virtual ::com::sun::star::util::Color getLineColor() - { - return 0; - } - virtual void setLineColor(::com::sun::star::util::Color _rColor) - { - (void)_rColor; - } - virtual ::com::sun::star::util::Color getHeaderBackgroundColor() - { - return -1; - } - - virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) - { - (void)_rColor; - } - virtual ::com::sun::star::util::Color getTextColor() - { - return 0; - } - virtual void setTextColor(::com::sun::star::util::Color _rColor) - { - (void)_rColor; - } - virtual ::com::sun::star::util::Color getOddRowBackgroundColor() - { - return -1; - } - virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) - { - (void)_rColor; - } - virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() - { - return com::sun::star::style::VerticalAlignment(0); - } - virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment _Align) - { - (void)_Align; - } - virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() - { - return -1; - } - virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) - { - (void)_rColor; - } - - virtual std::vector<std::vector< ::com::sun::star::uno::Any > >& getCellContent() - { - return *( new std::vector<std::vector< ::com::sun::star::uno::Any > >); - } - virtual void setRowHeaderName(const std::vector<rtl::OUString>& ) - { - } - virtual std::vector<rtl::OUString>& getRowHeaderName() - { - aRowHeaderNames.clear(); - aRowHeaderNames.push_back(rtl::OUString::createFromAscii("")); - return aRowHeaderNames; - } - - private: - std::vector<rtl::OUString> aRowHeaderNames; + virtual bool hasVerticalScrollbar() + { + return false; + } + virtual bool hasHorizontalScrollbar() + { + return false; + } + virtual void setCellContent(const std::vector<std::vector< ::com::sun::star::uno::Any > >& ) + { + } + virtual ::com::sun::star::util::Color getLineColor() + { + return 0; + } + virtual void setLineColor(::com::sun::star::util::Color ) + { + } + virtual ::com::sun::star::util::Color getHeaderBackgroundColor() + { + return -1; + } + virtual void setHeaderBackgroundColor(::com::sun::star::util::Color ) + { + } + virtual ::com::sun::star::util::Color getTextColor() + { + return 0; + } + virtual void setTextColor(::com::sun::star::util::Color ) + { + } + virtual ::com::sun::star::util::Color getOddRowBackgroundColor() + { + return -1; + } + virtual void setOddRowBackgroundColor(::com::sun::star::util::Color ) + { + } + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() + { + return com::sun::star::style::VerticalAlignment(0); + } + virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment ) + { + } + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() + { + return -1; + } + virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color ) + { + } + virtual std::vector<std::vector< ::com::sun::star::uno::Any > >& getCellContent() + { + return *( new std::vector<std::vector< ::com::sun::star::uno::Any > >); + } + virtual void setRowHeaderName(const std::vector<rtl::OUString>& ) + { + } + virtual std::vector<rtl::OUString>& getRowHeaderName() + { + aRowHeaderNames.clear(); + aRowHeaderNames.push_back(rtl::OUString::createFromAscii("")); + return aRowHeaderNames; + } + private: + std::vector<rtl::OUString> aRowHeaderNames; }; @@ -428,33 +416,33 @@ namespace svt { namespace table ,m_pModel ( new EmptyTableModel ) ,m_pInputHandler ( ) ,m_nRowHeightPixel ( 15 ) - ,m_nColHeaderHeightPixel( 0 ) + ,m_nColHeaderHeightPixel( 0 ) ,m_nRowHeaderWidthPixel ( 0 ) ,m_nColumnCount ( 0 ) ,m_nRowCount ( 0 ) ,m_nCurColumn ( COL_INVALID ) ,m_nCurRow ( ROW_INVALID ) ,m_nLeftColumn ( 0 ) - ,m_nTopRow ( 0 ) + ,m_nTopRow ( 0 ) ,m_nCursorHidden ( 1 ) ,m_pDataWindow ( new TableDataWindow( *this ) ) - ,m_pVScroll ( NULL ) + ,m_pVScroll ( NULL ) ,m_pHScroll ( NULL ) ,m_pScrollCorner ( NULL ) - ,m_pSelEngine ( ) - ,m_nRowSelected ( ) - ,m_pTableFunctionSet ( new TableFunctionSet(this ) ) - ,m_nAnchor (-1 ) - ,m_bResizing ( false ) - ,m_nResizingColumn ( 0 ) - ,m_bResizingGrid ( false ) + ,m_pSelEngine ( ) + ,m_nRowSelected ( ) + ,m_pTableFunctionSet ( new TableFunctionSet(this ) ) + ,m_nAnchor (-1 ) + ,m_bResizing ( false ) + ,m_nResizingColumn ( 0 ) + ,m_bResizingGrid ( false ) #if DBG_UTIL ,m_nRequiredInvariants ( INV_SCROLL_POSITION ) #endif { DBG_CTOR( TableControl_Impl, TableControl_Impl_checkInvariants ); - m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet); - m_pSelEngine->SetSelectionMode(SINGLE_SELECTION); + m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet); + m_pSelEngine->SetSelectionMode(SINGLE_SELECTION); m_pDataWindow->SetPosPixel( Point( 0, 0 ) ); m_pDataWindow->Show(); } @@ -467,8 +455,8 @@ namespace svt { namespace table DELETEZ( m_pVScroll ); DELETEZ( m_pHScroll ); DELETEZ( m_pScrollCorner ); - DELETEZ( m_pTableFunctionSet ); - DELETEZ( m_pSelEngine ); + DELETEZ( m_pTableFunctionSet ); + DELETEZ( m_pSelEngine ); DELETEZ( m_pDataWindow ); } @@ -562,8 +550,8 @@ namespace svt { namespace table m_pInputHandler.reset(); m_nColumnCount = m_nRowCount = 0; - m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height(); - if ( m_pModel->hasColumnHeaders() ) + m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height(); + if ( m_pModel->hasColumnHeaders() ) m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height(); if ( m_pModel->hasRowHeaders() ) m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width(); @@ -591,89 +579,89 @@ namespace svt { namespace table m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); long accumulatedPixelWidth = 0; - double gridWidth = m_rAntiImpl.GetSizePixel().Width()-4; - if(m_pModel->hasRowHeaders()) - { - TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); - gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); - } - if(m_pModel->hasVerticalScrollbar()) - { - sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); - gridWidth-=scrollbarWidth; - } - double colWidthsSum = 0.0; - double colWithoutFixedWidthsSum = 0.0; - double minColWithoutFixedSum = 0.0; - for ( ColPos col = 0; col < colCount; ++col ) - { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = 0; - TableMetrics colPrefWidth = pColumn->getPreferredWidth(); - bool bResizable = pColumn->isResizable(); - if(pColumn->getMinWidth() == 0 && bResizable) - { - pColumn->setMinWidth(1); - minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); - } - if(pColumn->getMaxWidth() == 0 && bResizable) - pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); - if( colPrefWidth != 0) + double gridWidth = m_rAntiImpl.GetSizePixel().Width()-4; + if(m_pModel->hasRowHeaders()) + { + TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); + gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); + } + if(m_pModel->hasVerticalScrollbar()) + { + sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + gridWidth-=scrollbarWidth; + } + double colWidthsSum = 0.0; + double colWithoutFixedWidthsSum = 0.0; + double minColWithoutFixedSum = 0.0; + for ( ColPos col = 0; col < colCount; ++col ) + { + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = 0; + TableMetrics colPrefWidth = pColumn->getPreferredWidth(); + bool bResizable = pColumn->isResizable(); + if(pColumn->getMinWidth() == 0 && bResizable) + { + pColumn->setMinWidth(1); + minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + } + if(pColumn->getMaxWidth() == 0 && bResizable) + pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); + if( colPrefWidth != 0) + { + if(m_bResizingGrid) { - if(m_bResizingGrid) - { - colWidth = pColumn->getWidth(); - pColumn->setPreferredWidth(0); - } - else - { - colWidth = colPrefWidth; - pColumn->setWidth(colPrefWidth); - } + colWidth = pColumn->getWidth(); + pColumn->setPreferredWidth(0); } else - colWidth = pColumn->getWidth(); - long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - if(bResizable && colPrefWidth == 0) - colWithoutFixedWidthsSum+=pixelWidth; - colWidthsSum+=pixelWidth; - } - gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; - double scalingFactor = 1.0; - if(m_bResizingGrid) - { - if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) - scalingFactor = gridWidth/colWithoutFixedWidthsSum; - } - else - { - if(colWidthsSum < gridWidth) { - if(colWithoutFixedWidthsSum>0) - scalingFactor = gridWidth/colWithoutFixedWidthsSum; + colWidth = colPrefWidth; + pColumn->setWidth(colPrefWidth); } } - long pixelWidth = 0; - for ( ColPos col = 0; col < colCount; ++col ) + else + colWidth = pColumn->getWidth(); + long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + if(bResizable && colPrefWidth == 0) + colWithoutFixedWidthsSum+=pixelWidth; + colWidthsSum+=pixelWidth; + } + gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double scalingFactor = 1.0; + if(m_bResizingGrid) + { + if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) + scalingFactor = gridWidth/colWithoutFixedWidthsSum; + } + else + { + if(colWidthsSum < gridWidth) { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = pColumn->getWidth(); - if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) - { - colWidth*=scalingFactor; - pColumn->setWidth(colWidth); - } - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - m_aColumnWidthsPixel.push_back( pixelWidth ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + if(colWithoutFixedWidthsSum>0) + scalingFactor = gridWidth/colWithoutFixedWidthsSum; } } + long pixelWidth = 0; + for ( ColPos col = 0; col < colCount; ++col ) + { + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = pColumn->getWidth(); + if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + { + colWidth*=scalingFactor; + pColumn->setWidth(colWidth); + } + pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + m_aColumnWidthsPixel.push_back( pixelWidth ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + } + } //-------------------------------------------------------------------- namespace @@ -905,20 +893,20 @@ namespace svt { namespace table void TableControl_Impl::onResize() { DBG_CHECK_ME(); - if(m_nRowCount != 0) + if(m_nRowCount != 0) + { + if(m_nColumnCount != 0) { - if(m_nColumnCount != 0) - { - if(m_bResizingGrid) - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); - m_bResizingGrid = true; - } + if(m_bResizingGrid) + impl_ni_updateColumnWidths(); + impl_ni_updateScrollbars(); + m_bResizingGrid = true; } } + } //-------------------------------------------------------------------- - void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect ) + void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect ) { DBG_CHECK_ME(); @@ -1010,69 +998,69 @@ namespace svt { namespace table Rectangle aAllDataCellsArea; impl_getAllVisibleDataCellArea( aAllDataCellsArea ); - //get the vector, which contains row vectors, each containing the data for the cells in this row - std::vector<std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent(); - //if the vector is empty, fill it with empty data, so the table can be painted - if(aCellContent.empty()) + //get the vector, which contains row vectors, each containing the data for the cells in this row + std::vector<std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent(); + //if the vector is empty, fill it with empty data, so the table can be painted + if(aCellContent.empty()) + { + std::vector< ::com::sun::star::uno::Any > emptyCells; + while(m_nRowCount!=0) { - std::vector< ::com::sun::star::uno::Any > emptyCells; - while(m_nRowCount!=0) - { - aCellContent.push_back( emptyCells); - --m_nRowCount; - } + aCellContent.push_back( emptyCells); + --m_nRowCount; } - std::vector<std::vector< ::com::sun::star::uno::Any > >::iterator it = aCellContent.begin()+m_nTopRow; - //get the vector, which contains the row header titles - std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName(); - ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin(); + } + std::vector<std::vector< ::com::sun::star::uno::Any > >::iterator it = aCellContent.begin()+m_nTopRow; + //get the vector, which contains the row header titles + std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName(); + ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin(); - if(m_pModel->hasRowHeaders()) + if(m_pModel->hasRowHeaders()) + { + //if the vector is empty, fill it with empty strings, so the table can be painted + if(aRowHeaderContent.empty()) { - //if the vector is empty, fill it with empty strings, so the table can be painted - if(aRowHeaderContent.empty()) + while(m_nRowCount!=0) { - while(m_nRowCount!=0) - { - aRowHeaderContent.push_back(rtl::OUString::createFromAscii("")); - --m_nRowCount; - } + aRowHeaderContent.push_back(rtl::OUString::createFromAscii("")); + --m_nRowCount; } - itRowName = aRowHeaderContent.begin()+m_nTopRow; } + itRowName = aRowHeaderContent.begin()+m_nTopRow; + } for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() ); aRowIterator.isValid(); aRowIterator.moveDown() ) { if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() ) + { + if(it < aCellContent.end()-1) { - if(it < aCellContent.end()-1) - { - if(m_pModel->hasRowHeaders()) - ++itRowName; - ++it; - } - continue; + if(m_pModel->hasRowHeaders()) + ++itRowName; + ++it; } + continue; + } bool isActiveRow = ( aRowIterator.getRow() == getCurRow() ); - bool isSelectedRow = false; - if(!m_nRowSelected.empty()) + bool isSelectedRow = false; + if(!m_nRowSelected.empty()) + { + for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin(); + itSel!=m_nRowSelected.end();++itSel) { - for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin(); - itSel!=m_nRowSelected.end();++itSel) - { - if(*itSel == aRowIterator.getRow()) - isSelectedRow = true; - } + if(*itSel == aRowIterator.getRow()) + isSelectedRow = true; } - std::vector< ::com::sun::star::uno::Any > aCellData; + } + std::vector< ::com::sun::star::uno::Any > aCellData; if(it != aCellContent.begin()+m_nTopRow+nActualRows) - { - aCellData = *it; - if(it < aCellContent.end()-1) - ++it; - } - ::std::vector< ::com::sun::star::uno::Any >::iterator iter = aCellData.begin()+m_nLeftColumn; + { + aCellData = *it; + if(it < aCellContent.end()-1) + ++it; + } + ::std::vector< ::com::sun::star::uno::Any >::iterator iter = aCellData.begin()+m_nLeftColumn; // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, @@ -1081,15 +1069,14 @@ namespace svt { namespace table // paint the row header if ( m_pModel->hasRowHeaders() ) { - rtl::OUString rowHeaderName; - if(itRowName != aRowHeaderContent.begin()+m_nTopRow+nActualRows) - { - rowHeaderName = *itRowName; - if(itRowName < m_pModel->getRowHeaderName().end()-1) - ++itRowName; - } + rtl::OUString rowHeaderName; + if(itRowName != aRowHeaderContent.begin()+m_nTopRow+nActualRows) + { + rowHeaderName = *itRowName; + if(itRowName < m_pModel->getRowHeaderName().end()-1) + ++itRowName; + } Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); - //rStyle.SetBackgroundColor(m_rAntiImpl.getHeaderBackgroundColor()); pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, rStyle, rowHeaderName ); } @@ -1102,30 +1089,29 @@ namespace svt { namespace table aCell.moveRight() ) { - - bool isSelectedColumn = false; - ::com::sun::star::uno::Any rCellData; - if(!aCellData.empty() && iter != aCellData.begin()+m_nLeftColumn+nActualCols) + bool isSelectedColumn = false; + ::com::sun::star::uno::Any rCellData; + if(!aCellData.empty() && iter != aCellData.begin()+m_nLeftColumn+nActualCols) + { + rCellData = *iter; + if(iter < aCellData.end()-1) + ++iter; + Size siz = m_rAntiImpl.GetSizePixel(); + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(rCellData>>=xGraphic) { - rCellData = *iter; - if(iter < aCellData.end()-1) - ++iter; - Size siz = m_rAntiImpl.GetSizePixel(); - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(rCellData>>=xGraphic) - { - Image* pImage = new Image(xGraphic); - if(pImage!=NULL) - pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + Image* pImage = new Image(xGraphic); + if(pImage!=NULL) + pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, pImage ); - } - else - { - ::rtl::OUString sContent = impl_convertToString(rCellData); - pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + } + else + { + ::rtl::OUString sContent = impl_convertToString(rCellData); + pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, sContent ); - } } + } } } } @@ -1158,74 +1144,70 @@ namespace svt { namespace table switch ( _eAction ) { case cursorDown: - if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + { + //if other rows already selected, deselect them + if(m_nRowSelected.size()>0) { - //if other rows already selected, deselect them - if(m_nRowSelected.size()>0) - { - for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); - it!=m_nRowSelected.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } - m_nRowSelected.clear(); - } - if(m_nCurRow < m_nRowCount-1) + for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); + it!=m_nRowSelected.end();++it) { - ++m_nCurRow; - m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(*it, *it, rCells); } - else - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - ensureVisible(m_nCurColumn,m_nCurRow,false); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; + m_nRowSelected.clear(); } - else + if(m_nCurRow < m_nRowCount-1) { - if ( m_nCurRow < m_nRowCount - 1 ) - { - bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 ); - } + ++m_nCurRow; + m_nRowSelected.push_back(m_nCurRow); } + else + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + ensureVisible(m_nCurColumn,m_nCurRow,false); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; + } + else + { + if ( m_nCurRow < m_nRowCount - 1 ) + bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 ); + } break; case cursorUp: - if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + { + if(m_nRowSelected.size()>0) { - if(m_nRowSelected.size()>0) - { - for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); + for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } - m_nRowSelected.clear(); - } - if(m_nCurRow>0) { - --m_nCurRow; - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateSelectedRegion(*it, *it, rCells); } - else - { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } - ensureVisible(m_nCurColumn,m_nCurRow,false); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; + m_nRowSelected.clear(); + } + if(m_nCurRow>0) + { + --m_nCurRow; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } else { - if ( m_nCurRow > 0 ) - { - bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 ); - } + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } - break; + ensureVisible(m_nCurColumn,m_nCurRow,false); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; + } + else + { + if ( m_nCurRow > 0 ) + bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 ); + } + break; case cursorLeft: if ( m_nCurColumn > 0 ) bSuccess = goTo( m_nCurColumn - 1, m_nCurRow ); @@ -1279,252 +1261,251 @@ namespace svt { namespace table case cursorBottomRight: bSuccess = goTo( m_nColumnCount - 1, m_nRowCount - 1 ); break; - - case cursorSelectRow: + case cursorSelectRow: + { + if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) + return bSuccess = false; + //pos is the position of the current row in the vector of selected rows, if current row is selected + int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow); + //if current row is selected, it should be deselected, when ALT+SPACE are pressed + if(pos>-1) + { + m_nRowSelected.erase(m_nRowSelected.begin()+pos); + if(m_nRowSelected.empty() && m_nAnchor != -1) + m_nAnchor = -1; + } + //else select the row->put it in the vector + else + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; + } + break; + case cursorSelectRowUp: + { + if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) + return bSuccess = false; + else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) { - if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) - return bSuccess = false; - //pos is the position of the current row in the vector of selected rows, if current row is selected - int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow); - //if current row is selected, it should be deselected, when ALT+SPACE are pressed - if(pos>-1) - { - m_nRowSelected.erase(m_nRowSelected.begin()+pos); - if(m_nRowSelected.empty() && m_nAnchor != -1) - m_nAnchor = -1; - } - //else select the row->put it in the vector - else - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; + //if there are other selected rows, deselect them + return false; } - break; - case cursorSelectRowUp: + else { - if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) - return bSuccess = false; - else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + //there are other selected rows + if(m_nRowSelected.size()>0) { - //if there are other selected rows, deselect them - return false; - } - else - { - //there are other selected rows - if(m_nRowSelected.size()>0) + //the anchor wasn't set -> a region is not selected, that's why clear all selection + //and select the current row + if(m_nAnchor==-1) { - // the anchor wasn't set -> a region is not selected, that's why clear all selection - // and select the current row - if(m_nAnchor==-1) - { - for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); + for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } - m_nRowSelected.clear(); - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } - else { - //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected - int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); - int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1); - if(prevRow>-1) + invalidateSelectedRegion(*it, *it, rCells); + } + m_nRowSelected.clear(); + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + } + else + { + //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected + int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); + int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1); + if(prevRow>-1) + { + //if m_nCurRow isn't the upper one, can move up, otherwise not + if(m_nCurRow>0) + m_nCurRow--; + else + return bSuccess = true; + //if nextRow already selected, deselect it, otherwise select it + if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow) { - //if m_nCurRow isn't the upper one, can move up, otherwise not - if(m_nCurRow>0) - m_nCurRow--; - else - return bSuccess = true; - //if nextRow already selected, deselect it, otherwise select it - if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow) - { - m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells); - } - else - { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } + m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); + invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells); } - else + else { - if(m_nCurRow>0) - { - m_nRowSelected.push_back(m_nCurRow); - m_nCurRow--; - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); - } + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + } + } + else + { + if(m_nCurRow>0) + { + m_nRowSelected.push_back(m_nCurRow); + m_nCurRow--; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); } } } + } + else + { + //if nothing is selected and the current row isn't the upper one + //select the current and one row above + //otherwise select only the upper row + if(m_nCurRow>0) + { + m_nRowSelected.push_back(m_nCurRow); + m_nCurRow--; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); + } else { - //if nothing is selected and the current row isn't the upper one - //select the current and one row above - //otherwise select only the upper row - if(m_nCurRow>0) - { - m_nRowSelected.push_back(m_nCurRow); - m_nCurRow--; - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); - } - else - { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } - m_pSelEngine->SetAnchor(TRUE); - m_nAnchor = m_nCurRow; - ensureVisible(m_nCurColumn, m_nCurRow, false); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; } + m_pSelEngine->SetAnchor(TRUE); + m_nAnchor = m_nCurRow; + ensureVisible(m_nCurColumn, m_nCurRow, false); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; } - break; - case cursorSelectRowDown: + } + break; + case cursorSelectRowDown: + { + if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) + bSuccess = false; + else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) { - if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) - bSuccess = false; - else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) - { - bSuccess = false; - } - else + bSuccess = false; + } + else + { + if(m_nRowSelected.size()>0) { - if(m_nRowSelected.size()>0) + //the anchor wasn't set -> a region is not selected, that's why clear all selection + //and select the current row + if(m_nAnchor==-1) { - //the anchor wasn't set -> a region is not selected, that's why clear all selection - //and select the current row - if(m_nAnchor==-1) - { - for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); + for(std::vector<RowPos>::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } - m_nRowSelected.clear(); - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } - else { - //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected - int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); - int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1); - if(prevRow>-1) - { - //if m_nCurRow isn't the last one, can move down, otherwise not - if(m_nCurRow<m_nRowCount-1) - m_nCurRow++; - else - return bSuccess = true; - //if next row already selected, deselect it, otherwise select it - if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow) - { - m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells); - } - else - { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); - } - } - else - { - if(m_nCurRow<m_nRowCount-1) - { - m_nRowSelected.push_back(m_nCurRow); - m_nCurRow++; - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); - } - } + invalidateSelectedRegion(*it, *it, rCells); + } + m_nRowSelected.clear(); + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } - } else { - //there wasn't any selection, select current and row beneath, otherwise only row beneath - if(m_nCurRow<m_nRowCount-1) - { - m_nRowSelected.push_back(m_nCurRow); - m_nCurRow++; - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); + //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected + int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); + int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1); + if(prevRow>-1) + { + //if m_nCurRow isn't the last one, can move down, otherwise not + if(m_nCurRow<m_nRowCount-1) + m_nCurRow++; + else + return bSuccess = true; + //if next row already selected, deselect it, otherwise select it + if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow) + { + m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); + invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells); + } + else + { + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + } } else { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + if(m_nCurRow<m_nRowCount-1) + { + m_nRowSelected.push_back(m_nCurRow); + m_nCurRow++; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); + } } } - m_pSelEngine->SetAnchor(TRUE); - m_nAnchor = m_nCurRow; - ensureVisible(m_nCurColumn, m_nCurRow, false); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; } - } - break; - case cursorSelectRowAreaTop: - { - if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) - bSuccess = false; - else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) - bSuccess = false; else { - //select the region between the current and the upper row - RowPos iter = m_nCurRow; - invalidateSelectedRegion(m_nCurRow, 0, rCells); - //put the rows in vector - while(iter>=0) + //there wasn't any selection, select current and row beneath, otherwise only row beneath + if(m_nCurRow<m_nRowCount-1) { - if(!isRowSelected(m_nRowSelected, iter)) - m_nRowSelected.push_back(iter); - --iter; + m_nRowSelected.push_back(m_nCurRow); + m_nCurRow++; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); + } + else + { + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } - m_nCurRow = 0; - m_nAnchor = m_nCurRow; - m_pSelEngine->SetAnchor(TRUE); - ensureVisible(m_nCurColumn, 0, false); - m_rAntiImpl.selectionChanged(true); - bSuccess = true; } + m_pSelEngine->SetAnchor(TRUE); + m_nAnchor = m_nCurRow; + ensureVisible(m_nCurColumn, m_nCurRow, false); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; } + } break; - case cursorSelectRowAreaBottom: + case cursorSelectRowAreaTop: + { + if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) + bSuccess = false; + else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + bSuccess = false; + else { - if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) - return bSuccess = false; - else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) - return bSuccess = false; - //select the region between the current and the last row + //select the region between the current and the upper row RowPos iter = m_nCurRow; - invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells); - //put the rows in the vector - while(iter<=m_nRowCount) + invalidateSelectedRegion(m_nCurRow, 0, rCells); + //put the rows in vector + while(iter>=0) { if(!isRowSelected(m_nRowSelected, iter)) m_nRowSelected.push_back(iter); - ++iter; + --iter; } - m_nCurRow = m_nRowCount-1; + m_nCurRow = 0; m_nAnchor = m_nCurRow; m_pSelEngine->SetAnchor(TRUE); - ensureVisible(m_nCurColumn, m_nRowCount-1, false); + ensureVisible(m_nCurColumn, 0, false); m_rAntiImpl.selectionChanged(true); bSuccess = true; } + } + break; + case cursorSelectRowAreaBottom: + { + if(m_pSelEngine->GetSelectionMode() == NO_SELECTION) + return bSuccess = false; + else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + return bSuccess = false; + //select the region between the current and the last row + RowPos iter = m_nCurRow; + invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells); + //put the rows in the vector + while(iter<=m_nRowCount) + { + if(!isRowSelected(m_nRowSelected, iter)) + m_nRowSelected.push_back(iter); + ++iter; + } + m_nCurRow = m_nRowCount-1; + m_nAnchor = m_nCurRow; + m_pSelEngine->SetAnchor(TRUE); + ensureVisible(m_nCurColumn, m_nRowCount-1, false); + m_rAntiImpl.selectionChanged(true); + bSuccess = true; + } break; default: DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" ); @@ -1540,15 +1521,10 @@ namespace svt { namespace table { Rectangle aCellRect; impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect ); - - if ( _bShow ) - { - pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect); - } - else - { - pRenderer->HideCellCursor( *m_pDataWindow, aCellRect); - } + if ( _bShow ) + pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect); + else + pRenderer->HideCellCursor( *m_pDataWindow, aCellRect); } } @@ -1625,7 +1601,6 @@ namespace svt { namespace table } showCursor(); } - //------------------------------------------------------------------------------- void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect) { @@ -1661,7 +1636,6 @@ namespace svt { namespace table } m_pDataWindow->Invalidate(_rCellRect); } - //------------------------------------------------------------------------------- //this method is to be called, when a new row is added void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect) @@ -1675,13 +1649,12 @@ namespace svt { namespace table impl_ni_updateScrollbars(); m_pDataWindow->Invalidate(_rRow.getRect()); } - //------------------------------------------------------------------------------- std::vector<RowPos>& TableControl_Impl::getSelectedRows() { return m_nRowSelected; } - + //------------------------------------------------------------------------------- void TableControl_Impl::removeSelectedRow(RowPos _nRowPos) { int i =0; @@ -1708,18 +1681,18 @@ namespace svt { namespace table else m_nCurRow = _nRowPos-1; } - //------------------------------------------------------------------------------- + //------------------------------------------------------------------------------ void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect) { - (void)_nRowStart; - (void)_rCellRect; - impl_ni_updateScrollbars(); - TableSize nVisibleRows = impl_getVisibleRows(true); - if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) - m_nTopRow--; - else - m_nTopRow = 0; - m_pDataWindow->Invalidate(); + (void)_nRowStart; + (void)_rCellRect; + impl_ni_updateScrollbars(); + TableSize nVisibleRows = impl_getVisibleRows(true); + if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) + m_nTopRow--; + else + m_nTopRow = 0; + m_pDataWindow->Invalidate(); } //-------------------------------------------------------------------- @@ -1892,15 +1865,17 @@ namespace svt { namespace table return (TableSize)( m_nLeftColumn - nOldLeftColumn ); } - + //------------------------------------------------------------------------------- SelectionEngine* TableControl_Impl::getSelEngine() { - return m_pSelEngine; + return m_pSelEngine; } + //------------------------------------------------------------------------------- TableDataWindow* TableControl_Impl::getDataWindow() { - return m_pDataWindow; + return m_pDataWindow; } + //------------------------------------------------------------------------------- BOOL TableControl_Impl::isRowSelected(::std::vector<RowPos> selectedRows, RowPos current) { for(::std::vector<RowPos>::iterator it=selectedRows.begin(); @@ -1911,7 +1886,7 @@ namespace svt { namespace table } return FALSE; } - + //------------------------------------------------------------------------------- int TableControl_Impl::getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current) { int pos = -1; @@ -1924,6 +1899,7 @@ namespace svt { namespace table } return pos; } + //------------------------------------------------------------------------------- void TableControl_Impl::setTooltip(const Point& rPoint ) { ::rtl::OUString aTooltipText; @@ -1960,9 +1936,7 @@ namespace svt { namespace table for(int i=0; i<text.getLength(); i++) { if(i==0) - { aTooltipText = text[i]; - } else { aTooltipText+= ::rtl::OUString::createFromAscii("\n"); @@ -1975,9 +1949,7 @@ namespace svt { namespace table int nCols = cols.getLength(); int mText = text.getLength(); if(nCols < mText ) - { cols.realloc(mText); - } else if(mText < nCols) text.realloc(nCols); for(int i=0; i<cols.getLength(); i++) @@ -2023,9 +1995,7 @@ namespace svt { namespace table int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && pColumn->isResizable()) - { aNewPointer = Pointer( POINTER_HSPLIT ); - } //MouseButton was pressed but not yet released, mouse is moving if(m_bResizing) { @@ -2046,7 +2016,6 @@ namespace svt { namespace table } m_pDataWindow->SetPointer(aNewPointer); } - //-------------------------------------------------------------------- bool TableControl_Impl::startResizeColumn(const Point& rPoint) { @@ -2094,29 +2063,29 @@ namespace svt { namespace table pColumn->setPreferredWidth(minWidth); if(m_nLeftColumn != 0) impl_updateLeftColumn(); - } - else if(oldX < actX) + } + else if(oldX < actX) + { + if(actWidth < maxWidth) { - if(actWidth < maxWidth) - { - newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); - pColumn->setPreferredWidth(newActWidth); - } - else - pColumn->setPreferredWidth(maxWidth); + newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); + pColumn->setPreferredWidth(newActWidth); } - m_nCurColumn = m_nResizingColumn; - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); - m_pDataWindow->Invalidate(INVALIDATE_UPDATE); - m_pDataWindow->SetPointer(Pointer()); - m_bResizing = false; - m_bResizingGrid = true; + else + pColumn->setPreferredWidth(maxWidth); } - m_pDataWindow->ReleaseMouse(); - return m_bResizing; + m_nCurColumn = m_nResizingColumn; + impl_ni_updateColumnWidths(); + impl_ni_updateScrollbars(); + m_pDataWindow->Invalidate(INVALIDATE_UPDATE); + m_pDataWindow->SetPointer(Pointer()); + m_bResizing = false; + m_bResizingGrid = true; } - + m_pDataWindow->ReleaseMouse(); + return m_bResizing; + } + //------------------------------------------------------------------------------- void TableControl_Impl::impl_ni_getAccVisibleColWidths() { TableSize nVisCols = impl_getVisibleColumns(true); @@ -2140,6 +2109,7 @@ namespace svt { namespace table nVisCols--; } } + //------------------------------------------------------------------------------- void TableControl_Impl::impl_updateLeftColumn() { int nVisCols = m_aVisibleColumnWidthsPixel.size(); @@ -2204,32 +2174,32 @@ namespace svt { namespace table return 0L; } //--------------------------------------------------------------------------------------- - TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl): - m_pTableControl( _pTableControl) - ,m_nCurrentRow (-2) + TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl) + :m_pTableControl( _pTableControl) + ,m_nCurrentRow (-2) { } - + //------------------------------------------------------------------------------- TableFunctionSet::~TableFunctionSet() { } - + //------------------------------------------------------------------------------- void TableFunctionSet::BeginDrag() { } - + //------------------------------------------------------------------------------- void TableFunctionSet::CreateAnchor() { m_pTableControl->m_nAnchor = m_pTableControl->m_nCurRow; } - - void TableFunctionSet::DestroyAnchor() - { + //------------------------------------------------------------------------------- + void TableFunctionSet::DestroyAnchor() + { m_pTableControl->m_nAnchor = -1; - } - - BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor) - { + } + //------------------------------------------------------------------------------- + BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor) + { BOOL bHandled = FALSE; Rectangle rCells; //curRow is the row where the mouse click happened, m_nCurRow is the last selected row, before the mouse click @@ -2280,10 +2250,8 @@ namespace svt { namespace table //no region selected else { - if(m_pTableControl->m_nRowSelected.empty()) - { + if(m_pTableControl->m_nRowSelected.empty() m_pTableControl->m_nRowSelected.push_back(curRow); - } else { if(m_pTableControl->m_pSelEngine->GetSelectionMode()==SINGLE_SELECTION) @@ -2307,7 +2275,7 @@ namespace svt { namespace table m_pTableControl->ensureVisible(m_pTableControl->m_nCurColumn,m_pTableControl->m_nCurRow,false); return bHandled; } - + //------------------------------------------------------------------------------- BOOL TableFunctionSet::IsSelectionAtPoint( const Point& rPoint ) { m_pTableControl->m_pSelEngine->AddAlways(FALSE); @@ -2322,7 +2290,7 @@ namespace svt { namespace table return selected; } } - + //------------------------------------------------------------------------------- void TableFunctionSet::DeselectAtPoint( const Point& rPoint ) { (void)rPoint; @@ -2341,13 +2309,14 @@ namespace svt { namespace table } m_pTableControl->m_nRowSelected.erase(m_pTableControl->m_nRowSelected.begin()+pos); } + //------------------------------------------------------------------------------- void TableFunctionSet::DeselectAll() { if(!m_pTableControl->m_nRowSelected.empty()) { Rectangle rCells; for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin(); - it!=m_pTableControl->m_nRowSelected.end();++it) + it!=m_pTableControl->m_nRowSelected.end();++it) { m_pTableControl->invalidateSelectedRegion(*it, *it, rCells); } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 8bc6b371d1d8..8494e73d5ce9 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ #ifndef SVTOOLS_TABLECONTROL_IMPL_HXX @@ -62,63 +63,63 @@ namespace svt { namespace table friend class TableRowGeometry; friend class TableColumnGeometry; friend class SuspendInvariants; - friend class TableFunctionSet; + friend class TableFunctionSet; private: /// the control whose impl-instance we implemnt - TableControl& m_rAntiImpl; + TableControl& m_rAntiImpl; /// the model of the table control - PTableModel m_pModel; + PTableModel m_pModel; /// the input handler to use, usually the input handler as provided by ->m_pModel - PTableInputHandler m_pInputHandler; + PTableInputHandler m_pInputHandler; /// the widths of the single columns, measured in pixel - ArrayOfLong m_aColumnWidthsPixel; + ArrayOfLong m_aColumnWidthsPixel; /** the accumulated widths of the single columns, i.e. their exclusive right borders, <strong<not</strong> counting the space for a possible row header column */ - ArrayOfLong m_aAccColumnWidthsPixel; + ArrayOfLong m_aAccColumnWidthsPixel; - ArrayOfLong m_aVisibleColumnWidthsPixel; + ArrayOfLong m_aVisibleColumnWidthsPixel; /// the height of a single row in the table, measured in pixels - long m_nRowHeightPixel; + long m_nRowHeightPixel; /// the height of the column header row in the table, measured in pixels - long m_nColHeaderHeightPixel; + long m_nColHeaderHeightPixel; /// the width of the row header column in the table, measured in pixels - long m_nRowHeaderWidthPixel; + long m_nRowHeaderWidthPixel; /// the number of columns in the table control. Cached model value. - TableSize m_nColumnCount; + TableSize m_nColumnCount; /// the number of rows in the table control. Cached model value. - TableSize m_nRowCount; + TableSize m_nRowCount; - ColPos m_nCurColumn; - RowPos m_nCurRow; - ColPos m_nLeftColumn; - RowPos m_nTopRow; + ColPos m_nCurColumn; + RowPos m_nCurRow; + ColPos m_nLeftColumn; + RowPos m_nTopRow; - sal_Int32 m_nCursorHidden; + sal_Int32 m_nCursorHidden; /** the window to contain all data content, including header bars The window's upper left corner is at position (0,0), relative to the table control, which is the direct parent of the data window. */ - TableDataWindow* m_pDataWindow; + TableDataWindow* m_pDataWindow; /// the vertical scrollbar, if any - ScrollBar* m_pVScroll; + ScrollBar* m_pVScroll; /// the horizontal scrollbar, if any ScrollBar* m_pHScroll; - ScrollBarBox* m_pScrollCorner; - //selection engine - for determining selection range, e.g. single, multiple - SelectionEngine* m_pSelEngine; - //vector which contains the selected rows - std::vector<RowPos> m_nRowSelected; - //part of selection engine - TableFunctionSet* m_pTableFunctionSet; - //part of selection engine - RowPos m_nAnchor; - bool m_bResizing; - ColPos m_nResizingColumn; - bool m_bResizingGrid; + ScrollBarBox* m_pScrollCorner; + //selection engine - for determining selection range, e.g. single, multiple + SelectionEngine* m_pSelEngine; + //vector which contains the selected rows + std::vector<RowPos> m_nRowSelected; + //part of selection engine + TableFunctionSet* m_pTableFunctionSet; + //part of selection engine + RowPos m_nAnchor; + bool m_bResizing; + ColPos m_nResizingColumn; + bool m_bResizingGrid; #if DBG_UTIL #define INV_SCROLL_POSITION 1 @@ -183,36 +184,36 @@ namespace svt { namespace table <TRUE/> if it's okay that the given cooordinate is only partially visible */ void ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility ); - /** returns the row, which contains the input point*/ - virtual RowPos getCurrentRow (const Point& rPoint); - - void setCursorAtCurrentCell(const Point& rPoint); - /** checks whether the vector with the selected rows contains the current row*/ - BOOL isRowSelected(::std::vector<RowPos> selectedRows, RowPos current); - /** returns the position of the current row in the selection vector */ - int getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current); - /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ - void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect ); - /** to be called when a new row is added to the control*/ - void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect ); - /** returns the vector, which contains the selected rows*/ - std::vector<RowPos>& getSelectedRows(); - /** updates the vector, which contains the selected rows after removing the row nRowPos*/ - void removeSelectedRow(RowPos _nRowPos); - void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); + /** returns the row, which contains the input point*/ + virtual RowPos getCurrentRow (const Point& rPoint); + + void setCursorAtCurrentCell(const Point& rPoint); + /** checks whether the vector with the selected rows contains the current row*/ + BOOL isRowSelected(::std::vector<RowPos> selectedRows, RowPos current); + /** returns the position of the current row in the selection vector */ + int getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current); + /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ + void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect ); + /** to be called when a new row is added to the control*/ + void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect ); + /** returns the vector, which contains the selected rows*/ + std::vector<RowPos>& getSelectedRows(); + /** updates the vector, which contains the selected rows after removing the row nRowPos*/ + void removeSelectedRow(RowPos _nRowPos); + void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); // IAbstractTableControl virtual void hideCursor(); virtual void showCursor(); virtual bool dispatchAction( TableControlAction _eAction ); - virtual SelectionEngine* getSelEngine(); - virtual void setTooltip(const Point& rPoint ); - virtual void resizeColumn(const Point& rPoint); - virtual bool startResizeColumn(const Point& rPoint); - virtual bool endResizeColumn(const Point& rPoint); + virtual SelectionEngine* getSelEngine(); + virtual void setTooltip(const Point& rPoint ); + virtual void resizeColumn(const Point& rPoint); + virtual bool startResizeColumn(const Point& rPoint); + virtual bool endResizeColumn(const Point& rPoint); - TableDataWindow* getDataWindow(); - /** retrieves the area occupied by the totality of (at least partially) visible cells + TableDataWindow* getDataWindow(); + /** retrieves the area occupied by the totality of (at least partially) visible cells The returned area includes row and column headers. Also, it takes into account the the fact that there might be less columns than would normally @@ -230,7 +231,7 @@ namespace svt { namespace table */ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; - ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); + ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); private: /** toggles the cursor visibility diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 8d7b08c4e255..1a1696a6ea58 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove @@ -51,6 +52,7 @@ namespace svt { namespace table { m_rTableControl.doPaintContent( rUpdateRect ); } + //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { Point aPoint = rMEvt.GetPosPixel(); @@ -70,6 +72,7 @@ namespace svt { namespace table Window::MouseMove( rMEvt ); } } + //-------------------------------------------------------------------- void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt ) { if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) @@ -82,20 +85,24 @@ namespace svt { namespace table } m_rTableControl.getAntiImpl().LoseFocus(); } + //-------------------------------------------------------------------- void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt ) { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); m_rTableControl.getAntiImpl().GetFocus(); } + //-------------------------------------------------------------------- void TableDataWindow::SetPointer( const Pointer& rPointer ) { Window::SetPointer(rPointer); } + //-------------------------------------------------------------------- void TableDataWindow::CaptureMouse() { Window::CaptureMouse(); } + //-------------------------------------------------------------------- void TableDataWindow::ReleaseMouse( ) { Window::ReleaseMouse(); diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx index 4ec032260b82..d60de9e6438f 100644 --- a/svtools/source/table/tablegeometry.cxx +++ b/svtools/source/table/tablegeometry.cxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove diff --git a/svtools/source/table/tablegeometry.hxx b/svtools/source/table/tablegeometry.hxx index 18b40c1e3781..3ddde0c98c64 100644 --- a/svtools/source/table/tablegeometry.hxx +++ b/svtools/source/table/tablegeometry.hxx @@ -1,26 +1,27 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * ************************************************************************/ #ifndef SVTOOLS_TABLEGEOMETRY_HXX diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index b2aff7ae711d..2f25a8f2f9b2 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: addrtempuno.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index b3ae322aa3ba..9eb36cf18a45 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contextmenuhelper.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx index 79b496187b5a..20176160b396 100644 --- a/svtools/source/uno/framestatuslistener.cxx +++ b/svtools/source/uno/framestatuslistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: framestatuslistener.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx index d4af28d51c57..a58d9b784cca 100644 --- a/svtools/source/uno/generictoolboxcontroller.cxx +++ b/svtools/source/uno/generictoolboxcontroller.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: generictoolboxcontroller.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index a5899834fd59..a7ece1acc369 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: genericunodialog.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 82e509f1ce08..7bfe37624947 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.21 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 0f7b79720179..433c1e1acbcb 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: miscservices.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -37,13 +34,27 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> +#include <osl/diagnose.h> +#include <uno/mapping.hxx> +#include "provider.hxx" +#include "renderer.hxx" + +#include <com/sun/star/registry/XRegistryKey.hpp> +#include "comphelper/servicedecl.hxx" using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; +using namespace unographic; using rtl::OUString; +namespace sdecl = comphelper::service_decl; + +namespace unographic { +extern sdecl::ServiceDecl const serviceDecl; +} + // ------------------------------------------------------------------------------------- // for CreateInstance functions implemented elsewhere @@ -60,10 +71,10 @@ using rtl::OUString; DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) -DECLARE_CREATEINSTANCE( PathService ) +DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider ) +DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) // ------------------------------------------------------------------------------------- - extern "C" { @@ -74,13 +85,14 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( } SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* _pServiceManager */, void * _pRegistryKey ) + void * pServiceManager, void * _pRegistryKey ) { if (_pRegistryKey) { Reference< XRegistryKey > xRegistryKey ( reinterpret_cast< XRegistryKey* >( _pRegistryKey )); Reference< XRegistryKey > xNewKey; + uno::Sequence< ::rtl::OUString > aServices; xNewKey = xRegistryKey->createKey ( OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) ); @@ -92,13 +104,37 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey ( OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); + // GraphicProvider + xNewKey = reinterpret_cast< registry::XRegistryKey * >( _pRegistryKey )->createKey( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + + GraphicProvider::getImplementationName_Static() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); + + aServices = GraphicProvider::getSupportedServiceNames_Static(); + int i; + for( i = 0; i < aServices.getLength(); i++ ) + xNewKey->createKey( aServices.getConstArray()[ i ] ); + + // GraphicRendererVCL + xNewKey = reinterpret_cast< registry::XRegistryKey * >( _pRegistryKey )->createKey( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + + GraphicRendererVCL::getImplementationName_Static() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); + + aServices = ( GraphicRendererVCL::getSupportedServiceNames_Static() ); + for( i = 0; i < aServices.getLength(); i++ ) + xNewKey->createKey( aServices.getConstArray()[ i ] ); + + if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( _pRegistryKey ), serviceDecl ) ) + return false; + return sal_True; } return sal_False; } SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */) + const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey) { void * pResult = 0; if ( _pServiceManager ) @@ -130,6 +166,27 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( SvFilterOptionsDialog_CreateInstance, aServiceNames); } + else if( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplementationName ) ) + { + xFactory = ::cppu::createOneInstanceFactory( + reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ), + GraphicProvider::getImplementationName_Static(), + GraphicProvider_CreateInstance, + GraphicProvider::getSupportedServiceNames_Static() ); + } + else if( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplementationName ) ) + { + xFactory = ::cppu::createOneInstanceFactory( + reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ), + GraphicRendererVCL::getImplementationName_Static(), + GraphicRendererVCL_CreateInstance, + GraphicRendererVCL::getSupportedServiceNames_Static() ); + } + else + { + pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ); + } + if ( xFactory.is() ) { xFactory->acquire(); diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx index 91c895f416a0..14b802a1bf90 100644 --- a/svtools/source/uno/statusbarcontroller.cxx +++ b/svtools/source/uno/statusbarcontroller.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: statusbarcontroller.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 40616c2a4d87..a9a61bbee1b1 100755..100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SVTXGridControl.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -87,10 +84,10 @@ SVTXGridControl::~SVTXGridControl() ::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); } @@ -392,11 +389,11 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_GRID_SHOWCOLUMNHEADER, BASEPROPERTY_GRID_DATAMODEL, BASEPROPERTY_GRID_COLUMNMODEL, - BASEPROPERTY_GRID_SELECTIONMODE, - BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND, - BASEPROPERTY_GRID_HEADER_BACKGROUND, - BASEPROPERTY_GRID_LINE_COLOR, - BASEPROPERTY_GRID_ROW_BACKGROUND, + BASEPROPERTY_GRID_SELECTIONMODE, + BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND, + BASEPROPERTY_GRID_HEADER_BACKGROUND, + BASEPROPERTY_GRID_LINE_COLOR, + BASEPROPERTY_GRID_ROW_BACKGROUND, 0); VCLXWindow::ImplGetPropertyIds( rIds, true ); } @@ -469,6 +466,12 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); m_pTableModel->getCellContent().clear(); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())), + Any()); + } } else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount()) { @@ -541,10 +544,10 @@ void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::G (void) Event; } - void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) - { +void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) +{ VCLXWindow::disposing( Source ); - } +} ::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) { diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index 232eaea4349f..bcb8badf72e5 100755..100644 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SVTXGridControl.hxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -70,7 +67,7 @@ protected: void ImplCallItemListeners(); public: - SVTXGridControl(); + SVTXGridControl(); ~SVTXGridControl(); //XGridDataListener overridables virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); @@ -82,9 +79,9 @@ public: virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } - void SAL_CALL release() throw() { VCLXWindow::release(); } + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } + void SAL_CALL release() throw() { VCLXWindow::release(); } // ::com::sun::star::lang::XTypeProvider ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index a8d05c49a7ae..3f0b4e7c0ee6 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: toolboxcontroller.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 22a86f473703..a46b9605a00d 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: treecontrolpeer.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx index e3738c1639eb..015e131321f8 100644 --- a/svtools/source/uno/treecontrolpeer.hxx +++ b/svtools/source/uno/treecontrolpeer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: treecontrolpeer.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 6d04098e0f78..3dca0cbf4425 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unocontroltablemodel.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -55,10 +52,10 @@ using namespace ::com::sun::star::uno; ,m_nWidth( 4 ) ,m_nMinWidth( 0 ) ,m_nMaxWidth( 0 ) - ,m_nPrefWidth ( 0 ) - ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) + ,m_nPrefWidth ( 0 ) + ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { - m_sName = m_xGridColumn->getTitle(); + m_sName = m_xGridColumn->getTitle(); } //-------------------------------------------------------------------- UnoControlTableColumn::UnoControlTableColumn() @@ -68,8 +65,8 @@ using namespace ::com::sun::star::uno; ,m_nWidth( 4 ) ,m_nMinWidth( 0 ) ,m_nMaxWidth( 0 ) - ,m_nPrefWidth ( 0 ) - ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) + ,m_nPrefWidth ( 0 ) + ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { } @@ -176,42 +173,42 @@ using namespace ::com::sun::star::uno; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; - bool bVScroll; - bool bHScroll; + bool bVScroll; + bool bHScroll; PTableRenderer pRenderer; PTableInputHandler pInputHandler; TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; - std::vector<rtl::OUString>& aRowHeadersTitle; - std::vector<std::vector< Any > >& aCellContent; - ::com::sun::star::util::Color m_xLineColor; - ::com::sun::star::util::Color m_xHeaderColor; - ::com::sun::star::util::Color m_xTextColor; - ::com::sun::star::util::Color m_xRowColor1; - ::com::sun::star::util::Color m_xRowColor2; - ::com::sun::star::style::VerticalAlignment m_xVerticalAlign; + std::vector<rtl::OUString>& aRowHeadersTitle; + std::vector<std::vector< Any > >& aCellContent; + ::com::sun::star::util::Color m_xLineColor; + ::com::sun::star::util::Color m_xHeaderColor; + ::com::sun::star::util::Color m_xTextColor; + ::com::sun::star::util::Color m_xRowColor1; + ::com::sun::star::util::Color m_xRowColor2; + ::com::sun::star::style::VerticalAlignment m_xVerticalAlign; UnoControlTableModel_Impl() - :aColumns ( *(new std::vector< PColumnModel> (0))) - ,nRowCount ( 0 ) + :aColumns ( *(new std::vector< PColumnModel> (0))) + ,nRowCount ( 0 ) ,bHasColumnHeaders ( false ) ,bHasRowHeaders ( false ) - ,bVScroll ( false ) - ,bHScroll ( false ) + ,bVScroll ( false ) + ,bHScroll ( false ) ,pRenderer ( ) ,pInputHandler ( ) ,nRowHeight ( 0 ) ,nColumnHeaderHeight( 0 ) ,nRowHeaderWidth ( 10 ) - ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0))) - ,aCellContent ( *(new std::vector<std::vector< Any > >(0)) ) - ,m_xLineColor( 0xFFFFFF ) - ,m_xHeaderColor( 0xFFFFFF ) - ,m_xTextColor( 0 ) //black as default - ,m_xRowColor1( 0xFFFFFF ) - ,m_xRowColor2( 0xFFFFFF ) - ,m_xVerticalAlign(com::sun::star::style::VerticalAlignment(0)) + ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0))) + ,aCellContent ( *(new std::vector<std::vector< Any > >(0)) ) + ,m_xLineColor ( 0xFFFFFF ) + ,m_xHeaderColor ( 0xFFFFFF ) + ,m_xTextColor ( 0 )//black as default + ,m_xRowColor1 ( 0xFFFFFF ) + ,m_xRowColor2 ( 0xFFFFFF ) + ,m_xVerticalAlign (com::sun::star::style::VerticalAlignment(0)) { } }; @@ -502,8 +499,8 @@ using namespace ::com::sun::star::uno; { m_pImpl->m_xRowColor2 = _rColor; } - //-------------------------------------------------------------------- - com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign() + //-------------------------------------------------------------------- + ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign() { return m_pImpl->m_xVerticalAlign; } diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index c72db4e7ba87..c00642448f79 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unocontroltablemodel.hxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -67,7 +64,7 @@ class UnoControlTableColumn : public IColumnModel public: UnoControlTableColumn(Reference<XGridColumn>); - UnoControlTableColumn(); + UnoControlTableColumn(); // IColumnModel overridables virtual ColumnID getID() const; @@ -82,16 +79,16 @@ class UnoControlTableColumn : public IColumnModel virtual void setMinWidth( TableMetrics _nMinWidth ); virtual TableMetrics getMaxWidth() const; virtual void setMaxWidth( TableMetrics _nMaxWidth ); - virtual TableMetrics getPreferredWidth() const; + virtual TableMetrics getPreferredWidth() const; virtual void setPreferredWidth( TableMetrics _nPrefWidth ); - virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign(); - virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign); - }; + virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign(); + virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign); +}; - struct UnoControlTableModel_Impl; +struct UnoControlTableModel_Impl; - class UnoControlTableModel : public ITableModel - { +class UnoControlTableModel : public ITableModel +{ private: UnoControlTableModel_Impl* m_pImpl; @@ -127,17 +124,17 @@ class UnoControlTableColumn : public IColumnModel // ITableModel overridables virtual TableSize getColumnCount() const; virtual TableSize getRowCount() const; - virtual void setColumnCount(TableSize _nColCount); + virtual void setColumnCount(TableSize _nColCount); virtual void setRowCount(TableSize _nRowCount); virtual bool hasColumnHeaders() const; virtual bool hasRowHeaders() const; - virtual void setRowHeaders(bool _bRowHeaders); - virtual void setColumnHeaders(bool _bColumnHeaders); + virtual void setRowHeaders(bool _bRowHeaders); + virtual void setColumnHeaders(bool _bColumnHeaders); virtual bool isCellEditable( ColPos col, RowPos row ) const; virtual void addTableModelListener( const PTableModelListener& listener ); virtual void removeTableModelListener( const PTableModelListener& listener ); virtual PColumnModel getColumnModel( ColPos column ); - virtual std::vector<PColumnModel>& getColumnModel(); + virtual std::vector<PColumnModel>& getColumnModel(); virtual PColumnModel getColumnModelByID( ColumnID id ); virtual PTableRenderer getRenderer() const; virtual PTableInputHandler getInputHandler() const; @@ -146,35 +143,35 @@ class UnoControlTableColumn : public IColumnModel virtual TableMetrics getRowHeaderWidth() const; virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const; virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const; - virtual void setVerticalScrollbarVisibility(bool _bVScroll) const; + virtual void setVerticalScrollbarVisibility(bool _bVScroll) const; virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const; - virtual void setCellContent(const std::vector<std::vector< Any > >& cellContent); - virtual std::vector<std::vector< Any > >& getCellContent(); - virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent); - virtual std::vector<rtl::OUString>& getRowHeaderName(); - virtual ::com::sun::star::util::Color getLineColor(); - virtual void setLineColor(::com::sun::star::util::Color _rColor); - virtual ::com::sun::star::util::Color getHeaderBackgroundColor(); - virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor); - virtual ::com::sun::star::util::Color getTextColor(); - virtual void setTextColor(::com::sun::star::util::Color _rColor); - virtual ::com::sun::star::util::Color getOddRowBackgroundColor(); - virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor); - virtual ::com::sun::star::util::Color getEvenRowBackgroundColor(); - virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor); - virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign(); - virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign); - virtual bool hasVerticalScrollbar(); - virtual bool hasHorizontalScrollbar(); - }; - - inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) - { + virtual void setCellContent(const std::vector<std::vector< Any > >& cellContent); + virtual std::vector<std::vector< Any > >& getCellContent(); + virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent); + virtual std::vector<rtl::OUString>& getRowHeaderName(); + virtual ::com::sun::star::util::Color getLineColor(); + virtual void setLineColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getHeaderBackgroundColor(); + virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getTextColor(); + virtual void setTextColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getOddRowBackgroundColor(); + virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor(); + virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign(); + virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign); + virtual bool hasVerticalScrollbar(); + virtual bool hasHorizontalScrollbar(); +}; + +inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) +{ getColumnModel( _nColumn )->setWidth( _nWidth100thMM ); - } +} - inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn ) - { - return getColumnModel( _nColumn )->getWidth(); - } +inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn ) +{ + return getColumnModel( _nColumn )->getWidth(); +} #endif // _UNOCONTROL_TABLEMODEL_HXX_ diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 6fc8b0017ad8..526cdbb5d03a 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoevent.cxx,v $ - * $Revision: 1.13.136.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc index 4f46edffdc51..a31d07e0bd27 100644 --- a/svtools/source/uno/unoifac2.hrc +++ b/svtools/source/uno/unoifac2.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoifac2.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/unoifac2.src b/svtools/source/uno/unoifac2.src index 661e3a68d248..406701ca4fc1 100644 --- a/svtools/source/uno/unoifac2.src +++ b/svtools/source/uno/unoifac2.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoifac2.src,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 9c7c3eec33d1..f2090be1655f 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoiface.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1053,7 +1050,7 @@ void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const case ::com::sun::star::uno::TypeClass_DOUBLE: if (pField->TreatingAsNumber()) { - double d; + double d = 0.0; rValue >>= d; aReturn <<= d; } @@ -1065,7 +1062,7 @@ void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const // should never fail Color* pDum; - double d; + double d = 0.0; rValue >>= d; String sConverted; pFormatter->GetOutputString(d, 0, sConverted, &pDum); diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 28d8c7acdc70..6b6e35482ae9 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoimap.cxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx index 61781c2b3500..7e81f17209f2 100644 --- a/svtools/source/urlobj/inetimg.cxx +++ b/svtools/source/urlobj/inetimg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: inetimg.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svtools/source/urlobj/makefile.mk b/svtools/source/urlobj/makefile.mk index cb115ae5f701..c75e592ea10b 100644 --- a/svtools/source/urlobj/makefile.mk +++ b/svtools/source/urlobj/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify |