diff options
author | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-10-22 17:29:01 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-10-22 17:29:01 +0200 |
commit | 1e7cd1ecd7a6b730daf90bae9ec9bd9b1b19c9e6 (patch) | |
tree | 53a78aaa7367b718070df14bec3290c120faa745 | |
parent | 5de3269dcd48cd653837de3d576d7be3df679927 (diff) | |
parent | cf144cb77169bfc84604434f4b7923fe5dac3d1e (diff) |
commit after rebase to DEV300m62
312 files changed, 16379 insertions, 3328 deletions
diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 7d0dc6e3967a..3ea13868aeb4 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -65,6 +65,7 @@ CDEFS+=-xalias_level=compatible .ENDIF # --- Common ---------------------------------------------------------- +.IF "$(L10N_framework)"=="" # BEGIN ---------------------------------------------------------------- # auto generated Target:tests by codegen.pl @@ -85,7 +86,6 @@ SHL1OBJS= \ # here, because not yet delivered. Need the functionality to test, so # we're linking it in statically. Need to keep this in sync with # source/makefile.mk - SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ $(CPPUNITLIB) \ @@ -95,7 +95,7 @@ SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = export.map - +.ENDIF # END ------------------------------------------------------------------ #APP2TARGET= bmpdemo @@ -127,6 +127,7 @@ SLOFILES=$(SHL1OBJS) .INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ +.IF "$(L10N_framework)"=="" unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @@ -135,3 +136,4 @@ unittest : $(SHL1TARGETN) $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN) ALLTAR : unittest +.ENDIF diff --git a/basegfx/inc/basegfx/color/bcolortools.hxx b/basegfx/inc/basegfx/color/bcolortools.hxx new file mode 100644 index 000000000000..b4906727d08b --- /dev/null +++ b/basegfx/inc/basegfx/color/bcolortools.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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: bcolor.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 _BGFX_COLOR_BCOLORTOOLS_HXX +#define _BGFX_COLOR_BCOLORTOOLS_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + class BColor; + + namespace tools + { + /// Transform from RGB to HSL + BColor rgb2hsl(const BColor& rRGBColor); + /// Transform from HSL to RGB + BColor hsl2rgb(const BColor& rHSLColor); + + /// Transform from RGB to HSV + BColor rgb2hsv(const BColor& rRGBColor); + /// Transform from HSV to RGB + BColor hsv2rgb(const BColor& rHSVColor); + + /// Transform from R'G'B' to YIQ (NTSC color model - Y is used in monochrome mode) + BColor rgb2yiq(const BColor& rRGBColor); + /// Transform from YIQ to R'G'B' (NTSC color model - Y is used in monochrome mode) + BColor yiq2rgb(const BColor& rYIQColor); + + /// Transform from R'G'B' to Y'PbPr (the [0,1]x[-.5,.5]x[-.5,.5] equivalent of Y'CbCr (which is scaled into 8bit)) + BColor rgb2ypbpr(const BColor& rRGBColor); + /// Transform from Y'PbPr (the [0,1]x[-.5,.5]x[-.5,.5] equivalent of Y'CbCr (which is scaled into 8bit)) into R'G'B' + BColor ypbpr2rgb(const BColor& rYPbPrColor); + + /// Transform from CIE XYZ into Rec. 709 RGB (D65 white point) + BColor ciexyz2rgb( const BColor& rXYZColor ); + /// Transform from Rec. 709 RGB (D65 white point) into CIE XYZ + BColor rgb2ciexyz( const BColor& rRGBColor ); + + } +} // end of namespace basegfx + +#endif /* _BGFX_COLOR_BCOLORTOOLS_HXX */ + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index 9dd6085bbc7f..a58cd33e4f9c 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -96,6 +96,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tools mkdir: %_DEST%\inc%_EXT%\basegfx\color ..\inc\basegfx\color\bcolor.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolor.hxx +..\inc\basegfx\color\bcolortools.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolortools.hxx ..\inc\basegfx\color\bcolormodifier.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolormodifier.hxx mkdir: %_DEST%\inc%_EXT%\basegfx\pixel diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx new file mode 100644 index 000000000000..1c7d2b222fff --- /dev/null +++ b/basegfx/source/color/bcolortools.cxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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: bcolor.cxx,v $ + * + * $Revision: 1.2 $ + * + * 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_basegfx.hxx" + +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/color/bcolortools.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx { namespace tools +{ + BColor rgb2hsl(const BColor& rRGBColor) + { + const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); + const double minVal = ::std::min( ::std::min( r, g ), b ); + const double maxVal = ::std::max( ::std::max( r, g ), b ); + const double d = maxVal - minVal; + + double h=0, s=0, l=0; + + l = (maxVal + minVal) / 2.0; + + if( ::basegfx::fTools::equalZero(d) ) + { + s = h = 0; // hue undefined (achromatic case) + } + else + { + s = l > 0.5 ? d/(2.0-maxVal-minVal) : + d/(maxVal + minVal); + + if( r == maxVal ) + h = (g - b)/d; + else if( g == maxVal ) + h = 2.0 + (b - r)/d; + else + h = 4.0 + (r - h)/d; + + h *= 60.0; + + if( h < 0.0 ) + h += 360.0; + } + + return BColor(h,s,l); + } + + static inline double hsl2rgbHelper( double nValue1, double nValue2, double nHue ) + { + // clamp hue to [0,360] + nHue = fmod( nHue, 360.0 ); + + // cope with wrap-arounds + if( nHue < 0.0 ) + nHue += 360.0; + + if( nHue < 60.0 ) + return nValue1 + (nValue2 - nValue1)*nHue/60.0; + else if( nHue < 180.0 ) + return nValue2; + else if( nHue < 240.0 ) + return nValue1 + (nValue2 - nValue1)*(240.0 - nHue)/60.0; + else + return nValue1; + } + + BColor hsl2rgb(const BColor& rHSLColor) + { + const double h=rHSLColor.getRed(), s=rHSLColor.getGreen(), l=rHSLColor.getBlue(); + + if( fTools::equalZero(s) ) + return BColor(l, l, l ); // achromatic case + + const double nVal1( l <= 0.5 ? l*(1.0 + s) : l + s - l*s ); + const double nVal2( 2.0*l - nVal1 ); + + return BColor( + hsl2rgbHelper(nVal2, + nVal1, + h + 120.0), + hsl2rgbHelper(nVal2, + nVal1, + h), + hsl2rgbHelper(nVal2, + nVal1, + h - 120.0) ); + } + + BColor rgb2hsv(const BColor& rRGBColor) + { + const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); + const double maxVal = std::max(std::max(r,g),b); + const double minVal = std::min(std::min(r,g),b); + const double delta = maxVal-minVal; + + double h=0, s=0, v=0; + + v = maxVal; + if( fTools::equalZero(v) ) + s = 0; + else + s = delta / v; + + if( !fTools::equalZero(s) ) + { + if( maxVal == r ) + { + h = (g - b) / delta; + } + else if( maxVal == g ) + { + h = 2.0 + (b - r) / delta; + } + else + { + h = 4.0 + (r - g) / delta; + } + + h *= 60.0; + + if( h < 0 ) + h += 360; + } + + return BColor(h,s,v); + } + + BColor hsv2rgb(const BColor& rHSVColor) + { + double h=rHSVColor.getRed(); + const double s=rHSVColor.getGreen(), v=rHSVColor.getBlue(); + + if( fTools::equalZero(s) ) + { + // achromatic case: no hue. + return BColor(v,v,v); + } + else + { + if( fTools::equal(h,360) ) + h = 0; // 360 degrees is equivalent to 0 degrees + + h /= 60.0; + const sal_Int32 intval = static_cast< sal_Int32 >( h ); + const double f = h - intval; + const double p = v*(1.0-s); + const double q = v*(1.0-(s*f)); + const double t = v*(1.0-(s*(1.0-f))); + + /* which hue area? */ + switch( intval ) + { + case 0: + return BColor(v,t,p); + + case 1: + return BColor(q,v,p); + + case 2: + return BColor(p,v,t); + + case 3: + return BColor(p,q,v); + + case 4: + return BColor(t,p,v); + + case 5: + return BColor(v,p,q); + + default: + // hue overflow + return BColor(); + } + } + } + + BColor rgb2yiq(const BColor& rRGBColor) + { + // from Foley, van Dam, Computer Graphics + const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); + return BColor( + 0.299*r + 0.587*g + 0.114*b, + 0.596*r - 0.274*g - 0.322*b, + 0.211*r - 0.522*g + 0.311*b); + } + + BColor yiq2rgb(const BColor& rYIQColor) + { + // from Foley, van Dam, Computer Graphics + const double y=rYIQColor.getRed(), i=rYIQColor.getGreen(), q=rYIQColor.getBlue(); + return BColor( + y + 0.956*i + 0.623*q, + y - 0.272*i - 0.648*q, + y - 1.105*i + 1.705*q ); + } + + BColor ciexyz2rgb( const BColor& rXYZColor ) + { + // from Poynton color faq, and SMPTE RP 177-1993, Derivation + // of Basic Television Color Equations + const double x=rXYZColor.getRed(), y=rXYZColor.getGreen(), z=rXYZColor.getBlue(); + return BColor( + 3.240479*x - 1.53715*y - 0.498535*z, + -0.969256*x + 1.875991*y + 0.041556*z, + 0.055648*x - 0.204043*y + 1.057311*z ); + } + + BColor rgb2ciexyz( const BColor& rRGBColor ) + { + // from Poynton color faq, and SMPTE RP 177-1993, Derivation + // of Basic Television Color Equations + const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); + return BColor( + 0.412453*r + 0.35758*g + 0.180423*b, + 0.212671*r + 0.71516*g + 0.072169*b, + 0.019334*r + 0.119193*g + 0.950227*b); + } + + BColor rgb2ypbpr(const BColor& rRGBColor) + { + const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); + return BColor( + 0.299*r + 0.587*g + 0.114*b, + -0.168736*r - 0.331264*g + 0.5*b, + 0.5*r - 0.418688*g - 0.081312*b); + } + + BColor ypbpr2rgb(const BColor& rYPbPrColor) + { + const double y=rYPbPrColor.getRed(), pb=rYPbPrColor.getGreen(), pr=rYPbPrColor.getBlue(); + return BColor( + 1.*y + 0.*pb + 1.402*pr, + 1.*y - 0.344136*pb - 0.714136*pr, + 1.*y + 1.772*pb + 0.*pr); + } + +} } // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/basegfx/source/color/makefile.mk b/basegfx/source/color/makefile.mk index 9fd79701d65a..77b91a82f3ac 100644 --- a/basegfx/source/color/makefile.mk +++ b/basegfx/source/color/makefile.mk @@ -45,6 +45,7 @@ TARGET=color SLOFILES= \ $(SLO)$/bcolor.obj \ + $(SLO)$/bcolortools.obj \ $(SLO)$/bcolormodifier.obj # --- Targets ---------------------------------- diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 07d6eb4c54e5..b4c9453c1d3c 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -43,6 +43,8 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/range/b2dmultirange.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/color/bcolortools.hxx> #include <basegfx/tools/debugplotter.hxx> @@ -1443,6 +1445,178 @@ public: CPPUNIT_TEST_SUITE_END(); }; // class b2dvector +class bcolor : public CppUnit::TestFixture +{ + BColor maWhite; + BColor maBlack; + BColor maRed; + BColor maGreen; + BColor maBlue; + BColor maYellow; + BColor maMagenta; + BColor maCyan; + +public: + bcolor() : + maWhite(1,1,1), + maBlack(0,0,0), + maRed(1,0,0), + maGreen(0,1,0), + maBlue(0,0,1), + maYellow(1,1,0), + maMagenta(1,0,1), + maCyan(0,1,1) + {} + + + // initialise your test code values here. + void setUp() + { + } + + void tearDown() + { + } + + // insert your test code here. + void hslTest() + { + CPPUNIT_ASSERT_MESSAGE("white", + tools::rgb2hsl(maWhite) == BColor(0,0,1)); + CPPUNIT_ASSERT_MESSAGE("black", + tools::rgb2hsl(maBlack) == BColor(0,0,0)); + CPPUNIT_ASSERT_MESSAGE("red", + tools::rgb2hsl(maRed) == BColor(0,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("green", + tools::rgb2hsl(maGreen) == BColor(120,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("blue", + tools::rgb2hsl(maBlue) == BColor(240,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("yellow", + tools::rgb2hsl(maYellow) == BColor(60,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("magenta", + tools::rgb2hsl(maMagenta) == BColor(300,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("cyan", + tools::rgb2hsl(maCyan) == BColor(180,1,0.5)); + + CPPUNIT_ASSERT_MESSAGE("roundtrip white", + tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite); + CPPUNIT_ASSERT_MESSAGE("roundtrip black", + tools::hsl2rgb(tools::rgb2hsl(maBlack)) == maBlack); + CPPUNIT_ASSERT_MESSAGE("roundtrip red", + tools::hsl2rgb(tools::rgb2hsl(maRed)) == maRed); + CPPUNIT_ASSERT_MESSAGE("roundtrip green", + tools::hsl2rgb(tools::rgb2hsl(maGreen)) == maGreen); + CPPUNIT_ASSERT_MESSAGE("roundtrip blue", + tools::hsl2rgb(tools::rgb2hsl(maBlue)) == maBlue); + CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", + tools::hsl2rgb(tools::rgb2hsl(maYellow)) == maYellow); + CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", + tools::hsl2rgb(tools::rgb2hsl(maMagenta)) == maMagenta); + CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", + tools::hsl2rgb(tools::rgb2hsl(maCyan)) == maCyan); + + CPPUNIT_ASSERT_MESSAGE("grey10", + tools::rgb2hsl(maWhite*.1) == BColor(0,0,.1)); + CPPUNIT_ASSERT_MESSAGE("grey90", + tools::rgb2hsl(maWhite*.9) == BColor(0,0,.9)); + CPPUNIT_ASSERT_MESSAGE("red/2", + tools::rgb2hsl(maRed*.5) == BColor(0,1,0.25)); + CPPUNIT_ASSERT_MESSAGE("green/2", + tools::rgb2hsl(maGreen*.5) == BColor(120,1,0.25)); + CPPUNIT_ASSERT_MESSAGE("blue/2", + tools::rgb2hsl(maBlue*.5) == BColor(240,1,0.25)); + CPPUNIT_ASSERT_MESSAGE("yellow/2", + tools::rgb2hsl(maYellow*.5) == BColor(60,1,0.25)); + CPPUNIT_ASSERT_MESSAGE("magenta/2", + tools::rgb2hsl(maMagenta*.5) == BColor(300,1,0.25)); + CPPUNIT_ASSERT_MESSAGE("cyan/2", + tools::rgb2hsl(maCyan*.5) == BColor(180,1,0.25)); + + CPPUNIT_ASSERT_MESSAGE("pastel", + tools::rgb2hsl(BColor(.75,.25,.25)) == BColor(0,.5,.5)); + } + + // insert your test code here. + void hsvTest() + { + CPPUNIT_ASSERT_MESSAGE("white", + tools::rgb2hsv(maWhite) == BColor(0,0,1)); + CPPUNIT_ASSERT_MESSAGE("black", + tools::rgb2hsv(maBlack) == BColor(0,0,0)); + CPPUNIT_ASSERT_MESSAGE("red", + tools::rgb2hsv(maRed) == BColor(0,1,1)); + CPPUNIT_ASSERT_MESSAGE("green", + tools::rgb2hsv(maGreen) == BColor(120,1,1)); + CPPUNIT_ASSERT_MESSAGE("blue", + tools::rgb2hsv(maBlue) == BColor(240,1,1)); + CPPUNIT_ASSERT_MESSAGE("yellow", + tools::rgb2hsv(maYellow) == BColor(60,1,1)); + CPPUNIT_ASSERT_MESSAGE("magenta", + tools::rgb2hsv(maMagenta) == BColor(300,1,1)); + CPPUNIT_ASSERT_MESSAGE("cyan", + tools::rgb2hsv(maCyan) == BColor(180,1,1)); + + CPPUNIT_ASSERT_MESSAGE("roundtrip white", + tools::hsv2rgb(tools::rgb2hsv(maWhite)) == maWhite); + CPPUNIT_ASSERT_MESSAGE("roundtrip black", + tools::hsv2rgb(tools::rgb2hsv(maBlack)) == maBlack); + CPPUNIT_ASSERT_MESSAGE("roundtrip red", + tools::hsv2rgb(tools::rgb2hsv(maRed)) == maRed); + CPPUNIT_ASSERT_MESSAGE("roundtrip green", + tools::hsv2rgb(tools::rgb2hsv(maGreen)) == maGreen); + CPPUNIT_ASSERT_MESSAGE("roundtrip blue", + tools::hsv2rgb(tools::rgb2hsv(maBlue)) == maBlue); + CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", + tools::hsv2rgb(tools::rgb2hsv(maYellow)) == maYellow); + CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", + tools::hsv2rgb(tools::rgb2hsv(maMagenta)) == maMagenta); + CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", + tools::hsv2rgb(tools::rgb2hsv(maCyan)) == maCyan); + + CPPUNIT_ASSERT_MESSAGE("grey10", + tools::rgb2hsv(maWhite*.1) == BColor(0,0,.1)); + CPPUNIT_ASSERT_MESSAGE("grey90", + tools::rgb2hsv(maWhite*.9) == BColor(0,0,.9)); + CPPUNIT_ASSERT_MESSAGE("red/2", + tools::rgb2hsv(maRed*.5) == BColor(0,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("green/2", + tools::rgb2hsv(maGreen*.5) == BColor(120,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("blue/2", + tools::rgb2hsv(maBlue*.5) == BColor(240,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("yellow/2", + tools::rgb2hsv(maYellow*.5) == BColor(60,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("magenta/2", + tools::rgb2hsv(maMagenta*.5) == BColor(300,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("cyan/2", + tools::rgb2hsv(maCyan*.5) == BColor(180,1,0.5)); + + CPPUNIT_ASSERT_MESSAGE("pastel", + tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5)); + } + + void ciexyzTest() + { + tools::rgb2ciexyz(maWhite); + tools::rgb2ciexyz(maBlack); + tools::rgb2ciexyz(maRed); + tools::rgb2ciexyz(maGreen); + tools::rgb2ciexyz(maBlue); + tools::rgb2ciexyz(maYellow); + tools::rgb2ciexyz(maMagenta); + tools::rgb2ciexyz(maCyan); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(bcolor); + CPPUNIT_TEST(hslTest); + CPPUNIT_TEST(hsvTest); + CPPUNIT_TEST(ciexyzTest); + CPPUNIT_TEST_SUITE_END(); +}; // class b2dvector + // ----------------------------------------------------------------------------- //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d"); @@ -1458,6 +1632,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dquadraticbezier, "basegfx2d" CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2drange, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dtuple, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dvector, "basegfx2d"); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::bcolor, "basegfx2d"); } // namespace basegfx2d diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 8e47a13defdd..1bd4d59b98d5 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -58,6 +58,7 @@ SHL1LIBS=\ $(SLB)$/range.lib \ $(SLB)$/tuple.lib \ $(SLB)$/tools.lib \ + $(SLB)$/color.lib \ $(SLB)$/vector.lib SHL1TARGET= basegfx_tests diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index f822749cab20..08a4e7a70fa1 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -44,6 +44,12 @@ #include <tools/prewin.h> #include <windows.h> #include <tools/postwin.h> +#ifdef max +#undef max +#endif +#ifdef min +#undef min +#endif #endif #include <vcl/sysdata.hxx> diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk index 2ab726da3464..27a1aeb6dcd7 100644 --- a/canvas/source/cairo/makefile.mk +++ b/canvas/source/cairo/makefile.mk @@ -49,7 +49,7 @@ DLLPRE = # --- X11 Mac build currently doesn't work with cairo ----------- .IF "$(OS)" == "MACOSX" && "$(GUIBASE)" == "unx" @all: - @echo "Cannot build cairocanvas with X11..." + @echo "Cannot build cairocanvas with X11..." .ENDIF .ENDIF @@ -65,7 +65,7 @@ CFLAGS+=-I$(SOLARINCDIR)/cairo .IF "$(verbose)"!="" || "$(VERBOSE)"!="" CDEFS+= -DVERBOSE .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/cairo_cachedbitmap.obj \ $(SLO)$/cairo_cairo.obj \ $(SLO)$/cairo_canvas.obj \ @@ -97,7 +97,6 @@ SHL1STDLIBS+= -lcairo .IF "$(GUIBASE)"=="aqua" # native Mac OS X (Quartz) SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj -OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) .ELSE # "$(GUIBASE)"=="aqua" @@ -131,7 +130,7 @@ SHL1VERSIONMAP=exports.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 932a15e1f5c1..acef323ddc1b 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -956,11 +956,43 @@ namespace dxcanvas { if(hr != D3DERR_DEVICELOST) return false; - hr = mpDevice->Reset(&mad3dpp); - if(SUCCEEDED(hr)) - return true; - if(hr == D3DERR_DEVICELOST) - return true; + + // interestingly enough, sometimes the Reset() below + // *still* causes DeviceLost errors. So, cycle until + // DX was kind enough to really reset the device... + do + { + mpVertexBuffer.reset(); + hr = mpDevice->Reset(&mad3dpp); + if(SUCCEEDED(hr)) + { + IDirect3DVertexBuffer9 *pVB(NULL); + DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); + if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, + D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, + aFVF, + D3DPOOL_DEFAULT, + &pVB, + NULL)) ) + { + throw lang::NoSupportException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create DirectX device - out of memory!")),NULL); + } + mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB); + + // retry after the restore + if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0))) + return true; + } + + TimeValue aTimeout; + aTimeout.Seconds=1; + aTimeout.Nanosec=0; + osl_waitThread(&aTimeout); + } + while(hr == D3DERR_DEVICELOST); + return false; } diff --git a/canvas/source/directx/dx_surfacegraphics.cxx b/canvas/source/directx/dx_surfacegraphics.cxx index 128095c1315d..8b9af6be6827 100755 --- a/canvas/source/directx/dx_surfacegraphics.cxx +++ b/canvas/source/directx/dx_surfacegraphics.cxx @@ -34,6 +34,8 @@ #include "dx_surfacegraphics.hxx" #include "dx_impltools.hxx" +using namespace ::com::sun::star; + namespace dxcanvas { namespace @@ -75,11 +77,12 @@ namespace dxcanvas tools::setupGraphics( *pGraphics ); pRet.reset(pGraphics, GraphicsDeleter(rSurface, aHDC)); + return pRet; } else rSurface->ReleaseDC( aHDC ); } - return pRet; + throw uno::RuntimeException(); } } diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx index e5e7e4ffb4ae..1c64506c0f21 100755 --- a/canvas/source/directx/dx_winstuff.hxx +++ b/canvas/source/directx/dx_winstuff.hxx @@ -97,25 +97,18 @@ #undef DrawText -// Needed for #?$&/@ gdiplus header -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define __WORKAROUND_MAX_DEFINED__ -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define __WORKAROUND_MIN_DEFINED__ -#endif - +#ifdef __MINGW32__
+using ::std::max;
+using ::std::min;
+#endif
+
#include <gdiplus.h> -#ifdef __WORKAROUND_MAX_DEFINED__ -#undef max +#ifdef min +# undef min #endif - -#ifdef __WORKAROUND_MIN_DEFINED__ -#undef min +#ifdef max +# undef max #endif namespace dxcanvas diff --git a/canvas/source/factory/makefile.mk b/canvas/source/factory/makefile.mk index 3e9611412463..1051b953ae81 100644 --- a/canvas/source/factory/makefile.mk +++ b/canvas/source/factory/makefile.mk @@ -37,7 +37,7 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE : settings.mk DLLPRE = - +.IF "$(L10N_framework)"=="" SLOFILES = \ $(SLO)$/cf_service.obj @@ -55,6 +55,6 @@ SHL1LIBS = $(SLB)$/$(TARGET).lib SHL1DEF = $(MISC)$/$(SHL1TARGET).def DEF1NAME = $(SHL1TARGET) - +.ENDIF .INCLUDE : target.mk diff --git a/canvas/source/null/makefile.mk b/canvas/source/null/makefile.mk index 76e372c56fd7..99a6bbab93a4 100644 --- a/canvas/source/null/makefile.mk +++ b/canvas/source/null/makefile.mk @@ -45,7 +45,7 @@ DLLPRE = .IF "$(verbose)"!="" || "$(VERBOSE)"!="" CDEFS+= -DVERBOSE .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/null_canvasbitmap.obj \ $(SLO)$/null_canvascustomsprite.obj \ $(SLO)$/null_canvasfont.obj \ @@ -68,7 +68,7 @@ SHL1VERSIONMAP=exports.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/canvas/source/simplecanvas/makefile.mk b/canvas/source/simplecanvas/makefile.mk index 6417ddb0c650..c0a60250ab85 100644 --- a/canvas/source/simplecanvas/makefile.mk +++ b/canvas/source/simplecanvas/makefile.mk @@ -45,7 +45,7 @@ DLLPRE = .IF "$(verbose)"!="" || "$(VERBOSE)"!="" CDEFS+= -DVERBOSE .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/simplecanvasimpl.obj SHL1TARGET=$(TARGET).uno @@ -60,6 +60,7 @@ SHL1VERSIONMAP=exports.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp +.ENDIF # ========================================================================== diff --git a/canvas/source/tools/makefile.mk b/canvas/source/tools/makefile.mk index bf99a00febfc..9dc9967fac82 100644 --- a/canvas/source/tools/makefile.mk +++ b/canvas/source/tools/makefile.mk @@ -51,7 +51,7 @@ CDEFS+= -DPROFILER #CFLAGS +:= /Ox /Ot # THIS IS IMPORTANT - +.IF "$(L10N_framework)"=="" SLOFILES = \ $(SLO)$/cachedprimitivebase.obj \ $(SLO)$/canvascustomspritehelper.obj \ @@ -95,7 +95,7 @@ DEFLIB1NAME =$(TARGET) .IF "$(GUI)" == "WNT" SHL1STDLIBS += $(WINMMLIB) $(KERNEL32LIB) .ENDIF - +.ENDIF # ========================================================================== diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index b049e1e4f317..d5b276901594 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -127,8 +127,19 @@ namespace vclcanvas { tools::LocalGuard aGuard; - // TODO(F1) - return rendering::FontMetrics(); + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont(getVCLFont()); + const ::FontMetric& aMetric( aVDev.GetFontMetric() ); + + return rendering::FontMetrics( + aMetric.GetAscent(), + aMetric.GetDescent(), + aMetric.GetIntLeading(), + aMetric.GetExtLeading(), + 0, + aMetric.GetDescent() / 2.0, + aMetric.GetAscent() / 2.0); } uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw (uno::RuntimeException) diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx index f9fa6f6dc4d2..5787f32cf4bf 100644 --- a/canvas/source/vcl/textlayout.cxx +++ b/canvas/source/vcl/textlayout.cxx @@ -35,6 +35,7 @@ #include <tools/diagnose_ex.h> #include <canvas/canvastools.hxx> +#include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/TextDirection.hpp> #include <vcl/metric.hxx> @@ -42,6 +43,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/tools/canvastools.hxx> #include "impltools.hxx" #include "textlayout.hxx" @@ -116,16 +118,104 @@ namespace vclcanvas { tools::LocalGuard aGuard; - // TODO(F1) - return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >(); + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont( mpFont->getVCLFont() ); + + setupLayoutMode( aVDev, mnTextDirection ); + + const rendering::ViewState aViewState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + NULL); + + rendering::RenderState aRenderState ( + geometry::AffineMatrix2D(1,0,0,0,1,0), + NULL, + uno::Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]); + setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState); + + uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence; + ::basegfx::B2DPolyPolygonVector aOutlines; + if (aVDev.GetTextOutlines( + aOutlines, + maText.Text, + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.Length), + FALSE, + 0, + aOffsets.get())) + { + aOutlineSequence.realloc(aOutlines.size()); + sal_Int32 nIndex (0); + for (::basegfx::B2DPolyPolygonVector::const_iterator + iOutline(aOutlines.begin()), + iEnd(aOutlines.end()); + iOutline!=iEnd; + ++iOutline) + { + aOutlineSequence[nIndex++] = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + mxDevice, + *iOutline); + } + } + + return aOutlineSequence; } uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException) { tools::LocalGuard aGuard; - // TODO(F1) - return uno::Sequence< geometry::RealRectangle2D >(); + + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont( mpFont->getVCLFont() ); + + setupLayoutMode( aVDev, mnTextDirection ); + + const rendering::ViewState aViewState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + NULL); + + rendering::RenderState aRenderState ( + geometry::AffineMatrix2D(1,0,0,0,1,0), + NULL, + uno::Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]); + setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState); + + MetricVector aMetricVector; + uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes; + if (aVDev.GetGlyphBoundRects( + Point(0,0), + maText.Text, + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.Length), + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + aMetricVector)) + { + aBoundingBoxes.realloc(aMetricVector.size()); + sal_Int32 nIndex (0); + for (MetricVector::const_iterator + iMetric(aMetricVector.begin()), + iEnd(aMetricVector.end()); + iMetric!=iEnd; + ++iMetric) + { + aBoundingBoxes[nIndex++] = geometry::RealRectangle2D( + iMetric->getX(), + iMetric->getY(), + iMetric->getX() + iMetric->getWidth(), + iMetric->getY() + iMetric->getHeight()); + } + } + return aBoundingBoxes; } uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException) @@ -171,7 +261,7 @@ namespace vclcanvas setupLayoutMode( aVDev, mnTextDirection ); - const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() ); + const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); if( maLogicalAdvancements.getLength() ) diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx new file mode 100644 index 000000000000..90927a3e9c6c --- /dev/null +++ b/comphelper/inc/comphelper/docpasswordhelper.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * 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: docpasswordhelper.hxx,v $ + * $Revision: 1.1 $ + * + * 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 COMPHELPER_DOCPASSWORDHELPR_HXX +#define COMPHELPER_DOCPASSWORDHELPR_HXX + +#include "comphelper/comphelperdllapi.h" +#include <vector> +#include "comphelper/docpasswordrequest.hxx" + +namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } } + +namespace comphelper { + +class MediaDescriptor; + +// ============================================================================ + +enum DocPasswordVerifierResult +{ + DocPasswordVerifierResult_OK, + DocPasswordVerifierResult_WRONG_PASSWORD, + DocPasswordVerifierResult_ABORT +}; + +// ============================================================================ + +/** Base class for a password verifier used by the DocPasswordHelper class + below. + + Users have to implement the virtual function and pass an instance of the + verifier to one of the password request functions. + */ +class COMPHELPER_DLLPUBLIC IDocPasswordVerifier +{ +public: + virtual ~IDocPasswordVerifier(); + + /** Will be called everytime a password needs to be verified. + + @return The result of the verification. + - DocPasswordVerifierResult_OK, if and only if the passed password + is valid and can be used to process the related document. + - DocPasswordVerifierResult_WRONG_PASSWORD, if the password is + wrong. The user may be asked again for a new password. + - DocPasswordVerifierResult_ABORT, if an unrecoverable error + occured while password verification. The password request loop + will be aborted. + */ + virtual DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword ) = 0; + +}; + +// ============================================================================ + +/** Helper that asks for a document password and checks its validity. + */ +class COMPHELPER_DLLPUBLIC DocPasswordHelper +{ +public: + // ------------------------------------------------------------------------ + + /** This helper function tries to request and verify a password to load a + protected document. + + First, the list of default passwords will be tried if provided. This is + needed by import filters for external file formats that have to check a + predefined password in some cases without asking the user for a + password. Every password is checked using the passed password verifier. + + If not successful, the passed password of a medium is tried, that has + been set e.g. by an API call to load a document. If existing, the + password is checked using the passed password verifier. + + If still not successful, the passed interaction handler is used to + request a password from the user. This will be repeated until the + passed password verifier validates the entered password, or if the user + chooses to cancel password input. + + @param rVerifier + The password verifier used to check every processed password. + + @param rMediaPassword + If not empty, will be passed to the password validator before + requesting a password from the user. This password usually should + be querried from a media descriptor. + + @param rxInteractHandler + The interaction handler that will be used to request a password + from the user, e.g. by showing a password input dialog. + + @param rDocumentName + The name of the related document that will be shown in the password + input dialog. + + @param eRequestType + The password request type that will be passed to the + DocPasswordRequest object created internally. See + docpasswordrequest.hxx for more details. + + @param pDefaultPasswords + If not null, contains default passwords that will be tried before a + password will be requested from the media descriptor or the user. + + @param pbIsDefaultPassword + (output parameter) If not null, the type of the found password will + be returned. True means the password has been found in the passed + list of default passwords. False means the password has been taken + from the rMediaPassword parameter or has been entered by the user. + + @return + If not empty, contains the password that has been validated by the + passed password verifier. If empty, no valid password has been + found, or the user has chossen to cancel password input. + */ + static ::rtl::OUString requestAndVerifyDocPassword( + IDocPasswordVerifier& rVerifier, + const ::rtl::OUString& rMediaPassword, + const ::com::sun::star::uno::Reference< + ::com::sun::star::task::XInteractionHandler >& rxInteractHandler, + const ::rtl::OUString& rDocumentName, + DocPasswordRequestType eRequestType, + const ::std::vector< ::rtl::OUString >* pDefaultPasswords = 0, + bool* pbIsDefaultPassword = 0 ); + + // ------------------------------------------------------------------------ + + /** This helper function tries to find a password for the document + described by the passed media descriptor. + + First, the list of default passwords will be tried if provided. This is + needed by import filters for external file formats that have to check a + predefined password in some cases without asking the user for a + password. Every password is checked using the passed password verifier. + + If not successful, the passed media descriptor is asked for a password, + that has been set e.g. by an API call to load a document. If existing, + the password is checked using the passed password verifier. + + If still not successful, the interaction handler contained in the + passed nmedia descriptor is used to request a password from the user. + This will be repeated until the passed password verifier validates the + entered password, or if the user chooses to cancel password input. + + @param rVerifier + The password verifier used to check every processed password. + + @param rMediaDesc + The media descriptor of the document that needs to be opened with + a password. If a valid password (that is not contained in the + passed list of default passwords) was found, it will be inserted + into the "Password" property of this descriptor. + + @param eRequestType + The password request type that will be passed to the + DocPasswordRequest object created internally. See + docpasswordrequest.hxx for more details. + + @param pDefaultPasswords + If not null, contains default passwords that will be tried before a + password will be requested from the media descriptor or the user. + + @return + If not empty, contains the password that has been validated by the + passed password verifier. If empty, no valid password has been + found, or the user has chossen to cancel password input. + */ + static ::rtl::OUString requestAndVerifyDocPassword( + IDocPasswordVerifier& rVerifier, + MediaDescriptor& rMediaDesc, + DocPasswordRequestType eRequestType, + const ::std::vector< ::rtl::OUString >* pDefaultPasswords = 0 ); + + // ------------------------------------------------------------------------ + +private: + ~DocPasswordHelper(); +}; + +// ============================================================================ + +} // namespace comphelper + +#endif + diff --git a/comphelper/inc/comphelper/docpasswordrequest.hxx b/comphelper/inc/comphelper/docpasswordrequest.hxx new file mode 100644 index 000000000000..b1e042e876bd --- /dev/null +++ b/comphelper/inc/comphelper/docpasswordrequest.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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: docpasswordrequest.hxx,v $ + * $Revision: 1.1 $ + * + * 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 COMPHELPER_DOCPASSWORDREQUEST_HXX +#define COMPHELPER_DOCPASSWORDREQUEST_HXX + +#include "comphelper/comphelperdllapi.h" +#include <com/sun/star/task/PasswordRequestMode.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace comphelper { + +// ============================================================================ + +/** Selects which UNO document password request type to use. */ +enum DocPasswordRequestType +{ + DocPasswordRequestType_STANDARD, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request. + DocPasswordRequestType_MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request. +}; + +// ============================================================================ + +class AbortContinuation; +class PasswordContinuation; + +/** Implements the task.XInteractionRequest interface for requesting a password + string for a document. + */ +class COMPHELPER_DLLPUBLIC DocPasswordRequest : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +{ +public: + explicit DocPasswordRequest( + DocPasswordRequestType eType, + ::com::sun::star::task::PasswordRequestMode eMode, + const ::rtl::OUString& rDocumentName ); + virtual ~DocPasswordRequest(); + + bool isAbort() const; + bool isPassword() const; + ::rtl::OUString getPassword() const; + +private: + virtual ::com::sun::star::uno::Any SAL_CALL + getRequest() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL + getContinuations() throw( ::com::sun::star::uno::RuntimeException ); + +private: + ::com::sun::star::uno::Any maRequest; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations; + AbortContinuation* mpAbort; + PasswordContinuation* mpPassword; +}; + +// ============================================================================ + +} // namespace comphelper + +#endif + diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index 5cd36d2e687b..e388c0b4ca3c 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -74,8 +74,10 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap does not work as expected under windows (under unix it works as well) these way must be used :-( */ + static const ::rtl::OUString& PROP_ABORTED(); static const ::rtl::OUString& PROP_ASTEMPLATE(); static const ::rtl::OUString& PROP_CHARACTERSET(); + static const ::rtl::OUString& PROP_COMPONENTDATA(); static const ::rtl::OUString& PROP_DEEPDETECTION(); static const ::rtl::OUString& PROP_DETECTSERVICE(); static const ::rtl::OUString& PROP_DOCUMENTSERVICE(); diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx new file mode 100644 index 000000000000..1f362c02f881 --- /dev/null +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * 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: docpasswordhelper.cxx,v $ + * $Revision: 1.1 $ + * + * 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_comphelper.hxx" + +#include "comphelper/docpasswordhelper.hxx" +#include <com/sun/star/task/XInteractionHandler.hpp> +#include "comphelper/mediadescriptor.hxx" + +using ::rtl::OUString; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::task::PasswordRequestMode; +using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER; +using ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER; +using ::com::sun::star::task::XInteractionHandler; +using ::com::sun::star::task::XInteractionRequest; + +namespace comphelper { + +// ============================================================================ + +IDocPasswordVerifier::~IDocPasswordVerifier() +{ +} + +// ============================================================================ + +/*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword( + IDocPasswordVerifier& rVerifier, + const OUString& rMediaPassword, + const Reference< XInteractionHandler >& rxInteractHandler, + const OUString& rDocumentName, + DocPasswordRequestType eRequestType, + const ::std::vector< OUString >* pDefaultPasswords, + bool* pbIsDefaultPassword ) +{ + OUString aPassword; + DocPasswordVerifierResult eResult = DocPasswordVerifierResult_WRONG_PASSWORD; + + // first, try provided default passwords + if( pbIsDefaultPassword ) + *pbIsDefaultPassword = false; + if( pDefaultPasswords ) + { + for( ::std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && (aIt != aEnd); ++aIt ) + { + aPassword = *aIt; + OSL_ENSURE( aPassword.getLength() > 0, "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" ); + if( aPassword.getLength() > 0 ) + { + eResult = rVerifier.verifyPassword( aPassword ); + if( pbIsDefaultPassword ) + *pbIsDefaultPassword = eResult == DocPasswordVerifierResult_OK; + } + } + } + + // try media password (skip, if result is OK or ABORT) + if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + { + aPassword = rMediaPassword; + if( aPassword.getLength() > 0 ) + eResult = rVerifier.verifyPassword( aPassword ); + } + + // request a password (skip, if result is OK or ABORT) + if( (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && rxInteractHandler.is() ) try + { + PasswordRequestMode eRequestMode = PasswordRequestMode_PASSWORD_ENTER; + while( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + { + DocPasswordRequest* pRequest = new DocPasswordRequest( eRequestType, eRequestMode, rDocumentName ); + Reference< XInteractionRequest > xRequest( pRequest ); + rxInteractHandler->handle( xRequest ); + if( pRequest->isPassword() ) + { + aPassword = pRequest->getPassword(); + if( aPassword.getLength() > 0 ) + eResult = rVerifier.verifyPassword( aPassword ); + } + else + { + eResult = DocPasswordVerifierResult_ABORT; + } + eRequestMode = PasswordRequestMode_PASSWORD_REENTER; + } + } + catch( Exception& ) + { + } + + return (eResult == DocPasswordVerifierResult_OK) ? aPassword : OUString(); +} + +/*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword( + IDocPasswordVerifier& rVerifier, + MediaDescriptor& rMediaDesc, + DocPasswordRequestType eRequestType, + const ::std::vector< OUString >* pDefaultPasswords ) +{ + OUString aMediaPassword = rMediaDesc.getUnpackedValueOrDefault( + MediaDescriptor::PROP_PASSWORD(), OUString() ); + Reference< XInteractionHandler > xInteractHandler = rMediaDesc.getUnpackedValueOrDefault( + MediaDescriptor::PROP_INTERACTIONHANDLER(), Reference< XInteractionHandler >() ); + OUString aDocumentName = rMediaDesc.getUnpackedValueOrDefault( + MediaDescriptor::PROP_URL(), OUString() ); + + bool bIsDefaultPassword = false; + OUString aPassword = requestAndVerifyDocPassword( + rVerifier, aMediaPassword, xInteractHandler, aDocumentName, eRequestType, pDefaultPasswords, &bIsDefaultPassword ); + + // insert valid password into media descriptor (but not a default password) + if( (aPassword.getLength() > 0) && !bIsDefaultPassword ) + rMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= aPassword; + + return aPassword; +} + +// ============================================================================ + +} // namespace comphelper + diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx new file mode 100644 index 000000000000..187642e10fe9 --- /dev/null +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * 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: docpasswordrequest.cxx,v $ + * $Revision: 1.1 $ + * + * 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_comphelper.hxx" + +#include "comphelper/docpasswordrequest.hxx" +#include <com/sun/star/task/DocumentMSPasswordRequest.hpp> +#include <com/sun/star/task/DocumentPasswordRequest.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/task/XInteractionPassword.hpp> + +using ::rtl::OUString; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::task::InteractionClassification_QUERY; +using ::com::sun::star::task::DocumentMSPasswordRequest; +using ::com::sun::star::task::DocumentPasswordRequest; +using ::com::sun::star::task::PasswordRequestMode; +using ::com::sun::star::task::XInteractionAbort; +using ::com::sun::star::task::XInteractionContinuation; +using ::com::sun::star::task::XInteractionPassword; + +namespace comphelper { + +// ============================================================================ + +class AbortContinuation : public ::cppu::WeakImplHelper1< XInteractionAbort > +{ +public: + inline explicit AbortContinuation() : mbSelected( false ) {} + + inline bool isSelected() const { return mbSelected; } + inline void reset() { mbSelected = false; } + + virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; } + +private: + bool mbSelected; +}; + +// ============================================================================ + +class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword > +{ +public: + inline explicit PasswordContinuation() : mbSelected( false ) {} + + inline bool isSelected() const { return mbSelected; } + inline void reset() { mbSelected = false; } + + virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; } + virtual void SAL_CALL setPassword( const OUString& rPass ) throw( RuntimeException ) { maPassword = rPass; } + virtual OUString SAL_CALL getPassword() throw( RuntimeException ) { return maPassword; } + +private: + OUString maPassword; + bool mbSelected; +}; + +// ============================================================================ + +DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType, + PasswordRequestMode eMode, const OUString& rDocumentName ) +{ + switch( eType ) + { + case DocPasswordRequestType_STANDARD: + { + DocumentPasswordRequest aRequest( OUString(), Reference< XInterface >(), + InteractionClassification_QUERY, eMode, rDocumentName ); + maRequest <<= aRequest; + } + break; + case DocPasswordRequestType_MS: + { + DocumentMSPasswordRequest aRequest( OUString(), Reference< XInterface >(), + InteractionClassification_QUERY, eMode, rDocumentName ); + maRequest <<= aRequest; + } + break; + /* no 'default', so compilers will complain about missing + implementation of a new enum value. */ + } + + maContinuations.realloc( 2 ); + maContinuations[ 0 ].set( mpAbort = new AbortContinuation ); + maContinuations[ 1 ].set( mpPassword = new PasswordContinuation ); +} + +DocPasswordRequest::~DocPasswordRequest() +{ +} + +bool DocPasswordRequest::isAbort() const +{ + return mpAbort->isSelected(); +} + +bool DocPasswordRequest::isPassword() const +{ + return mpPassword->isSelected(); +} + +OUString DocPasswordRequest::getPassword() const +{ + return mpPassword->getPassword(); +} + +Any SAL_CALL DocPasswordRequest::getRequest() throw( RuntimeException ) +{ + return maRequest; +} + +Sequence< Reference< XInteractionContinuation > > SAL_CALL DocPasswordRequest::getContinuations() throw( RuntimeException ) +{ + return maContinuations; +} + +// ============================================================================ + +} // namespace comphelper + diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index f50f57c47eb3..d0ffc368fd20 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -57,6 +57,8 @@ SLOFILES= \ $(SLO)$/componentcontext.obj \ $(SLO)$/componentmodule.obj \ $(SLO)$/configurationhelper.obj \ + $(SLO)$/docpasswordhelper.obj \ + $(SLO)$/docpasswordrequest.obj \ $(SLO)$/documentinfo.obj \ $(SLO)$/documentiologring.obj \ $(SLO)$/evtlistenerhlp.obj \ diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 9f463cdf0380..44578f840da9 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -114,6 +114,12 @@ namespace css = ::com::sun::star; /*----------------------------------------------- 10.03.2004 07:35 -----------------------------------------------*/ +const ::rtl::OUString& MediaDescriptor::PROP_ABORTED() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Aborted")); + return sProp; +} + const ::rtl::OUString& MediaDescriptor::PROP_ASTEMPLATE() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); @@ -126,6 +132,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_CHARACTERSET() return sProp; } +const ::rtl::OUString& MediaDescriptor::PROP_COMPONENTDATA() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ComponentData")); + return sProp; +} + const ::rtl::OUString& MediaDescriptor::PROP_DEEPDETECTION() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DeepDetection")); diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index a55d5b58854d..ae351340bc7a 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -218,11 +218,15 @@ namespace comphelper // public UiEventsLogger interface sal_Bool UiEventsLogger::isEnabled() { - try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); - return UiEventsLogger_Impl::getInstance()->m_Active; - } catch(...) { return false; } // never throws + if ( UiEventsLogger_Impl::getEnabledFromCfg() ) + { + try { + UiEventsLogger_Impl::prepareMutex(); + Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + return UiEventsLogger_Impl::getInstance()->m_Active; + } catch(...) { return false; } // never throws + } // if ( ) + return sal_False; } sal_Int32 UiEventsLogger::getSessionLogEventCount() diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index 08dd26dcf0ec..19911709860d 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -180,8 +180,7 @@ void GenericPropertySet::_setPropertyValues( const PropertyMapEntry** ppEntries, aEvt.PropertyName = aPropertyName; aEvt.NewValue = *pValues; aGuard.clear(); - pHelper->forEach<XPropertyChangeListener>( - ::boost::bind(&XPropertyChangeListener::propertyChange,_1,boost::cref(aEvt))); + pHelper->notifyEach( &XPropertyChangeListener::propertyChange, aEvt ); aGuard.reset(); } diff --git a/dtrans/prj/build.lst b/dtrans/prj/build.lst index 95d697d6ebd3..bd9c73582361 100644 --- a/dtrans/prj/build.lst +++ b/dtrans/prj/build.lst @@ -10,8 +10,6 @@ dr dtrans\source\win32\dnd nmake - w dr_win32_dnd dr_cnttype dr_win32_misc.w dr dtrans\source\win32\dtobj nmake - w dr_win32_dtobj dr_win32_clipb.w dr_win32_misc.w dr_win32_ftransl.w dr_inc NULL dr dtrans\source\os2\clipb nmake - p dr_os2_clipb dr_inc NULL dr dtrans\util nmake - all dr_util dr_cnttype dr_win32_misc.w dr_win32_mtaole.w dr_win32_ftransl.w dr_win32_clipb.w dr_win32_dnd.w dr_win32_dtobj.w dr_inc NULL -dr dtrans\source\X11 nmake - u dr_X11 dr_inc NULL -dr dtrans\source\aqua nmake - u dr_aqua dr_inc NULL dr dtrans\source\generic nmake - all dr_generic dr_inc NULL diff --git a/dtrans/prj/d.lst b/dtrans/prj/d.lst index bfa7e3b86d6d..a1a7c2e95480 100644 --- a/dtrans/prj/d.lst +++ b/dtrans/prj/d.lst @@ -5,6 +5,5 @@ ..\source\win32\clipb\sysdtrans.xml %_DEST%\xml%_EXT%\sysdtrans.xml ..\source\win32\dnd\dnd.xml %_DEST%\xml%_EXT%\dnd.xml ..\source\win32\ftransl\ftransl.xml %_DEST%\xml%_EXT%\ftransl.xml -..\source\X11\dtransX11.xml %_DEST%\xml%_EXT%\dtransX11.xml ..\source\cnttype\mcnttype.xml %_DEST%\xml%_EXT%\mcnttype.xml ..\source\generic\dtrans.xml %_DEST%\xml%_EXT%\dtrans.xml diff --git a/dtrans/source/X11/X11_service.cxx b/dtrans/source/X11/X11_service.cxx deleted file mode 100644 index b288d74a0513..000000000000 --- a/dtrans/source/X11/X11_service.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/************************************************************************* - * - * 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: X11_service.cxx,v $ - * $Revision: 1.11 $ - * - * 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_dtrans.hxx" - -#include <X11_clipboard.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <uno/dispatcher.h> // declaration of generic uno interface -#include <uno/mapping.hxx> // mapping stuff -#include <cppuhelper/factory.hxx> -#include <cppuhelper/compbase1.hxx> - -using namespace rtl; -using namespace cppu; -using namespace com::sun::star::lang; -using namespace com::sun::star::datatransfer::clipboard; -using namespace com::sun::star::awt; -using namespace x11; - -namespace x11 { - -class X11ClipboardFactory : public ::cppu::WeakComponentImplHelper1 < - ::com::sun::star::lang::XSingleServiceFactory -> -{ - ::osl::Mutex m_aMutex; - ::std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; -public: - X11ClipboardFactory(); - virtual ~X11ClipboardFactory(); - - /* - * XSingleServiceFactory - */ - virtual Reference< XInterface > createInstance() throw(); - virtual Reference< XInterface > createInstanceWithArguments( const Sequence< Any >& rArgs ) throw(); -}; - -// ------------------------------------------------------------------------ - -X11ClipboardFactory::X11ClipboardFactory() : - ::cppu::WeakComponentImplHelper1< - ::com::sun::star::lang::XSingleServiceFactory ->( m_aMutex ) -{ -} - -// ------------------------------------------------------------------------ - -X11ClipboardFactory::~X11ClipboardFactory() -{ -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > X11ClipboardFactory::createInstance() throw() -{ - return createInstanceWithArguments( Sequence< Any >() ); -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > X11ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw() -{ - OUString aDisplayName; - Atom nSelection; - - // extract display name from connection argument. An exception is thrown - // by SelectionManager.initialize() if no display connection is given. - if( arguments.getLength() > 0 ) - { - Reference< XDisplayConnection > xConn; - arguments.getConstArray()[0] >>= xConn; - - if( xConn.is() ) - { - Any aIdentifier = xConn->getIdentifier(); - aIdentifier >>= aDisplayName; - } - } - - SelectionManager& rManager = SelectionManager::get( aDisplayName ); - rManager.initialize( arguments ); - - // check if any other selection than clipboard selection is specified - if( arguments.getLength() > 1 ) - { - OUString aSelectionName; - - arguments.getConstArray()[1] >>= aSelectionName; - nSelection = rManager.getAtom( aSelectionName ); - } - else - { - // default atom is clipboard selection - nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); - } - - ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); - ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); - if( it != rMap.end() ) - return it->second; - - X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection ); - rMap[ nSelection ] = pClipboard; - - return static_cast<OWeakObject*>(pClipboard); -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL X11Clipboard_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL Xdnd_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > SAL_CALL Xdnd_createInstance( - const Reference< XMultiServiceFactory > & ) -{ - return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL Xdnd_dropTarget_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > SAL_CALL Xdnd_dropTarget_createInstance( - const Reference< XMultiServiceFactory > & ) -{ - return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); -} - -} - -static const OUString& getClipboardImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(X11_CLIPBOARD_IMPLEMENTATION_NAME); - return aImpl; -} - -static const OUString& getClipboardServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard" ); - return aImpl; -} - -static const OUString& getXdndImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(XDND_IMPLEMENTATION_NAME ); - return aImpl; -} - -static const OUString& getXdndServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource" ); - return aImpl; -} - -static const OUString& getXdndDropTargetImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(XDND_DROPTARGET_IMPLEMENTATION_NAME); - return aImpl; -} - -static const OUString& getXdndDropTargetServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget" ); - return aImpl; -} - -extern "C" { - void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, - uno_Environment** ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - sal_Bool SAL_CALL component_writeInfo( void*, void* pXUnoKey ) - { - if( pXUnoKey ) - { - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) ); - - OUString aImplName = OUString::createFromAscii( "/" ); - aImplName += getClipboardImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getClipboardServiceName(); - xKey->createKey( aImplName ); - - aImplName = OUString::createFromAscii( "/" ); - aImplName += getXdndImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getXdndServiceName(); - xKey->createKey( aImplName ); - - aImplName = OUString::createFromAscii( "/" ); - aImplName += getXdndDropTargetImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getXdndDropTargetServiceName(); - xKey->createKey( aImplName ); - - return sal_True; - } - catch( ::com::sun::star::registry::InvalidRegistryException& ) - { - } - } - return sal_False; - } - - void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pXUnoSMgr, - void* - ) - { - void* pRet = 0; - - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) ); - - if( pXUnoSMgr ) - { - Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( - reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr ) - ); - Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory; - if( aImplName.equals( getClipboardImplementationName() ) ) - xFactory = new X11ClipboardFactory(); - else if( aImplName.equals( getXdndImplementationName() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, Xdnd_createInstance, - Xdnd_getSupportedServiceNames() ); - } - else if( aImplName.equals( getXdndDropTargetImplementationName() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, Xdnd_dropTarget_createInstance, - Xdnd_dropTarget_getSupportedServiceNames() ); - } - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - return pRet; - } - -} /* extern "C" */ diff --git a/dtrans/source/X11/dtransX11.xml b/dtrans/source/X11/dtransX11.xml deleted file mode 100644 index 77994d5287b5..000000000000 --- a/dtrans/source/X11/dtransX11.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> dtransX11 </module-name> - <component-description> - <author> Tino Rachui </author> - <name> com.sun.star.comp.datatransfer.X11 </name> - <description> - The X11 implementation of the datatransfer service. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="beta"/> - <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service> - <supported-service> com.sun.star.datatransfer.dnd.X11DragSource </supported-service> - <supported-service> com.sun.star.datatransfer.dnd.X11DropTarget </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type> - <type> com.sun.star.datatransfer.XTransferable </type> - <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardOwner </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardListener </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDropContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDragContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTarget </type> - <type> com.sun.star.datatransfer.dnd.DNDConstants </type> - <type> com.sun.star.datatransfer.dnd.XDragSource </type> - <type> com.sun.star.datatransfer.dnd.XDragSourceContext </type> - <type> com.sun.star.awt.XDisplayConnection </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.container.XSet </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu2 </runtime-module-dependency> - <runtime-module-dependency> sal2 </runtime-module-dependency> -</module-description> diff --git a/dtrans/source/X11/exports.map b/dtrans/source/X11/exports.map deleted file mode 100644 index 7c56baa9bd73..000000000000 --- a/dtrans/source/X11/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/dtrans/source/aqua/dtransaqua.xml b/dtrans/source/aqua/dtransaqua.xml deleted file mode 100644 index 2a901134bf19..000000000000 --- a/dtrans/source/aqua/dtransaqua.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> dtransaqua </module-name> - <component-description> - <author> Tino Rachui </author> - <name> com.sun.star.comp.datatransfer.aqua </name> - <description> - The aqua implementation of the datatransfer service. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="beta"/> - <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type> - <type> com.sun.star.datatransfer.XTransferable </type> - <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardOwner </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardListener </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDropContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDragContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTarget </type> - <type> com.sun.star.datatransfer.dnd.DNDConstants </type> - <type> com.sun.star.datatransfer.dnd.XDragSource </type> - <type> com.sun.star.datatransfer.dnd.XDragSourceContext </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.container.XSet </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu2 </runtime-module-dependency> - <runtime-module-dependency> sal2 </runtime-module-dependency> -</module-description> diff --git a/dtrans/source/aqua/service_entry.cxx b/dtrans/source/aqua/service_entry.cxx deleted file mode 100644 index 66f133e74dbe..000000000000 --- a/dtrans/source/aqua/service_entry.cxx +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * 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: service_entry.cxx,v $ - * $Revision: 1.3 $ - * - * 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_dtrans.hxx" - -#include "DragSource.hxx" -#include "DropTarget.hxx" -#include "aqua_clipboard.hxx" -#include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <cppuhelper/factory.hxx> -#include <cppuhelper/compbase1.hxx> -#include <osl/diagnose.h> - -#include "cppuhelper/implementationentry.hxx" - -using namespace ::osl; -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::datatransfer::clipboard; - - -rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; - - -extern rtl::OUString dragSource_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> dragSource_getSupportedServiceNames(); -extern rtl::OUString dropTarget_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> dropTarget_getSupportedServiceNames(); -extern rtl::OUString clipboard_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> clipboard_getSupportedServiceNames(); - - -Reference<XInterface> SAL_CALL createDragSource(const Reference<XComponentContext>& rComponentContext); -Reference<XInterface> SAL_CALL createDropTarget(const Reference<XComponentContext>& rComponentContext); -Reference<XInterface> SAL_CALL createClipboard(const Reference<XComponentContext>& rComponentContext); - - -cppu::ImplementationEntry entries[] = { - { createDragSource, - dragSource_getImplementationName, - dragSource_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { createDropTarget, - dropTarget_getImplementationName, - dropTarget_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { createClipboard, - clipboard_getImplementationName, - clipboard_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - - -class AquaClipboardFactory : public WeakComponentImplHelper1<XSingleComponentFactory> -{ -public: - AquaClipboardFactory(); - virtual ~AquaClipboardFactory(); - - /* - * XSingleComponentFactory - */ - virtual Reference<XInterface> createInstanceWithContext(const Reference<XComponentContext>& Context) - throw (Exception); - - virtual Reference<XInterface> createInstanceWithArgumentsAndContext(const Sequence<Any>& rArgs, - const Reference<XComponentContext>& Context) - throw(Exception); - - private: - static Mutex m_aMutex; - static Reference<XInterface> mSingleInstance; -}; - -Reference<XInterface> AquaClipboardFactory::mSingleInstance; -Mutex AquaClipboardFactory::m_aMutex; - -// ------------------------------------------------------------------------ - -AquaClipboardFactory::AquaClipboardFactory() : - WeakComponentImplHelper1<XSingleComponentFactory>(m_aMutex) -{ -} - -// ------------------------------------------------------------------------ - -AquaClipboardFactory::~AquaClipboardFactory() -{ -} - -// ------------------------------------------------------------------------ - -Reference<XInterface> AquaClipboardFactory::createInstanceWithContext(const Reference<XComponentContext>& Context) throw(Exception) -{ - return createInstanceWithArgumentsAndContext(Sequence<Any>(), Context); -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > AquaClipboardFactory::createInstanceWithArgumentsAndContext(const Sequence<Any>& arguments, - const Reference<XComponentContext>& Context) throw(Exception) -{ - MutexGuard aGuard(m_aMutex); - - if (!mSingleInstance.is()) - { - AquaClipboardFactory::mSingleInstance = createClipboard(Context); - } - - return AquaClipboardFactory::mSingleInstance; -} - - -Reference<XInterface> SAL_CALL createDragSource( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XInitialization* >(new DragSource(rComponentContext)), UNO_QUERY); -} - -Reference<XInterface> SAL_CALL createDropTarget( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget(rComponentContext)), UNO_QUERY); -} - -Reference< XInterface > SAL_CALL createClipboard( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard(rComponentContext)), UNO_QUERY); -} - - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} - - -extern "C" void * SAL_CALL component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - void* pRet = NULL; - OUString iName = OUString::createFromAscii(implName); - Reference<XSingleComponentFactory> xFac; - - if (iName.equalsIgnoreAsciiCase(clipboard_getImplementationName())) - { - xFac = new AquaClipboardFactory(); - } - else - { - return component_getFactoryHelper(implName, - serviceManager, - registryKey, - entries); - } - - if (xFac.is()) - { - xFac->acquire(); - pRet = xFac.get(); - } - - return pRet; -} - - -extern "C" void SAL_CALL component_getImplementationEnvironment( - char const ** envTypeName, uno_Environment **) -{ - *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - - -extern "C" sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) -{ - return g_moduleCount.canUnload( &g_moduleCount , pTime ); -} - diff --git a/dtrans/source/generic/makefile.mk b/dtrans/source/generic/makefile.mk index 21076595d208..aa856865a3a8 100644 --- a/dtrans/source/generic/makefile.mk +++ b/dtrans/source/generic/makefile.mk @@ -40,7 +40,7 @@ COMP1TYPELIST=dtrans # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk - +.IF "$(L10N_framework)"=="" # ------------------------------------------------------------------ SLOFILES= \ @@ -66,5 +66,6 @@ DEF1NAME= $(SHL1TARGET) DEF1EXPORTFILE= exports.dxp # --- Targets ------------------------------------------------------ +.ENDIF # L10N_framework .INCLUDE : target.mk diff --git a/dtrans/util/makefile.mk b/dtrans/util/makefile.mk index 416ef7286aee..2e9666137619 100644 --- a/dtrans/util/makefile.mk +++ b/dtrans/util/makefile.mk @@ -41,7 +41,7 @@ TARGET4=dnd # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk - +.IF "$(L10N_framework)"=="" # --- mcnttype dynlib ---------------------------------------------- @@ -180,6 +180,7 @@ DEF3NAME= $(SHL3TARGET) DEF3EXPORTFILE= exports.dxp .ENDIF # "$(GUI)"=="OS2" +.ENDIF # L10N_framework .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/egif/makefile.mk b/goodies/source/filter.vcl/egif/makefile.mk index 55165533580c..418af69c7bf8 100644 --- a/goodies/source/filter.vcl/egif/makefile.mk +++ b/goodies/source/filter.vcl/egif/makefile.mk @@ -49,17 +49,18 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES = dlgegif.src \ egifstr.src - +.IF "$(L10N_framework)"=="" SLOFILES= $(SLO)$/egif.obj \ $(SLO)$/dlgegif.obj \ $(SLO)$/giflzwc.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" SHL1TARGET= egi$(DLLPOSTFIX) SHL1IMPLIB= egif SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) @@ -75,7 +76,7 @@ SHL1OBJS= $(SLO)$/egif.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/eos2met/makefile.mk b/goodies/source/filter.vcl/eos2met/makefile.mk index 1d6725e5e902..05f2f032e342 100644 --- a/goodies/source/filter.vcl/eos2met/makefile.mk +++ b/goodies/source/filter.vcl/eos2met/makefile.mk @@ -49,15 +49,15 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES= dlgeos2.src \ eos2mstr.src - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/eos2met.obj \ $(SLO)$/dlgeos2.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= eme$(DLLPOSTFIX) SHL1IMPLIB= eos2met SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) @@ -72,7 +72,7 @@ SHL1OBJS= $(SLO)$/eos2met.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/epbm/makefile.mk b/goodies/source/filter.vcl/epbm/makefile.mk index e70256c893e1..f4411d04e0fd 100644 --- a/goodies/source/filter.vcl/epbm/makefile.mk +++ b/goodies/source/filter.vcl/epbm/makefile.mk @@ -49,15 +49,15 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES= dlgepbm.src \ epbmstr.src - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/epbm.obj \ $(SLO)$/dlgepbm.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= epb$(DLLPOSTFIX) SHL1IMPLIB= epbm SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) @@ -73,7 +73,7 @@ SHL1OBJS= $(SLO)$/epbm.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/epgm/makefile.mk b/goodies/source/filter.vcl/epgm/makefile.mk index b4ff18588263..579ee6858a78 100644 --- a/goodies/source/filter.vcl/epgm/makefile.mk +++ b/goodies/source/filter.vcl/epgm/makefile.mk @@ -50,15 +50,15 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES= dlgepgm.src \ epgmstr.src - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/epgm.obj \ $(SLO)$/dlgepgm.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= epg$(DLLPOSTFIX) SHL1IMPLIB= epgm SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) @@ -74,7 +74,7 @@ SHL1OBJS= $(SLO)$/epgm.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk index 43a489dea78c..9f25a562488a 100644 --- a/goodies/source/filter.vcl/epict/makefile.mk +++ b/goodies/source/filter.vcl/epict/makefile.mk @@ -50,15 +50,15 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES = dlgepct.src \ epictstr.src - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/epict.obj \ $(SLO)$/dlgepct.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= ept$(DLLPOSTFIX) SHL1IMPLIB= epict SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB) @@ -74,7 +74,7 @@ SHL1OBJS= $(SLO)$/epict.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/eppm/makefile.mk b/goodies/source/filter.vcl/eppm/makefile.mk index 8ac83d7f1c8d..b40f9d897b8a 100644 --- a/goodies/source/filter.vcl/eppm/makefile.mk +++ b/goodies/source/filter.vcl/eppm/makefile.mk @@ -49,15 +49,15 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES= dlgeppm.src \ eppmstr.src - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/eppm.obj \ $(SLO)$/dlgeppm.obj - +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET2) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= epp$(DLLPOSTFIX) SHL1IMPLIB= eppm SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) @@ -73,6 +73,7 @@ SHL1OBJS= $(SLO)$/eppm.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/eps/makefile.mk b/goodies/source/filter.vcl/eps/makefile.mk index 59b63477531d..c5599344725a 100644 --- a/goodies/source/filter.vcl/eps/makefile.mk +++ b/goodies/source/filter.vcl/eps/makefile.mk @@ -50,16 +50,17 @@ CDEFS+= -DEDITDEBUG SRS1NAME=$(TARGET) SRC1FILES = dlgeps.src \ epsstr.src - +.IF "$(L10N_framework)"=="" EXCEPTIONSFILES=$(SLO)$/eps.obj SLOFILES = $(SLO)$/eps.obj \ $(SLO)$/dlgeps.obj +.ENDIF # ========================================================================== RESLIB1NAME=$(TARGET) RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - +.IF "$(L10N_framework)"=="" SHL1TARGET= eps$(DLLPOSTFIX) SHL1IMPLIB= eps SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) @@ -75,6 +76,7 @@ SHL1OBJS= $(SLO)$/eps.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/eras/makefile.mk b/goodies/source/filter.vcl/eras/makefile.mk index ae68c4a4ded6..e6aeaeefb223 100644 --- a/goodies/source/filter.vcl/eras/makefile.mk +++ b/goodies/source/filter.vcl/eras/makefile.mk @@ -40,7 +40,7 @@ DEPTARGET=veras .INCLUDE : settings.mk # --- Allgemein ---------------------------------------------------------- - +.IF "$(L10N_framework)"=="" .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF @@ -63,6 +63,7 @@ SHL1OBJS= $(SLO)$/eras.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/etiff/makefile.mk b/goodies/source/filter.vcl/etiff/makefile.mk index 69b958fc3598..70902012ce23 100644 --- a/goodies/source/filter.vcl/etiff/makefile.mk +++ b/goodies/source/filter.vcl/etiff/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vetiff .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/etiff.obj # ========================================================================== @@ -63,7 +63,7 @@ SHL1OBJS= $(SLO)$/etiff.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/expm/makefile.mk b/goodies/source/filter.vcl/expm/makefile.mk index a4093415be76..e123220feff8 100644 --- a/goodies/source/filter.vcl/expm/makefile.mk +++ b/goodies/source/filter.vcl/expm/makefile.mk @@ -45,7 +45,7 @@ DEPTARGET=vexpm .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/expm.obj # ========================================================================== @@ -64,7 +64,7 @@ SHL1OBJS= $(SLO)$/expm.obj SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/icgm/makefile.mk b/goodies/source/filter.vcl/icgm/makefile.mk index 0d97b3a144ef..ee62bbfb051c 100644 --- a/goodies/source/filter.vcl/icgm/makefile.mk +++ b/goodies/source/filter.vcl/icgm/makefile.mk @@ -39,7 +39,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk # --- Files -------------------------------------------------------- - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/cgm.obj \ $(SLO)$/chart.obj \ $(SLO)$/class0.obj \ @@ -76,6 +76,7 @@ SHL1STDLIBS = \ $(TOOLSLIB) \ $(CPPULIB) \ $(SALLIB) +.ENDIF # --- Targets -------------------------------------------------------------- diff --git a/goodies/source/filter.vcl/idxf/makefile.mk b/goodies/source/filter.vcl/idxf/makefile.mk index dbbcc83cec45..081022cd4e5b 100644 --- a/goodies/source/filter.vcl/idxf/makefile.mk +++ b/goodies/source/filter.vcl/idxf/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vidxf .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" EXCEPTIONSFILES=\ $(SLO)$/dxfentrd.obj \ $(SLO)$/dxf2mtf.obj @@ -76,6 +76,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/ieps/makefile.mk b/goodies/source/filter.vcl/ieps/makefile.mk index b1e38231a3ff..673cce72744c 100644 --- a/goodies/source/filter.vcl/ieps/makefile.mk +++ b/goodies/source/filter.vcl/ieps/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vieps .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ieps.obj # ========================================================================== @@ -64,7 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/ios2met/makefile.mk b/goodies/source/filter.vcl/ios2met/makefile.mk index 0cb3e762f06f..c987476316c6 100644 --- a/goodies/source/filter.vcl/ios2met/makefile.mk +++ b/goodies/source/filter.vcl/ios2met/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vios2met .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ios2met.obj # ========================================================================== @@ -65,7 +65,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) - +.ENDIF # ========================================================================== .INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/ipbm/makefile.mk b/goodies/source/filter.vcl/ipbm/makefile.mk index 1ef6fe0fd33b..84a9815a4974 100644 --- a/goodies/source/filter.vcl/ipbm/makefile.mk +++ b/goodies/source/filter.vcl/ipbm/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vipbm .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ipbm.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/ipcd/makefile.mk b/goodies/source/filter.vcl/ipcd/makefile.mk index c125d88e4bf9..7782b7b8e627 100644 --- a/goodies/source/filter.vcl/ipcd/makefile.mk +++ b/goodies/source/filter.vcl/ipcd/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vipcd .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ipcd.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/ipcx/makefile.mk b/goodies/source/filter.vcl/ipcx/makefile.mk index 796f16daaff8..7f0f309ae786 100644 --- a/goodies/source/filter.vcl/ipcx/makefile.mk +++ b/goodies/source/filter.vcl/ipcx/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vipcx .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ipcx.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/ipict/makefile.mk b/goodies/source/filter.vcl/ipict/makefile.mk index 56c158316ad7..2d84bffe3c36 100644 --- a/goodies/source/filter.vcl/ipict/makefile.mk +++ b/goodies/source/filter.vcl/ipict/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vipict .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ipict.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/ipsd/makefile.mk b/goodies/source/filter.vcl/ipsd/makefile.mk index 933827b88ef4..cd29c94f8074 100644 --- a/goodies/source/filter.vcl/ipsd/makefile.mk +++ b/goodies/source/filter.vcl/ipsd/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vipsd .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/ipsd.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/iras/makefile.mk b/goodies/source/filter.vcl/iras/makefile.mk index 1a4190a6e180..28b84c8401ef 100644 --- a/goodies/source/filter.vcl/iras/makefile.mk +++ b/goodies/source/filter.vcl/iras/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=viras .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/iras.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/itga/makefile.mk b/goodies/source/filter.vcl/itga/makefile.mk index 980b155a5210..a9dfe2e77643 100644 --- a/goodies/source/filter.vcl/itga/makefile.mk +++ b/goodies/source/filter.vcl/itga/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vitga .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/itga.obj # ========================================================================== @@ -64,6 +64,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/filter.vcl/itiff/makefile.mk b/goodies/source/filter.vcl/itiff/makefile.mk index 9b610d421f37..78405a563659 100644 --- a/goodies/source/filter.vcl/itiff/makefile.mk +++ b/goodies/source/filter.vcl/itiff/makefile.mk @@ -44,7 +44,7 @@ DEPTARGET=vitiff .IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" CDEFS+= -DEDITDEBUG .ENDIF - +.IF "$(L10N_framework)"=="" SLOFILES = $(SLO)$/itiff.obj \ $(SLO)$/lzwdecom.obj \ $(SLO)$/ccidecom.obj @@ -68,6 +68,7 @@ SHL1VERSIONMAP=exports.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +.ENDIF # ========================================================================== diff --git a/goodies/source/inv/makefile.mk b/goodies/source/inv/makefile.mk index 359aab167008..500ba17f6091 100644 --- a/goodies/source/inv/makefile.mk +++ b/goodies/source/inv/makefile.mk @@ -42,6 +42,7 @@ EXTERNAL_WARNINGS_NOT_ERRORS := TRUE .INCLUDE : settings.mk # --- Files -------------------------------------------------------- +.IF "$(L10N_framework)"=="" .IF "$(TEST)" != "" CDEFS+=-DTEST @@ -62,6 +63,7 @@ SLOFILES= \ $(SLO)$/score.obj \ $(SLO)$/monst.obj .ENDIF +.ENDIF SRS1NAME=$(TARGET) SRC1FILES=gegner.src strings.src @@ -70,6 +72,9 @@ RESLIB1IMAGES= $(PRJ)$/res RESLIB1NAME=tfu RESLIB1SRSFILES=$(SRS)$/invader.srs + +.IF "$(L10N_framework)"=="" + .IF "$(TEST)"!="" APP1TARGET= $(TARGET) APP1OBJS= $(OBJFILES) @@ -85,7 +90,7 @@ APP1STDLIBS= $(CPPULIB) \ .ELSE SHL1TARGET= tfu$(DLLPOSTFIX) -SHL1IMPLIB= itfu +SHL1IMPLIB= i SHL1STDLIBS=\ $(VCLLIB) \ $(TOOLSLIB) \ @@ -103,10 +108,11 @@ SHL1DEF=$(MISC)$/$(SHL1TARGET).def .ENDIF # --- Targets ------------------------------------------------------- - +.ENDIF .INCLUDE : target.mk +.IF "$(L10N_framework)"=="" ALLTAR: \ $(BIN)$/applicat.rdb @@ -147,3 +153,7 @@ $(MISC)$/$(SHL1TARGET).def: makefile.mk .ENDIF +.ELSE +pseudo: + +.ENDIF diff --git a/goodies/util/makefile.mk b/goodies/util/makefile.mk index 13bb94069804..dc5d9566ea8a 100644 --- a/goodies/util/makefile.mk +++ b/goodies/util/makefile.mk @@ -42,6 +42,7 @@ GEN_HID=TRUE .INCLUDE : settings.mk # --- Allgemein --------------------------------------------------- +.IF "$(L10N_framework)"=="" LIB1TARGET=$(SLB)$/go.lib LIB1FILES=\ @@ -78,6 +79,7 @@ DEF1EXPORTFILE =goodies.dxp # THB: exports list goodies checked for 6.0 Final 6.12.2001 # Note: explicit exports only necessary for VCL graphic filters (see there) +.ENDIF # --- Targets ----------------------------------------------------------- @@ -86,6 +88,7 @@ DEF1EXPORTFILE =goodies.dxp .IF "$(depend)"=="" # --- Goodies-Filter-Datei --- +.IF "$(L10N_framework)"=="" $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo ------------------------------ @@ -98,3 +101,5 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo CT>>$@ .ENDIF + +.ENDIF diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index f3f8082eef55..2bfc9e707d69 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -53,6 +53,7 @@ class DefaultNumberingProvider : public cppu::WeakImplHelper4 void GetCharStrN( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; void GetCharStr( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; void GetRomanString( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; + void impl_loadTranslit(); public: DefaultNumberingProvider( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF ); diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 68ae24bc2c21..eaf7eb9c2ea8 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -501,5 +501,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_ARABIC_PALESTINE 0x9801 /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ #define LANGUAGE_USER_ARABIC_SOMALIA 0x9C01 /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ #define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ANCIENT_GREEK 0x0649 +#define LANGUAGE_USER_ASTURIAN 0x064A #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx index 7cc5e6bd8926..27688cd995dc 100644 --- a/i18npool/inc/i18npool/mslangid.hxx +++ b/i18npool/inc/i18npool/mslangid.hxx @@ -216,6 +216,9 @@ public: static LanguageType getRealLanguageWithoutConfig( LanguageType nLang ); + static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType ); + + /** Whether locale has a Right-To-Left orientation. */ static bool isRightToLeft( LanguageType nLang ); @@ -246,6 +249,9 @@ public: configuration! */ static void setConfiguredSystemLanguage( LanguageType nLang ); static void setConfiguredSystemUILanguage( LanguageType nLang ); + static void setConfiguredWesternFallback( LanguageType nLang ); + static void setConfiguredComplexFallback( LanguageType nLang ); + static void setConfiguredAsianFallback( LanguageType nLang ); // --------------------------------------------------------------------------- @@ -274,6 +280,10 @@ private: static LanguageType nConfiguredSystemLanguage; static LanguageType nConfiguredSystemUILanguage; + static LanguageType nConfiguredWesternFallback; + static LanguageType nConfiguredAsianFallback; + static LanguageType nConfiguredComplexFallback; + static LanguageType getPlatformSystemLanguage(); static LanguageType getPlatformSystemUILanguage(); diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index 04c5836aaaea..ac2005c9f397 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -87,9 +87,9 @@ public: private: WordBreakCache cache[CACHE_MAX]; - sal_Bool seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& boundary); + sal_Bool seekSegment(const rtl::OUString& rText, sal_Int32 pos, Boundary& boundary); WordBreakCache& getCache(const sal_Unicode *text, Boundary& boundary); - sal_Bool exists(const sal_Unicode u); + sal_Bool exists(const sal_uInt32 u); sal_Int32 getLongestMatch(const sal_Unicode *text, sal_Int32 len); }; diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 0eb4c20ca250..0a75e642f240 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -261,13 +261,29 @@ sal_Int16 SAL_CALL BreakIteratorImpl::getScriptType( const OUString& Text, sal_I getScriptClass(Text.iterateCodePoints(&nPos, 0)); } + +/** Increments/decrements position first, then obtains character. + @return current position, may be -1 or text length if string was consumed. + */ static sal_Int32 SAL_CALL iterateCodePoints(const OUString& Text, sal_Int32 &nStartPos, sal_Int32 inc, sal_uInt32& ch) { - if (nStartPos + inc < 0 || nStartPos + inc >= Text.getLength()) { + sal_Int32 nLen = Text.getLength(); + if (nStartPos + inc < 0 || nStartPos + inc >= nLen) { ch = 0; - nStartPos = nStartPos + inc < 0 ? -1 : Text.getLength(); + nStartPos = nStartPos + inc < 0 ? -1 : nLen; } else { ch = Text.iterateCodePoints(&nStartPos, inc); - if (inc > 0) ch = Text.iterateCodePoints(&nStartPos, 0); + // Fix for #i80436#. + // erAck: 2009-06-30T21:52+0200 This logic looks somewhat + // suspicious as if it cures a symptom.. anyway, had to add + // nStartPos < Text.getLength() to silence the (correct) assertion + // in rtl_uString_iterateCodePoints() if Text was one character + // (codepoint) only, made up of a surrogate pair. + //if (inc > 0 && nStartPos < Text.getLength()) + // ch = Text.iterateCodePoints(&nStartPos, 0); + // With surrogates, nStartPos may actually point behind string + // now, even if inc is only +1 + if (inc > 0) + ch = (nStartPos < nLen ? Text.iterateCodePoints(&nStartPos, 0) : 0); } return nStartPos; } diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index 3a44c02edc23..9d690469067a 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -112,13 +112,13 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( if (bOptions.allowPunctuationOutsideMargin && hangingCharacters.indexOf(Text[nStartPos]) != -1 && - ++nStartPos == Text.getLength()) { + (Text.iterateCodePoints( &nStartPos, 1), nStartPos == Text.getLength())) { ; // do nothing } else if (bOptions.applyForbiddenRules && 0 < nStartPos && nStartPos < Text.getLength()) { while (nStartPos > 0 && (bOptions.forbiddenBeginCharacters.indexOf(Text[nStartPos]) != -1 || bOptions.forbiddenEndCharacters.indexOf(Text[nStartPos-1]) != -1)) - nStartPos--; + Text.iterateCodePoints( &nStartPos, -1); } lbr.breakIndex = nStartPos; diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index f286dd2449ac..add22f39d58e 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -126,8 +126,9 @@ void xdictionary::setJapaneseWordBreak() japaneseWordBreak = sal_True; } -sal_Bool xdictionary::exists(const sal_Unicode c) { - sal_Bool exist = existMark ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False; +sal_Bool xdictionary::exists(const sal_uInt32 c) { + // 0x1FFF is the hardcoded limit in gendict for existMarks + sal_Bool exist = (existMark && ((c>>3) < 0x1FFF)) ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False; if (!exist && japaneseWordBreak) return BreakIteratorImpl::getScriptClass(c) == ScriptType::ASIAN; else @@ -197,20 +198,35 @@ sal_Bool WordBreakCache::equals(const sal_Unicode* str, Boundary& boundary) { * @param pos : Position of the given character. * @return true if CJK. */ -sal_Bool xdictionary::seekSegment(const sal_Unicode *text, sal_Int32 pos, - sal_Int32 len, Boundary& segBoundary) { - for (segBoundary.startPos = pos - 1; - segBoundary.startPos >= 0 && - (u_isWhitespace((sal_uInt32)text[segBoundary.startPos]) || exists(text[segBoundary.startPos])); - segBoundary.startPos--) ; - segBoundary.startPos++; - - for (segBoundary.endPos = pos; - segBoundary.endPos < len && - (u_isWhitespace((sal_uInt32)text[segBoundary.endPos]) || exists(text[segBoundary.endPos])); - segBoundary.endPos++) ; - - return segBoundary.endPos > segBoundary.startPos + 1; +sal_Bool xdictionary::seekSegment(const rtl::OUString &rText, sal_Int32 pos, + Boundary& segBoundary) +{ + sal_Int32 indexUtf16; + segBoundary.endPos = segBoundary.startPos = pos; + + indexUtf16 = pos; + while (indexUtf16 > 0) + { + sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, -1); + if (u_isWhitespace(ch) || exists(ch)) + segBoundary.startPos = indexUtf16; + else + break; + } + + indexUtf16 = pos; + while (indexUtf16 < rText.getLength()) + { + sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, 1); + if (u_isWhitespace(ch) || exists(ch)) + segBoundary.endPos = indexUtf16; + else + break; + } + + indexUtf16 = segBoundary.startPos; + rText.iterateCodePoints(&indexUtf16, 1); + return segBoundary.endPos > indexUtf16; } #define KANJA 1 @@ -340,19 +356,24 @@ Boundary xdictionary::getWordBoundary(const OUString& rText, sal_Int32 anyPos, s sal_Int32 len=rText.getLength(); if (anyPos >= len || anyPos < 0) { boundary.startPos = boundary.endPos = anyPos < 0 ? 0 : len; - } else if (seekSegment(text, anyPos, len, boundary)) { // character in dict + } else if (seekSegment(rText, anyPos, boundary)) { // character in dict WordBreakCache& aCache = getCache(text, boundary); sal_Int32 i = 0; - while (aCache.wordboundary[i] <= (sal_Int32)anyPos - boundary.startPos) i++; + while (aCache.wordboundary[i] <= anyPos - boundary.startPos) i++; sal_Int32 startPos = aCache.wordboundary[i - 1]; // if bDirection is false - if (!bDirection && startPos > 0 && startPos == (anyPos - boundary.startPos) && - u_isWhitespace((sal_uInt32) text[anyPos - 1])) - i--; - boundary.endPos = aCache.wordboundary[i] + boundary.startPos; - boundary.startPos += aCache.wordboundary[i - 1]; + if (!bDirection && startPos > 0 && startPos == (anyPos - boundary.startPos)) + { + sal_Int32 indexUtf16 = anyPos-1; + sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, 1); + if (u_isWhitespace(ch)) + i--; + } + boundary.endPos = boundary.startPos; + rText.iterateCodePoints(&boundary.endPos, aCache.wordboundary[i]); + rText.iterateCodePoints(&boundary.startPos, aCache.wordboundary[i-1]); } else { boundary.startPos = anyPos; if (anyPos < len) rText.iterateCodePoints(&anyPos, 1); @@ -360,8 +381,14 @@ Boundary xdictionary::getWordBoundary(const OUString& rText, sal_Int32 anyPos, s } if (wordType == WordType::WORD_COUNT) { // skip punctuation for word count. - while (boundary.endPos < len && u_ispunct((sal_uInt32)text[boundary.endPos])) - boundary.endPos++; + while (boundary.endPos < len) + { + sal_Int32 indexUtf16 = boundary.endPos; + if (u_ispunct(rText.iterateCodePoints(&indexUtf16, 1))) + boundary.endPos = indexUtf16; + else + break; + } } return boundary; diff --git a/i18npool/source/collator/makefile.mk b/i18npool/source/collator/makefile.mk index bca1c00aa419..b38386d53de0 100644 --- a/i18npool/source/collator/makefile.mk +++ b/i18npool/source/collator/makefile.mk @@ -42,7 +42,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -txtlist:=$(shell @cd data && ls *.txt) +txtlist:=$(shell @cd data >& $(NULLDEV) && ls *.txt) LOCAL_RULE_LANGS:=$(uniq $(foreach,i,$(txtlist) $(i:s/-/_/:s/_/ /:1))) rules_dependencies:=$(foreach,i,$(txtlist) data$/$i) $(INCCOM)$/lrl_include.hxx diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 8979a5ffc203..9126162d6f36 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -195,9 +195,9 @@ static sal_Unicode lowerLetter[] = { 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; -DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XMultiServiceFactory >& xMSF ) : xSMgr(xMSF) +DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XMultiServiceFactory >& xMSF ) : xSMgr(xMSF),translit(NULL) { - translit = new TransliterationImpl(xMSF); + } DefaultNumberingProvider::~DefaultNumberingProvider() @@ -205,6 +205,12 @@ DefaultNumberingProvider::~DefaultNumberingProvider() delete translit; } +void DefaultNumberingProvider::impl_loadTranslit() +{ + if ( !translit ) + translit = new TransliterationImpl(xSMgr); +} + Sequence< Reference<container::XIndexAccess> > DefaultNumberingProvider::getDefaultOutlineNumberings(const Locale& rLocale ) throw(RuntimeException) { @@ -468,6 +474,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal const OUString &tmp = OUString::valueOf( number ); OUString transliteration; getPropertyByName(aProperties, "Transliteration", sal_True) >>= transliteration; + impl_loadTranslit(); translit->loadModuleByImplName(transliteration, aLocale); result += translit->transliterateString2String(tmp, 0, tmp.getLength()); } catch (Exception& ) { diff --git a/i18npool/source/isolang/inunx.cxx b/i18npool/source/isolang/inunx.cxx index 195ddfabf9b7..7e79625085bb 100644 --- a/i18npool/source/isolang/inunx.cxx +++ b/i18npool/source/isolang/inunx.cxx @@ -60,11 +60,11 @@ static const sal_Char* getLangFromEnvironment() const sal_Char *pLang = NULL; pLang = getenv ( "LC_ALL" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = getenv ( "LC_CTYPE" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = getenv( "LANG" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = pFallback; return pLang; @@ -79,13 +79,13 @@ static const sal_Char* getUILangFromEnvironment() const sal_Char *pLang = NULL; pLang = getenv ( "LANGUAGE" ); // respect the GNU extension - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = getenv ( "LC_ALL" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = getenv ( "LC_MESSAGES" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = getenv( "LANG" ); - if (! pLang) + if (! pLang || pLang[0] == 0) pLang = pFallback; return pLang; diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 74416df665a0..c321f62c95f9 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -331,9 +331,9 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_VENDA, "ven", "ZA" }, // 639-2 may have been used temporarily since 2004-07-23 { LANGUAGE_XHOSA, "xh", "ZA" }, { LANGUAGE_ZULU, "zu", "ZA" }, - { LANGUAGE_QUECHUA_BOLIVIA, "qu", "BO" }, { LANGUAGE_QUECHUA_ECUADOR, "qu", "EC" }, { LANGUAGE_QUECHUA_PERU, "qu", "PE" }, + { LANGUAGE_QUECHUA_BOLIVIA, "qu", "BO" }, // macro: quh-BO, qul-BO { LANGUAGE_PASHTO, "ps", "AF" }, { LANGUAGE_OROMO, "om", "ET" }, { LANGUAGE_DHIVEHI, "dv", "MV" }, @@ -446,6 +446,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_TETUN_TIMOR_LESTE, "tet", "TL" }, { LANGUAGE_USER_TOK_PISIN, "tpi", "PG" }, { LANGUAGE_USER_SHUSWAP, "shs", "CA" }, + { LANGUAGE_USER_ANCIENT_GREEK, "grc", "GR" }, + { LANGUAGE_USER_ASTURIAN, "ast", "ES" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/i18npool/source/isolang/langid.pl b/i18npool/source/isolang/langid.pl index 40313c5cc707..f4852cc7197d 100755 --- a/i18npool/source/isolang/langid.pl +++ b/i18npool/source/isolang/langid.pl @@ -43,7 +43,7 @@ sub Usage() "\n", "langid - a hackish utility to lookup lang.h language defines and LangIDs,\n", "isolang.cxx ISO639/ISO3166 mapping, locale data files, langtab.src language\n", - "listbox entries, Langpack.ulf installer language and file_ooo.scp registry name.\n\n", + "listbox entries, postset.mk and file_ooo.scp registry name.\n\n", "Usage: $0 [--single] {language string} | {LangID} | {primarylanguage sublanguage} | {language-country}\n\n", @@ -104,11 +104,12 @@ sub makeLangID($$) } -sub grepFile($$$$$) +sub grepFile($$$$@) { - my( $regex, $modifier, $path, $module, $name) = @_; + my( $regex, $path, $module, $name, @addregex) = @_; my @result; my $found = 0; + my $arefound = ''; my $file; # Try module under current working directory first to catch local # modifications. A Not yet delivered lang.h is a special case. @@ -125,43 +126,51 @@ sub grepFile($$$$$) print "No $file\n"; $file = "$path/$module.lnk/$name"; if (!($found = open( IN, $file))) { - print "No $file either.\n"; } + print "No $file.\n"; + $file = "$path/$module.link/$name"; + if (!($found = open( IN, $file))) { + print "No $file either.\n"; } + } } } if ($found) { $found = 0; - if ($modifier eq "i") + while (my $line = <IN>) { - while (my $line = <IN>) + if ($line =~ /$regex/) { - if ($line =~ /$regex/i) + if (!$found) { - if (!$found) - { - $found = 1; - print "$file:\n"; - } - chomp( $line); - print "$line\n"; - push( @result, $line); + $found = 1; + print "$file:\n"; } + chomp( $line); + print "$line\n"; + push( @result, $line); } - } - else - { - while (my $line = <IN>) + else { - if ($line =~ /$regex/) + for my $re (@addregex) { - if (!$found) + if ($re ne $arefound && $line =~ /$re/) { - $found = 1; - print "$file:\n"; + if ($arefound eq '') + { + $arefound = $re; + } + else + { + if (!$found) + { + $found = 1; + print "$file:\n"; + } + chomp( $line); + print "$line\n"; + push( @result, $line); + } } - chomp( $line); - print "$line\n"; - push( @result, $line); } } } @@ -214,16 +223,16 @@ sub main() Usage(); return 1; } - my $modifier = "i"; - my (@resultlist, @greplist, @lcidlist, $result); + my $modifier = "(?i)"; + my (@resultlist, @greplist, $result); # If no string was given on the command line, but value(s) were, lookup the # LangID value to obtain the define identifier. if ($grepdef) { # #define LANGUAGE_AFRIKAANS 0x0436 @resultlist = grepFile( - '^\s*#\s*define\s+[A-Z_]*' . $grepdef, $modifier, - $SOLENVINC, "i18npool", "lang.h"); + $modifier . '^\s*#\s*define\s+[A-Z_]*' . $grepdef, + $SOLENVINC, "i18npool", "lang.h", ()); } else { @@ -231,8 +240,8 @@ sub main() $lcid, $parts[0], $parts[1]); my $buf = sprintf( "0x%04X", $lcid); @resultlist = grepFile( - '^\s*#\s*define\s+\w+\s+' . $buf, "", - $SOLENVINC, "i18npool", "lang.h"); + '^\s*#\s*define\s+\w+\s+' . $buf, + $SOLENVINC, "i18npool", "lang.h", ()); } for $result (@resultlist) { @@ -260,8 +269,8 @@ sub main() $coun = uc($coun); # { LANGUAGE_AFRIKAANS, "af", "ZA" }, @resultlist = grepFile( - '^\s*\{\s*\w+\s*,\s*\"' . $lang . '\"\s*,\s*\"' . $coun . '\"\s*\}\s*,', "", - "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx"); + '^\s*\{\s*\w+\s*,\s*\"' . $lang . '\"\s*,\s*\"' . $coun . '\"\s*\}\s*,', + "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx", ()); for $result (@resultlist) { if ($result =~ /^\s*\{\s*(\w+)\s*,\s*\"\w+\"\s*,\s*\"(\w+)?\"\s*\}\s*,/) @@ -279,10 +288,13 @@ sub main() for $grepdef (@greplist) { print "\nUsing: " . $grepdef . "\n"; + + # Decimal LCID, was needed for Langpack.ulf but isn't used anymore, + # keep just in case we'd need it again. # #define LANGUAGE_AFRIKAANS 0x0436 @resultlist = grepFile( - '^\s*#\s*define\s+[A-Z_]*' . $grepdef, $modifier, - $SOLENVINC, "i18npool", "lang.h"); + $modifier . '^\s*#\s*define\s+[A-Z_]*' . $grepdef, + $SOLENVINC, "i18npool", "lang.h", ()); my @lcidlist; for $result (@resultlist) { @@ -295,8 +307,8 @@ sub main() # { LANGUAGE_AFRIKAANS, "af", "ZA" }, @resultlist = grepFile( - '^\s*\{\s*.*' . $grepdef . '.*\s*,\s*\".*\"\s*,\s*\".*\"\s*\}\s*,', $modifier, - "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx"); + $modifier . '^\s*\{\s*.*' . $grepdef . '.*\s*,\s*\".*\"\s*,\s*\".*\"\s*\}\s*,', + "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx", ()); my @langcoungreplist; for $result (@resultlist) @@ -322,7 +334,11 @@ sub main() if (!($found = open( LD, $file))) { $file = "$SRC_ROOT/i18npool.lnk/source/localedata/data/$loca.xml"; - $found = open( LD, $file); + if (!($found = open( LD, $file))) + { + $file = "$SRC_ROOT/i18npool.link/source/localedata/data/$loca.xml"; + $found = open( LD, $file); + } } if ($found) { @@ -346,8 +362,8 @@ sub main() # case LANGUAGE_ARABIC: grepFile( - '^\s*case\s*.*' . $grepdef . '.*\s*:', $modifier, - "$SRC_ROOT", "i18npool", "source/isolang/mslangid.cxx"); + $modifier . '^\s*case\s*.*' . $grepdef . '.*\s*:', + "$SRC_ROOT", "i18npool", "source/isolang/mslangid.cxx", ()); # With CWS 'langstatusbar' the language listbox resource file gets a new location. my $module = "svx"; @@ -359,28 +375,26 @@ sub main() # < "Afrikaans" ; LANGUAGE_AFRIKAANS ; > ; # lookup define @resultlist = grepFile( - '^\s*<\s*\".*\"\s*;\s*.*' . $grepdef . '.*\s*;\s*>\s*;', $modifier, - "$SRC_ROOT", $module, $name); + $modifier . '^\s*<\s*\".*\"\s*;\s*.*' . $grepdef . '.*\s*;\s*>\s*;', + "$SRC_ROOT", $module, $name, ()); # lookup string if (!@resultlist) { grepFile( - '^\s*<\s*\".*' . $grepdef . '.*\"\s*;\s*.*\s*;\s*>\s*;', $modifier, - "$SRC_ROOT", $module, $name); } - - for $lcid (@lcidlist) - { - # [OOO_LANGPACK_NAME_1033] - grepFile( - '^\s*\[OOO_LANGPACK_NAME_' . $lcid . '\]', "", - "$SRC_ROOT", "instsetoo_native", "inc_openoffice/windows/msi_languages/Langpack.ulf"); - } + $modifier . '^\s*<\s*\".*' . $grepdef . '.*\"\s*;\s*.*\s*;\s*>\s*;', + "$SRC_ROOT", $module, $name, ()); } for my $langcoun (@langcoungreplist) { # Name (xxx) = "/registry/spool/org/openoffice/Office/Common-ctl.xcu"; grepFile( - '^\s*Name\s*\(' . $langcoun . '\)\s*=', "", - "$SRC_ROOT", "scp2", "source/ooo/file_ooo.scp"); + '^\s*Name\s*\(' . $langcoun . '\)\s*=', + "$SRC_ROOT", "scp2", "source/ooo/file_ooo.scp", ()); + # completelangiso=af ar as-IN ... zu + grepFile( + '^\s*completelangiso\s*[= ](.{2,3}(-..)?)*' . $langcoun . '', + "$SRC_ROOT", "solenv", "inc/postset.mk", + # needs a duplicated pair of backslashes to produce a literal \\ + ('^\s*completelangiso\s*=', '^\s+' . $langcoun . '\s*\\\\*$')); } } return 0; diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 070ddb9dc562..3476341fbc79 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -41,6 +41,9 @@ LanguageType MsLangId::nConfiguredSystemLanguage = LANGUAGE_SYSTEM; LanguageType MsLangId::nConfiguredSystemUILanguage = LANGUAGE_SYSTEM; +LanguageType MsLangId::nConfiguredWesternFallback = LANGUAGE_SYSTEM; +LanguageType MsLangId::nConfiguredAsianFallback = LANGUAGE_SYSTEM; +LanguageType MsLangId::nConfiguredComplexFallback = LANGUAGE_SYSTEM; // static void MsLangId::setConfiguredSystemLanguage( LanguageType nLang ) @@ -55,6 +58,23 @@ void MsLangId::setConfiguredSystemUILanguage( LanguageType nLang ) nConfiguredSystemUILanguage = nLang; } +// static +void MsLangId::setConfiguredWesternFallback( LanguageType nLang ) +{ + nConfiguredWesternFallback = nLang; +} + +// static +void MsLangId::setConfiguredAsianFallback( LanguageType nLang ) +{ + nConfiguredAsianFallback = nLang; +} + +// static +void MsLangId::setConfiguredComplexFallback( LanguageType nLang ) +{ + nConfiguredComplexFallback = nLang; +} // static inline LanguageType MsLangId::simplifySystemLanguages( LanguageType nLang ) @@ -120,6 +140,40 @@ LanguageType MsLangId::getRealLanguage( LanguageType nLang ) // static +LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType ) +{ + if (nLang == LANGUAGE_NONE) + return nLang; + + nLang = getRealLanguage(nLang); + if (nType != ::com::sun::star::i18n::ScriptType::WEAK && getScriptType(nLang) != nType) + { + switch(nType) + { + case ::com::sun::star::i18n::ScriptType::ASIAN: + if (nConfiguredAsianFallback == LANGUAGE_SYSTEM) + nLang = LANGUAGE_CHINESE_SIMPLIFIED; + else + nLang = nConfiguredComplexFallback; + break; + case ::com::sun::star::i18n::ScriptType::COMPLEX: + if (nConfiguredComplexFallback == LANGUAGE_SYSTEM) + nLang = LANGUAGE_HINDI; + else + nLang = nConfiguredComplexFallback; + break; + default: + if (nConfiguredWesternFallback == LANGUAGE_SYSTEM) + nLang = LANGUAGE_ENGLISH_US; + else + nLang = nConfiguredWesternFallback; + break; + } + } + return nLang; +} + +// static void MsLangId::convertLanguageToLocale( LanguageType nLang, ::com::sun::star::lang::Locale & rLocale ) { @@ -211,10 +265,12 @@ bool MsLangId::isRightToLeft( LanguageType nLang ) { case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY : case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_YIDDISH & LANGUAGE_MASK_PRIMARY : case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY : case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY : case LANGUAGE_KASHMIRI & LANGUAGE_MASK_PRIMARY : case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_UIGHUR_CHINA & LANGUAGE_MASK_PRIMARY : return true; default: @@ -281,6 +337,7 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang ) case LANGUAGE_BURMESE: case LANGUAGE_FARSI: case LANGUAGE_HEBREW: + case LANGUAGE_YIDDISH: case LANGUAGE_MARATHI: case LANGUAGE_PUNJABI: case LANGUAGE_GUJARATI: diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 7596efc1087c..3f09e394a833 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -448,6 +448,11 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const if (aListSep == aThoSep) fprintf( stderr, "Warning: %s\n", "ListSeparator equals ThousandSeparator."); + if (aListSep.getLength() != 1 || aListSep.getStr()[0] != ';') + { + incError( "ListSeparator not ';' semicolon. Strongly recommended. Currently required."); + ++nSavErr; // format codes not affected + } if (aTimeSep == aTime100Sep) ++nWarn, fprintf( stderr, "Warning: %s\n", "Time100SecSeparator equals TimeSeparator, this is probably an error."); @@ -1299,6 +1304,16 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const delete []nbOfEras; } +bool isIso4217( const OUString& rStr ) +{ + const sal_Unicode* p = rStr.getStr(); + return rStr.getLength() == 3 + && 'A' <= p[0] && p[0] <= 'Z' + && 'A' <= p[1] && p[1] <= 'Z' + && 'A' <= p[2] && p[2] <= 'Z' + ; +} + void LCCurrencyNode :: generateCode (const OFileWriter &of) const { ::rtl::OUString useLocale = getAttr() -> getValueByName("ref"); @@ -1336,10 +1351,17 @@ void LCCurrencyNode :: generateCode (const OFileWriter &of) const } str = calNode -> findNode ("CurrencyID") -> getValue(); of.writeParameter("currencyID", str, nbOfCurrencies); + // CurrencyID MUST be ISO 4217. + if (!bLegacy && !isIso4217(str)) + incError( "CurrencyID is not ISO 4217"); str = calNode -> findNode ("CurrencySymbol") -> getValue(); of.writeParameter("currencySymbol", str, nbOfCurrencies); str = calNode -> findNode ("BankSymbol") -> getValue(); of.writeParameter("bankSymbol", str, nbOfCurrencies); + // BankSymbol currently must be ISO 4217. May change later if + // application always uses CurrencyID instead of BankSymbol. + if (!bLegacy && !isIso4217(str)) + incError( "BankSymbol is not ISO 4217"); str = calNode -> findNode ("CurrencyName") -> getValue(); of.writeParameter("currencyName", str, nbOfCurrencies); str = calNode -> findNode ("DecimalPlaces") -> getValue(); diff --git a/i18npool/source/localedata/data/ar_OM.xml b/i18npool/source/localedata/data/ar_OM.xml new file mode 100644 index 000000000000..935e736f7c29 --- /dev/null +++ b/i18npool/source/localedata/data/ar_OM.xml @@ -0,0 +1,357 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE Locale SYSTEM 'locale.dtd'> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> + <LC_INFO> + <Language> + <LangID>ar</LangID> + <DefaultName>Arabic, Omani Spoken</DefaultName> + </Language> + <Country> + <CountryID>OM</CountryID> + <DefaultName>Oman</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE unoid="generic"> + <Separators> + <DateSeparator>/</DateSeparator> + <ThousandSeparator>,</ThousandSeparator> + <DecimalSeparator>.</DecimalSeparator> + <TimeSeparator>:</TimeSeparator> + <Time100SecSeparator>.</Time100SecSeparator> + <ListSeparator>;</ListSeparator> + <LongDateDayOfWeekSeparator>، </LongDateDayOfWeekSeparator> + <LongDateDaySeparator>، </LongDateDaySeparator> + <LongDateMonthSeparator> </LongDateMonthSeparator> + <LongDateYearSeparator> </LongDateYearSeparator> + </Separators> + <Markers> + <QuotationStart>'</QuotationStart> + <QuotationEnd>'</QuotationEnd> + <DoubleQuotationStart>"</DoubleQuotationStart> + <DoubleQuotationEnd>"</DoubleQuotationEnd> + </Markers> + <TimeAM>ص</TimeAM> + <TimePM>م</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$ر.ع-2001]"> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>#,###.00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0.00E+00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0.00E+000</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> + <FormatCode>0%</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> + <FormatCode>0.00%</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> + <FormatCode>[CURRENCY]#,##0;-#,##0 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> + <FormatCode>[CURRENCY]#,##0.00;-#,##0.00 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> + <FormatCode>[CURRENCY]#,##0;[RED]-#,##0 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> + <FormatCode>[CURRENCY]#,##0.00;[RED]-#,##0.00 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> + <FormatCode>CCC#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#,##0.--;[RED]-#,##0.-- [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>D/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNDD، MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>DD/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>DD/MM/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>D، MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>D، MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D، MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>D، MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D، MMMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> + <FormatCode>NN، DD/MMM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> + <FormatCode>NN، D، MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN، D، MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNND، MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> + <FormatCode>HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> + <FormatCode>HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> + <FormatCode>HH:MM:SS AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> + <FormatCode>[HH]:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> + <FormatCode>MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> + <FormatCode>[HH]:MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>DD/MM/YY HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION> + <Collator default="true" unoid="alphanumeric"/> + <CollationOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </CollationOptions> + </LC_COLLATION> + <LC_SEARCH> + <SearchOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </SearchOptions> + </LC_SEARCH> + <LC_INDEX> + <IndexKey phonetic="false" default="true" unoid="alphanumeric">أ-ي</IndexKey> + <UnicodeScript>11</UnicodeScript> + <FollowPageWord>يتبع</FollowPageWord> + <FollowPageWord>يتبع</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>الأحد</DefaultAbbrvName> + <DefaultFullName>الأحد</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>الإثنين</DefaultAbbrvName> + <DefaultFullName>الإثنين</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>الثلاثاء</DefaultAbbrvName> + <DefaultFullName>الثلاثاء</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>الأربعاء</DefaultAbbrvName> + <DefaultFullName>الأربعاء</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>الخميس</DefaultAbbrvName> + <DefaultFullName>الخميس</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>الجمعة</DefaultAbbrvName> + <DefaultFullName>الجمعة</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>السبت</DefaultAbbrvName> + <DefaultFullName>السبت</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>يانير</DefaultAbbrvName> + <DefaultFullName>يانير</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>فبراير</DefaultAbbrvName> + <DefaultFullName>فبراير</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>مارس</DefaultAbbrvName> + <DefaultFullName>مارس</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>أبريل</DefaultAbbrvName> + <DefaultFullName>أبريل</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>مايو</DefaultAbbrvName> + <DefaultFullName>مايو</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>يونيو</DefaultAbbrvName> + <DefaultFullName>يونيو</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>يوليو</DefaultAbbrvName> + <DefaultFullName>يوليو</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>أغسطس</DefaultAbbrvName> + <DefaultFullName>أغسطس</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>سبتمبر</DefaultAbbrvName> + <DefaultFullName>سبتمبر</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>أكتوبر</DefaultAbbrvName> + <DefaultFullName>أكتوبر</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>نوفمبر</DefaultAbbrvName> + <DefaultFullName>نوفمبر</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>ديسمبر</DefaultAbbrvName> + <DefaultFullName>ديسمبر</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>ق.م</DefaultAbbrvName> + <DefaultFullName>قبل الميلاد</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>م</DefaultAbbrvName> + <DefaultFullName>ميلادي</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>sat</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>OMR</CurrencyID> + <CurrencySymbol>ر.ع</CurrencySymbol> + <BankSymbol>OMR</BankSymbol> + <CurrencyName>ريال عماني</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="IGNORE_CASE"/> + </LC_TRANSLITERATION> + <LC_MISC> + <ReservedWords> + <trueWord>صحيح</trueWord> + <falseWord>خاطئ</falseWord> + <quarter1Word>الربع الأول</quarter1Word> + <quarter2Word>الربع الثاني</quarter2Word> + <quarter3Word>الربع الثالث</quarter3Word> + <quarter4Word>الربع الرابع</quarter4Word> + <aboveWord>فوق</aboveWord> + <belowWord>تحت</belowWord> + <quarter1Abbreviation>الربع 1</quarter1Abbreviation> + <quarter2Abbreviation>الربع 2</quarter2Abbreviation> + <quarter3Abbreviation>الربع 3</quarter3Abbreviation> + <quarter4Abbreviation>الربع 4</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel> + <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix="."/> + <NumberingLevel NumType="0" Prefix=" " Suffix="."/> + <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="3" Prefix=" " Suffix="."/> + </LC_NumberingLevel> + <LC_OutLineNumberingLevel ref="en_US"/> +</Locale> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/ast_ES.xml b/i18npool/source/localedata/data/ast_ES.xml new file mode 100644 index 000000000000..05c63601828a --- /dev/null +++ b/i18npool/source/localedata/data/ast_ES.xml @@ -0,0 +1,359 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Locale SYSTEM "locale.dtd"> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> + <LC_INFO> + <Language> + <LangID>ast</LangID> + <DefaultName>Asturian</DefaultName> + </Language> + <Country> + <CountryID>ES</CountryID> + <DefaultName>Spain</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE unoid="generic"> + <Separators> + <DateSeparator>/</DateSeparator> + <ThousandSeparator>.</ThousandSeparator> + <DecimalSeparator>,</DecimalSeparator> + <TimeSeparator>:</TimeSeparator> + <Time100SecSeparator>,</Time100SecSeparator> + <ListSeparator>;</ListSeparator> + <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> + <LongDateDaySeparator>, </LongDateDaySeparator> + <LongDateMonthSeparator> </LongDateMonthSeparator> + <LongDateYearSeparator> </LongDateYearSeparator> + </Separators> + <Markers> + <QuotationStart>‘</QuotationStart> + <QuotationEnd>’</QuotationEnd> + <DoubleQuotationStart>“</DoubleQuotationStart> + <DoubleQuotationEnd>”</DoubleQuotationEnd> + </Markers> + <TimeAM>AM</TimeAM> + <TimePM>PM</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-64A]"> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>0,00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>#.##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>#.##0,00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>#.###,00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0,00E+00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0,00E+000</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> + <FormatCode>0%</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> + <FormatCode>0,00%</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> + <FormatCode>[CURRENCY]#.##0;-[CURRENCY]#.##0</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> + <FormatCode>[CURRENCY]#.##0,00;-[CURRENCY]#.##0,00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> + <FormatCode>[CURRENCY]#.##0;[RED]-[CURRENCY]#.##0</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> + <FormatCode>[CURRENCY]#.##0,00;[RED]-[CURRENCY]#.##0,00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> + <FormatCode>CCC#.##0,00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#.##0,--;[RED]-[CURRENCY]#.##0,--</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>D/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNDD, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>DD/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>DD/MM/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D, MMMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> + <FormatCode>NN, DD/MMM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> + <FormatCode>NN, D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN, D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNND, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> + <FormatCode>HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> + <FormatCode>HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> + <FormatCode>HH:MM:SS AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> + <FormatCode>[HH]:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> + <FormatCode>MM:SS,00</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> + <FormatCode>[HH]:MM:SS,00</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>DD/MM/YY HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION> + <Collator default="true" unoid="alphanumeric"/> + <CollationOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </CollationOptions> + </LC_COLLATION> + <LC_SEARCH> + <SearchOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </SearchOptions> + </LC_SEARCH> + <LC_INDEX> + <IndexKey phonetic="false" default="true" unoid="alphanumeric">A Á B-C {CH} D-E É F-H Ḥ I Í J-K L {ḶḶ} M-N Ñ O Ó P-U Ú Ü V-Z</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <UnicodeScript>37</UnicodeScript> + <FollowPageWord>s/páx</FollowPageWord> + <FollowPageWord>s/pxs</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>Dom</DefaultAbbrvName> + <DefaultFullName>Domingu</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>Llu</DefaultAbbrvName> + <DefaultFullName>Llunes</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Mar</DefaultAbbrvName> + <DefaultFullName>Martes</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Mié</DefaultAbbrvName> + <DefaultFullName>Miércoles</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>Xue</DefaultAbbrvName> + <DefaultFullName>Xueves</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>Vie</DefaultAbbrvName> + <DefaultFullName>Vienres</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>Sáb</DefaultAbbrvName> + <DefaultFullName>Sábadu</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>Xin</DefaultAbbrvName> + <DefaultFullName>Xineru</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>Feb</DefaultAbbrvName> + <DefaultFullName>Febreru</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>Mar</DefaultAbbrvName> + <DefaultFullName>Marzu</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>Abr</DefaultAbbrvName> + <DefaultFullName>Abril</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>May</DefaultAbbrvName> + <DefaultFullName>Mayu</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>Xun</DefaultAbbrvName> + <DefaultFullName>Xunu</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>Xnt</DefaultAbbrvName> + <DefaultFullName>Xunetu</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>Ago</DefaultAbbrvName> + <DefaultFullName>Agostu</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>Set</DefaultAbbrvName> + <DefaultFullName>Setiembre</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>Och</DefaultAbbrvName> + <DefaultFullName>Ochobre</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>Pay</DefaultAbbrvName> + <DefaultFullName>Payares</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>Avi</DefaultAbbrvName> + <DefaultFullName>Avientu</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>edC</DefaultAbbrvName> + <DefaultFullName>edC</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>dC</DefaultAbbrvName> + <DefaultFullName>dC</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>mon</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>EUR</CurrencyID> + <CurrencySymbol>€</CurrencySymbol> + <BankSymbol>EUR</BankSymbol> + <CurrencyName>Euro</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="IGNORE_CASE"/> + </LC_TRANSLITERATION> + <LC_MISC> + <ReservedWords> + <trueWord>Braero</trueWord> + <falseWord>Falso</falseWord> + <quarter1Word>1er Trimestre</quarter1Word> + <quarter2Word>2u Trimestre</quarter2Word> + <quarter3Word>3er Trimestre</quarter3Word> + <quarter4Word>4u Trimestre</quarter4Word> + <aboveWord>arriba</aboveWord> + <belowWord>abaxo</belowWord> + <quarter1Abbreviation>T1</quarter1Abbreviation> + <quarter2Abbreviation>T2</quarter2Abbreviation> + <quarter3Abbreviation>T3</quarter3Abbreviation> + <quarter4Abbreviation>T4</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel> + <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix="."/> + <NumberingLevel NumType="0" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="3" Prefix=" " Suffix="."/> + </LC_NumberingLevel> + <LC_OutLineNumberingLevel ref="en_US"/> +</Locale> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/az_AZ.xml b/i18npool/source/localedata/data/az_AZ.xml index ad96a38099e5..268aca4cd927 100644 --- a/i18npool/source/localedata/data/az_AZ.xml +++ b/i18npool/source/localedata/data/az_AZ.xml @@ -299,14 +299,17 @@ </Calendar> </LC_CALENDAR> <LC_CURRENCY> - <Currency default="true" usedInCompatibleFormatCodes="false"> + <Currency default="true" usedInCompatibleFormatCodes="true"> <CurrencyID>AZN</CurrencyID> <CurrencySymbol>man.</CurrencySymbol> <BankSymbol>AZN</BankSymbol> <CurrencyName>Manat</CurrencyName> <DecimalPlaces>2</DecimalPlaces> </Currency> - <Currency default="false" usedInCompatibleFormatCodes="true"> + <Currency default="false" usedInCompatibleFormatCodes="false" legacyOnly="true"> + <!-- legacyOnly to avoid the duplicated listing in the number formatter + dialog because of the identical CurrencySymbol, which also confuses + the currency listbox selection mechanism. --> <CurrencyID>AZM</CurrencyID> <CurrencySymbol>man.</CurrencySymbol> <BankSymbol>AZM</BankSymbol> diff --git a/i18npool/source/localedata/data/gl_ES.xml b/i18npool/source/localedata/data/gl_ES.xml index d9e6344f0cb0..26d21e913da7 100644 --- a/i18npool/source/localedata/data/gl_ES.xml +++ b/i18npool/source/localedata/data/gl_ES.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE Locale SYSTEM 'locale.dtd'> -<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.2"> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.3"> <LC_INFO> <Language> <LangID>gl</LangID> @@ -30,8 +30,8 @@ <DoubleQuotationStart>“</DoubleQuotationStart> <DoubleQuotationEnd>”</DoubleQuotationEnd> </Markers> - <TimeAM>AM</TimeAM> - <TimePM>PM</TimePM> + <TimeAM>a. m.</TimeAM> + <TimePM>p. m.</TimePM> <MeasurementSystem>metric</MeasurementSystem> </LC_CTYPE> <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$₧-456]"> @@ -184,37 +184,37 @@ <DaysOfWeek> <Day> <DayID>sun</DayID> - <DefaultAbbrvName>do.</DefaultAbbrvName> + <DefaultAbbrvName>dom.</DefaultAbbrvName> <DefaultFullName>domingo</DefaultFullName> </Day> <Day> <DayID>mon</DayID> - <DefaultAbbrvName>lu.</DefaultAbbrvName> + <DefaultAbbrvName>lun.</DefaultAbbrvName> <DefaultFullName>luns</DefaultFullName> </Day> <Day> <DayID>tue</DayID> - <DefaultAbbrvName>ma.</DefaultAbbrvName> + <DefaultAbbrvName>mar.</DefaultAbbrvName> <DefaultFullName>martes</DefaultFullName> </Day> <Day> <DayID>wed</DayID> - <DefaultAbbrvName>me.</DefaultAbbrvName> + <DefaultAbbrvName>mér.</DefaultAbbrvName> <DefaultFullName>mércores</DefaultFullName> </Day> <Day> <DayID>thu</DayID> - <DefaultAbbrvName>xo.</DefaultAbbrvName> + <DefaultAbbrvName>xov.</DefaultAbbrvName> <DefaultFullName>xoves</DefaultFullName> </Day> <Day> <DayID>fri</DayID> - <DefaultAbbrvName>ve.</DefaultAbbrvName> + <DefaultAbbrvName>ven.</DefaultAbbrvName> <DefaultFullName>venres</DefaultFullName> </Day> <Day> <DayID>sat</DayID> - <DefaultAbbrvName>sa.</DefaultAbbrvName> + <DefaultAbbrvName>sáb.</DefaultAbbrvName> <DefaultFullName>sábado</DefaultFullName> </Day> </DaysOfWeek> @@ -231,7 +231,7 @@ </Month> <Month> <MonthID>mar</MonthID> - <DefaultAbbrvName>mar</DefaultAbbrvName> + <DefaultAbbrvName>mar.</DefaultAbbrvName> <DefaultFullName>marzo</DefaultFullName> </Month> <Month> @@ -241,13 +241,13 @@ </Month> <Month> <MonthID>may</MonthID> - <DefaultAbbrvName>mai</DefaultAbbrvName> + <DefaultAbbrvName>mai.</DefaultAbbrvName> <DefaultFullName>maio</DefaultFullName> </Month> <Month> <MonthID>jun</MonthID> - <DefaultAbbrvName>xun</DefaultAbbrvName> - <DefaultFullName>xunio</DefaultFullName> + <DefaultAbbrvName>xuñ.</DefaultAbbrvName> + <DefaultFullName>xuño</DefaultFullName> </Month> <Month> <MonthID>jul</MonthID> @@ -283,13 +283,13 @@ <Eras> <Era> <EraID>bc</EraID> - <DefaultAbbrvName>A.C.</DefaultAbbrvName> - <DefaultFullName>A.C.</DefaultFullName> + <DefaultAbbrvName>a. C.</DefaultAbbrvName> + <DefaultFullName>antes de Cristo</DefaultFullName> </Era> <Era> <EraID>ad</EraID> - <DefaultAbbrvName>D.C.</DefaultAbbrvName> - <DefaultFullName>D.C.</DefaultFullName> + <DefaultAbbrvName>d. C.</DefaultAbbrvName> + <DefaultFullName>despois de Cristo</DefaultFullName> </Era> </Eras> <StartDayOfWeek> @@ -326,16 +326,16 @@ <ReservedWords> <trueWord>verdadeiro</trueWord> <falseWord>falso</falseWord> - <quarter1Word>1er trimestre</quarter1Word> - <quarter2Word>2on trimestre</quarter2Word> - <quarter3Word>3er trimestre</quarter3Word> - <quarter4Word>4rt trimestre</quarter4Word> + <quarter1Word>1.º trimestre</quarter1Word> + <quarter2Word>2.º trimestre</quarter2Word> + <quarter3Word>3.º trimestre</quarter3Word> + <quarter4Word>4.º trimestre</quarter4Word> <aboveWord>enriba</aboveWord> <belowWord>debaixo</belowWord> - <quarter1Abbreviation>T1</quarter1Abbreviation> - <quarter2Abbreviation>T2</quarter2Abbreviation> - <quarter3Abbreviation>T3</quarter3Abbreviation> - <quarter4Abbreviation>T4</quarter4Abbreviation> + <quarter1Abbreviation>1T</quarter1Abbreviation> + <quarter2Abbreviation>2T</quarter2Abbreviation> + <quarter3Abbreviation>3T</quarter3Abbreviation> + <quarter4Abbreviation>4T</quarter4Abbreviation> </ReservedWords> </LC_MISC> <LC_NumberingLevel ref="en_US"/> diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd index 7d58023a064a..b9ee78f69e79 100644 --- a/i18npool/source/localedata/data/locale.dtd +++ b/i18npool/source/localedata/data/locale.dtd @@ -20,13 +20,13 @@ A second possiblity is: - temporarily change the DOCTYPE of your file to read (all on one line) - <!DOCTYPE Locale SYSTEM "http://l10n.openoffice.org/unbranded-source/browse/*checkout*/l10n/i18npool/source/localedata/data/locale.dtd"> + <!DOCTYPE Locale SYSTEM "http://svn.services.openoffice.org/ooo/trunk/i18npool/source/localedata/data/locale.dtd"> - upload it to the form available at http://www.validome.org/ This will validate the file against the HEAD revision of locale.dtd, for - other revisions you'll have to specify the revision as in - http://l10n.openoffice.org/unbranded-source/browse/*checkout*/l10n/i18npool/source/localedata/data/locale.dtd?rev=1.14.4.3 + other revisions you'll have to specify the corresponding tags or cws branch + instead of trunk. Please test locale data files either in a non-product (!) build, which diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 9b46fd2adfa5..1a28eb537bd5 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -1,6 +1,7 @@ OOO_1.1 { global: GetVersionInfo; +getAllCalendars_ast_ES; getAllCalendars_be_BY; getAllCalendars_bg_BG; getAllCalendars_br_FR; @@ -53,6 +54,7 @@ getAllCalendars_pt_BR; getAllCalendars_pt_PT; getAllCalendars_ro_RO; getAllCalendars_ru_RU; +getAllCalendars_sc_IT; getAllCalendars_sh_ME; getAllCalendars_sh_RS; getAllCalendars_sh_YU; @@ -66,6 +68,7 @@ getAllCalendars_sv_SE; getAllCalendars_tr_TR; getAllCalendars_uk_UA; getAllCalendars_wa_BE; +getAllCurrencies_ast_ES; getAllCurrencies_be_BY; getAllCurrencies_bg_BG; getAllCurrencies_br_FR; @@ -118,6 +121,7 @@ getAllCurrencies_pt_BR; getAllCurrencies_pt_PT; getAllCurrencies_ro_RO; getAllCurrencies_ru_RU; +getAllCurrencies_sc_IT; getAllCurrencies_sh_ME; getAllCurrencies_sh_RS; getAllCurrencies_sh_YU; @@ -131,6 +135,7 @@ getAllCurrencies_sv_SE; getAllCurrencies_tr_TR; getAllCurrencies_uk_UA; getAllCurrencies_wa_BE; +getAllFormats0_ast_ES; getAllFormats0_be_BY; getAllFormats0_bg_BG; getAllFormats0_br_FR; @@ -183,6 +188,7 @@ getAllFormats0_pt_BR; getAllFormats0_pt_PT; getAllFormats0_ro_RO; getAllFormats0_ru_RU; +getAllFormats0_sc_IT; getAllFormats0_sh_ME; getAllFormats0_sh_RS; getAllFormats0_sh_YU; @@ -196,6 +202,7 @@ getAllFormats0_sv_SE; getAllFormats0_tr_TR; getAllFormats0_uk_UA; getAllFormats0_wa_BE; +getBreakIteratorRules_ast_ES; getBreakIteratorRules_be_BY; getBreakIteratorRules_bg_BG; getBreakIteratorRules_br_FR; @@ -248,6 +255,7 @@ getBreakIteratorRules_pt_BR; getBreakIteratorRules_pt_PT; getBreakIteratorRules_ro_RO; getBreakIteratorRules_ru_RU; +getBreakIteratorRules_sc_IT; getBreakIteratorRules_sh_ME; getBreakIteratorRules_sh_RS; getBreakIteratorRules_sh_YU; @@ -261,6 +269,7 @@ getBreakIteratorRules_sv_SE; getBreakIteratorRules_tr_TR; getBreakIteratorRules_uk_UA; getBreakIteratorRules_wa_BE; +getCollationOptions_ast_ES; getCollationOptions_be_BY; getCollationOptions_bg_BG; getCollationOptions_br_FR; @@ -313,6 +322,7 @@ getCollationOptions_pt_BR; getCollationOptions_pt_PT; getCollationOptions_ro_RO; getCollationOptions_ru_RU; +getCollationOptions_sc_IT; getCollationOptions_sh_ME; getCollationOptions_sh_RS; getCollationOptions_sh_YU; @@ -326,6 +336,7 @@ getCollationOptions_sv_SE; getCollationOptions_tr_TR; getCollationOptions_uk_UA; getCollationOptions_wa_BE; +getCollatorImplementation_ast_ES; getCollatorImplementation_be_BY; getCollatorImplementation_bg_BG; getCollatorImplementation_br_FR; @@ -378,6 +389,7 @@ getCollatorImplementation_pt_BR; getCollatorImplementation_pt_PT; getCollatorImplementation_ro_RO; getCollatorImplementation_ru_RU; +getCollatorImplementation_sc_IT; getCollatorImplementation_sh_ME; getCollatorImplementation_sh_RS; getCollatorImplementation_sh_YU; @@ -391,6 +403,7 @@ getCollatorImplementation_sv_SE; getCollatorImplementation_tr_TR; getCollatorImplementation_uk_UA; getCollatorImplementation_wa_BE; +getContinuousNumberingLevels_ast_ES; getContinuousNumberingLevels_be_BY; getContinuousNumberingLevels_bg_BG; getContinuousNumberingLevels_br_FR; @@ -443,6 +456,7 @@ getContinuousNumberingLevels_pt_BR; getContinuousNumberingLevels_pt_PT; getContinuousNumberingLevels_ro_RO; getContinuousNumberingLevels_ru_RU; +getContinuousNumberingLevels_sc_IT; getContinuousNumberingLevels_sh_ME; getContinuousNumberingLevels_sh_RS; getContinuousNumberingLevels_sh_YU; @@ -456,6 +470,7 @@ getContinuousNumberingLevels_sv_SE; getContinuousNumberingLevels_tr_TR; getContinuousNumberingLevels_uk_UA; getContinuousNumberingLevels_wa_BE; +getFollowPageWords_ast_ES; getFollowPageWords_be_BY; getFollowPageWords_bg_BG; getFollowPageWords_br_FR; @@ -508,6 +523,7 @@ getFollowPageWords_pt_BR; getFollowPageWords_pt_PT; getFollowPageWords_ro_RO; getFollowPageWords_ru_RU; +getFollowPageWords_sc_IT; getFollowPageWords_sh_ME; getFollowPageWords_sh_RS; getFollowPageWords_sh_YU; @@ -521,6 +537,7 @@ getFollowPageWords_sv_SE; getFollowPageWords_tr_TR; getFollowPageWords_uk_UA; getFollowPageWords_wa_BE; +getForbiddenCharacters_ast_ES; getForbiddenCharacters_be_BY; getForbiddenCharacters_bg_BG; getForbiddenCharacters_br_FR; @@ -573,6 +590,7 @@ getForbiddenCharacters_pt_BR; getForbiddenCharacters_pt_PT; getForbiddenCharacters_ro_RO; getForbiddenCharacters_ru_RU; +getForbiddenCharacters_sc_IT; getForbiddenCharacters_sh_ME; getForbiddenCharacters_sh_RS; getForbiddenCharacters_sh_YU; @@ -586,6 +604,7 @@ getForbiddenCharacters_sv_SE; getForbiddenCharacters_tr_TR; getForbiddenCharacters_uk_UA; getForbiddenCharacters_wa_BE; +getIndexAlgorithm_ast_ES; getIndexAlgorithm_be_BY; getIndexAlgorithm_bg_BG; getIndexAlgorithm_br_FR; @@ -638,6 +657,7 @@ getIndexAlgorithm_pt_BR; getIndexAlgorithm_pt_PT; getIndexAlgorithm_ro_RO; getIndexAlgorithm_ru_RU; +getIndexAlgorithm_sc_IT; getIndexAlgorithm_sh_ME; getIndexAlgorithm_sh_RS; getIndexAlgorithm_sh_YU; @@ -651,6 +671,7 @@ getIndexAlgorithm_sv_SE; getIndexAlgorithm_tr_TR; getIndexAlgorithm_uk_UA; getIndexAlgorithm_wa_BE; +getLCInfo_ast_ES; getLCInfo_be_BY; getLCInfo_bg_BG; getLCInfo_br_FR; @@ -703,6 +724,7 @@ getLCInfo_pt_BR; getLCInfo_pt_PT; getLCInfo_ro_RO; getLCInfo_ru_RU; +getLCInfo_sc_IT; getLCInfo_sh_ME; getLCInfo_sh_RS; getLCInfo_sh_YU; @@ -716,6 +738,7 @@ getLCInfo_sv_SE; getLCInfo_tr_TR; getLCInfo_uk_UA; getLCInfo_wa_BE; +getLocaleItem_ast_ES; getLocaleItem_be_BY; getLocaleItem_bg_BG; getLocaleItem_br_FR; @@ -768,6 +791,7 @@ getLocaleItem_pt_BR; getLocaleItem_pt_PT; getLocaleItem_ro_RO; getLocaleItem_ru_RU; +getLocaleItem_sc_IT; getLocaleItem_sh_ME; getLocaleItem_sh_RS; getLocaleItem_sh_YU; @@ -781,6 +805,7 @@ getLocaleItem_sv_SE; getLocaleItem_tr_TR; getLocaleItem_uk_UA; getLocaleItem_wa_BE; +getOutlineNumberingLevels_ast_ES; getOutlineNumberingLevels_be_BY; getOutlineNumberingLevels_bg_BG; getOutlineNumberingLevels_br_FR; @@ -833,6 +858,7 @@ getOutlineNumberingLevels_pt_BR; getOutlineNumberingLevels_pt_PT; getOutlineNumberingLevels_ro_RO; getOutlineNumberingLevels_ru_RU; +getOutlineNumberingLevels_sc_IT; getOutlineNumberingLevels_sh_ME; getOutlineNumberingLevels_sh_RS; getOutlineNumberingLevels_sh_YU; @@ -846,6 +872,7 @@ getOutlineNumberingLevels_sv_SE; getOutlineNumberingLevels_tr_TR; getOutlineNumberingLevels_uk_UA; getOutlineNumberingLevels_wa_BE; +getReservedWords_ast_ES; getReservedWords_be_BY; getReservedWords_bg_BG; getReservedWords_br_FR; @@ -898,6 +925,7 @@ getReservedWords_pt_BR; getReservedWords_pt_PT; getReservedWords_ro_RO; getReservedWords_ru_RU; +getReservedWords_sc_IT; getReservedWords_sh_ME; getReservedWords_sh_RS; getReservedWords_sh_YU; @@ -911,6 +939,7 @@ getReservedWords_sv_SE; getReservedWords_tr_TR; getReservedWords_uk_UA; getReservedWords_wa_BE; +getSearchOptions_ast_ES; getSearchOptions_be_BY; getSearchOptions_bg_BG; getSearchOptions_br_FR; @@ -963,6 +992,7 @@ getSearchOptions_pt_BR; getSearchOptions_pt_PT; getSearchOptions_ro_RO; getSearchOptions_ru_RU; +getSearchOptions_sc_IT; getSearchOptions_sh_ME; getSearchOptions_sh_RS; getSearchOptions_sh_YU; @@ -976,6 +1006,7 @@ getSearchOptions_sv_SE; getSearchOptions_tr_TR; getSearchOptions_uk_UA; getSearchOptions_wa_BE; +getTransliterations_ast_ES; getTransliterations_be_BY; getTransliterations_bg_BG; getTransliterations_br_FR; @@ -1028,6 +1059,7 @@ getTransliterations_pt_BR; getTransliterations_pt_PT; getTransliterations_ro_RO; getTransliterations_ru_RU; +getTransliterations_sc_IT; getTransliterations_sh_ME; getTransliterations_sh_RS; getTransliterations_sh_YU; @@ -1041,6 +1073,7 @@ getTransliterations_sv_SE; getTransliterations_tr_TR; getTransliterations_uk_UA; getTransliterations_wa_BE; +getUnicodeScripts_ast_ES; getUnicodeScripts_be_BY; getUnicodeScripts_bg_BG; getUnicodeScripts_br_FR; @@ -1093,6 +1126,7 @@ getUnicodeScripts_pt_BR; getUnicodeScripts_pt_PT; getUnicodeScripts_ro_RO; getUnicodeScripts_ru_RU; +getUnicodeScripts_sc_IT; getUnicodeScripts_sh_ME; getUnicodeScripts_sh_RS; getUnicodeScripts_sh_YU; diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index 5e32d8bb4a1b..a8212624e8e8 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -6,6 +6,7 @@ getAllCalendars_ak_GH; getAllCalendars_am_ET; getAllCalendars_ar_EG; getAllCalendars_ar_LB; +getAllCalendars_ar_OM; getAllCalendars_ar_SA; getAllCalendars_ar_TN; getAllCalendars_az_AZ; @@ -44,6 +45,7 @@ getAllCalendars_my_MM; getAllCalendars_ne_NP; getAllCalendars_nr_ZA; getAllCalendars_nso_ZA; +getAllCalendars_om_ET; getAllCalendars_or_IN; getAllCalendars_pa_IN; getAllCalendars_rw_RW; @@ -62,6 +64,7 @@ getAllCalendars_tk_TM; getAllCalendars_tn_ZA; getAllCalendars_tpi_PG; getAllCalendars_ts_ZA; +getAllCalendars_ug_CN; getAllCalendars_uz_UZ; getAllCalendars_ve_ZA; getAllCalendars_vi_VN; @@ -78,6 +81,7 @@ getAllCurrencies_ak_GH; getAllCurrencies_am_ET; getAllCurrencies_ar_EG; getAllCurrencies_ar_LB; +getAllCurrencies_ar_OM; getAllCurrencies_ar_SA; getAllCurrencies_ar_TN; getAllCurrencies_az_AZ; @@ -116,6 +120,7 @@ getAllCurrencies_my_MM; getAllCurrencies_ne_NP; getAllCurrencies_nr_ZA; getAllCurrencies_nso_ZA; +getAllCurrencies_om_ET; getAllCurrencies_or_IN; getAllCurrencies_pa_IN; getAllCurrencies_rw_RW; @@ -134,6 +139,7 @@ getAllCurrencies_tk_TM; getAllCurrencies_tn_ZA; getAllCurrencies_tpi_PG; getAllCurrencies_ts_ZA; +getAllCurrencies_ug_CN; getAllCurrencies_uz_UZ; getAllCurrencies_ve_ZA; getAllCurrencies_vi_VN; @@ -150,6 +156,7 @@ getAllFormats0_ak_GH; getAllFormats0_am_ET; getAllFormats0_ar_EG; getAllFormats0_ar_LB; +getAllFormats0_ar_OM; getAllFormats0_ar_SA; getAllFormats0_ar_TN; getAllFormats0_az_AZ; @@ -188,6 +195,7 @@ getAllFormats0_my_MM; getAllFormats0_ne_NP; getAllFormats0_nr_ZA; getAllFormats0_nso_ZA; +getAllFormats0_om_ET; getAllFormats0_or_IN; getAllFormats0_pa_IN; getAllFormats0_rw_RW; @@ -206,6 +214,7 @@ getAllFormats0_tk_TM; getAllFormats0_tn_ZA; getAllFormats0_tpi_PG; getAllFormats0_ts_ZA; +getAllFormats0_ug_CN; getAllFormats0_uz_UZ; getAllFormats0_ve_ZA; getAllFormats0_vi_VN; @@ -222,6 +231,7 @@ getBreakIteratorRules_ak_GH; getBreakIteratorRules_am_ET; getBreakIteratorRules_ar_EG; getBreakIteratorRules_ar_LB; +getBreakIteratorRules_ar_OM; getBreakIteratorRules_ar_SA; getBreakIteratorRules_ar_TN; getBreakIteratorRules_az_AZ; @@ -260,6 +270,7 @@ getBreakIteratorRules_my_MM; getBreakIteratorRules_ne_NP; getBreakIteratorRules_nr_ZA; getBreakIteratorRules_nso_ZA; +getBreakIteratorRules_om_ET; getBreakIteratorRules_or_IN; getBreakIteratorRules_pa_IN; getBreakIteratorRules_rw_RW; @@ -278,6 +289,7 @@ getBreakIteratorRules_tk_TM; getBreakIteratorRules_tn_ZA; getBreakIteratorRules_tpi_PG; getBreakIteratorRules_ts_ZA; +getBreakIteratorRules_ug_CN; getBreakIteratorRules_uz_UZ; getBreakIteratorRules_ve_ZA; getBreakIteratorRules_vi_VN; @@ -294,6 +306,7 @@ getCollationOptions_ak_GH; getCollationOptions_am_ET; getCollationOptions_ar_EG; getCollationOptions_ar_LB; +getCollationOptions_ar_OM; getCollationOptions_ar_SA; getCollationOptions_ar_TN; getCollationOptions_az_AZ; @@ -332,6 +345,7 @@ getCollationOptions_my_MM; getCollationOptions_ne_NP; getCollationOptions_nr_ZA; getCollationOptions_nso_ZA; +getCollationOptions_om_ET; getCollationOptions_or_IN; getCollationOptions_pa_IN; getCollationOptions_rw_RW; @@ -350,6 +364,7 @@ getCollationOptions_tk_TM; getCollationOptions_tn_ZA; getCollationOptions_tpi_PG; getCollationOptions_ts_ZA; +getCollationOptions_ug_CN; getCollationOptions_uz_UZ; getCollationOptions_ve_ZA; getCollationOptions_vi_VN; @@ -366,6 +381,7 @@ getCollatorImplementation_ak_GH; getCollatorImplementation_am_ET; getCollatorImplementation_ar_EG; getCollatorImplementation_ar_LB; +getCollatorImplementation_ar_OM; getCollatorImplementation_ar_SA; getCollatorImplementation_ar_TN; getCollatorImplementation_az_AZ; @@ -404,6 +420,7 @@ getCollatorImplementation_my_MM; getCollatorImplementation_ne_NP; getCollatorImplementation_nr_ZA; getCollatorImplementation_nso_ZA; +getCollatorImplementation_om_ET; getCollatorImplementation_or_IN; getCollatorImplementation_pa_IN; getCollatorImplementation_rw_RW; @@ -422,6 +439,7 @@ getCollatorImplementation_tk_TM; getCollatorImplementation_tn_ZA; getCollatorImplementation_tpi_PG; getCollatorImplementation_ts_ZA; +getCollatorImplementation_ug_CN; getCollatorImplementation_uz_UZ; getCollatorImplementation_ve_ZA; getCollatorImplementation_vi_VN; @@ -438,6 +456,7 @@ getContinuousNumberingLevels_ak_GH; getContinuousNumberingLevels_am_ET; getContinuousNumberingLevels_ar_EG; getContinuousNumberingLevels_ar_LB; +getContinuousNumberingLevels_ar_OM; getContinuousNumberingLevels_ar_SA; getContinuousNumberingLevels_ar_TN; getContinuousNumberingLevels_az_AZ; @@ -476,6 +495,7 @@ getContinuousNumberingLevels_my_MM; getContinuousNumberingLevels_ne_NP; getContinuousNumberingLevels_nr_ZA; getContinuousNumberingLevels_nso_ZA; +getContinuousNumberingLevels_om_ET; getContinuousNumberingLevels_or_IN; getContinuousNumberingLevels_pa_IN; getContinuousNumberingLevels_rw_RW; @@ -494,6 +514,7 @@ getContinuousNumberingLevels_tk_TM; getContinuousNumberingLevels_tn_ZA; getContinuousNumberingLevels_tpi_PG; getContinuousNumberingLevels_ts_ZA; +getContinuousNumberingLevels_ug_CN; getContinuousNumberingLevels_uz_UZ; getContinuousNumberingLevels_ve_ZA; getContinuousNumberingLevels_vi_VN; @@ -510,6 +531,7 @@ getFollowPageWords_ak_GH; getFollowPageWords_am_ET; getFollowPageWords_ar_EG; getFollowPageWords_ar_LB; +getFollowPageWords_ar_OM; getFollowPageWords_ar_SA; getFollowPageWords_ar_TN; getFollowPageWords_az_AZ; @@ -548,6 +570,7 @@ getFollowPageWords_my_MM; getFollowPageWords_ne_NP; getFollowPageWords_nr_ZA; getFollowPageWords_nso_ZA; +getFollowPageWords_om_ET; getFollowPageWords_or_IN; getFollowPageWords_pa_IN; getFollowPageWords_rw_RW; @@ -566,6 +589,7 @@ getFollowPageWords_tk_TM; getFollowPageWords_tn_ZA; getFollowPageWords_tpi_PG; getFollowPageWords_ts_ZA; +getFollowPageWords_ug_CN; getFollowPageWords_uz_UZ; getFollowPageWords_ve_ZA; getFollowPageWords_vi_VN; @@ -582,6 +606,7 @@ getForbiddenCharacters_ak_GH; getForbiddenCharacters_am_ET; getForbiddenCharacters_ar_EG; getForbiddenCharacters_ar_LB; +getForbiddenCharacters_ar_OM; getForbiddenCharacters_ar_SA; getForbiddenCharacters_ar_TN; getForbiddenCharacters_az_AZ; @@ -620,6 +645,7 @@ getForbiddenCharacters_my_MM; getForbiddenCharacters_ne_NP; getForbiddenCharacters_nr_ZA; getForbiddenCharacters_nso_ZA; +getForbiddenCharacters_om_ET; getForbiddenCharacters_or_IN; getForbiddenCharacters_pa_IN; getForbiddenCharacters_rw_RW; @@ -638,6 +664,7 @@ getForbiddenCharacters_tk_TM; getForbiddenCharacters_tn_ZA; getForbiddenCharacters_tpi_PG; getForbiddenCharacters_ts_ZA; +getForbiddenCharacters_ug_CN; getForbiddenCharacters_uz_UZ; getForbiddenCharacters_ve_ZA; getForbiddenCharacters_vi_VN; @@ -654,6 +681,7 @@ getIndexAlgorithm_ak_GH; getIndexAlgorithm_am_ET; getIndexAlgorithm_ar_EG; getIndexAlgorithm_ar_LB; +getIndexAlgorithm_ar_OM; getIndexAlgorithm_ar_SA; getIndexAlgorithm_ar_TN; getIndexAlgorithm_az_AZ; @@ -692,6 +720,7 @@ getIndexAlgorithm_my_MM; getIndexAlgorithm_ne_NP; getIndexAlgorithm_nr_ZA; getIndexAlgorithm_nso_ZA; +getIndexAlgorithm_om_ET; getIndexAlgorithm_or_IN; getIndexAlgorithm_pa_IN; getIndexAlgorithm_rw_RW; @@ -710,6 +739,7 @@ getIndexAlgorithm_tk_TM; getIndexAlgorithm_tn_ZA; getIndexAlgorithm_tpi_PG; getIndexAlgorithm_ts_ZA; +getIndexAlgorithm_ug_CN; getIndexAlgorithm_uz_UZ; getIndexAlgorithm_ve_ZA; getIndexAlgorithm_vi_VN; @@ -726,6 +756,7 @@ getLCInfo_ak_GH; getLCInfo_am_ET; getLCInfo_ar_EG; getLCInfo_ar_LB; +getLCInfo_ar_OM; getLCInfo_ar_SA; getLCInfo_ar_TN; getLCInfo_az_AZ; @@ -764,6 +795,7 @@ getLCInfo_my_MM; getLCInfo_ne_NP; getLCInfo_nr_ZA; getLCInfo_nso_ZA; +getLCInfo_om_ET; getLCInfo_or_IN; getLCInfo_pa_IN; getLCInfo_rw_RW; @@ -782,6 +814,7 @@ getLCInfo_tk_TM; getLCInfo_tn_ZA; getLCInfo_tpi_PG; getLCInfo_ts_ZA; +getLCInfo_ug_CN; getLCInfo_uz_UZ; getLCInfo_ve_ZA; getLCInfo_vi_VN; @@ -798,6 +831,7 @@ getLocaleItem_ak_GH; getLocaleItem_am_ET; getLocaleItem_ar_EG; getLocaleItem_ar_LB; +getLocaleItem_ar_OM; getLocaleItem_ar_SA; getLocaleItem_ar_TN; getLocaleItem_az_AZ; @@ -836,6 +870,7 @@ getLocaleItem_my_MM; getLocaleItem_ne_NP; getLocaleItem_nr_ZA; getLocaleItem_nso_ZA; +getLocaleItem_om_ET; getLocaleItem_or_IN; getLocaleItem_pa_IN; getLocaleItem_rw_RW; @@ -854,6 +889,7 @@ getLocaleItem_tk_TM; getLocaleItem_tn_ZA; getLocaleItem_tpi_PG; getLocaleItem_ts_ZA; +getLocaleItem_ug_CN; getLocaleItem_uz_UZ; getLocaleItem_ve_ZA; getLocaleItem_vi_VN; @@ -870,6 +906,7 @@ getOutlineNumberingLevels_ak_GH; getOutlineNumberingLevels_am_ET; getOutlineNumberingLevels_ar_EG; getOutlineNumberingLevels_ar_LB; +getOutlineNumberingLevels_ar_OM; getOutlineNumberingLevels_ar_SA; getOutlineNumberingLevels_ar_TN; getOutlineNumberingLevels_az_AZ; @@ -908,6 +945,7 @@ getOutlineNumberingLevels_my_MM; getOutlineNumberingLevels_ne_NP; getOutlineNumberingLevels_nr_ZA; getOutlineNumberingLevels_nso_ZA; +getOutlineNumberingLevels_om_ET; getOutlineNumberingLevels_or_IN; getOutlineNumberingLevels_pa_IN; getOutlineNumberingLevels_rw_RW; @@ -926,6 +964,7 @@ getOutlineNumberingLevels_tk_TM; getOutlineNumberingLevels_tn_ZA; getOutlineNumberingLevels_tpi_PG; getOutlineNumberingLevels_ts_ZA; +getOutlineNumberingLevels_ug_CN; getOutlineNumberingLevels_uz_UZ; getOutlineNumberingLevels_ve_ZA; getOutlineNumberingLevels_vi_VN; @@ -942,6 +981,7 @@ getReservedWords_ak_GH; getReservedWords_am_ET; getReservedWords_ar_EG; getReservedWords_ar_LB; +getReservedWords_ar_OM; getReservedWords_ar_SA; getReservedWords_ar_TN; getReservedWords_az_AZ; @@ -980,6 +1020,7 @@ getReservedWords_my_MM; getReservedWords_ne_NP; getReservedWords_nr_ZA; getReservedWords_nso_ZA; +getReservedWords_om_ET; getReservedWords_or_IN; getReservedWords_pa_IN; getReservedWords_rw_RW; @@ -998,6 +1039,7 @@ getReservedWords_tk_TM; getReservedWords_tn_ZA; getReservedWords_tpi_PG; getReservedWords_ts_ZA; +getReservedWords_ug_CN; getReservedWords_uz_UZ; getReservedWords_ve_ZA; getReservedWords_vi_VN; @@ -1014,6 +1056,7 @@ getSearchOptions_ak_GH; getSearchOptions_am_ET; getSearchOptions_ar_EG; getSearchOptions_ar_LB; +getSearchOptions_ar_OM; getSearchOptions_ar_SA; getSearchOptions_ar_TN; getSearchOptions_az_AZ; @@ -1052,6 +1095,7 @@ getSearchOptions_my_MM; getSearchOptions_ne_NP; getSearchOptions_nr_ZA; getSearchOptions_nso_ZA; +getSearchOptions_om_ET; getSearchOptions_or_IN; getSearchOptions_pa_IN; getSearchOptions_rw_RW; @@ -1070,6 +1114,7 @@ getSearchOptions_tk_TM; getSearchOptions_tn_ZA; getSearchOptions_tpi_PG; getSearchOptions_ts_ZA; +getSearchOptions_ug_CN; getSearchOptions_uz_UZ; getSearchOptions_ve_ZA; getSearchOptions_vi_VN; @@ -1086,6 +1131,7 @@ getTransliterations_ak_GH; getTransliterations_am_ET; getTransliterations_ar_EG; getTransliterations_ar_LB; +getTransliterations_ar_OM; getTransliterations_ar_SA; getTransliterations_ar_TN; getTransliterations_az_AZ; @@ -1124,6 +1170,7 @@ getTransliterations_my_MM; getTransliterations_ne_NP; getTransliterations_nr_ZA; getTransliterations_nso_ZA; +getTransliterations_om_ET; getTransliterations_or_IN; getTransliterations_pa_IN; getTransliterations_rw_RW; @@ -1142,6 +1189,7 @@ getTransliterations_tk_TM; getTransliterations_tn_ZA; getTransliterations_tpi_PG; getTransliterations_ts_ZA; +getTransliterations_ug_CN; getTransliterations_uz_UZ; getTransliterations_ve_ZA; getTransliterations_vi_VN; @@ -1158,6 +1206,7 @@ getUnicodeScripts_ak_GH; getUnicodeScripts_am_ET; getUnicodeScripts_ar_EG; getUnicodeScripts_ar_LB; +getUnicodeScripts_ar_OM; getUnicodeScripts_ar_SA; getUnicodeScripts_ar_TN; getUnicodeScripts_az_AZ; @@ -1196,6 +1245,7 @@ getUnicodeScripts_my_MM; getUnicodeScripts_ne_NP; getUnicodeScripts_nr_ZA; getUnicodeScripts_nso_ZA; +getUnicodeScripts_om_ET; getUnicodeScripts_or_IN; getUnicodeScripts_pa_IN; getUnicodeScripts_rw_RW; @@ -1214,6 +1264,7 @@ getUnicodeScripts_tk_TM; getUnicodeScripts_tn_ZA; getUnicodeScripts_tpi_PG; getUnicodeScripts_ts_ZA; +getUnicodeScripts_ug_CN; getUnicodeScripts_uz_UZ; getUnicodeScripts_ve_ZA; getUnicodeScripts_vi_VN; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 3eca889e7ccc..9fc29c722fb2 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -76,6 +76,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_ar_LB.cxx \ $(MISC)$/localedata_ar_SA.cxx \ $(MISC)$/localedata_ar_TN.cxx \ + $(MISC)$/localedata_ast_ES.cxx \ $(MISC)$/localedata_az_AZ.cxx \ $(MISC)$/localedata_be_BY.cxx \ $(MISC)$/localedata_bg_BG.cxx \ @@ -193,6 +194,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_nr_ZA.cxx \ $(MISC)$/localedata_nso_ZA.cxx \ $(MISC)$/localedata_oc_FR.cxx \ + $(MISC)$/localedata_om_ET.cxx \ $(MISC)$/localedata_or_IN.cxx \ $(MISC)$/localedata_pa_IN.cxx \ $(MISC)$/localedata_pl_PL.cxx \ @@ -227,6 +229,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_tpi_PG.cxx \ $(MISC)$/localedata_tr_TR.cxx \ $(MISC)$/localedata_ts_ZA.cxx \ + $(MISC)$/localedata_ug_CN.cxx \ $(MISC)$/localedata_uk_UA.cxx \ $(MISC)$/localedata_uz_UZ.cxx \ $(MISC)$/localedata_ve_ZA.cxx \ @@ -323,6 +326,7 @@ DEF3NAME=$(SHL3TARGET) SHL3STDLIBS= $(LINK_LOCALEDATA_EN_LIB) SHL3DEPN=$(SHL1TARGETN) $(SHL2TARGETN) SHL3OBJS= \ + $(SLO)$/localedata_ast_ES.obj \ $(SLO)$/localedata_be_BY.obj \ $(SLO)$/localedata_bg_BG.obj \ $(SLO)$/localedata_br_FR.obj \ @@ -375,6 +379,7 @@ SHL3OBJS= \ $(SLO)$/localedata_pt_PT.obj \ $(SLO)$/localedata_ru_RU.obj \ $(SLO)$/localedata_ro_RO.obj \ + $(SLO)$/localedata_sc_IT.obj \ $(SLO)$/localedata_sh_ME.obj \ $(SLO)$/localedata_sh_RS.obj \ $(SLO)$/localedata_sh_YU.obj \ @@ -412,6 +417,7 @@ SHL4OBJS= \ $(SLO)$/localedata_am_ET.obj \ $(SLO)$/localedata_ar_EG.obj \ $(SLO)$/localedata_ar_LB.obj \ + $(SLO)$/localedata_ar_OM.obj \ $(SLO)$/localedata_ar_SA.obj \ $(SLO)$/localedata_ar_TN.obj \ $(SLO)$/localedata_az_AZ.obj \ @@ -450,6 +456,7 @@ SHL4OBJS= \ $(SLO)$/localedata_ne_NP.obj \ $(SLO)$/localedata_nr_ZA.obj \ $(SLO)$/localedata_nso_ZA.obj \ + $(SLO)$/localedata_om_ET.obj \ $(SLO)$/localedata_or_IN.obj \ $(SLO)$/localedata_pa_IN.obj \ $(SLO)$/localedata_rw_RW.obj \ @@ -468,6 +475,7 @@ SHL4OBJS= \ $(SLO)$/localedata_tn_ZA.obj \ $(SLO)$/localedata_tpi_PG.obj \ $(SLO)$/localedata_ts_ZA.obj \ + $(SLO)$/localedata_ug_CN.obj \ $(SLO)$/localedata_uz_UZ.obj \ $(SLO)$/localedata_ve_ZA.obj \ $(SLO)$/localedata_vi_VN.obj \ diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml index 236f1c8dbb09..ef3dd47c0dc6 100644 --- a/i18npool/source/localedata/data/oc_FR.xml +++ b/i18npool/source/localedata/data/oc_FR.xml @@ -18,7 +18,7 @@ <DecimalSeparator>,</DecimalSeparator> <TimeSeparator>:</TimeSeparator> <Time100SecSeparator>,</Time100SecSeparator> - <ListSeparator>:</ListSeparator> + <ListSeparator>;</ListSeparator> <LongDateDayOfWeekSeparator> </LongDateDayOfWeekSeparator> <LongDateDaySeparator>, </LongDateDaySeparator> <LongDateMonthSeparator> de </LongDateMonthSeparator> diff --git a/i18npool/source/localedata/data/om_ET.xml b/i18npool/source/localedata/data/om_ET.xml new file mode 100644 index 000000000000..88418fbb7ebb --- /dev/null +++ b/i18npool/source/localedata/data/om_ET.xml @@ -0,0 +1,358 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Locale SYSTEM "locale.dtd"> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> + <LC_INFO> + <Language> + <LangID>om</LangID> + <DefaultName>Oromo, West Central</DefaultName> + </Language> + <Country> + <CountryID>ET</CountryID> + <DefaultName>Ethiopia</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE unoid="generic"> + <Separators> + <DateSeparator>/</DateSeparator> + <ThousandSeparator>,</ThousandSeparator> + <DecimalSeparator>.</DecimalSeparator> + <TimeSeparator>:</TimeSeparator> + <Time100SecSeparator>.</Time100SecSeparator> + <ListSeparator>;</ListSeparator> + <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> + <LongDateDaySeparator>, </LongDateDaySeparator> + <LongDateMonthSeparator> </LongDateMonthSeparator> + <LongDateYearSeparator> </LongDateYearSeparator> + </Separators> + <Markers> + <QuotationStart>‘</QuotationStart> + <QuotationEnd>’</QuotationEnd> + <DoubleQuotationStart>“</DoubleQuotationStart> + <DoubleQuotationEnd>”</DoubleQuotationEnd> + </Markers> + <TimeAM>AM</TimeAM> + <TimePM>PM</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$Qar-0472]"> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>#,###.00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0.00E+00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0.00E+000</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> + <FormatCode>0%</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> + <FormatCode>0.00%</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> + <FormatCode>[CURRENCY]#,##0;([CURRENCY]#,##0)</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> + <FormatCode>[CURRENCY]#,##0.00;([CURRENCY]#,##0.00)</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> + <FormatCode>[CURRENCY]#,##0;[RED]([CURRENCY]#,##0)</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> + <FormatCode>[CURRENCY]#,##0.00;[RED]([CURRENCY]#,##0.00)</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> + <FormatCode>CCC#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#,##0.--;[RED]([CURRENCY]#,##0.--)</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>D/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNDD, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>DD/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>DD/MM/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D, MMMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> + <FormatCode>NN, DD/MMM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> + <FormatCode>NN, D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN, D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNND, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM/DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> + <FormatCode>HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> + <FormatCode>HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> + <FormatCode>HH:MM:SS AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> + <FormatCode>[HH]:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> + <FormatCode>MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> + <FormatCode>[HH]:MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>DD/MM/YY HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION> + <Collator default="true" unoid="alphanumeric"/> + <CollationOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </CollationOptions> + </LC_COLLATION> + <LC_SEARCH> + <SearchOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </SearchOptions> + </LC_SEARCH> + <LC_INDEX> + <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <FollowPageWord>Fl</FollowPageWord> + <FollowPageWord>Flt</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>Dil</DefaultAbbrvName> + <DefaultFullName>Dilbata</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>Wix</DefaultAbbrvName> + <DefaultFullName>Wiixata</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Kib</DefaultAbbrvName> + <DefaultFullName>Kibxata</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Rob</DefaultAbbrvName> + <DefaultFullName>Roobii</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>Kam</DefaultAbbrvName> + <DefaultFullName>Kamisa</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>Jim</DefaultAbbrvName> + <DefaultFullName>Jimaata</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>San</DefaultAbbrvName> + <DefaultFullName>Sanbat-Xiqqaa</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>Amj</DefaultAbbrvName> + <DefaultFullName>Amajjii</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>Gur</DefaultAbbrvName> + <DefaultFullName>Gurraandhala</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>Bit</DefaultAbbrvName> + <DefaultFullName>Bitootessa</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>Cam</DefaultAbbrvName> + <DefaultFullName>Caamsaa</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>Ebl</DefaultAbbrvName> + <DefaultFullName>Ebla</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>Wax</DefaultAbbrvName> + <DefaultFullName>Waxabajjii</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>Ado</DefaultAbbrvName> + <DefaultFullName>Adoolessa</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>Hag</DefaultAbbrvName> + <DefaultFullName>Hagayya </DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>Ful</DefaultAbbrvName> + <DefaultFullName>Fulbaana</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>Onk</DefaultAbbrvName> + <DefaultFullName>Onkoloolessa </DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>Sad</DefaultAbbrvName> + <DefaultFullName>Sadaasa</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>Mud</DefaultAbbrvName> + <DefaultFullName>Muddee</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>DKD</DefaultAbbrvName> + <DefaultFullName>Dhaloota Kiristoosiin Dura</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>DKB</DefaultAbbrvName> + <DefaultFullName>Dhaloota Kiristoosiin Booda</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>mon</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>ETB</CurrencyID> + <CurrencySymbol>Qar</CurrencySymbol> + <BankSymbol>ETB</BankSymbol> + <CurrencyName>Qarshii</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="IGNORE_CASE"/> + </LC_TRANSLITERATION> + <LC_MISC> + <ReservedWords> + <trueWord>Dhugaa</trueWord> + <falseWord>Soba</falseWord> + <quarter1Word>Bona</quarter1Word> + <quarter2Word>Arfaasaa</quarter2Word> + <quarter3Word>Ganna</quarter3Word> + <quarter4Word>Birraa</quarter4Word> + <aboveWord>Gubbaa</aboveWord> + <belowWord>Jala</belowWord> + <quarter1Abbreviation>Bn</quarter1Abbreviation> + <quarter2Abbreviation>Ar</quarter2Abbreviation> + <quarter3Abbreviation>Gn</quarter3Abbreviation> + <quarter4Abbreviation>Br</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel> + <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix="."/> + <NumberingLevel NumType="0" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="3" Prefix=" " Suffix="."/> + </LC_NumberingLevel> + <LC_OutLineNumberingLevel ref="en_US"/> +</Locale> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/ro_RO.xml b/i18npool/source/localedata/data/ro_RO.xml index b5033ce9bb27..ed92d9243cb6 100644 --- a/i18npool/source/localedata/data/ro_RO.xml +++ b/i18npool/source/localedata/data/ro_RO.xml @@ -1,380 +1,390 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Locale SYSTEM 'locale.dtd'> -<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.2"> -<LC_INFO> -<Language> -<LangID>ro</LangID> -<DefaultName>Romanian</DefaultName> -</Language> -<Country> -<CountryID>RO</CountryID> -<DefaultName>Romania</DefaultName> -</Country> -</LC_INFO> -<LC_CTYPE unoid="generic"> -<Separators> -<DateSeparator>.</DateSeparator> -<ThousandSeparator>.</ThousandSeparator> -<DecimalSeparator>,</DecimalSeparator> -<TimeSeparator>:</TimeSeparator> -<Time100SecSeparator>,</Time100SecSeparator> -<ListSeparator>;</ListSeparator> -<LongDateDayOfWeekSeparator> </LongDateDayOfWeekSeparator> -<LongDateDaySeparator> </LongDateDaySeparator> -<LongDateMonthSeparator> </LongDateMonthSeparator> -<LongDateYearSeparator> </LongDateYearSeparator> -</Separators> -<Markers> -<QuotationStart>‘</QuotationStart> -<QuotationEnd>’</QuotationEnd> -<DoubleQuotationStart>„</DoubleQuotationStart> -<DoubleQuotationEnd>”</DoubleQuotationEnd> -</Markers> -<TimeAM>AM</TimeAM> -<TimePM>PM</TimePM> -<MeasurementSystem>Metric</MeasurementSystem> -</LC_CTYPE> -<LC_FORMAT> -<FormatElement msgid="DateFormatskey1" default="true" type="short" usage="DATE" formatindex="18"> -<FormatCode>DD.MM.YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="28"> -<FormatCode>NN DD.MMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="34"> -<FormatCode>MM.YY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="35"> -<FormatCode>DD MMM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="36"> -<FormatCode>MMMM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="37"> -<FormatCode>QQ/YY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="21"> -<FormatCode>DD.MM.YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey8" default="true" type="medium" usage="DATE" formatindex="20"> -<FormatCode>DD.MM.YY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19"> -<FormatCode>NNNND MMMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey10" default="false" type="long" usage="DATE" formatindex="22"> -<FormatCode>D MMM YY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey11" default="false" type="long" usage="DATE" formatindex="23"> -<FormatCode>D MMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey12" default="false" type="long" usage="DATE" formatindex="25"> -<FormatCode>D MMMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey13" default="false" type="long" usage="DATE" formatindex="27"> -<FormatCode>NN D MMM YY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey14" default="false" type="long" usage="DATE" formatindex="29"> -<FormatCode>NN D MMMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30"> -<FormatCode>NNNND MMMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="24"> -<FormatCode>D. MMM. YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="26"> -<FormatCode>D. MMMM YYYY</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31"> -<FormatCode>MM-DD</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey19" default="false" type="medium" usage="DATE" formatindex="32"> -<FormatCode>YY-MM-DD</FormatCode> -<DefaultName>ISO 8601</DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey20" default="false" type="medium" usage="DATE" formatindex="33"> -<FormatCode>YYYY-MM-DD</FormatCode> -<DefaultName>ISO 8601</DefaultName> -</FormatElement> -<FormatElement msgid="DateFormatskey21" default="false" type="medium" usage="DATE" formatindex="38"> -<FormatCode>WW</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey1" default="true" type="short" usage="TIME" formatindex="39"> -<FormatCode>HH:MM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey2" default="true" type="medium" usage="TIME" formatindex="40"> -<FormatCode>HH:MM:SS</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey3" default="false" type="short" usage="TIME" formatindex="41"> -<FormatCode>HH:MM AM/PM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey4" default="false" type="medium" usage="TIME" formatindex="42"> -<FormatCode>HH:MM:SS AM/PM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> -<FormatCode>[HH]:MM:SS</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> -<FormatCode>MM:SS,00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> -<FormatCode>[HH]:MM:SS,00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> -<FormatCode>DD.MM.YY HH:MM</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> -<FormatCode>DD.MM.YYYY HH:MM:SS</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> -<FormatCode>Standard</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> -<FormatCode>0</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> -<FormatCode>0,00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> -<FormatCode>#.##0</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> -<FormatCode>#.##0,00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> -<FormatCode>#.###,00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> -<FormatCode>#.##0 [$lei-418];-#.##0 [$lei-418]</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> -<FormatCode>#.##0,00 [$lei-418];-#.##0,00 [$lei-418]</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> -<FormatCode>#.##0 [$lei-418];[RED]-#.##0 [$lei-418]</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> -<FormatCode>#.##0,00 [$lei-418];[RED]-#.##0,00 [$lei-418]</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> -<FormatCode>#.##0,00 CCC</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> -<FormatCode>#.##0,-- [$lei-418];[RED]-#.##0,-- [$lei-418]</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> -<FormatCode>0%</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> -<FormatCode>0,00%</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> -<FormatCode>0,00E+000</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -<FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> -<FormatCode>0,00E+00</FormatCode> -<DefaultName></DefaultName> -</FormatElement> -</LC_FORMAT> -<LC_COLLATION ref="en_US"/> -<LC_SEARCH ref="en_US"/> -<LC_INDEX> -<IndexKey unoid="alphanumeric" default="true" phonetic="false">A Ă Â B-I Î J-S Ş T Ţ U-Z</IndexKey> -<UnicodeScript>0</UnicodeScript> -<UnicodeScript>1</UnicodeScript> -<UnicodeScript>2</UnicodeScript> -<FollowPageWord>p.</FollowPageWord> -<FollowPageWord>pp.</FollowPageWord> -</LC_INDEX> -<LC_CALENDAR> -<Calendar unoid="gregorian" default="true"> -<DaysOfWeek> -<Day> -<DayID>sun</DayID> -<DefaultAbbrvName>D</DefaultAbbrvName> -<DefaultFullName>duminică</DefaultFullName> -</Day> -<Day> -<DayID>mon</DayID> -<DefaultAbbrvName>L</DefaultAbbrvName> -<DefaultFullName>luni</DefaultFullName> -</Day> -<Day> -<DayID>tue</DayID> -<DefaultAbbrvName>Ma</DefaultAbbrvName> -<DefaultFullName>marţi</DefaultFullName> -</Day> -<Day> -<DayID>wed</DayID> -<DefaultAbbrvName>Mi</DefaultAbbrvName> -<DefaultFullName>miercuri</DefaultFullName> -</Day> -<Day> -<DayID>thu</DayID> -<DefaultAbbrvName>J</DefaultAbbrvName> -<DefaultFullName>joi</DefaultFullName> -</Day> -<Day> -<DayID>fri</DayID> -<DefaultAbbrvName>V</DefaultAbbrvName> -<DefaultFullName>vineri</DefaultFullName> -</Day> -<Day> -<DayID>sat</DayID> -<DefaultAbbrvName>S</DefaultAbbrvName> -<DefaultFullName>sâmbătă</DefaultFullName> -</Day> -</DaysOfWeek> -<MonthsOfYear> -<Month> -<MonthID>jan</MonthID> -<DefaultAbbrvName>ian</DefaultAbbrvName> -<DefaultFullName>ianuarie</DefaultFullName> -</Month> -<Month> -<MonthID>feb</MonthID> -<DefaultAbbrvName>febr</DefaultAbbrvName> -<DefaultFullName>februarie</DefaultFullName> -</Month> -<Month> -<MonthID>mar</MonthID> -<DefaultAbbrvName>mar</DefaultAbbrvName> -<DefaultFullName>martie</DefaultFullName> -</Month> -<Month> -<MonthID>apr</MonthID> -<DefaultAbbrvName>apr</DefaultAbbrvName> -<DefaultFullName>aprilie</DefaultFullName> -</Month> -<Month> -<MonthID>may</MonthID> -<DefaultAbbrvName>mai</DefaultAbbrvName> -<DefaultFullName>mai</DefaultFullName> -</Month> -<Month> -<MonthID>jun</MonthID> -<DefaultAbbrvName>iun</DefaultAbbrvName> -<DefaultFullName>iunie</DefaultFullName> -</Month> -<Month> -<MonthID>jul</MonthID> -<DefaultAbbrvName>iul</DefaultAbbrvName> -<DefaultFullName>iulie</DefaultFullName> -</Month> -<Month> -<MonthID>aug</MonthID> -<DefaultAbbrvName>aug</DefaultAbbrvName> -<DefaultFullName>august</DefaultFullName> -</Month> -<Month> -<MonthID>sep</MonthID> -<DefaultAbbrvName>sept</DefaultAbbrvName> -<DefaultFullName>septembrie</DefaultFullName> -</Month> -<Month> -<MonthID>oct</MonthID> -<DefaultAbbrvName>oct</DefaultAbbrvName> -<DefaultFullName>octombrie</DefaultFullName> -</Month> -<Month> -<MonthID>nov</MonthID> -<DefaultAbbrvName>nov</DefaultAbbrvName> -<DefaultFullName>noiembrie</DefaultFullName> -</Month> -<Month> -<MonthID>dec</MonthID> -<DefaultAbbrvName>dec</DefaultAbbrvName> -<DefaultFullName>decembrie</DefaultFullName> -</Month> -</MonthsOfYear> -<Eras> -<Era> -<EraID>bc</EraID> -<DefaultAbbrvName>î.Hr.</DefaultAbbrvName> -<DefaultFullName>î.Hr.</DefaultFullName> -</Era> -<Era> -<EraID>ad</EraID> -<DefaultAbbrvName>d.Hr.</DefaultAbbrvName> -<DefaultFullName>d.Hr.</DefaultFullName> -</Era> -</Eras> -<StartDayOfWeek> -<DayID>mon</DayID> -</StartDayOfWeek> -<MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> -</Calendar> -</LC_CALENDAR> -<LC_CURRENCY> -<Currency default="true" usedInCompatibleFormatCodes="true"> -<CurrencyID>ROL</CurrencyID> -<CurrencySymbol>lei</CurrencySymbol> -<BankSymbol>ROL</BankSymbol> -<CurrencyName>Leu</CurrencyName> -<DecimalPlaces>2</DecimalPlaces> -</Currency> -</LC_CURRENCY> -<LC_TRANSLITERATION ref="en_US"/> -<LC_MISC> -<ReservedWords> -<trueWord>adevărat</trueWord> -<falseWord>fals</falseWord> -<quarter1Word>trimestrul 1</quarter1Word> -<quarter2Word>trimestrul 2</quarter2Word> -<quarter3Word>trimestrul 3</quarter3Word> -<quarter4Word>trimestrul 4</quarter4Word> -<aboveWord>deasupra</aboveWord> -<belowWord>sub</belowWord> -<quarter1Abbreviation>T1</quarter1Abbreviation> -<quarter2Abbreviation>T2</quarter2Abbreviation> -<quarter3Abbreviation>T3</quarter3Abbreviation> -<quarter4Abbreviation>T4</quarter4Abbreviation> -</ReservedWords> -</LC_MISC> -<LC_NumberingLevel ref="en_US"/> -<LC_OutLineNumberingLevel ref="en_US"/> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.3"> + <LC_INFO> + <Language> + <LangID>ro</LangID> + <DefaultName>Romanian</DefaultName> + </Language> + <Country> + <CountryID>RO</CountryID> + <DefaultName>Romania</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE unoid="generic"> + <Separators> + <DateSeparator>.</DateSeparator> + <ThousandSeparator>.</ThousandSeparator> + <DecimalSeparator>,</DecimalSeparator> + <TimeSeparator>:</TimeSeparator> + <Time100SecSeparator>,</Time100SecSeparator> + <ListSeparator>;</ListSeparator> + <LongDateDayOfWeekSeparator> </LongDateDayOfWeekSeparator> + <LongDateDaySeparator> </LongDateDaySeparator> + <LongDateMonthSeparator> </LongDateMonthSeparator> + <LongDateYearSeparator> </LongDateYearSeparator> + </Separators> + <Markers> + <QuotationStart>‘</QuotationStart> + <QuotationEnd>’</QuotationEnd> + <DoubleQuotationStart>„</DoubleQuotationStart> + <DoubleQuotationEnd>”</DoubleQuotationEnd> + </Markers> + <TimeAM>AM</TimeAM> + <TimePM>PM</TimePM> + <MeasurementSystem>Metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT> + <FormatElement msgid="DateFormatskey1" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>DD.MM.YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="28"> + <FormatCode>NN DD.MMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM.YY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>DD MMM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ/YY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>DD.MM.YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>DD.MM.YY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNND MMMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>D MMM YY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>D MMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>D MMMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey13" default="false" type="long" usage="DATE" formatindex="27"> + <FormatCode>NN D MMM YY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN D MMMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNND MMMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D. MMM. YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D. MMMM YYYY</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM-DD</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey1" default="true" type="short" usage="TIME" formatindex="39"> + <FormatCode>HH:MM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey2" default="true" type="medium" usage="TIME" formatindex="40"> + <FormatCode>HH:MM:SS</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey3" default="false" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="false" type="medium" usage="TIME" formatindex="42"> + <FormatCode>HH:MM:SS AM/PM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> + <FormatCode>[HH]:MM:SS</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> + <FormatCode>MM:SS,00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> + <FormatCode>[HH]:MM:SS,00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>DD.MM.YY HH:MM</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>DD.MM.YYYY HH:MM:SS</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>Standard</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>0</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>0,00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>#.##0</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>#.##0,00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>#.###,00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> + <FormatCode>#.##0 [$lei-418];-#.##0 [$lei-418]</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> + <FormatCode>#.##0,00 [$lei-418];-#.##0,00 [$lei-418]</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> + <FormatCode>#.##0 [$lei-418];[RED]-#.##0 [$lei-418]</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> + <FormatCode>#.##0,00 [$lei-418];[RED]-#.##0,00 [$lei-418]</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> + <FormatCode>#.##0,00 CCC</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>#.##0,-- [$lei-418];[RED]-#.##0,-- [$lei-418]</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> + <FormatCode>0%</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> + <FormatCode>0,00%</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0,00E+000</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0,00E+00</FormatCode> + <DefaultName></DefaultName> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION ref="en_US"/> + <LC_SEARCH ref="en_US"/> + <LC_INDEX> + <IndexKey unoid="alphanumeric" default="true" phonetic="false">A Ă Â B-I Î J-S Ş T Ţ U-Z</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <UnicodeScript>2</UnicodeScript> + <FollowPageWord>p.</FollowPageWord> + <FollowPageWord>pp.</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>D</DefaultAbbrvName> + <DefaultFullName>duminică</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>L</DefaultAbbrvName> + <DefaultFullName>luni</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Ma</DefaultAbbrvName> + <DefaultFullName>marţi</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Mi</DefaultAbbrvName> + <DefaultFullName>miercuri</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>J</DefaultAbbrvName> + <DefaultFullName>joi</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>V</DefaultAbbrvName> + <DefaultFullName>vineri</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>S</DefaultAbbrvName> + <DefaultFullName>sâmbătă</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>ian</DefaultAbbrvName> + <DefaultFullName>ianuarie</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>febr</DefaultAbbrvName> + <DefaultFullName>februarie</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>mar</DefaultAbbrvName> + <DefaultFullName>martie</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>apr</DefaultAbbrvName> + <DefaultFullName>aprilie</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>mai</DefaultAbbrvName> + <DefaultFullName>mai</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>iun</DefaultAbbrvName> + <DefaultFullName>iunie</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>iul</DefaultAbbrvName> + <DefaultFullName>iulie</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>aug</DefaultAbbrvName> + <DefaultFullName>august</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>sept</DefaultAbbrvName> + <DefaultFullName>septembrie</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>oct</DefaultAbbrvName> + <DefaultFullName>octombrie</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>nov</DefaultAbbrvName> + <DefaultFullName>noiembrie</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>dec</DefaultAbbrvName> + <DefaultFullName>decembrie</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>î.Hr.</DefaultAbbrvName> + <DefaultFullName>î.Hr.</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>d.Hr.</DefaultAbbrvName> + <DefaultFullName>d.Hr.</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>mon</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>RON</CurrencyID> + <CurrencySymbol>lei</CurrencySymbol> + <BankSymbol>RON</BankSymbol> + <CurrencyName>Leu</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + <Currency default="false" usedInCompatibleFormatCodes="false" legacyOnly="true"> + <!-- legacyOnly to avoid the duplicated listing in the number formatter + dialog because of the identical CurrencySymbol, which also confuses + the currency listbox selection mechanism. --> + <CurrencyID>ROL</CurrencyID> + <CurrencySymbol>lei</CurrencySymbol> + <BankSymbol>ROL</BankSymbol> + <CurrencyName>Leu</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION ref="en_US"/> + <LC_MISC> + <ReservedWords> + <trueWord>adevărat</trueWord> + <falseWord>fals</falseWord> + <quarter1Word>trimestrul 1</quarter1Word> + <quarter2Word>trimestrul 2</quarter2Word> + <quarter3Word>trimestrul 3</quarter3Word> + <quarter4Word>trimestrul 4</quarter4Word> + <aboveWord>deasupra</aboveWord> + <belowWord>sub</belowWord> + <quarter1Abbreviation>T1</quarter1Abbreviation> + <quarter2Abbreviation>T2</quarter2Abbreviation> + <quarter3Abbreviation>T3</quarter3Abbreviation> + <quarter4Abbreviation>T4</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel ref="en_US"/> + <LC_OutLineNumberingLevel ref="en_US"/> </Locale> diff --git a/i18npool/source/localedata/data/sc_IT.xml b/i18npool/source/localedata/data/sc_IT.xml new file mode 100644 index 000000000000..81b446995891 --- /dev/null +++ b/i18npool/source/localedata/data/sc_IT.xml @@ -0,0 +1,358 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE Locale SYSTEM 'locale.dtd'> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> +<LC_INFO> +<Language> +<LangID>sc</LangID> +<DefaultName>Sardinian</DefaultName> +</Language> +<Country> +<CountryID>IT</CountryID> +<DefaultName>Italy</DefaultName> +</Country> +</LC_INFO> +<LC_CTYPE unoid="generic"> +<Separators> +<DateSeparator>/</DateSeparator> +<ThousandSeparator>,</ThousandSeparator> +<DecimalSeparator>.</DecimalSeparator> +<TimeSeparator>:</TimeSeparator> +<Time100SecSeparator>.</Time100SecSeparator> +<ListSeparator>;</ListSeparator> +<LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> +<LongDateDaySeparator>, </LongDateDaySeparator> +<LongDateMonthSeparator> </LongDateMonthSeparator> +<LongDateYearSeparator> </LongDateYearSeparator> +</Separators> +<Markers> +<QuotationStart>‘</QuotationStart> +<QuotationEnd>’</QuotationEnd> +<DoubleQuotationStart>“</DoubleQuotationStart> +<DoubleQuotationEnd>”</DoubleQuotationEnd> +</Markers> +<TimeAM>a.m.</TimeAM> +<TimePM>p.m.</TimePM> +<MeasurementSystem>metric</MeasurementSystem> +</LC_CTYPE> +<LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-627]"> +<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> +<FormatCode>General</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> +<FormatCode>0</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> +<FormatCode>0.00</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> +<FormatCode>#,##0</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> +<FormatCode>#,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> +<FormatCode>#,###.00</FormatCode> +</FormatElement> +<FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> +<FormatCode>0.00E+00</FormatCode> +</FormatElement> +<FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> +<FormatCode>0.00E+000</FormatCode> +</FormatElement> +<FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> +<FormatCode>0%</FormatCode> +</FormatElement> +<FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> +<FormatCode>0.00%</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> +<FormatCode>[CURRENCY] #,##0;-[CURRENCY] #,##0</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> +<FormatCode>[CURRENCY] #,##0.00;-[CURRENCY] #,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> +<FormatCode>[CURRENCY] #,##0;[RED]-[CURRENCY] #,##0</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> +<FormatCode>[CURRENCY] #,##0.00;[RED]-[CURRENCY] #,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> +<FormatCode>CCC #,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> +<FormatCode>[CURRENCY] #,##0.--;[RED]-[CURRENCY] #,##0.--</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> +<FormatCode>D/MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> +<FormatCode>NNNNDD, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> +<FormatCode>DD/MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> +<FormatCode>DD/MM/YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> +<FormatCode>D, MMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> +<FormatCode>D, MMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> +<FormatCode>D, MMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> +<FormatCode>D, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> +<FormatCode>D, MMMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> +<FormatCode>NN, DD/MMM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> +<FormatCode>NN, D, MMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> +<FormatCode>NN, D, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> +<FormatCode>NNNND, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> +<FormatCode>MM/DD</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> +<FormatCode>YY-MM-DD</FormatCode> +<DefaultName>ISO 8601</DefaultName> +</FormatElement> +<FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> +<FormatCode>YYYY-MM-DD</FormatCode> +<DefaultName>ISO 8601</DefaultName> +</FormatElement> +<FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> +<FormatCode>MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> +<FormatCode>MMM/DD</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> +<FormatCode>MMMM</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> +<FormatCode>QQ YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> +<FormatCode>WW</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> +<FormatCode>HH:MM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> +<FormatCode>HH:MM:SS</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> +<FormatCode>HH:MM AM/PM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> +<FormatCode>HH:MM:SS AM/PM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> +<FormatCode>[HH]:MM:SS</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> +<FormatCode>MM:SS.00</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> +<FormatCode>[HH]:MM:SS.00</FormatCode> +</FormatElement> +<FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> +<FormatCode>DD/MM/YY HH:MM</FormatCode> +</FormatElement> +<FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> +<FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> +</FormatElement> +</LC_FORMAT> +<LC_COLLATION> +<Collator default="true" unoid="alphanumeric"/> +<CollationOptions> +<TransliterationModules>IGNORE_CASE</TransliterationModules> +</CollationOptions> +</LC_COLLATION> +<LC_SEARCH> +<SearchOptions> +<TransliterationModules>IGNORE_CASE</TransliterationModules> +</SearchOptions> +</LC_SEARCH> +<LC_INDEX> +<IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z</IndexKey> +<UnicodeScript>0</UnicodeScript> +<UnicodeScript>1</UnicodeScript> +<FollowPageWord>s.</FollowPageWord> +<FollowPageWord>ss.</FollowPageWord> +</LC_INDEX> +<LC_CALENDAR> +<Calendar unoid="gregorian" default="true"> +<DaysOfWeek> +<Day> +<DayID>sun</DayID> +<DefaultAbbrvName>Dom</DefaultAbbrvName> +<DefaultFullName>Domìniga</DefaultFullName> +</Day> +<Day> +<DayID>mon</DayID> +<DefaultAbbrvName>Lun</DefaultAbbrvName> +<DefaultFullName>Lunis</DefaultFullName> +</Day> +<Day> +<DayID>tue</DayID> +<DefaultAbbrvName>Mar</DefaultAbbrvName> +<DefaultFullName>Martis</DefaultFullName> +</Day> +<Day> +<DayID>wed</DayID> +<DefaultAbbrvName>Mer</DefaultAbbrvName> +<DefaultFullName>Mèrcuris</DefaultFullName> +</Day> +<Day> +<DayID>thu</DayID> +<DefaultAbbrvName>Gio</DefaultAbbrvName> +<DefaultFullName>Giòvia</DefaultFullName> +</Day> +<Day> +<DayID>fri</DayID> +<DefaultAbbrvName>Che</DefaultAbbrvName> +<DefaultFullName>Chenàbura</DefaultFullName> +</Day> +<Day> +<DayID>sat</DayID> +<DefaultAbbrvName>Sab</DefaultAbbrvName> +<DefaultFullName>Sàbadu</DefaultFullName> +</Day> +</DaysOfWeek> +<MonthsOfYear> +<Month> +<MonthID>jan</MonthID> +<DefaultAbbrvName>Ghe</DefaultAbbrvName> +<DefaultFullName>Ghennàrgiu</DefaultFullName> +</Month> +<Month> +<MonthID>feb</MonthID> +<DefaultAbbrvName>Fre</DefaultAbbrvName> +<DefaultFullName>Freàrgiu</DefaultFullName> +</Month> +<Month> +<MonthID>mar</MonthID> +<DefaultAbbrvName>Mar</DefaultAbbrvName> +<DefaultFullName>Martzu</DefaultFullName> +</Month> +<Month> +<MonthID>apr</MonthID> +<DefaultAbbrvName>Abr</DefaultAbbrvName> +<DefaultFullName>Abrile</DefaultFullName> +</Month> +<Month> +<MonthID>may</MonthID> +<DefaultAbbrvName>Maj</DefaultAbbrvName> +<DefaultFullName>Maju</DefaultFullName> +</Month> +<Month> +<MonthID>jun</MonthID> +<DefaultAbbrvName>Làm</DefaultAbbrvName> +<DefaultFullName>Làmpadas</DefaultFullName> +</Month> +<Month> +<MonthID>jul</MonthID> +<DefaultAbbrvName>Trì</DefaultAbbrvName> +<DefaultFullName>Trìulas</DefaultFullName> +</Month> +<Month> +<MonthID>aug</MonthID> +<DefaultAbbrvName>Aus</DefaultAbbrvName> +<DefaultFullName>Austu</DefaultFullName> +</Month> +<Month> +<MonthID>sep</MonthID> +<DefaultAbbrvName>Cab</DefaultAbbrvName> +<DefaultFullName>Cabudanni</DefaultFullName> +</Month> +<Month> +<MonthID>oct</MonthID> +<DefaultAbbrvName>Sga</DefaultAbbrvName> +<DefaultFullName>Santugaine</DefaultFullName> +</Month> +<Month> +<MonthID>nov</MonthID> +<DefaultAbbrvName>San</DefaultAbbrvName> +<DefaultFullName>Santandria</DefaultFullName> +</Month> +<Month> +<MonthID>dec</MonthID> +<DefaultAbbrvName>Nad</DefaultAbbrvName> +<DefaultFullName>Nadale</DefaultFullName> +</Month> +</MonthsOfYear> +<Eras> +<Era> +<EraID>bc</EraID> +<DefaultAbbrvName>a.C.</DefaultAbbrvName> +<DefaultFullName>in antis de Cristos</DefaultFullName> +</Era> +<Era> +<EraID>ad</EraID> +<DefaultAbbrvName>p.C.</DefaultAbbrvName> +<DefaultFullName>a pustis de Cristos</DefaultFullName> +</Era> +</Eras> +<StartDayOfWeek> +<DayID>mon</DayID> +</StartDayOfWeek> +<MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> +</Calendar> +</LC_CALENDAR> +<LC_CURRENCY> +<Currency default="true" usedInCompatibleFormatCodes="true"> +<CurrencyID>EUR</CurrencyID> +<CurrencySymbol>€</CurrencySymbol> +<BankSymbol>EUR</BankSymbol> +<CurrencyName>èuro</CurrencyName> +<DecimalPlaces>2</DecimalPlaces> +</Currency> +</LC_CURRENCY> +<LC_TRANSLITERATION> +<Transliteration unoid="LOWERCASE_UPPERCASE"/> +<Transliteration unoid="UPPERCASE_LOWERCASE"/> +<Transliteration unoid="IGNORE_CASE"/> +</LC_TRANSLITERATION> +<LC_MISC> +<ReservedWords> +<trueWord>Beru</trueWord> +<falseWord>Farsu</falseWord> +<quarter1Word>Cuartu 1</quarter1Word> +<quarter2Word>Cuartu 2</quarter2Word> +<quarter3Word>Cuartu 3</quarter3Word> +<quarter4Word>Cuartu 4</quarter4Word> +<aboveWord>Subra</aboveWord> +<belowWord>Suta</belowWord> +<quarter1Abbreviation>C.tu 1</quarter1Abbreviation> +<quarter2Abbreviation>C.tu 2</quarter2Abbreviation> +<quarter3Abbreviation>C.tu 3</quarter3Abbreviation> +<quarter4Abbreviation>C.tu 4</quarter4Abbreviation> +</ReservedWords> +</LC_MISC> +<LC_NumberingLevel> +<NumberingLevel NumType="4" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="4" Prefix=" " Suffix="."/> +<NumberingLevel NumType="4" Prefix="(" Suffix=")"/> +<NumberingLevel NumType="2" Prefix=" " Suffix="."/> +<NumberingLevel NumType="0" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="1" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="1" Prefix="(" Suffix=")"/> +<NumberingLevel NumType="3" Prefix=" " Suffix="."/> +</LC_NumberingLevel> +<LC_OutLineNumberingLevel ref="en_US"/> +</Locale> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml index f5d666ec7e5a..981cb54aff3e 100644 --- a/i18npool/source/localedata/data/so_SO.xml +++ b/i18npool/source/localedata/data/so_SO.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE Locale SYSTEM 'locale.dtd'> -<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.1"> <LC_INFO> <Language> <LangID>so</LangID> @@ -13,12 +13,12 @@ </LC_INFO> <LC_CTYPE unoid="generic"> <Separators> - <DateSeparator>.</DateSeparator> - <ThousandSeparator> </ThousandSeparator> + <DateSeparator>/</DateSeparator> + <ThousandSeparator>,</ThousandSeparator> <DecimalSeparator>.</DecimalSeparator> <TimeSeparator>:</TimeSeparator> <Time100SecSeparator>.</Time100SecSeparator> - <ListSeparator>,</ListSeparator> + <ListSeparator>;</ListSeparator> <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> <LongDateDaySeparator>, </LongDateDaySeparator> <LongDateMonthSeparator> </LongDateMonthSeparator> @@ -30,11 +30,11 @@ <DoubleQuotationStart>‘</DoubleQuotationStart> <DoubleQuotationEnd>’</DoubleQuotationEnd> </Markers> - <TimeAM>AM</TimeAM> - <TimePM>PM</TimePM> + <TimeAM>XH</TimeAM> + <TimePM>XD</TimePM> <MeasurementSystem>metric</MeasurementSystem> </LC_CTYPE> - <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$So. Sh.-477]"> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$Ssh-477]"> <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> <FormatCode>General</FormatCode> </FormatElement> @@ -45,13 +45,13 @@ <FormatCode>0.00</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> - <FormatCode># ##0</FormatCode> + <FormatCode>#,##0</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> - <FormatCode># ##0.00</FormatCode> + <FormatCode>#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> - <FormatCode># ###.00</FormatCode> + <FormatCode>#,###.00</FormatCode> </FormatElement> <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> <FormatCode>0.00E+00</FormatCode> @@ -66,34 +66,34 @@ <FormatCode>0.00%</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> - <FormatCode># ##0 [CURRENCY];-# ##0 [CURRENCY]</FormatCode> + <FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> - <FormatCode># ##0.00 [CURRENCY];-# ##0.00 [CURRENCY]</FormatCode> + <FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> - <FormatCode># ##0 [CURRENCY];[RED]-# ##0 [CURRENCY]</FormatCode> + <FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> - <FormatCode># ##0.00 [CURRENCY];[RED]-# ##0.00 [CURRENCY]</FormatCode> + <FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> - <FormatCode># ##0.00CCC</FormatCode> + <FormatCode>CCC#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> - <FormatCode># ##0.-- [CURRENCY];[RED]-# ##0.-- [CURRENCY]</FormatCode> + <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> - <FormatCode>D.MM.YY</FormatCode> + <FormatCode>D/MM/YY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> <FormatCode>NNNNDD, MMMM YYYY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> - <FormatCode>DD.MM.YY</FormatCode> + <FormatCode>DD/MM/YY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> - <FormatCode>DD.MM.YYYY</FormatCode> + <FormatCode>DD/MM/YYYY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> <FormatCode>D, MMM YY</FormatCode> @@ -111,7 +111,7 @@ <FormatCode>D, MMMM YY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> - <FormatCode>NN, DD.MMM.YY</FormatCode> + <FormatCode>NN, DD/MMM/YY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> <FormatCode>NN, D, MMM YY</FormatCode> @@ -123,7 +123,7 @@ <FormatCode>NNNND, MMMM YYYY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> - <FormatCode>MM.DD</FormatCode> + <FormatCode>MM/DD</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> <FormatCode>YY-MM-DD</FormatCode> @@ -134,10 +134,10 @@ <DefaultName>ISO 8601</DefaultName> </FormatElement> <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> - <FormatCode>MM.YY</FormatCode> + <FormatCode>MM/YY</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> - <FormatCode>MMM.DD</FormatCode> + <FormatCode>MMM/DD</FormatCode> </FormatElement> <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> <FormatCode>MMMM</FormatCode> @@ -170,10 +170,10 @@ <FormatCode>[HH]:MM:SS.00</FormatCode> </FormatElement> <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> - <FormatCode>DD.MM.YY HH:MM</FormatCode> + <FormatCode>DD/MM/YY HH:MM</FormatCode> </FormatElement> <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> - <FormatCode>DD.MM.YYYY HH:MM:SS AM/PM</FormatCode> + <FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> </FormatElement> </LC_FORMAT> <LC_COLLATION> @@ -191,15 +191,15 @@ <IndexKey phonetic="false" default="true" unoid="alphanumeric">A-Z</IndexKey> <UnicodeScript>0</UnicodeScript> <UnicodeScript>1</UnicodeScript> - <FollowPageWord>bg.</FollowPageWord> - <FollowPageWord>bgg.</FollowPageWord> + <FollowPageWord>bg.s</FollowPageWord> + <FollowPageWord>bgg.s</FollowPageWord> </LC_INDEX> <LC_CALENDAR> <Calendar unoid="gregorian" default="true"> <DaysOfWeek> <Day> <DayID>sun</DayID> - <DefaultAbbrvName>Axd</DefaultAbbrvName> + <DefaultAbbrvName>Axa</DefaultAbbrvName> <DefaultFullName>Axad</DefaultFullName> </Day> <Day> @@ -215,7 +215,7 @@ <Day> <DayID>wed</DayID> <DefaultAbbrvName>Arb</DefaultAbbrvName> - <DefaultFullName>Arbaco</DefaultFullName> + <DefaultFullName>Arboco</DefaultFullName> </Day> <Day> <DayID>thu</DayID> @@ -247,7 +247,7 @@ <Month> <MonthID>mar</MonthID> <DefaultAbbrvName>Mar</DefaultAbbrvName> - <DefaultFullName>Maarso</DefaultFullName> + <DefaultFullName>Marso</DefaultFullName> </Month> <Month> <MonthID>apr</MonthID> @@ -256,18 +256,18 @@ </Month> <Month> <MonthID>may</MonthID> - <DefaultAbbrvName>Ma</DefaultAbbrvName> - <DefaultFullName>Maajo</DefaultFullName> + <DefaultAbbrvName>Maj</DefaultAbbrvName> + <DefaultFullName>Majo</DefaultFullName> </Month> <Month> <MonthID>jun</MonthID> <DefaultAbbrvName>Jun</DefaultAbbrvName> - <DefaultFullName>Juun</DefaultFullName> + <DefaultFullName>Junyo</DefaultFullName> </Month> <Month> <MonthID>jul</MonthID> - <DefaultAbbrvName>Lul</DefaultAbbrvName> - <DefaultFullName>Luulyo</DefaultFullName> + <DefaultAbbrvName>Jul</DefaultAbbrvName> + <DefaultFullName>Julaayo</DefaultFullName> </Month> <Month> <MonthID>aug</MonthID> @@ -277,7 +277,7 @@ <Month> <MonthID>sep</MonthID> <DefaultAbbrvName>Seb</DefaultAbbrvName> - <DefaultFullName>Sebteembar</DefaultFullName> + <DefaultFullName>Sebtembar </DefaultFullName> </Month> <Month> <MonthID>oct</MonthID> @@ -292,19 +292,19 @@ <Month> <MonthID>dec</MonthID> <DefaultAbbrvName>Dis</DefaultAbbrvName> - <DefaultFullName>Diseembar</DefaultFullName> + <DefaultFullName>Disembar</DefaultFullName> </Month> </MonthsOfYear> <Eras> <Era> <EraID>bc</EraID> - <DefaultAbbrvName>CD</DefaultAbbrvName> - <DefaultFullName>N. Ciise ka hor (CS)</DefaultFullName> + <DefaultAbbrvName>CH</DefaultAbbrvName> + <DefaultFullName>Ciise Hortiis</DefaultFullName> </Era> <Era> <EraID>ad</EraID> - <DefaultAbbrvName>AD</DefaultAbbrvName> - <DefaultFullName>N. Ciise Ka dib (CS)</DefaultFullName> + <DefaultAbbrvName>CD</DefaultAbbrvName> + <DefaultFullName>Ciise Dabadiis</DefaultFullName> </Era> </Eras> <StartDayOfWeek> @@ -316,6 +316,13 @@ <LC_CURRENCY> <Currency default="true" usedInCompatibleFormatCodes="true"> <CurrencyID>SOS</CurrencyID> + <CurrencySymbol>Ssh</CurrencySymbol> + <BankSymbol>SOS</BankSymbol> + <CurrencyName>Shilin Soomaali</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + <Currency default="false" usedInCompatibleFormatCodes="false" legacyOnly="true"> + <CurrencyID>SOS</CurrencyID> <CurrencySymbol>So. Sh.</CurrencySymbol> <BankSymbol>SOS</BankSymbol> <CurrencyName>Shilin Soomaali</CurrencyName> @@ -331,27 +338,27 @@ <ReservedWords> <trueWord>Run</trueWord> <falseWord>Been</falseWord> - <quarter1Word>Rubaca kowaad</quarter1Word> - <quarter2Word>Rubaca labaad</quarter2Word> - <quarter3Word>Rubaca sadaxaad</quarter3Word> - <quarter4Word>Rubaca afaraad</quarter4Word> - <aboveWord>ka kor</aboveWord> - <belowWord>ka hoos</belowWord> - <quarter1Abbreviation>Q1</quarter1Abbreviation> - <quarter2Abbreviation>Q2</quarter2Abbreviation> - <quarter3Abbreviation>Q3</quarter3Abbreviation> - <quarter4Abbreviation>Q4</quarter4Abbreviation> + <quarter1Word>Afarmeeloodka 1aad</quarter1Word> + <quarter2Word>Afarmeeloodka 2aad</quarter2Word> + <quarter3Word>Afarmeeloodka 3aad</quarter3Word> + <quarter4Word>Afarmeeloodka 4aad</quarter4Word> + <aboveWord>Kor</aboveWord> + <belowWord>Hoos</belowWord> + <quarter1Abbreviation>AM1</quarter1Abbreviation> + <quarter2Abbreviation>AM2</quarter2Abbreviation> + <quarter3Abbreviation>AM3</quarter3Abbreviation> + <quarter4Abbreviation>AM4</quarter4Abbreviation> </ReservedWords> </LC_MISC> <LC_NumberingLevel> - <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> - <NumberingLevel NumType="4" Prefix=" " Suffix="."/> - <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> - <NumberingLevel NumType="2" Prefix=" " Suffix="."/> - <NumberingLevel NumType="0" Prefix=" " Suffix=")"/> - <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> - <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> - <NumberingLevel NumType="3" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix="."/> + <NumberingLevel NumType="0" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="3" Prefix=" " Suffix="."/> </LC_NumberingLevel> <LC_OutLineNumberingLevel ref="en_US"/> </Locale> diff --git a/i18npool/source/localedata/data/ug_CN.xml b/i18npool/source/localedata/data/ug_CN.xml new file mode 100644 index 000000000000..b99f1f89a7ee --- /dev/null +++ b/i18npool/source/localedata/data/ug_CN.xml @@ -0,0 +1,364 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE Locale SYSTEM 'locale.dtd'> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> + <LC_INFO> + <Language> + <LangID>ug</LangID> + <DefaultName>Uyghur</DefaultName> + </Language> + <Country> + <CountryID>CN</CountryID> + <DefaultName>China</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE unoid="generic"> + <Separators> + <DateSeparator>-</DateSeparator> + <ThousandSeparator>,</ThousandSeparator> + <DecimalSeparator>.</DecimalSeparator> + <TimeSeparator>:</TimeSeparator> + <Time100SecSeparator>.</Time100SecSeparator> + <ListSeparator>;</ListSeparator> + <LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> + <LongDateDaySeparator>, </LongDateDaySeparator> + <LongDateMonthSeparator> </LongDateMonthSeparator> + <LongDateYearSeparator> </LongDateYearSeparator> + </Separators> + <Markers> + <QuotationStart>»</QuotationStart> + <QuotationEnd>«</QuotationEnd> + <DoubleQuotationStart>’</DoubleQuotationStart> + <DoubleQuotationEnd>‘</DoubleQuotationEnd> + </Markers> + <TimeAM>چ ب</TimeAM> + <TimePM>چ ك</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$¥-0480]"> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>#,###.00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0.00E+00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0.00E+000</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> + <FormatCode>0%</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> + <FormatCode>0.00%</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> + <FormatCode>[CURRENCY]#,##0;[CURRENCY]-#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> + <FormatCode>[CURRENCY]#,##0.00;[CURRENCY]-#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> + <FormatCode>[CURRENCY]#,##0;[RED][CURRENCY]-#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> + <FormatCode>[CURRENCY]#,##0.00;[RED][CURRENCY]-#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> + <FormatCode>CCC#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#,##0.--;[RED][CURRENCY]-#,##0.--</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>YY-MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNDD, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>YY-MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>YYYY-MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D, MMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> + <FormatCode>NN, DD-MMM-YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> + <FormatCode>NN, D, MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN, D, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNND, MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>YY-MM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> + <FormatCode>HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> + <FormatCode>HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> + <FormatCode>HH:MM:SS AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> + <FormatCode>[HH]:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> + <FormatCode>MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> + <FormatCode>[HH]:MM:SS.00</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>YY-MM-DD HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>YYYY-MM-DD HH:MM:SS AM/PM</FormatCode> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION> + <Collator default="true" unoid="alphanumeric"/> + <CollationOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </CollationOptions> + </LC_COLLATION> + <LC_SEARCH> + <SearchOptions> + <TransliterationModules>IGNORE_CASE</TransliterationModules> + </SearchOptions> + </LC_SEARCH> + <LC_INDEX> + <IndexKey phonetic="false" default="true" unoid="alphanumeric">ا-ە-ب-پ-ت-ج-چ-خ-د-ر-زژس-ش-غ-ف-ق-ك-گ-ڭ-ل-م-ن-ھ-و-ۇ-ۆ-ۈ-ۋ-ې-ى-ئ</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <UnicodeScript>2</UnicodeScript> + <UnicodeScript>3</UnicodeScript> + <UnicodeScript>8</UnicodeScript> + <UnicodeScript>11</UnicodeScript> + <UnicodeScript>80</UnicodeScript> + <UnicodeScript>84</UnicodeScript> + <FollowPageWord>ئەگەش</FollowPageWord> + <FollowPageWord>ئەگەش</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>ي</DefaultAbbrvName> + <DefaultFullName>يەكشەنبە</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>د</DefaultAbbrvName> + <DefaultFullName>دۈشەنبە</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>س</DefaultAbbrvName> + <DefaultFullName>سەيشەنبە</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>چ</DefaultAbbrvName> + <DefaultFullName>چارشەنبە</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>پ</DefaultAbbrvName> + <DefaultFullName>پەيشەنبە</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>ج</DefaultAbbrvName> + <DefaultFullName>جۈمە</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>ش</DefaultAbbrvName> + <DefaultFullName>شەنبە</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>قەھرىتان</DefaultAbbrvName> + <DefaultFullName>قەھرىتان</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>ھۇت</DefaultAbbrvName> + <DefaultFullName>ھۇت</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>نەۋرۇز</DefaultAbbrvName> + <DefaultFullName>نەۋرۇز</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>ئۇمۇت</DefaultAbbrvName> + <DefaultFullName>ئۇمۇت</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>باھار</DefaultAbbrvName> + <DefaultFullName>باھار</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>سەپەر</DefaultAbbrvName> + <DefaultFullName>سەپەر</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>چىللە</DefaultAbbrvName> + <DefaultFullName>چىللە</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>تومۇز</DefaultAbbrvName> + <DefaultFullName>تومۇز</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>مىزان</DefaultAbbrvName> + <DefaultFullName>مىزان</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>ئوغۇز</DefaultAbbrvName> + <DefaultFullName>ئوغۇز</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>ئوغلاق</DefaultAbbrvName> + <DefaultFullName>ئوغلاق</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>كۆنەك</DefaultAbbrvName> + <DefaultFullName>كۆنەك</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>م ئى</DefaultAbbrvName> + <DefaultFullName>مىلادىيەدىن ئىلگىرى</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>م</DefaultAbbrvName> + <DefaultFullName>مىلادىيە</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>sun</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>CNY</CurrencyID> + <CurrencySymbol>¥</CurrencySymbol> + <BankSymbol>CNY</BankSymbol> + <CurrencyName>يۈەن</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="IGNORE_CASE"/> + </LC_TRANSLITERATION> + <LC_MISC> + <ReservedWords> + <trueWord>راست</trueWord> + <falseWord>يالغان</falseWord> + <quarter1Word>بىرىنچى چارەك</quarter1Word> + <quarter2Word>ئىككىنچى چارەك</quarter2Word> + <quarter3Word>ئۈچىنچى چارەك</quarter3Word> + <quarter4Word>تۆتىنچى چارەك</quarter4Word> + <aboveWord>ئۈستى</aboveWord> + <belowWord>ئاستى</belowWord> + <quarter1Abbreviation>1 چارەك</quarter1Abbreviation> + <quarter2Abbreviation>2 چارەك</quarter2Abbreviation> + <quarter3Abbreviation>3 چارەك</quarter3Abbreviation> + <quarter4Abbreviation>4 چارەك</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel> + <NumberingLevel NumType="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix="."/> + <NumberingLevel NumType="0" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="1" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="3" Prefix=" " Suffix="."/> + </LC_NumberingLevel> + <LC_OutLineNumberingLevel ref="en_US"/> +</Locale> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 456bb1761b41..083fbc548c8c 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -175,6 +175,8 @@ static const struct { { "fy_NL", lcl_DATA_EURO }, { "oc_FR", lcl_DATA_EURO }, { "mt_MT", lcl_DATA_EURO }, + { "sc_IT", lcl_DATA_EURO }, + { "ast_ES", lcl_DATA_EURO }, { "ja_JP", lcl_DATA_OTHERS }, { "ko_KR", lcl_DATA_OTHERS }, @@ -250,6 +252,9 @@ static const struct { { "my_MM", lcl_DATA_OTHERS }, { "shs_CA", lcl_DATA_OTHERS }, { "tpi_PG", lcl_DATA_OTHERS }, + { "ar_OM", lcl_DATA_OTHERS }, + { "ug_CN", lcl_DATA_OTHERS }, + { "om_ET", lcl_DATA_OTHERS }, }; static const sal_Unicode under = sal_Unicode('_'); @@ -1393,6 +1398,7 @@ OutlineNumbering::OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlnLevel OutlineNumbering::~OutlineNumbering() { + delete [] m_pOutlineLevels; } sal_Int32 OutlineNumbering::getCount( ) throw(RuntimeException) diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index 543cdc1d4fee..6922290bd10c 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -737,9 +737,8 @@ NativeNumberXmlAttributes SAL_CALL NativeNumberSupplier::convertToXmlAttributes( break; } } - NativeNumberXmlAttributes att(rLocale, OUString(&NumberChar[number][1], 1), + return NativeNumberXmlAttributes(rLocale, OUString(&NumberChar[number][1], 1), OUString::createFromAscii(attType[type])); - return att; } static sal_Bool natNumIn(sal_Int16 num, sal_Int16 natnum[], sal_Int16 len) diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 870c49939648..3cb29cd6838f 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -207,6 +207,7 @@ IMPL_CREATEINSTANCE( NumToCharLower_zh_CN ) IMPL_CREATEINSTANCE( NumToCharUpper_zh_CN ) IMPL_CREATEINSTANCE( NumToCharLower_zh_TW ) IMPL_CREATEINSTANCE( NumToCharUpper_zh_TW ) +IMPL_CREATEINSTANCE( NumToCharHalfwidth ) IMPL_CREATEINSTANCE( NumToCharFullwidth ) IMPL_CREATEINSTANCE( NumToCharKanjiShort_ja_JP ) IMPL_CREATEINSTANCE( NumToCharKanjiTraditional_ja_JP ) @@ -469,6 +470,7 @@ static const struct InstancesArray { IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_CN), IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_TW), IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_TW), + IMPL_TRANSLITERATION_ITEM (NumToCharHalfwidth), IMPL_TRANSLITERATION_ITEM (NumToCharFullwidth), IMPL_TRANSLITERATION_ITEM (NumToCharKanjiShort_ja_JP), IMPL_TRANSLITERATION_ITEM (NumToCharKanjiTraditional_ja_JP), diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index a6ebfbba4bb9..70fe224cf6a9 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -39,7 +39,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk - +.IF "$(L10N_framework)"=="" # --- Common ---------------------------------------------------------- # BEGIN ---------------------------------------------------------------- @@ -65,12 +65,13 @@ SHL1VERSIONMAP = export.map SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ +.ENDIF # L10N_framework .INCLUDE : target.mk .INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ - +.IF "$(L10N_framework)"=="" unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @@ -78,3 +79,5 @@ unittest : $(SHL1TARGETN) $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN) ALLTAR : unittest +.ENDIF # L10N_framework + diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index c10be2d83fcd..052de2cbb731 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -147,27 +147,31 @@ void APChooseDriverPage::fill( PrinterInfo& rInfo ) } } -void APChooseDriverPage::updateDrivers() +void APChooseDriverPage::updateDrivers( bool bRefresh, const rtl::OUString& rSelectDriver ) { for( int k = 0; k < m_aDriverBox.GetEntryCount(); k++ ) delete (String*)m_aDriverBox.GetEntryData( k ); m_aDriverBox.Clear(); std::list< rtl::OUString > aDrivers; - psp::PPDParser::getKnownPPDDrivers( aDrivers ); + psp::PPDParser::getKnownPPDDrivers( aDrivers, bRefresh ); + rtl::OUString aSelectDriver( psp::PPDParser::getPPDPrinterName( rSelectDriver ) ); + + rtl::OUString aSelectedEntry; for( std::list< rtl::OUString >::const_iterator it = aDrivers.begin(); it != aDrivers.end(); ++it ) { - String aDriver( ::psp::PPDParser::getPPDPrinterName( *it ) ); - if( aDriver.Len() ) + rtl::OUString aDriver( psp::PPDParser::getPPDPrinterName( *it ) ); + if( aDriver.getLength() ) { int nPos = m_aDriverBox.InsertEntry( aDriver ); m_aDriverBox.SetEntryData( nPos, new String( *it ) ); - if( it->equalsAscii( "SGENPRT" ) ) - m_aDriverBox.SelectEntryPos( nPos ); + if( aDriver == aSelectDriver ) + aSelectedEntry = aDriver; } } + m_aDriverBox.SelectEntry( aSelectedEntry ); m_aRemBtn.Enable( m_aDriverBox.GetEntryCount() > 0 ); } @@ -185,7 +189,13 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton ) { PPDImportDialog aDlg( this ); if( aDlg.Execute() ) - updateDrivers(); + { + const std::list< rtl::OUString >& rImported( aDlg.getImportedFiles() ); + if( rImported.empty() ) + updateDrivers( true ); + else + updateDrivers( true, rImported.front() ); + } } else if( pButton == &m_aRemBtn ) { @@ -259,11 +269,10 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton ) rPIManager.removePrinter( *it ); } - ::std::list< rtl::OUString > aDirs; + std::list< rtl::OUString > aDirs; // get only psprint's directories, not eventual system dirs psp::getPrinterPathList( aDirs, NULL ); - ::std::list< rtl::OUString >::iterator dir; - + std::list< rtl::OUString >::iterator dir; for( dir = aDirs.begin(); dir != aDirs.end(); ++dir ) { ::std::list< String > aFiles; @@ -271,10 +280,11 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton ) OUStringBuffer aDir( *dir ); aDir.append( sal_Unicode( '/' ) ); aDir.appendAscii( PRINTER_PPDDIR ); - FindFiles( aDir.makeStringAndClear(), aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true ); + rtl::OUString aPPDDir( aDir.makeStringAndClear() ); + FindFiles( aPPDDir, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true ); for( file = aFiles.begin(); file != aFiles.end(); ++file ) { - String aFile( *dir ); + String aFile( aPPDDir ); if( aFile.GetChar( aFile.Len() ) != '/' ) aFile.AppendAscii( "/" ); aFile.Append( *file ); diff --git a/padmin/source/adddlg.hxx b/padmin/source/adddlg.hxx index e6fe17f30188..bb17044e800a 100644 --- a/padmin/source/adddlg.hxx +++ b/padmin/source/adddlg.hxx @@ -96,7 +96,7 @@ class APChooseDriverPage : public APTabPage DECL_LINK( ClickBtnHdl, PushButton* ); DECL_LINK( DelPressedHdl, ListBox* ); - void updateDrivers(); + void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ); public: APChooseDriverPage( AddPrinterDialog* pParent ); ~APChooseDriverPage(); diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk index 336631f1ceaa..91e4ca2a25f4 100644 --- a/padmin/source/makefile.mk +++ b/padmin/source/makefile.mk @@ -105,8 +105,7 @@ APP1STDLIBS= \ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(SALLIB) \ - -lXext -lX11 + $(SALLIB) UNIXTEXT = $(MISC)$/spadmin.sh diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx index 8d5414a2ceef..0fd6aa32c984 100644 --- a/padmin/source/newppdlg.cxx +++ b/padmin/source/newppdlg.cxx @@ -172,6 +172,7 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton ) ::std::list< rtl::OUString > aToDirs; psp::getPrinterPathList( aToDirs, PRINTER_PPDDIR ); ::std::list< rtl::OUString >::iterator writeDir = aToDirs.begin(); + m_aImportedFiles.clear(); for( int i = 0; i < m_aDriverLB.GetSelectEntryCount(); i++ ) { @@ -186,7 +187,10 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton ) aToFile.Append( aFile.GetName() ); OUString aToUni( aToFile.GetMainURL(INetURLObject::DECODE_TO_IURI) ); if( ! File::copy( aFromUni, aToUni ) ) + { + m_aImportedFiles.push_back( aToUni ); break; + } ++writeDir; } while( writeDir != aToDirs.end() ); } diff --git a/padmin/source/newppdlg.hxx b/padmin/source/newppdlg.hxx index 4d6d637efcc9..bd73b5ffed3e 100644 --- a/padmin/source/newppdlg.hxx +++ b/padmin/source/newppdlg.hxx @@ -64,9 +64,14 @@ namespace padmin { DECL_LINK( ModifyHdl, ComboBox* ); void Import(); + + std::list< rtl::OUString > m_aImportedFiles; public: PPDImportDialog( Window* pParent ); ~PPDImportDialog(); + + const std::list< rtl::OUString >& getImportedFiles() const + { return m_aImportedFiles; } }; } // namespace diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx index c95f1adc7b52..75f558398bb5 100644 --- a/rsc/source/parser/rscibas.cxx +++ b/rsc/source/parser/rscibas.cxx @@ -67,7 +67,7 @@ void RscTypCont::SETCONST( RscConst * pClass, const char * szString, UINT32 nVal void RscTypCont::SETCONST( RscConst * pClass, Atom nName, UINT32 nVal ) { #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "setconst hash: %d\n", nName ); + fprintf( stderr, "setconst hash: %u\n", (unsigned int)nName ); #endif pClass->SetConstant( aNmTb.Put( nName, CONSTNAME, nVal ), nVal ); @@ -106,9 +106,9 @@ void RscLangEnum::Init( RscNameTable& rNames ) { #if OSL_DEBUG_LEVEL > 2 fprintf( stderr, "ISO Language in : %d %d %s\n", - nIndex, - pLangEntry->meLang, - MsLangId::convertLanguageToIsoByteString( pLangEntry->meLang ).GetBuffer() ); + (int)nIndex, + pLangEntry->mnLang, + MsLangId::convertLanguageToIsoByteString( pLangEntry->mnLang ).getStr() ); #endif aLang = pLangEntry->maLangStr; aCountry = pLangEntry->maCountry; @@ -118,7 +118,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) if ( ! GetLangId( aLang )) ULong_Iso_map[ aLang ] = mnLangId; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "ISO Language out: %s 0x%hx\n", aLang.GetBuffer(), mnLangId ); + fprintf( stderr, "ISO Language out: %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); #endif mnLangId++; } @@ -128,7 +128,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) if ( ! GetLangId( aLang )) ULong_Iso_map[ aLang ] = mnLangId; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "ISO Language out: %s 0x%hx", aLang.GetBuffer(), mnLangId ); + fprintf( stderr, "ISO Language out: %s 0x%lx", aLang.GetBuffer(), mnLangId ); #endif mnLangId++; aLang += csep; @@ -137,7 +137,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) if ( ! GetLangId( aLang )) ULong_Iso_map[ aLang ] = mnLangId; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " %s 0x%hx\n", aLang.GetBuffer(), mnLangId ); + fprintf( stderr, " %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); #endif mnLangId++; // hack - survive "x-no-translate" @@ -167,7 +167,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) if ( ! GetLangId( aIsoToken )) ULong_Iso_map[ aIsoToken ] = mnLangId; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "Env ISO Language out: %s 0x%hx\n", aIsoToken.GetBuffer(), mnLangId ); + fprintf( stderr, "Env ISO Language out: %s 0x%lx\n", aIsoToken.GetBuffer(), mnLangId ); #endif mnLangId++; } diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index e69094064754..9ae58087a335 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -1449,6 +1449,9 @@ RscTop * RscTypCont::InitClassNumericFormatter( RscTop * pSuper ) nId = aNmTb.Put( "Value", VARNAME ); pClassNumeric->SetVariable( nId, &aIdLong, NULL, 0, NUMERICFORMATTER_VALUE ); + nId = aNmTb.Put( "NoThousandSep", VARNAME ); + pClassNumeric->SetVariable( nId, &aBool, NULL, + 0, NUMERICFORMATTER_NOTHOUSANDSEP ); return pClassNumeric; } @@ -1633,7 +1636,6 @@ RscTop * RscTypCont::InitClassNumericField( RscTop * pSuper ) nId = aNmTb.Put( "SpinSize", VARNAME ); pClassNumericField->SetVariable( nId, &aIdLong, NULL, 0, NUMERICFIELD_SPINSIZE ); - return pClassNumericField; } diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index d9553113c759..e1f5161b7e3a 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/io/XSeekable.hpp> #include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> @@ -135,6 +136,11 @@ OUString XmlChar2OUString( const XML_Char *p ) pThis->rDocumentLocator->getColumnNumber()\ ) );\ }\ + catch( com::sun::star::uno::RuntimeException &e ) {\ + pThis->bExceptionWasThrown = sal_True; \ + pThis->bRTExceptionWasThrown = sal_True; \ + pImpl->rtexception = e; \ + }\ }\ ((void)0) @@ -255,7 +261,9 @@ public: // module scope // Exception cannot be thrown through the C-XmlParser (possible resource leaks), // therefor the exception must be saved somewhere. SAXParseException exception; - sal_Bool bExceptionWasThrown; + RuntimeException rtexception; + sal_Bool bExceptionWasThrown; + sal_Bool bRTExceptionWasThrown; Locale locale; @@ -374,7 +382,8 @@ extern "C" // LocatorImpl //--------------------------------------------- class LocatorImpl : - public WeakImplHelper1< XLocator > + public WeakImplHelper2< XLocator, com::sun::star::io::XSeekable > + // should use a different interface for stream positions! { public: LocatorImpl( SaxExpatParser_Impl *p ) @@ -400,6 +409,20 @@ public: //XLocator return m_pParser->getEntity().structSource.sSystemId; } + // XSeekable (only for getPosition) + + virtual void SAL_CALL seek( sal_Int64 ) throw() + { + } + virtual sal_Int64 SAL_CALL getPosition() throw() + { + return XML_GetCurrentByteIndex( m_pParser->getEntity().pParser ); + } + virtual ::sal_Int64 SAL_CALL getLength() throw() + { + return 0; + } + private: SaxExpatParser_Impl *m_pParser; @@ -421,6 +444,7 @@ SaxExpatParser::SaxExpatParser( ) m_pImpl->rAttrList = Reference< XAttributeList > ( m_pImpl->pAttrList ); m_pImpl->bExceptionWasThrown = sal_False; + m_pImpl->bRTExceptionWasThrown = sal_False; } SaxExpatParser::~SaxExpatParser() @@ -721,6 +745,9 @@ void SaxExpatParser_Impl::parse( ) if( ! bContinue || this->bExceptionWasThrown ) { + if ( this->bRTExceptionWasThrown ) + throw rtexception; + // Error during parsing ! XML_Error xmlE = XML_GetErrorCode( getEntity().pParser ); OUString sSystemId = rDocumentLocator->getSystemId(); diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 9be52cdd24c3..717767d86e11 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -208,6 +208,8 @@ public: // If there are invalid characters in the string it returns sal_False. // Than the calling method has to throw the needed Exception. inline sal_Bool comment(const rtl::OUString& rComment) throw( SAXException ); + + inline void clearBuffer() throw( SAXException ); }; const sal_Bool g_bValidCharsBelow32[32] = @@ -434,7 +436,7 @@ inline sal_Bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, OSL_ENSURE( nSurrogate != 0, "lone 2nd Unicode surrogate" ); nSurrogate = ( nSurrogate << 10 ) | ( c & 0x03ff ); - if( nSurrogate > 0x00010000 && nSurrogate <= 0x001FFFFF ) + if( nSurrogate >= 0x00010000 && nSurrogate <= 0x0010FFFF ) { sal_Int8 aBytes[] = { sal_Int8(0xF0 | ((nSurrogate >> 18) & 0x0F)), sal_Int8(0x80 | ((nSurrogate >> 12) & 0x3F)), @@ -693,6 +695,17 @@ inline void SaxWriterHelper::endDocument() throw( SAXException ) } } +inline void SaxWriterHelper::clearBuffer() throw( SAXException ) +{ + FinishStartElement(); + if (nCurrentPos > 0) + { + m_Sequence.realloc(nCurrentPos); + nCurrentPos = writeSequence(); + m_Sequence.realloc(SEQUENCESIZE); + } +} + inline sal_Bool SaxWriterHelper::processingInstruction(const rtl::OUString& rTarget, const rtl::OUString& rData) throw( SAXException ) { FinishStartElement(); @@ -851,7 +864,7 @@ inline sal_Int32 calcXMLByteLength( const sal_Unicode *pStr, sal_Int32 nStrLen, { // 2. surrogate: write as UTF-8 (if range is OK nSurrogate = ( nSurrogate << 10 ) | ( c & 0x03ff ); - if( nSurrogate > 0x00010000 && nSurrogate <= 0x001FFFFF ) + if( nSurrogate >= 0x00010000 && nSurrogate <= 0x0010FFFF ) nOutputLength += 4; nSurrogate = 0; } @@ -927,12 +940,20 @@ public: // XActiveDataSource virtual void SAL_CALL setOutputStream(const Reference< XOutputStream > & aStream) throw (RuntimeException) { + // temporary: set same stream again to clear buffer + if ( m_out == aStream && mp_SaxWriterHelper && m_bDocStarted ) + mp_SaxWriterHelper->clearBuffer(); + else + { + m_out = aStream; delete mp_SaxWriterHelper; mp_SaxWriterHelper = new SaxWriterHelper(m_out); m_bDocStarted = sal_False; m_nLevel = 0; m_bIsCDATA = sal_False; + + } } virtual Reference< XOutputStream > SAL_CALL getOutputStream(void) throw(RuntimeException) diff --git a/svtools/inc/dialogcontrolling.hxx b/svtools/inc/dialogcontrolling.hxx index 9efb098ee013..edb425f78b00 100644 --- a/svtools/inc/dialogcontrolling.hxx +++ b/svtools/inc/dialogcontrolling.hxx @@ -52,7 +52,15 @@ namespace svt class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowOperator { public: - virtual void operateOn( Window& _rOperateOn ) const = 0; + /** called when an event happened which should be reacted to + + @param _rTrigger + the event which triggered the call. If the Id of the event is 0, then this is the initial + call which is made when ->_rOperateOn is added to the responsibility of the DialogController. + @param _rOperateOn + the window on which to operate + */ + virtual void operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const = 0; virtual ~IWindowOperator(); }; @@ -61,13 +69,13 @@ namespace svt //===================================================================== //= IWindowEventFilter //===================================================================== - /** an abstract interface for deciding whether a ->VclSimpleEvent + /** an abstract interface for deciding whether a ->VclWindowEvent is worth paying attention to */ class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowEventFilter { public: - virtual bool payAttentionTo( const VclSimpleEvent& _rEvent ) const = 0; + virtual bool payAttentionTo( const VclWindowEvent& _rEvent ) const = 0; virtual ~IWindowEventFilter(); }; @@ -96,7 +104,7 @@ namespace svt ::std::auto_ptr< DialogController_Data > m_pImpl; public: - DialogController( Window& _rInstigator, const PWindowEventFilter _pEventFilter, const PWindowOperator _pOperator ); + DialogController( Window& _rInstigator, const PWindowEventFilter& _pEventFilter, const PWindowOperator& _pOperator ); virtual ~DialogController(); /** adds a window to the list of dependent windows @@ -117,10 +125,10 @@ namespace svt private: void impl_Init(); - void impl_updateAll(); - void impl_update( Window& _rWindow ); + void impl_updateAll( const VclWindowEvent& _rTriggerEvent ); + void impl_update( const VclWindowEvent& _rTriggerEvent, Window& _rWindow ); - DECL_LINK( OnWindowEvent, const VclSimpleEvent* ); + DECL_LINK( OnWindowEvent, const VclWindowEvent* ); private: DialogController( const DialogController& ); // never implemented @@ -184,10 +192,9 @@ namespace svt /** adds a non-standard controller whose functionality is not covered by the other methods @param _pController - the controller to add to the manager. Must not be <NULL/>. The manager takes ownership - of the controller. + the controller to add to the manager. Must not be <NULL/>. */ - void addController( DialogController* _pController ); + void addController( const PDialogController& _pController ); private: ControlDependencyManager( const ControlDependencyManager& ); // never implemented @@ -224,7 +231,7 @@ namespace svt { } - virtual void operateOn( Window& _rOperateOn ) const + virtual void operateOn( const VclWindowEvent& /*_rTrigger*/, Window& _rOperateOn ) const { _rOperateOn.Enable( m_rCheckable.IsChecked() ); } @@ -248,12 +255,11 @@ namespace svt { } - bool payAttentionTo( const VclSimpleEvent& _rEvent ) const + bool payAttentionTo( const VclWindowEvent& _rEvent ) const { - const VclWindowEvent& rWindowEvent = dynamic_cast< const VclWindowEvent& >( _rEvent ); - if ( ( rWindowEvent.GetWindow() == &m_rWindow ) - && ( ( rWindowEvent.GetId() == VCLEVENT_RADIOBUTTON_TOGGLE ) - || ( rWindowEvent.GetId() == VCLEVENT_CHECKBOX_TOGGLE ) + if ( ( _rEvent.GetWindow() == &m_rWindow ) + && ( ( _rEvent.GetId() == VCLEVENT_RADIOBUTTON_TOGGLE ) + || ( _rEvent.GetId() == VCLEVENT_CHECKBOX_TOGGLE ) ) ) return true; diff --git a/svtools/inc/docmspasswdrequest.hxx b/svtools/inc/docmspasswdrequest.hxx deleted file mode 100644 index 684bffe71760..000000000000 --- a/svtools/inc/docmspasswdrequest.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright IBM Corporation 2009. - * Copyright 2009 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docmspasswdrequest.hxx,v $ - * $Revision: 1.0 $ - * - * 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 INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX -#define INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX - -#include "svtools/svldllapi.h" -#include <com/sun/star/task/DocumentMSPasswordRequest.hpp> -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> - -class MSAbortContinuation; -class MSPasswordContinuation; - -class SVL_DLLPUBLIC RequestMSDocumentPassword : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - ::com::sun::star::uno::Any m_aRequest; - - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > m_lContinuations; - - MSAbortContinuation* m_pAbort; - MSPasswordContinuation* m_pPassword; - -public: - RequestMSDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ); - - sal_Bool isAbort(); - sal_Bool isPassword(); - - ::rtl::OUString getPassword(); - - virtual ::com::sun::star::uno::Any SAL_CALL getRequest() - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > SAL_CALL getContinuations() - throw( ::com::sun::star::uno::RuntimeException ); -}; - -#endif /* INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX */ diff --git a/svtools/inc/docpasswdrequest.hxx b/svtools/inc/docpasswdrequest.hxx deleted file mode 100644 index 69095fbe5a5c..000000000000 --- a/svtools/inc/docpasswdrequest.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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: docpasswdrequest.hxx,v $ - * $Revision: 1.4 $ - * - * 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 INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX -#define INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX - -#include "svtools/svldllapi.h" -#include <com/sun/star/task/DocumentPasswordRequest.hpp> -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> - -class AbortContinuation; -class PasswordContinuation; - -class SVL_DLLPUBLIC RequestDocumentPassword : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - ::com::sun::star::uno::Any m_aRequest; - - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > m_lContinuations; - - AbortContinuation* m_pAbort; - PasswordContinuation* m_pPassword; - -public: - RequestDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ); - - sal_Bool isAbort(); - sal_Bool isPassword(); - - ::rtl::OUString getPassword(); - - virtual ::com::sun::star::uno::Any SAL_CALL getRequest() - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > SAL_CALL getContinuations() - throw( ::com::sun::star::uno::RuntimeException ); -}; - -#endif /* INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX */ diff --git a/svtools/inc/eventcfg.hxx b/svtools/inc/eventcfg.hxx index 4478d3f48028..4ee175f5b7e0 100644 --- a/svtools/inc/eventcfg.hxx +++ b/svtools/inc/eventcfg.hxx @@ -40,6 +40,35 @@ #include <hash_map> #include <vector> +#define STR_EVENT_STARTAPP 0 +#define STR_EVENT_CLOSEAPP 1 +#define STR_EVENT_DOCCREATED 2 +#define STR_EVENT_CREATEDOC 3 +#define STR_EVENT_LOADFINISHED 4 +#define STR_EVENT_OPENDOC 5 +#define STR_EVENT_PREPARECLOSEDOC 6 +#define STR_EVENT_CLOSEDOC 7 +#define STR_EVENT_SAVEDOC 8 +#define STR_EVENT_SAVEDOCDONE 9 +#define STR_EVENT_SAVEDOCFAILED 10 +#define STR_EVENT_SAVEASDOC 11 +#define STR_EVENT_SAVEASDOCDONE 12 +#define STR_EVENT_SAVEASDOCFAILED 13 +#define STR_EVENT_SAVETODOC 14 +#define STR_EVENT_SAVETODOCDONE 15 +#define STR_EVENT_SAVETODOCFAILED 16 +#define STR_EVENT_ACTIVATEDOC 17 +#define STR_EVENT_DEACTIVATEDOC 18 +#define STR_EVENT_PRINTDOC 19 +#define STR_EVENT_VIEWCREATED 20 +#define STR_EVENT_PREPARECLOSEVIEW 21 +#define STR_EVENT_CLOSEVIEW 22 +#define STR_EVENT_MODIFYCHANGED 23 +#define STR_EVENT_TITLECHANGED 24 +#define STR_EVENT_VISAREACHANGED 25 +#define STR_EVENT_MODECHANGED 26 +#define STR_EVENT_STORAGECHANGED 27 + typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector; typedef ::std::vector< ::rtl::OUString > SupportedEventsVector; @@ -67,7 +96,7 @@ public: ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - + ::rtl::OUString GetEventName( sal_Int32 nID ); }; class SVL_DLLPUBLIC GlobalEventConfig: @@ -86,7 +115,7 @@ class SVL_DLLPUBLIC GlobalEventConfig: ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - + static ::rtl::OUString GetEventName( sal_Int32 nID ); private: static GlobalEventConfig_Impl* m_pImpl; diff --git a/svtools/inc/sfxecode.hxx b/svtools/inc/sfxecode.hxx index 01292f1c87fa..d87fff819748 100644 --- a/svtools/inc/sfxecode.hxx +++ b/svtools/inc/sfxecode.hxx @@ -85,6 +85,7 @@ #define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52) #define ERRCODE_SFX_BROKENSIGNATURE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 53) #define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54) +#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55) diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx index 08fe3c7d162a..f4cccd3115b8 100644 --- a/svtools/inc/svtools/embedhlp.hxx +++ b/svtools/inc/svtools/embedhlp.hxx @@ -131,6 +131,7 @@ namespace svt BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method }; } diff --git a/svtools/inc/svtools/loginerr.hxx b/svtools/inc/svtools/loginerr.hxx deleted file mode 100644 index f04e569b41e0..000000000000 --- a/svtools/inc/svtools/loginerr.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************* - * - * 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: loginerr.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _LOGINERR_HXX -#define _LOGINERR_HXX - -#include <tools/string.hxx> -#include <tools/errcode.hxx> -#include <svtools/hint.hxx> - -//========================================================================= - -#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 -#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 -#define LOGINERROR_FLAG_MODIFY_USER_NAME 4 -#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 - -class LoginErrorInfo -{ -private: - String _aTitle; - String _aServer; - String _aAccount; - String _aUserName; - String _aPassword; - String _aPath; - String _aErrorText; - BYTE _nFlags; - USHORT _nRet; - -public: - LoginErrorInfo() - : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), - _nRet( ERRCODE_BUTTON_CANCEL ) - { - } - - const String& GetTitle() const { return _aTitle; } - const String& GetServer() const { return _aServer; } - const String& GetAccount() const { return _aAccount; } - const String& GetUserName() const { return _aUserName; } - const String& GetPassword() const { return _aPassword; } - const String& GetPath() const { return _aPath; } - const String& GetErrorText() const { return _aErrorText; } - BOOL GetIsPersistentPassword() const - { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); } - BOOL GetIsSavePassword() const - { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); } - BYTE GetFlags() const { return _nFlags; } - USHORT GetResult() const { return _nRet; } - - void SetTitle( const String& aTitle ) - { _aTitle = aTitle; } - void SetServer( const String& aServer ) - { _aServer = aServer; } - void SetAccount( const String& aAccount ) - { _aAccount = aAccount; } - void SetUserName( const String& aUserName ) - { _aUserName = aUserName; } - void SetPassword( const String& aPassword ) - { _aPassword = aPassword; } - void SetPath( const String& aPath ) - { _aPath = aPath; } - void SetErrorText( const String& aErrorText ) - { _aErrorText = aErrorText; } - void SetFlags( BYTE nFlags ) - { _nFlags = nFlags; } - inline void SetSavePassword( BOOL bSet ); - inline void SetPersistentPassword( BOOL bSet ); - inline void SetModifyAccount( BOOL bSet ); - inline void SetModifyUserName( BOOL bSet ); - void SetResult( USHORT nRet ) - { _nRet = nRet; } -}; - -inline void LoginErrorInfo::SetSavePassword( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD; - else - _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD; -} - -inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD; - else - _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD; -} - -inline void LoginErrorInfo::SetModifyAccount( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; - else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; -} - -inline void LoginErrorInfo::SetModifyUserName( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; - else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; -} - -//========================================================================= - -class CntLoginErrorHint : public SfxHint -{ -private: - LoginErrorInfo* _pInfo; - - CntLoginErrorHint( const CntLoginErrorHint& ); // n.i. - CntLoginErrorHint& operator=( const CntLoginErrorHint& ); // n.i. - -public: - TYPEINFO(); - - CntLoginErrorHint( LoginErrorInfo* pInfo ) - : _pInfo( pInfo ) - { - } - - LoginErrorInfo& GetErrorInfo() const { return *_pInfo; } -}; - -#endif diff --git a/svtools/inc/svtools/saveopt.hxx b/svtools/inc/svtools/saveopt.hxx index 6dfd083a3ca2..2966e2f24aba 100644 --- a/svtools/inc/svtools/saveopt.hxx +++ b/svtools/inc/svtools/saveopt.hxx @@ -60,12 +60,16 @@ public: E_ODFDEFAULTVERSION }; + // keep enum values sorted that a less or greater compare maps to older and newer versions! enum ODFDefaultVersion { ODFVER_UNKNOWN = 0, // unknown - ODFVER_010, // ODF 1.0 - ODFVER_011, // ODF 1.1 - ODFVER_012 // ODF 1.2 + ODFVER_010 = 1, // ODF 1.0 + ODFVER_011 = 2, // ODF 1.1 + DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration + ODFVER_012 = 4, // ODF 1.2 + + ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements }; SvtSaveOptions(); diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 4ff74419b9d4..3dc9c0b013bb 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -311,8 +311,6 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx -..\inc\docpasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docpasswdrequest.hxx -..\inc\docmspasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docmspasswdrequest.hxx ..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx ..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx ..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 767283a8e425..4ebed0d70f3f 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -538,7 +538,7 @@ void BrowseBox::SetColumnPos( USHORT nColumnId, USHORT nPos ) aScrollArea = Rectangle(Point(aNextRect.Left(),0), Point(aToRect.Right(),aDataWinSize.Height())); - pDataWin->Scroll( nScroll, 0, aScrollArea, SCROLL_FLAGS ); + pDataWin->Scroll( nScroll, 0, aScrollArea ); aToRect.Top() = 0; aToRect.Bottom() = aScrollArea.Bottom(); Invalidate( aToRect ); diff --git a/svtools/source/config/eventcfg.cxx b/svtools/source/config/eventcfg.cxx index ae2041356fd3..6026c3d4a3a0 100644 --- a/svtools/source/config/eventcfg.cxx +++ b/svtools/source/config/eventcfg.cxx @@ -62,24 +62,70 @@ using namespace ::com::sun::star; #define SETNODE_BINDINGS OUString(RTL_CONSTASCII_USTRINGPARAM("Bindings" )) #define PROPERTYNAME_BINDINGURL OUString(RTL_CONSTASCII_USTRINGPARAM("BindingURL")) +const char* pEventAsciiNames[] = +{ +"OnStartApp", +"OnCloseApp", +"OnCreate", +"OnNew", +"OnLoadFinished", +"OnLoad", +"OnPrepareUnload", +"OnUnload", +"OnSave", +"OnSaveDone", +"OnSaveFailed", +"OnSaveAs", +"OnSaveAsDone", +"OnSaveAsFailed", +"OnCopyTo", +"OnCopyToDone", +"OnCopyToFailed", +"OnFocus", +"OnUnfocus", +"OnPrint", +"OnViewCreated", +"OnPrepareViewClosing", +"OnViewClosed", +"OnModifyChanged", +"OnTitleChanged", +"OnVisAreaChanged", +"OnModeChanged", +"OnStorageChanged" +}; + GlobalEventConfig_Impl::GlobalEventConfig_Impl() : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE ) { // the supported event names - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnStartApp")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnCloseApp")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnNew")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnUnload")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnPrepareUnload")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnLoad")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSave")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveAs")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveDone")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveAsDone")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnFocus")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnUnfocus")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnPrint")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnModifyChanged")); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) ); initBindingInfo(); @@ -103,6 +149,14 @@ GlobalEventConfig_Impl::~GlobalEventConfig_Impl() } } +::rtl::OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) +{ + if ( nIndex < (sal_Int32) m_supportedEvents.size() ) + return m_supportedEvents[nIndex]; + else + return rtl::OUString(); +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** @@ -396,3 +450,9 @@ Mutex& GlobalEventConfig::GetOwnStaticMutex() // Return new created or already existing mutex object. return *pMutex; } + +::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) +{ + return GlobalEventConfig().m_pImpl->GetEventName( nIndex ); +} + diff --git a/svtools/source/config/lingucfg.cxx b/svtools/source/config/lingucfg.cxx index 263ced16cd50..2b4e4d482c3f 100644 --- a/svtools/source/config/lingucfg.cxx +++ b/svtools/source/config/lingucfg.cxx @@ -72,27 +72,6 @@ static osl::Mutex & GetOwnMutex() /////////////////////////////////////////////////////////////////////////// -static lang::Locale lcl_CreateLocale( LanguageType eLang ) -{ - lang::Locale aLocale; - if ( eLang != LANGUAGE_NONE ) - MsLangId::convertLanguageToLocale( eLang, aLocale ); - - return aLocale; -} - - -static INT16 lcl_LocaleToLanguage( const lang::Locale& rLocale ) -{ - // empty Locale -> LANGUAGE_NONE - if ( rLocale.Language.getLength() == 0 ) - return LANGUAGE_NONE; - - // Variant of Locale is ignored - return MsLangId::convertLocaleToLanguage( rLocale ); -} - - static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) { BOOL bSucc = FALSE; @@ -100,41 +79,31 @@ static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) lang::Locale aNew; if (rVal >>= aNew) // conversion successful? { - INT16 nNew = lcl_LocaleToLanguage( aNew ); + INT16 nNew = MsLangId::convertLocaleToLanguage( aNew ); if (nNew != rLanguage) { rLanguage = nNew; bSucc = TRUE; } } - return bSucc; } -static inline INT16 lcl_CfgLocaleStrToLanguage( const OUString &rCfgLocaleStr ) -{ - INT16 nRes = LANGUAGE_NONE; - if (0 != rCfgLocaleStr.getLength()) - nRes = MsLangId::convertIsoStringToLanguage( rCfgLocaleStr ); - return nRes; -} - - static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) { OUString aRes; - if (LANGUAGE_NONE != nLanguage) + if (LANGUAGE_SYSTEM != nLanguage) aRes = MsLangId::convertLanguageToIsoString( nLanguage ); return aRes; } -static void lcl_CfgAnyToLanguage( const uno::Any &rVal, INT16& rLanguage ) +static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) { OUString aTmp; - if ((rVal >>= aTmp) && 0 != aTmp.getLength()) - rLanguage = MsLangId::convertIsoStringToLanguage( aTmp ); + rVal >>= aTmp; + return (aTmp.getLength() == 0) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp ); } @@ -143,7 +112,6 @@ static void lcl_CfgAnyToLanguage( const uno::Any &rVal, INT16& rLanguage ) SvtLinguOptions::SvtLinguOptions() { nDefaultLanguage = LANGUAGE_NONE; - nDefaultLanguage_CJK = LANGUAGE_NONE; nDefaultLanguage_CTL = LANGUAGE_NONE; @@ -428,19 +396,19 @@ uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const } case UPH_DEFAULT_LOCALE : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } case UPH_DEFAULT_LOCALE_CJK : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage_CJK ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } case UPH_DEFAULT_LOCALE_CTL : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage_CTL ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } @@ -654,7 +622,7 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN switch ( nPropertyHandle ) { case UPH_DEFAULT_LOCALE : - { rOpt.bRODefaultLanguage = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage ); } break; + { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_ACTIVE_DICTIONARIES : { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break; case UPH_IS_USE_DICTIONARY_LIST : @@ -662,9 +630,9 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN case UPH_IS_IGNORE_CONTROL_CHARACTERS : { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break; case UPH_DEFAULT_LOCALE_CJK : - { rOpt.bRODefaultLanguage_CJK = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage_CJK ); } break; + { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_DEFAULT_LOCALE_CTL : - { rOpt.bRODefaultLanguage_CTL = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage_CTL ); } break; + { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_IS_SPELL_UPPER_CASE : { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break; diff --git a/svtools/source/config/saveopt.cxx b/svtools/source/config/saveopt.cxx index 6ce1be8441a4..2b18d1bf4767 100644 --- a/svtools/source/config/saveopt.cxx +++ b/svtools/source/config/saveopt.cxx @@ -437,7 +437,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bRODoPrettyPrinting( CFG_READONLY_DEFAULT ) , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) - , eODFDefaultVersion( SvtSaveOptions::ODFVER_012 ) + , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) { Sequence< OUString > aNames = GetPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); @@ -474,11 +474,16 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() { sal_Int16 nTmp = 0; if ( pValues[nProp] >>= nTmp ) - eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + { + if( nTmp == 3 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; + else + eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + } else { DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" ); }; - bROAutoSaveTime = pROStates[nProp]; + bROODFDefaultVersion = pROStates[nProp]; break; } @@ -729,7 +734,7 @@ void SvtSaveOptions_Impl::Commit() case ODFDEFAULTVERSION: if (!bROODFDefaultVersion) { - pValues[nRealCount] <<= sal_Int16( eODFDefaultVersion ); + pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion ); pNames[nRealCount] = pOrgNames[i]; ++nRealCount; } diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 7485efec7c7c..b0e178e631d9 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -201,6 +201,17 @@ namespace svt m_pImpl->InCompleteHyperLabel = NULL; m_pImpl->setCurItemID(-1 ); m_pImpl->setComplete( sal_True ); + + // Roadmap control should be reachable as one unit with a Tab key + // the next Tab key should spring out of the control. + // To reach it the control itself should get focus and set it + // on entries. The entries themself should not be reachable with + // the Tab key directly. So each entry should have WB_NOTABSTOP. + // + // In other words the creator should create the control with the following + // flags: + // SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL ); + // TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react // on this with calculating a new bold font. // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font. @@ -725,11 +736,9 @@ namespace svt //--------------------------------------------------------------------- IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel) { - return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); } - - void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt ) { if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || @@ -753,7 +762,7 @@ namespace svt ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& ) { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } @@ -761,7 +770,7 @@ namespace svt { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } //--------------------------------------------------------------------- diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index afdb728f450e..96eb8bb39e99 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -37,6 +37,7 @@ #include <vcl/svapp.hxx> #include <svtools/valueset.hxx> #include "valueimp.hxx" +#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -92,7 +93,8 @@ void ValueSetItem::ClearAccessible() ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) : ValueSetAccComponentBase (m_aMutex), mpParent( pParent ), - mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ) + mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ), + mbIsFocused(false) { } @@ -166,6 +168,35 @@ ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterfa } } + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::GetFocus (void) +{ + mbIsFocused = true; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::LoseFocus (void) +{ + mbIsFocused = false; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + // ----------------------------------------------------------------------------- uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext() @@ -321,6 +352,9 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAc pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE); if ( !mbIsTransientChildrenDisabled ) pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS); + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE); + if (mbIsFocused) + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED); return pStateSet; } diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 8d7951da0dfc..c176629953ae 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -150,6 +150,17 @@ public: public: + /** Called by the corresponding ValueSet when it gets the focus. + Stores the new focus state and broadcasts a state change event. + */ + void GetFocus (void); + + /** Called by the corresponding ValueSet when it loses the focus. + Stores the new focus state and broadcasts a state change event. + */ + void LoseFocus (void); + + // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); @@ -201,6 +212,8 @@ private: ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners; ValueSet* mpParent; bool mbIsTransientChildrenDisabled; + /// The current FOCUSED state. + bool mbIsFocused; static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 7326f540c654..4033a9df7bb5 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1683,13 +1683,10 @@ void ValueSet::GetFocus() ImplDrawSelect(); Control::GetFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); - + // Tell the accessible object that we got the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->GetFocus(); } // ----------------------------------------------------------------------- @@ -1703,12 +1700,10 @@ void ValueSet::LoseFocus() HideFocus(); Control::LoseFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); + // Tell the accessible object that we lost the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->LoseFocus(); } // ----------------------------------------------------------------------- diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index ddb34d5d4fd2..14ede88482a6 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -97,6 +97,22 @@ namespace svt DECLARE_STL_VECTOR( String, StringArray ); DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringBag ); DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, MapString2String ); + + namespace + { + String lcl_getSelectedDataSource( const ComboBox& _dataSourceCombo ) + { + String selectedDataSource = _dataSourceCombo.GetText(); + if ( _dataSourceCombo.GetEntryPos( selectedDataSource ) == LISTBOX_ENTRY_NOTFOUND ) + { + // none of the pre-selected entries -> assume a path to a database document + OFileNotation aFileNotation( selectedDataSource, OFileNotation::N_SYSTEM ); + selectedDataSource = aFileNotation.get( OFileNotation::N_URL ); + } + return selectedDataSource; + } + } + // =================================================================== // = IAssigmentData // =================================================================== @@ -857,9 +873,7 @@ public: Reference< XCompletedConnection > xDS; if ( m_pImpl->bWorkingPersistent ) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); // get the data source the user has chosen and let it build a connection INetURLObject aURL( sSelectedDS ); @@ -1179,9 +1193,7 @@ public: // ------------------------------------------------------------------- IMPL_LINK(AddressBookSourceDialog, OnOkClicked, Button*, EMPTYARG) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); if ( m_pImpl->bWorkingPersistent ) { m_pImpl->pConfigData->setDatasourceName(sSelectedDS); @@ -1231,7 +1243,6 @@ public: Reference<XPropertySet> xProp(xAdminDialog,UNO_QUERY); if ( xProp.is() ) { - String sOldDS = m_aDatasource.GetText(); ::rtl::OUString sName; xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName"))) >>= sName; diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index f0c69a24e4e4..aa0e62046ea6 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -303,8 +303,9 @@ void WizardDialog::ImplPosTabPage() } else if ( meViewAlign == WINDOWALIGN_LEFT ) { - nOffX += aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X; - aDlgSize.Width() -= aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X; + long nViewOffset = mbEmptyViewMargin ? 0 : WIZARDDIALOG_VIEW_DLGOFFSET_X; + nOffX += aViewSize.Width() + nViewOffset; + aDlgSize.Width() -= nOffX; } else if ( meViewAlign == WINDOWALIGN_BOTTOM ) aDlgSize.Height() -= aViewSize.Height()+WIZARDDIALOG_VIEW_DLGOFFSET_Y; diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index 9b712e6f020c..32aae84696c4 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -439,16 +439,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) BYTE nPitchFamily; WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT); - - if ( !rFont.GetSize().Width() ) - { - VirtualDevice aDev; - FontMetric aMetric( aDev.GetFontMetric( rFont ) ); - WriteHeightWidth(Size(aMetric.GetWidth(),-rFont.GetSize().Height())); - } - else - WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); - + WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); *pWMF << (short)rFont.GetOrientation() << (short)rFont.GetOrientation(); switch (rFont.GetWeight()) { diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx index a6edea49f699..a067672f3cf6 100644 --- a/svtools/source/inc/passwordcontainer.hxx +++ b/svtools/source/inc/passwordcontainer.hxx @@ -34,13 +34,14 @@ #include <vector> #include <map> #include <com/sun/star/task/XPasswordContainer.hpp> +#include <com/sun/star/task/XUrlContainer.hpp> #include <com/sun/star/task/PasswordRequestMode.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/task/XMasterPasswordHandling2.hpp> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/factory.hxx> @@ -52,6 +53,8 @@ #include <rtl/ref.hxx> #include <osl/mutex.hxx> +#include "syscreds.hxx" + #define MEMORY_RECORD 0 #define PERSISTENT_RECORD 1 @@ -241,9 +244,10 @@ enum PasswordState { cancelled }; -class PasswordContainer : public ::cppu::WeakImplHelper4< +class PasswordContainer : public ::cppu::WeakImplHelper5< ::com::sun::star::task::XPasswordContainer, ::com::sun::star::task::XMasterPasswordHandling2, + ::com::sun::star::task::XUrlContainer, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XEventListener > { @@ -253,6 +257,7 @@ private: ::osl::Mutex mMutex; ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; + SysCredentialsConfig mUrlContainer; ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( const ::std::list< NamePassRecord >& original, @@ -269,6 +274,19 @@ private: const ::rtl::OUString& name, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); +bool createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, + ::com::sun::star::task::UrlRecord & rRec ) + throw( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::task::UrlRecord find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString GetDefaultMasterPassword(); @@ -369,6 +387,12 @@ public: virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); + // XUrlContainer + virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); + void Notify(); }; diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index 01f9d4ed0eef..d461e5898227 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -79,8 +79,8 @@ namespace svt //= DialogController //===================================================================== //--------------------------------------------------------------------- - DialogController::DialogController( Window& _rInstigator, const PWindowEventFilter _pEventFilter, - const PWindowOperator _pOperator ) + DialogController::DialogController( Window& _rInstigator, const PWindowEventFilter& _pEventFilter, + const PWindowOperator& _pOperator ) :m_pImpl( new DialogController_Data( _rInstigator, _pEventFilter, _pOperator ) ) { DBG_ASSERT( m_pImpl->pEventFilter.get() && m_pImpl->pOperator.get(), @@ -108,31 +108,33 @@ namespace svt void DialogController::addDependentWindow( Window& _rWindow ) { m_pImpl->aConcernedWindows.push_back( &_rWindow ); - impl_update( _rWindow ); + + VclWindowEvent aEvent( &_rWindow, 0, NULL ); + impl_update( aEvent, _rWindow ); } //--------------------------------------------------------------------- - IMPL_LINK( DialogController, OnWindowEvent, const VclSimpleEvent*, _pEvent ) + IMPL_LINK( DialogController, OnWindowEvent, const VclWindowEvent*, _pEvent ) { if ( m_pImpl->pEventFilter->payAttentionTo( *_pEvent ) ) - impl_updateAll(); + impl_updateAll( *_pEvent ); return 0L; } //--------------------------------------------------------------------- - void DialogController::impl_updateAll() + void DialogController::impl_updateAll( const VclWindowEvent& _rTriggerEvent ) { for ( ::std::vector< Window* >::iterator loop = m_pImpl->aConcernedWindows.begin(); loop != m_pImpl->aConcernedWindows.end(); ++loop ) - impl_update( *(*loop) ); + impl_update( _rTriggerEvent, *(*loop) ); } //--------------------------------------------------------------------- - void DialogController::impl_update( Window& _rWindow ) + void DialogController::impl_update( const VclWindowEvent& _rTriggerEvent, Window& _rWindow ) { - m_pImpl->pOperator->operateOn( _rWindow ); + m_pImpl->pOperator->operateOn( _rTriggerEvent, _rWindow ); } //===================================================================== @@ -177,6 +179,13 @@ namespace svt } //--------------------------------------------------------------------- + void ControlDependencyManager::addController( const PDialogController& _pController ) + { + OSL_ENSURE( _pController.get() != NULL, "ControlDependencyManager::addController: invalid controller, this will crash, sooner or later!" ); + m_pImpl->aControllers.push_back( _pController ); + } + + //--------------------------------------------------------------------- void ControlDependencyManager::enableOnRadioCheck( RadioButton& _rRadio, Window& _rDependentWindow ) { PDialogController pController( new RadioDependentEnabler( _rRadio ) ); diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 8eaf915f3b0c..6bd1126f8082 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp> #include <cppuhelper/implbase4.hxx> #include "vcl/svapp.hxx" #include <rtl/logfile.hxx> @@ -249,6 +250,7 @@ struct EmbeddedObjectRef_Impl sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member }; void EmbeddedObjectRef::Construct_Impl() @@ -260,6 +262,7 @@ void EmbeddedObjectRef::Construct_Impl() mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000); } EmbeddedObjectRef::EmbeddedObjectRef() @@ -286,6 +289,7 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) mpImp->aPersistName = rObj.mpImp->aPersistName; mpImp->aMediaType = rObj.mpImp->aMediaType; mpImp->bNeedUpdate = rObj.mpImp->bNeedUpdate; + mpImp->aDefaultSizeForChart_In_100TH_MM = rObj.mpImp->aDefaultSizeForChart_In_100TH_MM; if ( rObj.mpImp->pGraphic && !rObj.mpImp->bNeedUpdate ) mpImp->pGraphic = new Graphic( *rObj.mpImp->pGraphic ); @@ -334,6 +338,14 @@ void EmbeddedObjectRef::Assign( const NS_UNO::Reference < NS_EMBED::XEmbeddedObj mpImp->nViewAspect = nAspect; mxObj = xObj; mpImp->xListener = EmbedEventListener_Impl::Create( this ); + + //#i103460# + { + ::com::sun::star::uno::Reference < ::com::sun::star::chart2::XDefaultSizeTransmitter > xSizeTransmitter( xObj, uno::UNO_QUERY ); + DBG_ASSERT( xSizeTransmitter.is(), "Object does not support XDefaultSizeTransmitter -> will cause #i103460#!" ); + if( xSizeTransmitter.is() ) + xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); + } } void EmbeddedObjectRef::Clear() @@ -902,4 +914,18 @@ BOOL EmbeddedObjectRef::IsChart() const return sal_False; } +void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) +{ + //#i103460# charts do not necessaryly have an own size within ODF files, + //for this case they need to use the size settings from the surrounding frame, + //which is made available with this method + + mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size( rSizeIn_100TH_MM.getWidth(), rSizeIn_100TH_MM.getHeight() ); + + ::com::sun::star::uno::Reference < ::com::sun::star::chart2::XDefaultSizeTransmitter > xSizeTransmitter( mxObj, uno::UNO_QUERY ); + DBG_ASSERT( xSizeTransmitter.is(), "Object does not support XDefaultSizeTransmitter -> will cause #i103460#!" ); + if( xSizeTransmitter.is() ) + xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); +} + } diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 033ecefc10e7..ebd922bfedf7 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -478,6 +478,10 @@ Resource RID_ERRHDL { Text [ en-US ] = "The digitally signed document content and/or macros do not match the current document signature.\n\nThis could be the result of document manipulation or of structural document damage due to data transmission.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ; }; + String ERRCODE_SFX_INCOMPLETE_ENCRYPTION + { + Text [ en-US ] = "The encrypted document contains unexpected non-encrypted streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ; + }; String ERRCODE_IO_INVALIDLENGTH { diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 21953d25d92a..4458d4b0f132 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -302,6 +302,14 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Maltese" ; LANGUAGE_MALTESE ; > ; < "Tok Pisin" ; LANGUAGE_USER_TOK_PISIN ; > ; < "Shuswap" ; LANGUAGE_USER_SHUSWAP ; > ; + < "Oromo" ; LANGUAGE_OROMO ; > ; + < "Greek, Ancient" ; LANGUAGE_USER_ANCIENT_GREEK ; > ; + < "Yiddish" ; LANGUAGE_YIDDISH ; > ; + < "Quechua (Ecuador)" ; LANGUAGE_QUECHUA_ECUADOR ; > ; + < "Uyghur" ; LANGUAGE_UIGHUR_CHINA ; > ; + < "Asturian" ; LANGUAGE_USER_ASTURIAN ; > ; + < "Sorbian, Upper" ; LANGUAGE_UPPER_SORBIAN_GERMANY ; > ; + < "Sorbian, Lower" ; LANGUAGE_LOWER_SORBIAN_GERMANY ; > ; }; }; diff --git a/svtools/source/misc1/docmspasswdrequest.cxx b/svtools/source/misc1/docmspasswdrequest.cxx deleted file mode 100644 index e892d3a57d1a..000000000000 --- a/svtools/source/misc1/docmspasswdrequest.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright IBM Corporation 2009. - * Copyright 2009 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docmspasswdrequest.cxx,v $ - * $Revision: 1.0 $ - * - * 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 "docmspasswdrequest.hxx" -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionPassword.hpp> - -//========================================================================== - -class MSAbortContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionAbort > -{ - sal_Bool mbSelected; - -public: - MSAbortContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException) { mbSelected = sal_True; } -}; - -//========================================================================== - -class MSPasswordContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionPassword > -{ - sal_Bool mbSelected; - ::rtl::OUString maPassword; - -public: - MSPasswordContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPassword( const ::rtl::OUString& aPass ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException); -}; - -void SAL_CALL MSPasswordContinuation::select() - throw(::com::sun::star::uno::RuntimeException) -{ - mbSelected = sal_True; -} - -void SAL_CALL MSPasswordContinuation::setPassword( const ::rtl::OUString& aPass ) - throw (::com::sun::star::uno::RuntimeException) -{ - maPassword = aPass; -} - -::rtl::OUString SAL_CALL MSPasswordContinuation::getPassword() - throw (::com::sun::star::uno::RuntimeException) -{ - return maPassword; -} - -//========================================================================== - -RequestMSDocumentPassword::RequestMSDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ) -{ - ::rtl::OUString temp; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; - ::com::sun::star::task::DocumentMSPasswordRequest - aDocumentMSPasswordRequest( temp, - temp2, - ::com::sun::star::task::InteractionClassification_QUERY, - nMode, - aName ); - - m_aRequest <<= aDocumentMSPasswordRequest; - - m_pAbort = new MSAbortContinuation; - m_pPassword = new MSPasswordContinuation; - - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pPassword ); -} - -sal_Bool RequestMSDocumentPassword::isAbort() -{ - return m_pAbort->isSelected(); -} - -sal_Bool RequestMSDocumentPassword::isPassword() -{ - return m_pPassword->isSelected(); -} - -::rtl::OUString RequestMSDocumentPassword::getPassword() -{ - return m_pPassword->getPassword(); -} - -::com::sun::star::uno::Any SAL_CALL RequestMSDocumentPassword::getRequest() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_aRequest; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > - SAL_CALL RequestMSDocumentPassword::getContinuations() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_lContinuations; -} - - diff --git a/svtools/source/misc1/docpasswdrequest.cxx b/svtools/source/misc1/docpasswdrequest.cxx deleted file mode 100644 index 37ceb85ec132..000000000000 --- a/svtools/source/misc1/docpasswdrequest.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************* - * - * 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: docpasswdrequest.cxx,v $ - * $Revision: 1.5 $ - * - * 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 "docpasswdrequest.hxx" -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionPassword.hpp> - -//========================================================================== - -class AbortContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionAbort > -{ - sal_Bool mbSelected; - -public: - AbortContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException) { mbSelected = sal_True; } -}; - -//========================================================================== - -class PasswordContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionPassword > -{ - sal_Bool mbSelected; - ::rtl::OUString maPassword; - -public: - PasswordContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPassword( const ::rtl::OUString& aPass ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException); -}; - -void SAL_CALL PasswordContinuation::select() - throw(::com::sun::star::uno::RuntimeException) -{ - mbSelected = sal_True; -} - -void SAL_CALL PasswordContinuation::setPassword( const ::rtl::OUString& aPass ) - throw (::com::sun::star::uno::RuntimeException) -{ - maPassword = aPass; -} - -::rtl::OUString SAL_CALL PasswordContinuation::getPassword() - throw (::com::sun::star::uno::RuntimeException) -{ - return maPassword; -} - -//========================================================================== - -RequestDocumentPassword::RequestDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ) -{ - ::rtl::OUString temp; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; - ::com::sun::star::task::DocumentPasswordRequest - aDocumentPasswordRequest( temp, - temp2, - ::com::sun::star::task::InteractionClassification_QUERY, - nMode, - aName ); - - m_aRequest <<= aDocumentPasswordRequest; - - m_pAbort = new AbortContinuation; - m_pPassword = new PasswordContinuation; - - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pPassword ); -} - -sal_Bool RequestDocumentPassword::isAbort() -{ - return m_pAbort->isSelected(); -} - -sal_Bool RequestDocumentPassword::isPassword() -{ - return m_pPassword->isSelected(); -} - -::rtl::OUString RequestDocumentPassword::getPassword() -{ - return m_pPassword->getPassword(); -} - -::com::sun::star::uno::Any SAL_CALL RequestDocumentPassword::getRequest() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_aRequest; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > - SAL_CALL RequestDocumentPassword::getContinuations() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_lContinuations; -} - - diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk index 3ca57ff36f92..dd143ea4e972 100644 --- a/svtools/source/misc1/makefile.mk +++ b/svtools/source/misc1/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -49,14 +49,11 @@ EXCEPTIONSFILES=\ SLOFILES=\ $(EXCEPTIONSFILES) \ $(SLO)$/adrparse.obj \ - $(SLO)$/docpasswdrequest.obj \ - $(SLO)$/docmspasswdrequest.obj \ $(SLO)$/filenotation.obj \ $(SLO)$/inethist.obj \ $(SLO)$/inettype.obj \ $(SLO)$/iniadrtk.obj \ $(SLO)$/lngmisc.obj \ - $(SLO)$/loginerr.obj \ $(SLO)$/PasswordHelper.obj SRS1NAME=$(TARGET) diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx index 7417367ec124..d65a2fd696ce 100644 --- a/svtools/source/numbers/numfmuno.cxx +++ b/svtools/source/numbers/numfmuno.cxx @@ -774,7 +774,7 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPro else if (aString.EqualsAscii( PROPERTYNAME_LOCALE )) { lang::Locale aLocale( MsLangId::convertLanguageToLocale( - pFormat->GetLanguage())); + pFormat->GetLanguage())); aRet <<= aLocale; } else if (aString.EqualsAscii( PROPERTYNAME_TYPE )) diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx index d6ce04c4da2a..77b33226559c 100644 --- a/svtools/source/numbers/zforscan.cxx +++ b/svtools/source/numbers/zforscan.cxx @@ -491,6 +491,8 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) if ( j < NF_MAX_DEFAULT_COLORS ) i = j; } + + Color* pResult = NULL; if (i >= NF_MAX_DEFAULT_COLORS) { const String& rColorWord = pKeyword[NF_KEY_COLOR]; @@ -516,15 +518,9 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) { long nIndex = sString.ToInt32(); if (nIndex > 0 && nIndex <= 64) - return pFormatter->GetUserDefColor((USHORT)nIndex-1); - else - return NULL; + pResult = pFormatter->GetUserDefColor((USHORT)nIndex-1); } - else - return NULL; } - else - return NULL; } else { @@ -538,8 +534,9 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) else sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; - return &(StandardColor[i]); + pResult = &(StandardColor[i]); } + return pResult; } diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk index 70692ecbf06b..31e1336ad966 100644 --- a/svtools/source/passwordcontainer/makefile.mk +++ b/svtools/source/passwordcontainer/makefile.mk @@ -43,7 +43,8 @@ DLLPRE= # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/passwordcontainer.obj + $(SLO)$/passwordcontainer.obj\ + $(SLO)$/syscreds.obj SHL1TARGET= $(TARGET) SHL1IMPLIB= i$(TARGET) diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx index 9855e7e3c487..cebde0705f12 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svtools/source/passwordcontainer/passwordcontainer.cxx @@ -152,10 +152,17 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) static sal_Bool shorterUrl( ::rtl::OUString& aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 ) + + if( aInd > 0 ) { - aURL = aURL.copy( 0, aInd ); - return sal_True; + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return sal_True; + } } return sal_False; @@ -753,37 +760,14 @@ void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUS UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( mMutex ); - - if( !m_aContainer.empty() ) - { - ::rtl::OUString aUrl( aURL ); - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - - // each iteration remove last '/...' section from the aUrl - // while it's possible, up to the most left '://' - while( shorterUrl( aUrl ) ) - { - // first look for <url>/somename and then look for <url>/somename/... - aIter = m_aContainer.find( aUrl ); - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - else - { - ::rtl::OUString tmpUrl( aUrl ); - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + return find( aURL, rtl::OUString(), false, aHandler ); +} - aIter = m_aContainer.lower_bound( aUrl ); - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - } - } - } +//------------------------------------------------------------------------- - return UrlRecord(); +UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + return find( aURL, aName, true, aHandler ); } //------------------------------------------------------------------------- @@ -810,48 +794,76 @@ Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >& //------------------------------------------------------------------------- -UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +bool PasswordContainer::createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const Reference< XInteractionHandler >& aHandler, + UrlRecord & rRec ) + throw( RuntimeException ) { + if ( bName ) + { + Sequence< UserRecord > aUsrRec + = FindUsr( rIter->second, aName, aHandler ); + if( aUsrRec.getLength() ) + { + rRec = UrlRecord( rIter->first, aUsrRec ); + return true; + } + } + else + { + rRec = UrlRecord( + rIter->first, + CopyToUserRecordSequence( rIter->second, aHandler ) ); + return true; + } + return false; +} + +//------------------------------------------------------------------------- +UrlRecord PasswordContainer::find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ ::osl::MutexGuard aGuard( mMutex ); - if( !m_aContainer.empty() ) + + if( !m_aContainer.empty() && aURL.getLength() ) { ::rtl::OUString aUrl( aURL ); - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter != m_aContainer.end() ) - { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); - } // each iteration remove last '/...' section from the aUrl // while it's possible, up to the most left '://' - while( shorterUrl( aUrl ) ) + do { // first look for <url>/somename and then look for <url>/somename/... - aIter = m_aContainer.find( aUrl ); + PassMap::iterator aIter = m_aContainer.find( aUrl ); if( aIter != m_aContainer.end() ) { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; } else { ::rtl::OUString tmpUrl( aUrl ); - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); - aIter = m_aContainer.lower_bound( aUrl ); - if( aIter != m_aContainer.end() ) + aIter = m_aContainer.lower_bound( tmpUrl ); + if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) ) { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; } } } + while( shorterUrl( aUrl ) && aUrl.getLength() ); } return UrlRecord(); @@ -1355,6 +1367,35 @@ void SAL_CALL PasswordContainer::removeMasterPassword() return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() ); } + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) + throw (uno::RuntimeException) +{ + mUrlContainer.add( Url, MakePersistent ); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + return mUrlContainer.find( Url ); +} + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + mUrlContainer.remove( Url ); +} + +//------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent ) + throw (uno::RuntimeException) +{ + return mUrlContainer.list( OnlyPersistent ); +} + //------------------------------------------------------------------------- void PasswordContainer::Notify() @@ -1487,7 +1528,9 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode aRememberModes, // rRememberPasswordModes RememberAuthentication_NO, // eDefaultRememberPasswordMode aRememberModes, // rRememberAccountModes - RememberAuthentication_NO // eDefaultRememberAccountMode + RememberAuthentication_NO, // eDefaultRememberAccountMode + sal_False, // bCanUseSystemCredentials + sal_False // bDefaultUseSystemCredentials ); Sequence< diff --git a/svtools/source/passwordcontainer/syscreds.cxx b/svtools/source/passwordcontainer/syscreds.cxx new file mode 100644 index 000000000000..b8c223040e6d --- /dev/null +++ b/svtools/source/passwordcontainer/syscreds.cxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * 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: $ + * $Revision: $ + * + * 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. + * + ************************************************************************/ + +#include "syscreds.hxx" +#include "com/sun/star/beans/PropertyValue.hpp" + +using namespace com::sun::star; + +SysCredentialsConfigItem::SysCredentialsConfigItem( + SysCredentialsConfig * pOwner ) +: utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Common/Passwords" ), + CONFIG_MODE_IMMEDIATE_UPDATE ), + m_bInited( false ), + m_pOwner( pOwner ) +{ + uno::Sequence< ::rtl::OUString > aNode( 1 ); + aNode[ 0 ] = rtl::OUString::createFromAscii( + "Office.Common/Passwords/AuthenticateUsingSystemCredentials" ); + EnableNotification( aNode ); +} + +//virtual +void SysCredentialsConfigItem::Notify( + const uno::Sequence< rtl::OUString > & /*seqPropertyNames*/ ) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_bInited = false; + // rebuild m_seqURLs + getSystemCredentialsURLs(); + } + m_pOwner->persistentConfigChanged(); +} + +uno::Sequence< rtl::OUString > +SysCredentialsConfigItem::getSystemCredentialsURLs() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bInited ) + { + // read config item + uno::Sequence< ::rtl::OUString > aPropNames( 1 ); + aPropNames[ 0 ] = rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + uno::Sequence< uno::Any > aAnyValues( + utl::ConfigItem::GetProperties( aPropNames ) ); + + OSL_ENSURE( + aAnyValues.getLength() == 1, + "SysCredentialsConfigItem::getSystemCredentialsURLs: " + "Error reading config item!" ); + + uno::Sequence< rtl::OUString > aValues; + if ( ( aAnyValues[ 0 ] >>= aValues ) || + ( !aAnyValues[ 0 ].hasValue() ) ) + { + m_seqURLs = aValues; + m_bInited = true; + } + } + return m_seqURLs; +} + +void SysCredentialsConfigItem::setSystemCredentialsURLs( + const uno::Sequence< rtl::OUString > & seqURLList ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // write config item. + uno::Sequence< rtl::OUString > aPropNames( 1 ); + uno::Sequence< uno::Any > aPropValues( 1 ); + aPropNames[ 0 ] + = ::rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + aPropValues[ 0 ] <<= seqURLList; + + utl::ConfigItem::SetModified(); + utl::ConfigItem::PutProperties( aPropNames, aPropValues ); + + m_seqURLs = seqURLList; + m_bInited = true; +} + +//============================================================================ + +namespace +{ + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + bool removeLastSegment( ::rtl::OUString & aURL ) + { + sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); + + if( aInd > 0 ) + { + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return true; + } + } + + return false; + } + + bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) + { + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + if( !rContainer.empty() && aURL.getLength() ) + { + ::rtl::OUString aUrl( aURL ); + + // each iteration remove last '/...' section from the aUrl + // while it's possible, up to the most left '://' + do + { + // first look for <url>/somename and then look for <url>/somename/... + StringSet::const_iterator aIter = rContainer.find( aUrl ); + if( aIter != rContainer.end() ) + { + aResult = *aIter; + return true; + } + else + { + ::rtl::OUString tmpUrl( aUrl ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = rContainer.lower_bound( tmpUrl ); + if( aIter != rContainer.end() && aIter->match( tmpUrl ) ) + { + aResult = *aIter; + return true; + } + } + } + while( removeLastSegment( aUrl ) && aUrl.getLength() ); + } + aResult = rtl::OUString(); + return false; + } + +} // namespace + +SysCredentialsConfig::SysCredentialsConfig() +: m_aConfigItem( this ), + m_bCfgInited( false ) +{ +} + +void SysCredentialsConfig::initCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bCfgInited ) + { + uno::Sequence< rtl::OUString > aURLs( + m_aConfigItem.getSystemCredentialsURLs() ); + for ( sal_Int32 n = 0; n < aURLs.getLength(); ++n ) + m_aCfgContainer.insert( aURLs[ n ] ); + + m_bCfgInited = true; + } +} + +void SysCredentialsConfig::writeCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + + OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" ); + + uno::Sequence< rtl::OUString > aURLs( m_aCfgContainer.size() ); + StringSet::const_iterator it = m_aCfgContainer.begin(); + const StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aURLs[ n ] = *it; + ++it; + ++n; + } + + m_aConfigItem.setSystemCredentialsURLs( aURLs ); +} + +rtl::OUString SysCredentialsConfig::find( rtl::OUString const & aURL ) +{ + osl::MutexGuard aGuard( m_aMutex ); + rtl::OUString aResult; + if ( findURL( m_aMemContainer, aURL, aResult ) ) + return aResult; + + initCfg(); + if ( findURL( m_aCfgContainer, aURL, aResult ) ) + return aResult; + + return rtl::OUString(); +} + +void SysCredentialsConfig::add( rtl::OUString const & rURL, bool bPersistent ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( bPersistent ) + { + m_aMemContainer.erase( rURL ); + + initCfg(); + m_aCfgContainer.insert( rURL ); + writeCfg(); + } + else + { + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); + + m_aMemContainer.insert( rURL ); + } +} + +void SysCredentialsConfig::remove( rtl::OUString const & rURL ) +{ + m_aMemContainer.erase( rURL ); + + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); +} + +uno::Sequence< rtl::OUString > SysCredentialsConfig::list( bool bOnlyPersistent ) +{ + initCfg(); + sal_Int32 nCount = m_aCfgContainer.size() + + ( bOnlyPersistent ? 0 : m_aMemContainer.size() ); + uno::Sequence< rtl::OUString > aResult( nCount ); + + StringSet::const_iterator it = m_aCfgContainer.begin(); + StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + + if ( !bOnlyPersistent ) + { + it = m_aMemContainer.begin(); + end = m_aMemContainer.end(); + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + } + return aResult; +} + +void SysCredentialsConfig::persistentConfigChanged() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + m_bCfgInited = false; // re-init on demand. +} diff --git a/svtools/source/passwordcontainer/syscreds.hxx b/svtools/source/passwordcontainer/syscreds.hxx new file mode 100644 index 000000000000..b037e17c348e --- /dev/null +++ b/svtools/source/passwordcontainer/syscreds.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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: $ + * $Revision: $ + * + * 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 INCLUDED_SVTOOLS_SYSCREDS_HXX +#define INCLUDED_SVTOOLS_SYSCREDS_HXX + +#include <set> +#include <memory> +#include "osl/mutex.hxx" +#include "rtl/ustring.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "unotools/configitem.hxx" + +class SysCredentialsConfig; + +class SysCredentialsConfigItem : public utl::ConfigItem +{ + public: + SysCredentialsConfigItem( SysCredentialsConfig * pOwner ); + //virtual ~SysCredentialsConfigItem(); + + virtual void Notify( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqPropertyNames ); + //virtual void Commit(); + + com::sun::star::uno::Sequence< rtl::OUString > + getSystemCredentialsURLs(); + + void setSystemCredentialsURLs( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqURLList ); + + //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const; + +private: + ::osl::Mutex m_aMutex; + bool m_bInited; + com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs; + SysCredentialsConfig * m_pOwner; +}; + +typedef std::set< rtl::OUString > StringSet; + +class SysCredentialsConfig +{ + public: + SysCredentialsConfig(); + + rtl::OUString find( rtl::OUString const & rURL ); + void add( rtl::OUString const & rURL, bool bPersistent ); + void remove( rtl::OUString const & rURL ); + com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent ); + + void persistentConfigChanged(); + + private: + void initCfg(); + void writeCfg(); + + ::osl::Mutex m_aMutex; + StringSet m_aMemContainer; + StringSet m_aCfgContainer; + SysCredentialsConfigItem m_aConfigItem; + bool m_bCfgInited; +}; + +#endif // INCLUDED_SVTOOLS_SYSCREDS_HXX diff --git a/svtools/source/syslocale/syslocale.cxx b/svtools/source/syslocale/syslocale.cxx index abe236bb46d0..9811d97fd964 100644 --- a/svtools/source/syslocale/syslocale.cxx +++ b/svtools/source/syslocale/syslocale.cxx @@ -66,18 +66,18 @@ public: virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + CharClass* GetCharClass(); + }; // ----------------------------------------------------------------------- -SvtSysLocale_Impl::SvtSysLocale_Impl() +SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { const lang::Locale& rLocale = Application::GetSettings().GetLocale(); pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), rLocale ); - pCharClass = new CharClass( - ::comphelper::getProcessServiceFactory(), rLocale ); aSysLocaleOptions.AddListener( *this ); } @@ -89,7 +89,15 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() delete pLocaleData; } - +CharClass* SvtSysLocale_Impl::GetCharClass() +{ + if ( !pCharClass ) + { + const lang::Locale& rLocale = Application::GetSettings().GetLocale(); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); + } + return pCharClass; +} void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) { const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); @@ -98,7 +106,7 @@ void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) MutexGuard aGuard( SvtSysLocale::GetMutex() ); const lang::Locale& rLocale = Application::GetSettings().GetLocale(); pLocaleData->setLocale( rLocale ); - pCharClass->setLocale( rLocale ); + GetCharClass()->setLocale( rLocale ); } } @@ -158,11 +166,11 @@ const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const const CharClass& SvtSysLocale::GetCharClass() const { - return *(pImpl->pCharClass); + return *(pImpl->GetCharClass()); } const CharClass* SvtSysLocale::GetCharClassPtr() const { - return pImpl->pCharClass; + return pImpl->GetCharClass(); } diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index e6922aa4f099..54cc448ff89e 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -133,7 +133,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: } else if (aServiceName.EqualsIgnoreCaseAscii("roadmap") ) { - pWindow = new ::svt::ORoadmap( pParent, WB_DIALOGCONTROL); + pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP ); *ppNewComp = new SVTXRoadmap; } else if ( aServiceName.EqualsIgnoreCaseAscii( "ProgressBar" ) ) diff --git a/toolkit/inc/toolkit/helper/vclunohelper.hxx b/toolkit/inc/toolkit/helper/vclunohelper.hxx index 1c5d89a3cc64..e29b7237abb8 100644 --- a/toolkit/inc/toolkit/helper/vclunohelper.hxx +++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/awt/MouseEvent.hpp> namespace com { namespace sun { namespace star { namespace uno { @@ -59,6 +60,7 @@ namespace com { namespace sun { namespace star { namespace awt { struct SimpleFontMetric; struct FontDescriptor; struct Rectangle; + struct KeyEvent; }}}} @@ -71,6 +73,8 @@ namespace com { namespace sun { namespace star { namespace awt { class Window; class OutputDevice; +class MouseEvent; +class KeyEvent; // ---------------------------------------------------- // class VclUnoHelper @@ -144,6 +148,18 @@ public: static ::Rectangle ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect ); static ::com::sun::star::awt::Rectangle ConvertToAWTRect( ::Rectangle const & _rRect ); + + static ::com::sun::star::awt::MouseEvent + createMouseEvent( + const ::MouseEvent& _rVclEvent, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext + ); + + static ::com::sun::star::awt::KeyEvent + createKeyEvent( + const ::KeyEvent& _rVclEvent, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext + ); }; diff --git a/toolkit/source/awt/makefile.mk b/toolkit/source/awt/makefile.mk index 86953691ad27..406386c5723e 100644 --- a/toolkit/source/awt/makefile.mk +++ b/toolkit/source/awt/makefile.mk @@ -44,7 +44,6 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- .IF "$(GUIBASE)"=="aqua" -OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) .ENDIF # "$(GUIBASE)"=="aqua" diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index c8e5e1bd3853..5200849d66ed 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -578,7 +578,7 @@ sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun: sal_Int16 nRet = 0; if ( mpMenu && IsPopupMenu() ) - nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags ); + nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags | POPUPMENU_NOMOUSEUPCLOSE ); return nRet; } diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 337400c08713..9ca21c5fb36b 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -554,48 +554,6 @@ void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pW pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset ); } -void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent, const KeyEvent& rEvt ) -{ - rEvent.Modifiers = 0; - if ( rEvt.GetKeyCode().IsShift() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT; - if ( rEvt.GetKeyCode().IsMod1() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1; - if ( rEvt.GetKeyCode().IsMod2() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2; - if ( rEvt.GetKeyCode().IsMod3() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD3; - - rEvent.KeyCode = rEvt.GetKeyCode().GetCode(); - rEvent.KeyChar = rEvt.GetCharCode(); - rEvent.KeyFunc = sal::static_int_cast< sal_Int16 >( - rEvt.GetKeyCode().GetFunction()); -} - -void ImplInitMouseEvent( awt::MouseEvent& rEvent, const MouseEvent& rEvt ) -{ - rEvent.Modifiers = 0; - if ( rEvt.IsShift() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT; - if ( rEvt.IsMod1() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1; - if ( rEvt.IsMod2() ) - rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2; - - rEvent.Buttons = 0; - if ( rEvt.IsLeft() ) - rEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT; - if ( rEvt.IsRight() ) - rEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT; - if ( rEvt.IsMiddle() ) - rEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE; - - rEvent.X = rEvt.GetPosPixel().X(); - rEvent.Y = rEvt.GetPosPixel().Y(); - rEvent.ClickCount = rEvt.GetClicks(); - rEvent.PopupTrigger = sal_False; -} - // ---------------------------------------------------- // class VCLXWindow // ---------------------------------------------------- @@ -890,9 +848,9 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if ( mpImpl->getKeyListeners().getLength() ) { - ::com::sun::star::awt::KeyEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); + ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( + *(KeyEvent*)rVclWindowEvent.GetData(), *this + ) ); mpImpl->getKeyListeners().keyPressed( aEvent ); } } @@ -901,9 +859,9 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if ( mpImpl->getKeyListeners().getLength() ) { - ::com::sun::star::awt::KeyEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); + ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( + *(KeyEvent*)rVclWindowEvent.GetData(), *this + ) ); mpImpl->getKeyListeners().keyReleased( aEvent ); } } @@ -925,9 +883,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) } MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 ); - awt::MouseEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitMouseEvent( aEvent, aMEvt ); + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) ); aEvent.PopupTrigger = sal_True; mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED ); } @@ -938,10 +894,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData(); if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) { - awt::MouseEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitMouseEvent( aEvent, *pMouseEvt ); - + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) ); mpImpl->notifyMouseEvent( aEvent, pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED @@ -950,11 +903,8 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) { - awt::MouseEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitMouseEvent( aEvent, *pMouseEvt ); + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) ); aEvent.ClickCount = 0; // #92138# - if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE ) mpImpl->getMouseMotionListeners().mouseMoved( aEvent ); else @@ -966,9 +916,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if ( mpImpl->getMouseListeners().getLength() ) { - awt::MouseEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitMouseEvent( aEvent, *(MouseEvent*)rVclWindowEvent.GetData() ); + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED ); } } @@ -977,9 +925,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if ( mpImpl->getMouseListeners().getLength() ) { - awt::MouseEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitMouseEvent( aEvent, *(MouseEvent*)rVclWindowEvent.GetData() ); + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED ); } } @@ -2560,7 +2506,14 @@ void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::sta ::vos::OGuard aGuard( GetMutex() ); if ( GetWindow() ) - GetWindow()->SetZoom( Fraction( fZoomX ) ); + { + // Fraction::Fraction takes a double, but we have a float only. + // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to + // 1.200000000047something. To prevent this, we convert explicitly to double, and round it. + double nZoom( fZoomX ); + nZoom = ::rtl::math::round( nZoom, 4 ); + GetWindow()->SetZoom( Fraction( nZoom ) ); + } } // ::com::sun::star::lang::XEventListener diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 724421da5f3c..da3a265130b8 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -104,6 +104,7 @@ static void lcl_throwIndexOutOfBoundsException( ) ImplRegisterProperty( BASEPROPERTY_COMPLETE ); ImplRegisterProperty( BASEPROPERTY_ACTIVATED ); ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TEXT ); } diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 029e520baca6..89bde88d018e 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -45,6 +45,8 @@ #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontWidth.hpp> +#include <com/sun/star/awt/KeyModifier.hpp> +#include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/embed/EmbedMapUnits.hpp> @@ -67,6 +69,8 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Point.hpp> +using namespace ::com::sun::star; + // ---------------------------------------------------- // class VCLUnoHelper // ---------------------------------------------------- @@ -745,3 +749,54 @@ com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint * { return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() ); } + +awt::MouseEvent VCLUnoHelper::createMouseEvent( const ::MouseEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext ) +{ + awt::MouseEvent aMouseEvent; + aMouseEvent.Source = _rxContext; + + aMouseEvent.Modifiers = 0; + if ( _rVclEvent.IsShift() ) + aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT; + if ( _rVclEvent.IsMod1() ) + aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1; + if ( _rVclEvent.IsMod2() ) + aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2; + + aMouseEvent.Buttons = 0; + if ( _rVclEvent.IsLeft() ) + aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT; + if ( _rVclEvent.IsRight() ) + aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT; + if ( _rVclEvent.IsMiddle() ) + aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE; + + aMouseEvent.X = _rVclEvent.GetPosPixel().X(); + aMouseEvent.Y = _rVclEvent.GetPosPixel().Y(); + aMouseEvent.ClickCount = _rVclEvent.GetClicks(); + aMouseEvent.PopupTrigger = sal_False; + + return aMouseEvent; +} + +awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext ) +{ + awt::KeyEvent aKeyEvent; + aKeyEvent.Source = _rxContext; + + aKeyEvent.Modifiers = 0; + if ( _rVclEvent.GetKeyCode().IsShift() ) + aKeyEvent.Modifiers |= awt::KeyModifier::SHIFT; + if ( _rVclEvent.GetKeyCode().IsMod1() ) + aKeyEvent.Modifiers |= awt::KeyModifier::MOD1; + if ( _rVclEvent.GetKeyCode().IsMod2() ) + aKeyEvent.Modifiers |= awt::KeyModifier::MOD2; + if ( _rVclEvent.GetKeyCode().IsMod3() ) + aKeyEvent.Modifiers |= awt::KeyModifier::MOD3; + + aKeyEvent.KeyCode = _rVclEvent.GetKeyCode().GetCode(); + aKeyEvent.KeyChar = _rVclEvent.GetCharCode(); + aKeyEvent.KeyFunc = ::sal::static_int_cast< sal_Int16 >( _rVclEvent.GetKeyCode().GetFunction()); + + return aKeyEvent; +} diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk index a04bdcbdf801..3c5da82d0dd9 100644 --- a/toolkit/util/makefile.mk +++ b/toolkit/util/makefile.mk @@ -80,22 +80,6 @@ DEF1DEPN =$(LIB1TARGET) DEF1DES =TK DEFLIB1NAME =tk -.IF "$(OS)"=="MACOSX" - -# [ed] 6/16/02 Add in X libraries if we're building X - -.IF "$(GUIBASE)"=="unx" -SHL1STDLIBS +=\ - -lX11 -lXt -lXmu -.ENDIF - -.ELSE -.IF "$(GUI)"=="UNX" -SHL1STDLIBS +=\ - -lX11 -.ENDIF -.ENDIF - RESLIB1IMAGES=$(PRJ)$/source$/awt RES1FILELIST=$(SRS)$/awt.srs RESLIB1NAME=$(TARGET) diff --git a/tools/inc/tools/errcode.hxx b/tools/inc/tools/errcode.hxx index af420397eba2..337fedfea44a 100644 --- a/tools/inc/tools/errcode.hxx +++ b/tools/inc/tools/errcode.hxx @@ -314,6 +314,7 @@ inline ULONG ERRCODE_TOERROR( ULONG x ) #define PRINTER_ABORT ERRCODE_IO_ABORT #define PRINTER_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY #define PRINTER_GENERALERROR ERRCODE_IO_GENERAL +#define PRINTER_ACCESSDENIED ERRCODE_IO_ACCESSDENIED #define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1) #define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2) diff --git a/tools/inc/tools/rc.h b/tools/inc/tools/rc.h index 11d6e2030162..8bad7dbf3f8a 100644 --- a/tools/inc/tools/rc.h +++ b/tools/inc/tools/rc.h @@ -102,6 +102,7 @@ typedef short RSWND_STYLE; //#define NUMERICFORMATTER_I12 0x08 // erAck: got rid of class International (2005-06-17) #define NUMERICFORMATTER_DECIMALDIGITS 0x10 #define NUMERICFORMATTER_VALUE 0x20 +#define NUMERICFORMATTER_NOTHOUSANDSEP 0x40 #define METRICFORMATTER_UNIT 0x01 #define METRICFORMATTER_CUSTOMUNITTEXT 0x02 diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 2aff0d734bf6..f7ffed5e4dd1 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -407,7 +407,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] { "out", "out://", 0, true, false, false, false, false, false, false, false }, { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false, - false, true, false, true, false }, + false, true, true, true, false }, { "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false, false, false, false, true, false }, { "vim", "vim://", 0, true, true, false, true, false, false, true, @@ -4825,9 +4825,8 @@ bool INetURLObject::setFSysPath(rtl::OUString const & rFSysPath, break; } - rtl::OUStringBuffer aSynAbsURIRef( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://"), - RTL_TEXTENCODING_ASCII_US)); + rtl::OUStringBuffer aSynAbsURIRef(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://"))); + switch (eStyle) { case FSYS_VOS: diff --git a/transex3/prj/build.lst b/transex3/prj/build.lst index 91a5056acce3..0017471af134 100644 --- a/transex3/prj/build.lst +++ b/transex3/prj/build.lst @@ -1,7 +1,10 @@ -tr transex3 : tools NULL +tr transex3 : tools libxslt berkeleydb LUCENE:lucene NULL tr transex3 usr1 - all tr_mkout NULL tr transex3\inc nmake - all tr_inc NULL tr transex3\source nmake - all tr_src tr_inc NULL tr transex3\layout nmake - all rt_layout tr_src tr_inc NULL tr transex3\java\l10nconv nmake - all tr_conv NULL tr transex3\java\receditor nmake - all tr_rece NULL +tr transex3\source\help nmake - all tr_bla_help NULL +tr transex3\source\filter\utils nmake - all tr_bla_utils NULL +tr transex3\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst index 54d1ab156205..39bafa4694c6 100644 --- a/transex3/prj/d.lst +++ b/transex3/prj/d.lst @@ -1,4 +1,10 @@ mkdir: %_DEST%\inc%_EXT%\transex3 +mkdir: %_DEST%\bin%_EXT% +mkdir: %_DEST%\bin%_EXT%\help +mkdir: %_DEST%\bin%_EXT%\help\com +mkdir: %_DEST%\bin%_EXT%\help\com\sun +mkdir: %_DEST%\bin%_EXT%\help\com\sun\star +mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\%__SRC%\bin\cfgex.exe %_DEST%\bin%_EXT%\cfgex.exe ..\%__SRC%\bin\cfgex %_DEST%\bin%_EXT%\cfgex @@ -20,6 +26,14 @@ mkdir: %_DEST%\inc%_EXT%\transex3 ..\%__SRC%\bin\txtconv %_DEST%\bin%_EXT%\txtconv ..\%__SRC%\bin\tralay.exe %_DEST%\bin%_EXT%\tralay.exe ..\%__SRC%\bin\tralay %_DEST%\bin%_EXT%\tralay +..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv +..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin%_EXT%\FCFGMerge.jar +..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin%_EXT%\HelpIndexerTool.jar +..\%__SRC%\bin\HelpLinker %_DEST%\bin%_EXT%\HelpLinker +..\%__SRC%\bin\HelpCompiler %_DEST%\bin%_EXT%\HelpCompiler +..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin%_EXT%\HelpCompiler.exe +..\%__SRC%\bin\HelpLinker.exe %_DEST%\bin%_EXT%\HelpLinker.exe +..\%__SRC%\bin\HelpLinker* %_DEST%\bin%_EXT% ..\%__SRC%\class\converter\converter.jar %_DEST%\bin%_EXT%\converter.jar ..\%__SRC%\doc\converter_javadoc.zip %_DEST%\bin%_EXT%\converter_javadoc.zip @@ -38,3 +52,8 @@ mkdir: %_DEST%\inc%_EXT%\transex3 ..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\transex3\utf8conv.hxx ..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib ..\%__SRC%\lib\libtransex.a %_DEST%\lib%_EXT%\libtransex.a + +..\source\help\compilehelp.hxx %_DEST%\inc%_EXT%\transex3\compilehelp.hxx +#..\source\help\helplinkerdllapi.h %_DEST%\inc%_EXT%\transex3\helplinkerdllapi.h +..\%__SRC%\lib\* %_DEST%\lib%_EXT%\* +..\%__SRC%\class\com\sun\star\help\* %_DEST%\bin%_EXT%\help\com\sun\star\help\* diff --git a/transex3/source/filter/merge/FCFGMerge.cfg b/transex3/source/filter/merge/FCFGMerge.cfg new file mode 100644 index 000000000000..46fcccafe7e4 --- /dev/null +++ b/transex3/source/filter/merge/FCFGMerge.cfg @@ -0,0 +1,125 @@ +#************************************************************************* +# +# 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: FCFGMerge.cfg,v $ +# +# $Revision: 1.5 $ +# +# 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. +# +#************************************************************************* + +#************************************************ +# Specify the verbose mode of this tool. +# 1 = show errors only +# 2 = show errors/warnings (default) +# 3 = show errors/warnings and some generic infos +# 4 = show anything (including detailed infos) +# +# [OPTIONAL] +#************************************************ + +loglevel = 2 + +#************************************************ +# This extension is used for all XML files. It doesnt +# matter if its used for reading fragments or writing +# XML packages. +# Must be given without any additional signes like "." +# or "*."! +# +# [REQUIRED] +#************************************************ + +extension_xcu=xcu + +#************************************************ +# This extension is used for all Package files. It doesnt +# matter if its used for reading such files or writing +# it. +# Must be given without any additional signes like "." +# or "*."! +# +# [REQUIRED] +#************************************************ + +extension_pkg=pkg + +#************************************************ +# These values are used to generate a correct XML +# header. +# Note: The property "xmlpackage" must be specified +# via command line. There exists more then one +# possible value. +# +# [REQUIRED] +#************************************************ + +xmlversion = 1.0 +xmlencoding = UTF-8 +xmlpath = org.openoffice.TypeDetection +#xmlpackage = + +#************************************************ +# These values are used to name the configuration +# sets inside the generated XCM file for different +# item groups like e.g. types, filters etcpp. +# +# [REQUIRED] +#************************************************ + +setname_types = Types +setname_filters = Filters +setname_frameloaders = FrameLoaders +setname_contenthandlers = ContentHandlers + +subdir_types = types +subdir_filters = filters +subdir_frameloaders = frameloaders +subdir_contenthandlers = contenthandlers + +#************************************************ +# This delimiter is used to split every +# item list of the package configuration files +# (which are temp. created by the make proccess) +# into its tokens. +# +# [REQUIRED] +#************************************************ +delimiter=, + +#************************************************ +# Enable/disable removing of leading/trailing withespaces +# during splitting stringlists. +# +# [REQUIRED] +#************************************************ +trim=true + +#************************************************ +# Enable/disable removing of leading/trailing "-signs +# during splitting stringlists. +# +# [REQUIRED] +#************************************************ +decode=false diff --git a/transex3/source/filter/merge/FCFGMerge.java b/transex3/source/filter/merge/FCFGMerge.java new file mode 100644 index 000000000000..7fbfa8a0c986 --- /dev/null +++ b/transex3/source/filter/merge/FCFGMerge.java @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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: FCFGMerge.java,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.filter.config.tools.merge; + +//_______________________________________________ + +import java.lang.*; +import java.util.*; +import java.io.*; +import com.sun.star.filter.config.tools.utils.*; + +//_______________________________________________ + +/** + * Its a simple command line tool, which can merge different XML fragments + * together. Such fragments must exist as files on disk, will be moved into + * one file together on disk. + * + * + */ +public class FCFGMerge +{ + //___________________________________________ + // const + + private static final java.lang.String CFGFILE = "com/sun/star/filter/config/tools/merge/FCFGMerge.cfg"; + private static final java.lang.String PROP_LOGLEVEL = "loglevel"; + + //___________________________________________ + // main + + public static void main(java.lang.String[] sCmdLine) + { + FCFGMerge.printCopyright(); + + // create log object in default mode "WARNINGS" + // If a command line parameter indicates another + // level - change it! + Logger aLog = new Logger(); + + try + { + // merge config file and overwrite properties + // via command line + ConfigHelper aCfg = null; + aCfg = new ConfigHelper(CFGFILE, sCmdLine); + + // update log level + int nLogLevel = aCfg.getInt(PROP_LOGLEVEL, Logger.LEVEL_WARNINGS); + aLog = new Logger(nLogLevel); + + // help requested? + if (aCfg.isHelp()) + { + FCFGMerge.printHelp(); + System.exit(-1); + } + + // create new merge object and start operation + Merger aMerger = new Merger(aCfg, aLog); + aMerger.merge(); + } + catch(java.lang.Throwable ex) + { + aLog.setException(ex); + System.exit(-1); + } + + System.exit(0); + } + + //___________________________________________ + + /** prints out a copyright message on stdout. + */ + private static void printCopyright() + { + java.lang.StringBuffer sOut = new java.lang.StringBuffer(256); + sOut.append("FCFGMerge\n"); + sOut.append("Copyright: 2003 by Sun Microsystems, Inc.\n"); + sOut.append("All Rights Reserved.\n"); + System.out.println(sOut.toString()); + } + + //___________________________________________ + + /** prints out a help message on stdout. + */ + private static void printHelp() + { + java.lang.StringBuffer sOut = new java.lang.StringBuffer(256); + sOut.append("____________________________________________________________\n"); + sOut.append("usage: FCFGMerge cfg=<file name>\n" ); + sOut.append("parameters:\n" ); + sOut.append("\tcfg=<file name>\n" ); + sOut.append("\t\tmust point to a system file, which contains\n" ); + sOut.append("\t\tall neccessary configuration data for the merge process.\n"); + sOut.append("\n\tFurther cou can specify every parameter allowed in the\n" ); + sOut.append("\n\tconfig file as command line parameter too, to overwrite\n" ); + sOut.append("\n\tthe value from the file.\n" ); + System.out.println(sOut.toString()); + } +} diff --git a/transex3/source/filter/merge/Manifest.mf b/transex3/source/filter/merge/Manifest.mf new file mode 100644 index 000000000000..1337eaf4d39a --- /dev/null +++ b/transex3/source/filter/merge/Manifest.mf @@ -0,0 +1 @@ +Main-Class: com.sun.star.filter.config.tools.merge.FCFGMerge diff --git a/transex3/source/filter/merge/Merger.java b/transex3/source/filter/merge/Merger.java new file mode 100644 index 000000000000..0bf11fc42fbf --- /dev/null +++ b/transex3/source/filter/merge/Merger.java @@ -0,0 +1,364 @@ +/************************************************************************* + * + * 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: Merger.java,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ +package com.sun.star.filter.config.tools.merge; + +//_______________________________________________ + +import java.lang.*; +import java.util.*; +import java.io.*; +import com.sun.star.filter.config.tools.utils.*; + +//_______________________________________________ + +/** can merge different xml fragments together. + * + * + */ +public class Merger +{ + //___________________________________________ + // const + + private static final java.lang.String PROP_XMLVERSION = "xmlversion" ; // <= global cfg file + private static final java.lang.String PROP_XMLENCODING = "xmlencoding" ; // <= global cfg file + private static final java.lang.String PROP_XMLPATH = "xmlpath" ; // <= global cfg file + private static final java.lang.String PROP_XMLPACKAGE = "xmlpackage" ; // <= global cfg file + + private static final java.lang.String PROP_SETNAME_TYPES = "setname_types" ; // <= global cfg file + private static final java.lang.String PROP_SETNAME_FILTERS = "setname_filters" ; // <= global cfg file + private static final java.lang.String PROP_SETNAME_LOADERS = "setname_frameloaders" ; // <= global cfg file + private static final java.lang.String PROP_SETNAME_HANDLERS = "setname_contenthandlers" ; // <= global cfg file + + private static final java.lang.String PROP_SUBDIR_TYPES = "subdir_types" ; // <= global cfg file + private static final java.lang.String PROP_SUBDIR_FILTERS = "subdir_filters" ; // <= global cfg file + private static final java.lang.String PROP_SUBDIR_LOADERS = "subdir_frameloaders" ; // <= global cfg file + private static final java.lang.String PROP_SUBDIR_HANDLERS = "subdir_contenthandlers" ; // <= global cfg file + + private static final java.lang.String PROP_EXTENSION_XCU = "extension_xcu" ; // <= global cfg file + private static final java.lang.String PROP_EXTENSION_PKG = "extension_pkg" ; // <= global cfg file + + private static final java.lang.String PROP_DELIMITER = "delimiter" ; // <= global cfg file + private static final java.lang.String PROP_TRIM = "trim" ; // <= global cfg file + private static final java.lang.String PROP_DECODE = "decode" ; // <= global cfg file + + private static final java.lang.String PROP_FRAGMENTSDIR = "fragmentsdir" ; // <= cmdline + private static final java.lang.String PROP_TEMPDIR = "tempdir" ; // <= cmdline + private static final java.lang.String PROP_OUTDIR = "outdir" ; // <= cmdline + private static final java.lang.String PROP_PKG = "pkg" ; // <= cmdline + private static final java.lang.String PROP_DEBUG = "debug" ; // <= cmdline + + private static final java.lang.String PROP_TCFG = "tcfg" ; // <= cmdline + private static final java.lang.String PROP_FCFG = "fcfg" ; // <= cmdline + private static final java.lang.String PROP_LCFG = "lcfg" ; // <= cmdline + private static final java.lang.String PROP_CCFG = "ccfg" ; // <= cmdline + private static final java.lang.String PROP_LANGUAGEPACK = "languagepack" ; // <= cmdline + + private static final java.lang.String PROP_ITEMS = "items" ; // <= pkg cfg files! + + //___________________________________________ + // member + + //------------------------------------------- + /** TODO */ + private ConfigHelper m_aCfg; + + //------------------------------------------- + /** TODO */ + private Logger m_aLog; + + //------------------------------------------- + /** TODO */ + private java.io.File m_aFragmentsDir; + + //------------------------------------------- + /** TODO */ + private java.io.File m_aTempDir; + + //------------------------------------------- + /** TODO */ + private java.io.File m_aOutDir; + + //------------------------------------------- + /** TODO */ + private java.util.Vector m_lTypes; + private java.util.Vector m_lFilters; + private java.util.Vector m_lLoaders; + private java.util.Vector m_lHandlers; + + //___________________________________________ + // interface + + //------------------------------------------- + /** initialize a new instance of this class and + * try to get all needed resources from the config module. + * + * @param aCfg + * provides access to all values of the global + * config file and to the command line. + * + * @param aLog + * can be used to print out log informations. + */ + public Merger(ConfigHelper aCfg, + Logger aLog) + throws java.lang.Exception + { + m_aCfg = aCfg; + m_aLog = aLog; + + m_aFragmentsDir = new java.io.File(m_aCfg.getString(PROP_FRAGMENTSDIR)); + m_aTempDir = new java.io.File(m_aCfg.getString(PROP_TEMPDIR )); +// m_aOutDir = new java.io.File(m_aCfg.getString(PROP_OUTDIR )); + + java.lang.String sDelimiter = m_aCfg.getString(PROP_DELIMITER); + boolean bTrim = m_aCfg.getBoolean(PROP_TRIM); + boolean bDecode = m_aCfg.getBoolean(PROP_DECODE); + + try + { + ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_TCFG), null); + m_lTypes = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode); + } + catch(java.util.NoSuchElementException ex1) + { + m_lTypes = new java.util.Vector(); + //m_aLog.setWarning("Fragment list of types is missing. Parameter \"items\" seems to be invalid."); + } + + try + { + ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_FCFG), null); + m_lFilters = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode); + } + catch(java.util.NoSuchElementException ex1) + { + m_lFilters = new java.util.Vector(); + //m_aLog.setWarning("Fragment list of filters is missing. Parameter \"items\" seems to be invalid."); + } + + try + { + ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_LCFG), null); + m_lLoaders = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode); + } + catch(java.util.NoSuchElementException ex1) + { + m_lLoaders = new java.util.Vector(); + //m_aLog.setWarning("Fragment list of frame loader objects is missing. Parameter \"items\" seems to be invalid."); + } + + try + { + ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_CCFG), null); + m_lHandlers = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode); + } + catch(java.util.NoSuchElementException ex1) + { + m_lHandlers = new java.util.Vector(); + //m_aLog.setWarning("Fragment list of content handler objects is missing. Parameter \"items\" seems to be invalid."); + } + } + + //------------------------------------------- + /** TODO */ + public synchronized void merge() + throws java.lang.Exception + { + java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(1000000); + java.lang.String sPackage = m_aCfg.getString(PROP_PKG); + + m_aLog.setGlobalInfo("create package \""+sPackage+"\" ..."); + m_aLog.setDetailedInfo("generate package header ... "); + + sBuffer.append( + XMLHelper.generateHeader( + m_aCfg.getString (PROP_XMLVERSION ), + m_aCfg.getString (PROP_XMLENCODING ), + m_aCfg.getString (PROP_XMLPATH ), + m_aCfg.getString (PROP_XMLPACKAGE ), + m_aCfg.getBoolean(PROP_LANGUAGEPACK, false))); + + // counts all transfered fragments + // Can be used later to decide, if a generated package file + // contains "nothing"! + int nItemCount = 0; + + for (int i=0; i<4; ++i) + { + java.lang.String sSetName = null; + java.lang.String sSubDir = null; + java.util.Vector lFragments = null; + + try + { + switch(i) + { + case 0: // types + { + m_aLog.setDetailedInfo("generate set for types ... "); + sSetName = m_aCfg.getString(PROP_SETNAME_TYPES); + sSubDir = m_aCfg.getString(PROP_SUBDIR_TYPES ); + lFragments = m_lTypes; + } + break; + + case 1: // filters + { + m_aLog.setDetailedInfo("generate set for filter ... "); + sSetName = m_aCfg.getString(PROP_SETNAME_FILTERS); + sSubDir = m_aCfg.getString(PROP_SUBDIR_FILTERS ); + lFragments = m_lFilters; + } + break; + + case 2: // loaders + { + m_aLog.setDetailedInfo("generate set for frame loader ... "); + sSetName = m_aCfg.getString(PROP_SETNAME_LOADERS); + sSubDir = m_aCfg.getString(PROP_SUBDIR_LOADERS ); + lFragments = m_lLoaders; + } + break; + + case 3: // handlers + { + m_aLog.setDetailedInfo("generate set for content handler ... "); + sSetName = m_aCfg.getString(PROP_SETNAME_HANDLERS); + sSubDir = m_aCfg.getString(PROP_SUBDIR_HANDLERS ); + lFragments = m_lHandlers; + } + break; + } + + nItemCount += lFragments.size(); + + getFragments( + new java.io.File(m_aFragmentsDir, sSubDir), + sSetName, + lFragments, + 1, + sBuffer); + } + catch(java.util.NoSuchElementException exIgnore) + { continue; } + } + + m_aLog.setDetailedInfo("generate package footer ... "); + sBuffer.append(XMLHelper.generateFooter()); + + // Attention! + // If the package seem to be empty, it make no sense to generate a corresponding + // xml file. We should suppress writing of this file on disk completly ... + if (nItemCount < 1) + { + m_aLog.setWarning("Package is empty and will not result into a xml file on disk!? Please check configuration file."); + return; + } + m_aLog.setGlobalInfo("package contains "+nItemCount+" items"); + + java.io.File aPackage = new File(sPackage); + m_aLog.setGlobalInfo("write temp package \""+aPackage.getPath()); // TODO encoding must be readed from the configuration + FileHelper.writeEncodedBufferToFile(aPackage, "UTF-8", false, sBuffer); // check for success is done inside this method! + } + + //------------------------------------------- + /** TODO */ + private void getFragments(java.io.File aDir , + java.lang.String sSetName , + java.util.Vector lFragments , + int nPrettyTabs, + java.lang.StringBuffer sBuffer ) + throws java.lang.Exception + { + if (lFragments.size()<1) + { + m_aLog.setWarning("List of fragments is empty!? Will be ignored ..."); + return; + } + + java.util.Enumeration pFragments = lFragments.elements(); + java.lang.String sExtXcu = m_aCfg.getString(PROP_EXTENSION_XCU); + + for (int tabs=0; tabs<nPrettyTabs; ++tabs) + sBuffer.append("\t"); + sBuffer.append("<node oor:name=\""+sSetName+"\">\n"); + ++nPrettyTabs; + + // special mode for generating language packs. + // In such case we must live with some missing fragment files. + // Reason behind; Not all filters are realy localized. + // But we dont use a different fragment list. We try to locate + // any fragment file in its language-pack version ... + boolean bHandleLanguagePacks = m_aCfg.getBoolean(PROP_LANGUAGEPACK, false); + boolean bDebug = m_aCfg.getBoolean(PROP_DEBUG , false); + java.lang.String sEncoding = "UTF-8"; + if (bDebug) + sEncoding = "UTF-8Special"; + + while(pFragments.hasMoreElements()) + { + java.lang.String sFragment = (java.lang.String)pFragments.nextElement(); + java.io.File aFragment = new java.io.File(aDir, sFragment+"."+sExtXcu); + + // handle simple files only and check for existence! + if (!aFragment.exists()) + { + if (bHandleLanguagePacks) + { + m_aLog.setWarning("language fragment \""+aFragment.getPath()+"\" does not exist. Will be ignored."); + continue; + } + else + throw new java.io.IOException("fragment \""+aFragment.getPath()+"\" does not exists."); + } + + if (!aFragment.isFile()) + { + m_aLog.setWarning("fragment \""+aFragment.getPath()+"\" seem to be not a valid file."); + continue; + } + + // copy file content of original fragment + // Note: A FileNotFoundException will be thrown automaticly by the + // used reader objects. Let it break this method too. Our calli is interested + // on such errors :-) + m_aLog.setDetailedInfo("merge fragment \""+aFragment.getPath()+"\" ..."); + FileHelper.readEncodedBufferFromFile(aFragment, sEncoding, sBuffer); + + sBuffer.append("\n"); + } + + --nPrettyTabs; + for (int tabs=0; tabs<nPrettyTabs; ++tabs) + sBuffer.append("\t"); + sBuffer.append("</node>\n"); + } +} diff --git a/transex3/source/filter/merge/makefile.mk b/transex3/source/filter/merge/makefile.mk new file mode 100644 index 000000000000..bf768be851d8 --- /dev/null +++ b/transex3/source/filter/merge/makefile.mk @@ -0,0 +1,96 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.9.102.1 $ +# +# 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 = ..$/..$/.. +TARGET = FCFGMerge +PRJNAME = filter +PACKAGE = com$/sun$/star$/filter$/config$/tools$/merge + +# --- Settings ----------------------------------------------------- + +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- +#.IF "$(L10N_framework)"=="" + +OWNCOPY = \ + $(MISC)$/$(TARGET)_copied.done + +#JARFILES = \ +# ridl.jar \ +# unoil.jar \ +# jurt.jar \ +# juh.jar \ +# java_uno.jar + +CFGFILES = \ + FCFGMerge.cfg + +JAVACLASSFILES = \ + $(CLASSDIR)$/$(PACKAGE)$/Merger.class \ + $(CLASSDIR)$/$(PACKAGE)$/FCFGMerge.class + +CUSTOMMANIFESTFILE = \ + Manifest.mf + +MAXLINELENGTH = 100000 + +#----- make a jar from compiled files ------------------------------ + +JARCLASSDIRS = \ + com$/sun$/star$/filter$/config$/tools$/utils \ + com$/sun$/star$/filter$/config$/tools$/merge + +JARTARGET = $(TARGET).jar + +JARCOMPRESS = TRUE + +# --- targets ----------------------------------------------------- + +.INCLUDE : target.mk + +.IF "$(SOLAR_JAVA)" != "" || "$(GUI)"=="OS2" +ALLTAR : $(OWNCOPY) + +.IF "$(JARTARGETN)" != "" +$(JARTARGETN) : $(OWNCOPY) +.ENDIF + +$(OWNCOPY) : $(CFGFILES) + -$(MKDIRHIER) $(CLASSDIR)$/$(PACKAGE) + $(COPY) $? $(CLASSDIR)$/$(PACKAGE) && $(TOUCH) $@ + +.ENDIF # "$(SOLAR_JAVA)" != "" + +#.ELSE +#pseudo: + +#.ENDIF diff --git a/transex3/source/filter/utils/AnalyzeStartupLog.java b/transex3/source/filter/utils/AnalyzeStartupLog.java new file mode 100644 index 000000000000..498528850697 --- /dev/null +++ b/transex3/source/filter/utils/AnalyzeStartupLog.java @@ -0,0 +1,328 @@ +/************************************************************************* + * + * 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: AnalyzeStartupLog.java,v $ + * $Revision: 1.4 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.filter.config.tools.utils; + +//_______________________________________________ +// imports +import java.util.*; +import java.lang.*; + +//_______________________________________________ +// implementation +public class AnalyzeStartupLog +{ + private class OperationTime + { + /** name the measured operation. */ + public java.lang.String sOperation; + + /** contains the time value, when this operation was started. */ + public long nStartTime; + + /** contains the time value, when this operation was finished. */ + public long nEndTime; + + /** text inside log file, which identifies the start time value. */ + public java.lang.String sStartMsg; + + /** text inside log file, which identifies the end time value. */ + public java.lang.String sEndMsg; + } + + //_________________________________ + // main + + public static void main(java.lang.String[] lCmdLine) + { + int nExit = 0; + try + { + // analyze command line + ConfigHelper aCmdLine = new ConfigHelper("", lCmdLine); + java.lang.String sLogDir = aCmdLine.getString("logdir" ); + java.lang.String sDataFile = aCmdLine.getString("datafile"); + + if (sLogDir == null || sDataFile == null) + { + System.err.println("AnalyzeStartupLog lodir=<dir> datafile=<file>"); + System.err.println("E.g.: AnalyzeStartupLog lodir=c:\\temp\\logs datafile=c:\\temp\\data.csv"); + System.exit(--nExit); + } + + // get list of all log files + boolean bRecursive = true; + java.util.Vector lLogs = FileHelper.getSystemFilesFromDir(new java.io.File(sLogDir), bRecursive); + if (lLogs == null || lLogs.isEmpty()) + { + System.err.println("log dir is empty"); + System.exit(--nExit); + } + + // analyze it + java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000); + sOut.append("log;t_cfg_start;t_cfg_end;t_fwk_start;t_fwk_end;t_sfx_start;t_sfx_end;t_types_start;t_types_end;t_filters_start;t_filters_end;"); + sOut.append("t_filters_swriter_start;t_filters_swriter_end;t_filters_sweb_start;t_filters_sweb_end;t_filters_sglobal_start;t_filters_sglobal_end;t_filters_scalc_start;t_filters_scalc_end;t_filters_sdraw_start;t_filters_sdraw_end;t_filters_simpress_start;t_filters_simpress_end;t_filters_schart_start;t_filters_schart_end;t_filters_smath_start;t_filters_smath_end;"); + sOut.append("t_others_start;t_others_end;d_cfg;d_fwk;d_sfx;d_types;d_filters;d_others;d_complete\n"); + + java.util.Enumeration aIt = lLogs.elements(); + while (aIt.hasMoreElements()) + { + java.io.File aLog = (java.io.File)aIt.nextElement(); + java.io.FileReader aReader = new java.io.FileReader(aLog); + java.io.BufferedReader aBuffer = new java.io.BufferedReader(aReader); + + long t_cfg_start = 0; + long t_cfg_end = 0; + + long t_fwk_start = 0; + long t_fwk_end = 0; + + long t_sfx_start = 0; + long t_sfx_end = 0; + + long t_types_start = 0; + long t_types_end = 0; + + long t_filters_start = 0; + long t_filters_end = 0; + + long t_filters_swriter_start = 0; + long t_filters_swriter_end = 0; + + long t_filters_sweb_start = 0; + long t_filters_sweb_end = 0; + + long t_filters_sglobal_start = 0; + long t_filters_sglobal_end = 0; + + long t_filters_scalc_start = 0; + long t_filters_scalc_end = 0; + + long t_filters_sdraw_start = 0; + long t_filters_sdraw_end = 0; + + long t_filters_simpress_start = 0; + long t_filters_simpress_end = 0; + + long t_filters_schart_start = 0; + long t_filters_schart_end = 0; + + long t_filters_smath_start = 0; + long t_filters_smath_end = 0; + + long t_others_start = 0; + long t_others_end = 0; + + while (true) + { + java.lang.String sLine = aBuffer.readLine(); + if (sLine == null) + break; + + if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { creation ConfigItem [file=standard, version=6, mode=3]")) + t_cfg_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } creation ConfigItem")) + t_cfg_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { reading TypeDetection.xml")) + t_fwk_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } reading TypeDetection.xml")) + t_fwk_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadTypes")) + t_types_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadTypes")) + t_types_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadFilters")) + t_filters_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadFilters")) + t_filters_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [swriter]")) + t_filters_swriter_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [swriter]")) + t_filters_swriter_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [sweb]")) + t_filters_sweb_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [sweb]")) + t_filters_sweb_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [sglobal]")) + t_filters_sglobal_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [sglobal]")) + t_filters_sglobal_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [scalc]")) + t_filters_scalc_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [scalc]")) + t_filters_scalc_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [sdraw]")) + t_filters_sdraw_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [sdraw]")) + t_filters_sdraw_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [simpress]")) + t_filters_simpress_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [simpress]")) + t_filters_simpress_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [schart]")) + t_filters_schart_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [schart]")) + t_filters_schart_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ reading FilterGroup [smath]")) + t_filters_smath_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} reading FilterGroup [smath]")) + t_filters_smath_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadDetectors")) + t_others_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadContentHandlers")) + t_others_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} framework (as96863) ::FilterCache::FilterCache")) + t_sfx_start = new java.lang.Long(sLine.substring(0, 6)).longValue(); + else + if (sLine.endsWith("} desktop (lo119109) OfficeWrapper::OfficeWrapper")) + t_sfx_end = new java.lang.Long(sLine.substring(0, 6)).longValue(); + } + + sOut.append(aLog.getName() ); + sOut.append(";" ); + sOut.append(t_cfg_start ); + sOut.append(";" ); + sOut.append(t_cfg_end ); + sOut.append(";" ); + sOut.append(t_fwk_start ); + sOut.append(";" ); + sOut.append(t_fwk_end ); + sOut.append(";" ); + sOut.append(t_sfx_start ); + sOut.append(";" ); + sOut.append(t_sfx_end ); + sOut.append(";" ); + sOut.append(t_types_start ); + sOut.append(";" ); + sOut.append(t_types_end ); + sOut.append(";" ); + sOut.append(t_filters_start ); + sOut.append(";" ); + sOut.append(t_filters_end ); + sOut.append(";" ); + + sOut.append(t_filters_swriter_start ); + sOut.append(";" ); + sOut.append(t_filters_swriter_end ); + sOut.append(";" ); + sOut.append(t_filters_sweb_start ); + sOut.append(";" ); + sOut.append(t_filters_sweb_end ); + sOut.append(";" ); + sOut.append(t_filters_sglobal_start ); + sOut.append(";" ); + sOut.append(t_filters_sglobal_end ); + sOut.append(";" ); + sOut.append(t_filters_scalc_start ); + sOut.append(";" ); + sOut.append(t_filters_scalc_end ); + sOut.append(";" ); + sOut.append(t_filters_sdraw_start ); + sOut.append(";" ); + sOut.append(t_filters_sdraw_end ); + sOut.append(";" ); + sOut.append(t_filters_simpress_start ); + sOut.append(";" ); + sOut.append(t_filters_simpress_end ); + sOut.append(";" ); + sOut.append(t_filters_schart_start ); + sOut.append(";" ); + sOut.append(t_filters_schart_end ); + sOut.append(";" ); + sOut.append(t_filters_smath_start ); + sOut.append(";" ); + sOut.append(t_filters_smath_end ); + sOut.append(";" ); + + sOut.append(t_others_start ); + sOut.append(";" ); + sOut.append(t_others_end ); + sOut.append(";" ); + sOut.append(t_cfg_end -t_cfg_start ); + sOut.append(";" ); + sOut.append(t_fwk_end -t_fwk_start ); + sOut.append(";" ); + sOut.append(t_sfx_end -t_sfx_start ); + sOut.append(";" ); + sOut.append(t_types_end -t_types_start ); + sOut.append(";" ); + sOut.append(t_filters_end-t_filters_start); + sOut.append(";" ); + sOut.append(t_others_end -t_others_start ); + sOut.append(";" ); + sOut.append(t_others_end -t_cfg_start ); + sOut.append("\n" ); + + aBuffer.close(); + } + + java.io.FileWriter aCSV = new java.io.FileWriter(sDataFile); + java.lang.String sData = sOut.toString(); + aCSV.write(sData, 0, sData.length()); + aCSV.flush(); + aCSV.close(); + } + catch(java.lang.Throwable exAny) + { + System.err.println(exAny.getMessage()); + exAny.printStackTrace(); + System.exit(--nExit); + } + + System.exit(0); + } +} diff --git a/transex3/source/filter/utils/Cache.java b/transex3/source/filter/utils/Cache.java new file mode 100644 index 000000000000..94c26008ed13 --- /dev/null +++ b/transex3/source/filter/utils/Cache.java @@ -0,0 +1,2449 @@ +/************************************************************************* + * + * 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: Cache.java,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ +package com.sun.star.filter.config.tools.utils; + +//_______________________________________________ + +import java.lang.*; +import java.util.*; +import java.io.*; + +//_______________________________________________ + +/** + * It implements a container for all possible entries which are part of the type + * and filter mechanism of an office - means all items of the configuration file + * "TypeDetection". How these entries will be readed or written can be switch + * in different modes. That would make it possible to edit an xml directly or + * to contact a running office instance. + * + * + */ +public class Cache +{ + //___________________________________________ + // public const + + /** identifies a file type item of this cache. */ + public static final int E_TYPE = 0; + + /** identifies a filter item of this cache. */ + public static final int E_FILTER = 1; + + /** identifies a detect service item of this cache. */ + public static final int E_DETECTSERVICE = 2; + + /** identifies a frame loader item of this cache. */ + public static final int E_FRAMELOADER = 3; + + /** identifies a content handler item of this cache. */ + public static final int E_CONTENTHANDLER = 4; + + /** indicates an unsupported xml format => error! */ + public static final int FORMAT_UNSUPPORTED = -1; + + /** identify the configuration format of an office 6.0. + * The own formated data string is used. */ + public static final int FORMAT_60 = 0; + + /** identify the configuration format of an office 6.y. + * Properties are realy xml tags again. */ + public static final int FORMAT_6Y = 1; + + /** identify the configuration format which is used inside + * this tooling project. */ + public static final int FORMAT_INTERNAL = 2; + + /** right value for a command line parameter to define a 6.0 version. */ + public static final java.lang.String CMDVAL_FORMAT_60 = "6.0"; + + /** right value for a command line parameter to define a 6.Y version. */ + public static final java.lang.String CMDVAL_FORMAT_6Y = "6.Y"; + + /** right value for a command line parameter to define an internal xml version! */ + public static final java.lang.String CMDVAL_FORMAT_INTERNAL = "internal"; + + // general + public static final java.lang.String PROPNAME_DATA = "Data"; + public static final java.lang.String PROPNAME_NAME = "Name"; + public static final java.lang.String PROPNAME_UINAME = "UIName"; + public static final java.lang.String PROPNAME_UINAMES = "UINames"; + + // type 6.0 ... + public static final java.lang.String PROPNAME_MEDIATYPE = "MediaType"; + public static final java.lang.String PROPNAME_PREFERRED = "Preferred"; + public static final java.lang.String PROPNAME_CLIPBOARDFORMAT = "ClipboardFormat"; + public static final java.lang.String PROPNAME_DOCUMENTICONID = "DocumentIconID"; + public static final java.lang.String PROPNAME_URLPATTERN = "URLPattern"; + public static final java.lang.String PROPNAME_EXTENSIONS = "Extensions"; + // ... +6.y + public static final java.lang.String PROPNAME_UIORDER = "UIOrder"; + public static final java.lang.String PROPNAME_PREFERREDFILTER = "PreferredFilter"; + public static final java.lang.String PROPNAME_DETECTSERVICE = "DetectService"; + public static final java.lang.String PROPNAME_FRAMELOADER = "FrameLoader"; + public static final java.lang.String PROPNAME_CONTENTHANDLER = "ContentHandler"; + + // filter + public static final java.lang.String PROPNAME_DOCUMENTSERVICE = "DocumentService"; + public static final java.lang.String PROPNAME_FILEFORMATVERSION = "FileFormatVersion"; + public static final java.lang.String PROPNAME_FILTERSERVICE = "FilterService"; + public static final java.lang.String PROPNAME_FLAGS = "Flags"; + public static final java.lang.String PROPNAME_ORDER = "Order"; // -6.y + public static final java.lang.String PROPNAME_TEMPLATENAME = "TemplateName"; + public static final java.lang.String PROPNAME_TYPE = "Type"; + public static final java.lang.String PROPNAME_UICOMPONENT = "UIComponent"; + public static final java.lang.String PROPNAME_USERDATA = "UserData"; + + // frame loader / detect services / content handler + public static final java.lang.String PROPNAME_TYPES = "Types"; + + //___________________________________________ + // private const + + private static final java.lang.String FILTERSERVICE_NATIVEWARPPER = "com.sun.star.filter.NativeFilterWrapper"; + private static final java.lang.String GENERIC_DETECTSERVICE = "com.sun.star.comp.office.FrameLoader"; + + /** its the name of the cfg set, which contains all types. */ + private static final java.lang.String CFGNODE_TYPES = "Types"; + + /** its the name of the cfg set, which contains all filters. */ + private static final java.lang.String CFGNODE_FILTERS = "Filters"; + + /** its the name of the cfg set, which contains all detect services. */ + private static final java.lang.String CFGNODE_DETECTSERVICES = "DetectServices"; + + /** its the name of the cfg set, which contains all frame loaders. */ + private static final java.lang.String CFGNODE_FRAMELOADERS = "FrameLoaders"; + + /** its the name of the cfg set, which contains all content handlers. */ + private static final java.lang.String CFGNODE_CONTENTHANDLERS = "ContentHandlers"; + + // names for filter flags + private static final java.lang.String FLAGNAME_3RDPARTYFILTER = "3RDPARTYFILTER"; + private static final java.lang.String FLAGNAME_ALIEN = "ALIEN"; + private static final java.lang.String FLAGNAME_ASYNCHRON = "ASYNCHRON"; + private static final java.lang.String FLAGNAME_BROWSERPREFERRED = "BROWSERPREFERRED"; + private static final java.lang.String FLAGNAME_CONSULTSERVICE = "CONSULTSERVICE"; + private static final java.lang.String FLAGNAME_DEFAULT = "DEFAULT"; + private static final java.lang.String FLAGNAME_EXPORT = "EXPORT"; + private static final java.lang.String FLAGNAME_IMPORT = "IMPORT"; + private static final java.lang.String FLAGNAME_INTERNAL = "INTERNAL"; + private static final java.lang.String FLAGNAME_NOTINCHOOSER = "NOTINCHOOSER"; + private static final java.lang.String FLAGNAME_NOTINFILEDIALOG = "NOTINFILEDIALOG"; + private static final java.lang.String FLAGNAME_NOTINSTALLED = "NOTINSTALLED"; + private static final java.lang.String FLAGNAME_OWN = "OWN"; + private static final java.lang.String FLAGNAME_PACKED = "PACKED"; + private static final java.lang.String FLAGNAME_PREFERRED = "PREFERRED"; + private static final java.lang.String FLAGNAME_READONLY = "READONLY"; + private static final java.lang.String FLAGNAME_SILENTEXPORT = "SILENTEXPORT"; + private static final java.lang.String FLAGNAME_TEMPLATE = "TEMPLATE"; + private static final java.lang.String FLAGNAME_TEMPLATEPATH = "TEMPLATEPATH"; + private static final java.lang.String FLAGNAME_USESOPTIONS = "USESOPTIONS"; + + private static final java.lang.String FLAGNAME_COMBINED = "COMBINED"; + private static final java.lang.String FLAGNAME_SUPPORTSSELECTION= "SUPPORTSSELECTION"; + + // values for filter flags + private static final int FLAGVAL_3RDPARTYFILTER = 0x00080000; // 524288 + private static final int FLAGVAL_ALIEN = 0x00000040; // 64 + private static final int FLAGVAL_ALL = 0xffffffff; // 4294967295 + private static final int FLAGVAL_ASYNCHRON = 0x00004000; // 16384 + private static final int FLAGVAL_BROWSERPREFERRED = 0x00400000; // 4194304 + private static final int FLAGVAL_CONSULTSERVICE = 0x00040000; // 262144 + private static final int FLAGVAL_DEFAULT = 0x00000100; // 256 + private static final int FLAGVAL_EXPORT = 0x00000002; // 2 + private static final int FLAGVAL_IMPORT = 0x00000001; // 1 + private static final int FLAGVAL_INTERNAL = 0x00000008; // 8 + private static final int FLAGVAL_NOTINCHOOSER = 0x00002000; // 8192 + private static final int FLAGVAL_NOTINFILEDIALOG = 0x00001000; // 4096 + private static final int FLAGVAL_NOTINSTALLED = 0x00020000; // 131072 + private static final int FLAGVAL_OWN = 0x00000020; // 32 + private static final int FLAGVAL_PACKED = 0x00100000; // 1048576 + private static final int FLAGVAL_PREFERRED = 0x10000000; // 268435456 + private static final int FLAGVAL_READONLY = 0x00010000; // 65536 + private static final int FLAGVAL_SILENTEXPORT = 0x00200000; // 2097152 + private static final int FLAGVAL_TEMPLATE = 0x00000004; // 4 + private static final int FLAGVAL_TEMPLATEPATH = 0x00000010; // 16 + private static final int FLAGVAL_USESOPTIONS = 0x00000080; // 128 + + private static final int FLAGVAL_COMBINED = 0x00800000; // ... + private static final int FLAGVAL_SUPPORTSSELECTION = 0x00000400; // 1024 + + //___________________________________________ + // member + + /** list of all located types. + * Format: [string,HashMap] + */ + private java.util.HashMap m_lTypes; + + /** list of all located filters. + * Format: [string,HashMap] + */ + private java.util.HashMap m_lFilters; + + /** list of all located detect services. + * Format: [string,HashMap] + */ + private java.util.HashMap m_lDetectServices; + + /** list of all located frame loader. + * Format: [string,HashMap] + */ + private java.util.HashMap m_lFrameLoaders; + + /** list of all located content handler. + * Format: [string,HashMap] + */ + private java.util.HashMap m_lContentHandlers; + + /** contains all analyzed relations between + * filters and types. The key is an internal + * type name (can be used as reference into the + * list m_lTypes) and the value is a Vector of all + * internal filter names, which are registered for + * this type. + * Format: [string, Vector] + */ + private java.util.HashMap m_lFilterToTypeRegistrations; + + private int m_nDoubleRegisteredFilters; + private int m_nTypesForFilters; + private int m_nTypesForDetectServices; + private int m_nTypesForFrameLoaders; + private int m_nTypesForContentHandlers; + + /** can be used to log different informations. */ + private Logger m_aDebug; + + //___________________________________________ + // interface + + /** standard ctor. + * + * Initialize an empty cache instance. You have to use + * on of the fromXXX() methods to fill it from different + * sources with content. + */ + public Cache(Logger aDebug) + { + reset(); + m_aDebug = aDebug; + } + + //___________________________________________ + + /** free memory and set default values on all members. + */ + public synchronized void reset() + { + m_lTypes = new java.util.HashMap(); + m_lFilters = new java.util.HashMap(); + m_lFrameLoaders = new java.util.HashMap(); + m_lDetectServices = new java.util.HashMap(); + m_lContentHandlers = new java.util.HashMap(); + m_lFilterToTypeRegistrations = new java.util.HashMap(); + m_aDebug = new Logger(); + m_nDoubleRegisteredFilters = 0; + m_nTypesForFilters = 0; + m_nTypesForDetectServices = 0; + m_nTypesForFrameLoaders = 0; + m_nTypesForContentHandlers = 0; + } + + //___________________________________________ + + /** converts a string representation of an xml format + * to its int value, which must be used at some interface + * methods of this cache. + * + * If the given string does not match to any well known format, + * the return value will be FORMAT_UNSUPPORTED. The calli have to + * check that. Otherwhise a called interface method at this cache + * instance will be rejected by an exception! + * + * @param sFormat + * the string representation + * Must be one of our public const values from type CMDVAL_FORMAT_xxx. + * + * @return [int] + * the int representation. + * Will be one of our public const values from type FORMAT_xxx. + */ + public static int mapFormatString2Format(java.lang.String sFormat) + { + int nFormat = FORMAT_UNSUPPORTED; + if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_60)) + nFormat = FORMAT_60; + else + if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_6Y)) + nFormat = FORMAT_6Y; + else + if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_INTERNAL)) + nFormat = FORMAT_INTERNAL; + return nFormat; + } + + //___________________________________________ + + /** return some statistic values. + * + * Such values can be: - count of container items, + * - ... + * + * @return [java.lang.String] + * a formated string, which contains al statistic data. + */ + public synchronized java.lang.String getStatistics() + { + java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(256); + + sBuffer.append("types = "+m_lTypes.size() +"\n"); + sBuffer.append("filters = "+m_lFilters.size() +"\n"); + sBuffer.append("detect services = "+m_lDetectServices.size() +"\n"); + sBuffer.append("frame loaders = "+m_lFrameLoaders.size() +"\n"); + sBuffer.append("content handler = "+m_lContentHandlers.size() +"\n"); + sBuffer.append("double registered filters = "+m_nDoubleRegisteredFilters+"\n"); + sBuffer.append("types used by filters = "+m_nTypesForFilters +"\n"); + sBuffer.append("types used by detect services = "+m_nTypesForDetectServices +"\n"); + sBuffer.append("types used by frame loaders = "+m_nTypesForFrameLoaders +"\n"); + sBuffer.append("types used by content handlers = "+m_nTypesForContentHandlers+"\n"); + + return sBuffer.toString(); + } + + //___________________________________________ + + /** reset this cache and fill it with new values using the given XML file. + * + * @param aXML + * must be a system file of a suitable XML file, which + * include all neccessary type/filter items. + * + * @param nFormat + * identifies the format of the specified xml file, + * which must be interpreted. + */ + public synchronized void fromXML(java.io.File aXML , + int nFormat) + throws java.lang.Exception + { + // clear this cache + reset(); + + // parse it + javax.xml.parsers.DocumentBuilderFactory aFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); + /* Attention: + * This call is important. It force right handling of entities during parsing and(!) + * writing. It let all possible signs for entities or it's quoted representations + * untouched. So this class don't change the original signs of the original file. + * Means: + * <ul> + * <li>(') => (')</li> + * <li>(") => (")</li> + * <li>(>) => (>)</li> + * <li>(<) => (<)</li> + * <li>(>) => (>)</li> + * <li>(&) => (&)</li> + * <li>...</li> + * </ul> + */ + + System.out.println("TODO: must be adapted to java 1.3 :-("); + System.exit(-1); +//TODO_JAVA aFactory.setExpandEntityReferences(false); + + javax.xml.parsers.DocumentBuilder aBuilder = aFactory.newDocumentBuilder(); + org.w3c.dom.Document aDOM = aBuilder.parse(aXML); + org.w3c.dom.Element aRoot = aDOM.getDocumentElement(); + + // step over all sets + java.util.Vector lSetNodes = XMLHelper.extractChildNodesByTagName(aRoot, XMLHelper.XMLTAG_NODE); + java.util.Enumeration it1 = lSetNodes.elements(); + while (it1.hasMoreElements()) + { + // try to find out, which set should be read + org.w3c.dom.Node aSetNode = (org.w3c.dom.Node)it1.nextElement(); + java.lang.String sSetName = XMLHelper.extractNodeAttribByName(aSetNode, XMLHelper.XMLATTRIB_OOR_NAME); + if (sSetName == null) + throw new java.io.IOException("unsupported format: could not extract set name on node ...\n"+aSetNode); + + // map some generic interfaces to the right members! + int eType = -1 ; + java.util.HashMap rMap = null; + + if (sSetName.equals(CFGNODE_TYPES)) + { + eType = E_TYPE; + rMap = m_lTypes; + } + else + if (sSetName.equals(CFGNODE_FILTERS)) + { + eType = E_FILTER; + rMap = m_lFilters; + } + else + if (sSetName.equals(CFGNODE_FRAMELOADERS)) + { + eType = E_FRAMELOADER; + rMap = m_lFrameLoaders; + } + else + if (sSetName.equals(CFGNODE_DETECTSERVICES)) + { + eType = E_DETECTSERVICE; + rMap = m_lDetectServices; + } + else + if (sSetName.equals(CFGNODE_CONTENTHANDLERS)) + { + eType = E_CONTENTHANDLER; + rMap = m_lContentHandlers; + } + else + throw new java.io.IOException("unsupported format: unknown set name [\""+sSetName+"\"] detected on node ...\n"+aSetNode); + + // load all set entries + java.util.Vector lChildNodes = XMLHelper.extractChildNodesByTagName(aSetNode, XMLHelper.XMLTAG_NODE); + java.util.Enumeration it2 = lChildNodes.elements(); + while (it2.hasMoreElements()) + { + org.w3c.dom.Node aChildNode = (org.w3c.dom.Node)it2.nextElement(); + java.lang.String sChildName = XMLHelper.extractNodeAttribByName(aChildNode, XMLHelper.XMLATTRIB_OOR_NAME); + if (sChildName == null) + throw new java.io.IOException("unsupported format: could not extract child node name on node ...\n"+aChildNode); + java.util.HashMap aPropSet = null; + + // Note: Our internal format is different from the source format! + java.util.HashMap aTempSet = XMLHelper.convertNodeToPropSet(aChildNode); + switch(eType) + { + case E_TYPE : + { + aPropSet = Cache.convertTypePropsToInternal(aTempSet, nFormat); + m_aDebug.setDetailedInfo("type [\""+sChildName+"\"] converted to internal format"); + } + break; + + case E_FILTER : + { + aPropSet = Cache.convertFilterPropsToInternal(aTempSet, nFormat); + m_aDebug.setDetailedInfo("filter [\""+sChildName+"\"] converted to internal format"); + } + break; + + case E_DETECTSERVICE : + { + aPropSet = Cache.convertDetectServicePropsToInternal(aTempSet, nFormat); + m_aDebug.setDetailedInfo("detect service [\""+sChildName+"\"] converted to internal format"); + } + break; + + case E_FRAMELOADER : + { + aPropSet = Cache.convertFrameLoaderPropsToInternal(aTempSet, nFormat); + m_aDebug.setDetailedInfo("frame loader [\""+sChildName+"\"] converted to internal format"); + } + break; + + case E_CONTENTHANDLER : + { + aPropSet = Cache.convertContentHandlerPropsToInternal(aTempSet, nFormat); + m_aDebug.setDetailedInfo("content handler [\""+sChildName+"\"] converted to internal format"); + } + break; + } + m_aDebug.setDetailedInfo("props = "+aTempSet); + rMap.put(sChildName, aPropSet); + } + } + } + + //___________________________________________ + + /** create some hml views of the current content of this cache. + * + * The given directory is used to create different html files + * there. Every of them show another aspect of this cache. + * E.g.: - all type/filter properties + * - relation ships between types/filters/loaders etc. + * + * @param aDirectory + * points to a system directory, which + * can be used completely(!) to generate + * the results there. + * + * @param nFormat + * specify in which context the cache items should be + * interpreted. + */ + public synchronized void toHTML(java.io.File aDirectory, + int nFormat , + java.lang.String sEncoding ) + throws java.lang.Exception + { + if (nFormat != FORMAT_6Y) + throw new java.lang.Exception("HTML views are supported for the new 6.y format only yet."); + + java.lang.StringBuffer sRelationView = new java.lang.StringBuffer(1000); + sRelationView.append("<html><header><title>Relation View</title></header><body>"); + sRelationView.append("<table border=1>"); + sRelationView.append("<tr><td><b>type</b></td><td><b>detect service</b></td><td><b>preferred filter</b></td><td><b>frame loader</b></td><td><b>content handler</b></td></tr>"); + + java.util.Iterator aIt = m_lTypes.keySet().iterator(); + while (aIt.hasNext()) + { + java.lang.String sType = (java.lang.String)aIt.next(); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sType); + + sRelationView.append("<tr>"); + sRelationView.append("<td>"+sType+"</td>"); + + java.lang.String sVal = (java.lang.String)aType.get(PROPNAME_DETECTSERVICE); + if (sVal == null || sVal.length()<1) + sRelationView.append("<td> - </td>"); + else + sRelationView.append("<td>"+sVal+"</td>"); + + sVal = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER); + if (sVal == null || sVal.length()<1) + sRelationView.append("<td> - </td>"); + else + sRelationView.append("<td>"+sVal+"</td>"); + + sVal = (java.lang.String)aType.get(PROPNAME_FRAMELOADER); + if (sVal == null || sVal.length()<1) + sRelationView.append("<td> - </td>"); + else + sRelationView.append("<td>"+sVal+"</td>"); + + sVal = (java.lang.String)aType.get(PROPNAME_CONTENTHANDLER); + if (sVal == null || sVal.length()<1) + sRelationView.append("<td> - </td>"); + else + sRelationView.append("<td>"+sVal+"</td>"); + + sRelationView.append("</tr>"); + } + + sRelationView.append("</table>"); + sRelationView.append("</body>"); + + FileHelper.writeEncodedBufferToFile(new java.io.File(aDirectory, "relation_view.html"), sEncoding, false, sRelationView); + + java.util.HashMap lFilters2TypeRegistration = new java.util.HashMap(); + aIt = m_lFilters.keySet().iterator(); + while (aIt.hasNext()) + { + java.lang.String sFilter = (java.lang.String)aIt.next(); + java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter); + java.lang.String sType = (java.lang.String)aFilter.get(PROPNAME_TYPE); + + java.util.Vector lFilters = (java.util.Vector)lFilters2TypeRegistration.get(sType); + if (lFilters == null) + lFilters = new java.util.Vector(); + lFilters.add(sFilter); + lFilters2TypeRegistration.put(sType, lFilters); + } + + java.lang.StringBuffer sType2FiltersView = new java.lang.StringBuffer(1000); + sType2FiltersView.append("<html><header><title>Type2Filters View</title></header><body>"); + sType2FiltersView.append("<table border=1>"); + sType2FiltersView.append("<tr><td><b>type</b></td><td><b>filters</b></td></tr>"); + + aIt = lFilters2TypeRegistration.keySet().iterator(); + while (aIt.hasNext()) + { + java.lang.String sType = (java.lang.String)aIt.next(); + java.util.Vector lFilters = (java.util.Vector)lFilters2TypeRegistration.get(sType); + + sType2FiltersView.append("<tr><td>"+sType+"</td><td>"); + java.util.Enumeration aEn = lFilters.elements(); + while(aEn.hasMoreElements()) + sType2FiltersView.append(aEn.nextElement()+"<br>"); + sType2FiltersView.append("</td></tr>"); + } + + sType2FiltersView.append("</table>"); + sType2FiltersView.append("</body>"); + + FileHelper.writeEncodedBufferToFile(new java.io.File(aDirectory, "type2filters_view.html"), sEncoding, false, sType2FiltersView); + } + + //___________________________________________ + + /** converts all items of this cache to its xml representation + * and write it to the given file. + * + * @param aXML + * the target file for output. + * + * @param nFormat + * the requested xml format. + * see const values FORMAT_xxx too. + * + * @param sEncoding + * specify the file encoding for the generated xml file. + * + * @throws [java.lang.Exception] + * if something fail during convertion. + */ + public synchronized void toXML(java.io.File aXML , + int nFormat , + java.lang.String sEncoding) + throws java.lang.Exception + { + java.lang.StringBuffer sXML = new java.lang.StringBuffer(500000); + + for (int i=0; i<5; ++i) + { + // define right sub container + java.lang.String sSetName = null; + java.util.HashMap rMap = null; + int eType = -1; + + switch(i) + { + case 0 : + { + sSetName = CFGNODE_TYPES; + rMap = m_lTypes; + eType = E_TYPE; + } + break; + + case 1 : + { + sSetName = CFGNODE_FILTERS; + rMap = m_lFilters; + eType = E_FILTER; + } + break; + + case 2 : + { + sSetName = CFGNODE_DETECTSERVICES; + rMap = m_lDetectServices; + eType = E_DETECTSERVICE; + } + break; + + case 3 : + { + sSetName = CFGNODE_FRAMELOADERS; + rMap = m_lFrameLoaders; + eType = E_FRAMELOADER; + } + break; + + case 4 : + { + sSetName = CFGNODE_CONTENTHANDLERS; + rMap = m_lContentHandlers; + eType = E_CONTENTHANDLER; + } + break; + } + + // generate set + sXML.append("<node oor:name=\""+sSetName+"\" oor:op=\"replace\">\n"); + java.util.Iterator it = rMap.keySet().iterator(); + while(it.hasNext()) + { + java.lang.String sItem = (java.lang.String)it.next(); + sXML.append("<node oor:name=\""+sItem+"\" oor:op=\"replace\">\n"); + sXML.append(getItemAsXML(eType, sItem, nFormat)); + sXML.append("</node>\n"); + } + sXML.append("</node>\n"); + } + + java.io.FileOutputStream aStream = new java.io.FileOutputStream(aXML.getAbsolutePath(), false); + java.io.OutputStreamWriter aWriter = new java.io.OutputStreamWriter(aStream, sEncoding); + java.lang.String sOut = sXML.toString(); + aWriter.write(sOut, 0, sOut.length()); + aWriter.flush(); + aWriter.close(); + } + + //___________________________________________ + + /** converts a type property set from internal format + * to an external one. + * + * @param aMap + * points to the item, which should be converted. + * + * @param nFormat + * specify the requested output format. + * + * @return [java.util.HashMap] + * contains the properties in the requested format. + * + * @throws [java.lang.Exception + * if something fail during convertion. + */ + private static java.util.HashMap convertTypePropsToExternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = new java.util.HashMap(); + // copy Name property ... if it exists! + if (aMap.containsKey(PROPNAME_NAME)) + aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME)); + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // copy UIName property unchanged + aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME)); + + // ignore properties "UIOrder", "PreferredFilter", "DetectService" + // They are not supported for 6.0 types. + + // pack all other properties to one "Data" string value + java.lang.StringBuffer sData = new java.lang.StringBuffer(256); + + sData.append(aMap.get(PROPNAME_PREFERRED)); + sData.append(","); + sData.append(aMap.get(PROPNAME_MEDIATYPE)); + sData.append(","); + sData.append(aMap.get(PROPNAME_CLIPBOARDFORMAT)); + sData.append(","); + + java.util.Vector lList = (java.util.Vector)aMap.get(PROPNAME_URLPATTERN); + int c = lList.size(); + int i = 0; + for (i=0; i<c; ++i) + { + sData.append(lList.elementAt(i)); + if (i<(c-1)) + sData.append(";"); + } + + lList = (java.util.Vector)aMap.get(PROPNAME_EXTENSIONS); + c = lList.size(); + for (i=0; i<c; ++i) + { + sData.append(lList.elementAt(i)); + if (i<(c-1)) + sData.append(";"); + } + + sData.append(","); + sData.append(aMap.get(PROPNAME_DOCUMENTICONID)); + sData.append(","); + + aResultMap.put(PROPNAME_DATA, sData.toString()); + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // copy all supported properties directly + aResultMap.put(PROPNAME_PREFERRED , aMap.get(PROPNAME_PREFERRED )); + aResultMap.put(PROPNAME_MEDIATYPE , aMap.get(PROPNAME_MEDIATYPE )); + aResultMap.put(PROPNAME_URLPATTERN , aMap.get(PROPNAME_URLPATTERN )); + aResultMap.put(PROPNAME_EXTENSIONS , aMap.get(PROPNAME_EXTENSIONS )); + aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME )); + aResultMap.put(PROPNAME_PREFERREDFILTER, aMap.get(PROPNAME_PREFERREDFILTER)); + aResultMap.put(PROPNAME_DETECTSERVICE , aMap.get(PROPNAME_DETECTSERVICE )); + aResultMap.put(PROPNAME_CLIPBOARDFORMAT, aMap.get(PROPNAME_CLIPBOARDFORMAT)); + aResultMap.put(PROPNAME_UIORDER , aMap.get(PROPNAME_UIORDER )); + /* REMOVED! + aResultMap.put(PROPNAME_DOCUMENTICONID , aMap.get(PROPNAME_DOCUMENTICONID )); + */ + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + //___________________________________________ + + /** converts a filter property set from internal format + * to an external one. + * + * @param aMap + * points to the item, which should be converted. + * + * @param nFormat + * specify the requested output format. + * + * @return [java.util.HashMap] + * contains the properties in the requested format. + * + * @throws [java.lang.Exception + * if something fail during convertion. + */ + private static java.util.HashMap convertFilterPropsToExternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = new java.util.HashMap(); + // copy Name property ... if it exists! + if (aMap.containsKey(PROPNAME_NAME)) + aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME)); + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // copy UIName property unchanged! + aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME)); + + // but pack all other properties + java.lang.StringBuffer sData = new java.lang.StringBuffer(256); + + sData.append(aMap.get(PROPNAME_ORDER)); + sData.append(","); + sData.append(aMap.get(PROPNAME_TYPE)); + sData.append(","); + sData.append(aMap.get(PROPNAME_DOCUMENTSERVICE)); + sData.append(","); + sData.append(aMap.get(PROPNAME_FILTERSERVICE)); + sData.append(","); + sData.append(aMap.get(PROPNAME_FLAGS)); + sData.append(","); + java.util.Vector lList = (java.util.Vector)aMap.get(PROPNAME_USERDATA); + int c = lList.size(); + int i = 0; + for (i=0; i<c; ++i) + { + sData.append(lList.elementAt(i)); + if (i<(c-1)) + sData.append(";"); + } + sData.append(","); + sData.append(aMap.get(PROPNAME_FILEFORMATVERSION)); + sData.append(","); + sData.append(aMap.get(PROPNAME_TEMPLATENAME)); + sData.append(","); + sData.append(aMap.get(PROPNAME_UICOMPONENT)); + sData.append(","); + + aResultMap.put(PROPNAME_DATA, sData.toString()); + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // supress "Order" property. + // Will be moved to type entries in 6.y version! + + // supress "UIName" property. + // Only type entries will be localized in 6.y version! + /* TODO make it configurable :-) */ + aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME )); + + // copy all supported properties directly + aResultMap.put(PROPNAME_TYPE , aMap.get(PROPNAME_TYPE )); + aResultMap.put(PROPNAME_DOCUMENTSERVICE , aMap.get(PROPNAME_DOCUMENTSERVICE )); + aResultMap.put(PROPNAME_FILTERSERVICE , aMap.get(PROPNAME_FILTERSERVICE )); + aResultMap.put(PROPNAME_USERDATA , aMap.get(PROPNAME_USERDATA )); + aResultMap.put(PROPNAME_FILEFORMATVERSION, aMap.get(PROPNAME_FILEFORMATVERSION)); + aResultMap.put(PROPNAME_TEMPLATENAME , aMap.get(PROPNAME_TEMPLATENAME )); + aResultMap.put(PROPNAME_UICOMPONENT , aMap.get(PROPNAME_UICOMPONENT )); + + // "Flags" will be converted from internal format [int] to + // the 6.y format [string-list]! + java.lang.Integer nFlags = (java.lang.Integer)aMap.get(PROPNAME_FLAGS); + java.util.Vector lFlags = Cache.convertFilterFlagValues2Names(nFlags); + aResultMap.put(PROPNAME_FLAGS, lFlags); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + //___________________________________________ + + /** converts a detect service property set from internal format + * to an external one. + * + * @param aMap + * points to the item, which should be converted. + * + * @param nFormat + * specify the requested output format. + * + * @return [java.util.HashMap] + * contains the properties in the requested format. + * + * @throws [java.lang.Exception + * if something fail during convertion. + */ + private static java.util.HashMap convertDetectServicePropsToExternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = null; + + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // no changes! + aResultMap = aMap; + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // remove localized name + aResultMap = aMap; + aResultMap.remove(PROPNAME_UINAME); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + private static java.util.HashMap convertFrameLoaderPropsToExternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = null; + + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // no changes! + aResultMap = aMap; + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // remove localized name + aResultMap = aMap; + aResultMap.remove(PROPNAME_UINAME); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + private static java.util.HashMap convertContentHandlerPropsToExternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = null; + + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // no changes! + aResultMap = aMap; + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // remove localized name + aResultMap = aMap; + aResultMap.remove(PROPNAME_UINAME); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + //___________________________________________ + + /** converts a type property set (using an external format) to + * our internal cache format. + * + * Especialy the data format string will be expanded + * to its real properties. + * + * Schema: + * aMap["UIName"] => aExpandedMap["UIName"] + * aMap["Data" ] => aExpandedMap["Preferred" ], aExpandedMap["MediaType"] etc. ... + * + * @param aMap + * points to the item, which should be converted. + + * @param nFormat + * specify the external format. + * + * @return [java.util.HashMap] + * The new map in internal format. + */ + private static java.util.HashMap convertTypePropsToInternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = new java.util.HashMap(); + // copy Name property ... if it exists! + if (aMap.containsKey(PROPNAME_NAME)) + aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME)); + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // copy UIName property unchanged! + aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME)); + + // generate new property "UIOrder" + // Its the moved property "Order" of filters for versions >= 6.y! + aResultMap.put(PROPNAME_UIORDER, new java.lang.Integer(0)); + + // generate new property "PreferredFilter" + // Its a the moved filter flag "Preferred" for versions >= 6.y! + aResultMap.put(PROPNAME_PREFERREDFILTER, new java.lang.String()); + + // generate new property "DetectService" + // Every type know its detector diretcly from now. No search + // will be neccessary any longer. + aResultMap.put(PROPNAME_DETECTSERVICE, new java.lang.String()); + + // analyze the Data property of the original map + // and copy its results (means all expanded properties) + // to the result map. + java.lang.String sDataVal = (java.lang.String)aMap.get(PROPNAME_DATA); + java.util.Vector lTokens = Cache.splitTokenString(sDataVal, ","); + + int t = 0; + java.util.Enumeration it = lTokens.elements(); + while (it.hasMoreElements()) + { + java.lang.String sToken = (java.lang.String)it.nextElement(); + switch(t) + { + case 0 : + aResultMap.put(PROPNAME_PREFERRED, new java.lang.Boolean(sToken)); + break; + case 1 : + aResultMap.put(PROPNAME_MEDIATYPE, sToken); + break; + case 2 : + { + /*HACK ersetze %20 mit " " ...*/ + int ni = sToken.indexOf("%20"); + if (ni!=-1) + { + java.lang.String sPatch = sToken.substring(0,ni) + " " + sToken.substring(ni+3); + sToken = sPatch; + } + aResultMap.put(PROPNAME_CLIPBOARDFORMAT, sToken); + } + break; + case 3 : + aResultMap.put(PROPNAME_URLPATTERN, Cache.splitTokenString(sToken, ";")); + break; + case 4 : + aResultMap.put(PROPNAME_EXTENSIONS, Cache.splitTokenString(sToken, ";")); + break; + case 5 : + aResultMap.put(PROPNAME_DOCUMENTICONID, new java.lang.Integer(sToken)); + break; + default : + throw new java.lang.Exception("unsupported format for data value of a type \""+aMap.get(PROPNAME_NAME)+"\" detected."); + } + ++t; + } + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // copy all supported properties directly + aResultMap.put(PROPNAME_PREFERRED , aMap.get(PROPNAME_PREFERRED )); + aResultMap.put(PROPNAME_MEDIATYPE , aMap.get(PROPNAME_MEDIATYPE )); + aResultMap.put(PROPNAME_CLIPBOARDFORMAT, aMap.get(PROPNAME_CLIPBOARDFORMAT)); + aResultMap.put(PROPNAME_URLPATTERN , aMap.get(PROPNAME_URLPATTERN )); + aResultMap.put(PROPNAME_EXTENSIONS , aMap.get(PROPNAME_EXTENSIONS )); + aResultMap.put(PROPNAME_DOCUMENTICONID , aMap.get(PROPNAME_DOCUMENTICONID )); + aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME )); + aResultMap.put(PROPNAME_UIORDER , aMap.get(PROPNAME_UIORDER )); + aResultMap.put(PROPNAME_PREFERREDFILTER, aMap.get(PROPNAME_PREFERREDFILTER)); + aResultMap.put(PROPNAME_DETECTSERVICE , aMap.get(PROPNAME_DETECTSERVICE )); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + //___________________________________________ + + /** converts a filter property set (using an external format) to + * our internal cache format. + * + * Especialy the data format string will be expanded + * to its real properties. + * + * Schema: + * aMap["UIName"] => aExpandedMap["UIName"] + * aMap["Data" ] => aExpandedMap["Order" ], aExpandedMap["Flags"] etc. ... + * + * @param aMap + * points to the item, which should be converted. + * + * @param nFormat + * specify the external format. + * + * @return [java.util.HashMap] + * The new map in internal format. + */ + private static java.util.HashMap convertFilterPropsToInternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + java.util.HashMap aResultMap = new java.util.HashMap(); + // copy Name property ... if it exists! + if (aMap.containsKey(PROPNAME_NAME)) + aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME)); + switch(nFormat) + { + //----------------------------------- + case FORMAT_60 : + { + // copy UIName property + aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME)); + + // analyze the Data property of the original map + // and copy its results (means all expanded properties) + // to the result map. + java.lang.String sDataVal = (java.lang.String)aMap.get(PROPNAME_DATA); + java.util.Vector lTokens = Cache.splitTokenString(sDataVal, ","); + + int t = 0; + java.util.Enumeration it = lTokens.elements(); + while (it.hasMoreElements()) + { + java.lang.String sToken = (java.lang.String)it.nextElement(); + switch(t) + { + case 0 : + aResultMap.put(PROPNAME_ORDER, new java.lang.Integer(sToken)); + break; + case 1 : + aResultMap.put(PROPNAME_TYPE, sToken); + break; + case 2 : + aResultMap.put(PROPNAME_DOCUMENTSERVICE, sToken); + break; + case 3 : + aResultMap.put(PROPNAME_FILTERSERVICE, sToken); + break; + case 4 : + aResultMap.put(PROPNAME_FLAGS, new java.lang.Integer(sToken)); + break; + case 5 : + aResultMap.put(PROPNAME_USERDATA, Cache.splitTokenString(sToken, ";")); + break; + case 6 : + aResultMap.put(PROPNAME_FILEFORMATVERSION, new java.lang.Integer(sToken)); + break; + case 7 : + aResultMap.put(PROPNAME_TEMPLATENAME, sToken); + break; + case 8 : + aResultMap.put(PROPNAME_UICOMPONENT, sToken); + break; + default : + throw new java.lang.Exception("unsupported format for data value of a filter detected."); + } + ++t; + } + + // its an optional property :-) + if (!aResultMap.containsKey(PROPNAME_TEMPLATENAME)) + aResultMap.put(PROPNAME_TEMPLATENAME, new java.lang.String("")); + + // its an optional property :-) + if (!aResultMap.containsKey(PROPNAME_UICOMPONENT)) + aResultMap.put(PROPNAME_UICOMPONENT, new java.lang.String("")); + } + break; + + //----------------------------------- + case FORMAT_6Y : + { + // "Order" does not exist for 6.y versions! Use default. + aResultMap.put(PROPNAME_ORDER, new java.lang.Integer(0)); + + // "UIName" property does not exist for 6.y versions! use default. + /* TODO make it configurable :-) */ + aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME)); + //aResultMap.put(PROPNAME_UINAME, new java.util.HashMap()); + + // "Flags" must be converted from names to its values + java.util.Vector lFlags = (java.util.Vector)aMap.get(PROPNAME_FLAGS); + java.lang.Integer nFlags = Cache.convertFilterFlagNames2Values(lFlags); + aResultMap.put(PROPNAME_FLAGS, nFlags); + + // copy all direct supported properties + aResultMap.put(PROPNAME_TYPE , aMap.get(PROPNAME_TYPE )); + aResultMap.put(PROPNAME_DOCUMENTSERVICE , aMap.get(PROPNAME_DOCUMENTSERVICE )); + aResultMap.put(PROPNAME_FILTERSERVICE , aMap.get(PROPNAME_ORDER )); + aResultMap.put(PROPNAME_USERDATA , aMap.get(PROPNAME_USERDATA )); + aResultMap.put(PROPNAME_FILEFORMATVERSION, aMap.get(PROPNAME_FILEFORMATVERSION)); + aResultMap.put(PROPNAME_TEMPLATENAME , aMap.get(PROPNAME_TEMPLATENAME )); + aResultMap.put(PROPNAME_UICOMPONENT , aMap.get(PROPNAME_UICOMPONENT )); + } + break; + + //----------------------------------- + default : + throw new java.lang.Exception("unknown format"); + } + + return aResultMap; + } + + private static java.util.HashMap convertDetectServicePropsToInternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + /*FIXME*/ + java.util.HashMap aResultMap = aMap; + return aResultMap; + } + + private static java.util.HashMap convertFrameLoaderPropsToInternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + /*FIXME*/ + java.util.HashMap aResultMap = aMap; + return aResultMap; + } + + private static java.util.HashMap convertContentHandlerPropsToInternal(java.util.HashMap aMap , + int nFormat) + throws java.lang.Exception + { + /*FIXME*/ + java.util.HashMap aResultMap = aMap; + return aResultMap; + } + + //___________________________________________ + + /** converts filter flag names to its int representation. + * + * @param lFlags + * a list of flag names. + * + * @return [java.lang.Integer] + * an integer field of all set flags. + * + * @throws [java.lang.Exception] + * for unsupported flags or empty flag fields! + */ + private static java.lang.Integer convertFilterFlagNames2Values(java.util.Vector lFlags) + throws java.lang.Exception + { + int nFlags = 0; + java.util.Enumeration it = lFlags.elements(); + while(it.hasMoreElements()) + { + java.lang.String sFlagName = (java.lang.String)it.nextElement(); + + if (sFlagName.equals(FLAGNAME_3RDPARTYFILTER)) + nFlags |= FLAGVAL_3RDPARTYFILTER; + else + if (sFlagName.equals(FLAGNAME_ALIEN)) + nFlags |= FLAGVAL_ALIEN; + else + if (sFlagName.equals(FLAGNAME_ASYNCHRON)) + nFlags |= FLAGVAL_ASYNCHRON; + else + if (sFlagName.equals(FLAGNAME_BROWSERPREFERRED)) + nFlags |= FLAGVAL_BROWSERPREFERRED; + else + if (sFlagName.equals(FLAGNAME_CONSULTSERVICE)) + nFlags |= FLAGVAL_CONSULTSERVICE; + else + if (sFlagName.equals(FLAGNAME_DEFAULT)) + nFlags |= FLAGVAL_DEFAULT; + else + if (sFlagName.equals(FLAGNAME_EXPORT)) + nFlags |= FLAGVAL_EXPORT; + else + if (sFlagName.equals(FLAGNAME_IMPORT)) + nFlags |= FLAGVAL_IMPORT; + else + if (sFlagName.equals(FLAGNAME_INTERNAL)) + nFlags |= FLAGVAL_INTERNAL; + else + if (sFlagName.equals(FLAGNAME_NOTINCHOOSER)) + nFlags |= FLAGVAL_NOTINCHOOSER; + else + if (sFlagName.equals(FLAGNAME_NOTINFILEDIALOG)) + nFlags |= FLAGVAL_NOTINFILEDIALOG; + else + if (sFlagName.equals(FLAGNAME_NOTINSTALLED)) + nFlags |= FLAGVAL_NOTINSTALLED; + else + if (sFlagName.equals(FLAGNAME_OWN)) + nFlags |= FLAGVAL_OWN; + else + if (sFlagName.equals(FLAGNAME_PACKED)) + nFlags |= FLAGVAL_PACKED; + else + if (sFlagName.equals(FLAGNAME_PREFERRED)) + nFlags |= FLAGVAL_PREFERRED; + else + if (sFlagName.equals(FLAGNAME_READONLY)) + nFlags |= FLAGVAL_READONLY; + else + if (sFlagName.equals(FLAGNAME_SILENTEXPORT)) + nFlags |= FLAGVAL_SILENTEXPORT; + else + if (sFlagName.equals(FLAGNAME_TEMPLATE)) + nFlags |= FLAGVAL_TEMPLATE; + else + if (sFlagName.equals(FLAGNAME_TEMPLATEPATH)) + nFlags |= FLAGVAL_TEMPLATEPATH; + else + if (sFlagName.equals(FLAGNAME_USESOPTIONS)) + nFlags |= FLAGVAL_USESOPTIONS; + else + if (sFlagName.equals(FLAGNAME_COMBINED)) + nFlags |= FLAGVAL_COMBINED; + else + throw new java.lang.Exception("unsupported filter flag detected: \""+sFlagName+"\""); + } + + if (nFlags == 0) + throw new java.lang.Exception("no filter flags?"); + + return new java.lang.Integer(nFlags); + } + + //___________________________________________ + + /** converts filter flag values to its string representation. + * + * @param nFlags + * the flag field as int value. + * + * @return [java.util.Vector] + * a list of flag names. + * + * @throws [java.lang.Exception] + * for unsupported flags or empty flag fields! + */ + private static java.util.Vector convertFilterFlagValues2Names(java.lang.Integer nFlags) + throws java.lang.Exception + { + java.util.Vector lFlags = new java.util.Vector(); + int field = nFlags.intValue(); + + if (field == 0) + throw new java.lang.Exception("no filter flags?"); + + if((field & FLAGVAL_IMPORT) == FLAGVAL_IMPORT) + lFlags.add(FLAGNAME_IMPORT); + + if((field & FLAGVAL_EXPORT) == FLAGVAL_EXPORT) + lFlags.add(FLAGNAME_EXPORT); + + if((field & FLAGVAL_TEMPLATE) == FLAGVAL_TEMPLATE) + lFlags.add(FLAGNAME_TEMPLATE); + + if((field & FLAGVAL_INTERNAL) == FLAGVAL_INTERNAL) + lFlags.add(FLAGNAME_INTERNAL); + + if((field & FLAGVAL_TEMPLATEPATH) == FLAGVAL_TEMPLATEPATH) + lFlags.add(FLAGNAME_TEMPLATEPATH); + + if((field & FLAGVAL_OWN) == FLAGVAL_OWN) + lFlags.add(FLAGNAME_OWN); + + if((field & FLAGVAL_ALIEN) == FLAGVAL_ALIEN) + lFlags.add(FLAGNAME_ALIEN); + + if((field & FLAGVAL_USESOPTIONS) == FLAGVAL_USESOPTIONS) + lFlags.add(FLAGNAME_USESOPTIONS); + + if((field & FLAGVAL_DEFAULT) == FLAGVAL_DEFAULT) + lFlags.add(FLAGNAME_DEFAULT); + + if((field & FLAGVAL_NOTINFILEDIALOG) == FLAGVAL_NOTINFILEDIALOG) + lFlags.add(FLAGNAME_NOTINFILEDIALOG); + + if((field & FLAGVAL_NOTINCHOOSER) == FLAGVAL_NOTINCHOOSER) + lFlags.add(FLAGNAME_NOTINCHOOSER); + + if((field & FLAGVAL_ASYNCHRON) == FLAGVAL_ASYNCHRON) + lFlags.add(FLAGNAME_ASYNCHRON); + + if((field & FLAGVAL_READONLY) == FLAGVAL_READONLY) + lFlags.add(FLAGNAME_READONLY); + + if((field & FLAGVAL_NOTINSTALLED) == FLAGVAL_NOTINSTALLED) + lFlags.add(FLAGNAME_NOTINSTALLED); + + if((field & FLAGVAL_CONSULTSERVICE) == FLAGVAL_CONSULTSERVICE) + lFlags.add(FLAGNAME_CONSULTSERVICE); + + if((field & FLAGVAL_3RDPARTYFILTER) == FLAGVAL_3RDPARTYFILTER) + lFlags.add(FLAGNAME_3RDPARTYFILTER); + + if((field & FLAGVAL_PACKED) == FLAGVAL_PACKED) + lFlags.add(FLAGNAME_PACKED); + + if((field & FLAGVAL_SILENTEXPORT) == FLAGVAL_SILENTEXPORT) + lFlags.add(FLAGNAME_SILENTEXPORT); + + if((field & FLAGVAL_BROWSERPREFERRED) == FLAGVAL_BROWSERPREFERRED) + lFlags.add(FLAGNAME_BROWSERPREFERRED); + + if((field & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED) + lFlags.add(FLAGNAME_PREFERRED); + + if((field & FLAGVAL_COMBINED) == FLAGVAL_COMBINED) + lFlags.add(FLAGNAME_COMBINED); + + if((field & FLAGVAL_COMBINED) == FLAGVAL_SUPPORTSSELECTION) + lFlags.add(FLAGNAME_SUPPORTSSELECTION); + + return lFlags; + } + + //___________________________________________ + + /** return a reference to one of our member + * lists for types/filters etc ... + * + * @param eItemType + * specify, which item map is required. + * + * @return [java.util.HashMap] + * a reference(!) to the right member. + * + * @throws [java.lang.Exception] + * if the specified map does not exist. + */ + private java.util.HashMap getItemMap(int eItemType) + throws java.lang.Exception + { + java.util.HashMap rMap = null; + switch(eItemType) + { + case E_TYPE : + rMap = m_lTypes; + break; + + case E_FILTER : + rMap = m_lFilters; + break; + + case E_DETECTSERVICE : + rMap = m_lDetectServices; + break; + + case E_FRAMELOADER : + rMap = m_lFrameLoaders; + break; + + case E_CONTENTHANDLER : + rMap = m_lContentHandlers; + break; + + default: + throw new java.lang.Exception("Invalid item map specified."); + } + return rMap; + } + + //___________________________________________ + + /** return the count of items inside a sub container + * of this cache. + * + * @param eItemType + * specify, which item map is required. + * + * @throws [java.lang.Exception] + * if the specified map does not exist. + */ + public synchronized int getItemCount(int eItemType) + throws java.lang.Exception + { + java.util.HashMap rMap = getItemMap(eItemType); + return rMap.size(); + } + + //___________________________________________ + + /** get a list of all item names of the specified + * sub container. + * + * @param eItemType + * specify, which item map is required. + * + * @throws [java.lang.Exception] + * if the specified map does not exist. + */ + public synchronized java.util.Vector getItemNames(int eItemType) + throws java.lang.Exception + { + java.util.Vector lNames = new java.util.Vector(); + java.util.HashMap rMap = getItemMap(eItemType); + java.util.Iterator it = rMap.keySet().iterator(); + while(it.hasNext()) + lNames.add(it.next()); + return lNames; + } + + //___________________________________________ + + /** get a list of all item names of the specified + * sub coontainer, where items match to given property set. + * + * Note: The given property set must exist at all + * returned items as minimum and every checked property + * value must be equals! Using of reg expressions or + * similar mechanism will not be supported here. + * + * @param eItemType + * specify, which item map is required. + * + * @param aPropSet + * the set of properties, which must + * exist at the returned item as minimum. + * + * @throws [java.lang.Exception] + * if the specified map does not exist. + */ + public synchronized java.util.Vector getMatchedItemNames(int eItemType, + java.util.HashMap aPropSet ) + throws java.lang.Exception + { + java.util.Vector lNames = new java.util.Vector(); + java.util.HashMap rMap = getItemMap(eItemType); + java.util.Iterator it = rMap.keySet().iterator(); + while(it.hasNext()) + { + java.lang.String sItemName = (java.lang.String)it.next(); + java.util.HashMap rItemProps = (java.util.HashMap)rMap.get(sItemName); + + boolean bMatch = Cache.matchPropSet(rItemProps, aPropSet); + if (bMatch) + lNames.add(sItemName); + else + { + java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(1000); + sBuffer.append("entry ["+eItemType+"] \""+sItemName+"\" does not match.\n"); + sBuffer.append("\torg items = {"+rItemProps+"}\n"); + sBuffer.append("\treq items = {"+aPropSet+"}\n"); + + m_aDebug.setDetailedInfo(sBuffer.toString()); + } + } + return lNames; + } + + //___________________________________________ + + /** check if two property sets are equals in its + * shared properties. + * + * Note: Only set properties of the match set will be searched + * inside the original set. And its values must be equals. + * Using of reg expressions or similar mechanism will not + * be supported here. + * + * @param rOrgProps + * the original property set, which should be checked. + * + * @param rMatchProps + * contains the properties, which must be searched + * inside rOrgProps. + * + * @return TRUE if all properties of rMatchProps could be located + * inside rOrgProps. + */ + private static boolean matchPropSet(java.util.HashMap rOrgProps , + java.util.HashMap rMatchProps) + { + java.util.Iterator it = rMatchProps.keySet().iterator(); + while(it.hasNext()) + { + java.lang.String sMatchName = (java.lang.String)it.next(); + java.lang.Object aMatchValue = rMatchProps.get(sMatchName); + + if ( + (!rOrgProps.containsKey(sMatchName) ) || + (!rOrgProps.get(sMatchName).equals(aMatchValue)) + ) + { + return false; + } + } + return true; + } + + //___________________________________________ + + /** return a property set for the queried container item. + * + * @param eItemType + * specify, which item map is required. + * + * @param sItemName + * must be a valid item name of the specified item map. + * + * @return [java.util.HashMap] + * the property set of the queried item. + * Always different from null! + * + * @throws [java.lang.Exception] + * if the specified item does not exists or + * seems to be invalid in general (means null!). + */ + public synchronized java.util.HashMap getItem(int eItemType, + java.lang.String sItemName) + throws java.lang.Exception + { + java.util.HashMap rMap = getItemMap(eItemType); + java.util.HashMap rItem = (java.util.HashMap)rMap.get(sItemName); + if (rItem == null) + throw new java.lang.Exception("Queried item \""+sItemName+"\" does not exist inside this cache."); + return rItem; + } + + //___________________________________________ + + /** return a requested item in XML format. + * + * @param eItemType + * identify the right sub set of this cache + * inside which the requested item should exist. + * e.g. E_TYPE, E_FILTER, ... + * + * @param sItemName + * the name of the request item + * + * @param nXMLFormat + * means the format of the generated xml source. + * + * @return [java.lang.String] + * a xml formated string, which contains all properties + * for this container item. + */ + public synchronized java.lang.String getItemAsXML(int eItemType , + java.lang.String sItemName , + int nXMLFormat) + throws java.lang.Exception + { + // Note: Our internal format must be converted to the target format! + java.util.HashMap rItem = getItem(eItemType, sItemName); + java.util.HashMap rFormatedItem = null; + switch(eItemType) + { + case E_TYPE : + { + rFormatedItem = Cache.convertTypePropsToExternal(rItem, nXMLFormat); + m_aDebug.setGlobalInfo("type to external \""+sItemName+"\""); + } + break; + + case E_FILTER : + { + rFormatedItem = Cache.convertFilterPropsToExternal(rItem, nXMLFormat); + m_aDebug.setGlobalInfo("filter to external \""+sItemName+"\""); + } + break; + + case E_DETECTSERVICE : + { + rFormatedItem = Cache.convertDetectServicePropsToExternal(rItem, nXMLFormat); + m_aDebug.setGlobalInfo("detect service to external \""+sItemName+"\""); + } + break; + + case E_FRAMELOADER : + { + rFormatedItem = Cache.convertFrameLoaderPropsToExternal(rItem, nXMLFormat); + m_aDebug.setGlobalInfo("frame loader to external \""+sItemName+"\""); + } + break; + + case E_CONTENTHANDLER : + { + rFormatedItem = Cache.convertContentHandlerPropsToExternal(rItem, nXMLFormat); + m_aDebug.setGlobalInfo("content handler to external \""+sItemName+"\""); + } + break; + } + + java.lang.StringBuffer sXML = new java.lang.StringBuffer(1000); + int nPrettyTabs = 1; + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + sXML.append("<"+XMLHelper.XMLTAG_NODE+" "+XMLHelper.XMLATTRIB_OOR_NAME+"=\""+XMLHelper.encodeHTMLSigns(sItemName)+"\" "+XMLHelper.XMLATTRIB_OOR_OP+"=\""+XMLHelper.XMLATTRIB_OP_REPLACE+"\">\n"); + sXML.append(XMLHelper.convertPropSetToXML(rFormatedItem, nPrettyTabs+1)); + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + sXML.append("</"+XMLHelper.XMLTAG_NODE+">\n"); + + return sXML.toString(); + } + + //___________________________________________ + + /** split the given string (using the specified delimiter) + * and return alist of found string tokens. + * + * Note: Against the normal behaviour of the StringTokenizer class + * this method returns empty tokens too. + * E.g: "0,,1" will return "0" - "" - "1" + * + * @param sTokenString + * the string value, which should be analyzed. + * + * @param sDelim + * the delimiter, which will be used to differe between tokens. + * + * @return [java.util.Vector] + * a list of string tokens. Can be empty - but not null! + */ + private static java.util.Vector splitTokenString(java.lang.String sTokenString, + java.lang.String sDelim ) + { + java.util.Vector lTokens = new java.util.Vector(); + java.util.StringTokenizer aTokenizer = new java.util.StringTokenizer(sTokenString, sDelim, true); + boolean bLastWasDelim = false; + + while (aTokenizer.hasMoreTokens()) + { + java.lang.String sToken = aTokenizer.nextToken(); + if (sToken.equals(sDelim)) + { + if (bLastWasDelim) + { + // last token was a delimiter - new one too + // => an empty token must be placed between these + // two delimiters! Add this empty value to the return list. + lTokens.add(""); + } + else + { + // last token was not a delimiter - new one is such delim + // => ignore this delimiter - but save the information, that + // it occured + bLastWasDelim = true; + } + } + else + { + // new token is no delim + // => Add it to the return list. + lTokens.add(sToken); + // Dont forget to reset this information - so next loop + // will do the right things! + bLastWasDelim = false; + } + } + + return lTokens; + } + + //___________________________________________ + + /** + */ + public synchronized void analyze() + { + m_nDoubleRegisteredFilters = 0; + m_nTypesForFilters = 0; + m_nTypesForDetectServices = 0; + m_nTypesForFrameLoaders = 0; + m_nTypesForContentHandlers = 0; + + // create table of types and all registered filters for such types + // By the way: count all double registrations, where a filter + // uses the same type then another filter. + m_lFilterToTypeRegistrations = new java.util.HashMap(); + java.util.Iterator aIt1 = m_lFilters.keySet().iterator(); + while (aIt1.hasNext()) + { + java.lang.String sFilter = (java.lang.String)aIt1.next(); + java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter); + java.lang.String sType = (java.lang.String)aFilter.get(PROPNAME_TYPE); + + java.util.Vector lFilters = (java.util.Vector)m_lFilterToTypeRegistrations.get(sType); + if (lFilters == null) + lFilters = new java.util.Vector(); + else + ++m_nDoubleRegisteredFilters; + lFilters.add(sFilter); + m_lFilterToTypeRegistrations.put(sType, lFilters); + } + + // count, how many types are used by filters, frame loaders or content handlers + aIt1 = m_lTypes.keySet().iterator(); + while (aIt1.hasNext()) + { + java.lang.String sType = (java.lang.String)aIt1.next(); + + java.util.Iterator aIt2 = m_lFilters.keySet().iterator(); + while (aIt2.hasNext()) + { + java.lang.String sItem = (java.lang.String)aIt2.next(); + java.util.HashMap aItem = (java.util.HashMap)m_lFilters.get(sItem); + java.lang.String sTypeReg = (java.lang.String)aItem.get(PROPNAME_TYPE); + + if (sTypeReg.equals(sType)) + { + ++m_nTypesForFilters; + break; + } + } + + aIt2 = m_lDetectServices.keySet().iterator(); + while (aIt2.hasNext()) + { + java.lang.String sItem = (java.lang.String)aIt2.next(); + java.util.HashMap aItem = (java.util.HashMap)m_lDetectServices.get(sItem); + java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES); + + if (lTypeReg.contains(sType)) + { + ++m_nTypesForDetectServices; + break; + } + } + + aIt2 = m_lFrameLoaders.keySet().iterator(); + while (aIt2.hasNext()) + { + java.lang.String sItem = (java.lang.String)aIt2.next(); + java.util.HashMap aItem = (java.util.HashMap)m_lFrameLoaders.get(sItem); + java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES); + + if (lTypeReg.contains(sType)) + { + ++m_nTypesForFrameLoaders; + break; + } + } + + aIt2 = m_lContentHandlers.keySet().iterator(); + while (aIt2.hasNext()) + { + java.lang.String sItem = (java.lang.String)aIt2.next(); + java.util.HashMap aItem = (java.util.HashMap)m_lContentHandlers.get(sItem); + java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES); + + if (lTypeReg.contains(sType)) + { + ++m_nTypesForContentHandlers; + break; + } + } + } + } + + //___________________________________________ + + /** validate all cache entries. + * + * It checks if all made registrations are valid; + * try to repair some simple problems; + * create missing informations on demand ... + * + * @param nFormat + * specify, which configuration format + * must be checked. + * + * @throws [java.lang.Exception] + * if an unrecoverable problem occure. + */ + public synchronized void validate(int nFormat) + throws java.lang.Exception + { + validateTypes(nFormat); + validateFilters(nFormat); + } + + //___________________________________________ + + /** validate all type entries of this cache. + * + * @param nFormat + * specify, which configuration format + * must be checked. + * + * @throws [java.lang.Exception] + * if an unrecoverable problem occure. + */ + private void validateTypes(int nFormat) + throws java.lang.Exception + { + java.util.Iterator aIt1 = m_lTypes.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sType = (java.lang.String)aIt1.next(); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sType); + if (aType == null) + throw new java.lang.Exception("type ["+sType+"] dos not exist realy?!"); + + if ( + (!aType.containsKey(PROPNAME_MEDIATYPE )) || + (!aType.containsKey(PROPNAME_PREFERRED )) || + (!aType.containsKey(PROPNAME_CLIPBOARDFORMAT)) || + (!aType.containsKey(PROPNAME_DOCUMENTICONID )) || + (!aType.containsKey(PROPNAME_URLPATTERN )) || + (!aType.containsKey(PROPNAME_EXTENSIONS )) || + (!aType.containsKey(PROPNAME_UINAME )) + ) + { + throw new java.lang.Exception("Type \""+sType+"\" does not contain all neccessary properties for a 6.0/6.Y format."); + } + + if ( + (((java.util.Vector)aType.get(PROPNAME_EXTENSIONS)).isEmpty()) && + (((java.util.Vector)aType.get(PROPNAME_URLPATTERN)).isEmpty()) + ) + { + throw new java.lang.Exception("Type \""+sType+"\" does not contain any extension nor an url pattern."); + } + + if (((java.util.HashMap)aType.get(PROPNAME_UINAME)).isEmpty()) + throw new java.lang.Exception("Type \""+sType+"\" is not localized."); + + if (nFormat == FORMAT_6Y) + { + if ( + (!aType.containsKey(PROPNAME_UIORDER )) || + (!aType.containsKey(PROPNAME_PREFERREDFILTER)) || + (!aType.containsKey(PROPNAME_DETECTSERVICE )) + ) + { + throw new java.lang.Exception("Type \""+sType+"\" does not contain all neccessary properties for a 6.Y format."); + } + + if (((java.lang.Integer)aType.get(PROPNAME_UIORDER)).intValue() < 0) + throw new java.lang.Exception("Type \""+sType+"\" has invalid value for prop UIOrder."); + + if (((java.lang.String)aType.get(PROPNAME_DETECTSERVICE)).length() < 1) + m_aDebug.setWarning("Type \""+sType+"\" has no detect service registered."); + + java.lang.String sPreferredReg = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER); + if ( + (sPreferredReg == null) || + (sPreferredReg.length() < 1 ) + ) + { + m_aDebug.setWarning("Type \""+sType+"\" has no preferred filter ..."); + /*FIXME + * OK - not every type has a filter registered .. but the + * a frame loader MUST(!) exist! Check it. + */ + } + else + { + if (!m_lFilters.containsKey(sPreferredReg)) + throw new java.lang.Exception("Type \""+sType+"\" has no valid preferred filter registration [\""+sPreferredReg+"\"]."); + } + } + } + } + + //___________________________________________ + + /** validate all filter entries of this cache. + * + * @param nFormat + * specify, which configuration format + * must be checked. + * + * @throws [java.lang.Exception] + * if an unrecoverable problem occure. + */ + public synchronized void validateFilters(int nFormat) + throws java.lang.Exception + { + java.util.Iterator aIt1 = m_lFilters.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sFilter = (java.lang.String)aIt1.next(); + java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter); + if (aFilter == null) + throw new java.lang.Exception("filter ["+sFilter+"] dos not exist realy?!"); + + if ( + (!aFilter.containsKey(PROPNAME_DOCUMENTSERVICE )) || + (!aFilter.containsKey(PROPNAME_FILEFORMATVERSION)) || + (!aFilter.containsKey(PROPNAME_FILTERSERVICE )) || + (!aFilter.containsKey(PROPNAME_FLAGS )) || + (!aFilter.containsKey(PROPNAME_TEMPLATENAME )) || + (!aFilter.containsKey(PROPNAME_TYPE )) || + (!aFilter.containsKey(PROPNAME_UICOMPONENT )) || + (!aFilter.containsKey(PROPNAME_USERDATA )) + ) + { + throw new java.lang.Exception("Filter \""+sFilter+"\" does not contain all neccessary properties for a 6.0/6.Y format."); + } + + if (((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue() < 1) + throw new java.lang.Exception("Filter \""+sFilter+"\" does not have a valid flag field."); + + if (!m_lTypes.containsKey(aFilter.get(PROPNAME_TYPE))) + throw new java.lang.Exception("Filter \""+sFilter+"\" is not registered for a well known type."); + + if (nFormat == FORMAT_60) + { + if ( + (!aFilter.containsKey(PROPNAME_ORDER )) || + (!aFilter.containsKey(PROPNAME_UINAME)) + ) + { + throw new java.lang.Exception("Filter \""+sFilter+"\" does not contain all neccessary properties for a 6.0 format."); + } + + if (((java.lang.Integer)aFilter.get(PROPNAME_ORDER)).intValue() < 0) + throw new java.lang.Exception("Filter \""+sFilter+"\" does not have a valid Order value."); + + if (((java.util.HashMap)aFilter.get(PROPNAME_UINAME)).isEmpty()) + throw new java.lang.Exception("Filter \""+sFilter+"\" is not localized."); + } +/*TODO + depends from the configuration item "remove_filter_flag_preferred" ... + + if (nFormat == FORMAT_6Y) + { + int flags = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue(); + if ((flags & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED) + throw new java.lang.Exception("Filter \""+sFilter+"\" has superflous Preferred flag set. Please remove this flag. ["+flags+"]"); + } +*/ + } + } + + /*TODO + * - remove graphic filters! + * - move detect services to types + */ + + public synchronized void transform60to6Y(boolean bCreateCombineFilterFlag , + boolean bRemoveFilterFlagBrowserPreferred, + boolean bRemoveFilterFlagPreferred , + boolean bRemoveFilterFlag3rdparty , + boolean bRemoveFilterUINames , + boolean bRemoveGraphicFilters , + boolean bSetDefaultDetector ) + throws java.lang.Exception + { + // remove some superflous cache entries ... + // everything related to "load macros" + // Macros should be dispatched instead of loaded! + if (m_lTypes.containsKey("macro")) + { + m_lTypes.remove("macro"); + m_aDebug.setDetailedInfo("superflous type \"macro\" was removed"); + } + if (m_lFrameLoaders.containsKey("com.sun.star.comp.sfx2.SfxMacroLoader")) + { + m_lFrameLoaders.remove("com.sun.star.comp.sfx2.SfxMacroLoader"); + m_aDebug.setDetailedInfo("superflous frame loader \"com.sun.star.comp.sfx2.SfxMacroLoader\" was removed"); + } + + // step over all filters and check her properties and references + java.util.Vector lPreferredFilters = new java.util.Vector(); + java.util.Vector lNoRealFilters = new java.util.Vector(); + java.util.Iterator aIt1 = m_lFilters.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sFilter = (java.lang.String)aIt1.next(); + java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter); + + // remove the "graphic helper filters" used by draw and impress + // They dont have any valid document service name set and cant be handled + // by our generic FrameLoader! + // They must be moved to her own configuration ... + + if ( + (bRemoveGraphicFilters ) && + (((java.lang.String)aFilter.get(PROPNAME_DOCUMENTSERVICE)).length() < 1) + ) + { + lNoRealFilters.add(sFilter); + continue; + } + + java.lang.String sTypeReg = (java.lang.String)aFilter.get(PROPNAME_TYPE); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg); + + // move UINames of filters to types + java.util.HashMap lFilterUINames = (java.util.HashMap)aFilter.get(PROPNAME_UINAME); + java.util.HashMap lTypeUINames = (java.util.HashMap)aType.get(PROPNAME_UINAME); + java.util.HashMap lPatchUINames = new java.util.HashMap(); + + java.util.Iterator pUINames = lTypeUINames.keySet().iterator(); + while(pUINames.hasNext()) + { + java.lang.String sLocale = (java.lang.String)pUINames.next(); + java.lang.String sValue = (java.lang.String)lTypeUINames.get(sLocale); + lPatchUINames.put(sLocale, sValue); + } + + pUINames = lFilterUINames.keySet().iterator(); + while(pUINames.hasNext()) + { + java.lang.String sLocale = (java.lang.String)pUINames.next(); + java.lang.String sValue = (java.lang.String)lFilterUINames.get(sLocale); + lPatchUINames.put(sFilter+":"+sLocale, sValue); + } + aType.put(PROPNAME_UINAME, lPatchUINames); + + // set generic filter service wrapper for our own native filters! + // By the way: The format types of such filters can be detected by our + // generic detector too. + if ( + (bSetDefaultDetector ) && + (((java.lang.String)aFilter.get(PROPNAME_FILTERSERVICE)).length() < 1) + ) + { + /*ME_THINKING aFilter.put(PROPNAME_FILTERSERVICE, FILTERSERVICE_NATIVEWARPPER);*/ + aType.put(PROPNAME_DETECTSERVICE, GENERIC_DETECTSERVICE); + } + + // move the preferred filter information to any type + // Set the filter name to the type for which the filter is registered. + // If this type already have a set PreferredFilter value, check if the current filter + // has the preferred flag set. If not ignore it - otherwhise overwrite the + // current information at the type. But look for multiple preferred filter relations ... + // means: look if more the one filter has set the preferred flag for the same type! + + /* Attention! + * + * Dont remove the preferred flag from any filter! ... not here. + * Otherwhise next loop can't detect ambigous preferred registrations! + * Add filter to a temp. list, which can be used later to remove the preferred + * flag ... + */ + + int flags1 = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue(); + java.lang.String sDocSrv = (java.lang.String)aFilter.get(PROPNAME_DOCUMENTSERVICE); + if (sDocSrv.length()>0)// without a doc service its not a real filter - its a graphic filter! + { + boolean preferred1 = ((flags1 & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED); + if (preferred1) + lPreferredFilters.add(aFilter); + + java.lang.String sAlreadyRegisteredFilter = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER); + // no registration => set this filter as "any possible one"! + if (sAlreadyRegisteredFilter.length() < 1) + aType.put(PROPNAME_PREFERREDFILTER, sFilter); + else + { + java.util.HashMap aAlreadyRegisteredFilter = (java.util.HashMap)m_lFilters.get(sAlreadyRegisteredFilter); + int flags2 = ((java.lang.Integer)aAlreadyRegisteredFilter.get(PROPNAME_FLAGS)).intValue(); + boolean preferred2 = ((flags2 & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED); + + // two preferred filters for the same type! => error + if (preferred1 && preferred2) + { + java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256); + sMsg.append("More the one preferred filter detected for the same type.\n"); + sMsg.append("\ttype = \""+sTypeReg+"\"\n"); + sMsg.append("\tfilter[1] = \""+sAlreadyRegisteredFilter+"\"\n"); + sMsg.append("\tfilter[2] = \""+sFilter+"\"\n"); + throw new java.lang.Exception(sMsg.toString()); + } + else + // overwrite the "any possible" filter with a real preferred one + if (preferred1 && !preferred2) + aType.put(PROPNAME_PREFERREDFILTER, sFilter); + } + } + + // create the new combined filter flag if required + if (bCreateCombineFilterFlag) + { + if ( + ((flags1 & FLAGVAL_IMPORT) == FLAGVAL_IMPORT) && + ((flags1 & FLAGVAL_EXPORT) == FLAGVAL_EXPORT) + ) + { + flags1 |= FLAGVAL_COMBINED; + flags1 &= ~FLAGVAL_IMPORT ; + flags1 &= ~FLAGVAL_EXPORT ; + aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1)); + } + } + + // remove some obsolete filter flags + if (bRemoveFilterFlagBrowserPreferred) + { + flags1 &= ~FLAGVAL_BROWSERPREFERRED; + aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1)); + } + + if (bRemoveFilterFlag3rdparty) + { + flags1 &= ~FLAGVAL_3RDPARTYFILTER; + aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1)); + } + + // if its a filter with an UI order ... + // move this information to the registered type. + // Note: Because more then one filter can be registered for the same type. + // Handle it as an error ... till we find a better transformation! + java.lang.Integer nOrder = (java.lang.Integer)aFilter.get(PROPNAME_ORDER); + java.lang.Integer nUIOrder = (java.lang.Integer)aType.get(PROPNAME_UIORDER); + int order = nOrder.intValue(); + int uiorder = nUIOrder.intValue(); + + if (order > 0) + { + if ( + (uiorder < 1 ) || + (uiorder > order) + ) + { + aType.put(PROPNAME_UIORDER, nOrder); + m_aDebug.setDetailedInfo("moved order value "+nOrder+" from filter \""+sFilter+"\" to type \""+sTypeReg+"\""); + } + else + m_aDebug.setDetailedInfo("ignore order value [order="+nOrder+",uiorder="+nUIOrder+"] for filter \""+sFilter+"\" and type \""+sTypeReg+"\""); + } + } + + // NOW ... remove the preferred flags from every filter, which it has set. + java.util.Enumeration aIt2 = null; + if (bRemoveFilterFlagPreferred) + { + aIt2 = lPreferredFilters.elements(); + while (aIt2.hasMoreElements()) + { + java.util.HashMap aFilter = (java.util.HashMap)aIt2.nextElement(); + int flags = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue(); + flags &= ~FLAGVAL_PREFERRED; + aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags)); + } + } + + // NOW ... remove all "no real filters" like the graphich helper filters of + // draw and impress! + aIt2 = lNoRealFilters.elements(); + while (aIt2.hasMoreElements()) + m_lFilters.remove(aIt2.nextElement()); + + // step over all detect services and move this information directly to + // the corresponding types + // Overwrite possibel default registrations with a real existing one! + aIt1 = m_lDetectServices.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sDetector = (java.lang.String)aIt1.next(); + java.util.HashMap aDetector = (java.util.HashMap)m_lDetectServices.get(sDetector); + java.util.Vector lTypeReg = (java.util.Vector)aDetector.get(PROPNAME_TYPES); + aIt2 = lTypeReg.elements(); + while(aIt2.hasMoreElements()) + { + java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement(); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg); + + if (aType == null) + { + m_aDebug.setWarning("Detector \""+sDetector+"\" seem to be registered for unknown type \""+sTypeReg+"\""); + continue; + } + + java.lang.Object aAlreadyRegisteredDetector = aType.get(PROPNAME_DETECTSERVICE); + if (aAlreadyRegisteredDetector != null && ((java.lang.String)aAlreadyRegisteredDetector).length() > 0) + { + java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256); + sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a detect service\n"); + sMsg.append("\tdetect service[1] = \""+(java.lang.String)aAlreadyRegisteredDetector+"\"\n"); + sMsg.append("\tdetect service[2] = \""+sDetector+"\"\n"); + m_aDebug.setWarning(sMsg.toString()); + } + aType.put(PROPNAME_DETECTSERVICE, sDetector); + m_aDebug.setGlobalInfo("move detector \""+sDetector+"\" to type \""+sTypeReg+"\""); + } + } + + // because all detect service was registered as type properties directly ... + // remove all detect service objects of this cache! + m_lDetectServices.clear(); + + // step over all frame loader and move this information directly to + // the corresponding types + // Overwrite possibel default registrations with a real existing one! + aIt1 = m_lFrameLoaders.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sLoader = (java.lang.String)aIt1.next(); + java.util.HashMap aLoader = (java.util.HashMap)m_lFrameLoaders.get(sLoader); + java.util.Vector lTypeReg = (java.util.Vector)aLoader.get(PROPNAME_TYPES); + aIt2 = lTypeReg.elements(); + while(aIt2.hasMoreElements()) + { + java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement(); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg); + java.lang.String sAlreadyRegisteredLoader = (java.lang.String)aType.get(PROPNAME_FRAMELOADER); + if (sAlreadyRegisteredLoader != null && sAlreadyRegisteredLoader.length() > 0) + { + java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256); + sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a frame loader\n"); + sMsg.append("\tframe loader[1] = \""+sAlreadyRegisteredLoader+"\"\n"); + sMsg.append("\tframe loader[2] = \""+sLoader+"\"\n"); + m_aDebug.setWarning(sMsg.toString()); + } + aType.put(PROPNAME_FRAMELOADER, sLoader); + System.out.println("move loader \""+sLoader+"\" to type \""+sTypeReg+"\""); + } + } + + m_lFrameLoaders.clear(); + + // step over all content handler and move this information directly to + // the corresponding types + // Overwrite possibel default registrations with a real existing one! + aIt1 = m_lContentHandlers.keySet().iterator(); + while(aIt1.hasNext()) + { + java.lang.String sHandler = (java.lang.String)aIt1.next(); + java.util.HashMap aHandler = (java.util.HashMap)m_lContentHandlers.get(sHandler); + java.util.Vector lTypeReg = (java.util.Vector)aHandler.get(PROPNAME_TYPES); + aIt2 = lTypeReg.elements(); + while(aIt2.hasMoreElements()) + { + java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement(); + java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg); + java.lang.String sAlreadyRegisteredHandler = (java.lang.String)aType.get(PROPNAME_CONTENTHANDLER); + if (sAlreadyRegisteredHandler != null && sAlreadyRegisteredHandler.length() > 0) + { + java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256); + sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a content handler\n"); + sMsg.append("\tcontent handler[1] = \""+sAlreadyRegisteredHandler+"\"\n"); + sMsg.append("\tcontent handler[2] = \""+sHandler+"\"\n"); + m_aDebug.setWarning(sMsg.toString()); + } + aType.put(PROPNAME_CONTENTHANDLER, sHandler); + System.out.println("move handler \""+sHandler+"\" to type \""+sTypeReg+"\""); + } + } + + m_lContentHandlers.clear(); + +/* + int c = m_lTypes.size(); + java.lang.String[] lT1 = new java.lang.String[c]; + java.lang.String[] lT2 = new java.lang.String[c]; + long nUPS = 0; + + int i = 0; + aIt1 = m_lTypes.keySet().iterator(); + while(aIt1.hasNext()) + { + lT1[i] = (java.lang.String)aIt1.next(); + lT2[i] = lT1[i]; + ++i; + } + + for (int i1=0; i1<c; ++i1) + { + java.lang.String sT1 = lT1[i1]; + java.util.HashMap aT1 = (java.util.HashMap)m_lTypes.get(sT1); + + for (int i2=i1; i2<c; ++i2) + { + java.lang.String sT2 = lT1[i2]; + java.util.HashMap aT2 = (java.util.HashMap)m_lTypes.get(sT2); + + if (!sT1.equals(sT2)) + { + if ( + aT1.get(PROPNAME_MEDIATYPE).equals(aT2.get(PROPNAME_MEDIATYPE)) && + aT1.get(PROPNAME_CLIPBOARDFORMAT).equals(aT2.get(PROPNAME_CLIPBOARDFORMAT)) && + aT1.get(PROPNAME_URLPATTERN).equals(aT2.get(PROPNAME_URLPATTERN)) && + aT1.get(PROPNAME_EXTENSIONS).equals(aT2.get(PROPNAME_EXTENSIONS)) + ) + { + System.err.println("UUPPSS----------------------------------------------------------------------------"); + System.err.println("[1]\""+sT1+"\" equals [2]\""+sT2+"\""); + System.err.println("\tprops 1: "+aT1); + System.err.println("\tprops 2: "+aT2); + System.err.println("----------------------------------------------------------------------------------\n"); + ++nUPS; +// throw new java.lang.Exception("UUPPS :-)"); + } + } + } + } + System.err.println("count of UPS = "+nUPS); +*/ + } +} diff --git a/transex3/source/filter/utils/ConfigHelper.java b/transex3/source/filter/utils/ConfigHelper.java new file mode 100644 index 000000000000..78cc71cf65b2 --- /dev/null +++ b/transex3/source/filter/utils/ConfigHelper.java @@ -0,0 +1,303 @@ +/************************************************************************* + * + * 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: ConfigHelper.java,v $ + * $Revision: 1.7 $ + * + * 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. + * + **********************************************************************_*/ + +package com.sun.star.filter.config.tools.utils; + +//_______________________________________________ +// imports + +import java.lang.*; +import java.util.*; +import java.io.*; + +//_______________________________________________ +// definition + +/** can be used to analyze command line parameters + * and merge it together with might existing config + * files. That provides the possibility to overwrite + * config values via command line parameter. + * + * + */ +public class ConfigHelper extends java.util.Properties +{ + //___________________________________________ + // member + + /** indicates an empty command line. */ + private boolean m_bEmpty = true; + + //___________________________________________ + // ctor + + //------------------------------------------- + /** initialize a new helper with the list of + * command line parameters and bind this new instance + * to a property file on disk. + * + * @param sPropFile + * name of the property file. + * If its set to null or an empty value + * it will be ignored. + * + * @param lCommandLineArgs + * the list of original command line arguments. + * + * @throws [Exception] + * in case the command line contains an unknown + * schema for specifiying parameters or the + * specified property file does not exists + * or seem to be corrupted. + */ + public ConfigHelper(java.lang.String sPropFile , + java.lang.String[] lCommandLineArgs) + throws java.lang.Exception + { + // first load prop file, so its values can be overwritten + // by command line args later + // Do it only, if a valid file name was given. + // But in case this file name is wrong, throw an exception. + // So the outside code can react! + if ( + (sPropFile != null) && + (sPropFile.length() > 0 ) + ) + { + java.lang.ClassLoader aLoader = getClass().getClassLoader(); + java.io.InputStream aStream = aLoader.getResourceAsStream(sPropFile); + if (aStream == null) + aStream = new java.io.FileInputStream(sPropFile); + load(aStream); + } + + int count = 0; + if (lCommandLineArgs != null) + count = lCommandLineArgs.length; + m_bEmpty = (count < 1); + + for (int arg=0; arg<count; ++arg) + { + // is it a named-value argument? + // Note: We ignores double "=" signs! => search from left to right + int len = lCommandLineArgs[arg].length(); + int pos = lCommandLineArgs[arg].indexOf('='); + if (pos != -1) + { + java.lang.String sArg = lCommandLineArgs[arg].substring(0,pos); + java.lang.String sValue = lCommandLineArgs[arg].substring(pos+1); + setProperty(sArg, sValue); + continue; + } + + // is it a boolean argument? + // Note: Because "--" and "-" will be interpreted as the same + // we search from right to left! + pos = lCommandLineArgs[arg].lastIndexOf('-'); + if (pos == -1) + pos = lCommandLineArgs[arg].lastIndexOf('/'); + if (pos != -1) + { + java.lang.String sArg = lCommandLineArgs[arg].substring(pos+1); + setProperty(sArg, java.lang.String.valueOf(true)); + continue; + } + + // There is an unknown format used by this argument ... + throw new MalformedCommandLineException("Invalid command line detected. The argument \""+lCommandLineArgs[arg]+"\" use an unsupported format."); + } + } + + //------------------------------------------- + /** indicates if the given command line includes + * a help request. + * + * @return True if there was an explicit help request. + */ + public synchronized boolean isHelp() + { + return ( + (containsKey("help")) || + (containsKey("?") ) || + (containsKey("h") ) + ); + } + + //------------------------------------------- + /** indicates if the gioven command line was empty. + * + * @return True if there was an empty command line. + */ + public synchronized boolean isEmpty() + { + return m_bEmpty; + } + + //------------------------------------------- + /** returns the value of sProp as boolean value. + * + * @param sProp + * the name of the parameter. + * + * @return The boolean value of the requested property. + * + * @throw [NoSuchElementException] + * if the requested property does not exists. + */ + public synchronized boolean getBoolean(java.lang.String sProp) + throws java.util.NoSuchElementException + { + java.lang.String sValue = getProperty(sProp); + if (sValue == null) + throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); + return new java.lang.Boolean(sValue).booleanValue(); + } + + public synchronized boolean getBoolean(java.lang.String sProp , + boolean bDefault) + { + java.lang.String sDefault = java.lang.String.valueOf(bDefault); + java.lang.String sValue = getProperty(sProp, sDefault); + return new java.lang.Boolean(sValue).booleanValue(); + } + + //------------------------------------------- + /** returns the value of sProp as int value. + * + * @param sProp + * the name of the parameter. + * + * @return The int value of the requested property. + * + * @throw [NoSuchElementException] + * if the requested property does not exists. + */ + public synchronized int getInt(java.lang.String sProp) + throws java.util.NoSuchElementException + { + java.lang.String sValue = getProperty(sProp); + if (sValue == null) + throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); + return new java.lang.Integer(sValue).intValue(); + } + + public synchronized int getInt(java.lang.String sProp , + int nDefault) + { + java.lang.String sDefault = java.lang.String.valueOf(nDefault); + java.lang.String sValue = getProperty(sProp, sDefault); + return new java.lang.Integer(sValue).intValue(); + } + + //------------------------------------------- + /** returns the value of sProp as string value. + * + * @param sProp + * the name of the parameter. + * + * @return The string value of the requested property. + * + * @throw [NoSuchElementException] + * if the requested property does not exists. + */ + public synchronized java.lang.String getString(java.lang.String sProp) + throws java.util.NoSuchElementException + { + java.lang.String sValue = getProperty(sProp); + if (sValue == null) + throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); + return sValue; + } + + //------------------------------------------- + /** returns the value of sProp as string list value! + * + * @descr The delimiter must be well known and + * it must be clear if trailing/leading + * whitespaces must be ignored or not. + * + * @param sProp + * the name of the parameter. + * + * @param sDelim + * the delimiter, which must be used to split + * the config string value into an array. + * + * @param bTrim + * if its set to true, trailing and leading whitespace + * characters will be ommited. + * + * @param bDecode + * if its set to TRUE all liste items will be + * interpreted as "<xxx>" and converted to <xxx>! + * + * @return The string list value of the requested property. + * + * @throw [NoSuchElementException] + * if the requested property does not exists. + */ + public synchronized java.util.Vector getStringList(java.lang.String sProp , + java.lang.String sDelimiter, + boolean bTrim , + boolean bDecode ) + throws java.util.NoSuchElementException + { + java.lang.String sValue = getProperty(sProp); + if (sValue == null) + throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); + + java.util.Vector lValue = new java.util.Vector(); + try + { + java.util.StringTokenizer lTokens = new java.util.StringTokenizer(sValue, sDelimiter); + while(lTokens.hasMoreTokens()) + { + java.lang.String sToken = lTokens.nextToken(); + // remove trailing/leading whitespaces + if (bTrim) + sToken = sToken.trim(); + // remove "" + if ( + (bDecode ) && + (sToken.indexOf("\"") == 0 ) && + (sToken.lastIndexOf("\"") == sToken.length()-1) + ) + { + sToken = sToken.substring(1, sToken.length()-1); + } + lValue.add(sToken); + } + } + catch(java.lang.Throwable ex) + { lValue.clear(); } + + return lValue; + } +} diff --git a/transex3/source/filter/utils/FileHelper.java b/transex3/source/filter/utils/FileHelper.java new file mode 100644 index 000000000000..71f51cf36bf6 --- /dev/null +++ b/transex3/source/filter/utils/FileHelper.java @@ -0,0 +1,766 @@ +/************************************************************************* + * + * 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: FileHelper.java,v $ + * $Revision: 1.13 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.filter.config.tools.utils; + +// __________ Imports __________ + +import java.io.*; +import java.lang.*; +import java.net.*; +import java.util.*; + +// __________ Implementation __________ + +/** + * It collects some static helper functons to handle file system specific problems. + * Sometimes it's neccessary to convert URL from/to system pathes; + * or from string notation to structural versions (e.g. com.sun.star.util.URL). + * And sometimes java had another notation then the office it has. + * Further it provides functionality to work easiear with the java.io.File class of java. + * + * + */ +public class FileHelper +{ + // ____________________ + + /** + * Because the office need URLs for loading/saving documents + * we must convert used system pathes. + * And java use another notation for file URLs ... correct it. + * + * @param aSystemPath + * represent the file in system notation + * + * @return [String] + * a file url which represent the given system path + */ + public static java.lang.String getFileURLFromSystemPath(java.io.File aSystemPath) + { + System.out.println("TODO: must be adapted to java 1.3 :-("); + System.exit(-1); +/*TODO_JAVA + try + { + sFileURL = aSystemPath.toURI().toURL().toString(); + } + catch( MalformedURLException exWrong ) + { + sFileURL = null; + } +*/ + java.lang.String sFileURL = null; + + // problem of java: file URL's are coded with 1 slash instead of 2 or 3 ones! + // => correct this problem first, otherwise office can't use these URL's + if( + (sFileURL != null ) && + (sFileURL.startsWith("file:/") == true ) && + (sFileURL.startsWith("file://") == false) + ) + { + java.lang.StringBuffer sWorkBuffer = new java.lang.StringBuffer(sFileURL); + sWorkBuffer.insert(6,"//"); + sFileURL = sWorkBuffer.toString(); + } + + return sFileURL; + } + + // ____________________ + + /** + * The same as getFileURLFromSystemPath() before but uses string parameter instead + * of a java.io.File type. It exist to supress converting of neccessary parameters in the + * outside code. But of course getFileURLFromSystemPath(File) will be a little bit faster + * then this method ... + * + * @param sSystemPath + * represent the file in system notation + * + * @return [String] + * a file url which represent the given system path + */ + public static java.lang.String getFileURLFromSystemPath(java.lang.String sSystemPath) + { + return getFileURLFromSystemPath(new java.io.File(sSystemPath)); + } + + // ____________________ + + /** + * Does the same as getFileURLFromSystemPath() before ... but uses + * the given protocol string (e.g."http://") insted of "file:///". + * + * @param aSystemPath + * represent the file in system notation + * + * @param aBasePath + * define the base path of the aSystemPath value, + * which must be replaced with the value of "sServerPath". + * + * @param sServerURL + * Will be used to replace sBasePath. + * + * @example + * System Path = "d:\test\file.txt" + * Base Path = "d:\test" + * Server Path = "http://alaska:8000" + * => "http://alaska:8000/file.txt" + * + * @return [String] + * an url which represent the given system path + * and uses the given protocol + */ + public static java.lang.String getURLWithProtocolFromSystemPath(java.io.File aSystemPath, + java.io.File aBasePath , + java.lang.String sServerURL ) + { + System.out.println("TODO: must be adapted to java 1.3 :-("); + System.exit(-1); + + java.lang.String sFileURL = FileHelper.getFileURLFromSystemPath(aSystemPath); + java.lang.String sBaseURL = FileHelper.getFileURLFromSystemPath(aBasePath ); + + // cut last '/'! + if (sBaseURL.lastIndexOf('/')==(sBaseURL.length()-1)) + sBaseURL = sBaseURL.substring(0,sBaseURL.length()-1); + + // cut last '/'! + if (sServerURL.lastIndexOf('/')==(sServerURL.length()-1)) + sServerURL = sServerURL.substring(0,sServerURL.length()-1); + +//TODO_JAVA java.lang.String sURL = sFileURL.replaceFirst(sBaseURL,sServerURL); + java.lang.String sURL = null; + return sURL; + } + + // ____________________ + + /** + * The same as getURLWithProtocolFromSystemPath() before but uses string parameter instead + * of a java.io.File types. It exist to supress converting of neccessary parameters in the + * outside code. But of course getURLWithProtocolFromSystemPath(File,File,String) will be + * a little bit faster then this method ... + * + * @param sSystemPath + * represent the file in system notation + * + * @param sBasePath + * define the base path of the aSystemPath value, + * which must be replaced with the value of "sServerPath". + * + * @param sServerPath + * Will be used to replace sBasePath. + * + * @example + * System Path = "d:\test\file.txt" + * Base Path = "d:\test" + * Server Path = "http://alaska:8000" + * => "http://alaska:8000/file.txt" + * + * @return [String] + * an url which represent the given system path + * and uses the given protocol + */ + public static java.lang.String getURLWithProtocolFromSystemPath(java.lang.String sSystemPath, + java.lang.String sBasePath , + java.lang.String sServerPath) + { + return getURLWithProtocolFromSystemPath(new java.io.File(sSystemPath), new java.io.File(sBasePath), sServerPath); + } + + //_________________________________ + + /** + * Return a list of all available files of a directory. + * We filter sub directories. All other files + * are returned. So they can be used for further purposes. + * One parameter define the start directory, + * another one enable/disable recursive search into sub directories. + * + * @param aRoot + * the start directory, which should be analyzed. + * + * @param bRecursive + * enable/disable search in sub directories. + * + * @return [Vector] + * a filtered list of java java.io.File objects of all available files + * of the start dir (and may of its sub directories). + */ + public static java.util.Vector getSystemFilesFromDir(java.io.File aRoot , + boolean bRecursive) + { + java.io.File[] lAllFiles = aRoot.listFiles(); + if (lAllFiles == null) + return null; + + int c = lAllFiles.length; + java.util.Vector lFilteredFiles = new java.util.Vector(c); + for (int i=0; i<c; ++i) + { + // simple files! + if (lAllFiles[i].isFile()) + lFilteredFiles.add(lAllFiles[i]); + else + // recursion? + if (bRecursive && lAllFiles[i].isDirectory()) + { + java.util.Vector lSubFiles = FileHelper.getSystemFilesFromDir(lAllFiles[i],bRecursive); + if (lSubFiles != null) + { + java.util.Enumeration aSnapshot = lSubFiles.elements(); + while (aSnapshot.hasMoreElements()) + lFilteredFiles.add(aSnapshot.nextElement()); + } + } + } + + return lFilteredFiles; + } + + //_________________________________ + /** it converts the given name (e.g. an internal type name) to + * an usable system file name. + * + * Do so some special characters (e.g. "/") must be replaced with other ones. + * + * @param sName + * the name, which should be analyzed and converted. + * + * @return A valid system file name, which should be similar to the + * given name, but does not contain special characters any longer. + */ + public static java.lang.String convertName2FileName(String sName) + { + int i = 0; + int nLength = sName.length(); + char[] lBuffer = sName.toCharArray(); + + java.lang.StringBuffer sNewName = new java.lang.StringBuffer(nLength); + for (i=0; i<nLength; ++i) + { + char c = lBuffer[i]; + if ( + c>=48 && c<=57 // 0-9 + && + c>=97 && c<=122 // a-z + && + c>=65 && c<=90 // A-Z + ) + { + sNewName.append(c); + } + else + { + sNewName.append("_"); + } + } + + return sNewName.toString(); + } + + //___________________________________________ + + /** it removes all child nodes of a file system directory. + * + * @param aDirectory + * points to the directory, which should be made empty. + * + * @param bFilesOnly + * force deletion of files only. If its set to TRUE, + * no subdirectory will be removed. + * + * @throw [java.io.IOException] + * if some of the child nodes couldn't be removed. + */ + public static void makeDirectoryEmpty(java.io.File aDirectory, + boolean bFilesOnly) + throws java.io.IOException + { + if (!aDirectory.isDirectory()) + throw new java.io.FileNotFoundException("\""+aDirectory.toString()+"\" is not a directory."); + + java.io.File[] lChilds = aDirectory.listFiles(); + for (int f=0; f<lChilds.length; ++f) + { + if (lChilds[f].isDirectory()) + { + FileHelper.makeDirectoryEmpty(lChilds[f], bFilesOnly); + if (!bFilesOnly) + { + if (!lChilds[f].delete()) + throw new java.io.IOException("\""+lChilds[f].toString()+"\" could not be deleted."); + } + } + else + { + if (!lChilds[f].delete()) + throw new java.io.IOException("\""+lChilds[f].toString()+"\" could not be deleted."); + } + } + } + + //___________________________________________ + + /** it try to generate a new file with a unique ID + * inside given directory. + * + * Call this method with a directory and a base name for + * a file. It will be used to generate a new files inside + * the directory. Existing files will be checked and new file + * name will be tested till a non existing file name would be found. + * + * @param aBaseDir + * must be a system path + * e.g.: "c:\temp" + * + * @param sBaseName + * must be a system file name without extensions. + * e.g.: "myfile_" + * + * @param sExtension + * the whished extension. + * e.g.: "dat" + * + * @return A valid file object, if an unique file could be created - + * Null otherwhise. + * e.g.: "c:\temp\myfile_1.dat" + */ + public static java.io.File createUniqueFile(java.io.File aBaseDir , + java.lang.String sBaseName , + java.lang.String sExtension) + { + java.io.File aBaseFile = new java.io.File(aBaseDir, sBaseName); + java.io.File aFile = null; + long nr = 0; + while (aFile == null && nr < java.lang.Long.MAX_VALUE) + { + java.lang.String sFileName = aBaseFile.getPath() + java.lang.String.valueOf(nr) + "." + sExtension; + aFile = new java.io.File(sFileName); + if (aFile.exists()) + aFile=null; + ++nr; + } + return aFile; + } + + //___________________________________________ + + /** reads the complete file, using the right encoding, + * into the given string buffer. + * + * @param aFile + * must point to a system file, which must exist. + * e.g.: "c:\temp\test.txt" + * "/tmp/test.txt" + * + * @param sEncoding + * will be used to encode the string content + * inside the file. + * e.g.: "UTF8" + * + * @param sBuffer + * used to return the file content. + * + * @throw [IOException] + * - if the file couldnt be opened + * - if the file does not use the right encoding + */ + public static void readEncodedBufferFromFile(java.io.File aFile , + java.lang.String sEncoding, + java.lang.StringBuffer sBuffer ) + throws java.io.IOException + { + if (sEncoding.equals("UTF-8Special")) + { + FileHelper.readAndCheckUTF8File(aFile,sBuffer); + return; + } + + java.io.FileInputStream aByteStream = new java.io.FileInputStream(aFile.getAbsolutePath()); + java.io.InputStreamReader aEncodedReader = new java.io.InputStreamReader(aByteStream, sEncoding); + char[] aEncodedBuffer = new char[4096]; + int nReadCount = 0; + + while((nReadCount=aEncodedReader.read(aEncodedBuffer))>0) + sBuffer.append(aEncodedBuffer, 0, nReadCount); + + aEncodedReader.close(); + } + + //___________________________________________ + private static void logEncodingData(java.lang.StringBuffer sLog , + int nUTF8 , + int nByteOrg1 , + int nByteOrg2 , + int nByteOrg3 , + int nByteOrg4 , + int nByte1 , + int nByte2 , + int nByte3 , + int nByte4 , + int nEncodingType) + { + sLog.append("["+nEncodingType+"]\t"); + sLog.append((int)nUTF8+"\t="); + sLog.append("\t"+nByteOrg1+"/"+nByte1); + sLog.append("\t"+nByteOrg2+"/"+nByte2); + sLog.append("\t"+nByteOrg3+"/"+nByte3); + sLog.append("\t"+nByteOrg4+"/"+nByte4); + sLog.append("\n"); + } + + //___________________________________________ + private static char impl_convertBytesToChar(int nByte1, int nByte2, int nByte3, int nByte4) + { + return (char)((nByte1*0x40000)+(nByte2*0x1000)+(nByte3*0x40)+nByte4); + } + + //___________________________________________ + private static int impl_readAndCheckNextByte(byte[] aBuffer , + int nBufPos , + int nBufLength , + int nMinRange , + int nMaxRange ) + throws java.lang.Exception + { + if (nBufPos>=nBufLength) + throw new java.lang.Exception("impl_readAndCheckNextByte()\nEnd of buffer reached."); + + int nByte = aBuffer[nBufPos] & 0xFF; + if ( + (nByte < nMinRange) || + (nByte > nMaxRange) + ) + { + throw new java.lang.Exception("impl_readAndCheckNextByte()\nByte does not fit the specified range."); + } + + return nByte; + } + + //___________________________________________ + public static void readAndCheckUTF8File(java.io.File aFile , + java.lang.StringBuffer sBuffer) + throws java.io.IOException + { + java.io.FileInputStream aByteStream = new java.io.FileInputStream(aFile.getAbsolutePath()); + byte[] aBuffer = new byte[4096]; + int nReadCount = 0; + int nByteOrg_1 = 0; + int nByteOrg_2 = 0; + int nByteOrg_3 = 0; + int nByteOrg_4 = 0; + int nByte_1 = 0; + int nByte_2 = 0; + int nByte_3 = 0; + int nByte_4 = 0; + char nUTF8 = 0; + int i = 0; + int nEncodingType = 0; + java.lang.StringBuffer sLog = new java.lang.StringBuffer(); + + try + { + + while((nReadCount=aByteStream.read(aBuffer))>0) + { + i=0; + while (i<nReadCount) + { + nByteOrg_1 = 0; + nByteOrg_2 = 0; + nByteOrg_3 = 0; + nByteOrg_4 = 0; + nByte_1 = 0; + nByte_2 = 0; + nByte_3 = 0; + nByte_4 = 0; + nUTF8 = 0; + nEncodingType = 0; + + nByteOrg_1 = aBuffer[i++] & 0xFF; + nByte_1 = nByteOrg_1; + /* + Table 3-6. Well-Formed UTF-8 Byte Sequences + + ============================================================================ + Nr. Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte + ============================================================================ + 01 U+ 0..U+ 7F 00..7F + 02 U+ 80..U+ 7FF C2..DF 80..BF + 03 U+ 800..U+ FFF E0 A0..BF 80..BF + 04 U+ 1000..U+ CFFF E1..EC 80..BF 80..BF + 05 U+ D000..U+ D7FF ED 80..9F 80..BF + 06 U+ E000..U+ FFFF EE..EF 80..BF 80..BF + 07 U+ 10000..U+ 3FFFF F0 90..BF 80..BF 80..BF + 08 U+ 40000..U+ FFFFF F1..F3 80..BF 80..BF 80..BF + 09 U+100000..U+10FFFF F4 80..8F 80..BF 80..BF + */ + // ------------------------------------------------------------ + // 01 + // 1 byte: 0xxxxxxx + // ------------------------------------------------------------ + if ( + (nByteOrg_1 >= 0x00) && + (nByteOrg_1 <= 0x7F) + ) + { + nEncodingType = 1; + nUTF8 = (char)nByte_1; + } + // ------------------------------------------------------------ + // 02 + // 1 byte: 110xxxxx + // 2 byte: 101xxxxx + // ------------------------------------------------------------ + else + if ( + (nByteOrg_1 >= 0xC2) && + (nByteOrg_1 <= 0xDF) + ) + { + nEncodingType = 2; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_1 = nByteOrg_1-0xC2; + nByte_2 = nByteOrg_2-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0,0,nByte_1, nByte_2); + } + // ------------------------------------------------------------ + // 03 + // 1 byte: 11100000 + // 2 byte: 101xxxxx + // 3 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if (nByteOrg_1 == 0xE0) + { + nEncodingType = 3; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0xA0, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_2 = nByteOrg_2-0xA0; + nByte_3 = nByteOrg_3-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0,0,nByte_2, nByte_3); + } + // ------------------------------------------------------------ + // 04 + // 1 byte: 111xxxxx + // 2 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if ( + (nByteOrg_1 >= 0xE1) && + (nByteOrg_1 <= 0xEC) + ) + { + nEncodingType = 4; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_1 = nByteOrg_1-0xE1; + nByte_2 = nByteOrg_2-0x80; + nByte_3 = nByteOrg_3-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0,nByte_1, nByte_2, nByte_3); + } + // ------------------------------------------------------------ + // 05 + // 1 byte: 11101101 + // 2 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if (nByteOrg_1 == 0xED) + { + nEncodingType = 5; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0x9F); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_2 = nByteOrg_2-0x80; + nByte_3 = nByteOrg_3-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0,0, nByte_2, nByte_3); + } + // ------------------------------------------------------------ + // 06 + // 1 byte: 1110111x + // 2 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if ( + (nByteOrg_1 >= 0xEE) && + (nByteOrg_1 <= 0xEF) + ) + { + nEncodingType = 6; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_1 = nByteOrg_1-0xEE; + nByte_2 = nByteOrg_2-0x80; + nByte_3 = nByteOrg_3-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0,nByte_1, nByte_2, nByte_3); + } + // ------------------------------------------------------------ + // 07 + // 1 byte: 11110000 + // 2 byte: 1001xxxx + // 3 byte: 10xxxxxx + // 4 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if (nByteOrg_1 == 0xF0) + { + nEncodingType = 7; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x90, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_2 = nByteOrg_2-0x90; + nByte_3 = nByteOrg_3-0x80; + nByte_4 = nByteOrg_4-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0, nByte_2, nByte_3, nByte_4); + } + // ------------------------------------------------------------ + // 08 + // 1 byte: 111100xx + // 2 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if ( + (nByteOrg_1 >= 0xF1) && + (nByteOrg_1 <= 0xF3) + ) + { + nEncodingType = 8; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_1 = nByteOrg_1-0xF1; + nByte_2 = nByteOrg_2-0x80; + nByte_3 = nByteOrg_3-0x80; + nByte_4 = nByteOrg_4-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(nByte_1, nByte_2, nByte_3, nByte_4); + } + // ------------------------------------------------------------ + // 09 + // 1 byte: 11110100 + // 2 byte: 10xxxxxx + // 3 byte: 10xxxxxx + // 4 byte: 10xxxxxx + // ------------------------------------------------------------ + else + if (nByteOrg_1 == 0xF0) + { + nEncodingType = 9; + nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF); + nByte_2 = nByteOrg_2-0x80; + nByte_3 = nByteOrg_3-0x80; + nByte_4 = nByteOrg_4-0x80; + nUTF8 = FileHelper.impl_convertBytesToChar(0, nByte_2, nByte_3, nByte_4); + } + // wrong encoding ? + else + { + throw new java.lang.Exception("Non well formed UTF-8 encoding."); + } + + sBuffer.append(nUTF8); + // -> DEBUG ! + FileHelper.logEncodingData(sLog, nUTF8, nByteOrg_1, nByteOrg_2, nByteOrg_3, nByteOrg_4, nByte_1, nByte_2, nByte_3, nByte_4, nEncodingType); + // <- DEBUG ! + } + } + + } + catch(java.lang.Throwable ex) + { + // -> DEBUG ! + FileHelper.logEncodingData(sLog, nUTF8, nByteOrg_1, nByteOrg_2, nByteOrg_3, nByteOrg_4, nByte_1, nByte_2, nByte_3, nByte_4, nEncodingType); + + java.io.File aDir = new java.io.File(aFile.getParent()); + java.lang.String sDump = aFile.getName(); + java.io.File aDump = FileHelper.createUniqueFile(aDir, sDump, "dump"); + FileHelper.writeEncodedBufferToFile(aDump, "UTF-8", false, sLog); + // <- DEBUG ! + + java.lang.String sMsg = "File '"+aFile.getPath()+"' is not encoded right as UTF-8."; + throw new java.io.IOException(sMsg); + } + + aByteStream.close(); + } + + //___________________________________________ + + /** writes the given string buffer into the specified file + * using the specified encoding. + * + * Further it can be set, if the file should be expanded + * or replaced by this new string buffer. + * + * @param aFile + * must point to a system file. It can already exist! + * e.g.: "c:\temp\test.txt" + * "/tmp/test.txt" + * + * @param sEncoding + * will be used to encode the string content inside the file. + * e.g.: "UTF8" + * + * @param bAppend + * specify if an already existing file will be + * expanded or replaced. + * + * @param sBuffer + * the new string content for this file. + */ + public static void writeEncodedBufferToFile(java.io.File aFile , + java.lang.String sEncoding, + boolean bAppend , + java.lang.StringBuffer sBuffer ) + throws java.io.IOException + { + java.io.FileOutputStream aByteStream = new java.io.FileOutputStream(aFile.getAbsolutePath(), bAppend); + java.io.OutputStreamWriter aEncodedWriter = new java.io.OutputStreamWriter(aByteStream, sEncoding); + + java.lang.String sTemp = sBuffer.toString(); + aEncodedWriter.write(sTemp, 0, sTemp.length()); + + aEncodedWriter.flush(); + aEncodedWriter.close(); + + if (!aFile.exists()) + throw new java.io.IOException("File \""+aFile.getAbsolutePath()+"\" not written correctly."); + } +} diff --git a/transex3/source/filter/utils/Logger.java b/transex3/source/filter/utils/Logger.java new file mode 100644 index 000000000000..7657eba5f426 --- /dev/null +++ b/transex3/source/filter/utils/Logger.java @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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: Logger.java,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.filter.config.tools.utils; + +//_______________________________________________ +// imports + +import java.lang.*; +import java.util.*; + +//_______________________________________________ +// definition + +/** can be used to print out some debug messages + * and group it into warnings/errors or info statements. + * + * + */ +public class Logger +{ + //___________________________________________ + // const + + /** only error message will be shown. */ + public static final int LEVEL_ERRORS = 1; + + /** only errors and warnings will be shown. */ + public static final int LEVEL_WARNINGS = 2; + + /** enable errors/warnings and some global info + * message. */ + public static final int LEVEL_GLOBALINFOS = 3; + + /** enable anything! */ + public static final int LEVEL_DETAILEDINFOS = 4; + + //___________________________________________ + // member + + /** enable/disable different output level. + * e.g. warnings/errors/infos */ + private int m_nLevel; + + //___________________________________________ + // ctor + + /** initialize new debug object with the specified + * debug level. + * + * @param nLevel + * the new debug level. + * See const values LEVEL_xxx too. + */ + public Logger(int nLevel) + { + m_nLevel = nLevel; + } + + //___________________________________________ + // interface + + /** initialize new debug object with a default + * debug level. + */ + public Logger() + { + m_nLevel = LEVEL_DETAILEDINFOS; + } + + //___________________________________________ + // interface + + /** prints out an exception ... if the right level is set. + * + * @param ex + * the exception object + */ + public synchronized void setException(java.lang.Throwable ex) + { + if (m_nLevel >= LEVEL_ERRORS) + { + System.err.println("Exception:\n"); + ex.printStackTrace(); + } + } + + //___________________________________________ + // interface + + /** prints out an error ... if the right level is set. + * + * @param sError + * the error message. + */ + public synchronized void setError(java.lang.String sError) + { + if (m_nLevel >= LEVEL_ERRORS) + System.err.println("Error :\t\""+sError+"\""); + } + + //___________________________________________ + // interface + + /** prints out a warning ... if the right level is set. + * + * @param sWarning + * the warning message. + */ + public synchronized void setWarning(java.lang.String sWarning) + { + if (m_nLevel >= LEVEL_WARNINGS) + System.err.println("Warning :\t\""+sWarning+"\""); + } + + //___________________________________________ + // interface + + /** prints out a global info message ... if the right level is set. + * + * Global infos should be used to describe a complex operation. + * E.g.: loading of a document. + * But not for every sub operation like e.g. analyzing lines + * during loading the document! + * + * @param sInfo + * the info message. + */ + public synchronized void setGlobalInfo(java.lang.String sInfo) + { + if (m_nLevel >= LEVEL_GLOBALINFOS) + System.out.println("Info :\t\""+sInfo+"\""); + } + + //___________________________________________ + // interface + + /** prints out a mode detailed info message ... if the right level is set. + * + * Such detailed message are e.g. "analyze line [n] of file ...". + * + * @param sInfo + * the info message. + */ + public synchronized void setDetailedInfo(java.lang.String sInfo) + { + if (m_nLevel >= LEVEL_DETAILEDINFOS) + System.out.println("Detail :\t\""+sInfo+"\""); + } +} diff --git a/svtools/source/misc1/loginerr.cxx b/transex3/source/filter/utils/MalformedCommandLineException.java index b9802a8be535..e073dcb9adcc 100644 --- a/svtools/source/misc1/loginerr.cxx +++ b/transex3/source/filter/utils/MalformedCommandLineException.java @@ -1,4 +1,4 @@ -/************************************************************************* +/*_*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: loginerr.cxx,v $ - * $Revision: 1.6 $ + * $RCSfile: MalformedCommandLineException.java,v $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -26,20 +26,25 @@ * <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" -#ifndef GCC -#endif +package com.sun.star.filter.config.tools.utils; -#include <svtools/loginerr.hxx> +//_______________________________________________ +// imports -//============================================================================ -// -// CntLoginErrorHint Implementation. -// -//============================================================================ +import java.lang.*; -TYPEINIT1( CntLoginErrorHint, SfxHint ); +//___________________________________________ +// types +/** indicates a malformed command line. + * + * E.g. it must be thrown if the command line contains one item more then once, + * or use unsupported format. + */ +public class MalformedCommandLineException extends java.lang.Exception +{ + public MalformedCommandLineException() {} + public MalformedCommandLineException(java.lang.String sMsg) { super(sMsg); } +} diff --git a/transex3/source/filter/utils/XMLHelper.java b/transex3/source/filter/utils/XMLHelper.java new file mode 100644 index 000000000000..0f912cac8e25 --- /dev/null +++ b/transex3/source/filter/utils/XMLHelper.java @@ -0,0 +1,825 @@ +/************************************************************************* + * + * 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: XMLHelper.java,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.filter.config.tools.utils; + +//_______________________________________________ + +import java.lang.*; +import java.util.*; +import java.io.*; + +//_______________________________________________ + +/** + * It provides some constant values and some static helper routines + * which are neccessary to work with a xml file - especialy + * the filter configuration. + * + * + */ +public class XMLHelper +{ + //___________________________________________ + // public const + + /** its a possible value of the xml attribute "oor:type" and identify an integer type. */ + public static final java.lang.String XMLTYPE_INTEGER = "xs:int"; + + /** its a possible value of the xml attribute "oor:type" and identify an boolean type. */ + public static final java.lang.String XMLTYPE_BOOLEAN = "xs:boolean"; + + /** its a possible value of the xml attribute "oor:type" and identify an string type. */ + public static final java.lang.String XMLTYPE_STRING = "xs:string"; + + /** its a possible value of the xml attribute "oor:type" and identify an string list type. */ + public static final java.lang.String XMLTYPE_STRINGLIST = "oor:string-list"; + + /** its a xml attribute, which specify a property name. */ + public static final java.lang.String XMLATTRIB_OOR_NAME = "oor:name"; + + /** its a xml attribute, which specify a property type. */ + public static final java.lang.String XMLATTRIB_OOR_TYPE = "oor:type"; + + /** its a xml attribute, which specify a list separator. */ + public static final java.lang.String XMLATTRIB_OOR_SEPARATOR = "oor:separator"; + + /** its a xml attribute, which specify a localized value. */ + public static final java.lang.String XMLATTRIB_OOR_LOCALIZED = "oor:localized"; + + /** its a xml attribute, which specify a merge operation for cfg layering. */ + public static final java.lang.String XMLATTRIB_OOR_OP = "oor:op"; + + /** can be used as value for XMLATTRIB_OOR_OP. */ + public static final java.lang.String XMLATTRIB_OP_REPLACE = "replace"; + + /** its a xml attribute, which specify a locale value. */ + public static final java.lang.String XMLATTRIB_XML_LANG = "xml:lang"; + + /** its the tag name of a <value ...> entry. */ + public static final java.lang.String XMLTAG_VALUE = "value"; + + /** its the tag name of a <prop ...> entry. */ + public static final java.lang.String XMLTAG_PROP = "prop"; + + /** its the tag name of a <node ...> entry. */ + public static final java.lang.String XMLTAG_NODE = "node"; + + //___________________________________________ + // private const + + /** a static list of all possible separators, which can be used for configuration type string-list. */ + private static final java.lang.String[] DELIMS = {" ", ",", ";", ".", ":", "-", "_", "#", "'", "+", "*", "~", "=", "?"}; + + /** index of the default separator inside list DELIMS. + * Its neccessary to know such default separator; because it can + * be supressed as xml attribute of the corresponding value tag. */ + private static final int DEFAULT_SEPARATOR = 0; + + //___________________________________________ + + /** analyze the structures of the given XML node and + * return a property set of all found sub nodes. + * + * Such properties are organized as [name, value] pairs. + * The type of a xml node will be detected automaticly. + * Following types are supported: + * xs:int => java.lang.Integer + * xs:bool => java.lang.Boolean + * xs:string => java.lang.String + * oor:string-list => java.util.LinkedList[java.lang.String] + * oor:set => java.util.Vector[java.lang.Object] + * oor:localized => java.util.HashMap[java.lang.Object] + * + * @param aNode + * points directly to the xml node, where we should analyze + * the children nodes. + * + * @return [java.util.HashMap] + * contains every node name as key and its string(!) as value. + */ + public static java.util.HashMap convertNodeToPropSet(org.w3c.dom.Node aNode) + throws java.lang.Exception + { + java.util.HashMap aPropSet = new java.util.HashMap(); + + // get all child nodes, which seems to be properties + java.util.Vector lChildNodes = XMLHelper.extractChildNodesByTagName(aNode, XMLTAG_PROP); + java.util.Enumeration en1 = lChildNodes.elements(); + while(en1.hasMoreElements()) + { + org.w3c.dom.Node aChildNode = (org.w3c.dom.Node)en1.nextElement(); + + // read its name + java.lang.String sChildName = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_NAME); + if (sChildName == null) + throw new java.io.IOException("unsupported format: could not extract child node name"); + + // read its type info + java.lang.String sChildType = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_TYPE); + if (sChildType == null) + { + /** Special patch: + * If an xml tag has no type information set ... we can restore it + * by analyzing the already readed tag name :-) + * Not very nice - but it can help to read stripped xml files too. */ + sChildType = XMLHelper.getTypeForTag(sChildName); + if (sChildType == null) + throw new java.io.IOException("unsupported format: could not extract child node type"); + } + + // read its value(s?) + java.util.Vector lChildValues = XMLHelper.extractChildNodesByTagName(aChildNode, XMLTAG_VALUE); + java.util.Enumeration en2 = lChildValues.elements(); + int nValue = 0; + java.lang.Object aValue = null; + while(en2.hasMoreElements()) + { + org.w3c.dom.Node aValueNode = (org.w3c.dom.Node)en2.nextElement(); + java.lang.String sChildLocale = XMLHelper.extractNodeAttribByName(aValueNode, XMLATTRIB_XML_LANG); + boolean bLocalized = (sChildLocale != null); + + ++nValue; + + if (sChildType.equals(XMLTYPE_INTEGER)) + { + if (!bLocalized && nValue > 1) + throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected"); + java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData(); + aValue = new java.lang.Integer(sData); + } + else + if (sChildType.equals(XMLTYPE_BOOLEAN)) + { + if (!bLocalized && nValue > 1) + throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected"); + java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData(); + aValue = new java.lang.Boolean(sData); + } + else + if (sChildType.equals(XMLTYPE_STRING)) + { + if (!bLocalized && nValue > 1) + throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected"); + + java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData(); + + java.util.HashMap lLocalized = null; + if (bLocalized) + { + if (aValue == null) + aValue = new java.util.HashMap(); + lLocalized = (java.util.HashMap)aValue; + lLocalized.put(sChildLocale, sData); + } + else + aValue = sData; + } + else + if (sChildType.equals(XMLTYPE_STRINGLIST)) + { + if (!bLocalized && nValue > 1) + throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected"); + + java.lang.String sSeparator = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_SEPARATOR); + if (sSeparator == null) + sSeparator = " "; + + java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData(); + sData = sData.replace('\t', ' '); + sData = sData.replace('\n', ' '); + java.util.StringTokenizer aTokenizer = new java.util.StringTokenizer(sData, sSeparator); + java.util.Vector lList = new java.util.Vector(); + while(aTokenizer.hasMoreTokens()) + { + java.lang.String sToken = (java.lang.String)aTokenizer.nextToken(); + sToken.trim(); + if (sToken.length() < 1) + continue; + lList.add(sToken); + } + aValue = lList; + } + + aPropSet.put(sChildName, aValue); + } + } + + return aPropSet; + } + + //___________________________________________ + + private static java.lang.String getTypeForTag(java.lang.String sTag) + { + java.lang.String sType = null; + + if ( + (sTag.equals(Cache.PROPNAME_DATA )) || + (sTag.equals(Cache.PROPNAME_NAME )) || + (sTag.equals(Cache.PROPNAME_UINAME )) || + (sTag.equals(Cache.PROPNAME_MEDIATYPE )) || + (sTag.equals(Cache.PROPNAME_CLIPBOARDFORMAT )) || + (sTag.equals(Cache.PROPNAME_PREFERREDFILTER )) || + (sTag.equals(Cache.PROPNAME_DETECTSERVICE )) || + (sTag.equals(Cache.PROPNAME_FRAMELOADER )) || + (sTag.equals(Cache.PROPNAME_CONTENTHANDLER )) || + (sTag.equals(Cache.PROPNAME_DOCUMENTSERVICE )) || + (sTag.equals(Cache.PROPNAME_FILTERSERVICE )) || + (sTag.equals(Cache.PROPNAME_TEMPLATENAME )) || + (sTag.equals(Cache.PROPNAME_TYPE )) || + (sTag.equals(Cache.PROPNAME_UICOMPONENT )) + ) + sType = XMLTYPE_STRING; + else + if ( + (sTag.equals(Cache.PROPNAME_PREFERRED )) || + (sTag.equals("Installed" )) + ) + sType = XMLTYPE_BOOLEAN; + else + if ( + (sTag.equals(Cache.PROPNAME_UIORDER )) || + (sTag.equals(Cache.PROPNAME_DOCUMENTICONID )) || + (sTag.equals(Cache.PROPNAME_FILEFORMATVERSION)) + ) + sType = XMLTYPE_INTEGER; + else + if ( + (sTag.equals(Cache.PROPNAME_URLPATTERN )) || + (sTag.equals(Cache.PROPNAME_EXTENSIONS )) || + (sTag.equals(Cache.PROPNAME_USERDATA )) || + (sTag.equals(Cache.PROPNAME_FLAGS )) || + (sTag.equals(Cache.PROPNAME_TYPES )) + ) + sType = XMLTYPE_STRINGLIST; + + if (sType == null) + System.err.println("getTypeForTag("+sTag+") = "+sType); + + return sType; + } + + //___________________________________________ + + /** return a xml representation of the given property set. + * + * @param aPropSet + * a set of <name,value> pairs, which should be translated to xml + * + * @return [java.lang.String] + * the xml string representation. + * + * @throws [java.lang.Exception] + * if anything during convertion fill fail. + */ + public static java.lang.String convertPropSetToXML(java.util.HashMap aPropSet , + int nPrettyTabs) + throws java.lang.Exception + { + java.lang.StringBuffer sXML = new java.lang.StringBuffer(256); + + java.util.Iterator it1 = aPropSet.keySet().iterator(); + while(it1.hasNext()) + { + java.lang.String sProp = (java.lang.String)it1.next(); + java.lang.Object aVal = aPropSet.get(sProp); + + sProp = encodeHTMLSigns(sProp); + + // is it a simple type? + if ( + (aVal instanceof java.lang.Integer) || + (aVal instanceof java.lang.Boolean) || + (aVal instanceof java.lang.String ) + ) + { + sXML.append(XMLHelper.convertSimpleObjectToXML(sProp, aVal, nPrettyTabs)); + continue; + } + + // no! + // is it a list value? + if (aVal instanceof java.util.Vector) + { + java.util.Vector lVal = (java.util.Vector)aVal; + sXML.append(XMLHelper.convertListToXML(sProp, lVal, nPrettyTabs)); + continue; + } + + // its a localized value? + if (aVal instanceof java.util.HashMap) + { + java.util.HashMap lVal = (java.util.HashMap)aVal; + sXML.append(XMLHelper.convertLocalizedValueToXML(sProp, lVal, nPrettyTabs)); + continue; + } + + // unknown type! + java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256); + sMsg.append("unsupported object type detected."); + sMsg.append("\ttype ? : \""+sProp+"\" = "+aVal); + sMsg.append("\tprop set: \""+aPropSet ); + throw new java.lang.Exception(sMsg.toString()); + } + + return sXML.toString(); + } + + public static java.lang.String encodeHTMLSigns(java.lang.String sValue) + { + java.lang.StringBuffer sSource = new java.lang.StringBuffer(sValue); + java.lang.StringBuffer sDestination = new java.lang.StringBuffer(1000 ); + + for (int i=0; i<sSource.length(); ++i) + { + char c = sSource.charAt(i); + if (c == '&') + sDestination.append("&"); + else + sDestination.append(c); + } + + java.lang.String sReturn = sDestination.toString(); + if (!sReturn.equals(sValue)) + System.out.println("encode \""+sValue+"\" => \""+sReturn+"\""); + + return sReturn; + } + + //___________________________________________ + + /** return a xml representation of an atomic property. + * + * Atomic property types are e.g. Integer, Boolean, String. + * + * @param sName + * the name of the property. + + * @param aValue + * the value of the property. + * + * @param nPrettyTabs + * count of tab signs for pretty format the xml code :-) + * + * @return [java.lang.String] + * the xml string representation. + * + * @throws [java.lang.Exception] + * if anything during convertion fill fail. + */ + private static java.lang.String convertSimpleObjectToXML(java.lang.String sName , + java.lang.Object aValue , + int nPrettyTabs) + throws java.lang.Exception + { + java.lang.StringBuffer sXML = new java.lang.StringBuffer(256); + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + + if (aValue instanceof java.lang.Integer) + { + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">"); + sXML.append("<value>"+aValue.toString()+"</value>"); + sXML.append("</prop>\n"); + } + else + if (aValue instanceof java.lang.Boolean) + { + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">"); + sXML.append("<value>"+aValue.toString()+"</value>"); + sXML.append("</prop>\n"); + } + else + if (aValue instanceof java.lang.String) + { + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\""); + java.lang.String sValue = (java.lang.String)aValue; + + sValue = encodeHTMLSigns(sValue); + + if (sValue.length() < 1) + sXML.append("/>\n"); + else + { + sXML.append("><value>"+sValue+"</value>"); + sXML.append("</prop>\n"); + } + } + else + { + System.err.println("name = "+sName); + System.err.println("value = "+aValue); + // ! can be used outside to detect - that it was not a simple type :-) + throw new java.lang.Exception("not an atomic type."); + } + + return sXML.toString(); + } + + //___________________________________________ + + /** return a xml representation of a string-list property. + * + * @param sName + * the name of the property. + + * @param aValue + * the value of the property. + * + * @param nPrettyTabs + * count of tab signs for pretty format the xml code :-) + * + * @return [java.lang.String] + * the xml string representation. + * + * @throws [java.lang.Exception] + * if anything during convertion fill fail. + */ + private static java.lang.String convertListToXML(java.lang.String sName , + java.util.Vector aValue , + int nPrettyTabs) + throws java.lang.Exception + { + java.lang.StringBuffer sXML = new java.lang.StringBuffer(256); + + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + + int c = aValue.size(); + if (c < 1) + { + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\"/>\n"); + return sXML.toString(); + } + + // step over all list items and add it to a string buffer + // Every item will be separated by a default separator "\n" first. + // Because "\n" is not a valid separator at all and can`t occure inside + // our list items. During we step over all items, we check if our current separator + // (we use a list of possible ones!) clash with an item. + // If it clash - we step to the next possible separator. + // If our list of possible separator values runs out of range we throw + // an exception :-) Its better then generating of wrong values + // If we found a valid seperator - we use it to replace our "\n" place holder + // at the end of the following loop ... + + int d = 0; + java.lang.StringBuffer sValBuff = new java.lang.StringBuffer(256); + for (int i=0; i<c; ++i) + { + // get the next list item + java.lang.Object aItem = aValue.get(i); + if (!(aItem instanceof java.lang.String)) + throw new java.lang.Exception("Current implementation supports string-list only!"); + + java.lang.String sValue = (java.lang.String)aItem; + + sValue = encodeHTMLSigns(sValue); + + // append item with default separator, which isn a valid separator at all + // But supress adding of the separator if last element is reached. + sValBuff.append(sValue); + if (i<(c-1)) + sValBuff.append("\n"); + + // check for delim clash + // Attention: An empty (means default) element forbid using + // of a whitespace character as separator! + while(true) + { + if (d >= DELIMS.length) + throw new java.lang.Exception("No valid separator found for a string list item."); + if (sValue.length() < 1 && DELIMS[d].equals(" ")) + { + ++d; + continue; + } + if (sValue.indexOf(DELIMS[d]) != -1) + { + ++d; + continue; + } + break; + } + } + + // replace default separator with right one + System.out.println("TODO: must be adapted to java 1.3 :-("); + System.exit(-1); +//TODO_JAVA java.lang.String sListVal = sValBuff.toString().replaceAll("\n", DELIMS[d]); + java.lang.String sListVal = null; + + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">"); + if (d == DEFAULT_SEPARATOR) + sXML.append("<value>"); + else + sXML.append("<value "+XMLATTRIB_OOR_SEPARATOR+"=\""+DELIMS[d]+"\">"); + sXML.append(sListVal); + sXML.append("</value>"); + sXML.append("</prop>\n"); + + return sXML.toString(); + } + + //___________________________________________ + + /** return a xml representation of a localized property. + * + * @param sName + * the name of the property. + + * @param aValue + * the value of the property. + * + * @param nPrettyTabs + * count of tab signs for pretty format the xml code :-) + * + * @return [java.lang.String] + * the xml string representation. + * + * @throws [java.lang.Exception] + * if anything during convertion fill fail. + */ + private static java.lang.String convertLocalizedValueToXML(java.lang.String sName , + java.util.HashMap aValue , + int nPrettyTabs) + throws java.lang.Exception + { + java.lang.StringBuffer sXML = new java.lang.StringBuffer(256); + + int c = aValue.size(); + if (c < 1) + throw new java.lang.Exception("Cant detect type of localized values. Because the given list is empty."); + + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + // !Our localized values must be formated at a deeper coloum + // then its property name! + ++nPrettyTabs; + + sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">\n"); + java.util.Iterator it = aValue.keySet().iterator(); +// boolean bTypeKnown = false; + while(it.hasNext()) + { + java.lang.String sLocale = (java.lang.String)it.next(); + java.lang.Object aLocalizedValue = aValue.get(sLocale); +/* + if (!bTypeKnown) + { + bTypeKnown = true; + if (aLocalizedValue instanceof java.lang.Integer) + sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_INTEGER+"\">\n"); + else + if (aLocalizedValue instanceof java.lang.Boolean) + sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_BOOLEAN+"\">\n"); + else + if (aLocalizedValue instanceof java.lang.String) + sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_STRING+"\">\n"); + else + throw new java.lang.Exception("Unsupported type for localized value detected."); + } +*/ + java.lang.String sLocValue = aLocalizedValue.toString(); + java.lang.String sValue = encodeHTMLSigns(sLocValue); + + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + sXML.append("<value "+XMLATTRIB_XML_LANG+"=\""+sLocale+"\">"+sValue+"</value>\n"); + } + --nPrettyTabs; + for (int t=0; t<nPrettyTabs; ++t) + sXML.append("\t"); + sXML.append("</prop>\n"); + + return sXML.toString(); + } + + //___________________________________________ + + /** returns the value of an attribute of the given node. + * + * If the given node represent an lement node, may it supports some attributes. + * Then this method search for an attribute with the specified name and return it's value. + * If nothing could be found ... or the given node isn't a suitable node ... it returns null. + * + * @param aNode + * the node, which should be analyzed. + * + * @param sAttrib + * name of the attribute, which should be searched. + * + * @return The value of the specified attribute if it could be found at the given node. + * Can be null if node doesn't support attributes or the searched one does not exist there. + */ + public static java.lang.String extractNodeAttribByName(org.w3c.dom.Node aNode , + java.lang.String sAttrib) + throws java.lang.Exception + { + // We can get valid attributes for element nodes only! + if (aNode.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) + { +// System.err.println("not an element node"); + return null; + } + + // may it supports attributes in general ... but doesn't have anyone realy. + org.w3c.dom.NamedNodeMap lAttribs = aNode.getAttributes(); + if (lAttribs==null) + { +// System.err.println("no attributes at all"); + return null; + } + + // step over the attribute list and search for the requested one + for (int i=0; i<lAttribs.getLength(); ++i) + { + org.w3c.dom.Attr aAttrib = (org.w3c.dom.Attr)lAttribs.item(i); + if (aAttrib.getName().equals(sAttrib)) + { + java.lang.String sValue = aAttrib.getValue(); + return sValue; + } + } + + // the searched attribute was not found! +// System.err.println("required attribute \""+sAttrib+"\" does not exist for node ["+aNode.toString()+"]"); + return null; + } + + //___________________________________________ + + /** returns a list of childs, which are ELEMENT_NODES and have the right tag name. + * + * It analyze the list of all possible child nodes. Only ELEMENT_NODES are candidates. + * All other ones will be ignored. Further these element nodes are compared by it's tag + * names. If it match with the specified value it's added to the return list. + * So the return list includes references to the DOM tree nodes only, which are child + * element nodes with the right tag name. + * + * @param aNode + * provides access to the child nodes, which should be analyzed + * + * @param sTag + * the searched tag name. + * + * @return A list of child nodes, which are element nodes and have the right tag name. + */ + public static java.util.Vector extractChildNodesByTagName(org.w3c.dom.Node aNode, + java.lang.String sTag ) + { + // extract first all ELEMENT_NODES of he given parent + // Such nodes only provide tag names. + java.util.Vector lChilds = XMLHelper.extractChildNodesByType(aNode,org.w3c.dom.Node.ELEMENT_NODE); + java.util.Vector lExtractedChilds = new java.util.Vector(lChilds.size()); + + // step over the list and search for the right tags using the specified name + java.util.Enumeration en = lChilds.elements(); + while (en.hasMoreElements()) + { + org.w3c.dom.Node aChild = (org.w3c.dom.Node)en.nextElement(); + if (aChild.getNodeName().equals(sTag)) + lExtractedChilds.add(aChild); + } + + // pack(!) and return the list + lExtractedChilds.trimToSize(); + return lExtractedChilds; + } + + //___________________________________________ + + /** returns a list of childs, which supports the right node type. + * + * It analyze the list of all possible child nodes. If a node represent the right node type + * it is added to the return list. Otherwhise it will be ignored. + * + * @param aNode + * provides access to the list of possible children nodes. + * + * @param nType + * represent the searched node type. + * Possible values are constant fields of a org.w3c.dom.Node - e.g. org.w3c.dom.Node.ELEMENT_NODE. + * + * @return A list of child nodes, which provides the right node type. + */ + public static java.util.Vector extractChildNodesByType(org.w3c.dom.Node aNode, + short nType) + { + // get list of all possibe childs and reserve enough space for our return list + // Attention: A null pointer is not allowed for return! (means lExtractedChilds) + org.w3c.dom.NodeList lChilds = aNode.getChildNodes(); + int c = lChilds.getLength(); + java.util.Vector lExtractedChilds = new java.util.Vector(c); + + // step of these childs and select only needed ones + for (int i=0; i<c; ++i) + { + org.w3c.dom.Node aChild = lChilds.item(i); + if (aChild.getNodeType() == nType) + lExtractedChilds.add(aChild); + } + + // pack(!) and return the list + lExtractedChilds.trimToSize(); + return lExtractedChilds; + } + + //___________________________________________ + + /** generates an xml header, using parameters. + * + * @param sVersion + * number of the xml version. + * + * @param sEncoding + * used file encoding. + * + * @param sPath + * name of the configuration root. + * + * @param sPackage + * name of the configuration package. + * + * @param bLanguagepack + * force creation of a special header, + * which is needed for language packs only. + * + * @return [java.lang.String] + * the generated xml header. + +*/ + public static java.lang.String generateHeader(java.lang.String sVersion , + java.lang.String sEncoding , + java.lang.String sPath , + java.lang.String sPackage , + boolean bLanguagePack) + { + java.lang.StringBuffer sHeader = new java.lang.StringBuffer(256); + + if (bLanguagePack) + { + sHeader.append("<?xml version=\""); + sHeader.append(sVersion); + sHeader.append("\" encoding=\""); + sHeader.append(sEncoding); + sHeader.append("\"?>\n"); + sHeader.append("<oor:component-data oor:package=\""); + sHeader.append(sPath); + sHeader.append("\" oor:name=\""); + sHeader.append(sPackage); + sHeader.append("\" xmlns:install=\"http://openoffice.org/2004/installation\""); + sHeader.append(" xmlns:oor=\"http://openoffice.org/2001/registry\""); + sHeader.append(" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""); + sHeader.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"); + } + else + { + sHeader.append("<?xml version=\""); + sHeader.append(sVersion); + sHeader.append("\" encoding=\""); + sHeader.append(sEncoding); + sHeader.append("\"?>\n<!DOCTYPE oor:component-data SYSTEM \"../../../../component-update.dtd\">\n"); + sHeader.append("<oor:component-data xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" oor:package=\""); + sHeader.append(sPath); + sHeader.append("\" oor:name=\""); + sHeader.append(sPackage); + sHeader.append("\">\n"); + } + + return sHeader.toString(); + } + + public static java.lang.String generateFooter() + { + return "</oor:component-data>\n"; + } +} diff --git a/transex3/source/filter/utils/makefile.mk b/transex3/source/filter/utils/makefile.mk new file mode 100644 index 000000000000..d41d8ba9a825 --- /dev/null +++ b/transex3/source/filter/utils/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.9.98.2 $ +# +# 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 = ..$/..$/.. +TARGET = FCFGUtils +PRJNAME = filter +PACKAGE = com$/sun$/star$/filter$/config$/tools$/utils + +# --- Settings ----------------------------------------------------- + +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- + + +JAVACLASSFILES = \ + $(CLASSDIR)$/$(PACKAGE)$/AnalyzeStartupLog.class \ + $(CLASSDIR)$/$(PACKAGE)$/ConfigHelper.class \ + $(CLASSDIR)$/$(PACKAGE)$/Logger.class \ + $(CLASSDIR)$/$(PACKAGE)$/FileHelper.class \ + $(CLASSDIR)$/$(PACKAGE)$/MalformedCommandLineException.class \ + $(CLASSDIR)$/$(PACKAGE)$/Cache.class \ + $(CLASSDIR)$/$(PACKAGE)$/XMLHelper.class + +MAXLINELENGTH = 100000 + +# --- targets ----------------------------------------------------- + +.INCLUDE : target.mk diff --git a/transex3/source/help/HelpCompiler.cxx b/transex3/source/help/HelpCompiler.cxx new file mode 100644 index 000000000000..5001d0907972 --- /dev/null +++ b/transex3/source/help/HelpCompiler.cxx @@ -0,0 +1,593 @@ +/************************************************************************* + * + * 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: HelpCompiler.cxx,v $ + * $Revision: 1.9 $ + * + * 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. + * + ************************************************************************/ + + +#include "HelpCompiler.hxx" +#include <limits.h> +#include <stdlib.h> +#include <string.h> +#include <libxslt/xslt.h> +#include <libxslt/xsltInternals.h> +#include <libxslt/transform.h> +#include <libxslt/xsltutils.h> +#ifdef __MINGW32__ +#include <tools/prewin.h> +#include <tools/postwin.h> +#endif +#include <osl/thread.hxx> + +static void impl_sleep( sal_uInt32 nSec ) +{ + TimeValue aTime; + aTime.Seconds = nSec; + aTime.Nanosec = 0; + + osl::Thread::wait( aTime ); +} + +HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile, + const fs::path &in_src, const fs::path &in_resEmbStylesheet, + const std::string &in_module, const std::string &in_lang, bool in_bExtensionMode) + : streamTable(in_streamTable), inputFile(in_inputFile), + src(in_src), module(in_module), lang(in_lang), resEmbStylesheet(in_resEmbStylesheet), + bExtensionMode( in_bExtensionMode ) +{ + xmlKeepBlanksDefaultValue = 0; +} + +xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath) +{ + static const char *params[4 + 1]; + static xsltStylesheetPtr cur = NULL; + + xmlDocPtr res; + if( bExtensionMode ) + { + res = xmlParseFile(filePath.native_file_string().c_str()); + if( !res ){ + impl_sleep( 3 ); + res = xmlParseFile(filePath.native_file_string().c_str()); + } + } + else + { + if (!cur) + { + static std::string fsroot('\'' + src.toUTF8() + '\''); + static std::string esclang('\'' + lang + '\''); + + xmlSubstituteEntitiesDefault(1); + xmlLoadExtDtdDefaultValue = 1; + cur = xsltParseStylesheetFile((const xmlChar *)resEmbStylesheet.native_file_string().c_str()); + + int nbparams = 0; + params[nbparams++] = "Language"; + params[nbparams++] = esclang.c_str(); + params[nbparams++] = "fsroot"; + params[nbparams++] = fsroot.c_str(); + params[nbparams] = NULL; + } + xmlDocPtr doc = xmlParseFile(filePath.native_file_string().c_str()); + if( !doc ) + { + impl_sleep( 3 ); + doc = xmlParseFile(filePath.native_file_string().c_str()); + } + + //???res = xmlParseFile(filePath.native_file_string().c_str()); + + res = xsltApplyStylesheet(cur, doc, params); + xmlFreeDoc(doc); + } + return res; +} + +HashSet HelpCompiler::switchFind(xmlDocPtr doc) +{ + HashSet hs; + xmlChar *xpath = (xmlChar*)"//switchinline"; + + xmlXPathContextPtr context = xmlXPathNewContext(doc); + xmlXPathObjectPtr result = xmlXPathEvalExpression(xpath, context); + xmlXPathFreeContext(context); + if (result) + { + xmlNodeSetPtr nodeset = result->nodesetval; + for (int i = 0; i < nodeset->nodeNr; i++) + { + xmlNodePtr el = nodeset->nodeTab[i]; + xmlChar *select = xmlGetProp(el, (xmlChar*)"select"); + if (select) + { + if (!strcmp((const char*)select, "appl")) + { + xmlNodePtr n1 = el->xmlChildrenNode; + while (n1) + { + if ((!xmlStrcmp(n1->name, (const xmlChar*)"caseinline"))) + { + xmlChar *appl = xmlGetProp(n1, (xmlChar*)"select"); + hs.push_back(std::string((const char*)appl)); + xmlFree(appl); + } + else if ((!xmlStrcmp(n1->name, (const xmlChar*)"defaultinline"))) + hs.push_back(std::string("DEFAULT")); + n1 = n1->next; + } + } + xmlFree(select); + } + } + xmlXPathFreeObject(result); + } + hs.push_back(std::string("DEFAULT")); + return hs; +} + +// returns a node representing the whole stuff compiled for the current +// application. +xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl) +{ + xmlNodePtr parent = xmlCopyNode(node, 2); + xmlNodePtr n = node->xmlChildrenNode; + while (n != NULL) + { + bool isappl = false; + if ( (!strcmp((const char*)n->name, "switchinline")) || + (!strcmp((const char*)n->name, "switch")) ) + { + xmlChar *select = xmlGetProp(n, (xmlChar*)"select"); + if (select) + { + if (!strcmp((const char*)select, "appl")) + isappl = true; + xmlFree(select); + } + } + if (isappl) + { + xmlNodePtr caseNode = n->xmlChildrenNode; + if (appl == "DEFAULT") + { + while (caseNode) + { + if (!strcmp((const char*)caseNode->name, "defaultinline")) + { + xmlNodePtr cnl = caseNode->xmlChildrenNode; + while (cnl) + { + xmlAddChild(parent, clone(cnl, appl)); + cnl = cnl->next; + } + break; + } + caseNode = caseNode->next; + } + } + else + { + while (caseNode) + { + isappl=false; + if (!strcmp((const char*)caseNode->name, "caseinline")) + { + xmlChar *select = xmlGetProp(n, (xmlChar*)"select"); + if (select) + { + if (!strcmp((const char*)select, appl.c_str())) + isappl = true; + xmlFree(select); + } + if (isappl) + { + xmlNodePtr cnl = caseNode->xmlChildrenNode; + while (cnl) + { + xmlAddChild(parent, clone(cnl, appl)); + cnl = cnl->next; + } + break; + } + + } + caseNode = caseNode->next; + } + } + + } + else + xmlAddChild(parent, clone(n, appl)); + + n = n->next; + } + return parent; +} + +class myparser +{ +public: + std::string documentId; + std::string fileName; + std::string title; + HashSet *hidlist; + Hashtable *keywords; + Stringtable *helptexts; +private: + HashSet extendedHelpText; +public: + myparser(const std::string &indocumentId, const std::string &infileName, + const std::string &intitle) : documentId(indocumentId), fileName(infileName), + title(intitle) + { + hidlist = new HashSet; + keywords = new Hashtable; + helptexts = new Stringtable; + } + void traverse( xmlNodePtr parentNode ); +private: + std::string dump(xmlNodePtr node); +}; + +std::string myparser::dump(xmlNodePtr node) +{ + std::string app; + if (node->xmlChildrenNode) + { + xmlNodePtr list = node->xmlChildrenNode; + while (list) + { + app += dump(list); + list = list->next; + } + } + if (xmlNodeIsText(node)) + { + xmlChar *pContent = xmlNodeGetContent(node); + app += std::string((const char*)pContent); + xmlFree(pContent); + // std::cout << app << std::endl; + } + return app; +} + +void trim(std::string& str) +{ + std::string::size_type pos = str.find_last_not_of(' '); + if(pos != std::string::npos) + { + str.erase(pos + 1); + pos = str.find_first_not_of(' '); + if(pos != std::string::npos) + str.erase(0, pos); + } + else + str.erase(str.begin(), str.end()); +} + +void myparser::traverse( xmlNodePtr parentNode ) +{ + // traverse all nodes that belong to the parent + xmlNodePtr test ; + for (test = parentNode->xmlChildrenNode; test; test = test->next) + { + if (fileName.empty() && !strcmp((const char*)test->name, "filename")) + { + xmlNodePtr node = test->xmlChildrenNode; + if (xmlNodeIsText(node)) + { + xmlChar *pContent = xmlNodeGetContent(node); + fileName = std::string((const char*)pContent); + xmlFree(pContent); + } + } + else if (title.empty() && !strcmp((const char*)test->name, "title")) + { + title = dump(test); + if (title.empty()) + title = "<notitle>"; + } + else if (!strcmp((const char*)test->name, "bookmark")) + { + xmlChar *branchxml = xmlGetProp(test, (const xmlChar*)"branch"); + xmlChar *idxml = xmlGetProp(test, (const xmlChar*)"id"); + std::string branch((const char*)branchxml); + std::string anchor((const char*)idxml); + xmlFree (branchxml); + xmlFree (idxml); + + std::string hid; + + if (branch.find("hid") == 0) + { + size_t index = branch.find('/'); + if (index != std::string::npos) + { + hid = branch.substr(1 + index); + // one shall serve as a documentId + if (documentId.empty()) + documentId = hid; + extendedHelpText.push_back(hid); + std::string foo = anchor.empty() ? hid : hid + "#" + anchor; + HCDBG(std::cerr << "hid pushback" << foo << std::endl); + hidlist->push_back( anchor.empty() ? hid : hid + "#" + anchor); + } + else + continue; + } + else if (branch.compare("index") == 0) + { + LinkedList ll; + + for (xmlNodePtr nd = test->xmlChildrenNode; nd; nd = nd->next) + { + if (strcmp((const char*)nd->name, "bookmark_value")) + continue; + + std::string embedded; + xmlChar *embeddedxml = xmlGetProp(nd, (const xmlChar*)"embedded"); + if (embeddedxml) + { + embedded = std::string((const char*)embeddedxml); + xmlFree (embeddedxml); + std::transform (embedded.begin(), embedded.end(), + embedded.begin(), tolower); + } + + bool isEmbedded = !embedded.empty() && embedded.compare("true") == 0; + if (isEmbedded) + continue; + + std::string keyword = dump(nd); + size_t keywordSem = keyword.find(';'); + if (keywordSem != std::string::npos) + { + std::string tmppre = + keyword.substr(0,keywordSem); + trim(tmppre); + std::string tmppos = + keyword.substr(1+keywordSem); + trim(tmppos); + keyword = tmppre + ";" + tmppos; + } + ll.push_back(keyword); + } + if (!ll.empty()) + (*keywords)[anchor] = ll; + } + else if (branch.compare("contents") == 0) + { + // currently not used + } + } + else if (!strcmp((const char*)test->name, "ahelp")) + { + std::string text = dump(test); + trim(text); + std::string name; + + HashSet::const_iterator aEnd = extendedHelpText.end(); + for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; + ++iter) + { + name = *iter; + (*helptexts)[name] = text; + } + extendedHelpText.clear(); + } + + // traverse children + traverse(test); + } +} + +bool HelpCompiler::compile( void ) throw( HelpProcessingException ) +{ + // we now have the jaroutputstream, which will contain the document. + // now determine the document as a dom tree in variable docResolved + + xmlDocPtr docResolvedOrg = getSourceDocument(inputFile); + + // now add path to the document + // resolve the dom + if (!docResolvedOrg) + { + impl_sleep( 3 ); + docResolvedOrg = getSourceDocument(inputFile); + if( !docResolvedOrg ) + { + std::stringstream aStrStream; + aStrStream << "ERROR: file not existing: " << inputFile.native_file_string().c_str() << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + } + + // now find all applications for which one has to compile + std::string documentId; + std::string fileName; + std::string title; + // returns all applications for which one has to compile + HashSet applications = switchFind(docResolvedOrg); + + HashSet::const_iterator aEnd = applications.end(); + for (HashSet::const_iterator aI = applications.begin(); aI != aEnd; ++aI) + { + std::string appl = *aI; + std::string modulename = appl; + if (modulename[0] == 'S') + { + modulename = modulename.substr(1); + std::transform(modulename.begin(), modulename.end(), modulename.begin(), tolower); + } + if (modulename != "DEFAULT" && modulename != module) + continue; + + // returns a clone of the document with swich-cases resolved + xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl); + myparser aparser(documentId, fileName, title); + aparser.traverse(docResolved); + + documentId = aparser.documentId; + fileName = aparser.fileName; + title = aparser.title; + + HCDBG(std::cerr << documentId << " : " << fileName << " : " << title << std::endl); + + xmlDocPtr docResolvedDoc = xmlCopyDoc(docResolvedOrg, false); + xmlDocSetRootElement(docResolvedDoc, docResolved); + + if (modulename == "DEFAULT") + { + streamTable.dropdefault(); + streamTable.default_doc = docResolvedDoc; + streamTable.default_hidlist = aparser.hidlist; + streamTable.default_helptexts = aparser.helptexts; + streamTable.default_keywords = aparser.keywords; + } + else if (modulename == module) + { + streamTable.dropappl(); + streamTable.appl_doc = docResolvedDoc; + streamTable.appl_hidlist = aparser.hidlist; + streamTable.appl_helptexts = aparser.helptexts; + streamTable.appl_keywords = aparser.keywords; + } + else + { + std::stringstream aStrStream; + aStrStream << "ERROR: Found unexpected module name \"" << modulename + << "\" in file" << src.native_file_string().c_str() << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + } // end iteration over all applications + + streamTable.document_id = documentId; + streamTable.document_path = fileName; + streamTable.document_title = title; + std::string actMod = module; + if ( !bExtensionMode && !fileName.empty()) + { + if (fileName.find("/text/") == 0) + { + int len = strlen("/text/"); + actMod = fileName.substr(len); + actMod = actMod.substr(0, actMod.find('/')); + } + } + streamTable.document_module = actMod; + + xmlFreeDoc(docResolvedOrg); + return true; +} + +namespace fs +{ + rtl_TextEncoding getThreadTextEncoding( void ) + { + static bool bNeedsInit = true; + static rtl_TextEncoding nThreadTextEncoding; + if( bNeedsInit ) + { + bNeedsInit = false; + nThreadTextEncoding = osl_getThreadTextEncoding(); + } + return nThreadTextEncoding; + } + + void create_directory(const fs::path indexDirName) + { + HCDBG( + std::cerr << "creating " << + rtl::OUStringToOString(indexDirName.data, RTL_TEXTENCODING_UTF8).getStr() + << std::endl + ); + osl::Directory::createPath(indexDirName.data); + } + + void rename(const fs::path &src, const fs::path &dest) + { + osl::File::move(src.data, dest.data); + } + + void copy(const fs::path &src, const fs::path &dest) + { + osl::File::copy(src.data, dest.data); + } + + bool exists(const fs::path &in) + { + osl::File tmp(in.data); + return (tmp.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None); + } + + void remove(const fs::path &in) + { + osl::File::remove(in.data); + } + + void removeRecursive(rtl::OUString const& _suDirURL) + { + { + osl::Directory aDir(_suDirURL); + aDir.open(); + if (aDir.isOpen()) + { + osl::DirectoryItem aItem; + osl::FileStatus aStatus(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes); + while (aDir.getNextItem(aItem) == ::osl::FileBase::E_None) + { + if (osl::FileBase::E_None == aItem.getFileStatus(aStatus) && + aStatus.isValid(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes)) + { + rtl::OUString suFilename = aStatus.getFileName(); + rtl::OUString suFullFileURL; + suFullFileURL += _suDirURL; + suFullFileURL += rtl::OUString::createFromAscii("/"); + suFullFileURL += suFilename; + + if (aStatus.getFileType() == osl::FileStatus::Directory) + removeRecursive(suFullFileURL); + else + osl::File::remove(suFullFileURL); + } + } + aDir.close(); + } + } + osl::Directory::remove(_suDirURL); + } + + void remove_all(const fs::path &in) + { + removeRecursive(in.data); + } +} + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/transex3/source/help/HelpCompiler.hxx b/transex3/source/help/HelpCompiler.hxx new file mode 100644 index 000000000000..7ffb096bd635 --- /dev/null +++ b/transex3/source/help/HelpCompiler.hxx @@ -0,0 +1,320 @@ +/************************************************************************* + * + * 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: HelpCompiler.hxx,v $ + * $Revision: 1.8 $ + * + * 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 HELPCOMPILER_HXX +#define HELPCOMPILER_HXX + +#include <string> +#include <hash_map> +#include <vector> +#include <list> +#include <fstream> +#include <iostream> +#include <sstream> +#include <algorithm> +#include <ctype.h> +#ifdef SYSTEM_DB +#include <db.h> +#else +#include <berkeleydb/db.h> +#endif + +#include <boost/shared_ptr.hpp> + +#include <libxml/xmlmemory.h> +#include <libxml/debugXML.h> +#include <libxml/HTMLtree.h> +#include <libxml/xmlIO.h> +#include <libxml/xinclude.h> +#include <libxml/catalog.h> + +#include <rtl/ustring.hxx> +#include <osl/thread.h> +#include <osl/process.h> +#include <osl/file.hxx> + +#include <compilehelp.hxx> + +#define EMULATEORIGINAL 1 + +#ifdef CMCDEBUG + #define HCDBG(foo) do { if (1) foo; } while(0) +#else + #define HCDBG(foo) do { if (0) foo; } while(0) +#endif + +namespace fs +{ + rtl_TextEncoding getThreadTextEncoding( void ); + + enum convert { native }; + class path + { + public: + ::rtl::OUString data; + public: + path() {} + path(const path &rOther) : data(rOther.data) {} + path(const std::string &in, convert) + { + rtl::OUString sWorkingDir; + osl_getProcessWorkingDir(&sWorkingDir.pData); + + rtl::OString tmp(in.c_str()); + rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding())); + osl::File::getFileURLFromSystemPath(ustrSystemPath, data); + osl::File::getAbsoluteFileURL(sWorkingDir, data, data); + } + path(const std::string &FileURL) + { + rtl::OString tmp(FileURL.c_str()); + data = rtl::OStringToOUString(tmp, getThreadTextEncoding()); + } + std::string native_file_string() const + { + ::rtl::OUString ustrSystemPath; + osl::File::getSystemPathFromFileURL(data, ustrSystemPath); + rtl::OString tmp(rtl::OUStringToOString(ustrSystemPath, getThreadTextEncoding())); + HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl); + return std::string(tmp.getStr()); + } + std::string native_directory_string() const { return native_file_string(); } + std::string toUTF8() const + { + rtl::OString tmp(rtl::OUStringToOString(data, RTL_TEXTENCODING_UTF8)); + return std::string(tmp.getStr()); + } + bool empty() const { return data.getLength() == 0; } + path operator/(const std::string &in) const + { + path ret(*this); + HCDBG(std::cerr << "orig was " << + rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl); + rtl::OString tmp(in.c_str()); + rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding())); + ret.data += rtl::OUString(sal_Unicode('/')); + ret.data += ustrSystemPath; + HCDBG(std::cerr << "final is " << + rtl::OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl); + return ret; + } + void append(const char *in) + { + rtl::OString tmp(in); + rtl::OUString ustrSystemPath(rtl::OStringToOUString(tmp, getThreadTextEncoding())); + data = data + ustrSystemPath; + } + void append(const std::string &in) { append(in.c_str()); } + }; + + void create_directory(const fs::path indexDirName); + void rename(const fs::path &src, const fs::path &dest); + void copy(const fs::path &src, const fs::path &dest); + bool exists(const fs::path &in); + void remove_all(const fs::path &in); + void remove(const fs::path &in); +} + +struct joaat_hash +{ + size_t operator()(const std::string &str) const + { + size_t hash = 0; + const char *key = str.data(); + for (size_t i = 0; i < str.size(); i++) + { + hash += key[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + return hash; + } +}; + +#define get16bits(d) ((((sal_uInt32)(((const sal_uInt8 *)(d))[1])) << 8)\ + +(sal_uInt32)(((const sal_uInt8 *)(d))[0]) ) + +struct SuperFastHash +{ + size_t operator()(const std::string &str) const + { + const char * data = str.data(); + int len = str.size(); + size_t hash = len, tmp; + if (len <= 0 || data == NULL) return 0; + + int rem = len & 3; + len >>= 2; + + /* Main loop */ + for (;len > 0; len--) + { + hash += get16bits (data); + tmp = (get16bits (data+2) << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2*sizeof (sal_uInt16); + hash += hash >> 11; + } + + /* Handle end cases */ + switch (rem) + { + case 3: hash += get16bits (data); + hash ^= hash << 16; + hash ^= data[sizeof (sal_uInt16)] << 18; + hash += hash >> 11; + break; + case 2: hash += get16bits (data); + hash ^= hash << 11; + hash += hash >> 17; + break; + case 1: hash += *data; + hash ^= hash << 10; + hash += hash >> 1; + } + + /* Force "avalanching" of final 127 bits */ + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + + return hash; + } +}; + +#define pref_hash joaat_hash + +typedef std::hash_map<std::string, std::string, pref_hash> Stringtable; +typedef std::list<std::string> LinkedList; +typedef std::vector<std::string> HashSet; + +typedef std::hash_map<std::string, LinkedList, pref_hash> Hashtable; + +class StreamTable +{ +public: + std::string document_id; + std::string document_path; + std::string document_module; + std::string document_title; + + HashSet *appl_hidlist; + Hashtable *appl_keywords; + Stringtable *appl_helptexts; + xmlDocPtr appl_doc; + + HashSet *default_hidlist; + Hashtable *default_keywords; + Stringtable *default_helptexts; + xmlDocPtr default_doc; + + StreamTable() : + appl_hidlist(NULL), appl_keywords(NULL), appl_helptexts(NULL), appl_doc(NULL), + default_hidlist(NULL), default_keywords(NULL), default_helptexts(NULL), default_doc(NULL) + {} + void dropdefault() + { + delete default_hidlist; + delete default_keywords; + delete default_helptexts; + if (default_doc) xmlFreeDoc(default_doc); + } + void dropappl() + { + delete appl_hidlist; + delete appl_keywords; + delete appl_helptexts; + if (appl_doc) xmlFreeDoc(appl_doc); + } + ~StreamTable() + { + dropappl(); + dropdefault(); + } +}; + +struct HelpProcessingException +{ + HelpProcessingErrorClass m_eErrorClass; + std::string m_aErrorMsg; + std::string m_aXMLParsingFile; + int m_nXMLParsingLine; + + HelpProcessingException( HelpProcessingErrorClass eErrorClass, const std::string& aErrorMsg ) + : m_eErrorClass( eErrorClass ) + , m_aErrorMsg( aErrorMsg ) + {} + HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine ) + : m_eErrorClass( HELPPROCESSING_XMLPARSING_ERROR ) + , m_aErrorMsg( aErrorMsg ) + , m_aXMLParsingFile( aXMLParsingFile ) + , m_nXMLParsingLine( nXMLParsingLine ) + {} +}; + +class HelpCompiler +{ +public: + HelpCompiler(StreamTable &streamTable, + const fs::path &in_inputFile, + const fs::path &in_src, + const fs::path &in_resEmbStylesheet, + const std::string &in_module, + const std::string &in_lang, + bool in_bExtensionMode); + bool compile( void ) throw (HelpProcessingException); + void addEntryToJarFile(const std::string &prefix, + const std::string &entryName, const std::string &bytesToAdd); + void addEntryToJarFile(const std::string &prefix, + const std::string &entryName, const HashSet &bytesToAdd); + void addEntryToJarFile(const std::string &prefix, + const std::string &entryName, const Stringtable &bytesToAdd); + void addEntryToJarFile(const std::string &prefix, + const std::string &entryName, const Hashtable &bytesToAdd); +private: + xmlDocPtr getSourceDocument(const fs::path &filePath); + HashSet switchFind(xmlDocPtr doc); + xmlNodePtr clone(xmlNodePtr node, const std::string& appl); + StreamTable &streamTable; + const fs::path inputFile, src; + const std::string module, lang; + const fs::path resEmbStylesheet; + bool bExtensionMode; +}; + +#endif + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/transex3/source/help/HelpFileDocument.java b/transex3/source/help/HelpFileDocument.java new file mode 100644 index 000000000000..2212db27f251 --- /dev/null +++ b/transex3/source/help/HelpFileDocument.java @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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: HelpFileDocument.java,v $ + * $Revision: 1.2 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.help; + +import java.io.File; +import java.io.Reader; +import java.io.FileInputStream; +import java.io.InputStreamReader; +//import java.io.FileReader; +import java.io.StringReader; + +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; + +/** Lucene Document for help files */ +public class HelpFileDocument +{ + /** Creates reader for UTF-8 files + */ + private static Reader getReaderForFile( File aFile ) + throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException { + Reader aReader; + if( aFile != null ) { + FileInputStream fis = new FileInputStream( aFile ); + aReader = new InputStreamReader( fis, "UTF-8" ); + } + else { + aReader = new StringReader( "" ); + } + return aReader; + } + + /** Makes a document for a File. + */ + public static Document Document( String aModule, File aCaptionFile, File aContentFile ) + throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException { + Document doc = new Document(); + + // Add the path of the file as a field named "path". Use a field that is + // indexed (i.e. searchable), but don't tokenize the field into words. + File aFile = aCaptionFile != null ? aCaptionFile : aContentFile; + if( aFile != null ) + { + String aPath = "#HLP#" + aModule + "/" + aFile.getName(); + doc.add(new Field("path", aPath, Field.Store.YES, Field.Index.UN_TOKENIZED)); + } + + // Add the caption of the file to a field named "caption". Specify a Reader, + // so that the text of the file is tokenized and indexed, but not stored. + doc.add( new Field( "caption", getReaderForFile( aCaptionFile ) ) ); + + // Add the contents of the file to a field named "content". Specify a Reader, + // so that the text of the file is tokenized and indexed, but not stored. + doc.add( new Field( "content", getReaderForFile( aContentFile ) ) ); + + // return the document + return doc; + } + + private HelpFileDocument() {} +} diff --git a/transex3/source/help/HelpIndexerTool.java b/transex3/source/help/HelpIndexerTool.java new file mode 100644 index 000000000000..6bf22d1ac344 --- /dev/null +++ b/transex3/source/help/HelpIndexerTool.java @@ -0,0 +1,372 @@ +/************************************************************************* + * + * 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: HelpIndexer.java,v $ + * $Revision: 1.21 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.help; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import java.util.zip.CRC32; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis.cjk.CJKAnalyzer; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.index.IndexWriter; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Date; + +public class HelpIndexerTool +{ + public HelpIndexerTool() + { + } + + + /** + * @param args the command line arguments + */ + public static void main( String[] args ) + { + boolean bExtensionMode = false; + mainImpl( args, bExtensionMode ); + } + + public static void mainImpl( String[] args, boolean bExtensionMode ) + { + String aDirToZipStr = ""; + String aSrcDirStr = ""; + String aLanguageStr = ""; + String aModule = ""; + String aTargetZipFileStr = ""; + String aCfsName = ""; + + // Scan arguments + boolean bLang = false; + boolean bMod = false; + boolean bZipDir = false; + boolean bSrcDir = false; + boolean bOutput = false; + boolean bCfsName = false; + + int nArgCount = args.length; + for( int i = 0 ; i < nArgCount ; i++ ) + { + if( "-lang".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aLanguageStr = args[i + 1]; + bLang = true; + } + i++; + } + else if( "-mod".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aModule = args[i + 1]; + bMod = true; + } + i++; + } + else if( "-zipdir".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aDirToZipStr = args[i + 1]; + bZipDir = true; + } + i++; + } + else if( "-srcdir".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aSrcDirStr = args[i + 1]; + bSrcDir = true; + } + i++; + } + else if( "-o".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aTargetZipFileStr = args[i + 1]; + bOutput = true; + } + i++; + } + else if( "-checkcfsname".equals(args[i]) ) + { + if( i + 1 < nArgCount ) + { + aCfsName = args[i + 1] + ".cfs"; + bCfsName = true; + } + i++; + } + } + + if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode) ) + { + if( bExtensionMode ) + return; + + System.out.println("Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -zipdir TempZipDir -o OutputZipFile"); + System.exit( -1 ); + } + + String aIndexDirName = aModule + ".idxl"; + File aIndexDir = new File( aDirToZipStr + File.separator + aIndexDirName ); + if( !bSrcDir ) + aSrcDirStr = aDirToZipStr; + File aCaptionFilesDir = new File( aSrcDirStr + File.separator + "caption" ); + File aContentFilesDir = new File( aSrcDirStr + File.separator + "content" ); + + try + { + Date start = new Date(); + Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer(); + IndexWriter writer = new IndexWriter( aIndexDir, analyzer, true ); + if( !bExtensionMode ) + System.out.println( "Lucene: Indexing to directory '" + aIndexDir + "'..." ); + int nRet = indexDocs( writer, aModule, bExtensionMode, aCaptionFilesDir, aContentFilesDir ); + if( nRet != -1 ) + { + if( !bExtensionMode ) + { + System.out.println(); + System.out.println( "Optimizing ..." ); + } + writer.optimize(); + } + writer.close(); + + boolean bCfsFileOk = true; + if( bCfsName && !bExtensionMode && nRet != -1 ) + { + String aCompleteCfsFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aCfsName; + File aCfsFile = new File( aCompleteCfsFileName ); + bCfsFileOk = aCfsFile.exists(); + System.out.println( "Checking cfs file " + aCfsName+ ": " + (bCfsFileOk ? "Found" : "Not found") ); + } + + if( bExtensionMode ) + { + if( !bSrcDir ) + { + deleteRecursively( aCaptionFilesDir ); + deleteRecursively( aContentFilesDir ); + } + } + else + { + if( nRet == -1 ) + deleteRecursively( aIndexDir ); + + if( bCfsFileOk ) + System.out.println( "Zipping ..." ); + File aDirToZipFile = new File( aDirToZipStr ); + createZipFile( aDirToZipFile, aTargetZipFileStr ); + deleteRecursively( aDirToZipFile ); + } + + if( !bCfsFileOk ) + { + System.out.println( "cfs file check failed, terminating..." ); + System.exit( -1 ); + } + + Date end = new Date(); + if( !bExtensionMode ) + System.out.println(end.getTime() - start.getTime() + " total milliseconds"); + } + catch (IOException e) + { + if( bExtensionMode ) + return; + + System.out.println(" caught a " + e.getClass() + + "\n with message: " + e.getMessage()); + System.exit( -1 ); + } + } + + private static int indexDocs(IndexWriter writer, String aModule, boolean bExtensionMode, + File aCaptionFilesDir, File aContentFilesDir) throws IOException + { + if( !aCaptionFilesDir.canRead() || !aCaptionFilesDir.isDirectory() ) + { + if( !bExtensionMode ) + System.out.println( "Not found: " + aCaptionFilesDir ); + return -1; + } + if( !aContentFilesDir.canRead() || !aContentFilesDir.isDirectory() ) + { + if( !bExtensionMode ) + System.out.println( "Not found: " + aContentFilesDir ); + return -1; + } + + String[] aCaptionFiles = aCaptionFilesDir.list(); + List aCaptionFilesList = Arrays.asList( aCaptionFiles ); + HashSet aCaptionFilesHashSet = new HashSet( aCaptionFilesList ); + + String[] aContentFiles = aContentFilesDir.list(); + List aContentFilesList = Arrays.asList( aContentFiles ); + HashSet aContentFilesHashSet = new HashSet( aContentFilesList ); + + // Loop over caption files and find corresponding content file + if( !bExtensionMode ) + System.out.println( "Indexing, adding files" ); + int nCaptionFilesLen = aCaptionFiles.length; + for( int i = 0 ; i < nCaptionFilesLen ; i++ ) + { + String aCaptionFileStr = aCaptionFiles[i]; + File aCaptionFile = new File( aCaptionFilesDir, aCaptionFileStr ); + File aContentFile = null; + if( aContentFilesHashSet.contains( aCaptionFileStr ) ) + aContentFile = new File( aContentFilesDir, aCaptionFileStr ); + + if( !bExtensionMode ) + System.out.print( "." ); + writer.addDocument( HelpFileDocument.Document( aModule, aCaptionFile, aContentFile ) ); + } + + // Loop over content files to find remaining files not mapped to caption files + int nContentFilesLen = aContentFiles.length; + for( int i = 0 ; i < nContentFilesLen ; i++ ) + { + String aContentFileStr = aContentFiles[i]; + if( !aCaptionFilesHashSet.contains( aContentFileStr ) ) + { + // Not already handled in caption files loop + File aCaptionFile = null; + File aContentFile = new File( aContentFilesDir, aContentFileStr ); + if( !bExtensionMode ) + System.out.print( "." ); + writer.addDocument( HelpFileDocument.Document( aModule, aCaptionFile, aContentFile ) ); + } + } + return 0; + } + + public static void createZipFile( File aDirToZip, String aTargetZipFileStr ) + throws FileNotFoundException, IOException + { + FileOutputStream fos = new FileOutputStream( aTargetZipFileStr ); + ZipOutputStream zos = new ZipOutputStream( fos ); + + File[] aChildrenFiles = aDirToZip.listFiles(); + int nFileCount = aChildrenFiles.length; + for( int i = 0 ; i < nFileCount ; i++ ) + addToZipRecursively( zos, aChildrenFiles[i], null ); + + zos.close(); + } + + public static void addToZipRecursively( ZipOutputStream zos, File aFile, String aBasePath ) + throws FileNotFoundException, IOException + { + if( aFile.isDirectory() ) + { + String aDirName = aFile.getName(); + if( aDirName.equalsIgnoreCase( "caption" ) || aDirName.equalsIgnoreCase( "content" ) ) + return; + + File[] aChildrenFiles = aFile.listFiles(); + String aNewBasePath = ""; + if( aBasePath != null ) + aNewBasePath += aBasePath + File.separator; + aNewBasePath += aDirName; + + int nFileCount = aChildrenFiles.length; + for( int i = 0 ; i < nFileCount ; i++ ) + addToZipRecursively( zos, aChildrenFiles[i], aNewBasePath ); + + return; + } + + // No directory + // read contents of file we are going to put in the zip + int fileLength = (int) aFile.length(); + FileInputStream fis = new FileInputStream( aFile ); + byte[] wholeFile = new byte[fileLength]; + int bytesRead = fis.read( wholeFile, 0, fileLength ); + fis.close(); + + String aFileName = aFile.getName(); + String aEntryName = ""; + if( aBasePath != null ) + aEntryName += aBasePath + "/"; + aEntryName += aFileName; + ZipEntry aZipEntry = new ZipEntry( aEntryName ); + aZipEntry.setTime( aFile.lastModified() ); + aZipEntry.setSize( fileLength ); + + int nMethod = ( aFileName.toLowerCase().endsWith( ".jar" ) ) + ? ZipEntry.STORED : ZipEntry.DEFLATED; + aZipEntry.setMethod( nMethod ); + + CRC32 tempCRC = new CRC32(); + tempCRC.update( wholeFile, 0, wholeFile.length ); + aZipEntry.setCrc( tempCRC.getValue() ); + + // write the contents into the zip element + zos.putNextEntry( aZipEntry ); + zos.write( wholeFile, 0, fileLength ); + zos.closeEntry(); + } + + static public boolean deleteRecursively( File aFile ) + { + if( aFile.isDirectory() ) + { + File[] aChildrenFiles = aFile.listFiles(); + int nFileCount = aChildrenFiles.length; + for( int i = 0 ; i < nFileCount ; i++ ) + { + File aChildrenFile = aChildrenFiles[i]; + boolean bSuccess = deleteRecursively( aChildrenFile ); + if( !bSuccess ) + return false; + } + } + + return aFile.delete(); + } +} + diff --git a/transex3/source/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx new file mode 100644 index 000000000000..8acb129b21fb --- /dev/null +++ b/transex3/source/help/HelpLinker.cxx @@ -0,0 +1,1161 @@ +/************************************************************************* + * + * 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: HelpLinker.cxx,v $ + * $Revision: 1.16 $ + * + * 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. + * + ************************************************************************/ + +#include "HelpCompiler.hxx" + +#include <map> + +#include <string.h> +#include <limits.h> + +#include <libxslt/xslt.h> +#include <libxslt/transform.h> +#include <libxslt/xsltutils.h> +#include <libxslt/functions.h> +#include <libxslt/extensions.h> + +#include <sal/types.h> +#include <osl/time.h> +#include <rtl/bootstrap.hxx> + +#ifdef SYSTEM_EXPAT +#include <expat.h> +#else +#include <expat/xmlparse.h> +#endif + +#define DBHELP_ONLY + + +class IndexerPreProcessor +{ +private: + std::string m_aModuleName; + fs::path m_fsIndexBaseDir; + fs::path m_fsCaptionFilesDirName; + fs::path m_fsContentFilesDirName; + + xsltStylesheetPtr m_xsltStylesheetPtrCaption; + xsltStylesheetPtr m_xsltStylesheetPtrContent; + +public: + IndexerPreProcessor( const std::string& aModuleName, const fs::path& fsIndexBaseDir, + const fs::path& idxCaptionStylesheet, const fs::path& idxContentStylesheet ); + ~IndexerPreProcessor(); + + void processDocument( xmlDocPtr doc, const std::string& EncodedDocPath ); +}; + +IndexerPreProcessor::IndexerPreProcessor + ( const std::string& aModuleName, const fs::path& fsIndexBaseDir, + const fs::path& idxCaptionStylesheet, const fs::path& idxContentStylesheet ) + : m_aModuleName( aModuleName ) + , m_fsIndexBaseDir( fsIndexBaseDir ) +{ + m_fsCaptionFilesDirName = fsIndexBaseDir / "caption"; + fs::create_directory( m_fsCaptionFilesDirName ); + + m_fsContentFilesDirName = fsIndexBaseDir / "content"; + fs::create_directory( m_fsContentFilesDirName ); + + m_xsltStylesheetPtrCaption = xsltParseStylesheetFile + ((const xmlChar *)idxCaptionStylesheet.native_file_string().c_str()); + m_xsltStylesheetPtrContent = xsltParseStylesheetFile + ((const xmlChar *)idxContentStylesheet.native_file_string().c_str()); +} + +IndexerPreProcessor::~IndexerPreProcessor() +{ + if( m_xsltStylesheetPtrCaption ) + xsltFreeStylesheet( m_xsltStylesheetPtrCaption ); + if( m_xsltStylesheetPtrContent ) + xsltFreeStylesheet( m_xsltStylesheetPtrContent ); +} + + +std::string getEncodedPath( const std::string& Path ) +{ + rtl::OString aOStr_Path( Path.c_str() ); + rtl::OUString aOUStr_Path( rtl::OStringToOUString + ( aOStr_Path, fs::getThreadTextEncoding() ) ); + rtl::OUString aPathURL; + osl::File::getFileURLFromSystemPath( aOUStr_Path, aPathURL ); + rtl::OString aOStr_PathURL( rtl::OUStringToOString + ( aPathURL, fs::getThreadTextEncoding() ) ); + std::string aStdStr_PathURL( aOStr_PathURL.getStr() ); + return aStdStr_PathURL; +} + +void IndexerPreProcessor::processDocument + ( xmlDocPtr doc, const std::string &EncodedDocPath ) +{ + std::string aStdStr_EncodedDocPathURL = getEncodedPath( EncodedDocPath ); + + xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL ); + xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode; + if( pResNodeCaption ) + { + fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; + std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); + fclose( pFile_docURL ); + } + } + xmlFreeDoc(resCaption); + + xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL ); + xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; + if( pResNodeContent ) + { + fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; + std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); + fclose( pFile_docURL ); + } + } + xmlFreeDoc(resContent); +} + +struct Data +{ + std::vector<std::string> _idList; + typedef std::vector<std::string>::const_iterator cIter; + + void append(const std::string &id) + { + _idList.push_back(id); + } + + std::string getString() const + { + std::string ret; + cIter aEnd = _idList.end(); + for (cIter aIter = _idList.begin(); aIter != aEnd; ++aIter) + ret += *aIter + ";"; + return ret; + } +}; + +void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::string& aValueStr ) +{ + if( pFile == NULL ) + return; + char cLF = 10; + int nKeyLen = aKeyStr.length(); + int nValueLen = aValueStr.length(); + fprintf( pFile, "%x ", nKeyLen ); + if( nKeyLen > 0 ) + fwrite( aKeyStr.c_str(), 1, nKeyLen, pFile );
+ fprintf( pFile, " %x ", nValueLen ); + if( nValueLen > 0 ) + fwrite( aValueStr.c_str(), 1, nValueLen, pFile );
+ fprintf( pFile, "%c", cLF ); +} + +class HelpKeyword +{ +private: + typedef std::hash_map<std::string, Data, pref_hash> DataHashtable; + DataHashtable _hash; + +public: + void insert(const std::string &key, const std::string &id) + { + Data &data = _hash[key]; + data.append(id); + } + + void dump(DB* table) + { + DataHashtable::const_iterator aEnd = _hash.end(); + for (DataHashtable::const_iterator aIter = _hash.begin(); aIter != aEnd; ++aIter) + { + const std::string &keystr = aIter->first; + DBT key; + memset(&key, 0, sizeof(key)); + key.data = const_cast<char*>(keystr.c_str()); + key.size = keystr.length(); + + const Data &data = aIter->second; + std::string str = data.getString(); + DBT value; + memset(&value, 0, sizeof(value)); + value.data = const_cast<char*>(str.c_str()); + value.size = str.length(); + + table->put(table, NULL, &key, &value, 0); + } + } + + void dump_DBHelp( const std::string& rFileName ) + { + FILE* pFile = fopen( rFileName.c_str(), "wb" ); + if( pFile == NULL ) + return; + + DataHashtable::const_iterator aEnd = _hash.end(); + for (DataHashtable::const_iterator aIter = _hash.begin(); aIter != aEnd; ++aIter) + writeKeyValue_DBHelp( pFile, aIter->first, aIter->second.getString() ); + + fclose( pFile ); + } +}; + +class HelpLinker +{ +public: + void main(std::vector<std::string> &args, std::string* pExtensionPath = NULL ) + throw( HelpProcessingException ); + + HelpLinker() + : init(true) + , m_pIndexerPreProcessor(NULL) + {} + ~HelpLinker() + { delete m_pIndexerPreProcessor; } + +private: + int locCount, totCount; + Stringtable additionalFiles; + HashSet helpFiles; + fs::path sourceRoot; + fs::path embeddStylesheet; + fs::path idxCaptionStylesheet; + fs::path idxContentStylesheet; + fs::path zipdir; + fs::path outputFile; + std::string module; + std::string lang; + std::string hid; + std::string extensionPath; + bool bExtensionMode; + fs::path indexDirName; + Stringtable hidlistTranslation; + fs::path indexDirParentName; + bool init; + IndexerPreProcessor* m_pIndexerPreProcessor; + void initIndexerPreProcessor(); + void link() throw( HelpProcessingException ); + void addBookmark( DB* dbBase, FILE* pFile_DBHelp, std::string thishid, + const std::string& fileB, const std::string& anchorB, + const std::string& jarfileB, const std::string& titleB ); +#if 0 + /** + * @param outputFile + * @param module + * @param lang + * @param hid + * @param helpFiles + * @param additionalFiles + */ + + private HelpURLStreamHandlerFactory urlHandler = null; +#endif +}; + +namespace URLEncoder +{ + static std::string encode(const std::string &rIn) + { + const char *good = "!$&'()*+,-.=@_"; + static const char hex[17] = "0123456789ABCDEF"; + + std::string result; + for (size_t i=0; i < rIn.length(); ++i) + { + unsigned char c = rIn[i]; + if (isalnum (c) || strchr (good, c)) + result += c; + else { + result += '%'; + result += hex[c >> 4]; + result += hex[c & 0xf]; + } + } + return result; + } +} + +void HelpLinker::addBookmark( DB* dbBase, FILE* pFile_DBHelp, std::string thishid, + const std::string& fileB, const std::string& anchorB, + const std::string& jarfileB, const std::string& titleB) +{ + HCDBG(std::cerr << "HelpLinker::addBookmark " << thishid << " " << + fileB << " " << anchorB << " " << jarfileB << " " << titleB << std::endl); + + std::string temp = thishid; + std::transform (temp.begin(), temp.end(), temp.begin(), toupper); + std::replace(temp.begin(), temp.end(), ':', '_'); + const std::string& translatedHid = hidlistTranslation[temp]; + if (!translatedHid.empty()) + thishid = translatedHid; + + thishid = URLEncoder::encode(thishid); + + DBT key; + memset(&key, 0, sizeof(key)); + key.data = const_cast<char*>(thishid.c_str()); + key.size = thishid.length(); + + int fileLen = fileB.length(); + if (!anchorB.empty()) + fileLen += (1 + anchorB.length()); + int dataLen = 1 + fileLen + 1 + jarfileB.length() + 1 + titleB.length(); + + std::vector<unsigned char> dataB(dataLen); + size_t i = 0; + dataB[i++] = static_cast<unsigned char>(fileLen); + for (size_t j = 0; j < fileB.length(); ++j) + dataB[i++] = fileB[j]; + if (!anchorB.empty()) + { + dataB[i++] = '#'; + for (size_t j = 0; j < anchorB.length(); ++j) + dataB[i++] = anchorB[j]; + } + dataB[i++] = static_cast<unsigned char>(jarfileB.length()); + for (size_t j = 0; j < jarfileB.length(); ++j) + dataB[i++] = jarfileB[j]; + + dataB[i++] = static_cast<unsigned char>(titleB.length()); + for (size_t j = 0; j < titleB.length(); ++j) + dataB[i++] = titleB[j]; + + DBT data; + memset(&data, 0, sizeof(data)); + data.data = &dataB[0]; + data.size = dataB.size(); + + if( dbBase != NULL ) + dbBase->put(dbBase, NULL, &key, &data, 0); + + if( pFile_DBHelp != NULL ) + { + std::string aValueStr( dataB.begin(), dataB.end() ); + writeKeyValue_DBHelp( pFile_DBHelp, thishid, aValueStr ); + } +} + +void HelpLinker::initIndexerPreProcessor() +{ + if( m_pIndexerPreProcessor ) + delete m_pIndexerPreProcessor; + std::string mod = module; + std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + m_pIndexerPreProcessor = new IndexerPreProcessor( mod, indexDirParentName, + idxCaptionStylesheet, idxContentStylesheet ); +} + +/** +* +*/ +void HelpLinker::link() throw( HelpProcessingException ) +{ + bool bIndexForExtension = true;
+
+ if( bExtensionMode ) + { + indexDirParentName = sourceRoot; + } + else + { + indexDirParentName = zipdir; + fs::create_directory(indexDirParentName); + } + +#ifdef CMC_DEBUG + std::cerr << "will not delete tmpdir of " << indexDirParentName.native_file_string().c_str() << std::endl; +#endif + + std::string mod = module; + std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + + // do the work here + // continue with introduction of the overall process thing into the + // here all hzip files will be worked on + std::string appl = mod; + if (appl[0] == 's') + appl = appl.substr(1); + + bool bUse_ = true; +#ifdef DBHELP_ONLY + if( !bExtensionMode ) + bUse_ = false; +#endif + + DB* helpText(0); +#ifndef DBHELP_ONLY + fs::path helpTextFileName(indexDirParentName / (mod + ".ht")); + db_create(&helpText,0,0); + helpText->open(helpText, NULL, helpTextFileName.native_file_string().c_str(), NULL, DB_BTREE, + DB_CREATE | DB_TRUNCATE, 0644); +#endif + + fs::path helpTextFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".ht_" : ".ht"))); + FILE* pFileHelpText_DBHelp = fopen + ( helpTextFileName_DBHelp.native_file_string().c_str(), "wb" ); + + DB* dbBase(0); +#ifndef DBHELP_ONLY + fs::path dbBaseFileName(indexDirParentName / (mod + ".db")); + db_create(&dbBase,0,0); + dbBase->open(dbBase, NULL, dbBaseFileName.native_file_string().c_str(), NULL, DB_BTREE, + DB_CREATE | DB_TRUNCATE, 0644); +#endif + + fs::path dbBaseFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".db_" : ".db"))); + FILE* pFileDbBase_DBHelp = fopen + ( dbBaseFileName_DBHelp.native_file_string().c_str(), "wb" ); + +#ifndef DBHELP_ONLY + DB* keyWord(0); + fs::path keyWordFileName(indexDirParentName / (mod + ".key")); + db_create(&keyWord,0,0); + keyWord->open(keyWord, NULL, keyWordFileName.native_file_string().c_str(), NULL, DB_BTREE, + DB_CREATE | DB_TRUNCATE, 0644); +#endif + + fs::path keyWordFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".key_" : ".key"))); + + HelpKeyword helpKeyword; + + // catch HelpProcessingException to avoid locking data bases + try + { + + std::ifstream fileReader(hid.c_str()); + while (fileReader) + { + std::string key; + fileReader >> key; + std::transform (key.begin(), key.end(), key.begin(), toupper); + std::replace(key.begin(), key.end(), ':', '_'); + std::string data; + fileReader >> data; + if (!key.empty() && !data.empty()) + hidlistTranslation[key] = data; + } + fileReader.close(); + + // lastly, initialize the indexBuilder + if ( (!bExtensionMode || bIndexForExtension) && !helpFiles.empty()) + initIndexerPreProcessor(); + + if( !bExtensionMode ) + { +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( + std::cout << "Making " << outputFile.native_file_string() << + " from " << helpFiles.size() << " input files" << std::endl; +#endif + } + + // here we start our loop over the hzip files. + HashSet::iterator end = helpFiles.end(); + for (HashSet::iterator iter = helpFiles.begin(); iter != end; ++iter) + { + if( !bExtensionMode ) + { + std::cout << "."; + std::cout.flush(); + } + + // process one file + // streamTable contains the streams in the hzip file + StreamTable streamTable; + const std::string &xhpFileName = *iter; + + if (!bExtensionMode && xhpFileName.rfind(".xhp") != xhpFileName.length()-4) + { + // only work on .xhp - files + std::cerr << + "ERROR: input list entry '" + << xhpFileName + << "' has the wrong extension (only files with extension .xhp " + << "are accepted)"; + continue; + } + + fs::path langsourceRoot(sourceRoot); + fs::path xhpFile; + + if( bExtensionMode ) + { + // langsourceRoot == sourceRoot for extensions + std::string xhpFileNameComplete( extensionPath ); + xhpFileNameComplete.append( '/' + xhpFileName ); + xhpFile = fs::path( xhpFileNameComplete ); + } + else + { + langsourceRoot.append('/' + lang + '/'); + xhpFile = fs::path(xhpFileName, fs::native); + } + + HelpCompiler hc( streamTable, xhpFile, langsourceRoot, + embeddStylesheet, module, lang, bExtensionMode ); + + HCDBG(std::cerr << "before compile of " << xhpFileName << std::endl); + bool success = hc.compile(); + HCDBG(std::cerr << "after compile of " << xhpFileName << std::endl); + + if (!success && !bExtensionMode) + { + std::stringstream aStrStream; + aStrStream << + "\nERROR: compiling help particle '" + << xhpFileName + << "' for language '" + << lang + << "' failed!"; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + const std::string documentBaseId = streamTable.document_id; + std::string documentPath = streamTable.document_path; + if (documentPath.find("/") == 0) + documentPath = documentPath.substr(1); + + std::string documentJarfile = streamTable.document_module + ".jar"; + + std::string documentTitle = streamTable.document_title; + if (documentTitle.empty()) + documentTitle = "<notitle>"; + +#if 0 + std::cout << "for " << xhpFileName << " documentBaseId is " << documentBaseId << "\n"; + std::cout << "for " << xhpFileName << " documentPath is " << documentPath << "\n"; + std::cout << "for " << xhpFileName << " documentJarfile is " << documentJarfile << "\n"; + std::cout << "for " << xhpFileName << " documentPath is " << documentTitle << "\n"; +#endif + + const std::string& fileB = documentPath; + const std::string& jarfileB = documentJarfile; + std::string& titleB = documentTitle; + + // add once this as its own id. + addBookmark(dbBase, pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB); + + // first the database *.db + // ByteArrayInputStream bais = null; + // ObjectInputStream ois = null; + + const HashSet *hidlist = streamTable.appl_hidlist; + if (!hidlist) + hidlist = streamTable.default_hidlist; + if (hidlist && !hidlist->empty()) + { + // now iterate over all elements of the hidlist + HashSet::const_iterator aEnd = hidlist->end(); + for (HashSet::const_iterator hidListIter = hidlist->begin(); + hidListIter != aEnd; ++hidListIter) + { + std::string thishid = *hidListIter; + + std::string anchorB; + size_t index = thishid.rfind('#'); + if (index != std::string::npos) + { + anchorB = thishid.substr(1 + index); + thishid = thishid.substr(0, index); + } + addBookmark(dbBase, pFileDbBase_DBHelp, thishid, fileB, anchorB, jarfileB, titleB); + } + } + + // now the keywords + const Hashtable *anchorToLL = streamTable.appl_keywords; + if (!anchorToLL) + anchorToLL = streamTable.default_keywords; + if (anchorToLL && !anchorToLL->empty()) + { + std::string fakedHid = URLEncoder::encode(documentPath); + Hashtable::const_iterator aEnd = anchorToLL->end(); + for (Hashtable::const_iterator enumer = anchorToLL->begin(); + enumer != aEnd; ++enumer) + { + const std::string &anchor = enumer->first; + addBookmark(dbBase, pFileDbBase_DBHelp, documentPath, fileB, + anchor, jarfileB, titleB); + std::string totalId = fakedHid + "#" + anchor; + // std::cerr << hzipFileName << std::endl; + const LinkedList& ll = enumer->second; + LinkedList::const_iterator aOtherEnd = ll.end(); + for (LinkedList::const_iterator llIter = ll.begin(); + llIter != aOtherEnd; ++llIter) + { + helpKeyword.insert(*llIter, totalId); + } + } + + } + + // and last the helptexts + const Stringtable *helpTextHash = streamTable.appl_helptexts; + if (!helpTextHash) + helpTextHash = streamTable.default_helptexts; + if (helpTextHash && !helpTextHash->empty()) + { + Stringtable::const_iterator aEnd = helpTextHash->end(); + for (Stringtable::const_iterator helpTextIter = helpTextHash->begin(); + helpTextIter != aEnd; ++helpTextIter) + { + std::string helpTextId = helpTextIter->first; + const std::string& helpTextText = helpTextIter->second; + + std::string temp = helpTextId; + std::transform (temp.begin(), temp.end(), temp.begin(), toupper); + std::replace(temp.begin(), temp.end(), ':', '_'); + + const std::string& tHid = hidlistTranslation[temp]; + if (!tHid.empty()) + helpTextId = tHid; + helpTextId = URLEncoder::encode(helpTextId); + + DBT keyDbt; + memset(&keyDbt, 0, sizeof(keyDbt)); + keyDbt.data = const_cast<char*>(helpTextId.c_str()); + keyDbt.size = helpTextId.length(); + + DBT textDbt; + memset(&textDbt, 0, sizeof(textDbt)); + textDbt.data = const_cast<char*>(helpTextText.c_str()); + textDbt.size = helpTextText.length(); + + if( helpText != NULL ) + helpText->put(helpText, NULL, &keyDbt, &textDbt, 0); + + if( pFileHelpText_DBHelp != NULL ) + writeKeyValue_DBHelp( pFileHelpText_DBHelp, helpTextId, helpTextText ); + } + } + + //IndexerPreProcessor + if( !bExtensionMode || bIndexForExtension ) + { + // now the indexing + xmlDocPtr document = streamTable.appl_doc; + if (!document) + document = streamTable.default_doc; + if (document) + { + std::string temp = module; + std::transform (temp.begin(), temp.end(), temp.begin(), tolower); + m_pIndexerPreProcessor->processDocument(document, URLEncoder::encode(documentPath) ); + } + } + + } // while loop over hzip files ending + if( !bExtensionMode ) + std::cout << std::endl; + + } // try + catch( HelpProcessingException& ) + { + // catch HelpProcessingException to avoid locking data bases +#ifndef DBHELP_ONLY + helpText->close(helpText, 0); + dbBase->close(dbBase, 0); + keyWord->close(keyWord, 0); +#endif + if( pFileHelpText_DBHelp != NULL ) + fclose( pFileHelpText_DBHelp ); + if( pFileDbBase_DBHelp != NULL ) + fclose( pFileDbBase_DBHelp ); + throw; + } + +#ifndef DBHELP_ONLY + helpText->close(helpText, 0); + dbBase->close(dbBase, 0); + helpKeyword.dump(keyWord); + keyWord->close(keyWord, 0); +#endif + if( pFileHelpText_DBHelp != NULL ) + fclose( pFileHelpText_DBHelp ); + if( pFileDbBase_DBHelp != NULL ) + fclose( pFileDbBase_DBHelp ); + + helpKeyword.dump_DBHelp( keyWordFileName_DBHelp.native_file_string() ); + + if( !bExtensionMode ) + { + // New index + Stringtable::iterator aEnd = additionalFiles.end(); + for (Stringtable::iterator enumer = additionalFiles.begin(); enumer != aEnd; + ++enumer) + { + const std::string &additionalFileName = enumer->second; + const std::string &additionalFileKey = enumer->first; + + fs::path fsAdditionalFileName( additionalFileName, fs::native ); + std::string aNativeStr = fsAdditionalFileName.native_file_string(); + const char* pStr = aNativeStr.c_str(); + std::cerr << pStr; + + fs::path fsTargetName( indexDirParentName / additionalFileKey ); + + fs::copy( fsAdditionalFileName, fsTargetName ); + } + } + +/* + ///////////////////////////////////////////////////////////////////////// + /// remove temprary directory for index creation + ///////////////////////////////////////////////////////////////////////// +#ifndef CMC_DEBUG + if( !bExtensionMode ) + fs::remove_all( indexDirParentName ); +#endif +*/ +} + + +void HelpLinker::main(std::vector<std::string> &args, std::string* pExtensionPath) + throw( HelpProcessingException ) +{ + rtl::OUString aOfficeHelpPath; + + bExtensionMode = false; + if( pExtensionPath && pExtensionPath->length() > 0 ) + { + helpFiles.clear(); + bExtensionMode = true; + extensionPath = *pExtensionPath; + sourceRoot = fs::path(extensionPath); + + aOfficeHelpPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/help") ); + rtl::Bootstrap::expandMacros( aOfficeHelpPath ); + } + if (args.size() > 0 && args[0][0] == '@') + { + std::vector<std::string> stringList; + std::string strBuf; + std::ifstream fileReader(args[0].substr(1).c_str()); + + while (fileReader) + { + std::string token; + fileReader >> token; + if (!token.empty()) + stringList.push_back(token); + } + fileReader.close(); + + args = stringList; + } + + size_t i = 0; + + while (i < args.size()) + { + if (args[i].compare("-src") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "sourceroot missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + if( !bExtensionMode ) + sourceRoot = fs::path(args[i], fs::native); + } + else if (args[i].compare("-sty") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "embeddingStylesheet missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + embeddStylesheet = fs::path(args[i], fs::native); + } + else if (args[i].compare("-zipdir") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "idxtemp missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + zipdir = fs::path(args[i], fs::native); + } + else if (args[i].compare("-idxcaption") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "idxcaption stylesheet missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + idxCaptionStylesheet = fs::path(args[i], fs::native); + } + else if (args[i].compare("-idxcontent") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "idxcontent stylesheet missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + idxContentStylesheet = fs::path(args[i], fs::native); + } + else if (args[i].compare("-o") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "outputfilename missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + outputFile = fs::path(args[i], fs::native); + } + else if (args[i].compare("-mod") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "module name missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + module = args[i]; + } + else if (args[i].compare("-lang") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "language name missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + lang = args[i]; + } + else if (args[i].compare("-hid") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "hid list missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + hid = args[i]; + } + else if (args[i].compare("-add") == 0) + { + std::string addFile, addFileUnderPath; + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "pathname missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + addFileUnderPath = args[i]; + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "pathname missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + addFile = args[i]; + if (!addFileUnderPath.empty() && !addFile.empty()) + additionalFiles[addFileUnderPath] = addFile; + } + else + helpFiles.push_back(args[i]); + ++i; + } + + if (!bExtensionMode && zipdir.empty()) + { + std::stringstream aStrStream; + aStrStream << "no index dir given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (!bExtensionMode && idxCaptionStylesheet.empty()) + { + std::stringstream aStrStream; + aStrStream << "no index caption stylesheet given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + else if ( bExtensionMode )
+ {
+ rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath );
+ aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" );
+
+ rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString + ( aIdxCaptionPathFileURL, fs::getThreadTextEncoding() ) ); + std::string aStdStr_IdxCaptionPathFileURL( aOStr_IdxCaptionPathFileURL.getStr() ); +
+ idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
+ }
+ if (!bExtensionMode && idxContentStylesheet.empty()) + { + std::stringstream aStrStream; + aStrStream << "no index content stylesheet given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + else if ( bExtensionMode )
+ {
+ rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath );
+ aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" );
+
+ rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString + ( aIdxContentPathFileURL, fs::getThreadTextEncoding() ) ); + std::string aStdStr_IdxContentPathFileURL( aOStr_IdxContentPathFileURL.getStr() ); +
+ idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL );
+ }
+ if (!bExtensionMode && embeddStylesheet.empty()) + { + std::stringstream aStrStream; + aStrStream << "no embedding resolving file given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (sourceRoot.empty()) + { + std::stringstream aStrStream; + aStrStream << "no sourceroot given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (!bExtensionMode && outputFile.empty()) + { + std::stringstream aStrStream; + aStrStream << "no output file given" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (module.empty()) + { + std::stringstream aStrStream; + aStrStream << "module missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (!bExtensionMode && lang.empty()) + { + std::stringstream aStrStream; + aStrStream << "language missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + if (!bExtensionMode && hid.empty()) + { + std::stringstream aStrStream; + aStrStream << "hid list missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + + link(); +} + +int main(int argc, char**argv) +{ + sal_uInt32 starttime = osl_getGlobalTimer(); + std::vector<std::string> args; + for (int i = 1; i < argc; ++i) + args.push_back(std::string(argv[i])); + try + { + HelpLinker* pHelpLinker = new HelpLinker(); + pHelpLinker->main( args ); + delete pHelpLinker; + } + catch( const HelpProcessingException& e ) + { + std::cerr << e.m_aErrorMsg; + exit(1); + } + sal_uInt32 endtime = osl_getGlobalTimer(); +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( + std::cout << "time taken was " << (endtime-starttime)/1000.0 << " seconds" << std::endl; +#endif + return 0; +} + +// Variable to set an exception in "C" StructuredXMLErrorFunction +static const HelpProcessingException* GpXMLParsingException = NULL; + +extern "C" void StructuredXMLErrorFunction(void *userData, xmlErrorPtr error) +{ + (void)userData; + (void)error; + + std::string aErrorMsg = error->message; + std::string aXMLParsingFile; + if( error->file != NULL ) + aXMLParsingFile = error->file; + int nXMLParsingLine = error->line; + HelpProcessingException* pException = new HelpProcessingException( aErrorMsg, aXMLParsingFile, nXMLParsingLine ); + GpXMLParsingException = pException; + + // Reset error handler + xmlSetStructuredErrorFunc( NULL, NULL ); +} + +HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpProcessingException& e ) +{ + m_eErrorClass = e.m_eErrorClass; + rtl::OString tmpErrorMsg( e.m_aErrorMsg.c_str() ); + m_aErrorMsg = rtl::OStringToOUString( tmpErrorMsg, fs::getThreadTextEncoding() ); + rtl::OString tmpXMLParsingFile( e.m_aXMLParsingFile.c_str() ); + m_aXMLParsingFile = rtl::OStringToOUString( tmpXMLParsingFile, fs::getThreadTextEncoding() ); + m_nXMLParsingLine = e.m_nXMLParsingLine; + return *this; +} + + +// Returns true in case of success, false in case of error +HELPLINKER_DLLPUBLIC bool compileExtensionHelp +( + const rtl::OUString& aExtensionName, + const rtl::OUString& aExtensionLanguageRoot, + sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, + HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo +) +{ + bool bSuccess = true; + + sal_Int32 argc = nXhpFileCount + 3; + const char** argv = new const char*[argc]; + argv[0] = ""; + argv[1] = "-mod"; + rtl::OString aOExtensionName = rtl::OUStringToOString( aExtensionName, fs::getThreadTextEncoding() ); + argv[2] = aOExtensionName.getStr(); + + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = pXhpFiles[iXhp]; + + rtl::OString aOXhpFile = rtl::OUStringToOString( aXhpFile, fs::getThreadTextEncoding() ); + char* pArgStr = new char[aOXhpFile.getLength() + 1]; + strcpy( pArgStr, aOXhpFile.getStr() ); + argv[iXhp + 3] = pArgStr; + } + + std::vector<std::string> args; + for( sal_Int32 i = 1; i < argc; ++i ) + args.push_back(std::string( argv[i]) ); + + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + delete argv[iXhp + 3]; + delete[] argv; + + rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() ); + const char* pExtensionPath = aOExtensionLanguageRoot.getStr(); + std::string aStdStrExtensionPath = pExtensionPath; + + // Set error handler + xmlSetStructuredErrorFunc( NULL, (xmlStructuredErrorFunc)StructuredXMLErrorFunction ); + try + { + HelpLinker* pHelpLinker = new HelpLinker(); + pHelpLinker->main( args,&aStdStrExtensionPath ); + delete pHelpLinker; + } + catch( const HelpProcessingException& e ) + { + if( GpXMLParsingException != NULL ) + { + o_rHelpProcessingErrorInfo = *GpXMLParsingException; + delete GpXMLParsingException; + GpXMLParsingException = NULL; + } + else + { + o_rHelpProcessingErrorInfo = e; + } + bSuccess = false; + } + // Reset error handler + xmlSetStructuredErrorFunc( NULL, NULL ); + + // i83624: Tree files + ::rtl::OUString aTreeFileURL = aExtensionLanguageRoot; + aTreeFileURL += rtl::OUString::createFromAscii( "/help.tree" ); + osl::DirectoryItem aTreeFileItem; + osl::FileBase::RC rcGet = osl::DirectoryItem::get( aTreeFileURL, aTreeFileItem ); + osl::FileStatus aFileStatus( FileStatusMask_FileSize ); + if( rcGet == osl::FileBase::E_None && + aTreeFileItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None && + aFileStatus.isValid( FileStatusMask_FileSize ) ) + { + sal_uInt64 ret, len = aFileStatus.getFileSize(); + char* s = new char[ int(len) ]; // the buffer to hold the installed files + osl::File aFile( aTreeFileURL ); + aFile.open( OpenFlag_Read ); + aFile.read( s, len, ret ); + aFile.close(); + + XML_Parser parser = XML_ParserCreate( 0 ); + int parsed = XML_Parse( parser, s, int( len ), true ); + + if( parsed == 0 ) + { + XML_Error nError = XML_GetErrorCode( parser ); + o_rHelpProcessingErrorInfo.m_eErrorClass = HELPPROCESSING_XMLPARSING_ERROR; + o_rHelpProcessingErrorInfo.m_aErrorMsg = rtl::OUString::createFromAscii( XML_ErrorString( nError ) );; + o_rHelpProcessingErrorInfo.m_aXMLParsingFile = aTreeFileURL; + // CRAHSES!!! o_rHelpProcessingErrorInfo.m_nXMLParsingLine = XML_GetCurrentLineNumber( parser ); + bSuccess = false; + } + + XML_ParserFree( parser ); + delete[] s; + } + + return bSuccess; +} + +// vnd.sun.star.help://swriter/52821?Language=en-US&System=UNIX +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ + diff --git a/transex3/source/help/MANIFEST.MF b/transex3/source/help/MANIFEST.MF new file mode 100644 index 000000000000..bf0e4ab46cb2 --- /dev/null +++ b/transex3/source/help/MANIFEST.MF @@ -0,0 +1,2 @@ +RegistrationClassName: com.sun.star.help.HelpComponent +Class-Path: lucene-core-2.3.jar lucene-analyzers-2.3.jar diff --git a/transex3/source/help/compilehelp.hxx b/transex3/source/help/compilehelp.hxx new file mode 100644 index 000000000000..1e9a1c8604b8 --- /dev/null +++ b/transex3/source/help/compilehelp.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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: compilehelp.hxx,v $ + * $Revision: 1.3 $ + * + * 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 COMPILE_HXX +#define COMPILE_HXX + +#include "sal/types.h" + +#if defined(HELPLINKER_DLLIMPLEMENTATION) +#define HELPLINKER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define HELPLINKER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define HELPLINKER_DLLPRIVATE SAL_DLLPRIVATE + + +//#include <helplinkerdllapi.h> +#include <rtl/ustring.hxx> + +enum HelpProcessingErrorClass +{ + HELPPROCESSING_NO_ERROR, + HELPPROCESSING_GENERAL_ERROR, // Missing files, options etc. + HELPPROCESSING_INTERNAL_ERROR, // Unexpected problems + HELPPROCESSING_XMLPARSING_ERROR // Errors thrown by libxml +}; + +struct HelpProcessingErrorInfo +{ + HelpProcessingErrorClass m_eErrorClass; + rtl::OUString m_aErrorMsg; + rtl::OUString m_aXMLParsingFile; + sal_Int32 m_nXMLParsingLine; + + HelpProcessingErrorInfo( void ) + : m_eErrorClass( HELPPROCESSING_NO_ERROR ) + , m_nXMLParsingLine( -1 ) + {} + + HelpProcessingErrorInfo& operator=( const struct HelpProcessingException& e ); +}; + + +// Returns true in case of success, false in case of error +HELPLINKER_DLLPUBLIC bool compileExtensionHelp +( + const rtl::OUString& aExtensionName, + const rtl::OUString& aExtensionLanguageRoot, + sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, + HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo +); + +#endif diff --git a/transex3/source/help/helplinker.pmk b/transex3/source/help/helplinker.pmk new file mode 100644 index 000000000000..569c5f4dbdee --- /dev/null +++ b/transex3/source/help/helplinker.pmk @@ -0,0 +1,35 @@ +#************************************************************************* +# +# 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: helplinker.pmk,v $ +# +# $Revision: 1.4 $ +# +# 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. +# +#************************************************************************* + +# define HELPLINKER_DLLIMPLEMENTATION (see @ inc/xmlhelp/helplinkerdllapi.h) +CDEFS += -DHELPLINKER_DLLIMPLEMENTATION + +VISIBILITY_HIDDEN=TRUE diff --git a/transex3/source/help/makefile.mk b/transex3/source/help/makefile.mk new file mode 100644 index 000000000000..edf68d906133 --- /dev/null +++ b/transex3/source/help/makefile.mk @@ -0,0 +1,139 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.38 $ +# +# 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 = xmlhelp +TARGET = HelpLinker +LIBBASENAME = helplinker +PACKAGE = com$/sun$/star$/help +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : helplinker.pmk + +.IF "$(SYSTEM_LIBXSLT)" == "YES" +CFLAGS+= $(LIBXSLT_CFLAGS) +.ELSE +LIBXSLTINCDIR=external$/libxslt +CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) +.ENDIF + +.IF "$(SYSTEM_DB)" == "YES" +CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) +.ENDIF + +.IF "$(SYSTEM_EXPAT)" == "YES" +CFLAGS+=-DSYSTEM_EXPAT +.ENDIF + +OBJFILES=\ + $(OBJ)$/HelpLinker.obj \ + $(OBJ)$/HelpCompiler.obj +SLOFILES=\ + $(SLO)$/HelpLinker.obj \ + $(SLO)$/HelpCompiler.obj + +EXCEPTIONSFILES=\ + $(OBJ)$/HelpLinker.obj \ + $(OBJ)$/HelpCompiler.obj \ + $(SLO)$/HelpLinker.obj \ + $(SLO)$/HelpCompiler.obj +.IF "$(OS)" == "MACOSX" && "$(CPU)" == "P" && "$(COM)" == "GCC" +# There appears to be a GCC 4.0.1 optimization error causing _file:good() to +# report true right before the call to writeOut at HelpLinker.cxx:1.12 l. 954 +# but out.good() to report false right at the start of writeOut at +# HelpLinker.cxx:1.12 l. 537: +NOOPTFILES=\ + $(OBJ)$/HelpLinker.obj \ + $(SLO)$/HelpLinker.obj +.ENDIF + +APP1TARGET= $(TARGET) +APP1OBJS=\ + $(OBJ)$/HelpLinker.obj \ + $(OBJ)$/HelpCompiler.obj + +APP1STDLIBS+=$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) + +SHL1TARGET =$(LIBBASENAME)$(DLLPOSTFIX) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1IMPLIB =i$(LIBBASENAME) +SHL1DEF =$(MISC)$/$(SHL1TARGET).def +SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) +SHL1USE_EXPORTS =ordinal + +DEF1NAME =$(SHL1TARGET) +DEFLIB1NAME =$(TARGET) + +JAVAFILES = \ + HelpIndexerTool.java \ + HelpFileDocument.java + + +JAVACLASSFILES = \ + $(CLASSDIR)$/$(PACKAGE)$/HelpIndexerTool.class \ + $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class + + +# $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ +# $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class \ +# $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ +# $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class + +#JARFILES = ridl.jar jurt.jar unoil.jar juh.jar +.IF "$(SYSTEM_LUCENE)" == "YES" +CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR) +COMP=fix_system_lucene +.ELSE +JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar +.ENDIF +JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) +#JAVAFILES = $(JAVACLASSFILES) + +JARCLASSDIRS = $(PACKAGE)/* +JARTARGET = HelpIndexerTool.jar +JARCOMPRESS = TRUE +#CUSTOMMANIFESTFILE = MANIFEST.MF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +.IF "$(JARTARGETN)"!="" +$(JARTARGETN) : $(COMP) +.ENDIF + +fix_system_lucene: + @echo "Fix Java Class-Path entry for Lucene libraries from system." + @$(SED) -r -e "s#^(Class-Path:).*#\1 file://$(LUCENE_CORE_JAR) file://$(LUCENE_ANALYZERS_JAR)#" \ + -i ../../$(INPATH)/class/HelpLinker/META-INF/MANIFEST.MF diff --git a/ucbhelper/inc/ucbhelper/interactionrequest.hxx b/ucbhelper/inc/ucbhelper/interactionrequest.hxx index b66a07caceb7..f23041d0caa2 100644 --- a/ucbhelper/inc/ucbhelper/interactionrequest.hxx +++ b/ucbhelper/inc/ucbhelper/interactionrequest.hxx @@ -38,7 +38,7 @@ #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/task/XInteractionDisapprove.hpp> #include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp> -#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> +#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp> #include <com/sun/star/ucb/XInteractionSupplyName.hpp> #include <rtl/ref.hxx> #include <cppuhelper/weak.hxx> @@ -342,7 +342,7 @@ public: class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication : public InteractionContinuation, public com::sun::star::lang::XTypeProvider, - public com::sun::star::ucb::XInteractionSupplyAuthentication + public com::sun::star::ucb::XInteractionSupplyAuthentication2 { com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication > m_aRememberPasswordModes; @@ -360,6 +360,9 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication : unsigned m_bCanSetUserName : 1; unsigned m_bCanSetPassword : 1; unsigned m_bCanSetAccount : 1; + unsigned m_bCanUseSystemCredentials : 1; + unsigned m_bDefaultUseSystemCredentials : 1; + unsigned m_bUseSystemCredentials : 1; public: /** @@ -382,7 +385,7 @@ public: sal_Bool bCanSetRealm, sal_Bool bCanSetUserName, sal_Bool bCanSetPassword, - sal_Bool bCanSetAccount ); + sal_Bool bCanSetAccount); /** * Constructor. * @@ -408,6 +411,11 @@ public: * @param eDefaultRememberAccountMode specifies the default * authentication-remember-mode for accounts preferred by the * requesting client. + * @param bCanUseSystemCredentials indicates whether issuer of the + * authetication request can obtain and use system credentials + * for authentication. + * @param bDefaultUseSystemCredentials specifies the default system + * credentials usage preferred by the requesting client * * @see com::sun::star::ucb::AuthenticationRequest * @see com::sun::star::ucb::RememberAuthentication @@ -427,7 +435,9 @@ public: com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes, const com::sun::star::ucb::RememberAuthentication - eDefaultRememberAccountMode ); + eDefaultRememberAccountMode, + sal_Bool bCanUseSystemCredentials, + sal_Bool bDefaultUseSystemCredentials ); // XInterface virtual com::sun::star::uno::Any SAL_CALL @@ -497,6 +507,12 @@ public: setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember ) throw( com::sun::star::uno::RuntimeException ); + // XInteractionSupplyAuthentication2 + virtual ::sal_Bool SAL_CALL canUseSystemCredentials( ::sal_Bool& Default ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setUseSystemCredentials( ::sal_Bool UseSystemCredentials ) + throw ( ::com::sun::star::uno::RuntimeException ); + // Non-interface methods. /** @@ -548,6 +564,8 @@ public: */ const com::sun::star::ucb::RememberAuthentication & getRememberAccountMode() const { return m_eRememberAccountMode; } + + sal_Bool getUseSystemCredentials() const { return m_bUseSystemCredentials; } }; //============================================================================ @@ -571,7 +589,10 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication( m_bCanSetRealm( bCanSetRealm ), m_bCanSetUserName( bCanSetUserName ), m_bCanSetPassword( bCanSetPassword ), - m_bCanSetAccount( bCanSetAccount ) + m_bCanSetAccount( bCanSetAccount ), + m_bCanUseSystemCredentials( sal_False ), + m_bDefaultUseSystemCredentials( sal_False ), + m_bUseSystemCredentials( sal_False ) { m_aRememberPasswordModes[ 0 ] = com::sun::star::ucb::RememberAuthentication_NO; @@ -593,7 +614,9 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication( const com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes, const com::sun::star::ucb::RememberAuthentication - eDefaultRememberAccountMode ) + eDefaultRememberAccountMode, + sal_Bool bCanUseSystemCredentials, + sal_Bool bDefaultUseSystemCredentials ) : InteractionContinuation( pRequest ), m_aRememberPasswordModes( rRememberPasswordModes ), m_aRememberAccountModes( rRememberAccountModes ), @@ -604,7 +627,10 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication( m_bCanSetRealm( bCanSetRealm ), m_bCanSetUserName( bCanSetUserName ), m_bCanSetPassword( bCanSetPassword ), - m_bCanSetAccount( bCanSetAccount ) + m_bCanSetAccount( bCanSetAccount ), + m_bCanUseSystemCredentials( bCanUseSystemCredentials ), + m_bDefaultUseSystemCredentials( bDefaultUseSystemCredentials ), + m_bUseSystemCredentials( bDefaultUseSystemCredentials & bCanUseSystemCredentials ) { } diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx index ddb2e655de8b..13061ca0238f 100644 --- a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx +++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx @@ -33,9 +33,12 @@ #include <rtl/ref.hxx> #include <ucbhelper/interactionrequest.hxx> -#include <com/sun/star/ucb/AuthenticationRequest.hpp> #include "ucbhelper/ucbhelperdllapi.h" +namespace com { namespace sun { namespace star { namespace ucb { + class URLAuthenticationRequest; +} } } } + namespace ucbhelper { /** @@ -63,12 +66,13 @@ class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::Intera ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; private: - void initialize( ::com::sun::star::ucb::AuthenticationRequest aRequest, - const sal_Bool & bCanSetRealm, - const sal_Bool & bCanSetUserName, - const sal_Bool & bCanSetPassword, - const sal_Bool & bCanSetAccount, - const sal_Bool & bAllowPersistentStoring ); + void initialize( const ::com::sun::star::ucb::URLAuthenticationRequest & rRequest, + sal_Bool bCanSetRealm, + sal_Bool bCanSetUserName, + sal_Bool bCanSetPassword, + sal_Bool bCanSetAccount, + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ); public: /** Specification whether some entity (realm, username, password, account) @@ -84,6 +88,7 @@ public: /** * Constructor. * + * @param rURL contains a URL for which authentication is requested. * @param rServerName contains a server name. * @param rRealm contains a realm, if applicable. * @param rUserName contains a username, if available (for instance from @@ -92,7 +97,8 @@ public: * a previous try). * @param rAccount contains an account, if applicable. */ - SimpleAuthenticationRequest( const rtl::OUString & rServerName, + SimpleAuthenticationRequest( const rtl::OUString & rURL, + const rtl::OUString & rServerName, const rtl::OUString & rRealm, const rtl::OUString & rUserName, const rtl::OUString & rPassword, @@ -102,6 +108,7 @@ public: /** * Constructor. * + * @param rURL contains a URL for which authentication is requested. * @param rServerName contains a server name. * @param rRealm contains a realm, if applicable. * @param rUserName contains a username, if available (for instance from @@ -109,14 +116,19 @@ public: * @param rPassword contains a password, if available (for instance from * a previous try). * @param rAccount contains an account, if applicable. - * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently + * @param bAllowPersistentStoring specifies if the credentials should + * be stored in the passowrd container persistently + * @param bAllowUseSystemCredntials specifies if requesting client is + * able to obtain and use system credentials for authentication */ - SimpleAuthenticationRequest( const rtl::OUString & rServerName, + SimpleAuthenticationRequest( const rtl::OUString & rURL, + const rtl::OUString & rServerName, const rtl::OUString & rRealm, const rtl::OUString & rUserName, const rtl::OUString & rPassword, const rtl::OUString & rAccount, - const sal_Bool & bAllowPersistentStoring); + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ); /** @@ -138,7 +150,8 @@ public: modifiable. * @param rAccount contains an account, if applicable. */ - SimpleAuthenticationRequest( const rtl::OUString & rServerName, + SimpleAuthenticationRequest( const rtl::OUString & rURL, + const rtl::OUString & rServerName, EntityType eRealmType, const rtl::OUString & rRealm, EntityType eUserNameType, @@ -152,6 +165,7 @@ public: /** * Constructor. * + * @param rURL contains a URL for which authentication is requested. * @param rServerName contains a server name. * @param eRealmType specifies whether a realm is applicable and modifiable. @@ -167,9 +181,13 @@ public: * @param eAccountType specifies whether an account is applicable and modifiable. * @param rAccount contains an account, if applicable. - * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently + * @param bAllowPersistentStoring specifies if the credentials should + * be stored in the passowrd container persistently + * @param bAllowUseSystemCredntials specifies if requesting client is + * able to obtain and use system credentials for authentication */ - SimpleAuthenticationRequest( const rtl::OUString & rServerName, + SimpleAuthenticationRequest( const rtl::OUString & rURL, + const rtl::OUString & rServerName, EntityType eRealmType, const rtl::OUString & rRealm, EntityType eUserNameType, @@ -178,7 +196,8 @@ public: const rtl::OUString & rPassword, EntityType eAccountType, const rtl::OUString & rAccount, - const sal_Bool & bAllowPersistentStoring); + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ); /** * This method returns the supplier for the missing authentication data, diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx index 8bfb4461d6f3..df91c47dc8fe 100644 --- a/ucbhelper/source/provider/interactionrequest.cxx +++ b/ucbhelper/source/provider/interactionrequest.cxx @@ -704,7 +704,8 @@ InteractionSupplyAuthentication::queryInterface( const uno::Type & rType ) uno::Any aRet = cppu::queryInterface( rType, static_cast< lang::XTypeProvider * >( this ), static_cast< task::XInteractionContinuation * >( this ), - static_cast< ucb::XInteractionSupplyAuthentication * >( this ) ); + static_cast< ucb::XInteractionSupplyAuthentication * >( this ), + static_cast< ucb::XInteractionSupplyAuthentication2 * >( this )); return aRet.hasValue() ? aRet : InteractionContinuation::queryInterface( rType ); @@ -750,7 +751,7 @@ uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes() uno::Reference< lang::XTypeProvider > * >( 0 ) ), getCppuType( static_cast< uno::Reference< - ucb::XInteractionSupplyAuthentication > * >( 0 ) ) ); + ucb::XInteractionSupplyAuthentication2 > * >( 0 ) ) ); pCollection = &collection; } } @@ -905,6 +906,33 @@ void SAL_CALL InteractionSupplyAuthentication::setRememberAccount( } //========================================================================= +// +// XInteractionSupplyAuthentication2 methods. +// +//========================================================================= + +// virtual +::sal_Bool SAL_CALL +InteractionSupplyAuthentication::canUseSystemCredentials( + ::sal_Bool& Default ) + throw ( uno::RuntimeException ) +{ + Default = m_bDefaultUseSystemCredentials; + return m_bCanUseSystemCredentials; +} + +//========================================================================= +// virtual +void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials( + ::sal_Bool UseSystemCredentials ) + throw ( uno::RuntimeException ) +{ + if ( m_bCanUseSystemCredentials ) + m_bUseSystemCredentials = UseSystemCredentials; +} + + +//========================================================================= //========================================================================= // // InteractionSupplyName Implementation. diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index 16570f7f012d..c5d7448fa29b 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucbhelper.hxx" #include <com/sun/star/task/XMasterPasswordHandling.hpp> +#include <com/sun/star/ucb/URLAuthenticationRequest.hpp> #include <ucbhelper/simpleauthenticationrequest.hxx> using namespace com::sun::star; @@ -38,14 +39,15 @@ using namespace ucbhelper; //========================================================================= SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rURL, const rtl::OUString & rServerName, const rtl::OUString & rRealm, const rtl::OUString & rUserName, const rtl::OUString & rPassword, const rtl::OUString & rAccount ) { - // Fill request... - ucb::AuthenticationRequest aRequest; + // Fill request... + ucb::URLAuthenticationRequest aRequest; // aRequest.Message = // OUString // aRequest.Context = // XInterface aRequest.Classification = task::InteractionClassification_ERROR; @@ -61,26 +63,30 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( aRequest.HasAccount = ( rAccount.getLength() > 0 ); if ( aRequest.HasAccount ) aRequest.Account = rAccount; + aRequest.URL = rURL; - initialize(aRequest, + initialize(aRequest, sal_False, sal_True, sal_True, aRequest.HasAccount, - sal_False); + sal_False, + sal_False ); } //========================================================================= SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rURL, const rtl::OUString & rServerName, const rtl::OUString & rRealm, const rtl::OUString & rUserName, const rtl::OUString & rPassword, const rtl::OUString & rAccount, - const sal_Bool & bAllowPersistentStoring ) + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ) { - // Fill request... - ucb::AuthenticationRequest aRequest; + // Fill request... + ucb::URLAuthenticationRequest aRequest; // aRequest.Message = // OUString // aRequest.Context = // XInterface aRequest.Classification = task::InteractionClassification_ERROR; @@ -96,56 +102,20 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( aRequest.HasAccount = ( rAccount.getLength() > 0 ); if ( aRequest.HasAccount ) aRequest.Account = rAccount; + aRequest.URL = rURL; - initialize(aRequest, + initialize(aRequest, sal_False, sal_True, sal_True, aRequest.HasAccount, - bAllowPersistentStoring); -} - -void SimpleAuthenticationRequest::initialize( - ucb::AuthenticationRequest aRequest, - const sal_Bool & bCanSetRealm, - const sal_Bool & bCanSetUserName, - const sal_Bool & bCanSetPassword, - const sal_Bool & bCanSetAccount, - const sal_Bool & bAllowPersistentStoring ) -{ - setRequest( uno::makeAny( aRequest ) ); - - // Fill continuations... - uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 ); - aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; - aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; - if (bAllowPersistentStoring) - aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT; - - m_xAuthSupplier - = new InteractionSupplyAuthentication( - this, - bCanSetRealm, - bCanSetUserName, - bCanSetPassword, - bCanSetAccount, - aRememberModes, // rRememberPasswordModes - ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode - aRememberModes, // rRememberAccountModes - ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode - ); - - uno::Sequence< - uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); - aContinuations[ 0 ] = new InteractionAbort( this ); - aContinuations[ 1 ] = new InteractionRetry( this ); - aContinuations[ 2 ] = m_xAuthSupplier.get(); - - setContinuations( aContinuations ); + bAllowPersistentStoring, + bAllowUseSystemCredentials ); } //========================================================================= SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rURL, const rtl::OUString & rServerName, EntityType eRealmType, const rtl::OUString & rRealm, @@ -157,7 +127,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( const rtl::OUString & rAccount ) { // Fill request... - ucb::AuthenticationRequest aRequest; + ucb::URLAuthenticationRequest aRequest; // aRequest.Message = // OUString // aRequest.Context = // XInterface aRequest.Classification = task::InteractionClassification_ERROR; @@ -175,17 +145,20 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( aRequest.HasAccount = eAccountType != ENTITY_NA; if ( aRequest.HasAccount ) aRequest.Account = rAccount; + aRequest.URL = rURL; initialize(aRequest, eRealmType == ENTITY_MODIFY, eUserNameType == ENTITY_MODIFY, ePasswordType == ENTITY_MODIFY, eAccountType == ENTITY_MODIFY, - sal_False); + sal_False, + sal_False ); } //========================================================================= SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rURL, const rtl::OUString & rServerName, EntityType eRealmType, const rtl::OUString & rRealm, @@ -195,10 +168,11 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( const rtl::OUString & rPassword, EntityType eAccountType, const rtl::OUString & rAccount, - const sal_Bool & bAllowPersistentStoring ) + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ) { // Fill request... - ucb::AuthenticationRequest aRequest; + ucb::URLAuthenticationRequest aRequest; // aRequest.Message = // OUString // aRequest.Context = // XInterface aRequest.Classification = task::InteractionClassification_ERROR; @@ -216,11 +190,56 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( aRequest.HasAccount = eAccountType != ENTITY_NA; if ( aRequest.HasAccount ) aRequest.Account = rAccount; + aRequest.URL = rURL; initialize(aRequest, eRealmType == ENTITY_MODIFY, eUserNameType == ENTITY_MODIFY, ePasswordType == ENTITY_MODIFY, eAccountType == ENTITY_MODIFY, - bAllowPersistentStoring); + bAllowPersistentStoring, + bAllowUseSystemCredentials ); +} + +//========================================================================= +void SimpleAuthenticationRequest::initialize( + const ucb::URLAuthenticationRequest & rRequest, + sal_Bool bCanSetRealm, + sal_Bool bCanSetUserName, + sal_Bool bCanSetPassword, + sal_Bool bCanSetAccount, + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ) +{ + setRequest( uno::makeAny( rRequest ) ); + + // Fill continuations... + uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 ); + aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; + aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; + if (bAllowPersistentStoring) + aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT; + + m_xAuthSupplier + = new InteractionSupplyAuthentication( + this, + bCanSetRealm, + bCanSetUserName, + bCanSetPassword, + bCanSetAccount, + aRememberModes, // rRememberPasswordModes + ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode + aRememberModes, // rRememberAccountModes + ucb::RememberAuthentication_SESSION, // eDefaultRememberAccountMode + bAllowUseSystemCredentials, // bCanUseSystemCredentials, + false // bDefaultUseSystemCredentials + ); + + uno::Sequence< + uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); + aContinuations[ 0 ] = new InteractionAbort( this ); + aContinuations[ 1 ] = new InteractionRetry( this ); + aContinuations[ 2 ] = m_xAuthSupplier.get(); + + setContinuations( aContinuations ); } diff --git a/unotools/inc/unotools/idhelper.hxx b/unotools/inc/unotools/idhelper.hxx index 2fcac8550af5..a2aa28d26c1b 100644 --- a/unotools/inc/unotools/idhelper.hxx +++ b/unotools/inc/unotools/idhelper.hxx @@ -125,9 +125,6 @@ public: \ static void release(); \ \ static ::com::sun::star::uno::Sequence< sal_Int8 > getImplementationId( \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >& _rxProvider); \ - \ - static ::com::sun::star::uno::Sequence< sal_Int8 > getImplementationId( \ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes); \ \ private: \ @@ -182,16 +179,6 @@ void classname::release() \ \ /*-----------------------------------------------------------------------*/ \ ::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId( \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >& _rxProvider) \ -{ \ - ::osl::MutexGuard aGuard(s_aMutex); \ - if (_rxProvider.is()) \ - return getImplementationId(_rxProvider->getTypes()); \ - return ::com::sun::star::uno::Sequence< sal_Int8 >(); \ -} \ - \ -/*-----------------------------------------------------------------------*/ \ -::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId( \ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes) \ { \ ::osl::MutexGuard aGuard(s_aMutex); \ diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index dc629b9a3b8c..a84be1fc2c25 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -35,6 +35,8 @@ #include <Cocoa/Cocoa.h> #include "postmac.h" +#include "com/sun/star/uno/Reference.hxx" + #include "vcl/sv.h" #include "vcl/svdata.hxx" #include "vcl/salwtype.hxx" @@ -112,6 +114,9 @@ struct SalData long mnDPIX; // #i100617# read DPI only once per office life long mnDPIY; // #i100617# read DPI only once per office life + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + mxClipboard; + SalData(); ~SalData(); diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index aeabdefc72a5..1d1eb3cb6bd3 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -44,6 +44,8 @@ #include <utility> #include <stdexcept> +#include <boost/shared_ptr.hpp> + class AquaSalGraphics; class AquaSalFrame; class AquaSalTimer; @@ -60,47 +62,49 @@ typedef struct SalFrame::SalPointerState SalPointerState; class AquaSalFrame : public SalFrame { public: - NSWindow* mpWindow; // Cocoa window - NSView* mpView; // Cocoa view (actually a custom view, see below - NSMenuItem* mpDockMenuEntry; // entry in the dynamic dock menu - NSRect maScreenRect; // for mirroring purposes - AquaSalGraphics* mpGraphics; // current frame graphics - AquaSalFrame* mpParent; // pointer to parent frame - SystemEnvData maSysData; // system data - int mnMinWidth; // min. client width in pixels - int mnMinHeight; // min. client height in pixels - int mnMaxWidth; // max. client width in pixels - int mnMaxHeight; // max. client height in pixels - NSRect maFullScreenRect; // old window size when in FullScreen - bool mbGraphics:1; // is Graphics used? - bool mbFullScreen:1; // is Window in FullScreen? - bool mbShown:1; - bool mbInitShow:1; - bool mbPositioned:1; - bool mbSized:1; - bool mbPresentation:1; - - ULONG mnStyle; - unsigned int mnStyleMask; // our style mask from NSWindow creation - - ULONG mnLastEventTime; - unsigned int mnLastModifierFlags; - AquaSalMenu* mpMenu; - - SalExtStyle mnExtStyle; // currently document frames are marked this way - - PointerStyle mePointerStyle; // currently active pointer style - - NSTrackingRectTag mnTrackingRectTag; // used to get enter/leave messages - - CGMutablePathRef mrClippingPath; // used for "shaping" - std::vector< CGRect > maClippingRects; - - std::list<AquaBlinker*> maBlinkers; - - Rectangle maInvalidRect; - - ULONG mnICOptions; + NSWindow* mpWindow; // Cocoa window + NSView* mpView; // Cocoa view (actually a custom view, see below + NSMenuItem* mpDockMenuEntry; // entry in the dynamic dock menu + NSRect maScreenRect; // for mirroring purposes + AquaSalGraphics* mpGraphics; // current frame graphics + AquaSalFrame* mpParent; // pointer to parent frame + SystemEnvData maSysData; // system data + int mnMinWidth; // min. client width in pixels + int mnMinHeight; // min. client height in pixels + int mnMaxWidth; // max. client width in pixels + int mnMaxHeight; // max. client height in pixels + NSRect maFullScreenRect; // old window size when in FullScreen + bool mbGraphics:1; // is Graphics used? + bool mbFullScreen:1; // is Window in FullScreen? + bool mbShown:1; + bool mbInitShow:1; + bool mbPositioned:1; + bool mbSized:1; + bool mbPresentation:1; + + ULONG mnStyle; + unsigned int mnStyleMask; // our style mask from NSWindow creation + + ULONG mnLastEventTime; + unsigned int mnLastModifierFlags; + AquaSalMenu* mpMenu; + + SalExtStyle mnExtStyle; // currently document frames are marked this way + + PointerStyle mePointerStyle; // currently active pointer style + + NSTrackingRectTag mnTrackingRectTag; // used to get enter/leave messages + + CGMutablePathRef mrClippingPath; // used for "shaping" + std::vector< CGRect > maClippingRects; + + std::list<AquaBlinker*> maBlinkers; + + Rectangle maInvalidRect; + + ULONG mnICOptions; + + boost::shared_ptr< Timer > mpActivityTimer; // Timer to prevent system sleep during presentation public: /** Constructor diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index b2cbc83d9f79..5b1cf0d84562 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -143,9 +143,16 @@ public: virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + static void handleAppDefinedEvent( NSEvent* pEvent ); // check whether a particular string is passed on the command line diff --git a/vcl/aqua/inc/vclnsapp.h b/vcl/aqua/inc/vclnsapp.h index fc637ff75a31..622f1bfd6bcd 100755 --- a/vcl/aqua/inc/vclnsapp.h +++ b/vcl/aqua/inc/vclnsapp.h @@ -35,6 +35,8 @@ #include "Cocoa/Cocoa.h" #include "postmac.h" +class AquaSalFrame; + @interface CocoaThreadEnabler : NSObject { } @@ -64,6 +66,8 @@ -(void)applicationWillResignActive: (NSNotification *)pNotification; -(MacOSBOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (MacOSBOOL)bWinVisible; -(void)setDockIconClickHandler: (NSObject*)pHandler; +-(void)cycleFrameForward: (AquaSalFrame*)pCurFrame; +-(void)cycleFrameBackward: (AquaSalFrame*)pCurFrame; @end #endif diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index b660472d9bbe..a49bce957b3b 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -151,7 +151,18 @@ static bool enabled = false; } [ nativeRole release ]; [ aWrapper setActsAsRadioGroup: asRadioGroup ]; - if ( ! rxAccessibleContext -> getAccessibleStateSet() -> contains ( AccessibleStateType::TRANSIENT ) ) { + #if 0 + /* #i102033# NSAccessibility does not seemt to know an equivalent for transient children. + That means we need to cache this, else e.g. tree list boxes are not accessible (moreover + it crashes by notifying dead objects - which would seemt o be another bug) + + FIXME: + Unfortunately this can increase memory consumption drastically until the non transient parent + is destroyed an finally all the transients are released. + */ + if ( ! rxAccessibleContext -> getAccessibleStateSet() -> contains ( AccessibleStateType::TRANSIENT ) ) + #endif + { [ dAllWrapper setObject: aWrapper forKey: nKey ]; } } diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index 99bcbd20f698..64e0e9ef0308 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -109,7 +109,18 @@ static MacOSBOOL isPopupMenuOpen = NO; // XAccessibleMultiLineText mpReferenceWrapper -> rAccessibleMultiLineText = Reference < XAccessibleMultiLineText > ( rxAccessibleContext, UNO_QUERY ); // XAccessibleEventBroadcaster - if ( ! rxAccessibleContext -> getAccessibleStateSet() -> contains ( AccessibleStateType::TRANSIENT ) ) { + #if 0 + /* #i102033# NSAccessibility does not seemt to know an equivalent for transient children. + That means we need to cache this, else e.g. tree list boxes are not accessible (moreover + it crashes by notifying dead objects - which would seemt o be another bug) + + FIXME: + Unfortunately this can increase memory consumption drastically until the non transient parent + is destroyed an finally all the transients are released. + */ + if ( ! rxAccessibleContext -> getAccessibleStateSet() -> contains ( AccessibleStateType::TRANSIENT ) ) + #endif + { Reference< XAccessibleEventBroadcaster > xBroadcaster(rxAccessibleContext, UNO_QUERY); if( xBroadcaster.is() ) { /* diff --git a/vcl/aqua/source/app/makefile.mk b/vcl/aqua/source/app/makefile.mk index 2bf3641898f1..a90c95c74a6e 100644 --- a/vcl/aqua/source/app/makefile.mk +++ b/vcl/aqua/source/app/makefile.mk @@ -50,8 +50,6 @@ dummy: .ELSE # "$(GUIBASE)"!="aqua" -#CFLAGS+=-x objective-c++ - SLOFILES= $(SLO)$/salinst.obj \ $(SLO)$/saldata.obj \ $(SLO)$/vclnsapp.obj \ diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 71bfb7953187..e4037df0c4aa 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -55,6 +55,14 @@ #include "saltimer.h" #include "vclnsapp.h" +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + #include "premac.h" #include <Foundation/Foundation.h> #include <ApplicationServices/ApplicationServices.h> @@ -64,6 +72,7 @@ using namespace std; +using namespace ::com::sun::star; extern BOOL ImplSVMain(); @@ -815,6 +824,18 @@ bool AquaSalInstance::AnyInput( USHORT nType ) return false; } + if( nType & INPUT_TIMER ) + { + if( AquaSalTimer::pRunningTimer ) + { + NSDate* pDt = [AquaSalTimer::pRunningTimer fireDate]; + if( pDt && [pDt timeIntervalSinceNow] < 0 ) + { + return true; + } + } + } + unsigned/*NSUInteger*/ nEventMask = 0; if( nType & INPUT_MOUSE) nEventMask |= @@ -828,7 +849,7 @@ bool AquaSalInstance::AnyInput( USHORT nType ) nEventMask |= NSKeyDownMask | NSKeyUpMask | NSFlagsChangedMask; if( nType & INPUT_OTHER) nEventMask |= NSTabletPoint; - // TODO: INPUT_PAINT / INPUT_TIMER / more INPUT_OTHER + // TODO: INPUT_PAINT / more INPUT_OTHER if( !nType) return false; @@ -1017,6 +1038,83 @@ void* AquaSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rRetur return (void*)""; } +// We need to re-encode file urls because osl_getFileURLFromSystemPath converts +// to UTF-8 before encoding non ascii characters, which is not what other apps expect. +static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl) +{ + rtl::OUString extUrl; + + uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory(); + if (sm.is()) + { + uno::Reference< beans::XPropertySet > pset; + sm->queryInterface( getCppuType( &pset )) >>= pset; + if (pset.is()) + { + uno::Reference< uno::XComponentContext > context; + static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ); + pset->getPropertyValue(DEFAULT_CONTEXT) >>= context; + if (context.is()) + extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl); + } + } + return extUrl; +} + +// #i104525# many versions of OSX have problems with some URLs: +// when an app requests OSX to add one of these URLs to the "Recent Items" list +// then this app gets killed (TextEdit, Preview, etc. and also OOo) +static bool isDangerousUrl( const rtl::OUString& rUrl ) +{ + // use a heuristic that detects all known cases since there is no official comment + // on the exact impact and root cause of the OSX bug + const int nLen = rUrl.getLength(); + const sal_Unicode* p = rUrl.getStr(); + for( int i = 0; i < nLen-3; ++i, ++p ) { + if( p[0] != '%' ) + continue; + // escaped percent? + if( (p[1] == '2') && (p[2] == '5') ) + return true; + // escapes are considered to be UTF-8 encoded + // => check for invalid UTF-8 leading byte + if( (p[1] != 'f') && (p[1] != 'F') ) + continue; + int cLowNibble = p[2]; + if( (cLowNibble >= '0' ) && (cLowNibble <= '9')) + return false; + if( cLowNibble >= 'a' ) + cLowNibble -= 'a' - 'A'; + if( (cLowNibble < 'A') || (cLowNibble >= 'C')) + return true; + } + + return false; +} + +void AquaSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& /*rMimeType*/) +{ + // Convert file URL for external use (see above) + rtl::OUString externalUrl = translateToExternalUrl(rFileUrl); + if( 0 == externalUrl.getLength() ) + externalUrl = rFileUrl; + + if( externalUrl.getLength() && !isDangerousUrl( externalUrl ) ) + { + NSString* pString = CreateNSString( externalUrl ); + NSURL* pURL = [NSURL URLWithString: pString]; + + if( pURL ) + { + NSDocumentController* pCtrl = [NSDocumentController sharedDocumentController]; + [pCtrl noteNewRecentDocumentURL: pURL]; + } + if( pString ) + [pString release]; + } +} + + // ----------------------------------------------------------------------- SalTimer* AquaSalInstance::CreateSalTimer() diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 43d44c709c12..5a295b5e1171 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -104,6 +104,24 @@ return; } } + + // #i90083# handle frame switching + // FIXME: lousy workaround + if( (nModMask & (NSControlKeyMask|NSAlternateKeyMask)) == 0 ) + { + if( [[pEvent characters] isEqualToString: @"<"] || + [[pEvent characters] isEqualToString: @"~"] ) + { + [self cycleFrameForward: pFrame]; + return; + } + else if( [[pEvent characters] isEqualToString: @">"] || + [[pEvent characters] isEqualToString: @"`"] ) + { + [self cycleFrameBackward: pFrame]; + return; + } + } // get information whether the event was handled; keyDown returns nothing GetSalData()->maKeyEventAnswer[ pEvent ] = false; @@ -186,6 +204,84 @@ { [super sendEvent: pEvent]; } + +-(void)cycleFrameForward: (AquaSalFrame*)pCurFrame +{ + // find current frame in list + std::list< AquaSalFrame* >& rFrames( GetSalData()->maFrames ); + std::list< AquaSalFrame* >::iterator it = rFrames.begin(); + for( ; it != rFrames.end() && *it != pCurFrame; ++it ) + ; + if( it != rFrames.end() ) + { + // now find the next frame (or end) + do + { + ++it; + if( it != rFrames.end() ) + { + if( (*it)->mpDockMenuEntry != NULL && + (*it)->mbShown ) + { + [(*it)->getWindow() makeKeyAndOrderFront: NSApp]; + return; + } + } + } while( it != rFrames.end() ); + // cycle around, find the next up to pCurFrame + it = rFrames.begin(); + while( *it != pCurFrame ) + { + if( (*it)->mpDockMenuEntry != NULL && + (*it)->mbShown ) + { + [(*it)->getWindow() makeKeyAndOrderFront: NSApp]; + return; + } + ++it; + } + } +} + +-(void)cycleFrameBackward: (AquaSalFrame*)pCurFrame +{ + // do the same as cycleFrameForward only with a reverse iterator + + // find current frame in list + std::list< AquaSalFrame* >& rFrames( GetSalData()->maFrames ); + std::list< AquaSalFrame* >::reverse_iterator it = rFrames.rbegin(); + for( ; it != rFrames.rend() && *it != pCurFrame; ++it ) + ; + if( it != rFrames.rend() ) + { + // now find the next frame (or end) + do + { + ++it; + if( it != rFrames.rend() ) + { + if( (*it)->mpDockMenuEntry != NULL && + (*it)->mbShown ) + { + [(*it)->getWindow() makeKeyAndOrderFront: NSApp]; + return; + } + } + } while( it != rFrames.rend() ); + // cycle around, find the next up to pCurFrame + it = rFrames.rbegin(); + while( *it != pCurFrame ) + { + if( (*it)->mpDockMenuEntry != NULL && + (*it)->mbShown ) + { + [(*it)->getWindow() makeKeyAndOrderFront: NSApp]; + return; + } + ++it; + } + } +} -(NSMenu*)applicationDockMenu:(NSApplication *)sender { diff --git a/dtrans/source/aqua/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index ce042e15b4d8..af05f084a97e 100644 --- a/dtrans/source/aqua/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -28,11 +28,13 @@ * ************************************************************************/ +#include "vcl/unohelp.hxx" #include <DataFlavorMapping.hxx> #include "HtmlFmtFlt.hxx" #include "PictToBmpFlt.hxx" -#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp> -#include <com/sun/star/datatransfer/XMimeContentType.hpp> +#include "com/sun/star/datatransfer/UnsupportedFlavorException.hpp" +#include "com/sun/star/datatransfer/XMimeContentType.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Sequence.hxx" #include <rtl/ustring.hxx> @@ -513,12 +515,11 @@ Any FileListDataProvider::getOOoData() //########################### -DataFlavorMapper::DataFlavorMapper(const Reference<XComponentContext>& context) : - mXComponentContext(context) +DataFlavorMapper::DataFlavorMapper() { - Reference<XMultiComponentFactory> mrServiceManager = mXComponentContext->getServiceManager(); - mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory")), mXComponentContext), UNO_QUERY); + Reference<XMultiServiceFactory> mrServiceManager = vcl::unohelper::GetMultiServiceFactory(); + mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstance( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); if (!mrXMimeCntFactory.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("AquaClipboard: Cannot create com.sun.star.datatransfer.MimeContentTypeFactory")), NULL); diff --git a/dtrans/source/aqua/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx index 6243032d5051..03cb77e319f7 100644 --- a/dtrans/source/aqua/DataFlavorMapping.hxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx @@ -75,7 +75,7 @@ public: /* Initialialize a DataFavorMapper instance. Throws a RuntimeException in case the XMimeContentTypeFactory service cannot be created. */ - DataFlavorMapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context); + DataFlavorMapper(); /* Map a system data flavor to an OpenOffice data flavor. @@ -133,7 +133,6 @@ private: bool isValidMimeContentType(const rtl::OUString& contentType) const; private: - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; }; diff --git a/dtrans/source/aqua/DragActionConversion.cxx b/vcl/aqua/source/dtrans/DragActionConversion.cxx index 793dcca503a0..793dcca503a0 100644 --- a/dtrans/source/aqua/DragActionConversion.cxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.cxx diff --git a/dtrans/source/aqua/DragActionConversion.hxx b/vcl/aqua/source/dtrans/DragActionConversion.hxx index 137e2af30be1..137e2af30be1 100644 --- a/dtrans/source/aqua/DragActionConversion.hxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.hxx diff --git a/dtrans/source/aqua/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index c0e7bd6ece94..074ce5c6c318 100644 --- a/dtrans/source/aqua/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/awt/MouseButton.hpp> @@ -61,9 +61,6 @@ using namespace comphelper; using namespace std; -extern rtl_StandardModuleCount g_moduleCount; - - // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>(); @@ -161,14 +158,12 @@ Sequence<OUString> dragSource_getSupportedServiceNames() @end -DragSource::DragSource( const Reference<XComponentContext>& context): +DragSource::DragSource(): WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex), - mXComponentContext(context), mView(NULL), mLastMouseEventBeforeStartDrag(nil), m_MouseButton(0) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt); } @@ -176,7 +171,6 @@ DragSource::~DragSource() { [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; [mDragSourceHelper release]; - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } @@ -254,7 +248,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, m_MouseButton= mMouseEvent.Buttons; mXDragSrcListener = listener; mXCurrentContext = static_cast<XDragSourceContext*>(new DragSourceContext(this)); - auto_ptr<AquaClipboard> clipb(new AquaClipboard(this->mXComponentContext, NULL, false)); + auto_ptr<AquaClipboard> clipb(new AquaClipboard(NULL, false)); g_XTransferable = transferable; clipb->setContents(g_XTransferable, Reference<XClipboardOwner>()); mDragSourceActions = sourceActions; diff --git a/dtrans/source/aqua/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx index 252b63fee41d..1268a466adf3 100644 --- a/dtrans/source/aqua/DragSource.hxx +++ b/vcl/aqua/source/dtrans/DragSource.hxx @@ -89,7 +89,7 @@ class DragSource : public ::cppu::BaseMutex, private ::boost::noncopyable { public: - DragSource(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext>& context); + DragSource(); virtual ~DragSource(); // XInitialization @@ -119,8 +119,6 @@ public: virtual unsigned int getSupportedDragOperations(bool isLocal) const; public: - com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> mXComponentContext; - // The context notifies the XDragSourceListeners com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDragSourceContext > mXCurrentContext; diff --git a/dtrans/source/aqua/DragSourceContext.cxx b/vcl/aqua/source/dtrans/DragSourceContext.cxx index f0496a297052..cd657a6147e9 100644 --- a/dtrans/source/aqua/DragSourceContext.cxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> @@ -43,20 +43,14 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants; using namespace com::sun::star::uno; using namespace cppu; - -extern rtl_StandardModuleCount g_moduleCount; - - DragSourceContext::DragSourceContext( DragSource* pSource) : WeakComponentImplHelper1<XDragSourceContext>(m_aMutex), m_pDragSource( pSource) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); } DragSourceContext::~DragSourceContext() { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } sal_Int32 SAL_CALL DragSourceContext::getCurrentCursor( ) diff --git a/dtrans/source/aqua/DragSourceContext.hxx b/vcl/aqua/source/dtrans/DragSourceContext.hxx index 3526ec846fd6..3526ec846fd6 100644 --- a/dtrans/source/aqua/DragSourceContext.hxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.hxx diff --git a/dtrans/source/aqua/DropTarget.cxx b/vcl/aqua/source/dtrans/DropTarget.cxx index 6f973d7aa08f..88ffc1e51d02 100644 --- a/dtrans/source/aqua/DropTarget.cxx +++ b/vcl/aqua/source/dtrans/DropTarget.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> @@ -65,8 +65,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::uno; using namespace comphelper; -extern rtl_StandardModuleCount g_moduleCount; - OUString dropTarget_getImplementationName() { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1")); @@ -152,17 +150,15 @@ namespace /* private */ @end -DropTarget::DropTarget( const Reference<XComponentContext>& context) : +DropTarget::DropTarget() : WeakComponentImplHelper5<XInitialization, XDropTarget, XDropTargetDragContext, XDropTargetDropContext, XServiceInfo>(m_aMutex), - mXComponentContext(context), mDropTargetHelper(nil), mbActive(false), mDragSourceSupportedActions(DNDConstants::ACTION_NONE), mSelectedDropAction(DNDConstants::ACTION_NONE), mDefaultActions(DNDConstants::ACTION_COPY_OR_MOVE | DNDConstants::ACTION_LINK | DNDConstants::ACTION_DEFAULT) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper(mXComponentContext)); + mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); } @@ -170,7 +166,6 @@ DropTarget::~DropTarget() { [(id <DraggingDestinationHandler>)mView unregisterDraggingDestinationHandler:mDropTargetHelper]; [mDropTargetHelper release]; - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } @@ -249,7 +244,7 @@ NSDragOperation DropTarget::draggingEntered(id sender) sal_Int32 posY = static_cast<sal_Int32>(dragLocation.y); NSPasteboard* dragPboard = [sender draggingPasteboard]; - mXCurrentDragClipboard = new AquaClipboard(mXComponentContext, dragPboard, false); + mXCurrentDragClipboard = new AquaClipboard(dragPboard, false); Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ? DragSource::g_XTransferable : mXCurrentDragClipboard->getContents(); @@ -297,6 +292,9 @@ NSDragOperation DropTarget::draggingUpdated(id sender) fire_dragOver(dtde); + // drag over callbacks likely have rendered something + [mView setNeedsDisplay: TRUE]; + dragOp = OfficeToSystemDragActions(mSelectedDropAction); //NSLog(@"Drag update: Source actions: %x proposed action %x selected action %x", mDragSourceSupportedActions, currentAction, mSelectedDropAction); diff --git a/dtrans/source/aqua/DropTarget.hxx b/vcl/aqua/source/dtrans/DropTarget.hxx index f65de4ff164e..91b50c041916 100644 --- a/dtrans/source/aqua/DropTarget.hxx +++ b/vcl/aqua/source/dtrans/DropTarget.hxx @@ -95,7 +95,7 @@ class DropTarget: public cppu::BaseMutex, private boost::noncopyable { public: - DropTarget(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context); + DropTarget(); virtual ~DropTarget(); // Overrides WeakComponentImplHelper::disposing which is called by @@ -157,7 +157,6 @@ private: void fire_dropActionChanged(const com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde); private: - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mXComponentContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetDragContext > mXCurrentDragContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetDropContext > mXCurrentDropContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboard > mXCurrentDragClipboard; diff --git a/dtrans/source/aqua/HtmlFmtFlt.cxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx index 3f558b0a5b4f..3f558b0a5b4f 100644 --- a/dtrans/source/aqua/HtmlFmtFlt.cxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx diff --git a/dtrans/source/aqua/HtmlFmtFlt.hxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx index 49f0cc70590c..49f0cc70590c 100644 --- a/dtrans/source/aqua/HtmlFmtFlt.hxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx diff --git a/dtrans/source/aqua/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx index a4f5b7807935..a893f09d89cc 100644 --- a/dtrans/source/aqua/OSXTransferable.cxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <sal/types.h> #ifndef _TRANSFERABLE_HXX_ @@ -63,11 +63,9 @@ namespace // private } // namespace private -OSXTransferable::OSXTransferable(const Reference< XComponentContext >& context, - const Reference<XMimeContentTypeFactory> rXMimeCntFactory, +OSXTransferable::OSXTransferable(const Reference<XMimeContentTypeFactory> rXMimeCntFactory, DataFlavorMapperPtr_t pDataFlavorMapper, NSPasteboard* pasteboard) : - mXComponentContext(context), mrXMimeCntFactory(rXMimeCntFactory), mDataFlavorMapper(pDataFlavorMapper), mPasteboard(pasteboard) diff --git a/dtrans/source/aqua/OSXTransferable.hxx b/vcl/aqua/source/dtrans/OSXTransferable.hxx index d231611f0aaf..9b371523c440 100644 --- a/dtrans/source/aqua/OSXTransferable.hxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.hxx @@ -58,8 +58,7 @@ class OSXTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatrans public: typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t; - explicit OSXTransferable(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context, - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, + explicit OSXTransferable(com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, DataFlavorMapperPtr_t pDataFlavorMapper, NSPasteboard* pasteboard); @@ -96,7 +95,6 @@ public: private: com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > mFlavorList; - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; DataFlavorMapperPtr_t mDataFlavorMapper; NSPasteboard* mPasteboard; diff --git a/dtrans/source/aqua/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx index 0643efae33ca..0643efae33ca 100644 --- a/dtrans/source/aqua/PictToBmpFlt.cxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx diff --git a/dtrans/source/aqua/PictToBmpFlt.hxx b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx index 29e9c535546f..29e9c535546f 100644 --- a/dtrans/source/aqua/PictToBmpFlt.hxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx diff --git a/dtrans/source/aqua/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index 370edee90eb7..27bf308dce9b 100644 --- a/dtrans/source/aqua/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -29,15 +29,15 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include "DataFlavorMapping.hxx" #include "OSXTransferable.hxx" -#ifndef COMPHELPER_MAKESEQUENCE_HXX_INCLUDED +#include "vcl/unohelp.hxx" + #include "comphelper/makesequence.hxx" -#endif #include <boost/assert.hpp> @@ -95,15 +95,14 @@ Sequence<OUString> clipboard_getSupportedServiceNames() } -AquaClipboard::AquaClipboard(const Reference< XComponentContext >& context, NSPasteboard* pasteboard, bool bUseSystemPasteboard) : +AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard) : WeakComponentImplHelper4<XClipboardEx, XClipboardNotifier, XFlushableClipboard, XServiceInfo>(m_aMutex), - mXComponentContext(context), mIsSystemPasteboard(bUseSystemPasteboard) { - Reference<XMultiComponentFactory> mrServiceMgr = mXComponentContext->getServiceManager(); + Reference<XMultiServiceFactory> mrServiceMgr = vcl::unohelper::GetMultiServiceFactory(); - mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory")), mXComponentContext), UNO_QUERY); + mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); if (!mrXMimeCntFactory.is()) { @@ -112,7 +111,7 @@ AquaClipboard::AquaClipboard(const Reference< XComponentContext >& context, NSPa static_cast<XClipboardEx*>(this)); } - mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper(mXComponentContext)); + mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); if (pasteboard != NULL) { @@ -183,8 +182,7 @@ Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeExce return mXClipboardContent; } - return Reference<XTransferable>(new OSXTransferable(mXComponentContext, - mrXMimeCntFactory, + return Reference<XTransferable>(new OSXTransferable(mrXMimeCntFactory, mpDataFlavorMapper, mPasteboard)); } diff --git a/dtrans/source/aqua/aqua_clipboard.hxx b/vcl/aqua/source/dtrans/aqua_clipboard.hxx index 3de02f5dcdcd..90bb404fdb36 100644 --- a/dtrans/source/aqua/aqua_clipboard.hxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.hxx @@ -92,8 +92,7 @@ public: system clipboard will be created (bUseSystemClipboard == true) or if the DragPasteboard if bUseSystemClipboard == false */ - AquaClipboard(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context, - NSPasteboard* pasteboard = NULL, + AquaClipboard(NSPasteboard* pasteboard = NULL, bool bUseSystemClipboard = true); ~AquaClipboard(); @@ -171,7 +170,6 @@ private: void fireClipboardChangedEvent(); private: - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory > mrXMimeCntFactory; ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > mClipboardListeners; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > mXClipboardContent; diff --git a/dtrans/source/aqua/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx index 39453683a2cc..aeaf697670ef 100644 --- a/dtrans/source/aqua/aqua_service.cxx +++ b/vcl/aqua/source/dtrans/aqua_service.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include <cppuhelper/factory.hxx> #include <com/sun/star/container/XSet.hpp> diff --git a/dtrans/source/aqua/makefile.mk b/vcl/aqua/source/dtrans/makefile.mk index e0b4eecf6db4..e802c98abf64 100644 --- a/dtrans/source/aqua/makefile.mk +++ b/vcl/aqua/source/dtrans/makefile.mk @@ -29,17 +29,11 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=..$/..$/.. -PRJNAME=dtrans +PRJNAME=vcl TARGET=dtransaqua ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO -.IF "$(OS)"=="MACOSX" -.IF "$(GUIBASE)"=="aqua" -COMP1TYPELIST=$(TARGET) -.ENDIF # "$(GUIBASE)"=="aqua" -.ENDIF # "$(OS)"=="MACOSX" # --- Settings ----------------------------------------------------- @@ -70,35 +64,7 @@ SLOFILES= \ $(SLO)$/DragSourceContext.obj \ $(SLO)$/DragActionConversion.obj -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - -framework Carbon \ - -framework QuickTime \ - -framework Cocoa - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) - -SHL1OBJS= $(SLOFILES) - -#APP1NOSAL=TRUE -#APP1TARGET=test_aquacb -#APP1OBJS=$(SLO)$/test_aquacb.obj -#APP1STDLIBS= -#$(SALLIB) -#$(CPPULIB) -#$(CPPUHELPERLIB) -#-framework Cocoa - # --- Targets ------------------------------------------------------ - -ALL : ALLTAR - +cd $(LB) && $(REGCOMP) -register -r ../bin/$(COMP1TYPELIST).rdb -c $(SHL1TARGET) - .INCLUDE : target.mk .ENDIF # "$(GUIBASE)"!="aqua" diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx new file mode 100644 index 000000000000..38784ecb53dd --- /dev/null +++ b/vcl/aqua/source/dtrans/service_entry.cxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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: service_entry.cxx,v $ + * $Revision: 1.3 $ + * + * 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_vcl.hxx" + +#include "saldata.hxx" +#include "salinst.h" +#include "DragSource.hxx" +#include "DropTarget.hxx" +#include "aqua_clipboard.hxx" +#include "osl/diagnose.h" + +using namespace ::osl; +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::cppu; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::datatransfer::clipboard; + + +Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mxClipboard.is() ) + pSalData->mxClipboard = Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); + return pSalData->mxClipboard; +} + + +Reference<XInterface> AquaSalInstance::CreateDragSource() +{ + return Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); +} + +Reference<XInterface> AquaSalInstance::CreateDropTarget() +{ + return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); +} + diff --git a/dtrans/source/aqua/test_aquacb.cxx b/vcl/aqua/source/dtrans/test_aquacb.cxx index bcb9dcd164df..db60712ce852 100644 --- a/dtrans/source/aqua/test_aquacb.cxx +++ b/vcl/aqua/source/dtrans/test_aquacb.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include <cppuhelper/servicefactory.hxx> diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index 42f29d677b52..8b7b23a681a0 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -214,16 +214,26 @@ bool AquaSalBitmap::CreateContext() { // convert user data to 32 bit nContextBytesPerRow = mnWidth << 2; - maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); + try + { + maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); - if( !bSkipConversion ) - ConvertBitmapData( mnWidth, mnHeight, - 32, nContextBytesPerRow, maPalette, maContextBuffer.get(), - mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() ); + if( !bSkipConversion ) + ConvertBitmapData( mnWidth, mnHeight, + 32, nContextBytesPerRow, maPalette, maContextBuffer.get(), + mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() ); + } + catch( std::bad_alloc ) + { + mxGraphicContext = 0; + } } - mxGraphicContext = ::CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight, - bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo ); + if( maContextBuffer.get() ) + { + mxGraphicContext = ::CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight, + bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo ); + } if( !mxGraphicContext ) maContextBuffer.reset(); diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 9c713ea26a52..b942c97cead1 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -43,6 +43,7 @@ #include "aqua11yfactory.h" #include "vcl/salwtype.hxx" #include "vcl/window.hxx" +#include "vcl/timer.hxx" #include "premac.h" // needed for theming @@ -749,16 +750,37 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) // ----------------------------------------------------------------------- +class PreventSleepTimer : public AutoTimer +{ +public: + PreventSleepTimer() + { + SetTimeout( 30000 ); + Start(); + } + + virtual ~PreventSleepTimer() + { + } + + virtual void Timeout() + { + UpdateSystemActivity(OverallAct); + } +}; + void AquaSalFrame::StartPresentation( BOOL bStart ) { if( bStart ) { + mpActivityTimer.reset( new PreventSleepTimer() ); [mpWindow setLevel: NSScreenSaverWindowLevel]; if( mbShown ) [mpWindow makeMainWindow]; } else { + mpActivityTimer.reset(); [mpWindow setLevel: NSNormalWindowLevel]; } } @@ -1173,6 +1195,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) Color aMenuTextColor( getColor( [NSColor textColor], aStyleSettings.GetMenuTextColor(), mpWindow ) ); aStyleSettings.SetMenuTextColor( aMenuTextColor ); + aStyleSettings.SetMenuBarTextColor( aMenuTextColor ); aStyleSettings.SetCursorBlinkTime( 500 ); diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index c7facd8c6c09..68ea2c2062f2 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -184,6 +184,8 @@ static AquaSalFrame* getMouseContainerFrame() return YES; if( mpFrame->mbFullScreen ) return YES; + if( (mpFrame->mnStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) + return YES; return [super canBecomeKeyWindow]; } @@ -1420,7 +1422,7 @@ private: return 0; } -#ifdef MAC_OS_X_VERSION_10_5 +#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) /* build target 10.5 or greater */ - (NSInteger)conversationIdentifier #else diff --git a/vcl/inc/vcl/floatwin.hxx b/vcl/inc/vcl/floatwin.hxx index 8dcba41e2a8e..02ac18ac28f8 100644 --- a/vcl/inc/vcl/floatwin.hxx +++ b/vcl/inc/vcl/floatwin.hxx @@ -157,6 +157,8 @@ public: const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; } BOOL GrabsFocus() const { return mbGrabFocus; } + + static Point CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex ); }; #endif // _SV_FLOATWIN_HXX diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx index a0acba21fefa..4821492af1f8 100644 --- a/vcl/inc/vcl/lazydelete.hxx +++ b/vcl/inc/vcl/lazydelete.hxx @@ -225,7 +225,7 @@ namespace vcl SomeWindow::Paint() { - static vcl::DeleteOnDeinitBase< BitmapEx > aBmp( new BitmapEx( ResId( 1000, myResMgr ) ) ); + static vcl::DeleteOnDeinit< BitmapEx > aBmp( new BitmapEx( ResId( 1000, myResMgr ) ) ); if( aBmp.get() ) // check whether DeInitVCL has been called already DrawBitmapEx( Point( 10, 10 ), *aBmp.get() ); @@ -244,7 +244,7 @@ namespace vcl }; template < typename T > - class VCL_DLLPUBLIC DeleteOnDeinit : public DeleteOnDeinitBase + class DeleteOnDeinit : public DeleteOnDeinitBase { T* m_pT; virtual void doCleanup() { delete m_pT; m_pT = NULL; } diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index 5fa47d412f26..ed9f91b97d99 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -202,7 +202,7 @@ public: static const PPDParser* getParser( const String& rFile ); static String getPPDPrinterName( const String& rFile ); static void freeAll(); - static void getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers ); + static void getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers, bool bRefresh = false ); const String& getFilename() const { return m_aFile; } diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 7a99442ebd5b..0e3f4e94a0b3 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -102,6 +102,8 @@ struct SystemEnvData; #define SAL_FRAME_STYLE_SYSTEMCHILD ((ULONG)0x08000000) // floating window #define SAL_FRAME_STYLE_FLOAT ((ULONG)0x20000000) +// floating window that needs to be focusable +#define SAL_FRAME_STYLE_FLOAT_FOCUSABLE ((ULONG)0x04000000) // toolwindows should be painted with a smaller decoration #define SAL_FRAME_STYLE_TOOLWINDOW ((ULONG)0x40000000) // the window containing the intro bitmap, aka splashscreen diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 221c9e370ea6..f8c148859516 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -31,6 +31,8 @@ #ifndef _SV_SALINST_HXX #define _SV_SALINST_HXX +#include "com/sun/star/uno/Reference.hxx" + #include "vcl/sv.h" #include "vcl/dllapi.h" @@ -176,6 +178,13 @@ public: // this is only necessary because PrintFontManager is an exported vcl API and therefore // needs to be in libvcl while libvclplug_* do not contain exported C++ API virtual void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); + + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0; }; // called from SVMain diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index a7cd61477519..decb7d01b2d4 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -379,6 +379,7 @@ private: Color maMenuHighlightColor; Color maMenuHighlightTextColor; Color maMenuTextColor; + Color maMenuBarTextColor; Color maMonoColor; Color maRadioCheckTextColor; Color maShadowColor; @@ -689,6 +690,10 @@ public: { CopyData(); mpData->maMenuTextColor = rColor; } const Color& GetMenuTextColor() const { return mpData->maMenuTextColor; } + void SetMenuBarTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarTextColor = rColor; } + const Color& GetMenuBarTextColor() const + { return mpData->maMenuBarTextColor; } void SetMenuHighlightColor( const Color& rColor ) { CopyData(); mpData->maMenuHighlightColor = rColor; } const Color& GetMenuHighlightColor() const diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index f853fae6c268..1e0c5218d1c5 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -479,6 +479,20 @@ public: */ static const ::rtl::OUString& GetDesktopEnvironment(); + /** Add a file to the system shells recent document list if there is any. + This function may have no effect under Unix because there is no + standard API among the different desktop managers. + + @param rFileUrl + The file url of the document. + + @param rMimeType + The mime content type of the document specified by aFileUrl. + If an empty string will be provided "application/octet-stream" + will be used. + */ + static void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + private: DECL_STATIC_LINK( Application, PostEventHandler, void* ); diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index a28127dd6f82..ff0639d70e82 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -150,6 +150,7 @@ class Menu; #define VCLEVENT_LISTBOX_ENTRY_EXPANDED 1174 #define VCLEVENT_LISTBOX_ENTRY_COLLAPSED 1175 // <-- +#define VCLEVENT_DROPDOWN_PRE_OPEN 1176 // VclMenuEvent #define VCLEVENT_MENU_ACTIVATE 1200 diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx index f5869eca55e4..968f0e1d255f 100644 --- a/vcl/inc/vcl/wintypes.hxx +++ b/vcl/inc/vcl/wintypes.hxx @@ -194,6 +194,7 @@ typedef sal_Int64 WinBits; #define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) #define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) #define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) +#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) #define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) #define WB_HSCROLL WB_HORZ diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h index 119324c1acd6..ba8dc7ddc43f 100644 --- a/vcl/os2/inc/salinst.h +++ b/vcl/os2/inc/salinst.h @@ -96,6 +96,7 @@ public: virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); }; SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ); diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index a14881c253ee..d4d324ad469c 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -811,6 +811,10 @@ void* Os2SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn return (void*) ""; } +void Os2SalInstance::AddToRecentDocumentList(const rtl::OUString& /*rFileUrl*/, const rtl::OUString& /*rMimeType*/) +{ +} + // ----------------------------------------------------------------------- SalTimer* Os2SalInstance::CreateSalTimer() diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 8860d68d683e..345573b268c3 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -2172,6 +2172,7 @@ void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); } aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 52b444164029..908dd1eafd72 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -14,13 +14,15 @@ vc vcl\os2\source\app nmake - p vc__appp vc_inc NULL vc vcl\os2\source\gdi nmake - p vc__gdip vc_inc NULL vc vcl\os2\source\window nmake - p vc__winp vc_inc NULL vc vcl\os2\source\src nmake - p vc__srcp vc_inc NULL -vc vcl\source\components nmake - all vc_components NULL +vc vcl\source\components nmake - all vc_components vc_inc NULL vc vcl\win\source\app nmake - w vc__appw vc_inc NULL vc vcl\win\source\gdi nmake - w vc__gdiw vc_inc NULL vc vcl\win\source\window nmake - w vc__winw vc_inc NULL vc vcl\win\source\src nmake - w vc__srcw vc_inc NULL vc vcl\unx\source\plugadapt nmake - u vc__plug vc_inc NULL +vc vcl\unx\source\desktopdetect nmake - u vc__desk vc_inc NULL vc vcl\unx\source\app nmake - u vc__appu vc_inc NULL +vc vcl\unx\source\dtrans nmake - u vc__dtru vc_inc NULL vc vcl\unx\source\fontmanager nmake - u vc__ftmu vc_inc NULL vc vcl\unx\source\gdi nmake - u vc__gdiu vc_inc NULL vc vcl\unx\source\printer nmake - u vc__prnu vc_inc NULL @@ -35,6 +37,7 @@ vc vcl\unx\kde nmake - u vc__kde vc_inc NULL vc vcl\unx\kde4 nmake - u vc__kde4 vc_inc NULL vc vcl\aqua\source\a11y nmake - u vc__aquy vc_inc NULL vc vcl\aqua\source\app nmake - u vc__appa vc_inc NULL +vc vcl\aqua\source\dtrans nmake - u vc__dtra vc_inc NULL vc vcl\aqua\source\gdi nmake - u vc__gdia vc_inc NULL vc vcl\aqua\source\res nmake - u vc__resa NULL vc vcl\aqua\source\window nmake - u vc__wina vc_inc NULL @@ -42,6 +45,6 @@ vc vcl\mac\source\app nmake - m vc__appm vc_inc NULL vc vcl\mac\source\gdi nmake - m vc__gdim vc_inc NULL vc vcl\mac\source\window nmake - m vc__winm vc_inc NULL vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL -vc vcl\util nmake - all vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL +vc vcl\util nmake - all vc_util vc__plug.u vc__desk.u vc__aquy.u vc__appa.u vc__dtra.u vc__appm.m vc__appu.u vc__dtru.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index d9c14f46b8d1..983628184177 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -1,14 +1,12 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %_DEST%\inc%_EXT%\vcl -mkdir: %_DEST%\inc%_EXT%\vcl\plug -mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl ..\%COMMON_OUTDIR%\bin\*.zip %COMMON_DEST%\bin%_EXT%\*.zip ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\bin\vcl*.res %_DEST%\bin%_EXT%\vcl*.res ..\%__SRC%\bin\vcl?????.dll %_DEST%\bin%_EXT%\vcl?????.dll ..\%__SRC%\bin\vcl?????.sym %_DEST%\bin%_EXT%\vcl?????.sym -..\%__SRC%\lib\libvcl*.so %_DEST%\lib%_EXT%\libvcl*.so +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\lib\ivcl.lib %_DEST%\lib%_EXT%\ivcl.lib ..\%__SRC%\misc\vcl?????.map %_DEST%\bin%_EXT%\vcl?????.map @@ -153,3 +151,4 @@ mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl ..\inc\vcl\ppdparser.hxx %_DEST%\inc%_EXT%\vcl\ppdparser.hxx ..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx ..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx +..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx
\ No newline at end of file diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 444f1f58c8fb..6aa453563596 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -478,6 +478,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maMenuHighlightColor( rData.maMenuHighlightColor ), maMenuHighlightTextColor( rData.maMenuHighlightTextColor ), maMenuTextColor( rData.maMenuTextColor ), + maMenuBarTextColor( rData.maMenuBarTextColor ), maMonoColor( rData.maMonoColor ), maRadioCheckTextColor( rData.maRadioCheckTextColor ), maShadowColor( rData.maShadowColor ), @@ -597,6 +598,7 @@ void ImplStyleData::SetStandardStyles() maMenuBarColor = Color( COL_LIGHTGRAY ); maMenuBorderColor = Color( COL_LIGHTGRAY ); maMenuTextColor = Color( COL_BLACK ); + maMenuBarTextColor = Color( COL_BLACK ); maMenuHighlightColor = Color( COL_BLUE ); maMenuHighlightTextColor = Color( COL_WHITE ); maHighlightColor = Color( COL_BLUE ); @@ -1028,6 +1030,7 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->maMenuBarColor == rSet.mpData->maMenuBarColor) && (mpData->maMenuBorderColor == rSet.mpData->maMenuBorderColor) && (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) && + (mpData->maMenuBarTextColor == rSet.mpData->maMenuBarTextColor) && (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) && (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) && (mpData->maHighlightColor == rSet.mpData->maHighlightColor) && diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 262910d18c82..6057409baa14 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -674,11 +674,11 @@ void Application::MergeSystemSettings( AllSettings& rSettings ) ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mbSettingsInit ) { - pWindow->ImplGetFrame()->UpdateSettings( *pSVData->maAppData.mpSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = TRUE; } - pWindow->ImplGetFrame()->UpdateSettings( rSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings pWindow->ImplUpdateGlobalSettings( rSettings, FALSE ); } } @@ -1989,6 +1989,12 @@ const ::rtl::OUString& Application::GetDesktopEnvironment() return SalGetDesktopEnvironment(); } +void Application::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType); +} + BOOL Application::IsAccessibilityEnabled() { return FALSE; diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx new file mode 100644 index 000000000000..58792cd4fbdb --- /dev/null +++ b/vcl/source/components/dtranscomp.cxx @@ -0,0 +1,556 @@ +/************************************************************************* + * + * 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: fontident.cxx,v $ + * + * $Revision: 1.3 $ + * + * 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_vcl.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" +#include "com/sun/star/lang/XInitialization.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/datatransfer/XTransferable.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardEx.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardListener.hpp" +#include "com/sun/star/datatransfer/dnd/XDragSource.hpp" +#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp" +#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp" + +#include "vcl/svapp.hxx" +#include "vcl/svdata.hxx" +#include "vcl/salinst.hxx" +#include "vos/mutex.hxx" +#include "osl/mutex.hxx" + +#include "cppuhelper/compbase1.hxx" +#include "cppuhelper/compbase2.hxx" +#include "cppuhelper/compbase3.hxx" +#include "cppuhelper/implbase1.hxx" + +using rtl::OUString; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + +// ----------------------------------------------------------------------- + +namespace vcl +{ +// generic implementation to satisfy SalInstance +class GenericClipboard : + public cppu::WeakComponentImplHelper3 < + datatransfer::clipboard::XClipboardEx, + datatransfer::clipboard::XClipboardNotifier, + XServiceInfo + > +{ + osl::Mutex m_aMutex; + Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; + Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; + std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; + + void fireChangedContentsEvent(); + void clearContents(); + +public: + + GenericClipboard() : cppu::WeakComponentImplHelper3< + datatransfer::clipboard::XClipboardEx, + datatransfer::clipboard::XClipboardNotifier, + XServiceInfo + >( m_aMutex ) + {} + virtual ~GenericClipboard(); + + /* + * XServiceInfo + */ + + virtual rtl::OUString SAL_CALL getImplementationName() throw( RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( RuntimeException ); + virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( RuntimeException ); + + static rtl::OUString getImplementationName_static(); + static Sequence< rtl::OUString > getSupportedServiceNames_static(); + + /* + * XClipboard + */ + + virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() + throw(RuntimeException); + + virtual void SAL_CALL setContents( + const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + throw(RuntimeException); + + virtual ::rtl::OUString SAL_CALL getName() + throw(RuntimeException); + + /* + * XClipboardEx + */ + + virtual sal_Int8 SAL_CALL getRenderingCapabilities() + throw(RuntimeException); + + /* + * XClipboardNotifier + */ + virtual void SAL_CALL addClipboardListener( + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + throw(RuntimeException); + + virtual void SAL_CALL removeClipboardListener( + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + throw(RuntimeException); +}; + +GenericClipboard::~GenericClipboard() +{ +} + +rtl::OUString GenericClipboard::getImplementationName_static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.VCLGenericClipboard" ) ); +} + +Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames_static() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +rtl::OUString GenericClipboard::getImplementationName() throw( RuntimeException ) +{ + return getImplementationName_static(); +} + +Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames() throw( RuntimeException ) +{ + return getSupportedServiceNames_static(); +} + +sal_Bool GenericClipboard::supportsService( const ::rtl::OUString& ServiceName ) throw( RuntimeException ) +{ + Sequence< OUString > aServices( getSupportedServiceNames() ); + sal_Int32 nServices = aServices.getLength(); + for( sal_Int32 i = 0; i < nServices; i++ ) + { + if( aServices[i] == ServiceName ) + return sal_True; + } + return sal_False; +} + +Reference< ::com::sun::star::datatransfer::XTransferable > GenericClipboard::getContents() throw( RuntimeException ) +{ + return m_aContents; +} + +void GenericClipboard::setContents( + const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner ); + Reference< datatransfer::XTransferable > xOldContents( m_aContents ); + m_aContents = xTrans; + m_aOwner = xClipboardOwner; + + std::list< Reference< datatransfer::clipboard::XClipboardListener > > xListeners( m_aListeners ); + datatransfer::clipboard::ClipboardEvent aEv; + aEv.Contents = m_aContents; + + aGuard.clear(); + + if( xOldOwner.is() && xOldOwner != xClipboardOwner ) + xOldOwner->lostOwnership( this, xOldContents ); + for( std::list< Reference< datatransfer::clipboard::XClipboardListener > >::iterator it = + xListeners.begin(); it != xListeners.end() ; ++it ) + { + (*it)->changedContents( aEv ); + } +} + +rtl::OUString GenericClipboard::getName() throw( RuntimeException ) +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CLIPBOARD" ) ); +} + +sal_Int8 GenericClipboard::getRenderingCapabilities() throw( RuntimeException ) +{ + return 0; +} + +void GenericClipboard::addClipboardListener( const Reference< datatransfer::clipboard::XClipboardListener >& listener ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + + m_aListeners.push_back( listener ); +} + +void GenericClipboard::removeClipboardListener( const Reference< datatransfer::clipboard::XClipboardListener >& listener ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + + m_aListeners.remove( listener ); +} + +// ------------------------------------------------------------------------ + +class ClipboardFactory : public ::cppu::WeakComponentImplHelper1< + com::sun::star::lang::XSingleServiceFactory +> +{ + osl::Mutex m_aMutex; +public: + ClipboardFactory(); + virtual ~ClipboardFactory(); + + /* + * XSingleServiceFactory + */ + virtual Reference< XInterface > SAL_CALL createInstance() throw(); + virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& rArgs ) throw(); +}; + +// ------------------------------------------------------------------------ + +ClipboardFactory::ClipboardFactory() : + cppu::WeakComponentImplHelper1< + com::sun::star::lang::XSingleServiceFactory +>( m_aMutex ) +{ +} + +// ------------------------------------------------------------------------ + +ClipboardFactory::~ClipboardFactory() +{ +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > ClipboardFactory::createInstance() throw() +{ + return createInstanceWithArguments( Sequence< Any >() ); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw() +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateClipboard( arguments ); + return xResult; +} + +// ------------------------------------------------------------------------ + +Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +OUString SAL_CALL Clipboard_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.X11ClipboardSupport" + #else + "com.sun.star.datatransfer.clipboard.AquaClipboard" + #endif + ) ); + #else + return GenericClipboard::getImplementationName_static(); + #endif +} + +Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ) +{ + return Reference< XSingleServiceFactory >( new ClipboardFactory() ); +} + +/* +* generic DragSource dummy +*/ +class GenericDragSource : public cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDragSource, + XInitialization + > +{ + osl::Mutex m_aMutex; +public: + GenericDragSource() : cppu::WeakComponentImplHelper2< datatransfer::dnd::XDragSource, XInitialization >( m_aMutex ) {} + virtual ~GenericDragSource(); + + // XDragSource + virtual sal_Bool SAL_CALL isDragImageSupported() throw(); + virtual sal_Int32 SAL_CALL getDefaultCursor( sal_Int8 dragAction ) throw(); + virtual void SAL_CALL startDrag( + const datatransfer::dnd::DragGestureEvent& trigger, + sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, + const Reference< datatransfer::XTransferable >& transferable, + const Reference< datatransfer::dnd::XDragSourceListener >& listener + ) throw(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception ); + + static Sequence< OUString > getSupportedServiceNames_static() + { + Sequence< OUString > aRet( 1 ); + aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDragSource" ); + return aRet; + } + + static OUString getImplementationName_static() + { + return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDragSource" ); + } +}; + +GenericDragSource::~GenericDragSource() +{ +} + +sal_Bool GenericDragSource::isDragImageSupported() throw() +{ + return sal_False; +} + +sal_Int32 GenericDragSource::getDefaultCursor( sal_Int8 ) throw() +{ + return 0; +} + +void GenericDragSource::startDrag( const datatransfer::dnd::DragGestureEvent&, + sal_Int8 /*sourceActions*/, sal_Int32 /*cursor*/, sal_Int32 /*image*/, + const Reference< datatransfer::XTransferable >&, + const Reference< datatransfer::dnd::XDragSourceListener >& listener + ) throw() +{ + datatransfer::dnd::DragSourceDropEvent aEv; + aEv.DropAction = datatransfer::dnd::DNDConstants::ACTION_COPY; + aEv.DropSuccess = sal_False; + listener->dragDropEnd( aEv ); +} + +void GenericDragSource::initialize( const Sequence< Any >& ) throw( Exception ) +{ +} + + +Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames() +{ + #if defined UNX + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.X11DragSource" + #else + "com.sun.star.datatransfer.dnd.OleDragSource" + #endif + ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; + #else + return GenericDragSource::getSupportedServiceNames_static(); + #endif +} + +OUString SAL_CALL DragSource_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.XdndSupport" + #else + "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1" + #endif + ) ); + #else + return GenericDragSource::getImplementationName_static(); + #endif +} + +Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory >& ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDragSource(); + return xResult; +} + +/* +* generic DragSource dummy +*/ + +class GenericDropTarget : public cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDropTarget, + XInitialization + > +{ + osl::Mutex m_aMutex; +public: + GenericDropTarget() : cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDropTarget, + XInitialization + > ( m_aMutex ) + {} + virtual ~GenericDropTarget(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& args ) throw ( Exception ); + + // XDropTarget + virtual void SAL_CALL addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual sal_Bool SAL_CALL isActive() throw(); + virtual void SAL_CALL setActive( sal_Bool active ) throw(); + virtual sal_Int8 SAL_CALL getDefaultActions() throw(); + virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(); + + static Sequence< OUString > getSupportedServiceNames_static() + { + Sequence< OUString > aRet( 1 ); + aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDropTarget" ); + return aRet; + } + + static OUString getImplementationName_static() + { + return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDropTarget" ); + } +}; + +GenericDropTarget::~GenericDropTarget() +{ +} + +void GenericDropTarget::initialize( const Sequence< Any >& ) throw( Exception ) +{ +} + +void GenericDropTarget::addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw() +{ +} + +void GenericDropTarget::removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw() +{ +} + +sal_Bool GenericDropTarget::isActive() throw() +{ + return sal_False; +} + +void GenericDropTarget::setActive( sal_Bool ) throw() +{ +} + +sal_Int8 GenericDropTarget::getDefaultActions() throw() +{ + return 0; +} + +void GenericDropTarget::setDefaultActions( sal_Int8) throw() +{ +} + +Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames() +{ + #if defined UNX + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.X11DropTarget" + #else + "com.sun.star.datatransfer.dnd.OleDropTarget" + #endif + ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; + #else + return GenericDropTarget::getSupportedServiceNames_static(); + #endif +} + +OUString SAL_CALL DropTarget_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.XdndDropTarget" + #else + "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1" + #endif + ) ); + #else + return GenericDropTarget::getImplementationName_static(); + #endif +} + +Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory >& ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDropTarget(); + return xResult; +} + + +} // namespace vcl + +/* +* SalInstance generic +*/ +Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& ) +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericClipboard() ); +} + +Reference< XInterface > SalInstance::CreateDragSource() +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDragSource() ); +} + +Reference< XInterface > SalInstance::CreateDropTarget() +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDropTarget() ); +} + diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index ef2e5c3b85fd..e816c31c613a 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -59,11 +59,23 @@ namespace vcl { extern Sequence< OUString > SAL_CALL DisplayAccess_getSupportedServiceNames(); extern OUString SAL_CALL DisplayAccess_getImplementationName(); -extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & ); +extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & ); extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames(); extern OUString SAL_CALL FontIdentificator_getImplementationName(); -extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); +extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames(); +extern OUString SAL_CALL Clipboard_getImplementationName(); +extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames(); +extern OUString SAL_CALL DragSource_getImplementationName(); +extern Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames(); +extern OUString SAL_CALL DropTarget_getImplementationName(); +extern Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory > & ); } extern "C" { @@ -102,6 +114,26 @@ extern "C" { aImplName.append( vcl::FontIdentificator_getSupportedServiceNames()[0] ); xKey->createKey( aImplName.makeStringAndClear() ); + #if defined UNX + aImplName.appendAscii( "/" ); + aImplName.append( vcl::Clipboard_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::Clipboard_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + + aImplName.appendAscii( "/" ); + aImplName.append( vcl::DragSource_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::DragSource_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + + aImplName.appendAscii( "/" ); + aImplName.append( vcl::DropTarget_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::DropTarget_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + #endif + return sal_True; } catch( ::com::sun::star::registry::InvalidRegistryException& ) @@ -143,6 +175,22 @@ extern "C" { xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, vcl::FontIdentificator_getSupportedServiceNames() ); } + else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = vcl::Clipboard_createFactory( xMgr ); + } + else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance, + vcl::DragSource_getSupportedServiceNames() ); + } + else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance, + vcl::DropTarget_getSupportedServiceNames() ); + } if( xFactory.is() ) { xFactory->acquire(); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk index 9158d33bb888..8cc836fe5424 100644 --- a/vcl/source/components/makefile.mk +++ b/vcl/source/components/makefile.mk @@ -44,6 +44,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES= $(SLO)$/display.obj \ + $(SLO)$/dtranscomp.obj \ $(SLO)$/fontident.obj \ $(SLO)$/factory.obj diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 2e2342fc6fc8..e7a4aadb8694 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -420,10 +420,9 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Image *pImage = &(mpButtonData->maImage); BitmapEx *pBitmapEx = mpButtonData->mpBitmapEx; - Color aBackCol; - if( !!(mpButtonData->maImageHC) && ImplGetCurrentBackgroundColor( aBackCol ) ) + if( !!(mpButtonData->maImageHC) ) { - if( aBackCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) { pImage = &(mpButtonData->maImageHC); pBitmapEx = mpButtonData->mpBitmapExHC; @@ -2375,14 +2374,10 @@ if ( bNativeOK == FALSE ) // check for HC mode Image *pImage = &maImage; - Color aBackCol; - if( !!maImageHC && ImplGetCurrentBackgroundColor( aBackCol ) ) + if( !!maImageHC ) { - if( aBackCol.IsDark() ) + if( rStyleSettings.GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aBackCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } Point aImagePos( aImageRect.TopLeft() ); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 49c7e5457da7..f83e46e38302 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -287,6 +287,7 @@ BOOL ComboBox::IsAutocompleteEnabled() const IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG ) { + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpSubEdit->GrabFocus(); if ( !mpImplLB->GetEntryList()->GetMRUCount() ) ImplUpdateFloatSelection(); @@ -523,6 +524,7 @@ void ComboBox::ToggleDropDown() ImplUpdateFloatSelection(); else mpImplLB->SelectEntry( 0 , TRUE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpBtn->SetPressed( TRUE ); SetSelection( Selection( 0, SELECTION_MAX ) ); mpFloatWin->StartFloat( TRUE ); @@ -800,14 +802,8 @@ void ComboBox::DataChanged( const DataChangedEvent& rDCEvt ) long ComboBox::PreNotify( NotifyEvent& rNEvt ) { - long nDone = 0; - - if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) ) - { - mpSubEdit->GrabFocus(); - } - return nDone ? nDone : Edit::PreNotify( rNEvt ); + return Edit::PreNotify( rNEvt ); } // ----------------------------------------------------------------------- @@ -830,6 +826,7 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) ImplUpdateFloatSelection(); if( ( nKeyCode == KEY_DOWN ) && mpFloatWin && !mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() ) { + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpBtn->SetPressed( TRUE ); if ( mpImplLB->GetEntryList()->GetMRUCount() ) mpImplLB->SelectEntry( 0 , TRUE ); @@ -886,6 +883,10 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) nDone = 0; // don't eat this event, let the default handling happen (i.e. scroll the context) } } + else if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) ) + { + mpSubEdit->GrabFocus(); + } return nDone ? nDone : Edit::Notify( rNEvt ); } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 1bc6af51f369..3cb6e45f0400 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -503,6 +503,9 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId ) mnFieldValue = mnMin; mnLastValue = mnFieldValue; } + + if ( NUMERICFORMATTER_NOTHOUSANDSEP & nMask ) + SetUseThousandSep( !(BOOL)pMgr->ReadShort() ); } } diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 530e928532e1..ecb066d107ce 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -804,13 +804,10 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, ULONG /* nDrawFlags */, USHORT nStyle = 0; Bitmap* pBitmap = &maBitmap; Color aCol; - if( !!maBitmapHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maBitmapHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pBitmap = &maBitmapHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) @@ -1058,13 +1055,10 @@ void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, Image *pImage = &maImage; Color aCol; - if( !!maImageHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maImageHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } // Haben wir ueberhaupt ein Image diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a25ddbb68e8b..c0a28c8b03fd 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2899,23 +2899,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP if( !!maImageHC ) { - // determine backgroundcolor as done in Paint() - Color aBackCol; - if( IsEnabled() ) - { - if( HasFocus() ) - aBackCol = GetSettings().GetStyleSettings().GetHighlightColor(); - else - aBackCol = GetBackground().GetColor(); - } - else // Disabled - aBackCol = GetBackground().GetColor(); - - if( aBackCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aBackCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if ( !IsZoom() ) diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 6d4777013a73..73b5154d32ac 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -93,14 +93,10 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt ) { USHORT nStyle = 0; BitmapEx* pBitmap = &maBmp; - Color aCol; - if( !!maBmpHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maBmpHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pBitmap = &maBmpHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if ( !*pBitmap ) diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index a5e9ff1cc7d0..a4d3cbc22544 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -303,6 +303,7 @@ IMPL_LINK( ListBox, ImplClickBtnHdl, void*, EMPTYARG ) { if( !mpFloatWin->IsInPopupMode() ) { + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpImplWin->GrabFocus(); mpBtn->SetPressed( TRUE ); mpFloatWin->StartFloat( TRUE ); @@ -363,6 +364,7 @@ void ListBox::ToggleDropDown() mpFloatWin->EndPopupMode(); else { + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpImplWin->GrabFocus(); mpBtn->SetPressed( TRUE ); mpFloatWin->StartFloat( TRUE ); @@ -919,6 +921,7 @@ long ListBox::PreNotify( NotifyEvent& rNEvt ) if( mpFloatWin && !mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() ) { + ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpBtn->SetPressed( TRUE ); mpFloatWin->StartFloat( FALSE ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 7af7e7e9c9e0..e5d83dc0733a 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -42,8 +42,10 @@ typedef long long S64; typedef sal_Int32 GlyphWidth; +typedef float RealType; +typedef RealType ValType; #include <vector> -typedef std::vector<int> IntVector; +typedef std::vector<ValType> ValVector; // ==================================================================== @@ -310,8 +312,8 @@ struct CffGlobal int mnFontDictBase; int mnFDAryCount; - IntVector maFontBBox; - //FloatVector maFontMatrix; + ValVector maFontBBox; + ValVector maFontMatrix; int mnFontNameSID; int mnFullNameSID; @@ -336,16 +338,16 @@ struct CffLocal // ATM hinting related values int mnStemStdHW; int mnStemStdVW; - IntVector maStemSnapH; - IntVector maStemSnapV; - IntVector maBlueValues; - IntVector maOtherBlues; - IntVector maFamilyBlues; - IntVector maFamilyOtherBlues; - double mfBlueScale; - double mfBlueShift; - double mfBlueFuzz; - double mfExpFactor; + ValVector maStemSnapH; + ValVector maStemSnapV; + ValVector maBlueValues; + ValVector maOtherBlues; + ValVector maFamilyBlues; + ValVector maFamilyOtherBlues; + RealType mfBlueScale; + RealType mfBlueShift; + RealType mfBlueFuzz; + RealType mfExpFactor; int mnLangGroup; bool mbForceBold; }; @@ -422,7 +424,7 @@ private: CffLocal* mpCffLocal; void readDictOp( void); - double readRealVal( void); + RealType readRealVal( void); const char* getString( int nStringID); int getFDSelect( int nGlyphIndex) const; int getGlyphSID( int nGlyphIndex) const; @@ -431,7 +433,7 @@ private: void readTypeOp( void); void read2push( void); void pop2write( void); - void writeType1Val( int/*TODO: double*/ nVal); + void writeType1Val( ValType); void writeTypeOp( int nTypeOp); void writeTypeEsc( int nTypeOp); void writeCurveTo( int nStackPos, int nIX1, int nIY1, int nIX2, int nIY2, int nIX3, int nIY3); @@ -441,10 +443,13 @@ private: public: // TODO: is public really needed? // accessing the value stack // TODO: add more checks - void push( int nVal) { mnValStack[ mnStackIdx++] = nVal;} - int pop( void) { return ((mnStackIdx>0) ? mnValStack[ --mnStackIdx] : 0);} - int peek( void) { return ((mnStackIdx>0) ? mnValStack[ mnStackIdx-1] : 0);} - int get( int nIndex) { return mnValStack[ nIndex];} + void push( ValType nVal) { mnValStack[ mnStackIdx++] = nVal;} + ValType popVal( void) { return ((mnStackIdx>0) ? mnValStack[ --mnStackIdx] : 0);} + ValType peekVal( void) const { return ((mnStackIdx>0) ? mnValStack[ mnStackIdx-1] : 0);} + ValType getVal( int nIndex) const { return mnValStack[ nIndex];} + int popInt( void); + int peekInt( void) const; + int getInt( int nIndex) const; int size( void) const { return mnStackIdx;} bool empty( void) const { return !mnStackIdx;} void clear( void) { mnStackIdx = 0;} @@ -453,7 +458,7 @@ public: // TODO: is public really needed? void addHints( bool bVerticalHints); int getHorzHintCount( void) const { return (mnHorzHintSize/2);} int getVertHintCount( void) const { return (mnHintSize-mnHorzHintSize)/2;} - void getHintPair( int nIndex, int* nMin, int* nEnd) const; + void getHintPair( int nIndex, ValType* nMin, ValType* nEnd) const; // accessing other charstring specifics bool hasCharWidth( void) const { return (mnCharWidth != -1);} @@ -465,12 +470,12 @@ public: // TODO: is public really needed? private: // typeop exceution context int mnStackIdx; - int mnValStack[ NMAXSTACK]; - int mnTransVals[ NMAXTRANS]; + ValType mnValStack[ NMAXSTACK]; + ValType mnTransVals[ NMAXTRANS]; int mnHintSize; int mnHorzHintSize; - int mnHintStack[ NMAXHINTS]; + ValType mnHintStack[ NMAXHINTS]; int mnCharWidth; }; @@ -499,6 +504,36 @@ CffSubsetterContext::~CffSubsetterContext( void) // -------------------------------------------------------------------- +inline int CffSubsetterContext::popInt( void) +{ + const ValType aVal = popVal(); + const int nInt = static_cast<int>(aVal); + assert( nInt == aVal); + return nInt; +} + +// -------------------------------------------------------------------- + +inline int CffSubsetterContext::peekInt( void) const +{ + const ValType aVal = peekVal(); + const int nInt = static_cast<int>(aVal); + assert( nInt == aVal); + return nInt; +} + +// -------------------------------------------------------------------- + +inline int CffSubsetterContext::getInt( int nIndex) const +{ + const ValType aVal = getVal( nIndex); + const int nInt = static_cast<int>(aVal); + assert( nInt == aVal); + return nInt; +} + +// -------------------------------------------------------------------- + inline void CffSubsetterContext::updateWidth( bool bUseFirstVal) { #if 1 // TODO: is this still needed? @@ -507,7 +542,7 @@ inline void CffSubsetterContext::updateWidth( bool bUseFirstVal) return; #endif if( bUseFirstVal) { - mnCharWidth = mpCffLocal->mnNominalWidth + mnValStack[0]; + mnCharWidth = static_cast<int>(mpCffLocal->mnNominalWidth + mnValStack[0]); // remove bottom stack entry --mnStackIdx; for( int i = 0; i < mnStackIdx; ++i) @@ -535,16 +570,16 @@ void CffSubsetterContext::addHints( bool bVerticalHints) assert( (mnHintSize + mnStackIdx) <= 2*NMAXHINTS); #ifdef IGNORE_HINTS - mnHorzHintSize += mnStackIdx; + mnHintSize += mnStackIdx; #else - int nHintOfs = 0; + ValType nHintOfs = 0; for( int i = 0; i < mnStackIdx; ++i) { - nHintOfs += mnValStack[ i]; + nHintOfs += mnValStack[ i ]; mnHintStack[ mnHintSize++] = nHintOfs; } +#endif // IGNORE_HINTS if( !bVerticalHints) mnHorzHintSize = mnHintSize; -#endif // IGNORE_HINTS // clear all values from the stack mnStackIdx = 0; @@ -552,12 +587,12 @@ void CffSubsetterContext::addHints( bool bVerticalHints) // -------------------------------------------------------------------- -void CffSubsetterContext::getHintPair( int nIndex, int* pMin, int* pEnd) const +void CffSubsetterContext::getHintPair( int nIndex, ValType* pMin, ValType* pEnd) const { nIndex *= 2; assert( nIndex < mnHintSize); assert( nIndex >= 0); - const int* pHint = &mnHintStack[ nIndex]; + const ValType* pHint = &mnHintStack[ nIndex ]; *pMin = pHint[0]; *pEnd = pHint[1]; } @@ -596,7 +631,8 @@ void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen) void CffSubsetterContext::readDictOp( void) { - int nVal = 0; + ValType nVal = 0; + int nInt = 0; const U8 c = *mpReadPtr; if( c <= 21 ) { int nOpId = *(mpReadPtr++); @@ -613,41 +649,45 @@ void CffSubsetterContext::readDictOp( void) switch( *pCmdName) { default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break; case 'b': // bool - nVal = pop(); + nInt = popInt(); switch( nOpId) { - case 915: mpCffLocal->mbForceBold = nVal; break; // "ForceBold" + case 915: mpCffLocal->mbForceBold = nInt; break; // "ForceBold" default: break; // TODO: handle more boolean dictops? } break; case 'n': // dict-op number - nVal = pop(); + nVal = popVal(); + nInt = static_cast<int>(nVal); switch( nOpId) { - case 10: mpCffLocal->mnStemStdHW = nVal; break; // "StdHW" - case 11: mpCffLocal->mnStemStdVW = nVal; break; // "StdVW" - case 15: mnCharsetBase = nVal; break; // "charset" - case 16: mnEncodingBase = nVal; break; // "nEncoding" - case 17: mnCharStrBase = nVal; break; // "nCharStrings" - case 19: mpCffLocal->mnLocalSubrOffs = nVal; break;// "nSubrs" - case 20: setDefaultWidth( nVal); break; // "defaultWidthX" - case 21: setNominalWidth( nVal); break; // "nominalWidthX" + case 10: mpCffLocal->mnStemStdHW = nInt; break; // "StdHW" + case 11: mpCffLocal->mnStemStdVW = nInt; break; // "StdVW" + case 15: mnCharsetBase = nInt; break; // "charset" + case 16: mnEncodingBase = nInt; break; // "nEncoding" + case 17: mnCharStrBase = nInt; break; // "nCharStrings" + case 19: mpCffLocal->mnLocalSubrOffs = nInt; break;// "nSubrs" + case 20: setDefaultWidth( nInt ); break; // "defaultWidthX" + case 21: setNominalWidth( nInt ); break; // "nominalWidthX" case 909: mpCffLocal->mfBlueScale = nVal; break; // "BlueScale" case 910: mpCffLocal->mfBlueShift = nVal; break; // "BlueShift" case 911: mpCffLocal->mfBlueFuzz = nVal; break; // "BlueFuzz" case 912: mpCffLocal->mfExpFactor = nVal; break; // "ExpansionFactor" - case 917: mpCffLocal->mnLangGroup = nVal; break; // "LanguageGroup" - case 936: mnFontDictBase = nVal; break; // "nFDArray" - case 937: mnFDSelectBase = nVal; break; // "nFDSelect" + case 917: mpCffLocal->mnLangGroup = nInt; break; // "LanguageGroup" + case 936: mnFontDictBase = nInt; break; // "nFDArray" + case 937: mnFDSelectBase = nInt; break; // "nFDSelect" default: break; // TODO: handle more numeric dictops? } break; case 'a': { // array + switch( nOpId) { + case 5: maFontBBox.clear(); break; // "FontBBox" + case 907: maFontMatrix.clear(); break; // "FontMatrix" + default: break; // TODO: reset other arrays? + } for( int i = 0; i < size(); ++i ) { - nVal = get(i); + nVal = getVal(i); switch( nOpId) { case 5: maFontBBox.push_back( nVal); break; // "FontBBox" -#if 0 // TODO case 907: maFontMatrix.push_back( nVal); break; // "FontMatrix" -#endif default: break; // TODO: handle more array dictops? } } @@ -656,7 +696,7 @@ void CffSubsetterContext::readDictOp( void) case 'd': { // delta array nVal = 0; for( int i = 0; i < size(); ++i ) { - nVal += get(i); + nVal += getVal(i); switch( nOpId) { case 6: mpCffLocal->maBlueValues.push_back( nVal); break; // "BlueValues" case 7: mpCffLocal->maOtherBlues.push_back( nVal); break; // "OtherBlues" @@ -670,39 +710,39 @@ void CffSubsetterContext::readDictOp( void) clear(); } break; case 's': // stringid (SID) - nVal = pop(); - switch( nOpId) { - case 2: mnFullNameSID = nVal; break; // "FullName" - case 3: mnFamilyNameSID = nVal; break; // "FamilyName" - case 938: mnFontNameSID = nVal; break; // "FontName" + nInt = popInt(); + switch( nOpId ) { + case 2: mnFullNameSID = nInt; break; // "FullName" + case 3: mnFamilyNameSID = nInt; break; // "FamilyName" + case 938: mnFontNameSID = nInt; break; // "FontName" default: break; // TODO: handle more string dictops? } break; case 'P': // private dict - mpCffLocal->mnPrivDictBase = pop(); - mpCffLocal->mnPrivDictSize = pop(); + mpCffLocal->mnPrivDictBase = popInt(); + mpCffLocal->mnPrivDictSize = popInt(); break; case 'r': { // ROS operands - int nSid1 = pop(); - int nSid2 = pop(); + int nSid1 = popInt(); + int nSid2 = popInt(); (void)nSid1; // TODO: use (void)nSid2; // TODO: use - nVal = pop(); + nVal = popVal(); mbCIDFont = true; } break; case 't': // CharstringType - nVal = pop(); - setCharStringType( nVal); + nInt = popInt(); + setCharStringType( nInt ); break; } return; } - if( (c >= 32) || (c == 28)) { + if( (c >= 32) || (c == 28) ) { // --mpReadPtr; read2push(); - } else if( c == 29) { // longint + } else if( c == 29 ) { // longint ++mpReadPtr; // skip 29 int nS32 = mpReadPtr[0] << 24; nS32 += mpReadPtr[1] << 16; @@ -711,13 +751,13 @@ void CffSubsetterContext::readDictOp( void) if( (sizeof(nS32) != 4) && (nS32 & (1<<31))) nS32 |= (~0U) << 31; // assuming 2s complement mpReadPtr += 4; - nVal = nS32; - push( nVal); + nVal = static_cast<ValType>(nS32); + push( nVal ); } else if( c == 30) { // real number ++mpReadPtr; // skip 30 - const double fReal = readRealVal(); + const RealType fReal = readRealVal(); // push value onto stack - nVal = static_cast<int>(fReal+0.5); //TODO!!! allow float on operand stack! + nVal = fReal; push( nVal); } } @@ -759,12 +799,12 @@ void CffSubsetterContext::readTypeOp( void) case 'C': nMinStack = 6; nMaxStack = 999; break; case 'E': nMinStack = 1; nMaxStack = 999; break; case 'G': nMinStack = 1; nMaxStack = 999; // global subr - nVal = peek(); + nVal = peekInt(); // TODO global subr break; case 'L': // local subr nMinStack = 1; nMaxStack = 999; - nVal = peek(); + nVal = peekInt(); // TODO local subr break; case 'I': // operands for "index" @@ -830,57 +870,70 @@ void CffSubsetterContext::readTypeOp( void) // -------------------------------------------------------------------- -void CffSubsetterContext::read2push( void) +void CffSubsetterContext::read2push() { - int nVal = 0; + ValType aVal = 0; const U8*& p = mpReadPtr; const U8 c = *p; - if( c == 28) { + if( c == 28 ) { short nS16 = (p[1] << 8) + p[2]; if( (sizeof(nS16) != 2) && (nS16 & (1<<15))) nS16 |= (~0U) << 15; // assuming 2s complement - nVal = nS16; + aVal = nS16; p += 3; - } else if( c <= 246) { // -107..+107 - nVal = p[0] - 139; + } else if( c <= 246 ) { // -107..+107 + aVal = static_cast<ValType>(p[0] - 139); p += 1; - } else if( c <= 250) { // +108..+1131 - nVal = ((p[0] << 8) + p[1]) - 63124; + } else if( c <= 250 ) { // +108..+1131 + aVal = static_cast<ValType>(((p[0] << 8) + p[1]) - 63124); p += 2; - } else if( c <= 254) { // -108..-1131 - nVal = 64148 - ((p[0] << 8) + p[1]); + } else if( c <= 254 ) { // -108..-1131 + aVal = static_cast<ValType>(64148 - ((p[0] << 8) + p[1])); p += 2; } else /*if( c == 255)*/ { // Fixed16.16 - nVal = (p[1] << 8) + p[2]; - // TODO: read non-integer part + int nS32 = (p[1] << 24) + (p[2] << 16) + (p[3] << 8) + p[4]; + if( (sizeof(nS32) != 2) && (nS32 & (1<<31))) + nS32 |= (~0U) << 31; // assuming 2s complement + aVal = static_cast<ValType>(nS32 * (1.0 / 0x10000)); p += 5; } - push( nVal); + push( aVal); } // -------------------------------------------------------------------- -void CffSubsetterContext::writeType1Val( int/*TODO: double*/ nVal) +void CffSubsetterContext::writeType1Val( ValType aVal) { U8* pOut = mpWritePtr; - if( (nVal >= -107) && (nVal <= +107)) { - *(pOut++) = static_cast<U8>(nVal + 139); // -107..+107 - } else if( (nVal >= -1131) && (nVal <= +1131)) { - if( nVal >= 0) - nVal += 63124; // +108..+1131 + + int nInt = static_cast<int>(aVal); + static const int nOutCharstrType = 1; + if( (nInt != aVal) && (nOutCharstrType == 2)) { + // numtype==255 means int32 for Type1, but 16.16 for Type2 charstrings!!! + *(pOut++) = 255; // Fixed 16.16 + *(pOut++) = static_cast<U8>(nInt >> 8); + *(pOut++) = static_cast<U8>(nInt); + nInt = static_cast<int>(aVal * 0x10000) & 0xFFFF; + *(pOut++) = static_cast<U8>(nInt >> 8); + *(pOut++) = static_cast<U8>(nInt); + } else if( (nInt >= -107) && (nInt <= +107)) { + *(pOut++) = static_cast<U8>(nInt + 139); // -107..+107 + } else if( (nInt >= -1131) && (nInt <= +1131)) { + if( nInt >= 0) + nInt += 63124; // +108..+1131 else - nVal = 64148 - nVal; // -108..-1131 - *(pOut++) = static_cast<U8>(nVal >> 8); - *(pOut++) = static_cast<U8>(nVal); - } else { + nInt = 64148 - nInt; // -108..-1131 + *(pOut++) = static_cast<U8>(nInt >> 8); + *(pOut++) = static_cast<U8>(nInt); + } else if( nOutCharstrType == 1) { // numtype==255 means int32 for Type1, but 16.16 for Type2 charstrings!!! *(pOut++) = 255; - *(pOut++) = static_cast<U8>(nVal >> 24); - *(pOut++) = static_cast<U8>(nVal >> 16); - *(pOut++) = static_cast<U8>(nVal >> 8); - *(pOut++) = static_cast<U8>(nVal); + *(pOut++) = static_cast<U8>(nInt >> 24); + *(pOut++) = static_cast<U8>(nInt >> 16); + *(pOut++) = static_cast<U8>(nInt >> 8); + *(pOut++) = static_cast<U8>(nInt); } mpWritePtr = pOut; @@ -890,8 +943,8 @@ void CffSubsetterContext::writeType1Val( int/*TODO: double*/ nVal) inline void CffSubsetterContext::pop2write( void) { - int nVal = pop(); - writeType1Val( nVal); + const ValType aVal = popVal(); + writeType1Val( aVal); } // -------------------------------------------------------------------- @@ -915,8 +968,8 @@ void CffSubsetterContext::pop2MultiWrite( int nArgsPerTypo, int nTypeOp, int nTy { for( int i = 0; i < mnStackIdx;) { for( int j = 0; j < nArgsPerTypo; ++j) { - int nVal = mnValStack[i+j]; - writeType1Val( nVal); + const ValType aVal = mnValStack[i+j]; + writeType1Val( aVal); } i += nArgsPerTypo; writeTypeOp( nTypeOp); @@ -931,8 +984,8 @@ void CffSubsetterContext::popAll2Write( int nTypeOp) { // pop in reverse order, then write for( int i = 0; i < mnStackIdx; ++i) { - int nVal = mnValStack[i]; - writeType1Val( nVal); + const ValType aVal = mnValStack[i]; + writeType1Val( aVal); } clear(); writeTypeOp( nTypeOp); @@ -944,23 +997,23 @@ void CffSubsetterContext::writeCurveTo( int nStackPos, int nIX1, int nIY1, int nIX2, int nIY2, int nIX3, int nIY3) { // get the values from the stack - const int nDX1 = nIX1 ? mnValStack[ nStackPos+nIX1] : 0; - const int nDY1 = nIY1 ? mnValStack[ nStackPos+nIY1] : 0; - const int nDX2 = nIX2 ? mnValStack[ nStackPos+nIX2] : 0; - const int nDY2 = nIY2 ? mnValStack[ nStackPos+nIY2] : 0; - const int nDX3 = nIX3 ? mnValStack[ nStackPos+nIX3] : 0; - const int nDY3 = nIY3 ? mnValStack[ nStackPos+nIY3] : 0; + const ValType nDX1 = nIX1 ? mnValStack[ nStackPos+nIX1 ] : 0; + const ValType nDY1 = nIY1 ? mnValStack[ nStackPos+nIY1 ] : 0; + const ValType nDX2 = nIX2 ? mnValStack[ nStackPos+nIX2 ] : 0; + const ValType nDY2 = nIY2 ? mnValStack[ nStackPos+nIY2 ] : 0; + const ValType nDX3 = nIX3 ? mnValStack[ nStackPos+nIX3 ] : 0; + const ValType nDY3 = nIY3 ? mnValStack[ nStackPos+nIY3 ] : 0; // emit the curveto operator and operands // TODO: determine the most efficient curveto operator // TODO: depending on type1op or type2op target - writeType1Val( nDX1); - writeType1Val( nDY1); - writeType1Val( nDX2); - writeType1Val( nDY2); - writeType1Val( nDX3); - writeType1Val( nDY3); - writeTypeOp( TYPE1OP::RCURVETO); + writeType1Val( nDX1 ); + writeType1Val( nDY1 ); + writeType1Val( nDX2 ); + writeType1Val( nDY2 ); + writeType1Val( nDX3 ); + writeType1Val( nDY3 ); + writeTypeOp( TYPE1OP::RCURVETO ); } // -------------------------------------------------------------------- @@ -969,7 +1022,7 @@ void CffSubsetterContext::convertOneTypeOp( void) { const int nType2Op = *(mpReadPtr++); - int i, nVal; // prevent WAE for declarations inside switch cases + int i, nInt; // prevent WAE for declarations inside switch cases // convert each T2op switch( nType2Op) { case TYPE2OP::T2ESC: @@ -977,12 +1030,12 @@ void CffSubsetterContext::convertOneTypeOp( void) break; case TYPE2OP::HSTEM: case TYPE2OP::VSTEM: - addHints( nType2Op == TYPE2OP::VSTEM); + addHints( nType2Op == TYPE2OP::VSTEM ); #ifndef IGNORE_HINTS - for( i = 0; i < mnHintSize; i+=2) { + for( i = 0; i < mnHintSize; i+=2 ) { writeType1Val( mnHintStack[i]); writeType1Val( mnHintStack[i+1] - mnHintStack[i]); - writeTypeOp( nType2Op); + writeTypeOp( nType2Op ); } #endif // IGNORE_HINTS break; @@ -1063,9 +1116,9 @@ void CffSubsetterContext::convertOneTypeOp( void) case TYPE2OP::CALLSUBR: case TYPE2OP::CALLGSUBR: { - nVal = pop(); + nInt = popInt(); const bool bGlobal = (nType2Op == TYPE2OP::CALLGSUBR); - callType2Subr( bGlobal, nVal); + callType2Subr( bGlobal, nInt); } break; case TYPE2OP::RETURN: @@ -1131,19 +1184,19 @@ void CffSubsetterContext::convertOneTypeOp( void) { bool bVert = (nType2Op == TYPE2OP::VHCURVETO); i = 0; - nVal = 0; - if( mnStackIdx & 1) - nVal = mnValStack[ --mnStackIdx]; + nInt = 0; + if( mnStackIdx & 1 ) + nInt = static_cast<int>(mnValStack[ --mnStackIdx ]); while( (i += 4) <= mnStackIdx) { // TODO: use writeCurveTo() - if( bVert) writeType1Val( 0); - writeType1Val( mnValStack[i-4]); - if( !bVert) writeType1Val( 0); - writeType1Val( mnValStack[i-3]); - writeType1Val( mnValStack[i-2]); - if( !bVert) writeType1Val( (i==mnStackIdx) ? nVal : 0); - writeType1Val( mnValStack[i-1]); - if( bVert) writeType1Val( (i==mnStackIdx) ? nVal : 0 ); + if( bVert ) writeType1Val( 0 ); + writeType1Val( mnValStack[i-4] ); + if( !bVert ) writeType1Val( 0); + writeType1Val( mnValStack[i-3] ); + writeType1Val( mnValStack[i-2] ); + if( !bVert ) writeType1Val( static_cast<ValType>((i==mnStackIdx) ? nInt : 0) ); + writeType1Val( mnValStack[i-1] ); + if( bVert ) writeType1Val( static_cast<ValType>((i==mnStackIdx) ? nInt : 0) ); bVert = !bVert; writeTypeOp( TYPE2OP::RCURVETO); } @@ -1195,83 +1248,83 @@ void CffSubsetterContext::convertOneTypeOp( void) void CffSubsetterContext::convertOneTypeEsc( void) { const int nType2Esc = *(mpReadPtr++); - int* pTop = &mnValStack[ mnStackIdx-1]; + ValType* pTop = &mnValStack[ mnStackIdx-1]; // convert each T2op switch( nType2Esc) { case TYPE2OP::AND: - assert( mnStackIdx >= 2); - pTop[0] &= pTop[-1]; + assert( mnStackIdx >= 2 ); + pTop[0] = static_cast<ValType>(static_cast<int>(pTop[0]) & static_cast<int>(pTop[-1])); --mnStackIdx; break; case TYPE2OP::OR: - assert( mnStackIdx >= 2); - pTop[0] |= pTop[-1]; + assert( mnStackIdx >= 2 ); + pTop[0] = static_cast<ValType>(static_cast<int>(pTop[0]) | static_cast<int>(pTop[-1])); --mnStackIdx; break; case TYPE2OP::NOT: - assert( mnStackIdx >= 1); - pTop[0] = !pTop[0]; + assert( mnStackIdx >= 1 ); + pTop[0] = (pTop[0] == 0); break; case TYPE2OP::ABS: - assert( mnStackIdx >= 1); + assert( mnStackIdx >= 1 ); if( pTop[0] >= 0) break; // fall through case TYPE2OP::NEG: - assert( mnStackIdx >= 1); + assert( mnStackIdx >= 1 ); pTop[0] = -pTop[0]; break; case TYPE2OP::ADD: - assert( mnStackIdx >= 2); + assert( mnStackIdx >= 2 ); pTop[0] += pTop[-1]; --mnStackIdx; break; case TYPE2OP::SUB: - assert( mnStackIdx >= 2); + assert( mnStackIdx >= 2 ); pTop[0] -= pTop[-1]; --mnStackIdx; break; case TYPE2OP::MUL: - assert( mnStackIdx >= 2); + assert( mnStackIdx >= 2 ); if( pTop[-1]) pTop[0] *= pTop[-1]; --mnStackIdx; break; case TYPE2OP::DIV: - assert( mnStackIdx >= 2); + assert( mnStackIdx >= 2 ); if( pTop[-1]) pTop[0] /= pTop[-1]; --mnStackIdx; break; case TYPE2OP::EQ: - assert( mnStackIdx >= 2); + assert( mnStackIdx >= 2 ); pTop[0] = (pTop[0] == pTop[-1]); --mnStackIdx; break; case TYPE2OP::DROP: - assert( mnStackIdx >= 1); + assert( mnStackIdx >= 1 ); --mnStackIdx; break; case TYPE2OP::PUT: { - assert( mnStackIdx >= 2); - const int nIdx = pTop[0]; - assert( nIdx >= 0); - assert( nIdx < NMAXTRANS); + assert( mnStackIdx >= 2 ); + const int nIdx = static_cast<int>(pTop[0]); + assert( nIdx >= 0 ); + assert( nIdx < NMAXTRANS ); mnTransVals[ nIdx] = pTop[-1]; mnStackIdx -= 2; break; } case TYPE2OP::GET: { - assert( mnStackIdx >= 1); - const int nIdx = pTop[0]; - assert( nIdx >= 0); - assert( nIdx < NMAXTRANS); - pTop[0] = mnTransVals[ nIdx]; + assert( mnStackIdx >= 1 ); + const int nIdx = static_cast<int>(pTop[0]); + assert( nIdx >= 0 ); + assert( nIdx < NMAXTRANS ); + pTop[0] = mnTransVals[ nIdx ]; break; } case TYPE2OP::IFELSE: { - assert( mnStackIdx >= 4); - if( pTop[-1] > pTop[0]) + assert( mnStackIdx >= 4 ); + if( pTop[-1] > pTop[0] ) pTop[-3] = pTop[-2]; mnStackIdx -= 3; break; @@ -1284,69 +1337,69 @@ void CffSubsetterContext::convertOneTypeEsc( void) // TODO: implement break; case TYPE2OP::DUP: - assert( mnStackIdx >= 1); + assert( mnStackIdx >= 1 ); pTop[+1] = pTop[0]; ++mnStackIdx; break; case TYPE2OP::EXCH: { - assert( mnStackIdx >= 2); - const int nVal = pTop[0]; + assert( mnStackIdx >= 2 ); + const ValType nVal = pTop[0]; pTop[0] = pTop[-1]; pTop[-1] = nVal; break; } case TYPE2OP::INDEX: { - assert( mnStackIdx >= 1); - const int nVal = pTop[0]; - assert( nVal >= 0); - assert( nVal < mnStackIdx-1); + assert( mnStackIdx >= 1 ); + const int nVal = static_cast<int>(pTop[0]); + assert( nVal >= 0 ); + assert( nVal < mnStackIdx-1 ); pTop[0] = pTop[-1-nVal]; break; } case TYPE2OP::ROLL: { - assert( mnStackIdx >= 1); - const int nNum = pTop[0]; + assert( mnStackIdx >= 1 ); + const int nNum = static_cast<int>(pTop[0]); assert( nNum >= 0); - assert( nNum < mnStackIdx-2); + assert( nNum < mnStackIdx-2 ); (void)nNum; // TODO: implement - const int nOfs = pTop[-1]; + const int nOfs = static_cast<int>(pTop[-1]); mnStackIdx -= 2; (void)nOfs;// TODO: implement break; } case TYPE2OP::HFLEX1: { - assert( mnStackIdx == 9); - writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, -6); - writeCurveTo( mnStackIdx, -4, -6, -3, -2, -1, -8); + assert( mnStackIdx == 9 ); + writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, -6 ); + writeCurveTo( mnStackIdx, -4, -6, -3, -2, -1, -8 ); mnStackIdx -= 9; } break; case TYPE2OP::HFLEX: { - assert( mnStackIdx == 7); - writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, -5); - writeCurveTo( mnStackIdx, -3, -5, -2, 0, -1, 0); + assert( mnStackIdx == 7 ); + writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, -5 ); + writeCurveTo( mnStackIdx, -3, -5, -2, 0, -1, 0 ); mnStackIdx -= 7; } break; case TYPE2OP::FLEX: { - assert( mnStackIdx == 13); - writeCurveTo( mnStackIdx, -13, -12, -11, -10, -9, -8); - writeCurveTo( mnStackIdx, -7, -6, -5, -4, -3, -2); - const int nFlexDepth = mnValStack[ mnStackIdx-1]; + assert( mnStackIdx == 13 ); + writeCurveTo( mnStackIdx, -13, -12, -11, -10, -9, -8 ); + writeCurveTo( mnStackIdx, -7, -6, -5, -4, -3, -2 ); + const ValType nFlexDepth = mnValStack[ mnStackIdx-1 ]; (void)nFlexDepth; // ignoring nFlexDepth mnStackIdx -= 13; } break; case TYPE2OP::FLEX1: { - assert( mnStackIdx == 11); + assert( mnStackIdx == 11 ); // write the first part of the flex1-hinted curve - writeCurveTo( mnStackIdx, -11, -10, -9, -8, -7, -6); + writeCurveTo( mnStackIdx, -11, -10, -9, -8, -7, -6 ); // determine if nD6 is horizontal or vertical const int i = mnStackIdx; - int nDeltaX = mnValStack[i-11] + mnValStack[i-9] + mnValStack[i-7] + mnValStack[i-5] + mnValStack[i-3]; + ValType nDeltaX = mnValStack[i-11] + mnValStack[i-9] + mnValStack[i-7] + mnValStack[i-5] + mnValStack[i-3]; if( nDeltaX < 0 ) nDeltaX = -nDeltaX; - int nDeltaY = mnValStack[i-10] + mnValStack[i-8] + mnValStack[i-6] + mnValStack[i-4] + mnValStack[i-2]; + ValType nDeltaY = mnValStack[i-10] + mnValStack[i-8] + mnValStack[i-6] + mnValStack[i-4] + mnValStack[i-2]; if( nDeltaY < 0 ) nDeltaY = -nDeltaY; const bool bVertD6 = (nDeltaY > nDeltaX); @@ -1473,14 +1526,14 @@ if( mbSawError) { // -------------------------------------------------------------------- -double CffSubsetterContext::readRealVal() +RealType CffSubsetterContext::readRealVal() { // TODO: more thorough number validity test bool bComma = false; int nExpVal = 0; int nExpSign = 0; S64 nNumber = 0; - double fReal = +1.0; + RealType fReal = +1.0; for(;;){ const U8 c = *(mpReadPtr++); // read nibbles // parse high nibble @@ -1548,6 +1601,7 @@ double CffSubsetterContext::readRealVal() // prepare to access an element inside a CFF/CID index table int CffSubsetterContext::seekIndexData( int nIndexBase, int nDataIndex) { + assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd)); if( nDataIndex < 0) return -1; mpReadPtr = mpBasePtr + nIndexBase; @@ -1578,6 +1632,7 @@ int CffSubsetterContext::seekIndexData( int nIndexBase, int nDataIndex) mpReadEnd = mpReadPtr + (nOfs2 - nOfs1); assert( nOfs1 >= 0); assert( nOfs2 >= nOfs1); + assert( mpReadPtr <= mpBaseEnd); assert( mpReadEnd <= mpBaseEnd); return (nOfs2 - nOfs1); } @@ -1587,10 +1642,12 @@ int CffSubsetterContext::seekIndexData( int nIndexBase, int nDataIndex) // skip over a CFF/CID index table void CffSubsetterContext::seekIndexEnd( int nIndexBase) { + assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd)); mpReadPtr = mpBasePtr + nIndexBase; const int nDataCount = (mpReadPtr[0]<<8) + mpReadPtr[1]; const int nDataOfsSz = mpReadPtr[2]; mpReadPtr += 3 + nDataOfsSz * nDataCount; + assert( mpReadPtr <= mpBaseEnd); int nEndOfs = 0; switch( nDataOfsSz) { default: fprintf( stderr, "\tINVALID nDataOfsSz=%d\n\n", nDataOfsSz); return; @@ -1602,6 +1659,8 @@ void CffSubsetterContext::seekIndexEnd( int nIndexBase) mpReadPtr += nDataOfsSz; mpReadPtr += nEndOfs - 1; mpReadEnd = mpBaseEnd; + assert( nEndOfs >= 0); + assert( mpReadEnd <= mpBaseEnd); } // ==================================================================== @@ -1944,7 +2003,7 @@ public: void emitAllCrypted( void); int tellPos( void) const; void updateLen( int nTellPos, int nLength); - void emitIntVector( const char* pLineHead, const char* pLineTail, const IntVector&); + void emitValVector( const char* pLineHead, const char* pLineTail, const ValVector&); private: FILE* mpFileOut; bool mbCloseOutfile; @@ -2095,8 +2154,8 @@ void Type1Emitter::emitAllCrypted( void) // -------------------------------------------------------------------- -void Type1Emitter::emitIntVector( const char* pLineHead, const char* pLineTail, - const IntVector& rVector) +void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, + const ValVector& rVector) { // ignore empty vectors if( rVector.empty()) @@ -2105,15 +2164,15 @@ void Type1Emitter::emitIntVector( const char* pLineHead, const char* pLineTail, // emit the line head mpPtr += sprintf( mpPtr, pLineHead); // emit the vector values - IntVector::value_type nVal = 0; - for( IntVector::const_iterator it = rVector.begin();;) { - nVal = *it; + ValVector::value_type aVal = 0; + for( ValVector::const_iterator it = rVector.begin();;) { + aVal = *it; if( ++it == rVector.end() ) break; - mpPtr += sprintf( mpPtr, "%d ", nVal); + mpPtr += sprintf( mpPtr, "%g ", aVal); } // emit the last value - mpPtr += sprintf( mpPtr, "%d", nVal); + mpPtr += sprintf( mpPtr, "%g", aVal); // emit the line tail mpPtr += sprintf( mpPtr, pLineTail); } @@ -2178,12 +2237,16 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, "/PaintType 0 def\n"); pOut += sprintf( pOut, "/FontName /%s def\n", rEmitter.maSubsetName); pOut += sprintf( pOut, "/UniqueID %d def\n", nUniqueId); - pOut += sprintf( pOut, "/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n"); + // emit FontMatrix + if( maFontMatrix.size() == 6) + rEmitter.emitValVector( "/FontMatrix [", "]readonly def\n", maFontMatrix); + else // emit default FontMatrix if needed + pOut += sprintf( pOut, "/FontMatrix [0.001 0 0 0.001 0 0]readonly def\n"); + // emit FontBBox if( maFontBBox.size() == 4) - pOut += sprintf( pOut, "/FontBBox [%d %d %d %d ]readonly def\n", - maFontBBox[0], maFontBBox[1], maFontBBox[2], maFontBBox[3]); - else - pOut += sprintf( pOut, "/FontBBox [0 0 999 999]readonly def\n"); + rEmitter.emitValVector( "/FontBBox {", "}readonly def\n", maFontBBox); + else // emit default FontBBox if needed + pOut += sprintf( pOut, "/FontBBox {0 0 999 999}readonly def\n"); // emit FONTINFO into TOPDICT pOut += sprintf( pOut, "/FontInfo 2 dict dup begin\n" // TODO: check fontinfo entry count @@ -2259,12 +2322,12 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, #else // emit blue hint related privdict entries if( !mpCffLocal->maBlueValues.empty()) - rEmitter.emitIntVector( "/BlueValues [", "]ND\n", mpCffLocal->maBlueValues); + rEmitter.emitValVector( "/BlueValues [", "]ND\n", mpCffLocal->maBlueValues); else pOut += sprintf( pOut, "/BlueValues []ND\n"); // default to empty BlueValues - rEmitter.emitIntVector( "/OtherBlues [", "]ND\n", mpCffLocal->maOtherBlues); - rEmitter.emitIntVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues); - rEmitter.emitIntVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues); + rEmitter.emitValVector( "/OtherBlues [", "]ND\n", mpCffLocal->maOtherBlues); + rEmitter.emitValVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues); + rEmitter.emitValVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues); if( mpCffLocal->mfBlueScale) pOut += sprintf( pOut, "/BlueScale %.6f def\n", mpCffLocal->mfBlueScale); @@ -2278,8 +2341,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/StdHW [%d] def\n", mpCffLocal->mnStemStdHW); if( mpCffLocal->mnStemStdVW) pOut += sprintf( pOut, "/StdVW [%d] def\n", mpCffLocal->mnStemStdVW); - rEmitter.emitIntVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); - rEmitter.emitIntVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); + rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); + rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); // emit other hints if( mpCffLocal->mbForceBold) @@ -2383,7 +2446,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // provide details to the subset requesters, TODO: move into own method? // note: Top and Bottom are flipped between Type1 and VCL - rFSInfo.m_aFontBBox = Rectangle( Point( maFontBBox[0], maFontBBox[1] ), Point( maFontBBox[2], maFontBBox[3] ) ); + rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0]), static_cast<long>(maFontBBox[1]) ), + Point( static_cast<long>(maFontBBox[2]), static_cast<long>(maFontBBox[3]) ) ); // PDF-Spec says the values below mean the ink bounds! // TODO: use better approximations for these ink bounds rFSInfo.m_nAscent = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters diff --git a/vcl/source/fontsubset/fontsubset.cxx b/vcl/source/fontsubset/fontsubset.cxx index e203feed1645..84f548d0a32f 100644 --- a/vcl/source/fontsubset/fontsubset.cxx +++ b/vcl/source/fontsubset/fontsubset.cxx @@ -40,7 +40,7 @@ FontSubsetInfo::FontSubsetInfo() , m_nCapHeight( 0) , m_nFontType( FontSubsetInfo::NO_FONT) , mpInFontBytes( NULL) -, mnInByteLength( NULL) +, mnInByteLength( 0) , meInFontType( FontSubsetInfo::NO_FONT) , mpSftTTFont( NULL) {} diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 345dc162e67e..0a7a8b765b6b 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6,8 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: outdev3.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -4498,71 +4496,78 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, FontStrikeout eStrikeout, Color aColor ) { - BOOL bOldMap = IsMapModeEnabled(); - EnableMapMode( FALSE ); - - Color aOldColor = GetTextColor(); - SetTextColor( aColor ); - ImplInitTextColor(); + // PDF-export does its own strikeout drawing... why again? + if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) + return; - xub_Unicode pChars[5]; + // prepare string for strikeout measurement + static char cStrikeoutChar; if ( eStrikeout == STRIKEOUT_SLASH ) - pChars[0] = '/'; + cStrikeoutChar = '/'; else // ( eStrikeout == STRIKEOUT_X ) - pChars[0] = 'X'; - pChars[3]=pChars[2]=pChars[1]=pChars[0]; + cStrikeoutChar = 'X'; + static const int nTestStrLen = 4; + static const int nMaxStrikeStrLen = 2048; + xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind... + for( int i = 0; i < nTestStrLen; ++i) + aChars[i] = cStrikeoutChar; + const String aStrikeoutTest( aChars, nTestStrLen ); // calculate approximation of strikeout atom size long nStrikeoutWidth = nWidth; - String aStrikeoutTest( pChars, 4 ); - SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 ); - if ( pLayout ) + SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); + if( pLayout ) { - nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / 4; + nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel()); pLayout->Release(); - if ( nStrikeoutWidth <= 0 ) // sanity check - nStrikeoutWidth = 1; } + if( nStrikeoutWidth <= 0 ) // sanity check + return; // calculate acceptable strikeout length // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth/2; + long nMaxWidth = nStrikeoutWidth / 2; if ( nMaxWidth < 2 ) nMaxWidth = 2; nMaxWidth += nWidth + 1; - // build strikeout string - long nFullStrikeoutWidth = 0; - String aStrikeoutText( pChars, 0 ); - while ( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 ) - aStrikeoutText += pChars[0]; - + int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth; // if the text width is smaller than the strikeout text, then do not // strike out at all. This case requires user interaction, e.g. adding // a space to the text - if ( (aStrikeoutText.Len() > 0) - && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) ) - { - if ( mpFontEntry->mnOrientation ) - ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + if( nStrikeStrLen <= 0 ) + return; + if( nStrikeStrLen > nMaxStrikeStrLen ) + nStrikeStrLen = nMaxStrikeStrLen; - // strikeout text has to be left aligned - ULONG nOrigTLM = mnTextLayoutMode; - mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; - SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); - mnTextLayoutMode = nOrigTLM; + // build the strikeout string + for( int i = nTestStrLen; i < nStrikeStrLen; ++i) + aChars[i] = cStrikeoutChar; + const String aStrikeoutText( aChars, xub_StrLen(nStrikeStrLen) ); - if ( pSalLayout ) - { - pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); - pSalLayout->DrawText( *mpGraphics ); - pSalLayout->Release(); - } - } + if( mpFontEntry->mnOrientation ) + ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + + // strikeout text has to be left aligned + ULONG nOrigTLM = mnTextLayoutMode; + mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; + pLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); + mnTextLayoutMode = nOrigTLM; + + if( !pLayout ) + return; + + // draw the strikeout text + const Color aOldColor = GetTextColor(); + SetTextColor( aColor ); + ImplInitTextColor(); + + pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); + pLayout->DrawText( *mpGraphics ); + pLayout->Release(); SetTextColor( aOldColor ); ImplInitTextColor(); - EnableMapMode( bOldMap ); } // ----------------------------------------------------------------------- @@ -6777,17 +6782,21 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, { BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - Color aCol; - if( IsBackground() ) - aCol = GetBackground().GetColor(); - else - // best guess is the face color here - // but it may be totally wrong. the background color - // was typically already reset - aCol = GetSettings().GetStyleSettings().GetFaceColor(); + const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + if( rStyleSettings.GetHighContrastMode() ) + { + Color aCol; + if( IsBackground() ) + aCol = GetBackground().GetColor(); + else + // best guess is the face color here + // but it may be totally wrong. the background color + // was typically already reset + aCol = rStyleSettings.GetFaceColor(); - bHighContrastBlack = aCol.IsDark(); - bHighContrastWhite = aCol.IsBright() && GetSettings().GetStyleSettings().GetHighContrastMode(); + bHighContrastBlack = aCol.IsDark(); + bHighContrastWhite = aCol.IsBright(); + } aOldTextColor = GetTextColor(); if ( IsTextFillColor() ) @@ -6795,8 +6804,6 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, bRestoreFillColor = TRUE; aOldTextFillColor = GetTextFillColor(); } - else - bRestoreFillColor = FALSE; if( bHighContrastBlack ) SetTextColor( COL_GREEN ); else if( bHighContrastWhite ) @@ -6811,7 +6818,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aRect.Move( 1, 1 ); DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE ); */ - SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() ); + SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); } } @@ -7445,13 +7452,18 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, BOOL bRestoreFillColor; BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - if( IsBackground() ) + const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + if( rStyleSettings.GetHighContrastMode() ) { - Wallpaper aWall = GetBackground(); - Color aCol = aWall.GetColor(); - bHighContrastBlack = aCol.IsDark(); - bHighContrastWhite = aCol.IsBright() && GetSettings().GetStyleSettings().GetHighContrastMode(); + if( IsBackground() ) + { + Wallpaper aWall = GetBackground(); + Color aCol = aWall.GetColor(); + bHighContrastBlack = aCol.IsDark(); + bHighContrastWhite = aCol.IsBright(); + } } + aOldTextColor = GetTextColor(); if ( IsTextFillColor() ) { @@ -7466,7 +7478,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, else if( bHighContrastWhite ) SetTextColor( COL_LIGHTGREEN ); else - SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() ); + SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); DrawText( rPos, aStr, nIndex, nLen, pVector, pDisplayText ); if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 9d68b13553eb..dfbb83b7954b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -803,7 +803,7 @@ class Matrix3 { double f[6]; - void set( double *pn ) { for( int i = 0 ; i < 5; i++ ) f[i] = pn[i]; } + void set( double *pn ) { for( int i = 0 ; i < 6; i++ ) f[i] = pn[i]; } public: Matrix3(); ~Matrix3() {} @@ -6785,14 +6785,15 @@ void PDFWriterImpl::drawHorizontalGlyphs( for( sal_uInt32 nPos = nBeginRun+1; nPos < aRunEnds[nRun]; nPos++ ) { appendHex( rGlyphs[nPos].m_nMappedGlyphId, aUnkernedLine ); - // check if glyph advance matches with the width of the previous glyph, else adjust + // check if default glyph positioning is sufficient const Point aThisPos = aMat.transform( rGlyphs[nPos].m_aPos ); const Point aPrevPos = aMat.transform( rGlyphs[nPos-1].m_aPos ); double fAdvance = aThisPos.X() - aPrevPos.X(); - fAdvance *= 1000.0 / (fXScale * nPixelFontHeight); - const sal_Int32 nAdjustment = rGlyphs[nPos-1].m_nNativeWidth - sal_Int32(fAdvance+0.5); + fAdvance *= 1000.0 / nPixelFontHeight; + const sal_Int32 nAdjustment = (sal_Int32)(rGlyphs[nPos-1].m_nNativeWidth - fAdvance + 0.5); if( nAdjustment != 0 ) { + // apply individual glyph positioning bNeedKern = true; aKernedLine.append( ">" ); aKernedLine.append( nAdjustment ); @@ -8641,6 +8642,8 @@ void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLine for(sal_uInt32 a(0); a < nEdgeCount; a++) { + if( a > 0 ) + aLine.append( " " ); const sal_uInt32 nNextIndex((a + 1) % nPointCount); const basegfx::B2DPoint aNext(aPoly.getB2DPoint(nNextIndex)); diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 9cced7de3651..db44bec521fe 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -154,7 +154,8 @@ void ImplAddMissingBands ( // We still have to cover two cases: // 1. The region does not yet contain any bands. // 2. The intervall nTop->nBottom extends past the bottom most band. - if (nCurrentTop < nBottom && (pBand==NULL || nBottom>pBand->mnYBottom)) + if (nCurrentTop <= nBottom + && (pBand==NULL || nBottom>pBand->mnYBottom)) { // When there is no previous band then the new one will be the // first. Otherwise the new band is inserted behind the last band. @@ -233,8 +234,9 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) ImplRegionBand* pTopBand = pBand; // If necessary split the band at nTop so that nTop is contained // in the lower band. - if ( // Prevent the current band from becoming 0 pixel high - pBand->mnYTop<nTop + if (pBand!=NULL + // Prevent the current band from becoming 0 pixel high + && pBand->mnYTop<nTop // this allows the lowest pixel of the band to be split off && pBand->mnYBottom>=nTop // do not split a band that is just one pixel high @@ -249,8 +251,9 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) pBand = pBand->mpNextBand; // The lowest band may have to be split at nBottom so that // nBottom itself remains in the upper band. - if ( // allow the current band becoming 1 pixel high - pBand->mnYTop<=nBottom + if (pBand!=NULL + // allow the current band becoming 1 pixel high + && pBand->mnYTop<=nBottom // prevent splitting off a band that is 0 pixel high && pBand->mnYBottom>nBottom // do not split a band that is just one pixel high diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index e0c69ce582f4..587395fa783f 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -469,7 +469,7 @@ Gradient Wallpaper::ImplGetApplicationGradient() const g.SetStyle( GRADIENT_LINEAR ); g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); // no 'extreme' gradient when high contrast - if( Application::GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); else g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceGradientColor() ); diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 67330698ffdf..9b16318fdc40 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -47,7 +47,7 @@ #include <rtl/ustring.hxx> #include <i18npool/mslangid.hxx> // Platform -#ifndef MSC +#ifndef WNT #include <saldisp.hxx> #include <vcl/salgdi.hxx> diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx index c1bca0f87cb8..8c514c611d2c 100644 --- a/vcl/source/glyphs/graphite_cache.cxx +++ b/vcl/source/glyphs/graphite_cache.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifdef MSC +#ifdef WNT #include <tools/svwin.h> #include <svsys.h> #endif diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx index 3c5214d3c420..dae1bfc2866e 100644 --- a/vcl/source/glyphs/graphite_features.cxx +++ b/vcl/source/glyphs/graphite_features.cxx @@ -38,7 +38,7 @@ #include <sal/types.h> -#ifdef MSC +#ifdef WNT #include <tools/svwin.h> #include <svsys.h> #endif diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 751c3694d033..86dee2749efa 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -54,7 +54,7 @@ #include <deque> // Platform -#ifdef MSC +#ifdef WNT #include <tools/svwin.h> #include <svsys.h> #endif @@ -86,7 +86,7 @@ FILE * grLogFile = NULL; FILE * grLog() { -#ifdef MSC +#ifdef WNT std::string logFileName(getenv("TEMP")); logFileName.append("\\graphitelayout.log"); if (grLogFile == NULL) grLogFile = fopen(logFileName.c_str(),"w"); @@ -135,7 +135,7 @@ namespace UErrorCode status = U_ZERO_ERROR; UBiDi *ubidi = ubidi_openSized(charCount, 0, &status); int limit = 0; - ubidi_setPara(ubidi, buffer, charCount, + ubidi_setPara(ubidi, reinterpret_cast<const UChar *>(buffer), charCount, (rtl)?UBIDI_DEFAULT_RTL:UBIDI_DEFAULT_LTR, NULL, &status); UBiDiLevel level = 0; ubidi_getLogicalRun(ubidi, 0, &limit, &level); diff --git a/vcl/source/glyphs/graphite_serverfont.cxx b/vcl/source/glyphs/graphite_serverfont.cxx index e8cd152b43ac..be424c94b9d2 100644 --- a/vcl/source/glyphs/graphite_serverfont.cxx +++ b/vcl/source/glyphs/graphite_serverfont.cxx @@ -45,7 +45,7 @@ #include "graphite_textsrc.hxx" #include <vcl/graphite_serverfont.hxx> -#ifndef MSC +#ifndef WNT // // An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used. diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index f5a8d8fbb14e..a300aedf8175 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -84,6 +84,9 @@ template<> bool LazyDeletor<Menu>::is_less( Menu* left, Menu* right ) DeleteOnDeinitBase::~DeleteOnDeinitBase() { + ImplSVData* pSVData = ImplGetSVData(); + if( pSVData && pSVData->mpDeinitDeleteList != NULL ) + pSVData->mpDeinitDeleteList->remove( this ); } void DeleteOnDeinitBase::addDeinitContainer( DeleteOnDeinitBase* i_pContainer ) diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index f8baad0b4137..c9e8d11557e8 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1840,7 +1840,7 @@ void ImplBorderWindow::ImplInit( Window* pParent, { // Alle WindowBits entfernen, die wir nicht haben wollen WinBits nOrgStyle = nStyle; - WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW ); + WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS); if ( nTypeStyle & BORDERWINDOW_STYLE_APP ) nTestStyle |= WB_APP; nStyle &= nTestStyle; diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index b5f1ada74a98..c587b7ad8441 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -1238,8 +1238,8 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) ULONG nFlags = FLOATWIN_POPUPMODE_ALLOWTEAROFF | FLOATWIN_POPUPMODE_NOFOCUSCLOSE | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE | - FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; +// |FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; // if the subtoolbar was opened via keyboard make sure that key events // will go into subtoolbar diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 7bcb90bbb8fc..5f1578c4b9e2 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -243,6 +243,13 @@ FloatingWindow::~FloatingWindow() // ----------------------------------------------------------------------- +Point FloatingWindow::CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex ) +{ + return ImplCalcPos( pWindow, rRect, nFlags, rArrangeIndex ); +} + +// ----------------------------------------------------------------------- + Point FloatingWindow::ImplCalcPos( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex ) @@ -676,8 +683,6 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags ) // avoid close on focus change for decorated floating windows only if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) ) nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; - else - nFlags &= ~FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; // #102010# For debugging Accessibility static const char* pEnv = getenv("SAL_FLOATWIN_NOAPPFOCUSCLOSE" ); @@ -751,8 +756,9 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, ULONG nFlags ) // FLOATWIN_POPUPMODE_NOMOUSECLOSE | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | // FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE | // #105968# floating toolboxes should close when clicked in (parent's) float rect - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE | - FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; +// | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + /* * FLOATWIN_POPUPMODE_NOKEYCLOSE | * don't set since it disables closing floaters with escape diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ccf75dbd59b3..ebd4475a80fc 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -557,7 +557,7 @@ public: void DataChanged( const DataChangedEvent& rDCEvt ); - void SetImages( long nMaxHeight = 0 ); + void SetImages( long nMaxHeight = 0, bool bForce = false ); void calcMinSize(); Size getMinSize(); @@ -591,7 +591,7 @@ void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt ) { calcMinSize(); SetBackground(); - SetImages(); + SetImages( 0, true); } } @@ -625,7 +625,7 @@ Size DecoToolBox::getMinSize() return maMinSize; } -void DecoToolBox::SetImages( long nMaxHeight ) +void DecoToolBox::SetImages( long nMaxHeight, bool bForce ) { long border = getMinSize().Height() - maImage.GetSizePixel().Height(); @@ -635,13 +635,13 @@ void DecoToolBox::SetImages( long nMaxHeight ) if( nMaxHeight < getMinSize().Height() ) nMaxHeight = getMinSize().Height(); - if( lastSize != nMaxHeight - border ) + if( (lastSize != nMaxHeight - border) || bForce ) { lastSize = nMaxHeight - border; Color aEraseColor( 255, 255, 255, 255 ); BitmapEx aBmpExDst( maImage.GetBitmapEx() ); - BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? + BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetHighContrastMode() ? maImageHC.GetBitmapEx() : aBmpExDst ); aEraseColor.SetTransparency( 255 ); @@ -2731,7 +2731,14 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* } if ( pThisItemOnly && bHighlighted ) - pWin->SetTextColor( rSettings.GetMenuTextColor() ); + { + // This restores the normal menu or menu bar text + // color for when it is no longer highlighted. + if ( bIsMenuBar ) + pWin->SetTextColor( rSettings.GetMenuBarTextColor() ); + else + pWin->SetTextColor( rSettings.GetMenuTextColor() ); + } } if( bLayout ) { @@ -3787,7 +3794,10 @@ static void ImplInitMenuWindow( Window* pWin, BOOL bFont, BOOL bMenuBar ) pWin->SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) ); } - pWin->SetTextColor( rStyleSettings.GetMenuTextColor() ); + if ( bMenuBar ) + pWin->SetTextColor( rStyleSettings.GetMenuBarTextColor() ); + else + pWin->SetTextColor( rStyleSettings.GetMenuTextColor() ); pWin->SetTextFillColor(); pWin->SetLineColor(); } @@ -5056,7 +5066,7 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP ); aCloser.InsertItem( IID_DOCUMENTCLOSE, - GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? aCloser.maImageHC : aCloser.maImage, 0 ); + GetSettings().GetStyleSettings().GetHighContrastMode() ? aCloser.maImageHC : aCloser.maImage, 0 ); aCloser.SetSelectHdl( LINK( this, MenuBarWindow, CloserHdl ) ); aCloser.AddEventListener( LINK( this, MenuBarWindow, ToolboxEventHdl ) ); aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr ) ) ); @@ -5697,7 +5707,7 @@ void MenuBarWindow::Paint( const Rectangle& ) // in high contrast mode draw a separating line on the lower edge if( ! IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) && - GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + GetSettings().GetStyleSettings().GetHighContrastMode() ) { Push( PUSH_LINECOLOR | PUSH_MAPMODE ); SetLineColor( Color( COL_WHITE ) ); diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index bd727092a836..3d3245af831f 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -500,7 +500,7 @@ void InfoBox::ImplInitInfoBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_INFO)+1; } @@ -591,7 +591,7 @@ void ErrorBox::ImplInitErrorBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_ERROR)+1; } @@ -637,7 +637,7 @@ void QueryBox::ImplInitQueryBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_QUERY)+1; } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index bb1f428c6626..8aa4926f5e1a 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -397,7 +397,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp Color startCol, endCol; startCol = pThis->GetSettings().GetStyleSettings().GetFaceGradientColor(); endCol = pThis->GetSettings().GetStyleSettings().GetFaceColor(); - if( endCol.IsDark() ) + if( pThis->GetSettings().GetStyleSettings().GetHighContrastMode() ) // no 'extreme' gradient when high contrast startCol = endCol; @@ -1901,37 +1901,78 @@ BOOL ToolBox::ImplCalcItem() nDefWidth = GetDefaultImageSize().Width(); nDefHeight = GetDefaultImageSize().Height(); + mnWinHeight = 0; // determine minimum size necessary in NWF - if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { Rectangle aRect( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); - Region aArrowReg = aRect; + Region aReg = aRect; ImplControlValue aVal; Region aNativeBounds, aNativeContent; - if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, - aArrowReg, + if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetWidth() > nMinWidth ) + nMinWidth = aRect.GetWidth(); + if( aRect.GetHeight() > nMinHeight ) + nMinHeight = aRect.GetHeight(); + if( nDropDownArrowWidth < nMinWidth ) + nDropDownArrowWidth = nMinWidth; + if( nMinWidth > mpData->mnMenuButtonWidth ) + mpData->mnMenuButtonWidth = nMinWidth; + else if( nMinWidth < TB_MENUBUTTON_SIZE ) + mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + } + } + + // also calculate the area for comboboxes, drop down list boxes and spinfields + // as these are often inserted into toolboxes; set mnWinHeight to the + // greater of those values to prevent toolbar flickering (#i103385#) + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_COMBOBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, + aReg, CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, aVal, OUString(), aNativeBounds, aNativeContent ) ) { aRect = aNativeBounds.GetBoundRect(); - if( aRect.GetWidth() > nMinWidth ) - nMinWidth = aRect.GetWidth(); - if( aRect.GetHeight() > nMinHeight ) - nMinHeight = aRect.GetHeight(); - if( nDropDownArrowWidth < nMinWidth ) - nDropDownArrowWidth = nMinWidth; - if( nMinWidth > mpData->mnMenuButtonWidth ) - mpData->mnMenuButtonWidth = nMinWidth; - else if( nMinWidth < TB_MENUBUTTON_SIZE ) - mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_SPINBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); } } if ( ! mpData->m_aItems.empty() ) { - mnWinHeight = 0; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) { diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 7fa8f76e1586..9ec86fab20de 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -2413,10 +2413,10 @@ void ToolBox::ImplUpdateImageList() { if (mpData->mpImageListProvider != NULL) { - BOOL bIsDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); try { - ImageListType eType = bIsDark ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO; + ImageListType eType = bHC ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO; if (eType != mpData->meImageListType) { diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5333d20d4306..6aff4779d8b2 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -292,6 +292,13 @@ bool Window::ImplCheckUIFont( const Font& rFont ) void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) { + // reset high contrast to false, so the system can either update it + // or AutoDetectSystemHC can kick in (see below) + StyleSettings aTmpSt( rSettings.GetStyleSettings() ); + aTmpSt.SetHighContrastMode( FALSE ); + rSettings.SetStyleSettings( aTmpSt ); + ImplGetFrame()->UpdateSettings( rSettings ); + // Verify availability of the configured UI font, otherwise choose "Andale Sans UI" String aUserInterfaceFont; bool bUseSystemFont = rSettings.GetStyleSettings().GetUseSystemUIFonts(); @@ -472,7 +479,8 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) rSettings.SetStyleSettings( aStyleSettings ); - // #104427# auto detect HC mode ? + // auto detect HC mode; if the system already set it to "yes" + // (see above) then accept that if( !rSettings.GetStyleSettings().GetHighContrastMode() ) { sal_Bool bTmp = sal_False, bAutoHCMode = sal_True; @@ -728,7 +736,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; nStyle |= WB_BORDER; } - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL), nBorderTypeStyle ); + ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); mpWindowImpl->mpBorderWindow = pBorderWin; @@ -783,6 +791,8 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste nFrameStyle = SAL_FRAME_STYLE_FLOAT; if( nStyle & WB_OWNERDRAWDECORATION ) nFrameStyle |= (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_NOSHADOW); + if( nStyle & WB_NEEDSFOCUS ) + nFrameStyle |= SAL_FRAME_STYLE_FLOAT_FOCUSABLE; } else if( mpWindowImpl->mbFloatWin ) nFrameStyle |= SAL_FRAME_STYLE_TOOLWINDOW; @@ -923,7 +933,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) ) { - mpWindowImpl->mpFrame->UpdateSettings( *pSVData->maAppData.mpSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = TRUE; diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 8bdfe1706962..8d83ca008e4a 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -33,12 +33,15 @@ #include "atkwrapper.hxx" #include "atktextattributes.hxx" +#include <algorithm> #include <com/sun/star/accessibility/AccessibleTextType.hpp> #include <com/sun/star/accessibility/TextSegment.hpp> #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp> +#include <com/sun/star/text/TextMarkupType.hpp> // #define ENABLE_TRACING @@ -175,6 +178,27 @@ static accessibility::XAccessibleText* /*****************************************************************************/ +static accessibility::XAccessibleTextMarkup* + getTextMarkup( AtkText *pText ) throw (uno::RuntimeException) +{ + AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText ); + if( pWrap ) + { + if( !pWrap->mpTextMarkup && pWrap->mpContext ) + { + uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); + pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); + pWrap->mpTextMarkup->acquire(); + } + + return pWrap->mpTextMarkup; + } + + return NULL; +} + +/*****************************************************************************/ + static accessibility::XAccessibleTextAttributes* getTextAttributes( AtkText *pText ) throw (uno::RuntimeException) { @@ -434,6 +458,8 @@ text_wrapper_get_run_attributes( AtkText *text, AtkAttributeSet *pSet = NULL; try { + bool bOffsetsAreValid = false; + accessibility::XAccessibleText* pText = getText( text ); accessibility::XAccessibleTextAttributes* pTextAttributes = getTextAttributes( text ); if( pText && pTextAttributes ) @@ -456,10 +482,47 @@ text_wrapper_get_run_attributes( AtkText *text, // *end_offset = aTextSegment.SegmentEnd + 1; // FIXME: TESTME *end_offset = aTextSegment.SegmentEnd; // <-- + bOffsetsAreValid = true; + } + } + + // Special handling for missspelled + accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text ); + if( pTextMarkup ) + { + uno::Sequence< accessibility::TextSegment > aTextSegmentSeq = + pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK ); + if( aTextSegmentSeq.getLength() > 0 ) + { + accessibility::TextSegment aTextSegment = aTextSegmentSeq[0]; + gint nStartOffsetMisspelled = aTextSegment.SegmentStart; + gint nEndOffsetMisspelled = aTextSegment.SegmentEnd; + + // Get attribute run here if it hasn't been done before + if( !bOffsetsAreValid ) + { + accessibility::TextSegment aAttributeTextSegment = + pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); + *start_offset = aAttributeTextSegment.SegmentStart; + *end_offset = aAttributeTextSegment.SegmentEnd; + } + + if( nEndOffsetMisspelled <= offset ) + *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled ); + else if( nStartOffsetMisspelled <= offset ) + *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled ); + + if( nStartOffsetMisspelled > offset ) + *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled ); + else if( nEndOffsetMisspelled > offset ) + *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled ); + + if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset ) + pSet = attribute_set_prepend_misspelled( pSet ); } } } - catch(const uno::Exception& e) { + catch(const uno::Exception& e){ g_warning( "Exception in get_run_attributes()" ); diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index f6b1eccc882a..58dd5f200bbd 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -76,6 +76,7 @@ static AtkTextAttribute atk_text_attribute_tab_interval = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID; +static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; /*****************************************************************************/ @@ -1299,6 +1300,18 @@ attribute_set_new_from_property_values( } +AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ) +{ + if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_misspelled ) + atk_text_attribute_misspelled = atk_text_attribute_register( "text-spelling" ); + + attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_misspelled, + g_strdup_printf( "misspelled" ) ); + + return attribute_set; +} + + /*****************************************************************************/ struct AtkTextAttrMapping diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx index 909f09eb1522..ca67fd946a20 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.hxx +++ b/vcl/unx/gtk/a11y/atktextattributes.hxx @@ -47,5 +47,6 @@ attribute_set_map_to_property_values( AtkAttributeSet* attribute_set, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList ); +AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ); #endif diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 927b8548a77a..8854083e1509 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> #include <com/sun/star/accessibility/XAccessibleValue.hpp> #include <com/sun/star/accessibility/XAccessibleAction.hpp> @@ -893,6 +894,7 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper) RELEASE( wrapper->mpMultiLineText ) RELEASE( wrapper->mpTable ) RELEASE( wrapper->mpText ) + RELEASE( wrapper->mpTextMarkup ) RELEASE( wrapper->mpTextAttributes ) RELEASE( wrapper->mpValue ) } diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx index 1003d0d25cc7..95cf30096e7b 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk/a11y/atkwrapper.hxx @@ -49,6 +49,7 @@ namespace com { namespace sun { namespace star { namespace accessibility { class XAccessibleSelection; class XAccessibleTable; class XAccessibleText; + class XAccessibleTextMarkup; class XAccessibleTextAttributes; class XAccessibleValue; } } } } @@ -69,6 +70,7 @@ struct _AtkObjectWrapper ::com::sun::star::accessibility::XAccessibleSelection *mpSelection; ::com::sun::star::accessibility::XAccessibleTable *mpTable; ::com::sun::star::accessibility::XAccessibleText *mpText; + ::com::sun::star::accessibility::XAccessibleTextMarkup *mpTextMarkup; ::com::sun::star::accessibility::XAccessibleTextAttributes *mpTextAttributes; ::com::sun::star::accessibility::XAccessibleValue *mpValue; diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 73b4432342bf..af3a1df97a8c 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -134,6 +134,16 @@ extern "C" VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule pModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + #if OSL_DEBUG_LEVEL > 1 int nFd = open( "/home/pl93762/log.txt", O_CREAT | O_TRUNC | O_WRONLY, 0755 ); dup2( nFd, STDERR_FILENO ); @@ -206,6 +216,34 @@ SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWind return new GtkSalObject( static_cast<GtkSalFrame*>(pParent), bShow ); } +extern "C" +{ + typedef void*(* getDefaultFnc)(); + typedef void(* addItemFnc)(void *, const char *); +} + +void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) +{ +#if GTK_CHECK_VERSION(2,10,0) + GtkRecentManager *manager = gtk_recent_manager_get_default (); + gtk_recent_manager_add_item (manager, rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr()); + (void)rMimeType; +#else + static getDefaultFnc sym_gtk_recent_manager_get_default = + (getDefaultFnc)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_recent_manager_get_default" ); + + static addItemFnc sym_gtk_recent_manager_add_item = + (addItemFnc)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_recent_manager_add_item"); + if (sym_gtk_recent_manager_get_default && sym_gtk_recent_manager_add_item) + { + sym_gtk_recent_manager_add_item(sym_gtk_recent_manager_get_default(), + rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr()); + } + else + X11SalInstance::AddToRecentDocumentList(rFileUrl, rMimeType); +#endif +} + GtkYieldMutex::GtkYieldMutex() { } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index fdaa102c614b..f922552ce923 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3291,12 +3291,38 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarColor( aBackColor ); aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] ); - aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] ); - if( aBackColor == aTextColor ) - aTextColor = (aBackColor.GetLuminance() < 128) ? Color( COL_WHITE ) : Color( COL_BLACK ); + aTextColor = getColor( pMenuTextStyle->text[GTK_STATE_NORMAL] ); aStyleSet.SetMenuColor( aBackColor ); aStyleSet.SetMenuTextColor( aTextColor ); + aTextColor = getColor( pMenubarStyle->text[GTK_STATE_NORMAL] ); + aStyleSet.SetMenuBarTextColor( aTextColor ); + +#if OSL_DEBUG_LEVEL > 1 + std::fprintf( stderr, "==\n" ); + std::fprintf( stderr, "MenuColor = %x (%d)\n", (int)aStyleSet.GetMenuColor().GetColor(), aStyleSet.GetMenuColor().GetLuminance() ); + std::fprintf( stderr, "MenuTextColor = %x (%d)\n", (int)aStyleSet.GetMenuTextColor().GetColor(), aStyleSet.GetMenuTextColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarColor = %x (%d)\n", (int)aStyleSet.GetMenuBarColor().GetColor(), aStyleSet.GetMenuBarColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarTextColor = %x (%d)\n", (int)aStyleSet.GetMenuBarTextColor().GetColor(), aStyleSet.GetMenuBarTextColor().GetLuminance() ); + std::fprintf( stderr, "LightColor = %x (%d)\n", (int)aStyleSet.GetLightColor().GetColor(), aStyleSet.GetLightColor().GetLuminance() ); + std::fprintf( stderr, "ShadowColor = %x (%d)\n", (int)aStyleSet.GetShadowColor().GetColor(), aStyleSet.GetShadowColor().GetLuminance() ); +#endif + + // Awful hack for menu separators in the Sonar and similar themes. + // If the menu color is not too dark, and the menu text color is lighter, + // make the "light" color lighter than the menu color and the "shadow" + // color darker than it. + if ( aStyleSet.GetMenuColor().GetLuminance() >= 32 && + aStyleSet.GetMenuColor().GetLuminance() <= aStyleSet.GetMenuTextColor().GetLuminance() ) + { + Color temp = aStyleSet.GetMenuColor(); + temp.IncreaseLuminance( 8 ); + aStyleSet.SetLightColor( temp ); + temp = aStyleSet.GetMenuColor(); + temp.DecreaseLuminance( 16 ); + aStyleSet.SetShadowColor( temp ); + } + aHighlightColor = getColor( pMenuItemStyle->bg[ GTK_STATE_SELECTED ] ); aHighlightTextColor = getColor( pMenuTextStyle->fg[ GTK_STATE_PRELIGHT ] ); if( aHighlightColor == aHighlightTextColor ) @@ -3439,13 +3465,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // FIXME: need some way of fetching toolbar icon size. // aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL ); - /* #i35482# do not override HC mode per force - // #i59364# high contrast mode - bool bHC = ( aStyleSet.GetFaceColor().IsDark() || - aStyleSet.GetWindowColor().IsDark() ); - aStyleSet.SetHighContrastMode( bHC ); - */ - // finally update the collected settings rSettings.SetStyleSettings( aStyleSet ); diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index b6770ca1a77e..8963ac2e3643 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1123,7 +1123,7 @@ void GtkSalFrame::SetIcon( USHORT nIcon ) USHORT nIndex; // Use high contrast icons where appropriate - if( Application::GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) { nOffsets[0] = SV_ICON_LARGE_HC_START; nOffsets[1] = SV_ICON_SMALL_HC_START; @@ -1506,7 +1506,7 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR if( isChild( false, true ) ) gtk_widget_set_size_request( m_pWindow, nWidth, nHeight ); - else + else if( ! ( m_nState & GDK_WINDOW_STATE_MAXIMIZED ) ) gtk_window_resize( GTK_WINDOW(m_pWindow), nWidth, nHeight ); setMinMaxSize(); } @@ -1608,6 +1608,7 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) SAL_FRAMESTATE_MASK_MAXIMIZED_WIDTH | SAL_FRAMESTATE_MASK_MAXIMIZED_HEIGHT; if( (pState->mnMask & SAL_FRAMESTATE_MASK_STATE) && + ! ( m_nState & GDK_WINDOW_STATE_MAXIMIZED ) && (pState->mnState & SAL_FRAMESTATE_MAXIMIZED) && (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask ) { diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 87d0e4662f29..7b93e59b6acd 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -504,6 +504,10 @@ void SvpSalInstance::StartTimer( ULONG nMS ) } } +void SvpSalInstance::AddToRecentDocumentList(const rtl::OUString&, const rtl::OUString&) +{ +} + SvpSalTimer::~SvpSalTimer() { } diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index 71c463f071a9..e77debb53f1d 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -193,6 +193,8 @@ public: virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); }; #endif // _SV_SALINST_HXX diff --git a/vcl/unx/inc/plugins/gtk/gtkinst.hxx b/vcl/unx/inc/plugins/gtk/gtkinst.hxx index 22c50f627e0c..16dce4688ede 100644 --- a/vcl/unx/inc/plugins/gtk/gtkinst.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkinst.hxx @@ -91,6 +91,7 @@ public: virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); virtual SalSystem* CreateSalSystem(); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); }; class GtkSalSystem : public X11SalSystem diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index c0614a78af9b..399326c44f27 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -116,6 +116,13 @@ public: virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + bool isPrinterInit() const { diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 15a5ba087ab2..1b5a2f86dcee 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -232,6 +232,16 @@ void KDEData::Init() extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + rtl::OString aVersion( qVersion() ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() ); diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 24358022d6a1..8046d22d75d3 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1996,6 +1996,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) } aStyleSettings.SetMenuTextColor( aMenuFore ); + aStyleSettings.SetMenuBarTextColor( aMenuFore ); aStyleSettings.SetMenuColor( aMenuBack ); aStyleSettings.SetMenuBarColor( aMenuBack ); @@ -2035,13 +2036,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // Scroll bar size aStyleSettings.SetScrollBarSize( kapp->style().pixelMetric( QStyle::PM_ScrollBarExtent ) ); - /* #i35482# do not override HC mode - // #i59364# high contrast mode - bool bHC = ( aStyleSettings.GetFaceColor().IsDark() || - aStyleSettings.GetWindowColor().IsDark() ); - aStyleSettings.SetHighContrastMode( bHC ); - */ - rSettings.SetStyleSettings( aStyleSettings ); } diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx index 07a10c60d933..91e3a758da3c 100644 --- a/vcl/unx/kde4/KDEData.cxx +++ b/vcl/unx/kde4/KDEData.cxx @@ -45,6 +45,8 @@ void KDEData::initNWF() // draw toolbars on separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; + // no borders for menu, theming does that + pSVData->maNWFData.mbFlatMenu = true; } void KDEData::deInitNWF() diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index ad8f467ee960..796350a63d50 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -318,6 +318,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aMenuBack = toColor( qMenuCG.color( QPalette::Button ) ); style.SetMenuTextColor( aMenuFore ); + style.SetMenuBarTextColor( aMenuFore ); style.SetMenuColor( aMenuBack ); style.SetMenuBarColor( aMenuBack ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index ae917f252b11..2e8f0dcad96b 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -35,6 +35,8 @@ #include <QStyle> #include <QStyleOption> #include <QPainter> +#include <QFrame> +#include <QLabel> #include <kapplication.h> @@ -42,10 +44,9 @@ #include "KDESalGraphics.hxx" -#include <vcl/settings.hxx> -#include <rtl/ustrbuf.hxx> - -#include <stdio.h> +#include "vcl/settings.hxx" +#include "vcl/decoview.hxx" +#include "rtl/ustrbuf.hxx" using namespace ::rtl; @@ -150,6 +151,30 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, return FALSE; } +void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveElement i_nElement, + ControlState i_nState, const ImplControlValue& i_rValue ) +{ + #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) + QStyleOptionFrameV3 styleOption; + styleOption.frameShape = QFrame::StyledPanel; + #else + QStyleOptionFrame styleOption; + QFrame aFrame( NULL ); + aFrame.setFrameRect( QRect(0, 0, i_rRect.width(), i_rRect.height()) ); + aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + aFrame.ensurePolished(); + styleOption.initFrom( &aFrame ); + styleOption.lineWidth = aFrame.lineWidth(); + styleOption.midLineWidth = aFrame.midLineWidth(); + #endif + styleOption.rect = QRect(0, 0, i_rRect.width(), i_rRect.height()); + styleOption.state = vclStateValue2StateFlag( i_nState, i_rValue ); + #if ( QT_VERSION < QT_VERSION_CHECK( 4, 5, 0 ) ) + styleOption.state |= QStyle::State_Sunken; + #endif + kapp->style()->drawPrimitive(i_nElement, &styleOption, &i_rPainter); +} + BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, const ImplControlValue& value, SalControlHandle&, @@ -352,18 +377,25 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_LISTBOX) { - QStyleOptionComboBox styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - if (part == PART_SUB_EDIT) + if( part == PART_WINDOW ) { - kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else { - kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + QStyleOptionComboBox styleOption; + + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + styleOption.state = vclStateValue2StateFlag( nControlState, value ); + + if (part == PART_SUB_EDIT) + { + kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter); + } + else + { + kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + } } } else if (type == CTRL_LISTNODE) @@ -481,33 +513,11 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_FRAME) { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - #else - QStyleOptionFrameV2 styleOption; - #endif - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.frameShape = QFrame::StyledPanel; - #endif - - kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else if (type == CTRL_FIXEDBORDER) { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - #else - QStyleOptionFrameV2 styleOption; - #endif - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.frameShape = QFrame::StyledPanel; - #endif - - kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); } else if (type == CTRL_WINDOW_BACKGROUND) { @@ -573,14 +583,21 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; case CTRL_EDITBOX: { - styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height()); - styleOption.state = vclStateValue2StateFlag(controlState, val); - - int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1; - - contentRect.adjust( -size, -size, size, size); - boundingRect = contentRect; - + int nFontHeight = kapp->fontMetrics().height(); + //int nFrameSize = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); + int nLayoutTop = kapp->style()->pixelMetric(QStyle::PM_LayoutTopMargin); + int nLayoutBottom = kapp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin); + int nLayoutLeft = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + int nLayoutRight = kapp->style()->pixelMetric(QStyle::PM_LayoutRightMargin); + + int nMinHeight = (nFontHeight + nLayoutTop + nLayoutBottom); + if( boundingRect.height() < nMinHeight ) + { + int delta = nMinHeight - boundingRect.height(); + boundingRect.adjust( 0, 0, 0, delta ); + } + contentRect = boundingRect; + contentRect.adjust( -nLayoutLeft+1, -nLayoutTop+1, nLayoutRight-1, nLayoutBottom-1 ); retVal = true; break; @@ -621,7 +638,6 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, case PART_ENTIRE_CONTROL: { int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2; - contentRect.adjust(-size,-size,size,size); // find out the minimum size that should be used // assume contents is a text ling @@ -632,6 +648,11 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, if( aMinSize.height() > contentRect.height() ) contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() ); boundingRect = contentRect; + // FIXME: why this difference between comboboxes and listboxes ? + // because a combobox has a sub edit and that is positioned + // inside the outer bordered control ? + if( type == CTRL_COMBOBOX ) + contentRect.adjust(-size,-size,size,size); retVal = true; break; } @@ -647,6 +668,9 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, retVal = true; break; + case PART_WINDOW: + retVal = true; + break; } break; } @@ -703,14 +727,19 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; case CTRL_FRAME: { - if (part == PART_BORDER) + if( part == PART_BORDER ) { - int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - //contentRect.adjust(size, size, size, size); - boundingRect.adjust(-size, -size, size, size); + int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + USHORT nStyle = val.getNumericVal(); + if( nStyle & FRAME_DRAW_NODRAW ) + { + // in this case the question is: how thick would a frame be + // see brdwin.cxx, decoview.cxx + // most probably the behavior in decoview.cxx is wrong. + contentRect.adjust(size, size, -size, -size); + } retVal = true; } - break; } case CTRL_RADIOBUTTON: diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx index 2a48624d9d14..798990c06466 100644 --- a/vcl/unx/kde4/main.cxx +++ b/vcl/unx/kde4/main.cxx @@ -45,6 +45,16 @@ extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + #if QT_VERSION < 0x050000 // Qt 4.x support needs >= 4.1.0 rtl::OString aVersion( qVersion() ); diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index c160ea4c2fa5..1dc2d1404009 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -35,6 +35,8 @@ #include <stdio.h> #include <stdlib.h> +#include <osl/module.hxx> + #include "salunx.h" #include "saldata.hxx" @@ -103,6 +105,16 @@ extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance() { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() ); // initialize SalData @@ -403,3 +415,20 @@ void X11SalInstance::FillFontPathList( std::list< rtl::OString >& o_rFontPaths ) #endif /* SOLARIS */ } +extern "C" { static void SAL_CALL thisModule() {} } + +void X11SalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) +{ + const rtl::OUString SYM_ADD_TO_RECENTLY_USED_FILE_LIST(RTL_CONSTASCII_USTRINGPARAM("add_to_recently_used_file_list")); + const rtl::OUString LIB_RECENT_FILE(RTL_CONSTASCII_USTRINGPARAM("librecentfile.so")); + typedef void (*PFUNC_ADD_TO_RECENTLY_USED_LIST)(const rtl::OUString&, const rtl::OUString&); + + PFUNC_ADD_TO_RECENTLY_USED_LIST add_to_recently_used_file_list = 0; + + osl::Module module; + module.loadRelative( &thisModule, LIB_RECENT_FILE ); + if (module.is()) + add_to_recently_used_file_list = (PFUNC_ADD_TO_RECENTLY_USED_LIST)module.getFunctionSymbol(SYM_ADD_TO_RECENTLY_USED_FILE_LIST); + if (add_to_recently_used_file_list) + add_to_recently_used_file_list(rFileUrl, rMimeType); +} diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index 7e4e16579623..ff981b04259b 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -48,6 +48,7 @@ #include <saldisp.hxx> #include <salframe.h> #include <vcl/svapp.hxx> +#include <vcl/window.hxx> #include <salinst.h> #include <osl/conditn.h> @@ -187,6 +188,7 @@ bool SessionManagerClient::bDocSaveDone = false; static SmProp* pSmProps = NULL; static SmProp** ppSmProps = NULL; static int nSmProps = 0; +static unsigned char *pSmRestartHint = NULL; static void BuildSmPropertyList() @@ -195,7 +197,7 @@ static void BuildSmPropertyList() { ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); - nSmProps = 4; + nSmProps = 5; pSmProps = new SmProp[ nSmProps ]; pSmProps[ 0 ].name = const_cast<char*>(SmCloneCommand); @@ -243,6 +245,15 @@ static void BuildSmPropertyList() pSmProps[ 3 ].vals->value = strdup( aUser.getStr() ); pSmProps[ 3 ].vals->length = strlen( (char *)pSmProps[ 3 ].vals->value )+1; + pSmProps[ 4 ].name = const_cast<char*>(SmRestartStyleHint); + pSmProps[ 4 ].type = const_cast<char*>(SmCARD8); + pSmProps[ 4 ].num_vals = 1; + pSmProps[ 4 ].vals = new SmPropValue; + pSmProps[ 4 ].vals->value = malloc(1); + pSmRestartHint = (unsigned char *)pSmProps[ 4 ].vals->value; + *pSmRestartHint = SmRestartIfRunning; + pSmProps[ 4 ].vals->length = 1; + ppSmProps = new SmProp*[ nSmProps ]; for( int i = 0; i < nSmProps; i++ ) ppSmProps[ i ] = &pSmProps[i]; @@ -257,6 +268,31 @@ bool SessionManagerClient::checkDocumentsSaved() IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) { SMprintf( "posting save documents event shutdown = %s\n", (pThis!=0) ? "true" : "false" ); + + static bool bFirstShutdown=true; + if (pThis != 0 && bFirstShutdown) //first shutdown request + { + bFirstShutdown = false; + /* + If we have no actual frames open, e.g. we launched a quickstarter, + and then shutdown all our frames leaving just a quickstarter running, + then we don't want to launch an empty toplevel frame on the next + start. (The job of scheduling the restart of the quick-starter is a + task of the quick-starter) + */ + *pSmRestartHint = SmRestartNever; + const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); + for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) + { + Window *pWindow = (*it)->GetWindow(); + if (pWindow && pWindow->IsVisible()) + { + *pSmRestartHint = SmRestartIfRunning; + break; + } + } + } + if( pOneInstance ) { SalSessionSaveRequestEvent aEvent( pThis != 0, false ); @@ -385,7 +421,7 @@ void SessionManagerClient::saveDone() ICEConnectionObserver::lock(); SmcSetProperties( aSmcConnection, nSmProps, ppSmProps ); SmcSaveYourselfDone( aSmcConnection, True ); - SMprintf( "sent SaveYourselfDone\n" ); + SMprintf( "sent SaveYourselfDone SmRestartHint of %d\n", *pSmRestartHint ); bDocSaveDone = true; ICEConnectionObserver::unlock(); } diff --git a/vcl/unx/source/desktopdetect/desktopdetector.cxx b/vcl/unx/source/desktopdetect/desktopdetector.cxx new file mode 100644 index 000000000000..07fb18fa8344 --- /dev/null +++ b/vcl/unx/source/desktopdetect/desktopdetector.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * 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: salplug.cxx,v $ + * $Revision: 1.30 $ + * + * 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_vcl.hxx" + +#include <svunx.h> +#include <tools/prex.h> +#include <X11/Xatom.h> +#include <tools/postx.h> + +#include "vcl/dllapi.h" + +#include "rtl/ustrbuf.hxx" +#include "osl/module.h" +#include "osl/process.h" +#include "osl/thread.h" + +#include <unistd.h> + +using namespace rtl; + +enum { + DESKTOP_NONE = 0, + DESKTOP_UNKNOWN, + DESKTOP_GNOME, + DESKTOP_KDE, + DESKTOP_KDE4, + DESKTOP_CDE +}; + +static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" }; + +static bool is_gnome_desktop( Display* pDisplay ) +{ + bool ret = false; + + // warning: these checks are coincidental, GNOME does not + // explicitly advertise itself + + if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) ) + ret = true; + + if( ! ret ) + { + Atom nAtom1 = XInternAtom( pDisplay, "GNOME_SM_PROXY", True ); + Atom nAtom2 = XInternAtom( pDisplay, "NAUTILUS_DESKTOP_WINDOW_ID", True ); + if( nAtom1 || nAtom2 ) + { + int nProperties = 0; + Atom* pProperties = XListProperties( pDisplay, DefaultRootWindow( pDisplay ), &nProperties ); + if( pProperties && nProperties ) + { + for( int i = 0; i < nProperties; i++ ) + if( pProperties[ i ] == nAtom1 || + pProperties[ i ] == nAtom2 ) + { + ret = true; + } + XFree( pProperties ); + } + } + } + + if( ! ret ) + { + Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True ); + Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True ); + if( nUTFAtom && nNetWMNameAtom ) + { + // another, more expensive check: search for a gnome-panel + XLIB_Window aRoot, aParent, *pChildren = NULL; + unsigned int nChildren = 0; + XQueryTree( pDisplay, DefaultRootWindow( pDisplay ), + &aRoot, &aParent, &pChildren, &nChildren ); + if( pChildren && nChildren ) + { + for( unsigned int i = 0; i < nChildren && ! ret; i++ ) + { + Atom nType = None; + int nFormat = 0; + unsigned long nItems = 0, nBytes = 0; + unsigned char* pProp = NULL; + XGetWindowProperty( pDisplay, + pChildren[i], + nNetWMNameAtom, + 0, 8, + False, + nUTFAtom, + &nType, + &nFormat, + &nItems, + &nBytes, + &pProp ); + if( pProp && nType == nUTFAtom ) + { + OString aWMName( (sal_Char*)pProp ); + if( aWMName.equalsIgnoreAsciiCase( "gnome-panel" ) ) + ret = true; + } + if( pProp ) + XFree( pProp ); + } + XFree( pChildren ); + } + } + } + + return ret; +} + +static bool bWasXError = false; + +static inline bool WasXError() +{ + bool bRet = bWasXError; + bWasXError = false; + return bRet; +} + +extern "C" +{ + static int autodect_error_handler( Display*, XErrorEvent* ) + { + bWasXError = true; + return 0; + } + + typedef int(* XErrorHandler)(Display*,XErrorEvent*); +} + +static int KDEVersion( Display* pDisplay ) +{ + int nRet = 0; + + Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True ); + Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True ); + + if( nFullSession ) + { + if( !nKDEVersion ) + return 3; + + Atom aRealType = None; + int nFormat = 8; + unsigned long nItems = 0; + unsigned long nBytesLeft = 0; + unsigned char* pProperty = NULL; + XGetWindowProperty( pDisplay, + DefaultRootWindow( pDisplay ), + nKDEVersion, + 0, 1, + False, + AnyPropertyType, + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ); + if( !WasXError() && nItems != 0 && pProperty ) + { + nRet = *reinterpret_cast< sal_Int32* >( pProperty ); + } + if( pProperty ) + { + XFree( pProperty ); + pProperty = NULL; + } + } + return nRet; +} + +static bool is_kde_desktop( Display* pDisplay ) +{ + if ( NULL != getenv( "KDE_FULL_SESSION" ) ) + { + const char *pVer = getenv( "KDE_SESSION_VERSION" ); + if ( !pVer || pVer[0] == '0' ) + { + return true; // does not exist => KDE3 + } + + rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) ); + if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + { + return true; + } + } + + if ( KDEVersion( pDisplay ) == 3 ) + return true; + + return false; +} + +static bool is_kde4_desktop( Display* pDisplay ) +{ + if ( NULL != getenv( "KDE_FULL_SESSION" ) ) + { + rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "4" ) ); + + const char *pVer = getenv( "KDE_SESSION_VERSION" ); + if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + return true; + } + + if ( KDEVersion( pDisplay ) == 4 ) + return true; + + return false; +} + +static bool is_cde_desktop( Display* pDisplay ) +{ + void* pLibrary = NULL; + + Atom nDtAtom = XInternAtom( pDisplay, "_DT_WM_READY", True ); + OUString aPathName( RTL_CONSTASCII_USTRINGPARAM( "file:///usr/dt/lib/libDtSvc.so" ) ); + if( nDtAtom && ( pLibrary = osl_loadModule( aPathName.pData, SAL_LOADMODULE_DEFAULT ) ) ) + { + osl_unloadModule( (oslModule)pLibrary ); + return true; + } + + return false; +} + + +extern "C" +{ + +VCL_DLLPUBLIC rtl::OUString get_desktop_environment() +{ + rtl::OUStringBuffer aRet( 8 ); + static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" ); + + if ( pOverride && *pOverride ) + { + OString aOver( pOverride ); + + if ( aOver.equalsIgnoreAsciiCase( "cde" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); + if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); + if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); + if ( aOver.equalsIgnoreAsciiCase( "kde" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); + if ( aOver.equalsIgnoreAsciiCase( "none" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); + } + + if( aRet.getLength() == 0 ) + { + // get display to connect to + const char* pDisplayStr = getenv( "DISPLAY" ); + int nParams = osl_getCommandArgCount(); + OUString aParam; + OString aBParm; + for( int i = 0; i < nParams; i++ ) + { + osl_getCommandArg( i, &aParam.pData ); + if( aParam.equalsAscii( "-headless" ) ) + { + pDisplayStr = NULL; + break; + } + if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) + { + osl_getCommandArg( i+1, &aParam.pData ); + aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); + pDisplayStr = aBParm.getStr(); + break; + } + } + + // no server at all + if( ! pDisplayStr || !*pDisplayStr ) + aRet.appendAscii( desktop_strings[DESKTOP_NONE] ); + else + { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + + Display* pDisplay = XOpenDisplay( pDisplayStr ); + if( pDisplay ) + { + XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); + + if ( is_kde4_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); + else if ( is_gnome_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); + else if ( is_cde_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); + else if ( is_kde_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); + else + aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); + + // set the default handler again + XSetErrorHandler( pOldHdl ); + + XCloseDisplay( pDisplay ); + } + } + } + + return aRet.makeStringAndClear(); +} + +} diff --git a/vcl/unx/source/desktopdetect/makefile.mk b/vcl/unx/source/desktopdetect/makefile.mk new file mode 100644 index 000000000000..cc845ee34887 --- /dev/null +++ b/vcl/unx/source/desktopdetect/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# 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: 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 +# 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=vcl +TARGET=dtdetect + +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile2.pmk + +# --- Files -------------------------------------------------------- + +.IF "$(GUIBASE)"!="unx" + +dummy: + @echo "Nothing to build for GUIBASE $(GUIBASE)" + +.ELSE # "$(GUIBASE)"!="unx" + +SLOFILES=$(SLO)$/desktopdetector.obj + +.ENDIF # "$(GUIBASE)"!="unx" + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/dtrans/source/X11/X11_clipboard.cxx b/vcl/unx/source/dtrans/X11_clipboard.cxx index ddef361e0670..0a47076f0d09 100644 --- a/dtrans/source/X11/X11_clipboard.cxx +++ b/vcl/unx/source/dtrans/X11_clipboard.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11/Xatom.h> #include <X11_clipboard.hxx> diff --git a/dtrans/source/X11/X11_clipboard.hxx b/vcl/unx/source/dtrans/X11_clipboard.hxx index a12064df6cbd..a12064df6cbd 100644 --- a/dtrans/source/X11/X11_clipboard.hxx +++ b/vcl/unx/source/dtrans/X11_clipboard.hxx diff --git a/dtrans/source/X11/X11_dndcontext.cxx b/vcl/unx/source/dtrans/X11_dndcontext.cxx index b9d8f10efa23..59832c27c2a7 100644 --- a/dtrans/source/X11/X11_dndcontext.cxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11_dndcontext.hxx> #include <X11_selection.hxx> diff --git a/dtrans/source/X11/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx index f2ecb7b0841b..f2ecb7b0841b 100644 --- a/dtrans/source/X11/X11_dndcontext.hxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx diff --git a/dtrans/source/X11/X11_droptarget.cxx b/vcl/unx/source/dtrans/X11_droptarget.cxx index 4f71a0507790..153514c668a0 100644 --- a/dtrans/source/X11/X11_droptarget.cxx +++ b/vcl/unx/source/dtrans/X11_droptarget.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11_selection.hxx> diff --git a/dtrans/source/X11/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 21030a220917..3f7dfc2df709 100644 --- a/dtrans/source/X11/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <unistd.h> #include <stdio.h> @@ -293,25 +293,11 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c * registering us as XEventHandler on it. * * implementor's note: - * <RANT> - * Because XDND implementations send their ClientMessage events with - * XSendEvent and event mask 0 (which is perfectly sensible) - * these events get only sent to the connection that created - * the window in question: the vcl display. - * - * So this whole service should be implemented in vcl where - * it belongs. But as usual the dogmatics win and the dogma says: - * "vcl bad, service good". So instead of making vcl a service - * providing library we make a new one that is "independent" of vcl, - * because it is not linked against it and dispatch every event of - * the vcl event loop to here via uno mechanisms (that is copying it, - * locking and unlocking mutexes). Well, the user has fast computers - * these days, so why do we need performance where more memory and - * a faster CPU will do the job ? - * And that is why this runs under the title: - * How NOT to implement a service - * or the victory of dogma over common sense. - * </RANT> + * FIXME: + * finally the clipboard and XDND service is back in the module it belongs + * now cleanup and sharing of resources with the normal vcl event loop + * needs to be added. The display used whould be that of the normal event loop + * and synchronization should be done via the SolarMutex. */ if( arguments.getLength() > 0 ) arguments.getConstArray()[0] >>= m_xDisplayConnection; @@ -338,20 +324,8 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c arguments.getConstArray()[2] >>= m_xBitmapConverter; } - int nParams = osl_getCommandArgCount(); OUString aParam; - bool bIsHeadless = false; - for( int i = 0; i < nParams; i++ ) - { - osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) - { - bIsHeadless = true; - break; - } - } - - if( ! m_pDisplay && ! bIsHeadless ) + if( ! m_pDisplay ) { OUString aUDisplay; if( m_xDisplayConnection.is() ) diff --git a/dtrans/source/X11/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx index dc6c41247bbd..dc6c41247bbd 100644 --- a/dtrans/source/X11/X11_selection.hxx +++ b/vcl/unx/source/dtrans/X11_selection.hxx diff --git a/vcl/unx/source/dtrans/X11_service.cxx b/vcl/unx/source/dtrans/X11_service.cxx new file mode 100644 index 000000000000..cf971a2f8eb6 --- /dev/null +++ b/vcl/unx/source/dtrans/X11_service.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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: X11_service.cxx,v $ + * $Revision: 1.11 $ + * + * 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_vcl.hxx" + +#include "salinst.h" + +#include <X11_clipboard.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <uno/dispatcher.h> // declaration of generic uno interface +#include <uno/mapping.hxx> // mapping stuff +#include <cppuhelper/factory.hxx> +#include <cppuhelper/compbase1.hxx> + +using namespace rtl; +using namespace cppu; +using namespace com::sun::star::lang; +using namespace com::sun::star::datatransfer::clipboard; +using namespace com::sun::star::awt; +using namespace x11; + +Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource"); + return aRet; +} + +Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget"); + return aRet; +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) +{ + static std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; + + OUString aDisplayName; + Atom nSelection; + + // extract display name from connection argument. An exception is thrown + // by SelectionManager.initialize() if no display connection is given. + if( arguments.getLength() > 0 ) + { + Reference< XDisplayConnection > xConn; + arguments.getConstArray()[0] >>= xConn; + + if( xConn.is() ) + { + Any aIdentifier = xConn->getIdentifier(); + aIdentifier >>= aDisplayName; + } + } + + SelectionManager& rManager = SelectionManager::get( aDisplayName ); + rManager.initialize( arguments ); + + // check if any other selection than clipboard selection is specified + if( arguments.getLength() > 1 ) + { + OUString aSelectionName; + + arguments.getConstArray()[1] >>= aSelectionName; + nSelection = rManager.getAtom( aSelectionName ); + } + else + { + // default atom is clipboard selection + nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); + } + + ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); + ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); + if( it != rMap.end() ) + return it->second; + + X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection ); + rMap[ nSelection ] = pClipboard; + + return static_cast<OWeakObject*>(pClipboard); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateDragSource() +{ + return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateDropTarget() +{ + return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); +} + + diff --git a/dtrans/source/X11/X11_transferable.cxx b/vcl/unx/source/dtrans/X11_transferable.cxx index d9dfa3a659a4..a95b87fe1c15 100644 --- a/dtrans/source/X11/X11_transferable.cxx +++ b/vcl/unx/source/dtrans/X11_transferable.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> diff --git a/dtrans/source/X11/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx index 8e8367f666e2..8e8367f666e2 100644 --- a/dtrans/source/X11/X11_transferable.hxx +++ b/vcl/unx/source/dtrans/X11_transferable.hxx diff --git a/dtrans/source/X11/bmp.cxx b/vcl/unx/source/dtrans/bmp.cxx index 372dad10b696..49219bfb0e2a 100644 --- a/dtrans/source/X11/bmp.cxx +++ b/vcl/unx/source/dtrans/bmp.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <unistd.h> #include <cstdio> diff --git a/dtrans/source/X11/bmp.hxx b/vcl/unx/source/dtrans/bmp.hxx index baf04ac31d90..baf04ac31d90 100644 --- a/dtrans/source/X11/bmp.hxx +++ b/vcl/unx/source/dtrans/bmp.hxx diff --git a/dtrans/source/X11/config.cxx b/vcl/unx/source/dtrans/config.cxx index f2f8a0f19b90..2402fb4452c3 100644 --- a/dtrans/source/X11/config.cxx +++ b/vcl/unx/source/dtrans/config.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <cstdio> #include <unotools/configitem.hxx> diff --git a/dtrans/source/X11/copydata_curs.h b/vcl/unx/source/dtrans/copydata_curs.h index 21a095521939..21a095521939 100644 --- a/dtrans/source/X11/copydata_curs.h +++ b/vcl/unx/source/dtrans/copydata_curs.h diff --git a/dtrans/source/X11/copydata_mask.h b/vcl/unx/source/dtrans/copydata_mask.h index 25db64d9bfee..25db64d9bfee 100644 --- a/dtrans/source/X11/copydata_mask.h +++ b/vcl/unx/source/dtrans/copydata_mask.h diff --git a/dtrans/source/X11/linkdata_curs.h b/vcl/unx/source/dtrans/linkdata_curs.h index 01ea8678acd2..01ea8678acd2 100644 --- a/dtrans/source/X11/linkdata_curs.h +++ b/vcl/unx/source/dtrans/linkdata_curs.h diff --git a/dtrans/source/X11/linkdata_mask.h b/vcl/unx/source/dtrans/linkdata_mask.h index b4207ad40dcf..b4207ad40dcf 100644 --- a/dtrans/source/X11/linkdata_mask.h +++ b/vcl/unx/source/dtrans/linkdata_mask.h diff --git a/dtrans/source/X11/makefile.mk b/vcl/unx/source/dtrans/makefile.mk index 219033cb706d..6af3a7c75048 100644 --- a/dtrans/source/X11/makefile.mk +++ b/vcl/unx/source/dtrans/makefile.mk @@ -29,15 +29,13 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=..$/..$/.. -PRJNAME=dtrans +PRJNAME=vcl TARGET=dtransX11 TARGETTYPE=GUI ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST=$(TARGET) -LIBTARGET=NO # --- Settings ----------------------------------------------------- @@ -67,28 +65,6 @@ SLOFILES=\ $(SLO)$/bmp.obj \ $(SLO)$/config.obj -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -.IF "$(OS)"=="MACOSX" -SHL1STDLIBS= $(LIBSTLPORT) $(CPPUHELPERLIB) -.ELSE -SHL1STDLIBS= $(CPPUHELPERLIB) -.ENDIF - -SHL1STDLIBS+= \ - $(UNOTOOLSLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - -lX11 - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) -SHL1OBJS= $(SLOFILES) - -SHL1VERSIONMAP=exports.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - .ENDIF # "$(OS)"=="MACOSX" # --- Targets ------------------------------------------------------ diff --git a/dtrans/source/X11/movedata_curs.h b/vcl/unx/source/dtrans/movedata_curs.h index 36845d5e9d1e..36845d5e9d1e 100644 --- a/dtrans/source/X11/movedata_curs.h +++ b/vcl/unx/source/dtrans/movedata_curs.h diff --git a/dtrans/source/X11/movedata_mask.h b/vcl/unx/source/dtrans/movedata_mask.h index facca718b8bf..facca718b8bf 100644 --- a/dtrans/source/X11/movedata_mask.h +++ b/vcl/unx/source/dtrans/movedata_mask.h diff --git a/dtrans/source/X11/nodrop_curs.h b/vcl/unx/source/dtrans/nodrop_curs.h index 725b0fccf91b..725b0fccf91b 100644 --- a/dtrans/source/X11/nodrop_curs.h +++ b/vcl/unx/source/dtrans/nodrop_curs.h diff --git a/dtrans/source/X11/nodrop_mask.h b/vcl/unx/source/dtrans/nodrop_mask.h index ef67a2bc2642..ef67a2bc2642 100644 --- a/dtrans/source/X11/nodrop_mask.h +++ b/vcl/unx/source/dtrans/nodrop_mask.h diff --git a/vcl/unx/source/gdi/cdeint.cxx b/vcl/unx/source/gdi/cdeint.cxx index 4d2a6dba78ca..3794737b293e 100644 --- a/vcl/unx/source/gdi/cdeint.cxx +++ b/vcl/unx/source/gdi/cdeint.cxx @@ -216,6 +216,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetDialogTextColor( aDeactive ); aStyleSettings.SetMenuTextColor( aDeactive ); + aStyleSettings.SetMenuBarTextColor( aDeactive ); aStyleSettings.SetButtonTextColor( aDeactive ); aStyleSettings.SetRadioCheckTextColor( aDeactive ); aStyleSettings.SetGroupTextColor( aDeactive ); diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index e128b7d150fa..bfc5aa9d66f4 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1176,11 +1176,11 @@ typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; } // end of anonymous namespace // draw a poly-polygon -bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, double fTransparency) +bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency) { // nothing to do for empty polypolygons - const int nPolygonCount = rPolyPoly.count(); - if( nPolygonCount <= 0 ) + const int nOrigPolyCount = rOrigPolyPoly.count(); + if( nOrigPolyCount <= 0 ) return TRUE; // nothing to do if everything is transparent @@ -1209,28 +1209,22 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); - const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly ); + const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); const bool bNeedViewClip = !aPolyRange.isInside( aViewRange ); if( !aPolyRange.overlaps( aViewRange ) ) return true; // convert the polypolygon to trapezoids - // first convert the B2DPolyPolygon to HalfTrapezoids - // #i100922# try to prevent priority-queue reallocations by reservering enough + // prepare the polypolygon for the algorithm below: + // - clip it against the view range + // - make sure it contains no self-intersections + // while we are at it guess the number of involved polygon points int nHTQueueReserve = 0; - for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx ) - { - const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx ); - const int nPointCount = aOuterPolygon.count(); - nHTQueueReserve += aOuterPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; - } - nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTQueue aHTQueue; - aHTQueue.reserve( nHTQueueReserve ); - for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx ) + basegfx::B2DPolyPolygon aGoodPolyPoly; + for( int nOrigPolyIdx = 0; nOrigPolyIdx < nOrigPolyCount; ++nOrigPolyIdx ) { - const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx ); + const ::basegfx::B2DPolygon aOuterPolygon = rOrigPolyPoly.getB2DPolygon( nOrigPolyIdx ); // render-trapezoids should be inside the view => clip polygon against view range basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon ); @@ -1238,33 +1232,55 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly { aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false ); DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" ); - if( !aClippedPolygon.count() ) - continue; } + const int nClippedPolyCount = aClippedPolygon.count(); + if( !nClippedPolyCount ) + continue; - // render-trapezoids have linear edges => get rid of bezier segments - if( aClippedPolygon.areControlPointsUsed() ) - aClippedPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aClippedPolygon, 0.125 ); - - // test and remove self intersections - // TODO: make code intersection save, then remove this test - basegfx::B2DPolyPolygon aInnerPolyPoly(basegfx::tools::solveCrossovers( aClippedPolygon)); - const int nInnerPolyCount = aInnerPolyPoly.count(); - for( int nInnerPolyIdx = 0; nInnerPolyIdx < nInnerPolyCount; ++nInnerPolyIdx ) + // #i103259# polypoly.solveCrossover() fails to remove self-intersections + // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon + // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections + for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) { - ::basegfx::B2DPolygon aInnerPolygon = aInnerPolyPoly.getB2DPolygon( nInnerPolyIdx ); - const int nPointCount = aInnerPolygon.count(); - if( !nPointCount ) - continue; + ::basegfx::B2DPolygon aUnsolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); + basegfx::B2DPolyPolygon aSolvedPolyPoly( basegfx::tools::solveCrossovers( aUnsolvedPolygon) ); + const int nSolvedPolyCount = aSolvedPolyPoly.count(); + for( int nSolvedPolyIdx = 0; nSolvedPolyIdx < nSolvedPolyCount; ++nSolvedPolyIdx ) + { + // build the intersection-free polypolygon one by one + const ::basegfx::B2DPolygon aSolvedPolygon = aSolvedPolyPoly.getB2DPolygon( nSolvedPolyIdx ); + aGoodPolyPoly.append( aSolvedPolygon ); + // and while we are at it use the conviently available point count to guess the number of needed half-traps + const int nPointCount = aSolvedPolygon.count(); + nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; + } + } + } + // #i100922# try to prevent priority-queue reallocations by reservering enough + nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; + HTQueue aHTQueue; + aHTQueue.reserve( nHTQueueReserve ); - aHTQueue.reserve( aHTQueue.size() + 8 * nPointCount ); + // first convert the B2DPolyPolygon to HalfTrapezoids + const int nGoodPolyCount = aGoodPolyPoly.count(); + for( int nGoodPolyIdx = 0; nGoodPolyIdx < nGoodPolyCount; ++nGoodPolyIdx ) + { + ::basegfx::B2DPolygon aInnerPolygon = aGoodPolyPoly.getB2DPolygon( nGoodPolyIdx ); + + // render-trapezoids have linear edges => get rid of bezier segments + if( aInnerPolygon.areControlPointsUsed() ) + aInnerPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aInnerPolygon, 0.125 ); + const int nPointCount = aInnerPolygon.count(); + if( nPointCount >= 3 ) + { // convert polygon point pairs to HalfTrapezoids // connect the polygon point with the first one if needed XPointFixed aOldXPF = { 0, 0 }; XPointFixed aNewXPF; for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF ) { + // auto-close the polygon if needed const int k = (nPointIdx < nPointCount) ? nPointIdx : 0; const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k ); @@ -1550,3 +1566,4 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 8a1ed05b8e25..14de25b13e4d 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: salplug.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,18 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <osl/module.h> -#include <osl/process.h> +#include "osl/module.h" +#include "osl/process.h" -#include <rtl/ustrbuf.hxx> +#include "rtl/ustrbuf.hxx" -#include <svunx.h> -#include <tools/prex.h> -#include <X11/Xatom.h> -#include <tools/postx.h> -#include <vcl/salinst.hxx> -#include <saldata.hxx> +#include "vcl/salinst.hxx" +#include "saldata.hxx" #include <cstdio> #include <unistd.h> @@ -130,292 +123,45 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) return pInst; } -static bool is_gnome_desktop( Display* pDisplay ) +static const rtl::OUString& get_desktop_environment() { - bool ret = false; - - // warning: these checks are coincidental, GNOME does not - // explicitly advertise itself - - if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) ) - ret = true; - - if( ! ret ) - { - Atom nAtom1 = XInternAtom( pDisplay, "GNOME_SM_PROXY", True ); - Atom nAtom2 = XInternAtom( pDisplay, "NAUTILUS_DESKTOP_WINDOW_ID", True ); - if( nAtom1 || nAtom2 ) - { - int nProperties = 0; - Atom* pProperties = XListProperties( pDisplay, DefaultRootWindow( pDisplay ), &nProperties ); - if( pProperties && nProperties ) - { - for( int i = 0; i < nProperties; i++ ) - if( pProperties[ i ] == nAtom1 || - pProperties[ i ] == nAtom2 ) - { - ret = true; - } - XFree( pProperties ); - } - } - } - - if( ! ret ) + static rtl::OUString aRet; + if( ! aRet.getLength() ) { - Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True ); - Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True ); - if( nUTFAtom && nNetWMNameAtom ) - { - // another, more expensive check: search for a gnome-panel - XLIB_Window aRoot, aParent, *pChildren = NULL; - unsigned int nChildren = 0; - XQueryTree( pDisplay, DefaultRootWindow( pDisplay ), - &aRoot, &aParent, &pChildren, &nChildren ); - if( pChildren && nChildren ) - { - for( unsigned int i = 0; i < nChildren && ! ret; i++ ) - { - Atom nType = None; - int nFormat = 0; - unsigned long nItems = 0, nBytes = 0; - unsigned char* pProp = NULL; - XGetWindowProperty( pDisplay, - pChildren[i], - nNetWMNameAtom, - 0, 8, - False, - nUTFAtom, - &nType, - &nFormat, - &nItems, - &nBytes, - &pProp ); - if( pProp && nType == nUTFAtom ) - { - OString aWMName( (sal_Char*)pProp ); - if( aWMName.equalsIgnoreAsciiCase( "gnome-panel" ) ) - ret = true; - } - if( pProp ) - XFree( pProp ); - } - XFree( pChildren ); - } - } - } - - return ret; -} - -static bool bWasXError = false; - -static inline bool WasXError() -{ - bool bRet = bWasXError; - bWasXError = false; - return bRet; -} - -extern "C" -{ - static int autodect_error_handler( Display*, XErrorEvent* ) - { - bWasXError = true; - return 0; - } - - typedef int(* XErrorHandler)(Display*,XErrorEvent*); -} - -static int KDEVersion( Display* pDisplay ) -{ - int nRet = 0; - - Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True ); - Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True ); - - if( nFullSession ) - { - if( !nKDEVersion ) - return 3; - - Atom aRealType = None; - int nFormat = 8; - unsigned long nItems = 0; - unsigned long nBytesLeft = 0; - unsigned char* pProperty = NULL; - XGetWindowProperty( pDisplay, - DefaultRootWindow( pDisplay ), - nKDEVersion, - 0, 1, - False, - AnyPropertyType, - &aRealType, - &nFormat, - &nItems, - &nBytesLeft, - &pProperty ); - if( !WasXError() && nItems != 0 && pProperty ) - { - nRet = *reinterpret_cast< sal_Int32* >( pProperty ); - } - if( pProperty ) - { - XFree( pProperty ); - pProperty = NULL; - } - } - return nRet; -} - -static bool is_kde_desktop( Display* pDisplay ) -{ - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( !pVer || pVer[0] == '0' ) - { - return true; // does not exist => KDE3 - } - - rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) ); - if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + OUStringBuffer aModName( 128 ); + aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" ); + aModName.appendAscii( SAL_DLLPOSTFIX ); + aModName.appendAscii( SAL_DLLEXTENSION ); + OUString aModule = aModName.makeStringAndClear(); + + oslModule aMod = osl_loadModuleRelative( + reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData, + SAL_LOADMODULE_DEFAULT ); + if( aMod ) { - return true; + rtl::OUString (*pSym)() = (rtl::OUString(*)()) + osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" ); + if( pSym ) + aRet = pSym(); } + osl_unloadModule( aMod ); } - - if ( KDEVersion( pDisplay ) == 3 ) - return true; - - return false; -} - -static bool is_kde4_desktop( Display* pDisplay ) -{ - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "4" ) ); - - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) - return true; - } - - if ( KDEVersion( pDisplay ) == 4 ) - return true; - - return false; -} - -static bool is_cde_desktop( Display* pDisplay ) -{ - void* pLibrary = NULL; - - Atom nDtAtom = XInternAtom( pDisplay, "_DT_WM_READY", True ); - OUString aPathName( RTL_CONSTASCII_USTRINGPARAM( "file:///usr/dt/lib/libDtSvc.so" ) ); - if( nDtAtom && ( pLibrary = osl_loadModule( aPathName.pData, SAL_LOADMODULE_DEFAULT ) ) ) - { - osl_unloadModule( (oslModule)pLibrary ); - return true; - } - - return false; -} - - -static const char * get_desktop_environment() -{ - static const char *pRet = NULL; - static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" ); - - if ( pOverride && *pOverride ) - { - OString aOver( pOverride ); - - if ( aOver.equalsIgnoreAsciiCase( "cde" ) ) - pRet = desktop_strings[DESKTOP_CDE]; - if ( aOver.equalsIgnoreAsciiCase( "kde" ) ) - pRet = desktop_strings[DESKTOP_KDE]; - if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) - pRet = desktop_strings[DESKTOP_KDE4]; - if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) - pRet = desktop_strings[DESKTOP_GNOME]; - if ( aOver.equalsIgnoreAsciiCase( "none" ) ) - pRet = desktop_strings[DESKTOP_UNKNOWN]; - } - - if ( NULL == pRet ) - { - // get display to connect to - const char* pDisplayStr = getenv( "DISPLAY" ); - int nParams = osl_getCommandArgCount(); - OUString aParam; - OString aBParm; - for( int i = 0; i < nParams; i++ ) - { - osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) - { - pDisplayStr = NULL; - break; - } - if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) - { - osl_getCommandArg( i+1, &aParam.pData ); - aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); - pDisplayStr = aBParm.getStr(); - break; - } - } - - // no server at all - if( ! pDisplayStr || !*pDisplayStr ) - pRet = desktop_strings[DESKTOP_NONE]; - else - { - Display* pDisplay = XOpenDisplay( pDisplayStr ); - if( pDisplay ) - { - XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); - - if ( is_kde4_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_KDE4]; - else if ( is_kde_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_KDE]; - else if ( is_gnome_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_GNOME]; - else if ( is_cde_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_CDE]; - else - pRet = desktop_strings[DESKTOP_UNKNOWN]; - - // set the default handler again - XSetErrorHandler( pOldHdl ); - - XCloseDisplay( pDisplay ); - } - } - } - - return pRet; + return aRet; } - static const char* autodetect_plugin() { - const char * desktop = get_desktop_environment(); + const rtl::OUString& desktop( get_desktop_environment() ); const char * pRet = "gen"; // no server at all: dummy plugin - if ( desktop == desktop_strings[DESKTOP_NONE] ) + if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) pRet = "svp"; - else if ( desktop == desktop_strings[DESKTOP_GNOME] ) + else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) pRet = "gtk"; - else if( desktop == desktop_strings[DESKTOP_KDE] ) + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) pRet = "kde"; - else if( desktop == desktop_strings[DESKTOP_KDE4] ) + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) pRet = "kde4"; else { @@ -455,19 +201,6 @@ SalInstance *CreateSalInstance() if( !(pUsePlugin && *pUsePlugin) ) pInst = check_headless_plugin(); - if( ! pInst ) - { - /* #i92121# workaround deadlocks in the X11 implementation - */ - static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); - /* #i90094# - from now on we know that an X connection will be - established, so protect X against itself - */ - if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) - XInitThreads(); - } - if( ! pInst && !(pUsePlugin && *pUsePlugin) ) pUsePlugin = autodetect_plugin(); @@ -527,8 +260,7 @@ void SalAbort( const XubString& rErrorText ) const OUString& SalGetDesktopEnvironment() { - static OUString aRet = OStringToOUString(OString(get_desktop_environment()), RTL_TEXTENCODING_ASCII_US); - return aRet; + return get_desktop_environment(); } SalData::SalData() : diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index 1caf64ef7e2c..95bc7bca41ca 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -293,8 +293,14 @@ void PPDParser::initPPDFiles() } } -void PPDParser::getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers ) +void PPDParser::getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers, bool bRefresh ) { + if( bRefresh ) + { + delete pAllPPDFiles; + pAllPPDFiles = NULL; + } + initPPDFiles(); o_rDrivers.clear(); diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 04eb9cd32771..6219b50d6ec3 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -1212,7 +1212,12 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) XLIB_Time nUserTime = 0; if( ! bNoActivate && (nStyle_ & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_TOOLWINDOW)) == 0 ) - nUserTime = pDisplay_->GetLastUserEventTime(); + { + if( GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ) + nUserTime = pDisplay_->GetLastUserEventTime( true ); + else + nUserTime = pDisplay_->GetLastUserEventTime(); + } GetDisplay()->getWMAdaptor()->setUserTime( this, nUserTime ); // actually map the window diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 5bb18f25ecd3..32620d9e966a 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -158,6 +158,9 @@ LIB1FILES+= \ $(SLB)$/salwin.lib \ $(SLB)$/salgdi.lib \ $(SLB)$/salapp.lib +.IF "$(GUIBASE)" == "aqua" +LIB1FILES+= $(SLB)$/dtransaqua.lib +.ENDIF .ENDIF SHL1TARGET= vcl$(DLLPOSTFIX) @@ -195,7 +198,8 @@ SHL1USE_EXPORTS=name .IF "$(GUIBASE)"=="aqua" SHL1STDLIBS+= \ $(BASEBMPLIB) \ - -lAppleRemote$(DLLPOSTFIX) + -lAppleRemote$(DLLPOSTFIX) \ + -framework QuickTime LIB1FILES+= \ $(SLB)$/sala11y.lib @@ -268,9 +272,20 @@ STDSHL1 += ft2lib.lib # UNX sal plugins .IF "$(GUI)" == "UNX" && "$(GUIBASE)" != "aqua" +# desktop detector +LIB7TARGET=$(SLB)$/idet +LIB7FILES=$(SLB)$/dtdetect.lib +SHL7TARGET=desktop_detector$(DLLPOSTFIX) +SHL7STDLIBS=\ + $(SALLIB) \ + $(X11LINK_DYNAMIC) +SHL7IMPLIB=idet +SHL7LIBS=$(LIB7TARGET) + # basic pure X11 plugin LIB2TARGET=$(SLB)$/ipure_x LIB2FILES= \ + $(SLB)$/dtransX11.lib \ $(SLB)$/printergfx.lib \ $(SLB)$/salwin.lib \ $(SLB)$/salgdi.lib \ @@ -287,6 +302,9 @@ SHL2STDLIBS=\ $(TOOLSLIB) \ $(VOSLIB) \ $(BASEGFXLIB) \ + $(UNOTOOLSLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ $(SALLIB) # prepare linking of Xinerama @@ -362,7 +380,8 @@ SHL4STDLIBS+=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" @@ -390,7 +409,8 @@ SHL5STDLIBS+=\ $(VCLLIB) \ $(TOOLSLIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" @@ -419,7 +439,8 @@ SHL6STDLIBS+=\ $(PSPLIB) \ $(TOOLSLIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk index 0e57d7aeb80b..63b2889bc15d 100644 --- a/vcl/util/makefile2.pmk +++ b/vcl/util/makefile2.pmk @@ -34,6 +34,5 @@ CDEFS += -DVCL_DLLIMPLEMENTATION VISIBILITY_HIDDEN=TRUE .IF "$(GUIBASE)"=="aqua" -OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) .ENDIF # "$(GUIBASE)"=="aqua" diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h index 26afe892b9a3..33a1a941ed49 100644 --- a/vcl/win/inc/salinst.h +++ b/vcl/win/inc/salinst.h @@ -88,6 +88,7 @@ public: virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo); }; diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index d57cdd48eed2..2b5ac6d3162d 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -39,7 +39,7 @@ #ifdef __MINGW32__ #include <excpt.h> #endif - +#include <osl/file.hxx> #include <vos/mutex.hxx> #include <tools/debug.hxx> #include <wincomp.hxx> @@ -65,11 +65,13 @@ #if defined _MSC_VER #pragma warning(push, 1) +#pragma warning( disable: 4917 ) #endif #include <GdiPlus.h> #include <GdiPlusEnums.h> #include <GdiPlusColor.h> +#include <Shlobj.h> #if defined _MSC_VER #pragma warning(pop) @@ -456,10 +458,10 @@ void InitSalData() { SalData* pSalData = new SalData; CoInitialize(0); -
- // init GDIPlus
- static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
- Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL);
+ + // init GDIPlus + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL); } @@ -471,7 +473,7 @@ void DeInitSalData() // deinit GDIPlus if(pSalData) { - Gdiplus::GdiplusShutdown(pSalData->gdiplusToken);
+ Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); } delete pSalData; @@ -1089,6 +1091,26 @@ void* WinSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn // ----------------------------------------------------------------------- +/** Add a file to the system shells recent document list if there is any. + This function may have no effect under Unix because there is no + standard API among the different desktop managers. + + @param aFileUrl + The file url of the document. +*/ +void WinSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& /*rMimeType*/) +{ + rtl::OUString system_path; + osl::FileBase::RC rc = osl::FileBase::getSystemPathFromFileURL(rFileUrl, system_path); + + OSL_ENSURE(osl::FileBase::E_None == rc, "Invalid file url"); + + if (osl::FileBase::E_None == rc) + SHAddToRecentDocs(SHARD_PATHW, system_path.getStr()); +} + +// ----------------------------------------------------------------------- + SalTimer* WinSalInstance::CreateSalTimer() { return new WinSalTimer(); diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 2d335808e4c1..1b80bf578530 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -1920,7 +1920,7 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, // calculate the absolute position of the first result glyph in pixel units const GOFFSET aGOffset = mpGlyphOffsets[ nStart ]; - Point aRelativePos( nXOffset + aGOffset.du, aGOffset.dv ); + Point aRelativePos( nXOffset + aGOffset.du, -aGOffset.dv ); rPos = GetDrawPosition( aRelativePos ); // fill the result arrays diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 3ffc358bd76d..4a49d83918da 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -440,11 +440,11 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, nExSysStyle |= WS_EX_TOOLWINDOW; pFrame->mbFloatWin = TRUE; - if ( pEnvTransparentFloats && bLayeredAPI == 1 /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) + if ( (bLayeredAPI == 1) && (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) nExSysStyle |= WS_EX_LAYERED; } - if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP ) + if( (nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP) || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) nExSysStyle |= WS_EX_TOPMOST; // init frame data @@ -2930,6 +2930,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetUseFlatBorders( FALSE ); aStyleSettings.SetUseFlatMenues( FALSE ); aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk index 34316356a1a6..0b89f031651d 100644 --- a/vcl/workben/makefile.mk +++ b/vcl/workben/makefile.mk @@ -140,6 +140,7 @@ APP5STDLIBS+=-lsocket .ENDIF .INCLUDE : target.mk +.IF "$(L10N_framework)"=="" ALLTAR : $(BIN)$/applicat.rdb @@ -151,4 +152,4 @@ $(BIN)$/applicat.rdb : makefile.mk $(UNOUCRRDB) $(REGCOMP) -register -r applicat.rdb \ -c i18nsearch.uno$(DLLPOST) \ -c i18npool.uno$(DLLPOST) - +.ENDIF |