diff options
author | Armin Le Grand <alg@apache.org> | 2013-11-07 13:29:41 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-11-07 13:29:41 +0000 |
commit | e9a2d5e2889fe43565fcf453fa9db3875187d20b (patch) | |
tree | 5f9fd2bed5efa78233da130f080810e5d8d17de7 | |
parent | 016bb3894dcc2e3a9cfb6324f1a9f389c192426d (diff) |
resync to trunk
538 files changed, 8065 insertions, 38869 deletions
diff --git a/accessibility/bridge/source/java/makefile.mk b/accessibility/bridge/source/java/makefile.mk index 4ec98fe8d470..d19f88f45260 100644 --- a/accessibility/bridge/source/java/makefile.mk +++ b/accessibility/bridge/source/java/makefile.mk @@ -61,6 +61,6 @@ SHL1HEADER=$(OUT)$/inc$/WindowsAccessBridgeAdapter.h $(SLO)$/WindowsAccessBridgeAdapter.obj : $(SHL1HEADER) $(SHL1HEADER) : - javah -classpath $(OUT)$/class -o $(SHL1HEADER) org.openoffice.accessibility.WindowsAccessBridgeAdapter + javah -classpath "$(OUT)$/class;$(OUTDIR)$/bin/ridl.jar;$(OUTDIR)$/bin/unoil.jar;$(CLASSPATH)" -o $(SHL1HEADER) org.openoffice.accessibility.WindowsAccessBridgeAdapter .ENDIF # "$(GUI)"=="WNT" diff --git a/autodoc/source/inc/estack.hxx b/autodoc/source/inc/estack.hxx index 29ec063a9844..351560ed61fa 100644 --- a/autodoc/source/inc/estack.hxx +++ b/autodoc/source/inc/estack.hxx @@ -74,7 +74,6 @@ class EStack : private std::slist<ELEM> // INQUIRY const value_type & top() const { return base::front(); } - size_type size() const { return base::size(); } bool empty() const { return base::empty(); } // ACCESS diff --git a/autodoc/source/parser/cpp/sownstck.hxx b/autodoc/source/parser/cpp/sownstck.hxx index a3ec524eb893..ca3a1fa2b05a 100644 --- a/autodoc/source/parser/cpp/sownstck.hxx +++ b/autodoc/source/parser/cpp/sownstck.hxx @@ -121,7 +121,7 @@ inline ary::cpp::Class * ContextForAry:: S_OwnerStack::CurClass() const { - return aStack_Classes.size() > 0 + return !aStack_Classes.empty() ? aStack_Classes.top().first : (ary::cpp::Class *) 0; } @@ -130,7 +130,7 @@ inline void ContextForAry:: S_OwnerStack::SetOwner_2CurNamespace() { - csv_assert( aStack_Namespaces.size() > 0 ); + csv_assert( !aStack_Namespaces.empty() ); pOwner_Cur = pOwner_Namespace.MutablePtr(); pOwner_Namespace->SetAnotherNamespace( CurNamespace() ); } @@ -139,7 +139,7 @@ inline void ContextForAry:: S_OwnerStack::SetOwner_2CurClass() { - csv_assert( aStack_Classes.size() > 0 ); + csv_assert( !aStack_Classes.empty() ); pOwner_Cur = pOwner_Class.MutablePtr(); pOwner_Class->SetAnotherClass( *CurClass() ); } @@ -173,7 +173,7 @@ inline void ContextForAry:: S_OwnerStack::SetGlobalNamespace( ary::cpp::Namespace & io_rGlobalNamespace ) { - csv_assert( aStack_Namespaces.size() == 0 ); + csv_assert( aStack_Namespaces.empty() ); aStack_Namespaces.push(&io_rGlobalNamespace); SetOwner_2CurNamespace(); } @@ -187,7 +187,7 @@ inline void ContextForAry:: S_OwnerStack::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) { - csv_assert( aStack_Namespaces.size() > 0 OR io_rOpenedNamespace.Parent() == 0 ); + csv_assert( !aStack_Namespaces.empty() OR io_rOpenedNamespace.Parent() == 0 ); aStack_Namespaces.push(&io_rOpenedNamespace); SetOwner_2CurNamespace(); } @@ -228,7 +228,7 @@ inline E_Protection ContextForAry:: S_OwnerStack::CurProtection() const { - return aStack_Classes.size() > 0 + return !aStack_Classes.empty() ? aStack_Classes.top().second : ary::cpp::PROTECT_global; } @@ -271,15 +271,15 @@ S_OwnerStack::CloseBlock() } else { - // csv_assert( aStack_Classes.size() == 0 ); - if ( aStack_Classes.size() > 0 ) + // csv_assert( aStack_Classes.empty() ); + if ( !aStack_Classes.empty() ) throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); csv_assert( pCurEnum == 0 ); aStack_Namespaces.pop(); - // csv_assert( aStack_Namespaces.size() > 0 ); - if( aStack_Namespaces.size() == 0 ) + // csv_assert( !aStack_Namespaces.empty() ); + if( aStack_Namespaces.empty() ) throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); } @@ -290,12 +290,12 @@ void ContextForAry:: S_OwnerStack::CloseClass() { - // csv_assert( aStack_Classes.size() > 0 ); - if ( aStack_Classes.size() == 0 ) + // csv_assert( !aStack_Classes.empty() ); + if ( aStack_Classes.empty() ) throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); aStack_Classes.pop(); - if ( aStack_Classes.size() > 0 ) + if ( !aStack_Classes.empty() ) SetOwner_2CurClass(); else SetOwner_2CurNamespace(); @@ -307,7 +307,7 @@ S_OwnerStack::CloseEnum() { csv_assert( pCurEnum != 0 ); pCurEnum = 0; - if ( aStack_Classes.size() > 0 ) + if ( !aStack_Classes.empty() ) SetOwner_2CurClass(); else SetOwner_2CurNamespace(); diff --git a/automation/source/mozillaserver/makefile.mk b/automation/source/mozillaserver/makefile.mk deleted file mode 100644 index 1ad74c47b306..000000000000 --- a/automation/source/mozillaserver/makefile.mk +++ /dev/null @@ -1,149 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=..$/.. - -PRJNAME=automation -TARGET=xxx -USE_DEFFILE=TRUE -NO_BSYMBOLIC=TRUE -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -PACKAGE := com$/sun$/star$/testtool -TARGET := com_sun_star_testtool - - -#RDB=$(SOLARBINDIR)$/applicat.rdb -RDB=$(BIN)$/mozillatesttool.rdb - - -GENJAVACLASSFILES = \ - $(CLASSDIR)$/$(PACKAGE)$/XAction.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionControl.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionCommand.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionControl.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionFlow.class \ - $(CLASSDIR)$/$(PACKAGE)$/XResult.class \ - $(CLASSDIR)$/$(PACKAGE)$/ResultType.class \ - $(CLASSDIR)$/$(PACKAGE)$/XMozillaTesttoolServer.class - - -TYPES={$(subst,.class, $(subst,$/,. $(subst,$(CLASSDIR)$/,-T $(GENJAVACLASSFILES))))} -GENJAVAFILES = {$(subst,.class,.java $(subst,$/class, $(GENJAVACLASSFILES)))} -#JAVAFILES= $(GENJAVAFILES) - - - -UNOUCRDEP=$(RDB) -UNOUCRRDB=$(RDB) - -UNOUCROUT=$(OUT)$/inc -INCPRE+=$(OUT)$/inc - -UNOTYPES= \ - com.sun.star.uno.TypeClass \ - com.sun.star.uno.XAggregation \ - com.sun.star.uno.XWeak \ - com.sun.star.lang.XTypeProvider \ - com.sun.star.lang.XServiceInfo \ - com.sun.star.lang.XSingleServiceFactory \ - com.sun.star.lang.XMultiServiceFactory \ - com.sun.star.lang.XComponent \ - com.sun.star.lang.XMain \ - com.sun.star.loader.XImplementationLoader \ - com.sun.star.registry.XRegistryKey \ - com.sun.star.bridge.XUnoUrlResolver \ - com.sun.star.container.XSet \ - com.sun.star.testtool.XAction \ - com.sun.star.testtool.XActionControl \ - com.sun.star.testtool.XActionCommand \ - com.sun.star.testtool.XActionControl \ - com.sun.star.testtool.XActionFlow \ - com.sun.star.testtool.XResult \ - com.sun.star.testtool.ResultType \ - com.sun.star.testtool.XMozillaTesttoolServer - - - -#SLOFILES= \ -# $(SLO)$/iserverproxy.obj \ -# $(SLO)$/broadcastclient.obj \ -# $(SLO)$/genericinformation.obj \ -# $(SLO)$/informationclient.obj - -# ---- test ---- - -#LIB1TARGET=$(SLB)$/iserverproxy.lib -#LIB1OBJFILES=$(SLOFILES) - -#SHL1TARGET=iserverproxy -#SHL1STDLIBS= \ -# $(VOSLIB) $(OSLLIB) $(RTLLIB) $(TOOLSLIB) \ -# $(CPPULIB) \ -# $(CPPUHELPERLIB) \ -# $(UNOLIB) \ -# $(SVTOOLLIB) \ -# $(SALLIB) \ -# $(BOOTSTRP) - -#SHL1LIBS= $(LIB1TARGET) $(LB)$/ico.lib -#SHL1DEF= $(MISC)$/$(SHL1TARGET).def -#DEF1NAME= $(SHL1TARGET) -#DEF1EXPORTFILE= exports.dxp - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(GENJAVAFILES) - -ALLIDLFILES= \ - mozillatesttoolserver.idl \ - xmozillatesttoolserver.idl - -$(RDB): $(ALLIDLFILES) - $(TOUCH) $@ - $(RM) $@ - unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $? - $(REGMERGE) $@ /UCR $(BIN)$/{$(ALLIDLFILES:f:s/.idl/.urd/)} - $(REGMERGE) $@ / $(SOLARBINDIR)$/applicat.rdb - $(REGCOMP) -register -r $@ -c $(DLLPRE)connectr$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)acceptor$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)brdgfctr$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)remotebridge$(DLLPOST) - $(TOUCH) $@ - - -$(GENJAVAFILES): $(RDB) - @echo Types: $(TYPES) - @echo Javafiles: $(GENJAVAFILES) - $(JAVAMAKER) -BUCR -O$(OUT) $(TYPES) $(RDB) - - diff --git a/automation/source/mozillaserver/mozillatesttoolserver.idl b/automation/source/mozillaserver/mozillatesttoolserver.idl deleted file mode 100644 index 84b62b70e6c3..000000000000 --- a/automation/source/mozillaserver/mozillatesttoolserver.idl +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef __com_sun_star_testtool_MozillaTesttoolServer_idl__ -#define __com_sun_star_testtool_MozillaTesttoolServer_idl__ - -#include <xmozillatesttoolserver.idl> - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** - * This service provides the ability to control Mozilla - *<BR> - */ -service MozillaTesttoolServer -{ - /** resolve objects via this interface. - */ - interface com::sun::star::testtool::XMozillaTesttoolServer; -}; - -//============================================================================= - -}; }; }; }; - -#endif diff --git a/automation/source/mozillaserver/xmozillatesttoolserver.idl b/automation/source/mozillaserver/xmozillatesttoolserver.idl deleted file mode 100644 index 43ad5a450dc1..000000000000 --- a/automation/source/mozillaserver/xmozillatesttoolserver.idl +++ /dev/null @@ -1,153 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef __com_sun_star_testtool_XMozillaTesttoolServer_idl__ -#define __com_sun_star_testtool_XMozillaTesttoolServer_idl__ - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/lang/IllegalArgumentException.idl> -#include <com/sun/star/connection/NoConnectException.idl> - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XAction : com::sun::star::uno::XInterface -{ - /** execute one command - <BR> - */ - void execute(); - -}; - -//============================================================================= - - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XActionControl : XAction -{ - /** execute one command - <BR> - */ - void execute(); - -}; - -//============================================================================= - - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XActionCommand : XAction -{ - /** execute one command - <BR> - */ - void execute(); - -}; - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423743-33D6-11D1-AABE00A0-259D5623), ident( "XActionFlow", 1.0 ) ] -interface XActionFlow : XAction -{ - /** execute one command - <BR> - */ - void execute(); - -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -module com { module sun { module star { module testtool { - - -enum ResultType - { - SEQUENCE, /// command with SEQUENCE has been executed - ERROR, /// An error has ocured - RESULT, /// Result of a request - ASSERTION, /// An Assertion has been captured - UI_INFO /// Info about the UserInterfaace - }; - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2426453-33D6-11D1-AABE00A0-259D5623), ident( "XResult", 1.0 ) ] -interface XResult : com::sun::star::uno::XInterface -{ - /** execute one command - <BR> - */ - void SetResultType( [in] ResultType aType ); - ResultType GetResultType(); - - void SetValue( [in] any Value ); - any GetValue(); -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2446735-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XMozillaTesttoolServer : com::sun::star::uno::XInterface -{ - /** Control the Mozilla Browser - <BR> - */ - [oneway] void execute( [in] XAction aAction ); -// sequence < XResult > getResults( [in] boolean bBlock ); /// bBoch = TRUE means to wait for at least 1 result - -}; - -//============================================================================= - -}; }; }; }; - - -#endif diff --git a/basegfx/inc/basegfx/color/bcolor.hxx b/basegfx/inc/basegfx/color/bcolor.hxx index 724fe057afab..0319b09745e7 100644 --- a/basegfx/inc/basegfx/color/bcolor.hxx +++ b/basegfx/inc/basegfx/color/bcolor.hxx @@ -193,18 +193,20 @@ namespace basegfx } // clamp color to [0.0..1.0] values in all three intensity components - void clamp() + BColor& clamp() { mfX = basegfx::clamp(mfX, 0.0, 1.0); mfY = basegfx::clamp(mfY, 0.0, 1.0); mfZ = basegfx::clamp(mfZ, 0.0, 1.0); + return *this; } - void invert() + BColor& invert() { mfX = 1.0 - mfX; mfY = 1.0 - mfY; mfZ = 1.0 - mfZ; + return *this; } static const BColor& getEmptyBColor() diff --git a/basegfx/inc/basegfx/color/bcolormodifier.hxx b/basegfx/inc/basegfx/color/bcolormodifier.hxx index afdc38c8b9a7..4009239b00c4 100644 --- a/basegfx/inc/basegfx/color/bcolormodifier.hxx +++ b/basegfx/inc/basegfx/color/bcolormodifier.hxx @@ -19,77 +19,376 @@ * *************************************************************/ - - #ifndef _BGFX_COLOR_BCOLORMODIFIER_HXX #define _BGFX_COLOR_BCOLORMODIFIER_HXX #include <basegfx/color/bcolor.hxx> +#include <boost/utility.hpp> +#include <boost/shared_ptr.hpp> #include <vector> ////////////////////////////////////////////////////////////////////////////// namespace basegfx { - /** Descriptor for type of color modification + /** base class to define color modifications + + The basic idea is to have instances of color modifiers where each + of these can be asked to get a modified version of a color. This + can be as easy as to return a fixed color, but may also do any + other computation based on the given source color and the local + algorythm to apply. + + This base implementation defines the abstract base class. Every + derivation offers another color blending effect, when needed with + parameters for that blending defined as members. + + As long as aw080 is not applied, an operator== is needed to implement + the operator== of the primitive based on this instances. + + For the exact definitions of the color blending applied refer to the + implementation of the method getModifiedColor + + BColorModifier is not copyable (no copy constructor, no assigment + operator); local values cannot be changed after construction. The + instances are cheap and the idea is to create them on demand. To + be able to reuse these as much as possible, a define for a + ::boost::shared_ptr named BColorModifierSharedPtr exists below. + All usages should handle instances of BColorModifier encapsulated + into these shared pointers. */ - enum BColorModifyMode + class BColorModifier : private boost::noncopyable { - BCOLORMODIFYMODE_REPLACE, // replace all color with local color - BCOLORMODIFYMODE_INTERPOLATE, // interpolate color between given and local with local value - BCOLORMODIFYMODE_GRAY, // convert color to gray - BCOLORMODIFYMODE_BLACKANDWHITE, // convert color to B&W, local value is treshhold - BCOLORMODIFYMODE_INVERT, // invert color - BCOLORMODIFYMODE_LUMINANCE_TO_ALPHA // convert color to alpha value (used for Svg Mask) + private: + protected: + // noone is allowed to incarnate the abstract base class + // except derivations + BColorModifier() {} + + public: + // noone should directly destroy it; all incarnations should be + // handled in a boost::shared_ptr of type BColorModifierSharedPtr + virtual ~BColorModifier(); + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const = 0; + bool operator!=(const BColorModifier& rCompare) const + { + return !(operator==(rCompare)); + } + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const = 0; }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** convert color to gray - /** Class to hold a color, value and mode for a color modification. Color modification is - done calling the getModifiedColor() method + returns a color where red green and blue are replaced with the + luminance value calculated based on the source color by using + the following weights: r * 0.30, g * 0.59, b * 0.11 */ - class BColorModifier + class BColorModifier_gray : public BColorModifier { + private: protected: - ::basegfx::BColor maBColor; - double mfValue; - BColorModifyMode meMode; + public: + BColorModifier_gray() + : BColorModifier() + { + } + + virtual ~BColorModifier_gray(); + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// +namespace basegfx +{ + /** invert color + + returns a color where red green and blue are inverted using 1.0 - n + */ + class BColorModifier_invert : public BColorModifier + { + private: + protected: public: - BColorModifier( - const ::basegfx::BColor& rBColor, - double fValue = 0.5, - BColorModifyMode eMode = BCOLORMODIFYMODE_REPLACE) - : maBColor(rBColor), - mfValue(fValue), - meMode(eMode) - {} - - // compare operator(s) - bool operator==(const BColorModifier& rCompare) const + BColorModifier_invert() + : BColorModifier() { - return (maBColor == rCompare.maBColor && mfValue == rCompare.mfValue && meMode == rCompare.meMode); } - bool operator!=(const BColorModifier& rCompare) const + virtual ~BColorModifier_invert(); + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** convert to alpha based on luminance + + returns a color where red green and blue are first weighted and added + to build a luminance value which is then inverted and used for red, + green and blue. The weights are r * 0.2125 + g * 0.7154 + b * 0.0721. + This derivation is used for the svg importer and does exactly what SVG + defines for this needed case. + */ + class BColorModifier_luminance_to_alpha : public BColorModifier + { + private: + protected: + public: + BColorModifier_luminance_to_alpha() + : BColorModifier() + { + } + + virtual ~BColorModifier_luminance_to_alpha(); + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** replace color + + does not use the source color at all, but always returns the + given color, replacing everything. Useful e.g. for unified shadow + creation + */ + class BColorModifier_replace : public BColorModifier + { + private: + ::basegfx::BColor maBColor; + + protected: + public: + BColorModifier_replace(const ::basegfx::BColor& rBColor) + : BColorModifier(), + maBColor(rBColor) { - return !(operator==(rCompare)); } + virtual ~BColorModifier_replace(); + // data access const ::basegfx::BColor& getBColor() const { return maBColor; } + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** interpolate color + + returns an interpolated color mixed by the given value (f) in the range + [0.0 .. 1.0] and the given color (col) as follows: + + col * (1 - f) + aSourceColor * f + */ + class BColorModifier_interpolate : public BColorModifier + { + private: + ::basegfx::BColor maBColor; + double mfValue; + + protected: + public: + BColorModifier_interpolate(const ::basegfx::BColor& rBColor, double fValue) + : BColorModifier(), + maBColor(rBColor), + mfValue(fValue) + { + } + + virtual ~BColorModifier_interpolate(); + + // data access + const ::basegfx::BColor& getBColor() const { return maBColor; } + double getValue() const { return mfValue; } + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** convert color to black and white + + returns black when the luminance of the given color is less than + the given treshhold value in the range [0.0 .. 1.0], else white + */ + class BColorModifier_black_and_white : public BColorModifier + { + private: + double mfValue; + + protected: + public: + BColorModifier_black_and_white(double fValue) + : BColorModifier(), + mfValue(fValue) + { + } + + virtual ~BColorModifier_black_and_white(); + + // data access + double getValue() const { return mfValue; } + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** gamma correction + + Input is a gamma correction value in the range ]0.0 .. 10.0]; the + color values get correted using + + col(r,g,b) = clamp(pow(col(r,g,b), 1.0 / gamma), 0.0, 1.0) + */ + class BColorModifier_gamma : public BColorModifier + { + private: + double mfValue; + double mfInvValue; + + /// bitfield + bool mbUseIt : 1; + + protected: + public: + BColorModifier_gamma(double fValue); + + virtual ~BColorModifier_gamma(); + + // data access double getValue() const { return mfValue; } - BColorModifyMode getMode() const { return meMode; } + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; + + // compute modified color + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /** Red, Green, Blue, Luminance and Contrast correction + + Input are percent values from [-1.0 .. 1-0] which correspond to -100% to 100% + correction of Red, Green, Blue, Luminance or Contrast. 0.0 means no change of + the corresponding channel. All these are combined (but can be used single) to + - be able to cover a bigger change range utilizing the cmobination + - allow execution by a small, common, precalculated table + */ + class BColorModifier_RGBLuminanceContrast : public BColorModifier + { + private: + double mfRed; + double mfGreen; + double mfBlue; + double mfLuminance; + double mfContrast; + + double mfContrastOff; + double mfRedOff; + double mfGreenOff; + double mfBlueOff; + + /// bitfield + bool mbUseIt : 1; + + protected: + public: + BColorModifier_RGBLuminanceContrast(double fRed, double fGreen, double fBlue, double fLuminance, double fContrast); + + virtual ~BColorModifier_RGBLuminanceContrast(); + + // data access + double getRed() const { return mfRed; } + double getGreen() const { return mfGreen; } + double getBlue() const { return mfBlue; } + double getLuminance() const { return mfLuminance; } + double getContrast() const { return mfContrast; } + + // compare operator + virtual bool operator==(const BColorModifier& rCompare) const; // compute modified color - ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; + virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; }; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + /// typedef to allow working with shared instances of BColorModifier + /// for the whole mechanism + typedef ::boost::shared_ptr< BColorModifier > BColorModifierSharedPtr; - /** Class to hold a stack of BColorModifiers and to get the modified color with - applying all existing entry changes + /** Class to hold a stack of BColorModifierSharedPtrs and to get the modified color with + applying all existing entry changes as defined in the stack. Instances of BColorModifier + can be pushed and popped to change the stack. + + All references to BColorModifier members use shared pointers, thus instances of + BColorModifierStack can be copied by the default mechanisms if needed. */ class BColorModifierStack { protected: - ::std::vector< BColorModifier > maBColorModifiers; + ::std::vector< BColorModifierSharedPtr > maBColorModifiers; public: sal_uInt32 count() const @@ -97,33 +396,17 @@ namespace basegfx return maBColorModifiers.size(); } - const BColorModifier& getBColorModifier(sal_uInt32 nIndex) const + const BColorModifierSharedPtr& getBColorModifier(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < count(), "BColorModifierStack: Access out of range (!)"); return maBColorModifiers[nIndex]; } - ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& rSource) const - { - if(count()) - { - ::basegfx::BColor aRetval(rSource); - ::std::vector< BColorModifier >::const_iterator aEnd(maBColorModifiers.end()); - - while(aEnd != maBColorModifiers.begin()) - { - aRetval = (--aEnd)->getModifiedColor(aRetval); - } - - return aRetval; - } - else - { - return rSource; - } - } + // get the color in it's modified form by applying all existing BColorModifiers, + // from back to front (the newest first) + ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& rSource) const; - void push(const BColorModifier& rNew) + void push(const BColorModifierSharedPtr& rNew) { maBColorModifiers.push_back(rNew); } @@ -135,6 +418,8 @@ namespace basegfx }; } // end of namespace basegfx +////////////////////////////////////////////////////////////////////////////// + #endif // _BGFX_COLOR_BCOLORMODIFIER_HXX ////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index c1470fc8c281..c853f26bbf7b 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -529,6 +529,19 @@ namespace basegfx */ B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate); + /** returns true if the Polygon only contains horizontal or vertical edges + so that it could be represented by RegionBands + */ + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate); + + /// get the tangent with which the given point is entered seen from the previous + /// polygon path data. Take into account all stuff like closed state, zero-length edges and others. + B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex); + + /// get the tangent with which the given point is left seen from the following + /// polygon path data. Take into account all stuff like closed state, zero-length edges and others. + B2DVector getTangentLeavingPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex); + /// converters for com::sun::star::drawing::PointSequence B2DPolygon UnoPointSequenceToB2DPolygon( const com::sun::star::drawing::PointSequence& rPointSequenceSource, diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx index ccfb155ecd09..2149e80b4eec 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/drawing/PointSequenceSequence.hpp> #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <vector> +#include <set> namespace rtl { @@ -120,6 +121,32 @@ namespace basegfx // with distance fDistance and rounded edges (start and end point). bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance); + /** Helper class to transport PointIndices to a PolyPolygon, + with an operator< for convenient sorting in a std::set usage + */ + class PointIndex + { + private: + sal_uInt32 mnPolygonIndex; + sal_uInt32 mnPointIndex; + + public: + PointIndex(sal_uInt32 nPolygonIndex, sal_uInt32 nPointIndex) + : mnPolygonIndex(nPolygonIndex), + mnPointIndex(nPointIndex) + {} + + sal_uInt32 getPolygonIndex() const { return mnPolygonIndex; } + sal_uInt32 getPointIndex() const { return mnPointIndex; } + bool operator<(const PointIndex& rComp) const; + }; + + /** the PointIndexSet itself; it allows to define a 'selection'of + points in a PolyPolygon by giving the polygon and point index. + Adding points double makes no sense, hence the std::set + */ + typedef std::set< PointIndex > PointIndexSet; + /** Read poly-polygon from SVG. This function imports a poly-polygon from an SVG-D @@ -132,37 +159,31 @@ namespace basegfx @param rSvgDAttribute A valid SVG-D attribute string - @return true, if the string was successfully parsed - */ - bool importFromSvgD( B2DPolyPolygon& o_rPolyPoly, - const ::rtl::OUString& rSvgDAttribute ); - - /** Export poly-polygon to SVG. - - This function exports a poly-polygon into an SVG-D - statement. Currently, output of relative point sequences - is not yet supported (might cause slightly larger output) - - @param rPolyPoly - The poly-polygon to export - - @param bUseRelativeCoordinates - When true, all coordinate values are exported as relative - to the current position. This tends to save some space, - since fewer digits needs to be written. - - @param bDetectQuadraticBeziers - When true, the export tries to detect cubic bezier - segments in the input polygon, which can be represented by - quadratic bezier segments. Note that the generated string - causes versions prior to OOo2.0 to crash. + @param bHandleRelativeNextPointCompatible + If set to true, the old error that after a relative 'z' command + the current point was not reset to the first point of the current + polygon is kept; this is needed to read odf files. + If false, pure svg is used; this is needed for svg import. + + @param pHelpPointIndexSet + If given, all points created in the target PolyPolygon + which are only helper points are added here using their + point indices; this are currently points created from + import of the 'a' and 'A' svg:d statements which create + bezier curve info as representation and maybe points + which are no 'real' svg:d points, but helper points. It + is necessary to identify these e.g. when markers need to + be created in the svg import @return the generated SVG-D statement (the XML d attribute value alone, without any "<path ...>" or "d="...") */ - ::rtl::OUString exportToSvgD( const B2DPolyPolygon& rPolyPoly, - bool bUseRelativeCoordinates=true, - bool bDetectQuadraticBeziers=true ); + + bool importFromSvgD( + B2DPolyPolygon& o_rPolyPoly, + const ::rtl::OUString& rSvgDAttribute, + bool bHandleRelativeNextPointCompatible, + PointIndexSet* pHelpPointIndexSet); // grow for polyPolygon. Move all geometry in each point in the direction of the normal in that point // with the given amount. Value may be negative. @@ -221,6 +242,41 @@ namespace basegfx */ bool isRectangle( const B2DPolyPolygon& rPoly ); + /** Export poly-polygon to SVG. + + This function exports a poly-polygon into an SVG-D + statement. Currently, output of relative point sequences + is not yet supported (might cause slightly larger output) + + @param rPolyPoly + The poly-polygon to export + + @param bUseRelativeCoordinates + When true, all coordinate values are exported as relative + to the current position. This tends to save some space, + since fewer digits needs to be written. + + @param bDetectQuadraticBeziers + When true, the export tries to detect cubic bezier + segments in the input polygon, which can be represented by + quadratic bezier segments. Note that the generated string + causes versions prior to OOo2.0 to crash. + + @param bHandleRelativeNextPointCompatible + If set to true, the old error that after a relative 'z' command + the current point was not reset to the first point of the current + polygon is kept; this is needed to read odf files. + If false, pure svg is used; this is needed for svg import. + + @return the generated SVG-D statement (the XML d attribute + value alone, without any "<path ...>" or "d="...") + */ + ::rtl::OUString exportToSvgD( + const B2DPolyPolygon& rPolyPoly, + bool bUseRelativeCoordinates, + bool bDetectQuadraticBeziers, + bool bHandleRelativeNextPointCompatible); + // #i76891# Try to remove existing curve segments if they are simply edges B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate); @@ -257,6 +313,11 @@ namespace basegfx */ B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate); + /** returns true if the Polygon only contains horizontal or vertical edges + so that it could be represented by RegionBands + */ + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate); + /// converters for com::sun::star::drawing::PointSequence B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( const com::sun::star::drawing::PointSequenceSequence& rPointSequenceSequenceSource, diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index 152518e8f165..ee3240fad6e0 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx @@ -220,12 +220,12 @@ namespace basegfx bool operator==( const B2DTuple& rTup ) const { - return equal(rTup); + return mfX == rTup.mfX && mfY == rTup.mfY; } bool operator!=( const B2DTuple& rTup ) const { - return !equal(rTup); + return mfX != rTup.mfX || mfY != rTup.mfY; } B2DTuple& operator=( const B2DTuple& rTup ) diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx index bceae5b056b8..0e9f74753958 100644 --- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx @@ -252,12 +252,12 @@ namespace basegfx bool operator==( const B3DTuple& rTup ) const { - return equal(rTup); + return mfX == rTup.mfX && mfY == rTup.mfY && mfZ == rTup.mfZ; } bool operator!=( const B3DTuple& rTup ) const { - return !equal(rTup); + return mfX != rTup.mfX || mfY != rTup.mfY || mfZ != rTup.mfZ; } B3DTuple& operator=( const B3DTuple& rTup ) diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx index 517fe417cae6..67ad15452579 100644 --- a/basegfx/source/color/bcolormodifier.cxx +++ b/basegfx/source/color/bcolormodifier.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basegfx.hxx" @@ -30,46 +28,314 @@ namespace basegfx { - ::basegfx::BColor BColorModifier::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + BColorModifier::~BColorModifier() + { + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_gray::~BColorModifier_gray() + { + } + + bool BColorModifier_gray::operator==(const BColorModifier& rCompare) const + { + return 0 != dynamic_cast< const BColorModifier_gray* >(&rCompare); + } + + ::basegfx::BColor BColorModifier_gray::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + const double fLuminance(aSourceColor.luminance()); + + return ::basegfx::BColor(fLuminance, fLuminance, fLuminance); + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_invert::~BColorModifier_invert() + { + } + + bool BColorModifier_invert::operator==(const BColorModifier& rCompare) const + { + return 0 != dynamic_cast< const BColorModifier_invert* >(&rCompare); + } + + ::basegfx::BColor BColorModifier_invert::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + return ::basegfx::BColor(1.0 - aSourceColor.getRed(), 1.0 - aSourceColor.getGreen(), 1.0 - aSourceColor.getBlue()); + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_luminance_to_alpha::~BColorModifier_luminance_to_alpha() + { + } + + bool BColorModifier_luminance_to_alpha::operator==(const BColorModifier& rCompare) const + { + return 0 != dynamic_cast< const BColorModifier_luminance_to_alpha* >(&rCompare); + } + + ::basegfx::BColor BColorModifier_luminance_to_alpha::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + const double fAlpha(1.0 - ((aSourceColor.getRed() * 0.2125) + (aSourceColor.getGreen() * 0.7154) + (aSourceColor.getBlue() * 0.0721))); + + return ::basegfx::BColor(fAlpha, fAlpha, fAlpha); + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_replace::~BColorModifier_replace() + { + } + + bool BColorModifier_replace::operator==(const BColorModifier& rCompare) const { - switch(meMode) + const BColorModifier_replace* pCompare = dynamic_cast< const BColorModifier_replace* >(&rCompare); + + if(!pCompare) { - case BCOLORMODIFYMODE_INTERPOLATE : - { - return interpolate(maBColor, aSourceColor, mfValue); - } - case BCOLORMODIFYMODE_GRAY : - { - const double fLuminance(aSourceColor.luminance()); - return ::basegfx::BColor(fLuminance, fLuminance, fLuminance); - } - case BCOLORMODIFYMODE_BLACKANDWHITE : - { - const double fLuminance(aSourceColor.luminance()); - - if(fLuminance < mfValue) - { - return ::basegfx::BColor::getEmptyBColor(); - } - else - { - return ::basegfx::BColor(1.0, 1.0, 1.0); - } - } - case BCOLORMODIFYMODE_INVERT : - { - return ::basegfx::BColor(1.0 - aSourceColor.getRed(), 1.0 - aSourceColor.getGreen(), 1.0 - aSourceColor.getBlue()); - } - case BCOLORMODIFYMODE_LUMINANCE_TO_ALPHA: + return false; + } + + return getBColor() == pCompare->getBColor(); + } + + ::basegfx::BColor BColorModifier_replace::getModifiedColor(const ::basegfx::BColor& /*aSourceColor*/) const + { + return maBColor; + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_interpolate::~BColorModifier_interpolate() + { + } + + bool BColorModifier_interpolate::operator==(const BColorModifier& rCompare) const + { + const BColorModifier_interpolate* pCompare = dynamic_cast< const BColorModifier_interpolate* >(&rCompare); + + if(!pCompare) + { + return false; + } + + return getBColor() == pCompare->getBColor() && getValue() == pCompare->getValue(); + } + + ::basegfx::BColor BColorModifier_interpolate::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + return interpolate(maBColor, aSourceColor, mfValue); + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_black_and_white::~BColorModifier_black_and_white() + { + } + + bool BColorModifier_black_and_white::operator==(const BColorModifier& rCompare) const + { + const BColorModifier_black_and_white* pCompare = dynamic_cast< const BColorModifier_black_and_white* >(&rCompare); + + if(!pCompare) + { + return false; + } + + return getValue() == pCompare->getValue(); + } + + ::basegfx::BColor BColorModifier_black_and_white::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + const double fLuminance(aSourceColor.luminance()); + + if(fLuminance < mfValue) + { + return ::basegfx::BColor::getEmptyBColor(); + } + else + { + return ::basegfx::BColor(1.0, 1.0, 1.0); + } + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_gamma::BColorModifier_gamma(double fValue) + : BColorModifier(), + mfValue(fValue), + mfInvValue(fValue), + mbUseIt(!basegfx::fTools::equal(fValue, 1.0) && basegfx::fTools::more(fValue, 0.0) && basegfx::fTools::lessOrEqual(fValue, 10.0)) + { + if(mbUseIt) + { + mfInvValue = 1.0 / mfValue; + } + } + + BColorModifier_gamma::~BColorModifier_gamma() + { + } + + bool BColorModifier_gamma::operator==(const BColorModifier& rCompare) const + { + const BColorModifier_gamma* pCompare = dynamic_cast< const BColorModifier_gamma* >(&rCompare); + + if(!pCompare) + { + return false; + } + + // getValue is sufficient, mfInvValue and mbUseIt are only helper values + return getValue() == pCompare->getValue(); + } + + ::basegfx::BColor BColorModifier_gamma::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + if(mbUseIt) + { + ::basegfx::BColor aRetval( + pow(aSourceColor.getRed(), mfInvValue), + pow(aSourceColor.getGreen(), mfInvValue), + pow(aSourceColor.getBlue(), mfInvValue)); + + aRetval.clamp(); + return aRetval; + } + else + { + return aSourceColor; + } + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + BColorModifier_RGBLuminanceContrast::BColorModifier_RGBLuminanceContrast(double fRed, double fGreen, double fBlue, double fLuminance, double fContrast) + : BColorModifier(), + mfRed(basegfx::clamp(fRed, -1.0, 1.0)), + mfGreen(basegfx::clamp(fGreen, -1.0, 1.0)), + mfBlue(basegfx::clamp(fBlue, -1.0, 1.0)), + mfLuminance(basegfx::clamp(fLuminance, -1.0, 1.0)), + mfContrast(basegfx::clamp(fContrast, -1.0, 1.0)), + mfContrastOff(1.0), + mfRedOff(0.0), + mfGreenOff(0.0), + mfBlueOff(0.0), + mbUseIt(false) + { + if(!basegfx::fTools::equalZero(mfRed) + || !basegfx::fTools::equalZero(mfGreen) + || !basegfx::fTools::equalZero(mfBlue) + || !basegfx::fTools::equalZero(mfLuminance) + || !basegfx::fTools::equalZero(mfContrast)) + { + // calculate slope + if(mfContrast >= 0.0) { - const double fAlpha(1.0 - ((aSourceColor.getRed() * 0.2125) + (aSourceColor.getGreen() * 0.7154) + (aSourceColor.getBlue() * 0.0721))); - return ::basegfx::BColor(fAlpha, fAlpha, fAlpha); + mfContrastOff = 128.0 / (128.0 - (mfContrast * 127.0)); } - default : // BCOLORMODIFYMODE_REPLACE + else { - return maBColor; + mfContrastOff = ( 128.0 + (mfContrast * 127.0)) / 128.0; } + + // calculate unified contrast offset + const double fPreparedContrastOff((128.0 - mfContrastOff * 128.0) / 255.0); + const double fCombinedOffset(mfLuminance + fPreparedContrastOff); + + // set full offsets + mfRedOff = mfRed + fCombinedOffset; + mfGreenOff = mfGreen + fCombinedOffset; + mfBlueOff = mfBlue + fCombinedOffset; + + mbUseIt = true; + } + } + + BColorModifier_RGBLuminanceContrast::~BColorModifier_RGBLuminanceContrast() + { + } + + bool BColorModifier_RGBLuminanceContrast::operator==(const BColorModifier& rCompare) const + { + const BColorModifier_RGBLuminanceContrast* pCompare = dynamic_cast< const BColorModifier_RGBLuminanceContrast* >(&rCompare); + + if(!pCompare) + { + return false; } + + // no need to compare other values, these are just helpers + return getRed() == pCompare->getRed() + && getGreen() == pCompare->getGreen() + && getBlue() == pCompare->getBlue() + && getLuminance() == pCompare->getLuminance() + && getContrast() == pCompare->getContrast(); + } + + ::basegfx::BColor BColorModifier_RGBLuminanceContrast::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + if(mbUseIt) + { + return basegfx::BColor( + basegfx::clamp(aSourceColor.getRed() * mfContrastOff + mfRedOff, 0.0, 1.0), + basegfx::clamp(aSourceColor.getGreen() * mfContrastOff + mfGreenOff, 0.0, 1.0), + basegfx::clamp(aSourceColor.getBlue() * mfContrastOff + mfBlueOff, 0.0, 1.0)); + } + else + { + return aSourceColor; + } + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + ::basegfx::BColor BColorModifierStack::getModifiedColor(const ::basegfx::BColor& rSource) const + { + if(maBColorModifiers.empty()) + { + return rSource; + } + + ::basegfx::BColor aRetval(rSource); + + for(sal_uInt32 a(maBColorModifiers.size()); a;) + { + a--; + aRetval = maBColorModifiers[a]->getModifiedColor(aRetval); + } + + return aRetval; } } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 1fef1a89ef8e..3e082e4ee51c 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -1264,7 +1264,7 @@ namespace basegfx { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - if(getB2DPoint(nIndex) != rValue) + if(mpPolygon->getPoint(nIndex) != rValue) { mpPolygon->setPoint(nIndex, rValue); } diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index de646323fc97..7afcfb358b07 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3626,6 +3626,121 @@ namespace basegfx } } + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate) + { + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount < 2) + { + return true; + } + + const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount + 1 : nPointCount); + basegfx::B2DPoint aLast(rCandidate.getB2DPoint(0)); + + for(sal_uInt32 a(1); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex(a % nPointCount); + const basegfx::B2DPoint aCurrent(rCandidate.getB2DPoint(nNextIndex)); + + if(!basegfx::fTools::equal(aLast.getX(), aCurrent.getX()) && !basegfx::fTools::equal(aLast.getY(), aCurrent.getY())) + { + return false; + } + + aLast = aCurrent; + } + + return true; + } + + B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex) + { + B2DVector aRetval(0.0, 0.0); + const sal_uInt32 nCount(rCandidate.count()); + + if(nIndex >= nCount) + { + // out of range + return aRetval; + } + + // start immediately at prev point compared to nIndex + const bool bClosed(rCandidate.isClosed()); + sal_uInt32 nPrev(bClosed ? (nIndex + nCount - 1) % nCount : nIndex ? nIndex - 1 : nIndex); + + if(nPrev == nIndex) + { + // no previous, done + return aRetval; + } + + B2DCubicBezier aSegment; + + // go backward in the polygon; if closed, maximal back to start index (nIndex); if not closed, + // until zero. Use nIndex as stop criteria + while(nPrev != nIndex) + { + // get BezierSegment and tangent at the *end* of segment + rCandidate.getBezierSegment(nPrev, aSegment); + aRetval = aSegment.getTangent(1.0); + + if(!aRetval.equalZero()) + { + // if we have a tangent, return it + return aRetval; + } + + // prepare index before checked one + nPrev = bClosed ? (nPrev + nCount - 1) % nCount : nPrev ? nPrev - 1 : nIndex; + } + + return aRetval; + } + + B2DVector getTangentLeavingPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex) + { + B2DVector aRetval(0.0, 0.0); + const sal_uInt32 nCount(rCandidate.count()); + + if(nIndex >= nCount) + { + // out of range + return aRetval; + } + + // start at nIndex + const bool bClosed(rCandidate.isClosed()); + sal_uInt32 nCurrent(nIndex); + B2DCubicBezier aSegment; + + // go forward; if closed, do this until once around and back at start index (nIndex); if not + // closed, until last point (nCount - 1). Use nIndex as stop criteria + do + { + // get BezierSegment and tangent at the *beginning* of segment + rCandidate.getBezierSegment(nCurrent, aSegment); + aRetval = aSegment.getTangent(0.0); + + if(!aRetval.equalZero()) + { + // if we have a tangent, return it + return aRetval; + } + + // prepare next index + nCurrent = bClosed ? (nCurrent + 1) % nCount : nCurrent + 1 < nCount ? nCurrent + 1 : nIndex; + } + while(nCurrent != nIndex); + + return aRetval; + } + ////////////////////////////////////////////////////////////////////////////// // converters for com::sun::star::drawing::PointSequence diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index 1e369fa4dd77..e18a47c6c123 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -110,6 +110,8 @@ namespace basegfx typedef ::std::vector< PN > PNV; typedef ::std::vector< VN > VNV; typedef ::std::vector< SN > SNV; + typedef ::std::pair< basegfx::B2DPoint /*orig*/, basegfx::B2DPoint /*repl*/ > CorrectionPair; + typedef ::std::vector< CorrectionPair > CorrectionTable; ////////////////////////////////////////////////////////////////////////////// @@ -120,6 +122,7 @@ namespace basegfx PNV maPNV; VNV maVNV; SNV maSNV; + CorrectionTable maCorrectionTable; bool mbIsCurve : 1; bool mbChanged : 1; @@ -464,13 +467,44 @@ namespace basegfx void impSolve() { - // sort by point to identify common nodes + // sort by point to identify common nodes easier ::std::sort(maSNV.begin(), maSNV.end()); // handle common nodes const sal_uInt32 nNodeCount(maSNV.size()); + sal_uInt32 a(0); - for(sal_uInt32 a(0); a < nNodeCount - 1; a++) + // snap unsharp-equal points + if(nNodeCount) + { + basegfx::B2DPoint* pLast(&maSNV[0].mpPN->maPoint); + + for(a = 1; a < nNodeCount; a++) + { + basegfx::B2DPoint* pCurrent(&maSNV[a].mpPN->maPoint); + + if(pLast->equal(*pCurrent) && (pLast->getX() != pCurrent->getX() || pLast->getY() != pCurrent->getY())) + { + const basegfx::B2DPoint aMiddle((*pLast + *pCurrent) * 0.5); + + if(pLast->getX() != aMiddle.getX() || pLast->getY() != aMiddle.getY()) + { + maCorrectionTable.push_back(CorrectionPair(*pLast, aMiddle)); + *pLast = aMiddle; + } + + if(pCurrent->getX() != aMiddle.getX() || pCurrent->getY() != aMiddle.getY()) + { + maCorrectionTable.push_back(CorrectionPair(*pCurrent, aMiddle)); + *pCurrent = aMiddle; + } + } + + pLast = pCurrent; + } + } + + for(a = 0; a < nNodeCount - 1; a++) { // test a before using it, not after. Also use nPointCount instead of aSortNodes.size() PN& rPNb = *(maSNV[a].mpPN); @@ -640,8 +674,45 @@ namespace basegfx } else { + const sal_uInt32 nCorrectionSize(maCorrectionTable.size()); + // no change, return original - return maOriginal; + if(!nCorrectionSize) + { + return maOriginal; + } + + // apply coordinate corrections to ensure inside/outside correctness after solving + const sal_uInt32 nPolygonCount(maOriginal.count()); + basegfx::B2DPolyPolygon aRetval(maOriginal); + + for(sal_uInt32 a(0); a < nPolygonCount; a++) + { + basegfx::B2DPolygon aTemp(aRetval.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aTemp.count()); + bool bChanged(false); + + for(sal_uInt32 b(0); b < nPointCount; b++) + { + const basegfx::B2DPoint aCandidate(aTemp.getB2DPoint(b)); + + for(sal_uInt32 c(0); c < nCorrectionSize; c++) + { + if(maCorrectionTable[c].first.getX() == aCandidate.getX() && maCorrectionTable[c].first.getY() == aCandidate.getY()) + { + aTemp.setB2DPoint(b, maCorrectionTable[c].second); + bChanged = true; + } + } + } + + if(bChanged) + { + aRetval.setB2DPolygon(a, aTemp); + } + } + + return aRetval; } } }; diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index c2d6d65f9c64..c62c183dad6d 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -592,6 +592,24 @@ namespace basegfx return aRetval; } + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate) + { + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + for(sal_uInt32 a(0); a < rCandidate.count(); a++) + { + if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a))) + { + return false; + } + } + + return true; + } + ////////////////////////////////////////////////////////////////////////////// // converters for com::sun::star::drawing::PointSequence diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index b67ff5b068aa..05cb42004dba 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -38,12 +38,25 @@ namespace basegfx { namespace tools { - bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString& rSvgDStatement) + bool PointIndex::operator<(const PointIndex& rComp) const + { + if(rComp.getPolygonIndex() == getPolygonIndex()) + { + return rComp.getPointIndex() < getPointIndex(); + } + + return rComp.getPolygonIndex() < getPolygonIndex(); + } + + bool importFromSvgD( + B2DPolyPolygon& o_rPolyPolygon, + const ::rtl::OUString& rSvgDStatement, + bool bHandleRelativeNextPointCompatible, + PointIndexSet* pHelpPointIndexSet) { o_rPolyPolygon.clear(); const sal_Int32 nLen(rSvgDStatement.getLength()); sal_Int32 nPos(0); - bool bIsClosed(false); double nLastX( 0.0 ); double nLastY( 0.0 ); B2DPolygon aCurrPoly; @@ -54,27 +67,56 @@ namespace basegfx while(nPos < nLen) { bool bRelative(false); - bool bMoveTo(false); const sal_Unicode aCurrChar(rSvgDStatement[nPos]); + if(o_rPolyPolygon.count() && !aCurrPoly.count() && !('m' == aCurrChar || 'M' == aCurrChar)) + { + // we have a new sub-polygon starting, but without a 'moveto' command. + // this requires to add the current point as start point to the polygon + // (see SVG1.1 8.3.3 The "closepath" command) + aCurrPoly.append(B2DPoint(nLastX, nLastY)); + } + switch(aCurrChar) { case 'z' : case 'Z' : { + // consume CurrChar and whitespace nPos++; ::basegfx::internal::lcl_skipSpaces(nPos, rSvgDStatement, nLen); - // remember closed state of current polygon - bIsClosed = true; + // create closed polygon and reset import values + if(aCurrPoly.count()) + { + if(!bHandleRelativeNextPointCompatible) + { + // SVG defines that "the next subpath starts at the + // same initial point as the current subpath", so set the + // current point if we do not need to be compatible + nLastX = aCurrPoly.getB2DPoint(0).getX(); + nLastY = aCurrPoly.getB2DPoint(0).getY(); + } + + aCurrPoly.setClosed(true); + o_rPolyPolygon.append(aCurrPoly); + aCurrPoly.clear(); + } + break; } case 'm' : case 'M' : { - bMoveTo = true; - // FALLTHROUGH intended + // create non-closed polygon and reset import values + if(aCurrPoly.count()) + { + o_rPolyPolygon.append(aCurrPoly); + aCurrPoly.clear(); + } + + // FALLTHROUGH intended to add coordinate data as 1st point of new polygon } case 'l' : case 'L' : @@ -84,28 +126,7 @@ namespace basegfx bRelative = true; } - if(bMoveTo) - { - // new polygon start, finish old one - if(aCurrPoly.count()) - { - // add current polygon - if(bIsClosed) - { - // #123465# no need to do the old closeWithGeometryChange - // corerection on SVG polygons; this even may lead to wrong - // results e.g. for marker processing - aCurrPoly.setClosed(true); - } - - o_rPolyPolygon.append(aCurrPoly); - - // reset import values - bIsClosed = false; - aCurrPoly.clear(); - } - } - + // consume CurrChar and whitespace nPos++; ::basegfx::internal::lcl_skipSpaces(nPos, rSvgDStatement, nLen); @@ -590,7 +611,22 @@ namespace basegfx // if we swapped angles above if( bFlipSegment ) aSegment.flip(); + + // remember PointIndex of evtl. added pure helper points + sal_uInt32 nPointIndex(aCurrPoly.count() + 1); aCurrPoly.append(aSegment); + + // if asked for, mark pure helper points by adding them to the index list of + // helper points + if(pHelpPointIndexSet && aCurrPoly.count() > 1) + { + const sal_uInt32 nPolyIndex(o_rPolyPolygon.count()); + + for(;nPointIndex + 1 < aCurrPoly.count(); nPointIndex++) + { + pHelpPointIndexSet->insert(PointIndex(nPolyIndex, nPointIndex)); + } + } } // set last position @@ -610,17 +646,9 @@ namespace basegfx } } + // if there is polygon data, create non-closed polygon if(aCurrPoly.count()) { - // end-process last poly - if(bIsClosed) - { - // #123465# no need to do the old closeWithGeometryChange - // corerection on SVG polygons; this even may lead to wrong - // results e.g. for marker processing - aCurrPoly.setClosed(true); - } - o_rPolyPolygon.append(aCurrPoly); } @@ -679,7 +707,8 @@ namespace basegfx ::rtl::OUString exportToSvgD( const B2DPolyPolygon& rPolyPolygon, bool bUseRelativeCoordinates, - bool bDetectQuadraticBeziers) + bool bDetectQuadraticBeziers, + bool bHandleRelativeNextPointCompatible) { const sal_uInt32 nCount(rPolyPolygon.count()); ::rtl::OUStringBuffer aResult; @@ -699,10 +728,21 @@ namespace basegfx // handle polygon start point B2DPoint aEdgeStart(aPolygon.getB2DPoint(0)); - aResult.append(::basegfx::internal::lcl_getCommand('M', 'm', bUseRelativeCoordinates)); - ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); - ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); - aLastSVGCommand = ::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinates); + bool bUseRelativeCoordinatesForFirstPoint(bUseRelativeCoordinates); + + if(bHandleRelativeNextPointCompatible) + { + // To get around the error that the start point for the next polygon is the + // start point of the current one (and not the last as it was handled up to now) + // do force to write an absolute 'M' command as start for the next polygon + bUseRelativeCoordinatesForFirstPoint = false; + } + + // Write 'moveto' and the 1st coordinates, set aLastSVGCommand to 'lineto' + aResult.append(::basegfx::internal::lcl_getCommand('M', 'm', bUseRelativeCoordinatesForFirstPoint)); + ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinatesForFirstPoint); + ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinatesForFirstPoint); + aLastSVGCommand = ::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinatesForFirstPoint); aCurrentSVGPosition = aEdgeStart; for(sal_uInt32 nIndex(0); nIndex < nEdgeCount; nIndex++) @@ -900,6 +940,13 @@ namespace basegfx { aResult.append(::basegfx::internal::lcl_getCommand('Z', 'z', bUseRelativeCoordinates)); } + + if(!bHandleRelativeNextPointCompatible) + { + // SVG defines that "the next subpath starts at the same initial point as the current subpath", + // so set aCurrentSVGPosition to the 1st point of the current, now ended and written path + aCurrentSVGPosition = aPolygon.getB2DPoint(0); + } } } diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 45c98780832e..b317d7b4e630 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -150,23 +150,20 @@ public: ::rtl::OUString aExport; CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D", - tools::importFromSvgD( aPoly, - aPath0 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath0, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); const char* sExportString = "m10 10h-20v-20h20z"; CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D", !aExport.compareToAscii(sExportString) ); CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)", !aExport.compareToAscii(sExportString)); CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", - tools::importFromSvgD( aPoly, - aPath1 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath1, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): // @@ -193,11 +190,11 @@ public: // a 2nd good test is that re-importing of aExport has to create the same // B2DPolPolygon again: B2DPolyPolygon aReImport; - CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport)); + CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0)); CPPUNIT_ASSERT_MESSAGE("re-imported polygon needs to be identical", aReImport == aPoly); - CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2 )); - aExport = tools::exportToSvgD( aPoly ); + CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2, , false, 0)); + aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): // @@ -213,22 +210,20 @@ public: "8 752-224 1128-21 101-31 183-31 245 0 39 9 70 26 93 17 24 39 36 67 36 145 0 279-80 400-240s182-365 182-615c0-2" "88-107-533-322-734s-487-301-816-301c-395 0-715 124-960 373s-368 569-368 958q0 577.5 357 900c237 216 557 324 95" "8 325 189-1 389-27 600-77 211-52 378-110 503-174q40.5 105 81 210z"; - CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport)); + CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0)); CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport == aPoly); CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", !aExport.compareToAscii(sExportString1)); CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)", !aExport.compareToAscii(sExportString1)); CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D", - tools::importFromSvgD( aPoly, - aPath3 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath3, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); const char* sExportString2 = "m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293" "zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97" @@ -253,15 +248,14 @@ public: CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D", !aExport.compareToAscii(sExportString2)); CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)", !aExport.compareToAscii(sExportString2)); const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); - aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false); + aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false, false ); const char* sExportStringRect = "M0 0H4000V4000H0Z"; CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string", diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index a90a602c08d3..38fd51d1b75c 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -175,7 +175,7 @@ public: B2DPolyPolygon randomPoly; tools::importFromSvgD( randomPoly, - rtl::OUString::createFromAscii(randomSvg)); + rtl::OUString::createFromAscii(randomSvg), false, 0); std::for_each(randomPoly.begin(), randomPoly.end(), boost::bind( @@ -243,16 +243,14 @@ public: B2DPolyPolygon aTmp1; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp1, - rtl::OUString::createFromAscii(sSvg))); + aTmp1, rtl::OUString::createFromAscii(sSvg), false, 0)); const rtl::OUString aSvg= - tools::exportToSvgD(toTest.solveCrossovers()); + tools::exportToSvgD(toTest.solveCrossovers(), , true, true, false); B2DPolyPolygon aTmp2; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp2, - aSvg)); + aTmp2, aSvg, false, 0)); CPPUNIT_ASSERT_MESSAGE( sName, @@ -303,7 +301,7 @@ public: #if defined(VERBOSE) fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( - basegfx::tools::exportToSvgD(rPoly), + basegfx::tools::exportToSvgD(rPoly, , true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif } @@ -347,15 +345,14 @@ public: fprintf(stderr, "%s input - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( - genericClip), + genericClip, , true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif const B2DPolyPolygon boxClipResult=rRange.solveCrossovers(); const rtl::OUString boxClipSvg( basegfx::tools::exportToSvgD( - normalizePoly( - boxClipResult))); + normalizePoly(boxClipResult)), true, true, false); #if defined(VERBOSE) fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( @@ -366,8 +363,7 @@ public: genericClip = tools::solveCrossovers(genericClip); const rtl::OUString genericClipSvg( basegfx::tools::exportToSvgD( - normalizePoly( - genericClip))); + normalizePoly(genericClip)), true, true, false); #if defined(VERBOSE) fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index 60c6da40f10b..7a3529d8c939 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.cxx @@ -107,23 +107,21 @@ public: #if defined(VERBOSE) fprintf(stderr, "%s - svg:d=\"%s\"\n", sName, rtl::OUStringToOString( - basegfx::tools::exportToSvgD(toTest.getClipPoly()), + basegfx::tools::exportToSvgD(toTest.getClipPoly(), true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif B2DPolyPolygon aTmp1; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp1, - rtl::OUString::createFromAscii(sSvg))); + aTmp1, rtl::OUString::createFromAscii(sSvg), false, 0)); const rtl::OUString aSvg= - tools::exportToSvgD(toTest.getClipPoly()); + tools::exportToSvgD(toTest.getClipPoly(), true, true, false); B2DPolyPolygon aTmp2; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp2, - aSvg)); + aTmp2, aSvg, false, 0)); CPPUNIT_ASSERT_MESSAGE( sName, @@ -153,8 +151,7 @@ public: B2DPolyPolygon aTmp1; tools::importFromSvgD( - aTmp1, - rtl::OUString::createFromAscii(unionSvg)); + aTmp1, rtl::OUString::createFromAscii(unionSvg), false, 0); aMixedClip.intersectPolyPolygon(aTmp1); aMixedClip.subtractRange(B2DRange(-20,-150,20,0)); diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx index 39e2cd47d836..49abbbd1aa74 100644 --- a/basegfx/test/genericclipper.cxx +++ b/basegfx/test/genericclipper.cxx @@ -91,12 +91,12 @@ public: fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( - aSelfIntersect), + aSelfIntersect, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( - aRect), + aRect, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif @@ -106,14 +106,14 @@ public: #if defined(VERBOSE) fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( - basegfx::tools::exportToSvgD(aRes), + basegfx::tools::exportToSvgD(aRes, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif rtl::OUString aValid=rtl::OUString::createFromAscii(pValidSvgD); CPPUNIT_ASSERT_MESSAGE(pName, - basegfx::tools::exportToSvgD(aRes) == aValid); + basegfx::tools::exportToSvgD(aRes, true, true, false) == aValid); } void validateOr() diff --git a/boost/boost_1_48_0.patch b/boost/boost_1_48_0.patch index 3d8ce838bf62..e92009fc3b7b 100644 --- a/boost/boost_1_48_0.patch +++ b/boost/boost_1_48_0.patch @@ -198,3 +198,126 @@ diff -ru misc/boost_1_48_0/boost/unordered/detail/emplace_args.hpp misc/build/bo + BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n)) #endif +--- misc/boost_1_48_0/boost/unordered/detail/buckets.hpp 2011-10-09 20:30:10.000000000 +0200 ++++ misc/build/boost_1_48_0/boost/unordered/detail/buckets.hpp 2012-06-21 10:22:36.000000000 +0000 +@@ -477,22 +477,22 @@ + + // This is called after erasing a node or group of nodes to fix up + // the bucket pointers. +- void fix_buckets(bucket_pointer bucket, ++ void fix_buckets(bucket_pointer bucket_arg, + previous_pointer prev, node_pointer next) + { + if (!next) + { +- if (bucket->next_ == prev) bucket->next_ = node_pointer(); ++ if (bucket_arg->next_ == prev) bucket_arg->next_ = node_pointer(); + } + else + { + bucket_pointer next_bucket = this->get_bucket( + next->hash_ % this->bucket_count_); + +- if (next_bucket != bucket) ++ if (next_bucket != bucket_arg) + { + next_bucket->next_ = prev; +- if (bucket->next_ == prev) bucket->next_ = node_pointer(); ++ if (bucket_arg->next_ == prev) bucket_arg->next_ = node_pointer(); + } + } + } +--- misc/boost_1_48_0/boost/unordered/detail/equivalent.hpp 2011-11-04 03:31:36.000000000 +0100 ++++ misc/build/boost_1_48_0/boost/unordered/detail/equivalent.hpp 2012-06-21 10:23:12.000000000 +0000 +@@ -246,14 +246,14 @@ + node_pointer n = this->find_node(k); + if (!n) return 0; + +- std::size_t count = 0; ++ std::size_t lcl_count = 0; + node_pointer it = n; + do { + it = static_cast<node_pointer>(it->group_prev_); +- ++count; ++ ++lcl_count; + } while(it != n); + +- return count; ++ return lcl_count; + } + + std::pair<iterator, iterator> +@@ -523,9 +523,9 @@ + + std::size_t hash = this->hash_function()(k); + std::size_t bucket_index = hash % this->bucket_count_; +- bucket_pointer bucket = this->get_bucket(bucket_index); ++ bucket_pointer lcl_bucket = this->get_bucket(bucket_index); + +- previous_pointer prev = bucket->next_; ++ previous_pointer prev = lcl_bucket->next_; + if (!prev) return 0; + + for (;;) +@@ -548,7 +548,7 @@ + static_cast<node_pointer>(pos->group_prev_)->next_; + node_pointer end = static_cast<node_pointer>(end1); + prev->next_ = end1; +- this->fix_buckets(bucket, prev, end); ++ this->fix_buckets(lcl_bucket, prev, end); + return this->delete_nodes(pos, end); + } + +@@ -557,11 +557,11 @@ + BOOST_ASSERT(r); + node_pointer next = static_cast<node_pointer>(r->next_); + +- bucket_pointer bucket = this->get_bucket( ++ bucket_pointer lcl_bucket = this->get_bucket( + r->hash_ % this->bucket_count_); +- previous_pointer prev = unlink_node(*bucket, r); ++ previous_pointer prev = unlink_node(*lcl_bucket, r); + +- this->fix_buckets(bucket, prev, next); ++ this->fix_buckets(lcl_bucket, prev, next); + + this->delete_node(r); + +--- misc/boost_1_48_0/boost/unordered/detail/unique.hpp 2011-11-04 03:31:36.000000000 +0100 ++++ misc/build/boost_1_48_0/boost/unordered/detail/unique.hpp 2012-06-21 10:23:00.000000000 +0000 +@@ -523,9 +523,9 @@ + + std::size_t hash = this->hash_function()(k); + std::size_t bucket_index = hash % this->bucket_count_; +- bucket_pointer bucket = this->get_bucket(bucket_index); ++ bucket_pointer lcl_bucket = this->get_bucket(bucket_index); + +- previous_pointer prev = bucket->next_; ++ previous_pointer prev = lcl_bucket->next_; + if (!prev) return 0; + + for (;;) +@@ -545,7 +545,7 @@ + node_pointer pos = static_cast<node_pointer>(prev->next_); + node_pointer end = static_cast<node_pointer>(pos->next_); + prev->next_ = pos->next_; +- this->fix_buckets(bucket, prev, end); ++ this->fix_buckets(lcl_bucket, prev, end); + return this->delete_nodes(pos, end); + } + +@@ -554,11 +554,11 @@ + BOOST_ASSERT(r); + node_pointer next = static_cast<node_pointer>(r->next_); + +- bucket_pointer bucket = this->get_bucket( ++ bucket_pointer lcl_bucket = this->get_bucket( + r->hash_ % this->bucket_count_); +- previous_pointer prev = unlink_node(*bucket, r); ++ previous_pointer prev = unlink_node(*lcl_bucket, r); + +- this->fix_buckets(bucket, prev, next); ++ this->fix_buckets(lcl_bucket, prev, next); + + this->delete_node(r); + diff --git a/canvas/source/tools/surfaceproxy.cxx b/canvas/source/tools/surfaceproxy.cxx index 248bd2cbcf02..1f0fc27f5687 100644 --- a/canvas/source/tools/surfaceproxy.cxx +++ b/canvas/source/tools/surfaceproxy.cxx @@ -156,11 +156,11 @@ namespace canvas OSL_TRACE( "Original clip polygon: %s\n" "Triangulated polygon: %s\n", rtl::OUStringToOString( - basegfx::tools::exportToSvgD( rClipPoly ), + basegfx::tools::exportToSvgD( rClipPoly, true, true, false ), RTL_TEXTENCODING_ASCII_US).getStr(), rtl::OUStringToOString( basegfx::tools::exportToSvgD( - basegfx::B2DPolyPolygon(rTriangulatedPolygon) ), + basegfx::B2DPolyPolygon(rTriangulatedPolygon), true, true, false ), RTL_TEXTENCODING_ASCII_US).getStr() ); #endif diff --git a/cli_ure/source/native/native_bootstrap.cxx b/cli_ure/source/native/native_bootstrap.cxx index 3255d918aabd..8dfa92aa60f5 100644 --- a/cli_ure/source/native/native_bootstrap.cxx +++ b/cli_ure/source/native/native_bootstrap.cxx @@ -56,9 +56,6 @@ namespace cli_ure { // in main\scp2\source\ooo\registryitem_ooo.scp #define INSTALL_PATH L"Software\\OpenOffice\\UNO\\InstallPath" #define INSTALL_PATH_64 L"Software\\Wow6432Node\\OpenOffice\\UNO\\InstallPath" -#define BASIS_LINK L"\\basis-link" -#define URE_LINK L"\\ure-link" -#define URE_BIN L"\\bin" #define UNO_PATH L"UNO_PATH" namespace @@ -110,23 +107,6 @@ WCHAR* getPathFromRegistryKey( HKEY hroot, LPCWSTR subKeyName ) return data; } -/* If the path does not end with '\' the las segment will be removed. - path: C:\a\b - -> C:\a - @param io_path - in/out parameter. The string is not reallocated. Simply a '\0' - will be inserted to shorten the string. -*/ -void oneDirUp(LPTSTR io_path) -{ - WCHAR * pEnd = io_path + lstrlen(io_path) - 1; - while (pEnd > io_path //prevent crashing if provided string does not contain a backslash - && *pEnd != L'\\') - pEnd --; - *pEnd = L'\0'; -} - - /* Returns the path to the program folder of the brand layer, for example c:/openoffice.org 3/program This path is either obtained from the environment variable UNO_PATH @@ -142,8 +122,8 @@ WCHAR * getInstallPath() DWORD cChars = GetEnvironmentVariable(UNO_PATH, NULL, 0); if (cChars > 0) { - szInstallPath = new WCHAR[cChars]; - cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars); + szInstallPath = new WCHAR[cChars+1]; + cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars+1); //If PATH is not set then it is no error if (cChars == 0) { @@ -158,14 +138,14 @@ WCHAR * getInstallPath() if ( szInstallPath == NULL ) { /* read the key's default value from HKEY_LOCAL_USER */ - szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 ); + szInstallPath = getPathFromRegistryKey( HKEY_CURRENT_USER, INSTALL_PATH_64 ); } - else if ( szInstallPath == NULL ) + if ( szInstallPath == NULL ) { /* read the key's default value from HKEY_LOCAL_MACHINE */ szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH ); } - else if ( szInstallPath == NULL ) + if ( szInstallPath == NULL ) { /* read the key's default value from HKEY_LOCAL_MACHINE */ szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 ); @@ -174,67 +154,6 @@ WCHAR * getInstallPath() return szInstallPath; } -/* Returns the path to the URE/bin path, where cppuhelper lib resides. - The returned string must be freed with delete[] -*/ -WCHAR* getUnoPath() -{ - WCHAR * szLinkPath = NULL; - WCHAR * szUrePath = NULL; - WCHAR * szUreBin = NULL; //the return value - - WCHAR * szInstallPath = getInstallPath(); - if (szInstallPath) - { - //build the path tho the basis-link file - oneDirUp(szInstallPath); - int sizeLinkPath = lstrlen(szInstallPath) + lstrlen(INSTALL_PATH) + 1; - if (sizeLinkPath < MAX_PATH) - sizeLinkPath = MAX_PATH; - szLinkPath = new WCHAR[sizeLinkPath]; - szLinkPath[0] = L'\0'; - lstrcat(szLinkPath, szInstallPath); - lstrcat(szLinkPath, BASIS_LINK); - - //get the path to the actual Basis folder - if (cli_ure::resolveLink(szLinkPath)) - { - //build the path to the ure-link file - int sizeUrePath = lstrlen(szLinkPath) + lstrlen(URE_LINK) + 1; - if (sizeUrePath < MAX_PATH) - sizeUrePath = MAX_PATH; - szUrePath = new WCHAR[sizeUrePath]; - szUrePath[0] = L'\0'; - lstrcat(szUrePath, szLinkPath); - lstrcat(szUrePath, URE_LINK); - - //get the path to the actual Ure folder - if (cli_ure::resolveLink(szUrePath)) - { - //build the path to the URE/bin directory - szUreBin = new WCHAR[lstrlen(szUrePath) + lstrlen(URE_BIN) + 1]; - szUreBin[0] = L'\0'; - lstrcat(szUreBin, szUrePath); - lstrcat(szUreBin, URE_BIN); - } - } - } -#if OSL_DEBUG_LEVEL >=2 - if (szUreBin) - { - fwprintf(stdout,L"[cli_cppuhelper]: Path to URE libraries:\n %s \n", szUreBin); - } - else - { - fwprintf(stdout,L"[cli_cppuhelper]: Failed to determine location of URE.\n"); - } -#endif - delete[] szInstallPath; - delete[] szLinkPath; - delete[] szUrePath; - return szUreBin; -} - /*We extend the path to contain the Ure/bin folder, so that components can use osl_loadModule with arguments, such as @@ -280,7 +199,6 @@ HMODULE loadFromPath(LPCWSTR sLibName) if (sLibName == NULL) return NULL; -// WCHAR * szUreBinPath = getUnoPath(); WCHAR * szUreBinPath = getInstallPath(); if (!szUreBinPath) return NULL; @@ -344,10 +262,10 @@ namespace util Bootstrapping requires the existence of many libraries which are contained in an URE installation. To find and load these libraries the Windows - registry keys HKEY_CURRENT_USER\Software\OpenOffice\Layer\URE\1 - and HKEY_LOCAL_MACHINE\Software\OpenOffice\Layer\URE\1 are examined. - These contain a named value UREINSTALLLOCATION which holds a path to the URE - installation folder. + registry keys HKEY_CURRENT_USER\Software\OpenOffice\UNO\InstallPath + and HKEY_LOCAL_MACHINE\Software\OpenOffice\UNO\InstallPath are examined. + The default value contain the path to the office prgoram dir. No seaparate URE + anymore. */ public __sealed __gc class Bootstrap { diff --git a/cli_ure/version/version.txt b/cli_ure/version/version.txt index 9c46b253e62c..11d003892ea7 100644 --- a/cli_ure/version/version.txt +++ b/cli_ure/version/version.txt @@ -19,23 +19,23 @@ # #************************************************************** -CLI_URETYPES_NEW_VERSION=1.0.8.0 -CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.7.0 -CLI_URETYPES_POLICY_VERSION=8.0.0.0 +CLI_URETYPES_NEW_VERSION=1.0.9.0 +CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.8.0 +CLI_URETYPES_POLICY_VERSION=9.0.0.0 CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes -CLI_BASETYPES_NEW_VERSION=1.0.19.0 -CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.18.0 -CLI_BASETYPES_POLICY_VERSION=19.0.0.0 +CLI_BASETYPES_NEW_VERSION=1.0.20.0 +CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.19.0 +CLI_BASETYPES_POLICY_VERSION=20.0.0.0 CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes -CLI_URE_NEW_VERSION=1.0.22.0 -CLI_URE_OLD_VERSION=1.0.0.0-1.0.21.0 -CLI_URE_POLICY_VERSION=22.0.0.0 +CLI_URE_NEW_VERSION=1.0.23.0 +CLI_URE_OLD_VERSION=1.0.0.0-1.0.22.0 +CLI_URE_POLICY_VERSION=23.0.0.0 CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure -CLI_CPPUHELPER_NEW_VERSION=1.0.22.0 -CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.21.0 -CLI_CPPUHELPER_POLICY_VERSION=22.0.0.0 +CLI_CPPUHELPER_NEW_VERSION=1.0.23.0 +CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.22.0 +CLI_CPPUHELPER_POLICY_VERSION=23.0.0.0 CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper diff --git a/comphelper/inc/comphelper/evtmethodhelper.hxx b/comphelper/inc/comphelper/evtmethodhelper.hxx index a141c0282486..eac68430f205 100644 --- a/comphelper/inc/comphelper/evtmethodhelper.hxx +++ b/comphelper/inc/comphelper/evtmethodhelper.hxx @@ -20,15 +20,15 @@ *************************************************************/ -#ifndef COMPHELPER_EVENTMEHODHELPER_HXX -#define COMPHELPER_EVENMETHODHELPER_HXX +#ifndef COMPHELPER_EVENTMETHODHELPER_HXX +#define COMPHELPER_EVENTMETHODHELPER_HXX #include <comphelper/sequence.hxx> -//........................................................................ + namespace comphelper { COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type); -//........................................................................ -} // namespace comphelper -//........................................................................ -#endif // COMPHELPER_EVENTMEHODHELPER_HXX +} + +#endif // COMPHELPER_EVENTMETHODHELPER_HXX + diff --git a/configure.in b/configure.in index c3000be581ab..dbdf400c678c 100644 --- a/configure.in +++ b/configure.in @@ -59,8 +59,7 @@ AC_ARG_ENABLE(online-update, [ --disable-online-update Disables the Online Update feature. ],,enable_online_update=yes) AC_ARG_ENABLE(ldap, -[ --disable-ldap Disables the use of LDAP backend via Netscape/Mozilla - or OpenLDAP LDAP SDK +[ --disable-ldap Disables the use of LDAP backend via OpenLDAP ],,) AC_ARG_ENABLE(fetch-external, [ --disable-fetch-external Disables fetching external tarballs from web sources. @@ -70,8 +69,7 @@ AC_ARG_WITH(external-tar, [ TARFILE_LOCATION="$withval" ]) AC_ARG_WITH(openldap, -[ --with-openldap Enables the use of the OpenLDAP LDAP SDK instead - of the Netscape/Mozilla one +[ --with-openldap Enables the use of the OpenLDAP ],,) AC_ARG_ENABLE(lockdown, [ --enable-lockdown Enables the gconf integration work in OOo @@ -324,35 +322,8 @@ AC_ARG_ENABLE(static-gtk, AC_ARG_ENABLE(layout, [ --enable-layout Enable the compilation and use of layout dialogs ],,) -AC_ARG_ENABLE(mozilla, -[ --disable-mozilla OO.o usually includes a strangely hacked up mozilla - binary for your platform, to build without this - version, use this option. -],,enable_mozilla="yes") -AC_ARG_ENABLE(build-mozilla, -[ --disable-build-mozilla Use this option if you do not want to build the - mozilla components from the mozilla source code but - take precompiled zips -],,) -AC_ARG_WITH(mozilla-version, -[ --with-mozilla-version Choose which version of mozilla to use while building - mozilla. Default: 1.7.5. - Note that not all versions are supported. -],,) -AC_ARG_WITH(mozilla-toolkit, -[ --with-mozilla-toolkit Choose which GUI toolkit to use while building mozilla - components. Default: gtk2 -],,) -AC_ARG_WITH(system-mozilla, -[ --with-system-mozilla Use mozilla already on system. Note that some - components cannot be built against a contemporary - mozilla. The flavour used can be specified by - --with-system-mozilla=<flavour>. Supported are: - libxul (default), xulrunner, firefox, seamonkey, - mozilla -], WITH_SYSTEM_MOZILLA=$withval, WITH_SYSTEM_MOZILLA=no) AC_ARG_ENABLE(nss_module, -[ --disable-nss-module Whether to use provided NSS module +[ --disable-nss-module Whether to use the NSS module that is used for xml-security ],,enable_nss_module=yes) AC_ARG_ENABLE(kde, [ --enable-kde Determines whether to use Qt/KDE vclplug on platforms @@ -430,7 +401,7 @@ AC_ARG_WITH(external-thes-dir, AC_ARG_WITH(system-libs, [ --with-system-libs Use libs already on system -- enables all - --with-system-* flags except mozilla and + --with-system-* flags except odbc/sane/xrender-header(s) ],,) AC_ARG_WITH(system-headers, @@ -449,6 +420,9 @@ AC_ARG_WITH(system-jars, AC_ARG_WITH(system-zlib, [ --with-system-zlib Use zlib already on system ],,) +AC_ARG_WITH(system-nss, +[ --with-system-nss Use NSS already on system +],,) AC_ARG_WITH(system-openssl, [ --with-system-openssl Use OpenSSL already on system ],,) @@ -629,10 +603,6 @@ AC_ARG_WITH(system-mdds, AC_ARG_WITH(system-vigra, [ --with-system-vigra Use vigra already on system ],,) -AC_ARG_ENABLE(Xaw, -[ --disable-Xaw Disables the use of Xaw for the Netscape/Mozilla - plugin -],,) AC_ARG_ENABLE(hunspell, [ --enable-hunspell Determines whether to enable the Hunspell library. If enabled, the library will be built unless you @@ -1428,7 +1398,6 @@ ENABLE_CATEGORY_B= AC_MSG_CHECKING([whether to enable category B components]) # Category B modules (libraries): -# moz (seamonkey) # nss (nss) # hunspell (hunspell) # hyphen (hyphen) @@ -1447,10 +1416,9 @@ if test "$enable_category_b" = "yes"; then enable_coinmp="yes" enable_category_b_fonts="yes" - AC_MSG_RESULT([yes: allow modules moz, nss, hunspell, hyphen, saxon, rhino, beanshell, graphite, coinmp to be built]) + AC_MSG_RESULT([yes: allow modules, nss, hunspell, hyphen, saxon, rhino, beanshell, graphite, coinmp to be built]) else # Disable libaries. - enable_mozilla="no" enable_nss_module="no" enable_hunspell="no" enable_hyphen="no" @@ -1461,7 +1429,7 @@ else enable_coinmp="no" enable_category_b_fonts="no" - AC_MSG_RESULT([no: disabled modules moz, nss, hunspell, hyphen, saxon, rhino, beanshell, graphite, coinmp]) + AC_MSG_RESULT([no: disabled modules, nss, hunspell, hyphen, saxon, rhino, beanshell, graphite, coinmp]) fi AC_SUBST(ENABLE_CATEGORY_B) @@ -4765,40 +4733,19 @@ else fi AC_SUBST(SYSTEM_ODBC_HEADERS) -WITH_MOZILLA=NO -AC_MSG_CHECKING([whether to enable build of Mozilla/Mozilla NSS-using components]) -if test "$enable_mozilla" = "no"; then - AC_MSG_RESULT([no]) - WITH_MOZILLA=NO - ENABLE_NSS_MODULE=NO -else - AC_MSG_RESULT([yes]) - WITH_MOZILLA=YES -fi - -AC_MSG_CHECKING([whether to build Mozilla addressbook connectivity]) -if test "$enable_mozilla" = "no"; then - AC_MSG_RESULT([no]) -elif test "$with_system_mozilla" = "yes"; then - AC_MSG_RESULT([no, not possible with system-mozilla]) -else - AC_MSG_RESULT([yes]) -fi - AC_MSG_CHECKING([whether to build XML Security support]) -if test "$enable_mozilla" = "no"; then - AC_MSG_RESULT([no, since Mozilla (NSS) disabled but needed]) +if test "$enable_nss_module" = "no"; then + AC_MSG_RESULT([no, since NSS disabled but needed]) else AC_MSG_RESULT([yes]) fi AC_MSG_CHECKING([whether to build LDAP configuration backend]) if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then - if test "$enable_mozilla" = "yes" || test "$with_openldap" = "yes"; then + if test "$with_openldap" = "yes"; then AC_MSG_RESULT([yes]) WITH_LDAP=YES else - AC_MSG_RESULT([no. Either Mozilla or OpenLDAP needed]) WITH_LDAP=NO fi else @@ -4808,7 +4755,7 @@ fi if test "$WITH_LDAP" = "YES"; then dnl =================================================================== - dnl Test whether we want to use the Mozilla or the OpenLDAP LDAP SDK + dnl Test whether we want to use the OpenLDAP LDAP SDK dnl =================================================================== AC_MSG_CHECKING([which LDAP SDK to use]) if test -n "$with_openldap" && test "$with_openldap" != "no"; then @@ -4822,170 +4769,11 @@ if test "$WITH_LDAP" = "YES"; then # it has it. Test for it to be sure AC_CHECK_LIB(ldap, ldap_set_option, [], [AC_MSG_ERROR(openldap lib not found or functional)], []) - else - AC_MSG_RESULT([Netscape/Mozilla]) - # TODO. Actually do a sanity check and check for - # LDAP_OPT_SIZELIMIT and LDAP_X_OPT_CONNECT_TIMEOUT - WITH_OPENLDAP=NO fi fi AC_SUBST(WITH_LDAP) AC_SUBST(WITH_OPENLDAP) -dnl =================================================================== -dnl Check for system mozilla -dnl =================================================================== -AC_MSG_CHECKING([which mozilla to use]) -if test -n "$with_system_mozilla" && test "$with_system_mozilla" != "no"; then - AC_MSG_RESULT([external]) - SYSTEM_MOZILLA=YES - ENABLE_NSS_MODULE=NO - enable_nss_module=no - AC_MSG_CHECKING([which Mozilla flavour to use]) - if test -n "$with_system_mozilla" && test "$with_system_mozilla" = "libxul"; then - MOZ_FLAVOUR=libxul - elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "xulrunner"; then - MOZ_FLAVOUR=xulrunner - elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "seamonkey"; then - MOZ_FLAVOUR=seamonkey - elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "firefox"; then - MOZ_FLAVOUR=firefox - elif test -n "$with_system_mozilla" && test "$with_system_mozilla" = "mozilla"; then - MOZ_FLAVOUR=mozilla - else - MOZ_FLAVOUR=libxul - fi - tmp=`echo $MOZ_FLAVOUR | $PERL -e 'print ucfirst(<STDIN>);'` - AC_MSG_RESULT($tmp) - - PKG_CHECK_MODULES( MOZ_NSS, nss, STANDALONENSS="TRUE", STANDALONENSS="" ) - if test -z "$STANDALONENSS"; then - PKG_CHECK_MODULES( MOZ_NSS, $MOZ_FLAVOUR-nss ) - else - NSS_LIB="-L`$PKG_CONFIG --variable=libdir nss`" - AC_SUBST(NSS_LIB) - fi - - if $PKG_CONFIG --exists nspr ; then - PKG_CHECK_MODULES( MOZ_NSPR, nspr ) - NSPR_LIB="-L`$PKG_CONFIG --variable=libdir nspr`" - AC_SUBST(NSPR_LIB) - else - PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr ) - fi - - if test "$MOZ_FLAVOUR" != "libxul"; then - PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" ) - MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom` - MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom` - fi - - if test -z "$HASXPCOM"; then - PKG_CHECK_MODULES( MOZILLAXPCOM, libxul ) - MOZ_INC=`$PKG_CONFIG --variable=includedir libxul` - MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul` - if ! test -e "$MOZ_LIB/libxul.so"; then - MOZ_LIB=`$PKG_CONFIG --variable=sdkdir libxul` - if test -e "$MOZ_LIB/sdk/lib/libxul.so"; then - MOZ_LIB="$MOZ_LIB/sdk/lib" - fi - fi - fi - - save_CPPFLAGS="$CPPFLAGS" - save_LDFLAGS="$LDFLAGS" - save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $MOZ_NSS_CFLAGS" - LDFLAGS="$LDFLAGS $MOZ_NSS_LIBS" - AC_CHECK_LIB(nss3, PK11_GetCertFromPrivateKey, [], - [AC_MSG_ERROR(PK11_GetCertFromPrivateKey missing but needed. -See https://bugzilla.mozilla.org/show_bug.cgi?id=262274. -Fixed since nss 3.9.3 (contained by e.g. mozilla >= 1.7.5))], []) - LDFLAGS="$save_LDFLAGS" - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" - - MOZ_LIB_XPCOM=$MOZILLAXPCOM_LIBS - if test "$WITH_LDAP" != "NO" && test "$WITH_OPENLDAP" != "YES"; then - AC_MSG_CHECKING([whether $tmp was compiled with --enable-ldap]) - if test -d "$MOZ_INC/ldap"; then - AC_MSG_RESULT([yes]) - MOZ_LDAP_CFLAGS="-I$MOZ_INC" - else - AC_MSG_ERROR([no. -Could not find LDAP header include files in $MOZ_INC/ldap. -Please recompile $tmp with --enable-ldap or use --with-openldap.]) - fi - fi - - #e.g. http://fedoraproject.org/wiki/Releases/FeatureXULRunnerAPIChanges - #the plugin pkg-config etc. reverts to "mozilla-plugin" with libxul - if test "$MOZ_FLAVOUR" = "libxul"; then - MOZ_FLAVOUR="mozilla" - fi - -elif test "$enable_mozilla" = "no"; then - AC_MSG_RESULT([none]) - WITH_MOZILLA=NO - ENABLE_NSS_MODULE=NO - enable_nss_module=no -else - AC_MSG_RESULT([internal]) - SYSTEM_MOZILLA=NO - BUILD_TYPE="$BUILD_TYPE MOZ" - WITH_MOZILLA=YES -if test -z "$with_mozilla_version"; then - MOZILLA_VERSION= -else - AC_MSG_CHECKING([which mozilla version to build]) - MOZILLA_VERSION=$with_mozilla_version - enable_build_mozilla=1 - AC_MSG_RESULT([$MOZILLA_VERSION]) -fi - -AC_SUBST(MOZILLA_VERSION) -AC_SUBST(WITH_MOZILLA) - -AC_MSG_CHECKING([for toolkit mozilla should use]) -if test -z "$with_mozilla_toolkit"; then - if test "$_os" != "WINNT" ; then - if test "$_os" = "Darwin" ; then - MOZILLA_TOOLKIT=mac - AC_MSG_RESULT([mac]) - else - MOZILLA_TOOLKIT=gtk2 - AC_MSG_RESULT([gtk2]) - fi - fi -else - MOZILLA_TOOLKIT=$with_mozilla_toolkit - enable_build_mozilla=1 - AC_MSG_RESULT([$MOZILLA_TOOLKIT]) -fi -#if test "$_os" = "Darwin" && test "$MOZILLA_TOOLKIT" != "gtk2"; then -# #only gtk2 toolkit supported - xlib or cocoa nees glib1 and libIDL1 - the latter is not -# #available using fink, mac (carbon) doesn't work because xcode installs conflicting headers -# AC_MSG_ERROR([Only gtk2 toolkit supported on Mac, sorry.]) -#fi - -AC_SUBST(MOZILLA_TOOLKIT) - -# default to enabling build mozilla -if test "$enable_build_mozilla" != "no"; then - enable_build_mozilla=yes -else - enable_build_mozilla= -fi - -AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey]) -if test -n "$enable_build_mozilla"; then - BUILD_MOZAB="TRUE" - AC_MSG_RESULT([yes]) -else - BUILD_MOZAB="" - AC_MSG_RESULT([no]) -fi - AC_MSG_CHECKING([whether to build provided NSS module]) if test "$enable_nss_module" != "no"; then ENABLE_NSS_MODULE="YES" @@ -4994,7 +4782,7 @@ if test "$enable_nss_module" != "no"; then if test "$_os" = "WINNT"; then AC_MSG_CHECKING([for Mozilla build tooling]) if test -z "$MOZILLABUILD" ; then -AC_MSG_ERROR([Mozilla build tooling not found. +AC_MSG_ERROR([Mozilla build tooling not found. It is needed for NSS. Use the --with-mozilla-build option after installling the tools obtained from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32]) else @@ -5019,77 +4807,9 @@ else AC_MSG_RESULT([no]) fi -if test "$BUILD_MOZAB" = "TRUE"; then - if test "$_os" = "WINNT"; then - if test "$WITH_MINGWIN" != "yes"; then - # compiling with MSVC. Only supported platform here is MSVS2005 at the moment. - if test "$MSVSVER" != "2005"; then - AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio .NET 2005 only.]) - fi - else - AC_MSG_WARN([Building SeaMonkey with mingwin is not tested, and likely to break.]) - echo "Building SeaMonkey with mingwin is not tested, and likely to break." >> warn - fi - fi - - if test -z "$MOZILLA_VERSION"; then - MOZILLA_VERSION=1.1.14 - fi - if test "$_os" = "WINNT"; then - AC_MSG_CHECKING([for moztools binaries]) - if test ! -e "$TARFILE_LOCATION/vc8-moztools.zip" ; then - AC_MSG_ERROR([The following file is missing in $TARFILE_LOCATION: vc8-moztools.zip -(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)]) - else - AC_MSG_RESULT([ok]) - fi - elif test "$_os" = "Darwin"; then - if test "$MOZILLA_TOOLKIT" = "gtk2"; then - AC_MSG_NOTICE([checking whether mozilla can be built...]) - PKG_CHECK_MODULES(MOZGTK2, gtk+-2.0 >= 2.4 libIDL-2.0 >= 0.8, AC_MSG_NOTICE([OK - can build mozilla]), AC_MSG_ERROR([Prerequisites to build mozilla not met. Either use the precompiled mozilla binaries or install the missing packages])) - else - PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.6.3, MOZIDL="TRUE", MOZIDL="") - if test -z "$MOZIDL"; then - AC_MSG_ERROR([libIDL 0.6.3 or newer is needed to build mozilla with mac toolkit.]) - fi - fi - else - # Generic Unix/Linux section - if test "$MOZILLA_TOOLKIT" = "gtk2"; then - PKG_CHECK_MODULES(MOZLIBREQ, gtk+-2.0, MOZGTK="TRUE", MOZGTK="") - if test -z "$MOZGTK"; then - AC_MSG_ERROR([GTK2 is needed to build mozilla.]) - fi - PKG_CHECK_MODULES(MOZLIBREQ, libIDL-2.0 >= 0.8.0, MOZIDL="TRUE", MOZIDL="") - if test -z "$MOZIDL"; then - AC_MSG_ERROR([libIDL >= 0.8.0 is needed when using GTK2 to build mozilla.]) - fi - else - PKG_CHECK_MODULES(MOZLIBREQ, gtk+ >= 1.2.3, MOZGTK="TRUE", MOZGTK="") - if test -z "$MOZGTK"; then - AC_MSG_ERROR([gtk 1.2 is needed when not using GTK2 to build mozilla.]) - fi - PKG_CHECK_MODULES(MOZLIBREQ, libidl >= 0.6.3 libidl <= 0.6.8, MOZIDL="TRUE", MOZIDL="") - if test -z "$MOZIDL"; then - AC_MSG_ERROR([libIDL 0.6.3 - 0.6.8 is needed when not using GTK2 to build mozilla.]) - fi - fi - fi -fi - -AC_SUBST(BUILD_MOZAB) - -fi AC_SUBST(ENABLE_NSS_MODULE) AC_SUBST(MOZILLABUILD) -AC_SUBST(SYSTEM_MOZILLA) -AC_SUBST(MOZ_FLAVOUR) AC_SUBST(MOZ_INC) -AC_SUBST(MOZ_LIB) -AC_SUBST(MOZ_LIB_XPCOM) -AC_SUBST(MOZ_NSPR_CFLAGS) -AC_SUBST(MOZ_NSS_CFLAGS) -AC_SUBST(MOZ_LDAP_CFLAGS) dnl =================================================================== dnl Check for system sane @@ -5279,28 +4999,6 @@ fi AC_SUBST(XLIB) AC_SUBST(XAU_LIBS) -if test "$_os" != "WINNT" -a "$_os" != "OS2" -a "$_os" != "Darwin"; then - dnl =================================================================== - dnl Check for using Xaw - dnl =================================================================== - AC_MSG_CHECKING([whether to use Xaw]) - if test "$enable_Xaw" = "no"; then - DISABLE_XAW=TRUE - AC_MSG_RESULT([no]) - AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt include headers not found])], - [#include <X11/Intrinsic.h>]) - else - AC_MSG_RESULT([yes]) - AC_CHECK_HEADERS(X11/Xaw/Label.h,[],[AC_MSG_ERROR([Xaw include headers not found])], - [#include <X11/Intrinsic.h>]) - AC_CHECK_LIB(Xaw, main, [], - [AC_MSG_ERROR(Xaw library not found or functional)], []) - fi -fi -AC_SUBST(DISABLE_XAW) - - - dnl =================================================================== dnl Check if fontconfig/fontconfig.h is available dnl =================================================================== @@ -5381,6 +5079,23 @@ AC_SUBST(XRANDR_LIBS) AC_SUBST(ENABLE_RANDR) dnl =================================================================== +dnl Check for system nss +dnl =================================================================== +AC_MSG_CHECKING([which libnss to use]) +if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then + AC_MSG_RESULT([external]) + PKG_CHECK_MODULES( NSS, nss ) + SYSTEM_NSS=YES +else + AC_MSG_RESULT([internal]) + SYSTEM_NSS=NO + BUILD_TYPE="$BUILD_TYPE NSS" +fi +AC_SUBST(SYSTEM_NSS) +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) + +dnl =================================================================== dnl Check for system openssl dnl =================================================================== if test "$_os" = "Darwin" && test "$with_system_openssl" != "no"; then diff --git a/connectivity/prj/build.lst b/connectivity/prj/build.lst index 509b61cc6f9a..81e9d6a43c28 100644 --- a/connectivity/prj/build.lst +++ b/connectivity/prj/build.lst @@ -1,4 +1,4 @@ -cn connectivity : shell L10N:l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss LIBXSLT:libxslt NULL +cn connectivity : shell L10N:l10n comphelper SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss LIBXSLT:libxslt NULL cn connectivity usr1 - all cn_mkout NULL cn connectivity\inc nmake - all cn_inc NULL cn connectivity\com\sun\star\sdbcx\comp\hsqldb nmake - all cn_jhsqldbdb cn_hsqldb cn_inc NULL @@ -8,9 +8,6 @@ cn connectivity\source\cpool nmake - all cn_cpool cn_ cn connectivity\source\resource nmake - all cn_res cn_inc NULL cn connectivity\source\sdbcx nmake - all cn_sdbcx cn_inc NULL cn connectivity\source\drivers\ado nmake - all cn_ado cn_dbtools cn_inc NULL -cn connectivity\source\drivers\mozab\mozillasrc nmake - all cn_mozab_mozillasrc cn_file cn_inc NULL -cn connectivity\source\drivers\mozab\bootstrap nmake - all cn_mozab_bootstrap cn_mozab_mozillasrc cn_inc NULL -cn connectivity\source\drivers\mozab nmake - all cn_mozab cn_mozab_bootstrap cn_dbtools cn_inc NULL cn connectivity\source\drivers\kab nmake - all cn_kab cn_dbtools cn_inc NULL cn connectivity\source\drivers\macab nmake - all cn_macab cn_dbtools cn_inc NULL cn connectivity\source\drivers\evoab2 nmake - all cn_evoab2 cn_dbtools cn_file cn_inc NULL @@ -29,4 +26,4 @@ cn connectivity\source\simpledbt nmake - all cn_simpledbt cn connectivity\source\dbtools nmake - all cn_dbtools cn_simpledbt cn_cmtools cn_parse cn_res cn_sdbcx cn_inc cn_res NULL cn connectivity\qa\connectivity\tools nmake - all cn_qa_tools cn_inc NULL cn connectivity\qa nmake - all cn_qa cn_inc NULL -cn connectivity\util nmake - all cn_util cn_ado cn_mozab cn_kab cn_evoab2 cn_calc cn_odbc cn_mysql cn_jdbc cn_adabas cn_flat cn_dbase cn_hsqldb cn_macab NULL +cn connectivity\util nmake - all cn_util cn_ado cn_kab cn_evoab2 cn_calc cn_odbc cn_mysql cn_jdbc cn_adabas cn_flat cn_dbase cn_hsqldb cn_macab NULL diff --git a/connectivity/prj/d.lst b/connectivity/prj/d.lst index 6a761078ea23..ae56093e62e3 100644 --- a/connectivity/prj/d.lst +++ b/connectivity/prj/d.lst @@ -17,7 +17,6 @@ ..\source\drivers\dbase\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\drivers\jdbc\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\drivers\odbc\*.xml %_DEST%\xml%_EXT%\*.xml -..\source\drivers\mozab\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\drivers\evoab2\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\drivers\calc\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\drivers\mysql\*.xml %_DEST%\xml%_EXT%\*.xml @@ -46,8 +45,6 @@ mkdir: %_DEST%\xml%_EXT%\registry\spool\DataAccess ..\%__SRC%\misc\jdbc.component %_DEST%\xml%_EXT%\jdbc.component ..\%__SRC%\misc\kab1.component %_DEST%\xml%_EXT%\kab1.component ..\%__SRC%\misc\macab1.component %_DEST%\xml%_EXT%\macab1.component -..\%__SRC%\misc\mozab.component %_DEST%\xml%_EXT%\mozab.component -..\%__SRC%\misc\mozbootstrap.component %_DEST%\xml%_EXT%\mozbootstrap.component ..\%__SRC%\misc\mysql.component %_DEST%\xml%_EXT%\mysql.component ..\%__SRC%\misc\odbc.component %_DEST%\xml%_EXT%\odbc.component ..\%__SRC%\misc\sdbc2.component %_DEST%\xml%_EXT%\sdbc2.component diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index 06e2b5f522dc..7cd53e55a5ab 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -196,7 +196,10 @@ namespace {} bool operator() (const ::com::sun::star::beans::PropertyValue& lhs, const ::com::sun::star::beans::PropertyValue& rhs) const { - return !!(lhs.Name.equalsIgnoreAsciiCase( rhs.Name )); + const rtl_uString* l = lhs.Name.pData; + const rtl_uString* r = rhs.Name.pData; + const int c = rtl_ustr_compareIgnoreAsciiCase_WithLength( l->buffer, l->length, r->buffer, r->length ); + return (c < 0); } }; diff --git a/connectivity/source/drivers/evoab/LCatalog.cxx b/connectivity/source/drivers/evoab/LCatalog.cxx deleted file mode 100644 index 1bbbbc284009..000000000000 --- a/connectivity/source/drivers/evoab/LCatalog.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - - -#include "LCatalog.hxx" -#include "LConnection.hxx" -#include "LTables.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; - -// ------------------------------------------------------------------------- -using namespace connectivity::evoab; -// ------------------------------------------------------------------------- -OEvoabCatalog::OEvoabCatalog(OEvoabConnection* _pCon) : file::OFileCatalog(_pCon) -{ -} -// ------------------------------------------------------------------------- -void OEvoabCatalog::refreshTables() -{ - TStringVector aVector; - Sequence< ::rtl::OUString > aTypes; - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - aVector.push_back(xRow->getString(3)); - } - if(m_pTables) - m_pTables->reFill(aVector); - else - m_pTables = new OEvoabTables(m_xMetaData,*this,m_aMutex,aVector); -} -// ----------------------------------------------------------------------------- - - - diff --git a/connectivity/source/drivers/evoab/LCatalog.hxx b/connectivity/source/drivers/evoab/LCatalog.hxx deleted file mode 100644 index d7969707eb8d..000000000000 --- a/connectivity/source/drivers/evoab/LCatalog.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LCATALOG_HXX_ -#define _CONNECTIVITY_EVOAB_LCATALOG_HXX_ - -#include "file/FCatalog.hxx" - -namespace connectivity -{ - namespace evoab - { - class OEvoabConnection; - class OEvoabCatalog : public file::OFileCatalog - { - public: - virtual void refreshTables(); - - public: - OEvoabCatalog(OEvoabConnection* _pCon); - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LCATALOG_HXX_ - diff --git a/connectivity/source/drivers/evoab/LColumnAlias.cxx b/connectivity/source/drivers/evoab/LColumnAlias.cxx deleted file mode 100644 index fe84fd408f75..000000000000 --- a/connectivity/source/drivers/evoab/LColumnAlias.cxx +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LColumnAlias.hxx" -#include "LDriver.hxx" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include "LConfigAccess.hxx" - -using namespace ::connectivity; -using namespace ::connectivity::evoab; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; - -static const ::rtl::OUString sProgrammaticNames[] = -{ - ::rtl::OUString::createFromAscii("FirstName"), - ::rtl::OUString::createFromAscii("LastName"), - ::rtl::OUString::createFromAscii("DisplayName"), - ::rtl::OUString::createFromAscii("NickName"), - ::rtl::OUString::createFromAscii("PrimaryEmail"), - ::rtl::OUString::createFromAscii("SecondEmail"), - ::rtl::OUString::createFromAscii("PreferMailFormat"), - ::rtl::OUString::createFromAscii("WorkPhone"), - ::rtl::OUString::createFromAscii("HomePhone"), - ::rtl::OUString::createFromAscii("FaxNumber"), - ::rtl::OUString::createFromAscii("PagerNumber"), - ::rtl::OUString::createFromAscii("CellularNumber"), - ::rtl::OUString::createFromAscii("HomeAddress"), - ::rtl::OUString::createFromAscii("HomeAddress2"), - ::rtl::OUString::createFromAscii("HomeCity"), - ::rtl::OUString::createFromAscii("HomeState"), - ::rtl::OUString::createFromAscii("HomeZipCode"), - ::rtl::OUString::createFromAscii("HomeCountry"), - ::rtl::OUString::createFromAscii("WorkAddress"), - ::rtl::OUString::createFromAscii("WorkAddress2"), - ::rtl::OUString::createFromAscii("WorkCity"), - ::rtl::OUString::createFromAscii("WorkState"), - ::rtl::OUString::createFromAscii("WorkZipCode"), - ::rtl::OUString::createFromAscii("WorkCountry"), - ::rtl::OUString::createFromAscii("JobTitle"), - ::rtl::OUString::createFromAscii("Department"), - ::rtl::OUString::createFromAscii("Company"), - ::rtl::OUString::createFromAscii("WebPage1"), - ::rtl::OUString::createFromAscii("WebPage2"), - ::rtl::OUString::createFromAscii("BirthYear"), - ::rtl::OUString::createFromAscii("BirthMonth"), - ::rtl::OUString::createFromAscii("BirthDay"), - ::rtl::OUString::createFromAscii("Notes") -}; -//------------------------------------------------------------------------------ -OColumnAlias::OColumnAlias() -{ - // Initialise m_aAlias with the default values from sProgrammaticNames. - initialise(); - - // Initialise m_aAlias map with the default values from sProgrammaticNames. - setAliasMap(); -} -//------------------------------------------------------------------ -OColumnAlias::~OColumnAlias() -{ -} -//------------------------------------------------------------------ -void OColumnAlias::initialise() -{ - m_aAlias.reserve( END - FIRSTNAME + 1 ); - for (sal_Int32 i(FIRSTNAME); i < END; ++i) - { - m_aAlias.push_back(sProgrammaticNames[i]); - m_aHeadLineNames.push_back(sProgrammaticNames[i]); - } - - return; -} -//------------------------------------------------------------------ -void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) -{ - OSL_TRACE("OColumnAlias::setAlias()entered"); - - // open our driver settings config node - - // the config path for our own driver's settings - Reference< XPropertySet > xEvoDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() ); - //Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, mozab::OConnection::getDriverImplementationName() ); - Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver") ); - if ( xEvoDriverNode.is() && xMozDriverNode.is() ) - { - try - { - //============================================================= - Reference< XNameAccess > xEvoAliasesNode; - Reference< XNameAccess > xMozAliasesNode; - xEvoDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xEvoAliasesNode; - xMozDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xMozAliasesNode; - OSL_ENSURE( xEvoAliasesNode.is(), "OColumnAlias::setAlias: missing the evolution aliases node!" ); - OSL_ENSURE( xMozAliasesNode.is(), "OColumnAlias::setAlias: missing the mozilla aliases node!" ); - - // this is a set of string nodes - Sequence< ::rtl::OUString > aColumnProgrammaticNames; - //OSL_TRACE("OColumnAlias::setAlias()before xAliasesNode->getElementNames()"); - if ( xEvoAliasesNode.is() ) - aColumnProgrammaticNames = xEvoAliasesNode->getElementNames(); - //OSL_TRACE("OColumnAlias::setAlias()after xAliasesNode->getElementNames()"); - - //============================================================= - // travel through all the set elements - const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray(); - const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.getLength(); - ::rtl::OUString sAssignedAlias; - ::rtl::OUString sHeadLineName; - - for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames ) - { - //OSL_TRACE("OColumnAlias::setAlias()::*pProgrammaticNames = %s\n", ((OUtoCStr(*pProgrammaticNames)) ? (OUtoCStr(*pProgrammaticNames)):("NULL")) ); - OSL_ENSURE( m_aAliasMap.end() != m_aAliasMap.find( *pProgrammaticNames ), - "OColumnAlias::setAlias: found an invalid programmtic name!" ); - // if this asserts, somebody stored a programmatic name in the configuration - // which is not allowed (i.e. not in the list of known programmatics). - //OSL_TRACE("OColumnAlias::setAlias()before xAliasesNode->getByName()"); - -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bExtractionSuccess = -#endif - xMozAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias; - OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid mozilla config data!" ); -#if OSL_DEBUG_LEVEL > 0 - bExtractionSuccess = -#endif - xEvoAliasesNode->getByName( *pProgrammaticNames) >>= sHeadLineName; - OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid evolution config data!" ); - //OSL_TRACE("OColumnAlias::setAlias()after xAliasesNode->getByName()"); - - // normalize in case the config data is corrupted - // (what we really don't need is an empty alias ...) - if ( 0 == sAssignedAlias.getLength() ) - sAssignedAlias = *pProgrammaticNames; - if ( 0 == sHeadLineName.getLength() ) - sHeadLineName = *pProgrammaticNames; - //OSL_TRACE("OColumnAlias::setAlias()::sAssignedAlias = %s\n", ((OUtoCStr(sAssignedAlias)) ? (OUtoCStr(sAssignedAlias)):("NULL")) ); - //OSL_TRACE("OColumnAlias::setAlias()::sHeadLineName = %s\n", ((OUtoCStr(sHeadLineName)) ? (OUtoCStr(sHeadLineName)):("NULL")) ); - - //============================================================= - // check the value - // look up the programmatic indicated by pProgrammaticNames in the known programmatics - const ::rtl::OUString* pProgrammatic = sProgrammaticNames + FIRSTNAME; - const ::rtl::OUString* pProgrammaticEnd = sProgrammaticNames + END; - - OSL_ENSURE( (sal_Int32)m_aAlias.size() == pProgrammaticEnd - pProgrammatic, - "OColumnAlias::setAlias: aliases vector not yet initialized!" ); - - // the destination where we want to remember the alias - ::std::vector< ::rtl::OUString >::iterator aAlias = m_aAlias.begin(); - ::std::vector< ::rtl::OUString >::iterator aHeadLineName = m_aHeadLineNames.begin(); - - for ( ; pProgrammatic < pProgrammaticEnd; ++pProgrammatic, ++aAlias, ++aHeadLineName ) - { - //OSL_TRACE("OColumnAlias::setAlias()::*pProgrammatic = %s\n", ((OUtoCStr(*pProgrammatic)) ? (OUtoCStr(*pProgrammatic)):("NULL")) ); - if ( pProgrammaticNames->equals( *pProgrammatic ) ) - { - // add alias to the vector - *aAlias = sAssignedAlias; - *aHeadLineName = sHeadLineName; - break; - } - } - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" ); - } - } - - // Initialise m_aAliasMap. - setAliasMap(); - - return; -} -//------------------------------------------------------------------ -const ::std::vector< ::rtl::OUString> & OColumnAlias::getAlias() const -{ - return m_aAlias; -} -//------------------------------------------------------------------ -const ::std::map< ::rtl::OUString, ::rtl::OUString> & OColumnAlias::getAliasMap() const -{ - return m_aAliasMap; -} -//------------------------------------------------------------------ -void OColumnAlias::setAliasMap() -{ - // Fill the map with the values of m_aAlias - // and the sProgrammaticNames array. - for (sal_Int32 i(FIRSTNAME); i < END; ++i) { - m_aAliasMap[m_aAlias[i]] = m_aHeadLineNames[i]; - //OSL_TRACE("OColumnAlias::setAliasMap()::m_aAlias[i] = %s\n", ((OUtoCStr(m_aAlias[i])) ? (OUtoCStr(m_aAlias[i])):("NULL")) ); - //OSL_TRACE("OColumnAlias::setAliasMap()::m_aAliasMap[m_aAlias[i]] = %s\n", ((OUtoCStr(m_aAliasMap[m_aAlias[i]])) ? (OUtoCStr(m_aAliasMap[m_aAlias[i]])):("NULL")) ); - } - - return; -} -//------------------------------------------------------------------ diff --git a/connectivity/source/drivers/evoab/LColumnAlias.hxx b/connectivity/source/drivers/evoab/LColumnAlias.hxx deleted file mode 100644 index 26609f762597..000000000000 --- a/connectivity/source/drivers/evoab/LColumnAlias.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_ -#define _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_ - -#include <unotools/confignode.hxx> - -#include <osl/mutex.hxx> -#include <vector> -#include <map> - -namespace connectivity -{ - namespace evoab - { - typedef enum { - FIRSTNAME = 0, - LASTNAME, - DISPLAYNAME, - NICKNAME, - PRIMARYEMAIL, - SECONDEMAIL, - PREFERMAILFORMAT, - WORKPHONE, - HOMEPHONE, - FAXNUMBER, - PAGERNUMBER, - CELLULARNUMBER, - HOMEADDRESS, - HOMEADDRESS2, - HOMECITY, - HOMESTATE, - HOMEZIPCODE, - HOMECOUNTRY, - WORKADDRESS, - WORKADDRESS2, - WORKCITY, - WORKSTATE, - WORKZIPCODE, - WORKCOUNTRY, - JOBTITLE, - DEPARTMENT, - COMPANY, - WEBPAGE1, - WEBPAGE2, - BIRTHYEAR, - BIRTHMONTH, - BIRTHDAY, - NOTES, - END - } ProgrammaticName; - - class OColumnAlias - { - /** - * m_Alias holds aliases for the evolution addressbook - * column names. This member gets initialised during - * creation of the connection to the driver. - * m_aAlias initialises m_aAliasMap which then can be - * used to find the corresponding programmatic name - * when an alias is used as a query attribute. Mozilla - * expects programmatic names from its clients. - * - * m_aAlias: vector of aliases used to initialise m_aAliasMap. - * m_AliasMap: map of {alias, programmaticname} pairs. - * - */ - private: - ::std::vector< ::rtl::OUString> m_aAlias; - ::std::vector< ::rtl::OUString> m_aHeadLineNames; - ::std::map< ::rtl::OUString, ::rtl::OUString> m_aAliasMap; - protected: - ::osl::Mutex m_aMutex; - public: - void initialise(void); - const ::std::vector< ::rtl::OUString> & getAlias(void) const; - const ::std::map< ::rtl::OUString, ::rtl::OUString> & getAliasMap(void) const; - void setAlias(const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > &); - private: - void setAliasMap(void); - public: - OColumnAlias(void); - ~OColumnAlias(void); - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LCOLUMNALIAS_HXX_ diff --git a/connectivity/source/drivers/evoab/LColumns.cxx b/connectivity/source/drivers/evoab/LColumns.cxx deleted file mode 100644 index c3dfa480c6d8..000000000000 --- a/connectivity/source/drivers/evoab/LColumns.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "LColumns.hxx" -#include "LTable.hxx" -#include "connectivity/sdbcx/VColumn.hxx" - -using namespace connectivity::evoab; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; - - -sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName) -{ - - OEvoabTable* pTable = (OEvoabTable*)m_pTable; - ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); - OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); - sdbcx::ObjectType xRet; - if(aIter != aCols->get().end()) - xRet = sdbcx::ObjectType(*aIter,UNO_QUERY); - return xRet; -} -// ------------------------------------------------------------------------- - - diff --git a/connectivity/source/drivers/evoab/LColumns.hxx b/connectivity/source/drivers/evoab/LColumns.hxx deleted file mode 100644 index 4f368559ea32..000000000000 --- a/connectivity/source/drivers/evoab/LColumns.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_ -#define _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_ - -#include "file/FColumns.hxx" - -namespace connectivity -{ - namespace evoab - { - class OEvoabColumns : public file::OColumns - { - protected: - virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); - public: - OEvoabColumns(file::OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const TStringVector &_rVector - ) : file::OColumns(_pTable,_rMutex,_rVector) - {} - - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LCOLUMNS_HXX_ - diff --git a/connectivity/source/drivers/evoab/LConfigAccess.cxx b/connectivity/source/drivers/evoab/LConfigAccess.cxx deleted file mode 100644 index 6ea30a7242df..000000000000 --- a/connectivity/source/drivers/evoab/LConfigAccess.cxx +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LConfigAccess.hxx" -#include "LDriver.hxx" -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#include "LDebug.hxx" -#endif - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; - -//......................................................................... -namespace connectivity -{ - namespace evoab - { - //----------------------------------------------------------------- - Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB, ::rtl::OUString _sDriverImplementationName ) - { - OSL_TRACE("createDriverConfigNode()entered"); - - Reference< XPropertySet > xNode; - try - { - //============================================================= - // create the config provider - Reference< XMultiServiceFactory > xConfigProvider( - _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ), - UNO_QUERY - ); - OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" ); - - if ( xConfigProvider.is() ) - { - ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" ); - sCompleteNodePath += _sDriverImplementationName; - //sCompleteNodePath += OEvoabConnection::getDriverImplementationName(); - //sCompleteNodePath += ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver"); - EVO_TRACE_STRING("createDriverConfigNode()::sCompleteNodePath = %s\n", sCompleteNodePath ); - - //========================================================= - // arguments for creating the config access - Sequence< Any > aArguments(2); - // the path to the node to open - aArguments[0] <<= PropertyValue( - ::rtl::OUString::createFromAscii( "nodepath"), - 0, - makeAny( sCompleteNodePath ), - PropertyState_DIRECT_VALUE - ); - // the depth: -1 means unlimited - aArguments[1] <<= PropertyValue( - ::rtl::OUString::createFromAscii( "depth"), - 0, - makeAny( (sal_Int32)-1 ), - PropertyState_DIRECT_VALUE - ); - - //========================================================= - // create the access - Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ), - aArguments - ); - OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" ); - - xNode = xNode.query( xAccess ); - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); - } - - // outta here - return xNode; - } - - //----------------------------------------------------------------- - namespace - { - // a private helper to accessing the point where we store the reference - // to the factory - Reference< XMultiServiceFactory >& accessFactoryStorage( ) - { - static Reference< XMultiServiceFactory > xEvoabServiceFactory; - return xEvoabServiceFactory; - } - } - - //----------------------------------------------------------------- - void setEvoabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory ) - { - accessFactoryStorage( ) = _rxFactory; - } - - //----------------------------------------------------------------- - const Reference< XMultiServiceFactory >& getEvoabServiceFactory( ) - { - return accessFactoryStorage( ); - } - - //----------------------------------------------------------------- - ::rtl::OUString getFullPathExportingCommand( Reference< XMultiServiceFactory > _rxORB ) - { - ::rtl::OUString sFullPathExportingCommand; - - //Reference< XMultiServiceFactory > xFactory = getEvoabServiceFactory(); - //OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" ); - OSL_ENSURE( _rxORB.is(), "getFullPathExportingCommand: invalid service factory!" ); - if ( _rxORB.is() ) - { - try - { - Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() ); - Reference< XPropertySet > xEvoPrefsNode; - if ( xDriverNode.is() ) - xDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii( "EvolutionPreferences" ) ) >>= xEvoPrefsNode; - OSL_ENSURE( xEvoPrefsNode.is(), "getFullPathExportingCommand: could not access the node for the evolution preferences!" ); - if ( xEvoPrefsNode.is() ) - xEvoPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii( "FullPathExportingCommand" ) ) >>= sFullPathExportingCommand; - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "getFullPathExportingCommand: caught an exception!" ); - } - } - return sFullPathExportingCommand; - } - } -} - -//......................................................................... diff --git a/connectivity/source/drivers/evoab/LConfigAccess.hxx b/connectivity/source/drivers/evoab/LConfigAccess.hxx deleted file mode 100644 index bc8b6c224166..000000000000 --- a/connectivity/source/drivers/evoab/LConfigAccess.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_ -#define _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_ - -// This is the extended version (for use on the SO side of the driver) of MConfigAccess -// (which is for use on the mozilla side only) - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -namespace connectivity -{ - namespace evoab - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB, ::rtl::OUString _sDriverImplementationName ); - ::rtl::OUString getFullPathExportingCommand( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB ); - } -} -#endif // _CONNECTIVITY_EVOAB_LCONFIGACCESS_HXX_ diff --git a/connectivity/source/drivers/evoab/LConnection.cxx b/connectivity/source/drivers/evoab/LConnection.cxx deleted file mode 100644 index 3b2a5b722d85..000000000000 --- a/connectivity/source/drivers/evoab/LConnection.cxx +++ /dev/null @@ -1,263 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LConnection.hxx" -#include "LDatabaseMetaData.hxx" -#include "LCatalog.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include <tools/urlobj.hxx> -#include "LPreparedStatement.hxx" -#include "LStatement.hxx" -#include <comphelper/extract.hxx> -#include <connectivity/dbcharset.hxx> -#include <connectivity/dbexception.hxx> -#include <comphelper/processfactory.hxx> -#include <vos/process.hxx> -#include <tools/debug.hxx> -#include "LDebug.hxx" -#include "diagnose_ex.h" -#include <comphelper/sequence.hxx> -#include <connectivity/dbexception.hxx> -#include "resource/common_res.hrc" - -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace vos; - -typedef connectivity::file::OConnection OConnection_B; - -//------------------------------------------------------------------------------ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::lang; - -::rtl::OUString implGetExceptionMsg( Exception& e, const ::rtl::OUString& aExceptionType_ ) -{ - ::rtl::OUString aExceptionType = aExceptionType_; - if( aExceptionType.getLength() == 0 ) - aExceptionType = ::rtl::OUString( ::rtl::OUString::createFromAscii("Unknown" ) ); - - ::rtl::OUString aTypeLine( ::rtl::OUString::createFromAscii("\nType: " ) ); - aTypeLine += aExceptionType; - - ::rtl::OUString aMessageLine( ::rtl::OUString::createFromAscii("\nMessage: " ) ); - aMessageLine += ::rtl::OUString( e.Message ); - - ::rtl::OUString aMsg(aTypeLine); - aMsg += aMessageLine; - return aMsg; -} - - // Exception type unknown -::rtl::OUString implGetExceptionMsg( Exception& e ) -{ - ::rtl::OUString aMsg = implGetExceptionMsg( e, ::rtl::OUString() ); - return aMsg; -} - -// -------------------------------------------------------------------------------- -OEvoabConnection::OEvoabConnection(OEvoabDriver* _pDriver) : OConnection(_pDriver) - ,m_bHeaderLine(sal_True) - ,m_cFieldDelimiter(',') - ,m_cStringDelimiter('"') - ,m_cDecimalDelimiter('.') - ,m_cThousandDelimiter(' ') -{ - // Initialise m_aColumnAlias. - m_aColumnAlias.setAlias(_pDriver->getFactory()); -} -//----------------------------------------------------------------------------- -OEvoabConnection::~OEvoabConnection() -{ -} - -// XServiceInfo -// -------------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO(OEvoabConnection, "com.sun.star.sdbc.drivers.evoab.Connection", "com.sun.star.sdbc.Connection") - -//----------------------------------------------------------------------------- -void OEvoabConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) -{ - osl_incrementInterlockedCount( &m_refCount ); - EVO_TRACE_STRING("OEvoabConnection::construct()::url = %s\n", url ); - - - ::rtl::OUString aCLICommand = getDriver()->getEvoab_CLI_EffectiveCommand(); - ::rtl::OUString aWorkingDirPath = getDriver()->getWorkingDirPath(); - ::rtl::OUString aArg1 = ::rtl::OUString::createFromAscii(OEvoabDriver::getEVOAB_CLI_ARG_LIST_FOLDERS()); - ::rtl::OUString aArg2 = ::rtl::OUString::createFromAscii(OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX()); - aArg2 += aWorkingDirPath; - aArg2 += getDriver()->getEvoFolderListFileName(); - OArgumentList aArgs(2,&aArg1,&aArg2); - - EVO_TRACE_STRING("OEvoabConnection::construct()::aCLICommand = %s\n", aCLICommand ); - EVO_TRACE_STRING("OEvoabConnection::construct()::aWorkingDirPath = %s\n", aWorkingDirPath ); - EVO_TRACE_STRING("OEvoabConnection::construct()::aArg1 = %s\n", aArg1 ); - EVO_TRACE_STRING("OEvoabConnection::construct()::aArg2 = %s\n", aArg2 ); - OProcess aApp( aCLICommand,aWorkingDirPath); - OSL_VERIFY_EQUALS( - aApp.execute( (OProcess::TProcessOption)(OProcess::TOption_Hidden | OProcess::TOption_Wait | OProcess::TOption_SearchPath),aArgs), - OProcess::E_None, - "Error at execute evolution-addressbook-export to get VCards"); - - - Sequence<PropertyValue> aDriverParam; - ::std::vector<PropertyValue> aParam; - - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("EnableSQL92Check"), 0, Any(), PropertyState_DIRECT_VALUE)); - ::dbtools::OCharsetMap aLookupIanaName; - ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(RTL_TEXTENCODING_UTF8); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("CharSet"), 0, - makeAny((*aLookup).getIanaName()), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("Extension"), 0, makeAny(getDriver()->getFileExt()), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("HeaderLine"), 0, makeAny(m_bHeaderLine), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("FieldDelimiter"), 0, makeAny(::rtl::OUString(&m_cFieldDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("StringDelimiter"), 0, makeAny(::rtl::OUString(&m_cStringDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("DecimalDelimiter"), 0, makeAny(::rtl::OUString(&m_cDecimalDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("ThousandDelimiter"), 0, makeAny(::rtl::OUString(&m_cThousandDelimiter,1)), PropertyState_DIRECT_VALUE)); - - // build a new parameter sequence from the original parameters, appended by the new parameters from above - PropertyValue *pParams = aParam.empty() ? 0 : &aParam[0]; - aDriverParam = ::comphelper::concatSequences( - info, - Sequence< PropertyValue >( pParams, aParam.size() ) - ); - - // transform "sdbc:address:evolution" part of URL to "sdbc:flat:file:///..." - // - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); - // Get Scheme - nLen = aAddrbookURI.indexOf(':'); - ::rtl::OUString aAddrbookScheme; - if ( nLen == -1 ) - { - // There isn't any subschema: - but could be just subschema - if ( aAddrbookURI.getLength() > 0 ) - { - aAddrbookScheme= aAddrbookURI; - } - else - { - OSL_TRACE( "No subschema given!!!\n"); - throwGenericSQLException(STR_URI_SYNTAX_ERROR ,*this); - } - } - else - { - aAddrbookScheme = aAddrbookURI.copy(0, nLen); - } - - EVO_TRACE_STRING("OEvoabConnection::construct()::URI = %s\n", aAddrbookURI ); - EVO_TRACE_STRING("OEvoabConnection::construct()::Scheme = %s\n", aAddrbookScheme ); - - // - // Now we have a URI convert it to a Evolution CLI flat file URI - // - // The Mapping being used is: - // - // * for Evolution - // "sdbc:address:evolution:" -> "sdbc:flat:file:///(file path generated) - - rtl::OUString aEvoFlatURI; - if ( aAddrbookScheme.compareToAscii( OEvoabDriver::getSDBC_SCHEME_EVOLUTION() ) == 0 ) - { - aEvoFlatURI = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "sdbc:flat:" )); - } - - - aEvoFlatURI += getDriver()->getWorkingDirURL(); - EVO_TRACE_STRING("OEvoabConnection::construct()::m_aEvoFlatURI = %s\n", aEvoFlatURI ); - //setURL(aEvoFlatURI); - m_aEvoFlatURI = aEvoFlatURI; - - osl_decrementInterlockedCount( &m_refCount ); - OConnection::construct(aEvoFlatURI,aDriverParam); -} -// -------------------------------------------------------------------------------- -Reference< XDatabaseMetaData > SAL_CALL OEvoabConnection::getMetaData( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_B::rBHelper.bDisposed); - - - Reference< XDatabaseMetaData > xMetaData = m_xMetaData; - if(!xMetaData.is()) - { - xMetaData = new OEvoabDatabaseMetaData(this); - m_xMetaData = xMetaData; - } - - return xMetaData; -} -//------------------------------------------------------------------------------ -::com::sun::star::uno::Reference< XTablesSupplier > OEvoabConnection::createCatalog() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XTablesSupplier > xTab = m_xCatalog; - if(!xTab.is()) - { - OEvoabCatalog *pCat = new OEvoabCatalog(this); - xTab = pCat; - m_xCatalog = xTab; - } - return xTab; -} -// -------------------------------------------------------------------------------- -Reference< XStatement > SAL_CALL OEvoabConnection::createStatement( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_B::rBHelper.bDisposed); - - OEvoabStatement* pStmt = new OEvoabStatement(this); - - Reference< XStatement > xStmt = pStmt; - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return xStmt; -} -// -------------------------------------------------------------------------------- -Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_B::rBHelper.bDisposed); - - - OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement(this); - Reference< XPreparedStatement > xStmt = pStmt; - pStmt->construct(sql); - - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return xStmt; -} -// -------------------------------------------------------------------------------- -Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this ); - return NULL; -} -// ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab/LConnection.hxx b/connectivity/source/drivers/evoab/LConnection.hxx deleted file mode 100644 index ecf6ff3c1f2e..000000000000 --- a/connectivity/source/drivers/evoab/LConnection.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LCONNECTION_HXX_ -#define _CONNECTIVITY_EVOAB_LCONNECTION_HXX_ - -#include "LDriver.hxx" -#include "file/FConnection.hxx" -#include "LColumnAlias.hxx" - -namespace connectivity -{ - namespace evoab - { - class OEvoabConnection : public file::OConnection - { - private: - OColumnAlias m_aColumnAlias; - sal_Bool m_bHeaderLine; // column names in first row - sal_Unicode m_cFieldDelimiter; // look at the name - sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter - sal_Unicode m_cDecimalDelimiter; // Dezimal-delimiter (Dezimalpoint) - sal_Unicode m_cThousandDelimiter; // - rtl::OUString m_aEvoFlatURI; - - public: - OEvoabConnection(OEvoabDriver* _pDriver); - virtual ~OEvoabConnection(); - - virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException); - - // own methods - inline const OEvoabDriver* getDriver() const { return static_cast< const OEvoabDriver* >( m_pDriver ); } - inline sal_Bool isHeaderLine() const { return m_bHeaderLine; } - inline sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; } - inline sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; } - inline sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; } - inline sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;} - const OColumnAlias& getColumnAlias() const { return m_aColumnAlias; } - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XConnection - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LCONNECTION_HXX_ diff --git a/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx b/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx deleted file mode 100644 index 229fbe60a5b0..000000000000 --- a/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx +++ /dev/null @@ -1,387 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LDatabaseMetaData.hxx" -#include "LConnection.hxx" -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/beans/XFastPropertySet.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/sdbcx/XIndexesSupplier.hpp> -#include <com/sun/star/ucb/XContentAccess.hpp> -#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_ -#include <com/sun/star/sdbc/XRow.hpp> -#endif -#include <tools/urlobj.hxx> -#include "FDatabaseMetaDataResultSet.hxx" -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <comphelper/extract.hxx> -#include <comphelper/types.hxx> -#include "LFolderList.hxx" -#include "connectivity/CommonTools.hxx" -#include <vos/process.hxx> -#include <osl/process.h> -#include <tools/debug.hxx> -#include <map> -#include <vector> - -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#include "LDebug.hxx" -#endif -#include "diagnose_ex.h" - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::evoab; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::ucb; -using namespace osl; -using namespace vos; - -namespace connectivity -{ - namespace evoab - { - static sal_Int32 const s_nCOLUMN_SIZE = 256; - static sal_Int32 const s_nDECIMAL_DIGITS = 0; - static sal_Int32 const s_nNULLABLE = 1; - static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535; - } -} - -OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon) -{ -} -// ------------------------------------------------------------------------- -OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData() -{ -} -// ------------------------------------------------------------------------- -Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); - Reference< XResultSet > xRef = pResult; - static ODatabaseMetaDataResultSet::ORows aRows; - if(aRows.empty()) - { - ODatabaseMetaDataResultSet::ORow aRow; - - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); - aRow.push_back(new ORowSetValueDecorator(DataType::CHAR)); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); - - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); - aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); - aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRows.push_back(aRow); - - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); - aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); - aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); - aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); - aRow[2] = new ORowSetValueDecorator(DataType::DATE); - aRow[3] = new ORowSetValueDecorator((sal_Int32)10); - aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); - aRow[2] = new ORowSetValueDecorator(DataType::TIME); - aRow[3] = new ORowSetValueDecorator((sal_Int32)8); - aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); - aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[3] = new ORowSetValueDecorator((sal_Int32)19); - aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); - aRow[2] = new ORowSetValueDecorator(DataType::BIT); - aRow[3] = ODatabaseMetaDataResultSet::get1Value(); - aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); - aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); - aRow[3] = new ORowSetValueDecorator((sal_Int32)20); - aRow[15] = new ORowSetValueDecorator((sal_Int32)15); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); - aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE); - aRow[3] = new ORowSetValueDecorator((sal_Int32)20); - aRow[15] = ODatabaseMetaDataResultSet::get0Value(); - aRows.push_back(aRow); - - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); - aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC); - aRow[3] = new ORowSetValueDecorator((sal_Int32)20); - aRow[15] = new ORowSetValueDecorator((sal_Int32)20); - aRows.push_back(aRow); - } - - pResult->setRows(aRows); - return xRef; -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns( - const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, - const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("OEvoabDatabaseMetaData::getColumns()::Entered\n"); - EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::schemaPattern = %s\n", schemaPattern ); - EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::tableNamePattern = %s\n", tableNamePattern ); - EVO_TRACE_STRING("OEvoabDatabaseMetaData::getColumns()::columnNamePattern = %s\n", columnNamePattern ); - - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XTablesSupplier > xTables = m_pConnection->createCatalog(); - if(!xTables.is()) - throw SQLException(); - - Reference< XNameAccess> xNames = xTables->getTables(); - if(!xNames.is()) - throw SQLException(); - - ODatabaseMetaDataResultSet::ORows aRows; - ODatabaseMetaDataResultSet::ORow aRow(19); - aRow[10] = new ORowSetValueDecorator((sal_Int32)10); - Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); - const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); - const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength(); - for(;pTabBegin != pTabEnd;++pTabBegin) - { - if(match(tableNamePattern,*pTabBegin,'\0')) - { - Reference< XColumnsSupplier> xTable; - ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin)); - aRow[3] = new ORowSetValueDecorator(*pTabBegin); - - Reference< XNameAccess> xColumns = xTable->getColumns(); - if(!xColumns.is()) - throw SQLException(); - - Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames()); - - const ::rtl::OUString* pBegin = aColNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aColNames.getLength(); - Reference< XPropertySet> xColumn; - for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i) - { - if(match(columnNamePattern,*pBegin,'\0')) - { - aRow[4] = new ORowSetValueDecorator(*pBegin); - - ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin)); - OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); - aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); - aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); - aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); - aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); - - switch((sal_Int32)aRow[5]->getValue()) - { - case DataType::CHAR: - case DataType::VARCHAR: - aRow[16] = new ORowSetValueDecorator((sal_Int32)254); - break; - case DataType::LONGVARCHAR: - aRow[16] = new ORowSetValueDecorator((sal_Int32)65535); - break; - default: - aRow[16] = new ORowSetValueDecorator((sal_Int32)0); - } - aRow[17] = new ORowSetValueDecorator(i); - switch(sal_Int32(aRow[11]->getValue())) - { - case ColumnValue::NO_NULLS: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); - break; - case ColumnValue::NULLABLE: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); - break; - default: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); - } - aRows.push_back(aRow); - } - } - } - } - - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns); - Reference< XResultSet > xRef = pResult; - pResult->setRows(aRows); - - return xRef; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")) + m_pConnection->getURL(); -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( - const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, - const ::rtl::OUString& /*tableNamePattern*/, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - - ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); - Reference< XResultSet > xRef = pResult; - - // check if any type is given - // when no types are given then we have to return all tables e.g. TABLE - - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); - - sal_Bool bTableFound = sal_True; - sal_Int32 nLength = types.getLength(); - if(nLength) - { - bTableFound = sal_False; - - const ::rtl::OUString* pBegin = types.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + nLength; - for(;pBegin != pEnd;++pBegin) - { - if(*pBegin == aTable) - { - bTableFound = sal_True; - break; - } - } - } - if(!bTableFound) - return xRef; - - OEvoabConnection* pOEvoabConnection = (OEvoabConnection*)m_pConnection; - OEvoabFolderList* pFolderList = new OEvoabFolderList( pOEvoabConnection ); - - - ODatabaseMetaDataResultSet::ORows aRows; - sal_Bool bMoreData = sal_True; - ::rtl::OUString aName, aLocation; - sal_Int32 nCardsCount; - - pFolderList->initializeRow(3); - bMoreData = pFolderList->first(); - OSL_TRACE("OEvoabDatabaseMetaData::getTables()::first %d\n",bMoreData ); - do - { - if(bMoreData) - bMoreData = pFolderList->getRow(); - if(bMoreData) - { - aLocation = pFolderList->getString(1); - aName = pFolderList->getString(2); - nCardsCount = pFolderList->getInt(3); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aLocation = %s\n", aLocation ); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aName = %s\n", aName ); - OSL_TRACE("OEvoabDatabaseMetaData::getTables()::nCardsCount = %d\n", nCardsCount); - - ODatabaseMetaDataResultSet::ORow aRow(3); - aRow.reserve(6); - aRow.push_back(new ORowSetValueDecorator(aName)); - aRow.push_back(new ORowSetValueDecorator(aTable)); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRows.push_back(aRow); - - ::rtl::OUString aWorkingDir = pOEvoabConnection->getDriver()->getWorkingDirPath(); - ::rtl::OUString aCLICommand = pOEvoabConnection->getDriver()->getEvoab_CLI_EffectiveCommand(); - ::rtl::OUString aArg1 = aLocation; - ::rtl::OUString aArg2 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX()); - aArg2 += aWorkingDir; - aArg2 += aName; - aArg2 += ::rtl::OUString::createFromAscii("."); - aArg2 += ::rtl::OUString(pOEvoabConnection->getExtension()); - ::rtl::OUString aArg3 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FORMAT()); - - OArgumentList aArgs(3,&aArg1,&aArg2,&aArg3); - - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aCLICommand = %s\n", aCLICommand ); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aWorkingDir = %s\n", aWorkingDir ); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg1 = %s\n", aArg1 ); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg2 = %s\n", aArg2 ); - EVO_TRACE_STRING( "OEvoabDatabaseMetaData::getTables()::aArg3 = %s\n", aArg3 ); - - OProcess aApp( aCLICommand,aWorkingDir); - OSL_VERIFY_EQUALS( - aApp.execute( (OProcess::TProcessOption)(OProcess::TOption_Hidden | OProcess::TOption_Wait | OProcess::TOption_SearchPath),aArgs), - OProcess::E_None, - "Error at execute evolution-addressbook-exporter to get VCards" ); - - bMoreData = pFolderList->next(); - } - } - while ( bMoreData ); - - delete pFolderList; - pFolderList = NULL; - - pResult->setRows(aRows); - - return xRef; -} diff --git a/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx b/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx deleted file mode 100644 index f985643bcea3..000000000000 --- a/connectivity/source/drivers/evoab/LDatabaseMetaData.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_ -#define _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_ - -#include "file/FDatabaseMetaData.hxx" -#include "FDatabaseMetaDataResultSet.hxx" - -namespace connectivity -{ - namespace evoab - { - //************************************************************** - //************ Class: java.sql.DatabaseMetaDataDate - //************************************************************** - - class OEvoabDatabaseMetaData : public file::ODatabaseMetaData - { - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); - virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - protected: - virtual ~OEvoabDatabaseMetaData(); - public: - OEvoabDatabaseMetaData(file::OConnection* _pCon); - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LDATABASEMETADATA_HXX_ - diff --git a/connectivity/source/drivers/evoab/LDebug.cxx b/connectivity/source/drivers/evoab/LDebug.cxx deleted file mode 100644 index aa76ff644fd2..000000000000 --- a/connectivity/source/drivers/evoab/LDebug.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#include "LDebug.hxx" -#endif -#include <osl/diagnose.h> - -void evo_traceStringMessage( const sal_Char* _pFormat, const ::rtl::OUString& _rAsciiString ) -{ - ::rtl::OString sByteStringMessage( _rAsciiString.getStr(), _rAsciiString.getLength(), RTL_TEXTENCODING_ASCII_US ); - if ( !sByteStringMessage.getLength() ) - sByteStringMessage = "<empty>"; - OSL_TRACE( _pFormat, sByteStringMessage.getStr() ); -} diff --git a/connectivity/source/drivers/evoab/LDebug.hxx b/connectivity/source/drivers/evoab/LDebug.hxx deleted file mode 100644 index 2598c5ff01d3..000000000000 --- a/connectivity/source/drivers/evoab/LDebug.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#define CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX - -#include <rtl/ustring.hxx> - -#ifdef _DEBUG - void evo_traceStringMessage( const sal_Char* _pFormat, const ::rtl::OUString& _rAsciiString ); - - #define EVO_TRACE_STRING( pFormat, rAsciiString ) evo_traceStringMessage( pFormat, rAsciiString ) -#else - #define EVO_TRACE_STRING( pFormat, rAsciiString ) (void)(0) -#endif - - -#endif // CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX diff --git a/connectivity/source/drivers/evoab/LDriver.cxx b/connectivity/source/drivers/evoab/LDriver.cxx deleted file mode 100644 index 79ad2f787700..000000000000 --- a/connectivity/source/drivers/evoab/LDriver.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LDriver.hxx" -#include "LConnection.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include "connectivity/dbexception.hxx" -#include "LConfigAccess.hxx" -#include <osl/file.hxx> -#include "osl/security.hxx" -#include <comphelper/processfactory.hxx> -#include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <ucbhelper/content.hxx> -#include <tools/debug.hxx> -#include "resource/common_res.hrc" -#include "resource/sharedresources.hxx" -#include "LDebug.hxx" - -using namespace osl; -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; - -// -------------------------------------------------------------------------------- -OEvoabDriver::OEvoabDriver(const Reference< XMultiServiceFactory >& _rxFactory) : OFileDriver(_rxFactory) - ,m_aTempDir(NULL, sal_True) - ,m_aFolderListName(::rtl::OUString::createFromAscii(getEVOAB_FOLDERLIST_FILE_NAME())) - ,m_aVersionName(::rtl::OUString::createFromAscii(getEVOAB_VERSION_FILE_NAME())) - ,m_aFileExt(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(getEVOAB_META_FILE_EXT()))) - ,m_bWorkingDirCreated(sal_False) - ,m_eSupportedEvoVersion( eUnknown ) -{ - m_aEvoab_CLI_FullPathCommand = getFullPathExportingCommand(_rxFactory); - - if ( m_aEvoab_CLI_FullPathCommand.getLength() == 0 ) - m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii(getEVOAB_CLI_FULLPATHCOMMAND()); - if ( m_aEvoab_CLI_FullPathCommand.copy(0,7) != ::rtl::OUString::createFromAscii("file://") && m_aEvoab_CLI_FullPathCommand.copy(0,1) == ::rtl::OUString::createFromAscii("/")) - m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii("file://") + m_aEvoab_CLI_FullPathCommand; - m_aEvoab_CLI_EffectiveCommand = m_aEvoab_CLI_FullPathCommand; - m_aTempDir.EnableKillingFile(); - - EVO_TRACE_STRING("OEvoabDriver::OEvoabDriver()::m_aEvoab_CLI_FullPathCommand = %s", m_aEvoab_CLI_FullPathCommand ); -} -// static ServiceInfo -//------------------------------------------------------------------------------ -rtl::OUString OEvoabDriver::getImplementationName_Static( ) throw(RuntimeException) -{ - return rtl::OUString::createFromAscii(EVOAB_DRIVER_IMPL_NAME); -} - -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL OEvoabDriver::getImplementationName( ) throw(RuntimeException) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------ -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::evoab::OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) -{ - return *(new OEvoabDriver(_rxFactory)); -} -// -------------------------------------------------------------------------------- -Reference< XConnection > SAL_CALL OEvoabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); - - if ( ! acceptsURL(url) ) - return NULL; - - OEvoabConnection* pCon = new OEvoabConnection(this); - pCon->construct(url,info); - Reference< XConnection > xCon = pCon; - m_xConnections.push_back(WeakReferenceHelper(*pCon)); - - return xCon; -} -// -------------------------------------------------------------------------------- -namespace -{ - ::rtl::OUString lcl_translateProcessErrorMessage( oslProcessError nProcErr) - { - ::rtl::OUString sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" not executed!.")); - switch (nProcErr) - { - case osl_Process_E_None: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed sucessful!")); - break; - case osl_Process_E_NotFound: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: not found!")); - break; - case osl_Process_E_NoPermission: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: has no permission!")); - break; - case osl_Process_E_TimedOut: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: time out!")); - break; - case osl_Process_E_Unknown: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: unkown reason!")); - break; - case osl_Process_E_InvalidError: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: invalid error!")); - break; - default: - sProcErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" executed failed: other reason!")); - } - return sProcErr; - } - oslProcessError lcl_execute( const ::rtl::OUString& _rCommand, ::rtl::OUString& _rArgument, - const ::rtl::OUString& _rWorkingDir, oslProcessOption _nOptions, oslFileHandle& /*[out]*/ _hStdOut ) - { - oslProcessError nError = osl_Process_E_None; - - EVO_TRACE_STRING("LDriver.cxx::lcl_execute: command : %s", _rCommand ); - EVO_TRACE_STRING("LDriver.cxx::lcl_execute: argument : %s", _rArgument ); - EVO_TRACE_STRING("LDriver.cxx::lcl_execute: working dir: %s", _rWorkingDir ); - - oslProcess hProcess( 0 ); - - nError = osl_executeProcess_WithRedirectedIO( - _rCommand.pData, - &_rArgument.pData, - 1, - _nOptions, - 0, - _rWorkingDir.pData, - 0, - 0, - &hProcess, - NULL, - &_hStdOut, - NULL - ); - ::rtl::OUString sError = _rCommand + lcl_translateProcessErrorMessage( nError); - EVO_TRACE_STRING( "%s", sError ); - - if ( nError == osl_Process_E_None ) - { - TimeValue aFiveSeconds; - aFiveSeconds.Seconds = 5; - aFiveSeconds.Nanosec = 0; - oslProcessError nWaitForProcessError = osl_joinProcessWithTimeout( hProcess, &aFiveSeconds ); - if ( osl_Process_E_None != nWaitForProcessError ) - { - nError = nWaitForProcessError; - // TODO: kill the running process? - } - osl_freeProcessHandle( hProcess ); - } - return nError; - } -} - -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const ::rtl::OUString& url ) - throw(SQLException, RuntimeException) -{ - sal_Bool bRet; - bRet = sal_False; - // here we have to look if we support this url format - if(acceptsURL_Stat(url)) - { - if ( m_eSupportedEvoVersion != eUnknown ) - return m_eSupportedEvoVersion == eTrue ? sal_True : sal_False; - - if(!m_bWorkingDirCreated) - { - String sTempDirURL = getTempDirURL(); - //EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::sTempDirURL = %s", sTempDirURL ); - - ::rtl::OUString aTempDirURL(sTempDirURL); - m_aWorkingDirURL = aTempDirURL; - m_bWorkingDirCreated = sal_True; - } - - ::rtl::OUString aCLICommand = getEvoab_CLI_EffectiveCommand(); - ::rtl::OUString aWorkingDirURL = getWorkingDirURL(); - ::rtl::OUString aArgVersion = ::rtl::OUString::createFromAscii(getEVOAB_CLI_ARG_VERSION()); - - oslFileHandle hStdout = NULL; - oslProcessError nProcErr = lcl_execute( aCLICommand, aArgVersion, aWorkingDirURL, 0, hStdout ); - if(nProcErr != osl_Process_E_None) - { - if(doesEvoab_CLI_HavePath()) - aCLICommand = getEvoab_CLI_Command(); - else - aCLICommand = getEvoab_CLI_Path() + getEvoab_CLI_Command(); - nProcErr = lcl_execute( aCLICommand, aArgVersion, aWorkingDirURL, osl_Process_SEARCHPATH | osl_Process_HIDDEN, hStdout ); - if ( nProcErr == osl_Process_E_None ) - m_aEvoab_CLI_EffectiveCommand = aCLICommand; - } - - if ( hStdout != NULL ) - { - OSL_ASSERT( hStdout ); - sal_Char pBuffer[256]; - sal_uInt64 nBytesRead; - oslFileError nFileErr = osl_File_E_None; - nFileErr = osl_readFile( hStdout, pBuffer, 256, &nBytesRead); - if ( nFileErr != osl_File_E_None ) - { - ::rtl::OUString sErr = translateFileErrorMessage( nFileErr); - OSL_ENSURE(false, ::rtl::OUStringToOString( sErr, RTL_TEXTENCODING_ASCII_US ).getStr()); - } - ::rtl::OUString aVersionInfo; - if ( nFileErr == osl_File_E_None && nBytesRead > 0 && nBytesRead <= 256) - { - OSL_TRACE("OEvoabDriver::acceptsURL()::osl_readFile(),nBytesRead = %u",nBytesRead); - aVersionInfo = - ::rtl::OUString( ( const sal_Char * )pBuffer, - (sal_Int32)nBytesRead, - RTL_TEXTENCODING_UTF8 ); - EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::aVersionInfo = %s", aVersionInfo ); - sal_Int32 nIndex = 0; - sal_Bool bNumRetrieved = sal_False; - ::rtl::OUString aToken; - sal_Int32 aVer[4]; - sal_Int32 i; - for ( i = 0; i < 4; i++ ) - aVer[i] = 0; - do - { - aToken = aVersionInfo.getToken( 0, ' ', nIndex ); - //OSL_TRACE("OEvoabDriver::acceptsURL()::Token:%d", nIndex ); - //EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::aToken = %s", aToken ); - if( aToken.toChar() >= '0' && aToken.toChar() <= '9' ) - { - bNumRetrieved = sal_True; - sal_Int32 nIndex1 = 0; - ::rtl::OUString aNum; - for(i = 0; i < 4 ; i++) - { - if( nIndex1 >= 0 ) - { - aNum = aToken.getToken( 0, '.', nIndex1); - aVer[i] = aNum.toInt32(); - OSL_TRACE("OEvoabDriver::acceptsURL()::Ver[%u]=%u", i, aVer[i] ); - } - } - } - } - while ( nIndex >= 0 && !bNumRetrieved ); - - if((aVer[0]>1)||(aVer[0]==1 && aVer[1]>3)||(aVer[0]==1 && aVer[1]==3 && aVer[2]>2)||(aVer[0]==1 && aVer[1]==3 && aVer[2]==2 && aVer[3]>=99)) - bRet = sal_True; - else - bRet = sal_False; - } - else - bRet = sal_False; - - osl_closeFile( hStdout ); - } - m_eSupportedEvoVersion = bRet ? eTrue : eFalse; - } - EVO_TRACE_STRING("OEvoabDriver::acceptsURL()::return, return value = %s", ::rtl::OUString::valueOf(bRet) ); - return bRet; -} - - -// -------------------------------------------------------------------------------- -sal_Bool OEvoabDriver::acceptsURL_Stat( const ::rtl::OUString& url ) -{ - - EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::Scheme = %s", url ); - // Skip 'sdbc:address: part of URL - // - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); - - // Get Scheme - nLen = aAddrbookURI.indexOf(':'); - ::rtl::OUString aAddrbookScheme; - if ( nLen == -1 ) - { - // There isn't any subschema: - but could be just subschema - if ( aAddrbookURI.getLength() > 0 ) - aAddrbookScheme= aAddrbookURI; - else if(url == ::rtl::OUString::createFromAscii("sdbc:address:") ) - return sal_True; // special case here - else - return sal_False; - } - else - aAddrbookScheme = aAddrbookURI.copy(0, nLen); - - - EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::URI = %s", aAddrbookURI ); - EVO_TRACE_STRING("OEvoabDriver::acceptsURL_Stat()::Scheme = %s", aAddrbookScheme ); - - return aAddrbookScheme.compareToAscii( getSDBC_SCHEME_EVOLUTION() ) == 0 ; -} -// ------------------------------------------------------------------------- -const rtl::OUString OEvoabDriver::getEvoab_CLI_Command() const -{ - rtl::OUString aEvoab_CLI_Command; - sal_Int32 nLen = m_aEvoab_CLI_FullPathCommand.lastIndexOf('/'); - - if ( nLen == -1 ) - aEvoab_CLI_Command = m_aEvoab_CLI_FullPathCommand; - else - aEvoab_CLI_Command = m_aEvoab_CLI_FullPathCommand.copy(nLen+1); - - EVO_TRACE_STRING( "OEvoabDriver::getEvoab_CLI_Command()::aEvoab_CLI_Command = %s", aEvoab_CLI_Command ); - - return aEvoab_CLI_Command; -} -// ------------------------------------------------------------------------- -const rtl::OUString OEvoabDriver::getEvoab_CLI_Path() const -{ - rtl::OUString aEvoab_CLI_Path; - sal_Int32 nLen = m_aEvoab_CLI_FullPathCommand.lastIndexOf('/'); - - if ( nLen == -1 ) - { - rtl::OUString aDefault_CLI_FullPathCommand; - aDefault_CLI_FullPathCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OEvoabDriver::getEVOAB_CLI_FULLPATHCOMMAND())); - sal_Int32 nLength = aDefault_CLI_FullPathCommand.lastIndexOf('/'); - aEvoab_CLI_Path = aDefault_CLI_FullPathCommand.copy(0, nLength+1); - } - else - aEvoab_CLI_Path = m_aEvoab_CLI_FullPathCommand.copy(0, nLen+1); - EVO_TRACE_STRING( "OEvoabDriver::getEvoab_CLI_Path()::aEvoab_CLI_Path = %s", aEvoab_CLI_Path ); - - return aEvoab_CLI_Path; -} -// ------------------------------------------------------------------------- -const rtl::OUString OEvoabDriver::getWorkingDirPath() const -{ - ::rtl::OUString aWorkingDirPath; - if(m_bWorkingDirCreated) - osl::File::getSystemPathFromFileURL( m_aWorkingDirURL, aWorkingDirPath ); - return aWorkingDirPath; -} -// ------------------------------------------------------------------------- -const String OEvoabDriver::getEvoFolderListFileURL() const -{ - - ::rtl::OUString aEvoFolderListFileURL; - aEvoFolderListFileURL = getWorkingDirURL() + getEvoFolderListFileName(); - - EVO_TRACE_STRING("OEvoabDriver::getEvoFolderListFileURL(): aEvoFolderListFileURL = %s", aEvoFolderListFileURL ); - return aEvoFolderListFileURL.getStr(); -} - -// ------------------------------------------------------------------------- -String OEvoabDriver::getTempDirURL() const -{ - ::rtl::OUString aTempDirURL; - aTempDirURL = m_aTempDir.GetURL(); - if((aTempDirURL.lastIndexOf( '/')) != (aTempDirURL.getLength( ) - 1)) - aTempDirURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - - EVO_TRACE_STRING("OEvoabDriver::getTempDirURL(): aTempDirURL = %s", aTempDirURL ); - return aTempDirURL.getStr(); -} -//------------------------------------------------------------------------- -sal_Bool OEvoabDriver::fileExists(const ::rtl::OUString& _rURL, sal_Bool _bIsDir) const -{ - ::ucbhelper::Content aCheckExistence; - sal_Bool bExists = sal_False; - try - { - aCheckExistence = ::ucbhelper::Content(_rURL, Reference< XCommandEnvironment >()); - if(_bIsDir) - bExists = aCheckExistence.isFolder(); - else - bExists = aCheckExistence.isDocument(); - } - catch(const Exception&) { } - return bExists; -} - -// ----------------------------------------------------------------------------- -const sal_Char* OEvoabDriver::getSDBC_SCHEME_EVOLUTION() -{ - static const sal_Char* SDBC_SCHEME_EVOLUTION = EVOAB_EVOLUTION_SCHEMA; - return SDBC_SCHEME_EVOLUTION; -} -const sal_Char* OEvoabDriver::getEVOAB_FOLDERLIST_FILE_NAME() -{ - static const sal_Char* EVOAB_FOLDERLIST_FILE_NAME = "FolderList"; - return EVOAB_FOLDERLIST_FILE_NAME; -} -const sal_Char* OEvoabDriver::getEVOAB_VERSION_FILE_NAME() -{ - static const sal_Char* EVOAB_VERSION_FILE_NAME = "EvoVersion"; - return EVOAB_VERSION_FILE_NAME; -} -const sal_Char* OEvoabDriver::getEVOAB_META_FILE_EXT() -{ - static const sal_Char* EVOAB_META_FILE_EXT = "csv"; - return EVOAB_META_FILE_EXT; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_FULLPATHCOMMAND() -{ - static const sal_Char* EVOAB_CLI_FULLPATHCOMMAND = "file:///home/evoab/extra/share/evolution/*/tools/evolution-addressbook-export"; - return EVOAB_CLI_FULLPATHCOMMAND; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_LIST_FOLDERS() -{ - static const sal_Char* EVOAB_CLI_ARG_LIST_FOLDERS = "-l"; - return EVOAB_CLI_ARG_LIST_FOLDERS; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX() -{ - static const sal_Char* EVOAB_CLI_ARG_OUTPUT_FILE_PREFIX = "--output="; - return EVOAB_CLI_ARG_OUTPUT_FILE_PREFIX; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_FORMAT() -{ - static const sal_Char* EVOAB_CLI_ARG_OUTPUT_FORMAT = "--format=csv"; - return EVOAB_CLI_ARG_OUTPUT_FORMAT; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_VERSION() -{ - static const sal_Char* EVOAB_CLI_ARG_VERSION = "--version"; - return EVOAB_CLI_ARG_VERSION; -} -const sal_Char* OEvoabDriver::getEVOAB_CLI_ARG_OUTPUT_REDIRECT() -{ - static const sal_Char* EVOAB_CLI_ARG_OUTPUT_REDIRECT = ">"; - return EVOAB_CLI_ARG_OUTPUT_REDIRECT; -} -rtl::OUString OEvoabDriver::translateFileErrorMessage( oslFileError nFileErr) -{ - ::rtl::OUString sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" no file operation!.")); - switch (nFileErr) - { - case osl_File_E_None: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation succeeded!")); - break; - case osl_File_E_INVAL: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: the format of the parameters was not valid!")); - break; - case osl_File_E_INTR: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: function call was interrupted!")); - break; - case osl_File_E_IO: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: I/O errors!")); - break; - case osl_File_E_ISDIR: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: is a directory!")); - break; - case osl_File_E_BADF: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: bad file!")); - break; - case osl_File_E_FAULT: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: bad address!")); - break; - case osl_File_E_AGAIN: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: operation would block!")); - break; - case osl_File_E_NOLINK: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: link has been severed!")); - break; - default: - sFileErr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" File operation failed: other reason!")); - } - return sFileErr; -} -// ----------------------------------------------------------------------------- -Sequence< DriverPropertyInfo > SAL_CALL OEvoabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) -{ - if ( !acceptsURL(url) ) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); - ::dbtools::throwGenericSQLException(sMessage ,*this); - } // if ( !acceptsURL(url) ) - return Sequence< DriverPropertyInfo >(); -} diff --git a/connectivity/source/drivers/evoab/LDriver.hxx b/connectivity/source/drivers/evoab/LDriver.hxx deleted file mode 100644 index e6aa66013c68..000000000000 --- a/connectivity/source/drivers/evoab/LDriver.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LDRIVER_HXX_ -#define _CONNECTIVITY_EVOAB_LDRIVER_HXX_ - -#include <cppuhelper/compbase2.hxx> -#include "connectivity/CommonTools.hxx" -#include "file/FDriver.hxx" -#include <unotools/tempfile.hxx> -#include <osl/file.h> -#include <osl/process.h> - -#define EVOAB_EVOLUTION_SCHEMA "evolution" -#define EVOAB_LDAP_SCHEMA "ldap" -#define EVOAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.evoab.OEvoabDriver" - -namespace connectivity -{ - namespace evoab - { - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); - - class OEvoabDriver : public file::OFileDriver - { - private: - enum MaybeVoidBool - { - eUnknown, - eTrue, - eFalse - }; - ::utl::TempFile m_aTempDir; - rtl::OUString m_aFolderListName; - rtl::OUString m_aVersionName; - rtl::OUString m_aFileExt; - rtl::OUString m_aWorkingDirURL; - rtl::OUString m_aEvoab_CLI_EffectiveCommand; - rtl::OUString m_aEvoab_CLI_FullPathCommand; - sal_Bool m_bWorkingDirCreated; - MaybeVoidBool m_eSupportedEvoVersion; - - sal_Bool fileExists(const ::rtl::OUString& _rURL, sal_Bool _bIsDir=sal_False) const; - - public: - OEvoabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); - - inline rtl::OUString getEvoFolderListName() const { return m_aFolderListName;} - inline rtl::OUString getFileExt() const { return m_aFileExt;} - inline rtl::OUString getEvoFolderListFileName() const { return m_aFolderListName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;} - inline rtl::OUString getEvoVersionFileName() const { return m_aVersionName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;} - inline rtl::OUString getWorkingDirURL() const { return m_aWorkingDirURL;} - inline rtl::OUString getEvoab_CLI_FullPathCommand() const { return m_aEvoab_CLI_FullPathCommand;} - inline rtl::OUString getEvoab_CLI_EffectiveCommand() const { return m_aEvoab_CLI_EffectiveCommand;} - inline sal_Bool doesEvoab_CLI_HavePath() const { return m_aEvoab_CLI_FullPathCommand.lastIndexOf('/')!=-1;} - const rtl::OUString getEvoab_CLI_Command() const; - const rtl::OUString getEvoab_CLI_Path() const; - const rtl::OUString getWorkingDirPath() const; - const String getEvoFolderListFileURL() const; - String getTempDirURL() const; - - // XInterface - ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - // XDriver - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - - // static methods - static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); - static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url ); - static ::rtl::OUString translateProcessErrorMessage( oslProcessError nProcErr); - static ::rtl::OUString translateFileErrorMessage( oslFileError nFileErr); - static const sal_Char* getSDBC_SCHEME_EVOLUTION(); - static const sal_Char* getEVOAB_FOLDERLIST_FILE_NAME(); - static const sal_Char* getEVOAB_VERSION_FILE_NAME(); - static const sal_Char* getEVOAB_META_FILE_EXT(); - static const sal_Char* getEVOAB_CLI_FULLPATHCOMMAND(); - static const sal_Char* getEVOAB_CLI_ARG_LIST_FOLDERS(); - static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX(); - static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_FORMAT(); - static const sal_Char* getEVOAB_CLI_ARG_VERSION(); - static const sal_Char* getEVOAB_CLI_ARG_OUTPUT_REDIRECT(); - - }; - } - -} -#endif //_CONNECTIVITY_EVOAB_LDRIVER_HXX_ diff --git a/connectivity/source/drivers/evoab/LFolderList.cxx b/connectivity/source/drivers/evoab/LFolderList.cxx deleted file mode 100644 index cd4ac7283cbf..000000000000 --- a/connectivity/source/drivers/evoab/LFolderList.cxx +++ /dev/null @@ -1,559 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <ctype.h> -#include <algorithm> -#include "LFolderList.hxx" -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <svl/converter.hxx> -#include "LConnection.hxx" -#include "LColumns.hxx" -#include <osl/thread.h> -#include <tools/config.hxx> -#include <comphelper/sequence.hxx> -#include <svl/zforlist.hxx> -#include <rtl/math.hxx> -#include <stdio.h> //sprintf -#include <comphelper/extract.hxx> -#include <comphelper/numbers.hxx> -#include "LDriver.hxx" -#include <com/sun/star/util/NumberFormat.hpp> -#include <unotools/configmgr.hxx> -#include <i18npool/mslangid.hxx> -#include "connectivity/dbconversion.hxx" -#include <comphelper/types.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <tools/debug.hxx> -#include "connectivity/dbexception.hxx" -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#include "LDebug.hxx" -#endif -#include <unotools/syslocale.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::cppu; -using namespace utl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -// ------------------------------------------------------------------------- -void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) -{ - sal_Bool bRead = sal_True; - - QuotedTokenizedString aHeaderLine; - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - - // read first row - QuotedTokenizedString aFirstLine; - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); - - while(bRead && !aFirstLine.Len()) - { - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); - } - // use first row as headerline because we need the number of columns - aHeaderLine = aFirstLine; - - // column count - xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - - if(!m_aColumns.isValid()) - m_aColumns = new OSQLColumns(); - else - m_aColumns->get().clear(); - - m_aTypes.clear(); - m_aPrecisions.clear(); - m_aScales.clear(); - // reserve some space - m_aColumns->get().reserve(nFieldCount); - m_aTypes.reserve(nFieldCount); - m_aPrecisions.reserve(nFieldCount); - m_aScales.reserve(nFieldCount); - - sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); - CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); - // read description - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); - String aColumnName; - ::rtl::OUString aTypeName; - ::comphelper::UStringMixEqual aCase(bCase); - xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens - xub_StrLen nStartPosFirstLine2 = 0; - for (xub_StrLen i = 0; i < nFieldCount; i++) - { - - // no column name so ... - aColumnName = 'C'; - aColumnName += String::CreateFromInt32(i+1); - - sal_Int32 eType; - sal_uInt16 nPrecision = 0; - sal_uInt16 nScale = 0; - - sal_Bool bNumeric = sal_False; - sal_uIntPtr nIndex = 0; - - // first without fielddelimiter - String aField; - aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,pConnection->getFieldDelimiter(),'\0'); - if (aField.Len() == 0 || - (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0))) - { - bNumeric = sal_False; - } - else - { - String aField2; - if ( pConnection->getStringDelimiter() != '\0' ) - aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - else - aField2 = aField; - - if (aField2.Len() == 0) - { - bNumeric = sal_False; - } - else - { - bNumeric = sal_True; - xub_StrLen nDot = 0; - for (xub_StrLen j = 0; j < aField2.Len(); j++) - { - sal_Unicode c = aField2.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if ((!cDecimalDelimiter || c != cDecimalDelimiter) && - (!cThousandDelimiter || c != cThousandDelimiter) && - !aCharClass.isDigit(aField2,j)) - { - bNumeric = sal_False; - break; - } - if (cDecimalDelimiter && c == cDecimalDelimiter) - { - nPrecision = 15; // we have an decimal value - nScale = 2; - nDot++; - } - } - - if (nDot > 1) // if there is more than one dot it isn't a number - bNumeric = sal_False; - if (bNumeric && cThousandDelimiter) - { - // Ist der Trenner richtig angegeben? - String aValue = aField2.GetToken(0,cDecimalDelimiter); - for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) - { - sal_Unicode c = aValue.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if (c == cThousandDelimiter && j) - continue; - else - { - bNumeric = sal_False; - break; - } - } - } - - // jetzt koennte es noch ein Datumsfeld sein - if (!bNumeric) - { - try - { - nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2); - } - catch(Exception&) - { - } - } - } - } - - sal_Int32 nFlags = 0; - if (bNumeric) - { - if (cDecimalDelimiter) - { - if(nPrecision) - { - eType = DataType::DECIMAL; - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); - } - else - { - eType = DataType::DOUBLE; - aTypeName = ::rtl::OUString::createFromAscii("DOUBLE"); - } - } - else - eType = DataType::INTEGER; - nFlags = ColumnSearch::BASIC; - } - else - { - - switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex)) - { - case NUMBERFORMAT_DATE: - eType = DataType::DATE; - aTypeName = ::rtl::OUString::createFromAscii("DATE"); - break; - case NUMBERFORMAT_DATETIME: - eType = DataType::TIMESTAMP; - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); - break; - case NUMBERFORMAT_TIME: - eType = DataType::TIME; - aTypeName = ::rtl::OUString::createFromAscii("TIME"); - break; - default: - eType = DataType::VARCHAR; - nPrecision = 0; // nyi: Daten koennen aber laenger sein! - nScale = 0; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); - }; - nFlags |= ColumnSearch::CHAR; - } - - // check if the columname already exists - String aAlias(aColumnName); - OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); - sal_Int32 nExprCnt = 0; - while(aFind != m_aColumns->get().end()) - { - (aAlias = aColumnName) += String::CreateFromInt32(++nExprCnt); - aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); - } - - sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(), - ColumnValue::NULLABLE, - nPrecision, - nScale, - eType, - sal_False, - sal_False, - sal_False, - bCase); - Reference< XPropertySet> xCol = pColumn; - m_aColumns->get().push_back(xCol); - m_aTypes.push_back(eType); - m_aPrecisions.push_back(nPrecision); - m_aScales.push_back(nScale); - } - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); -} -// ------------------------------------------------------------------------- -DBG_NAME( OEvoabFolderList ); -OEvoabFolderList::OEvoabFolderList(OEvoabConnection* _pConnection) - :m_nFilePos(0) - ,m_pFileStream(NULL) - ,m_pConnection(_pConnection) - ,m_bIsNull(sal_False) -{ - DBG_CTOR( OEvoabFolderList, NULL ); - m_aColumns = new OSQLColumns(); - - construct(); -} -// ----------------------------------------------------------------------------- -void OEvoabFolderList::construct() -{ - SvtSysLocale aLocale; - ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale()); - Sequence< ::com::sun::star::uno::Any > aArg(1); - aArg[0] <<= aAppLocale; - - Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); - m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); - m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); - - INetURLObject aURL; - aURL.SetURL(m_pConnection->getDriver()->getEvoFolderListFileURL()); - - String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); - - EVO_TRACE_STRING("OJ::construct()::aFileName = %s\n", aFileName ); - m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); - - if(!m_pFileStream) - m_pFileStream = createStream_simpleError( aFileName,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE); - - if(m_pFileStream) - { - m_pFileStream->Seek(STREAM_SEEK_TO_END); - sal_Int32 nSize = m_pFileStream->Tell(); - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - - // Buffersize abhaengig von der Filegroesse - m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : - nSize > 100000 ? 16384 : - nSize > 10000 ? 4096 : 1024); - OSL_TRACE("OEvoabFolderList::construct()::m_pFileStream->Tell() = %d\n", nSize ); - - fillColumns(aAppLocale); - } -} - - -//------------------------------------------------------------------ -sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) -{ - (_rRow->get())[0] = m_nFilePos; // the "bookmark" - - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // Felder: - xub_StrLen nStartPos = 0; - String aStr; - OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); - for (sal_Int32 i = 0; aIter != _rCols.get().end();++aIter, ++i) - { - m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - //OSL_TRACE("OEvoabFolderList::fetchRow()::aStr = %s\n", ((OUtoCStr(::rtl::OUString(aStr))) ? (OUtoCStr(::rtl::OUString(aStr))):("NULL")) ); - - if (aStr.Len() == 0) - (_rRow->get())[i+1].setNull(); - else - { - // length depending on the data type - sal_Int32 nType = m_aTypes[i]; - switch(nType) - { - case DataType::TIMESTAMP: - case DataType::DATE: - case DataType::TIME: - { - double nRes = 0.0; - try - { - nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); - Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); - com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; - - switch(nType) - { - case DataType::DATE: - (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate)); - break; - case DataType::TIMESTAMP: - (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate)); - break; - default: - (_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes)); - } - } - catch(Exception&) - { - (_rRow->get())[i+1].setNull(); - } - } break; - case DataType::DOUBLE: - case DataType::INTEGER: - case DataType::DECIMAL: // #99178# OJ - case DataType::NUMERIC: - { - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); - String aStrConverted; - - OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || - !cDecimalDelimiter && nType == DataType::INTEGER, - "FalscherTyp"); - - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: - for (xub_StrLen j = 0; j < aStr.Len(); ++j) - { - if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) - aStrConverted += '.'; - else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it - break; // #99189# OJ - else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) - { - // weglassen - } - else - aStrConverted += aStr.GetChar(j) ; - } - double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL); - - // #99178# OJ - if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) - (_rRow->get())[i+1] = String::CreateFromDouble(nVal); - else - (_rRow->get())[i+1] = nVal; - } break; - - default: - { - // Wert als String in Variable der Row uebernehmen - (_rRow->get())[i+1] = aStr; - } - break; - } - } - } - return sal_True; -} - - -//------------------------------------------------------------------ -sal_Bool OEvoabFolderList::seekRow(IResultSetHelper::Movement eCursorPosition) -{ - //OSL_TRACE("OEvoabFolderList::seekRow()::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - if ( !m_pFileStream ) - return sal_False; - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // ---------------------------------------------------------- - // Positionierung vorbereiten: - //OSL_TRACE("OEvoabFolderList::seekRow()::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - switch(eCursorPosition) - { - case IResultSetHelper::FIRST: - m_nFilePos = 0; - // run through - - case IResultSetHelper::NEXT: - m_pFileStream->Seek(m_nFilePos); - - if (m_pFileStream->IsEof()) - { - OSL_TRACE( "OEvoabFolderList::seekRow: EOF /before/ reading the line." ); - return sal_False; - } - - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - { - OSL_TRACE( "OEvoabFolderList::seekRow: EOF /after/ reading the line." ); - if ( !m_aCurrentLine.Len() ) - { - OSL_TRACE( "OEvoabFolderList::seekRow: empty line read." ); - return sal_False; - } - } - m_nFilePos = m_pFileStream->Tell(); - break; - - default: - OSL_ENSURE( sal_False, "OEvoabFolderList::seekRow: unsupported positioning!" ); - break; - } - - //OSL_TRACE("OEvoabFolderList::seekRow()::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - return sal_True; -} -// ----------------------------------------------------------------------------- -SvStream* OEvoabFolderList::createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode) -{ - utl::UcbLockBytesHandler* p_null_dummy=NULL; - SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, p_null_dummy); - if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode())) - { - delete pReturn; - pReturn = NULL; - } - return pReturn; -} -// ----------------------------------------------------------------------------- -const ORowSetValue& OEvoabFolderList::getValue(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException) -{ - checkIndex( _nColumnIndex ); - - m_bIsNull = (m_aRow->get())[_nColumnIndex].isNull(); - return (m_aRow->get())[_nColumnIndex]; -} -// ----------------------------------------------------------------------------- -void OEvoabFolderList::checkIndex(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException) -{ - if ( _nColumnIndex <= 0 || _nColumnIndex >= (sal_Int32)m_aRow->get().size() ) { -// ::dbtools::throwInvalidIndexException(); - ; - } -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OEvoabFolderList::getString( sal_Int32 _nColumnIndex ) throw(SQLException, RuntimeException) -{ - return getValue(_nColumnIndex); -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OEvoabFolderList::getInt( sal_Int32 _nColumnIndex ) throw(SQLException, RuntimeException) -{ - return getValue( _nColumnIndex ); -} -// ----------------------------------------------------------------------------- -void OEvoabFolderList::initializeRow(sal_Int32 _nColumnCount) -{ - if(!m_aRow.isValid()) - { - m_aRow = new OValueVector(_nColumnCount); - (m_aRow->get())[0].setBound(sal_True); - ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetBound(sal_False)); - } - //OSL_TRACE("OEvoabFolderList::initializeRow()::_nColumnCount = %d\n", _nColumnCount); - -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OEvoabFolderList::first( ) throw(SQLException, RuntimeException) -{ - sal_Bool bSuccess = seekRow(IResultSetHelper::FIRST); - - EVO_TRACE_STRING("OEvoabFolderList::first(): returning %s\n", ::rtl::OUString::valueOf(bSuccess) ); - return bSuccess; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OEvoabFolderList::next( ) throw(SQLException, RuntimeException) -{ - sal_Bool bSuccess = seekRow(IResultSetHelper::NEXT); - - EVO_TRACE_STRING("OEvoabFolderList::next(): returning %s\n", ::rtl::OUString::valueOf(bSuccess) ); - return bSuccess; -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OEvoabFolderList::getRow( ) throw(SQLException, RuntimeException) -{ - sal_Bool bRet = fetchRow(m_aRow,getTableColumns().getBody()); - EVO_TRACE_STRING("OEvoabFolderList::getRow()::fetchRow() = %s\n", ::rtl::OUString::valueOf(bRet) ); - - return bRet; -} diff --git a/connectivity/source/drivers/evoab/LFolderList.hxx b/connectivity/source/drivers/evoab/LFolderList.hxx deleted file mode 100644 index f850beac16ce..000000000000 --- a/connectivity/source/drivers/evoab/LFolderList.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_ -#define _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_ - -#include "connectivity/sdbcx/VColumn.hxx" -#include "connectivity/CommonTools.hxx" -#include <tools/urlobj.hxx> -#include "LTable.hxx" -#include "TResultSetHelper.hxx" - - -namespace connectivity -{ - namespace evoab - { - //================================================================== - // Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden - // Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein - //================================================================== - - class OEvoabConnection; - - class OEvoabFolderList - { - // maps a row postion to a file position - ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset - ::std::vector<sal_Int32> m_aPrecisions; // same as aboth - ::std::vector<sal_Int32> m_aScales; - QuotedTokenizedString m_aCurrentLine; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; - sal_Int32 m_nFilePos; // aktuelle IResultSetHelper::Movement - SvStream* m_pFileStream; - OEvoabConnection* m_pConnection; - ::vos::ORef<OSQLColumns> m_aColumns; - OValueRow m_aRow; - sal_Bool m_bIsNull; - - private: - void fillColumns(const ::com::sun::star::lang::Locale& _aLocale); - sal_Bool CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo); - - sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols); - sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition); - - public: - - OEvoabFolderList( OEvoabConnection* _pConnection); - - OEvoabConnection* getConnection() const { return m_pConnection;} - ::vos::ORef<OSQLColumns> getTableColumns() const {return m_aColumns;} - void construct(); // can throw any exception - static SvStream* createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode); - void initializeRow(sal_Int32 _nColumnCount); - void checkIndex(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException); - const ORowSetValue& getValue(sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException); - ::rtl::OUString SAL_CALL getString( sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getInt( sal_Int32 _nColumnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LEVOABFOLDERLIST_HXX_ - diff --git a/connectivity/source/drivers/evoab/LNoException.cxx b/connectivity/source/drivers/evoab/LNoException.cxx deleted file mode 100644 index 53d10059f87f..000000000000 --- a/connectivity/source/drivers/evoab/LNoException.cxx +++ /dev/null @@ -1,320 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LTable.hxx" -#include "LConnection.hxx" - -using namespace connectivity; -using namespace connectivity::evoab; - -//------------------------------------------------------------------ -xub_StrLen OEvoabString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const -{ - if ( !Len() ) - return 0; - - xub_StrLen nTokCount = 1; - sal_Bool bStart = sal_True; // Stehen wir auf dem ersten Zeichen im Token? - sal_Bool bInString = sal_False; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? - - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - for( xub_StrLen i = 0; i < Len(); i++ ) - { - if (bStart) - { - bStart = sal_False; - // Erstes Zeichen ein String-Delimiter? - if ((*this).GetChar(i) == cStrDel) - { - bInString = sal_True; // dann sind wir jetzt INNERHALB des Strings! - continue; // dieses Zeichen ueberlesen! - } - } - - if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) - { - if ((i+1 < Len()) && ((*this).GetChar(i+1) == cStrDel)) - { - // Verdoppeltes String-Delimiter-Zeichen: - i++; // kein String-Ende, naechstes Zeichen ueberlesen. - } - else - { - // String-Ende - bInString = sal_False; - } - } - } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( (*this).GetChar(i) == cTok ) - { - nTokCount++; - bStart = sal_True; - } - } - } - //OSL_TRACE("OEvoabString::nTokCount = %d\n", ((OUtoCStr(::rtl::OUString(nTokCount))) ? (OUtoCStr(::rtl::OUString(nTokCount))):("NULL")) ); - - return nTokCount; -} - -//------------------------------------------------------------------ -void OEvoabString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const -{ - _rStr.Erase(); - xub_StrLen nLen = Len(); - if ( nLen ) - { - sal_Bool bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? - - // Erstes Zeichen ein String-Delimiter? - if (bInString ) - ++nStartPos; // dieses Zeichen ueberlesen! - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - for( xub_StrLen i = nStartPos; i < nLen; ++i ) - { - if (bInString) - { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) - { - if ((i+1 < nLen) && ((*this).GetChar(i+1) == cStrDel)) - { - // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. - - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - else - { - // String-Ende - bInString = sal_False; - } - } - else - { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - - } - else - { - // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok - if ( (*this).GetChar(i) == cTok ) - { - // Vorzeitiger Abbruch der Schleife moeglich, denn - // wir haben, was wir wollten. - nStartPos = i+1; - break; - } - else - { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - } - } - } -} -// ----------------------------------------------------------------------------- -void OEvoabTable::refreshIndexes() -{ -} -// ----------------------------------------------------------------------------- -sal_Bool OEvoabTable::checkHeaderLine() -{ - if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine()) - { - sal_Bool bRead2; - do - { - bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); - } - while(bRead2 && !m_aCurrentLine.Len()); - - m_nFilePos = m_pFileStream->Tell(); - if (m_pFileStream->IsEof()) - return sal_False; - } - return sal_True; -} -//------------------------------------------------------------------ -sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) -{ - //OSL_TRACE("OEvoabTable::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - if ( !m_pFileStream ) - return sal_False; - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // ---------------------------------------------------------- - // Positionierung vorbereiten: - //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - m_nFilePos = nCurPos; - - switch(eCursorPosition) - { - case IResultSetHelper::FIRST: - m_nFilePos = 0; - m_nRowPos = 1; - // run through - case IResultSetHelper::NEXT: - if(eCursorPosition != IResultSetHelper::FIRST) - ++m_nRowPos; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - - m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos)); - - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - nCurPos = m_pFileStream->Tell(); - break; - case IResultSetHelper::PRIOR: - --m_nRowPos; - if(m_nRowPos > 0) - { - m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - m_nRowPos = 0; - - break; - - break; - case IResultSetHelper::LAST: - if(m_nMaxRowCount) - { - m_nFilePos = m_aRowToFilePos.rbegin()->second; - m_nRowPos = m_aRowToFilePos.rbegin()->first; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - { - while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row - // now I know all - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::RELATIVE: - if(nOffset > 0) - { - for(sal_Int32 i = 0;i<nOffset;++i) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else if(nOffset < 0) - { - for(sal_Int32 i = nOffset;i;++i) - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::ABSOLUTE: - { - if(nOffset < 0) - nOffset = m_nRowPos + nOffset; - ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset); - if(aIter != m_aRowToFilePos.end()) - { - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table - { - m_nRowPos = m_nMaxRowCount; - return sal_False; - } - else - { - aIter = m_aRowToFilePos.upper_bound(nOffset); - if(aIter == m_aRowToFilePos.end()) - { - m_nRowPos = m_aRowToFilePos.rbegin()->first; - nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second; - while(m_nRowPos != nOffset) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else - { - --aIter; - m_nRowPos = aIter->first; - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - } - } - - break; - case IResultSetHelper::BOOKMARK: - m_pFileStream->Seek(nOffset); - if (m_pFileStream->IsEof()) - return sal_False; - - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - break; - } - - //OSL_TRACE("OEvoabTable::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - return sal_True; -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab/LPreparedStatement.cxx b/connectivity/source/drivers/evoab/LPreparedStatement.cxx deleted file mode 100644 index 6312dc17a59f..000000000000 --- a/connectivity/source/drivers/evoab/LPreparedStatement.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LPreparedStatement.hxx" -#include "LResultSet.hxx" - -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::com::sun::star::uno; -// ------------------------------------------------------------------------- -OResultSet* OEvoabPreparedStatement::createResultSet() -{ - return new OEvoabResultSet(this,m_aSQLIterator); -} -// ------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,"com.sun.star.sdbc.driver.evoab.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); - diff --git a/connectivity/source/drivers/evoab/LPreparedStatement.hxx b/connectivity/source/drivers/evoab/LPreparedStatement.hxx deleted file mode 100644 index acac1989a43a..000000000000 --- a/connectivity/source/drivers/evoab/LPreparedStatement.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_ -#define _CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_ - -#include "file/FPreparedStatement.hxx" - -namespace connectivity -{ - namespace evoab - { - class OConnection; - class OEvoabPreparedStatement : public file::OPreparedStatement - { - protected: - virtual file::OResultSet* createResultSet(); - public: - OEvoabPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}; - DECLARE_SERVICE_INFO(); - }; - } -} - -#endif //_CONNECTIVITY_EVOAB_LPREPAREDSTATEMENT_HXX_ - diff --git a/connectivity/source/drivers/evoab/LResultSet.cxx b/connectivity/source/drivers/evoab/LResultSet.cxx deleted file mode 100644 index 725ea5edf736..000000000000 --- a/connectivity/source/drivers/evoab/LResultSet.cxx +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <com/sun/star/sdbcx/CompareBookmark.hpp> -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#include "LResultSet.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include <comphelper/sequence.hxx> -#include <comphelper/types.hxx> - -using namespace ::comphelper; - -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -// using namespace com::sun::star::container; -// using namespace com::sun::star::util; -//------------------------------------------------------------------------------ -OEvoabResultSet::OEvoabResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator) - : file::OResultSet(pStmt,_aSQLIterator) - ,m_bBookmarkable(sal_True) -{ - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException) -{ - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.evoab.ResultSet"); -} -// ------------------------------------------------------------------------- -Sequence< ::rtl::OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( ) throw( RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); - return aSupported; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OEvoabResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; -} -// ------------------------------------------------------------------------- -Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException) -{ - if(rType == ::getCppuType((const Reference<XDeleteRows>*)0) || rType == ::getCppuType((const Reference<XResultSetUpdate>*)0) - || rType == ::getCppuType((const Reference<XRowUpdate>*)0)) - return Any(); - - Any aRet = OResultSet::queryInterface(rType); - return aRet.hasValue() ? aRet : OEvoabResultSet_BASE::queryInterface(rType); -} -// ------------------------------------------------------------------------- -Sequence< Type > SAL_CALL OEvoabResultSet::getTypes( ) throw( RuntimeException) -{ - Sequence< Type > aTypes = OResultSet::getTypes(); - ::std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) - { - if(!(*pBegin == ::getCppuType((const Reference<XDeleteRows>*)0) || - *pBegin == ::getCppuType((const Reference<XResultSetUpdate>*)0) || - *pBegin == ::getCppuType((const Reference<XRowUpdate>*)0))) - { - aOwnTypes.push_back(*pBegin); - } - } - Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; - Sequence< Type > aRet(pTypes, aOwnTypes.size()); - return ::comphelper::concatSequences(aRet,OEvoabResultSet_BASE::getTypes()); -} - -// ------------------------------------------------------------------------- -// XRowLocate -Any SAL_CALL OEvoabResultSet::getBookmark( ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - return makeAny((sal_Int32)(m_aRow->get())[0]->getValue()); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OEvoabResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False; - - return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OEvoabResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False; - - Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False); - - return relative(rows); -} - -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OEvoabResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException) -{ - return (lhs == rhs) ? 0 : 2; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OEvoabResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OEvoabResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) -{ - return comphelper::getINT32(bookmark); -} -// ------------------------------------------------------------------------- -IPropertyArrayHelper* OEvoabResultSet::createArrayHelper( ) const -{ - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); -} -// ------------------------------------------------------------------------- -IPropertyArrayHelper & OEvoabResultSet::getInfoHelper() -{ - return *OEvoabResultSet_BASE3::getArrayHelper(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OEvoabResultSet::acquire() throw() -{ - OEvoabResultSet_BASE2::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OEvoabResultSet::release() throw() -{ - OEvoabResultSet_BASE2::release(); -} -// ----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OEvoabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) -{ - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); -} -// ----------------------------------------------------------------------------- - diff --git a/connectivity/source/drivers/evoab/LResultSet.hxx b/connectivity/source/drivers/evoab/LResultSet.hxx deleted file mode 100644 index e66431a352c3..000000000000 --- a/connectivity/source/drivers/evoab/LResultSet.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LRESULTSET_HXX_ -#define _CONNECTIVITY_EVOAB_LRESULTSET_HXX_ - -#include "file/FResultSet.hxx" -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <cppuhelper/implbase1.hxx> - -namespace connectivity -{ - namespace evoab - { - class OEvoabResultSet; - // these typedef's are only necessary for the compiler - typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XRowLocate> OEvoabResultSet_BASE; - typedef file::OResultSet OEvoabResultSet_BASE2; - typedef ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet> OEvoabResultSet_BASE3; - - - class OEvoabResultSet : public OEvoabResultSet_BASE2, - public OEvoabResultSet_BASE, - public OEvoabResultSet_BASE3 - { - sal_Bool m_bBookmarkable; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - public: - DECLARE_SERVICE_INFO(); - - OEvoabResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - - // XRowLocate - virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - }; - } -} -#endif //_CONNECTIVITY_EVOAB_LRESULTSET_HXX_ - diff --git a/connectivity/source/drivers/evoab/LServices.cxx b/connectivity/source/drivers/evoab/LServices.cxx deleted file mode 100644 index 598b7a822287..000000000000 --- a/connectivity/source/drivers/evoab/LServices.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LDriver.hxx" -#include <cppuhelper/factory.hxx> - -using namespace connectivity::evoab; -using ::rtl::OUString; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::lang::XMultiServiceFactory; - -typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* _pT - ); - -//--------------------------------------------------------------------------------------- -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - sal_Char const* pImplementationName - ) - : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - inline - sal_Bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); - } - catch(...) - { - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - -//--------------------------------------------------------------------------------------- - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL -component_getImplementationEnvironment( - const sal_Char **ppEnvTypeName, - uno_Environment ** /*ppEnv*/ - ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = 0; - if (pServiceManager) - { - ProviderRequest aReq(pServiceManager,pImplementationName); - - aReq.CREATE_PROVIDER( - OEvoabDriver::getImplementationName_Static(), - OEvoabDriver::getSupportedServiceNames_Static(), - OEvoabDriver_CreateInstance, ::cppu::createSingleFactory) - ; - - if(aReq.xRet.is()) - aReq.xRet->acquire(); - - pRet = aReq.getProvider(); - } - - return pRet; -}; - diff --git a/connectivity/source/drivers/evoab/LStatement.cxx b/connectivity/source/drivers/evoab/LStatement.cxx deleted file mode 100644 index ed905d29f6cd..000000000000 --- a/connectivity/source/drivers/evoab/LStatement.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LStatement.hxx" -#include "LResultSet.hxx" - -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace com::sun::star::uno; -// ------------------------------------------------------------------------- -OResultSet* OEvoabStatement::createResultSet() -{ - return new OEvoabResultSet(this,m_aSQLIterator); -} -// ------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO(OEvoabStatement,"com.sun.star.sdbc.driver.evoab.Statement","com.sun.star.sdbc.Statement"); - diff --git a/connectivity/source/drivers/evoab/LStatement.hxx b/connectivity/source/drivers/evoab/LStatement.hxx deleted file mode 100644 index cd8af47d6e25..000000000000 --- a/connectivity/source/drivers/evoab/LStatement.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LSTATEMENT_HXX_ -#define _CONNECTIVITY_EVOAB_LSTATEMENT_HXX_ - -#include "file/FStatement.hxx" - -namespace connectivity -{ - namespace evoab - { - class OConnection; - class OEvoabStatement : public file::OStatement - { - protected: - virtual file::OResultSet* createResultSet(); - public: - OEvoabStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; - } -} - -#endif //_CONNECTIVITY_EVOAB_LSTATEMENT_HXX_ diff --git a/connectivity/source/drivers/evoab/LTable.cxx b/connectivity/source/drivers/evoab/LTable.cxx deleted file mode 100644 index 6270b0a135c7..000000000000 --- a/connectivity/source/drivers/evoab/LTable.cxx +++ /dev/null @@ -1,866 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <ctype.h> -#include "LTable.hxx" -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/ucb/XContentAccess.hpp> -#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_ -//#include <com/sun/star/sdbc/XRow.hpp> -#endif -#include <svl/converter.hxx> -#include "LConnection.hxx" -#include "LColumns.hxx" -#include <osl/thread.h> -#include <tools/config.hxx> -#include <comphelper/sequence.hxx> -#include <svl/zforlist.hxx> -#include <rtl/math.hxx> -#include <stdio.h> //sprintf -#include <comphelper/extract.hxx> -#include <comphelper/numbers.hxx> -#include "LDriver.hxx" -#include <com/sun/star/util/NumberFormat.hpp> -#include <unotools/configmgr.hxx> -#include <i18npool/mslangid.hxx> -#include "connectivity/dbconversion.hxx" -#include <comphelper/types.hxx> -#include <unotools/syslocale.hxx> -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX -#include "LDebug.hxx" -#endif -#include <map> - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::cppu; -using namespace utl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -// ------------------------------------------------------------------------- -void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) -{ - sal_Bool bRead = sal_True; - - QuotedTokenizedString aHeaderLine; - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - if (pConnection->isHeaderLine()) - { - while(bRead && !aHeaderLine.Len()) - { - bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,pConnection->getTextEncoding()); - } - } - - // read first row - QuotedTokenizedString aFirstLine; - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); - - if (!pConnection->isHeaderLine() || !aHeaderLine.Len()) - { - while(bRead && !aFirstLine.Len()) - { - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); - } - // use first row as headerline because we need the number of columns - aHeaderLine = aFirstLine; - } - // column count - xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - - if(!m_aColumns.isValid()) - m_aColumns = new OSQLColumns(); - else - m_aColumns->get().clear(); - - m_aTypes.clear(); - m_aPrecisions.clear(); - m_aScales.clear(); - // reserve some space - m_aColumnRawNames.reserve(nFieldCount); - m_aColumns->get().reserve(nFieldCount); - m_aTypes.reserve(nFieldCount); - m_aPrecisions.reserve(nFieldCount); - m_aScales.reserve(nFieldCount); - - sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); - CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); - // read description - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); - String aColumnName; - ::rtl::OUString aTypeName; - ::comphelper::UStringMixEqual aCase(bCase); - xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens - xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens - xub_StrLen nStartPosFirstLine2 = 0; - for (xub_StrLen i = 0; i < nFieldCount; i++) - { - if (pConnection->isHeaderLine()) - { - aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - } - else - { - // no column name so ... - aColumnName = 'C'; - aColumnName += String::CreateFromInt32(i+1); - } - //OSL_TRACE("OEvoabTable::aColumnName = %s\n", ((OUtoCStr(::rtl::OUString(aColumnName))) ? (OUtoCStr(::rtl::OUString(aColumnName))):("NULL")) ); - - sal_Int32 eType; - sal_uInt16 nPrecision = 0; - sal_uInt16 nScale = 0; - - sal_Bool bNumeric = sal_False; - sal_uIntPtr nIndex = 0; - - // first without fielddelimiter - String aField; - aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,pConnection->getFieldDelimiter(),'\0'); - //OSL_TRACE("OEvoabTable::aField = %s\n", ((OUtoCStr(::rtl::OUString(aField))) ? (OUtoCStr(::rtl::OUString(aField))):("NULL")) ); - - if (aField.Len() == 0 || - (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0))) - { - bNumeric = sal_False; - } - else - { - String aField2; - if ( pConnection->getStringDelimiter() != '\0' ) - aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - else - aField2 = aField; - - //OSL_TRACE("OEvoabTable::aField2 = %s\n", ((OUtoCStr(::rtl::OUString(aField2))) ? (OUtoCStr(::rtl::OUString(aField2))):("NULL")) ); - - if (aField2.Len() == 0) - { - bNumeric = sal_False; - } - else - { - bNumeric = sal_True; - xub_StrLen nDot = 0; - for (xub_StrLen j = 0; j < aField2.Len(); j++) - { - sal_Unicode c = aField2.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if ((!cDecimalDelimiter || c != cDecimalDelimiter) && - (!cThousandDelimiter || c != cThousandDelimiter) && - !aCharClass.isDigit(aField2,j)) - { - bNumeric = sal_False; - break; - } - if (cDecimalDelimiter && c == cDecimalDelimiter) - { - nPrecision = 15; // we have an decimal value - nScale = 2; - nDot++; - } - } - - if (nDot > 1) // if there is more than one dot it isn't a number - bNumeric = sal_False; - if (bNumeric && cThousandDelimiter) - { - // Ist der Trenner richtig angegeben? - String aValue = aField2.GetToken(0,cDecimalDelimiter); - for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) - { - sal_Unicode c = aValue.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if (c == cThousandDelimiter && j) - continue; - else - { - bNumeric = sal_False; - break; - } - } - } - - // jetzt koennte es noch ein Datumsfeld sein - if (!bNumeric) - { - try - { - nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2); - } - catch(Exception&) - { - } - } - } - } - - sal_Int32 nFlags = 0; - if (bNumeric) - { - if (cDecimalDelimiter) - { - if(nPrecision) - { - eType = DataType::DECIMAL; - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); - } - else - { - eType = DataType::DOUBLE; - aTypeName = ::rtl::OUString::createFromAscii("DOUBLE"); - } - } - else - eType = DataType::INTEGER; - nFlags = ColumnSearch::BASIC; - } - else - { - - switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex)) - { - case NUMBERFORMAT_DATE: - eType = DataType::DATE; - aTypeName = ::rtl::OUString::createFromAscii("DATE"); - break; - case NUMBERFORMAT_DATETIME: - eType = DataType::TIMESTAMP; - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); - break; - case NUMBERFORMAT_TIME: - eType = DataType::TIME; - aTypeName = ::rtl::OUString::createFromAscii("TIME"); - break; - default: - eType = DataType::VARCHAR; - nPrecision = 0; // nyi: Daten koennen aber laenger sein! - nScale = 0; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); - }; - nFlags |= ColumnSearch::CHAR; - } - - // check if the columname already exists - String aAlias(aColumnName); - OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); - sal_Int32 nExprCnt = 0; - while(aFind != m_aColumns->get().end()) - { - (aAlias = aColumnName) += String::CreateFromInt32(++nExprCnt); - aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); - } - - m_aColumnRawNames.push_back(::rtl::OUString(aAlias)); - - //~ sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(), - //~ ColumnValue::NULLABLE, - //~ nPrecision, - //~ nScale, - //~ eType, - //~ sal_False, - //~ sal_False, - //~ sal_False, - //~ bCase); - //~ Reference< XPropertySet> xCol = pColumn; - //~ m_aColumns->push_back(xCol); - m_aTypes.push_back(eType); - m_aPrecisions.push_back(nPrecision); - m_aScales.push_back(nScale); - } - setColumnAliases(); - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); -} -// ------------------------------------------------------------------------- -OEvoabTable::OEvoabTable(sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection) : OEvoabTable_BASE(_pTables,_pConnection) -{ - -} -// ------------------------------------------------------------------------- -OEvoabTable::OEvoabTable(sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection, - const ::rtl::OUString& _Name, - const ::rtl::OUString& _Type, - const ::rtl::OUString& _Description , - const ::rtl::OUString& _SchemaName, - const ::rtl::OUString& _CatalogName - ) : OEvoabTable_BASE(_pTables,_pConnection,_Name, - _Type, - _Description, - _SchemaName, - _CatalogName) - ,m_nRowPos(0) - ,m_nMaxRowCount(0) -{ - //~ OSL_TRACE("OEvoabTable::(in constructor)_Name = %s\n", ((OUtoCStr(_Name)) ? (OUtoCStr(_Name)):("NULL")) ); - //~ OSL_TRACE("OEvoabTable::(in constructor)_Type = %s\n", ((OUtoCStr(_Type)) ? (OUtoCStr(_Type)):("NULL")) ); - //~ OSL_TRACE("OEvoabTable::(in constructor)_Description = %s\n", ((OUtoCStr(_Description)) ? (OUtoCStr(_Description)):("NULL")) ); - //~ OSL_TRACE("OEvoabTable::(in constructor)_SchemaName = %s\n", ((OUtoCStr(_SchemaName)) ? (OUtoCStr(_SchemaName)):("NULL")) ); - //~ OSL_TRACE("OEvoabTable::(in constructor)_CatalogName = %s\n", ((OUtoCStr(_CatalogName)) ? (OUtoCStr(_CatalogName)):("NULL")) ); -} -// ----------------------------------------------------------------------------- -void OEvoabTable::construct() -{ - SvtSysLocale aLocale; - ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale()); - Sequence< ::com::sun::star::uno::Any > aArg(1); - aArg[0] <<= aAppLocale; - - Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); - m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); - m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); - - INetURLObject aURL; - aURL.SetURL(getEntry()); - - if(aURL.getExtension() != rtl::OUString(m_pConnection->getExtension())) - aURL.setExtension(m_pConnection->getExtension()); - - String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); - - m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); - - if(!m_pFileStream) - m_pFileStream = createStream_simpleError( aFileName,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE); - - if(m_pFileStream) - { - OSL_TRACE("OEvoabTable::construct()::m_pFileStream created\n" ); - m_pFileStream->Seek(STREAM_SEEK_TO_END); - sal_Int32 nSize = m_pFileStream->Tell(); - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - - // Buffersize abhaengig von der Filegroesse - m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : - nSize > 100000 ? 16384 : - nSize > 10000 ? 4096 : 1024); - OSL_TRACE("OEvoabTable::construct()::m_pFileStream->Tell() = %d\n", nSize ); - - fillColumns(aAppLocale); - - refreshColumns(); - } -} -// ------------------------------------------------------------------------- -String OEvoabTable::getEntry() -{ - ::rtl::OUString sURL; - try - { - Reference< XResultSet > xDir = m_pConnection->getDir()->getStaticResultSet(); - Reference< XRow> xRow(xDir,UNO_QUERY); - ::rtl::OUString sName; - ::rtl::OUString sExt; - - INetURLObject aURL; - xDir->beforeFirst(); - static const ::rtl::OUString s_sSeparator(RTL_CONSTASCII_USTRINGPARAM("/")); - while(xDir->next()) - { - sName = xRow->getString(1); - aURL.SetSmartProtocol(INET_PROT_FILE); - String sUrl = m_pConnection->getURL() + s_sSeparator + sName; - aURL.SetSmartURL( sUrl ); - - // cut the extension - sExt = aURL.getExtension(); - - // name and extension have to coincide - if ( m_pConnection->matchesExtension( sExt ) ) - { - sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString()); - if ( sName == m_Name ) - { - Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); - sURL = xContentAccess->queryContentIdentifierString(); - break; - } - } - } - xDir->beforeFirst(); // move back to before first record - } - catch(Exception&) - { - OSL_ASSERT(0); - } - return sURL.getStr(); -} -// ------------------------------------------------------------------------- -void OEvoabTable::refreshColumns() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - TStringVector aVector; - aVector.reserve(m_aColumns->get().size()); - - for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter) - aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName()); - - if(m_pColumns) - m_pColumns->reFill(aVector); - else - m_pColumns = new OEvoabColumns(this,m_aMutex,aVector); - - OSL_TRACE("OEvoabTable::refreshColumns()::end\n" ); -} - -// ------------------------------------------------------------------------- -void SAL_CALL OEvoabTable::disposing(void) -{ - OFileTable::disposing(); - ::osl::MutexGuard aGuard(m_aMutex); - m_aColumns = NULL; -} -// ------------------------------------------------------------------------- -Sequence< Type > SAL_CALL OEvoabTable::getTypes( ) throw(RuntimeException) -{ - Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); - ::std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) - { - if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) || - *pBegin == ::getCppuType((const Reference<XRename>*)0) || - *pBegin == ::getCppuType((const Reference<XIndexesSupplier>*)0) || - *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) || - *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))) - { - aOwnTypes.push_back(*pBegin); - } - } - Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; - return Sequence< Type >(pTypes, aOwnTypes.size()); -} - -// ------------------------------------------------------------------------- -Any SAL_CALL OEvoabTable::queryInterface( const Type & rType ) throw(RuntimeException) -{ - if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || - rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) || - rType == ::getCppuType((const Reference<XRename>*)0) || - rType == ::getCppuType((const Reference<XAlterTable>*)0) || - rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) - return Any(); - - Any aRet = OTable_TYPEDEF::queryInterface(rType); - return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); -} - -//-------------------------------------------------------------------------- -Sequence< sal_Int8 > OEvoabTable::getUnoTunnelImplementationId() -{ - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} - -// com::sun::star::lang::XUnoTunnel -//------------------------------------------------------------------ -sal_Int64 OEvoabTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) -{ - return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - ? reinterpret_cast< sal_Int64 >( this ) - : OEvoabTable_BASE::getSomething(rId); -} -//------------------------------------------------------------------ -sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData) -{ - *(_rRow->get())[0] = m_nFilePos; - - if (!bRetrieveData) - return sal_True; - - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // Felder: - xub_StrLen nStartPos = 0; - String aStr; - OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); - for (sal_Int32 i = 0; aIter != _rCols.get().end();++aIter, ++i) - { - m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); - //OSL_TRACE("OEvoabTable::fetchRow()::aStr = %s\n", ((OUtoCStr(::rtl::OUString(aStr))) ? (OUtoCStr(::rtl::OUString(aStr))):("NULL")) ); - - if (aStr.Len() == 0) - (_rRow->get())[i+1]->setNull(); - else - { - // Laengen je nach Datentyp: - sal_Int32 nLen, - nType = 0; - if(bIsTable) - { - nLen = m_aPrecisions[i]; - nType = m_aTypes[i]; - } - else - { - Reference< XPropertySet> xColumn = *aIter; - xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen; - xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; - } - switch(nType) - { - case DataType::TIMESTAMP: - case DataType::DATE: - case DataType::TIME: - { - double nRes = 0.0; - try - { - nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); - Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); - com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; - - switch(nType) - { - case DataType::DATE: - *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate)); - break; - case DataType::TIMESTAMP: - *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate)); - break; - default: - *(_rRow->get())[i+1] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes)); - } - } - catch(Exception&) - { - (_rRow->get())[i+1]->setNull(); - } - } break; - case DataType::DOUBLE: - case DataType::INTEGER: - case DataType::DECIMAL: // #99178# OJ - case DataType::NUMERIC: - { - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); - String aStrConverted; - - OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || - !cDecimalDelimiter && nType == DataType::INTEGER, - "FalscherTyp"); - - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: - for (xub_StrLen j = 0; j < aStr.Len(); ++j) - { - if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) - aStrConverted += '.'; - else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it - break; // #99189# OJ - else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) - { - // weglassen - } - else - aStrConverted += aStr.GetChar(j) ; - } - double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL); - - // #99178# OJ - if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) - *(_rRow->get())[i+1] = ORowSetValue(String::CreateFromDouble(nVal)); - else - *(_rRow->get())[i+1] = nVal; - } break; - - default: - { - // Wert als String in Variable der Row uebernehmen - *(_rRow->get())[i+1] = ORowSetValue(aStr); - } - break; - } - } - } - return sal_True; -} -// ----------------------------------------------------------------------------- -sal_Bool OEvoabTable::setColumnAliases() -{ - - size_t nSize = m_aColumnRawNames.size(); - if(nSize == 0 || m_aPrecisions.size() != nSize || m_aScales.size() != nSize || m_aTypes.size() != nSize) - return sal_False; - m_aColumns->get().clear(); - m_aColumns->get().reserve(nSize); - ::rtl::OUString aColumnReadName; - ::rtl::OUString aColumnHeadlineName; - ::rtl::OUString aColumnDisplayName; - ::rtl::OUString aColumnFinalName; - String sColumnFinalName; - - const TStringVector& colAliasNames = ((OEvoabConnection*)m_pConnection)->getColumnAlias().getAlias(); - const ::std::map< ::rtl::OUString, ::rtl::OUString > & colMap = ((OEvoabConnection*)m_pConnection)->getColumnAlias().getAliasMap(); - ::osl::MutexGuard aGuard( m_aMutex ); - - for(size_t i = 0;i < nSize; ++i) - { - aColumnReadName = m_aColumnRawNames[i]; - //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnReadName = %s\n", ((OUtoCStr(aColumnReadName)) ? (OUtoCStr(aColumnReadName)):("NULL")) ); - sal_Bool bFound = sal_False; - for ( size_t j = 0; j < colAliasNames.size(); ++j ) - { - aColumnDisplayName = colAliasNames[j]; - - ::std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator aPos = colMap.find( aColumnDisplayName ); - if ( colMap.end() != aPos ) - { - aColumnHeadlineName = aPos->second; - EVO_TRACE_STRING( "OEvoabTable::getColumnRows()::aColumnDisplayName = %s\n", aColumnDisplayName ); - EVO_TRACE_STRING( "OEvoabTable::getColumnRows()::aColumnHeadlineName= %s\n", aColumnHeadlineName ); - if(aColumnReadName == aColumnHeadlineName) - { - //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnHeadlineName = %s\n", ((OUtoCStr(aColumnHeadlineName)) ? (OUtoCStr(aColumnHeadlineName)):("NULL")) ); - //OSL_TRACE("OEvoabTable::getColumnRows()::aColumnDisplayName = %s\n", ((OUtoCStr(aColumnDisplayName)) ? (OUtoCStr(aColumnDisplayName)):("NULL")) ); - aColumnFinalName = aColumnDisplayName; - bFound = sal_True; - //OSL_TRACE("OEvoabTable::getColumnRows()::j = %d\n", j ); - - break; - } - } - else - OSL_ENSURE( sal_False, "OEvoabTable::setColumnAliases: did not find one of the aliases!" ); - } - if(!bFound) - aColumnFinalName = aColumnReadName; - sColumnFinalName = aColumnFinalName; - - sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); - ::rtl::OUString aTypeName; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); - sdbcx::OColumn* pColumn = new sdbcx::OColumn(sColumnFinalName,aTypeName,::rtl::OUString(), - ColumnValue::NULLABLE, - m_aPrecisions[i], - m_aScales[i], - m_aTypes[i], - sal_False, - sal_False, - sal_False, - bCase); - Reference< XPropertySet> xCol = pColumn; - m_aColumns->get().push_back(xCol); - } - return sal_True; -} -// ----------------------------------------------------------------------------- -void OEvoabTable::refreshIndexes() -{ -} -// ----------------------------------------------------------------------------- -sal_Bool OEvoabTable::checkHeaderLine() -{ - if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine()) - { - sal_Bool bRead2; - do - { - bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); - } - while(bRead2 && !m_aCurrentLine.Len()); - - m_nFilePos = m_pFileStream->Tell(); - if (m_pFileStream->IsEof()) - return sal_False; - } - return sal_True; -} -//------------------------------------------------------------------ -sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) -{ - //OSL_TRACE("OEvoabTable::(before SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - if ( !m_pFileStream ) - return sal_False; - OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // ---------------------------------------------------------- - // Positionierung vorbereiten: - //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - m_nFilePos = nCurPos; - - switch(eCursorPosition) - { - case IResultSetHelper::FIRST: - m_nFilePos = 0; - m_nRowPos = 1; - // run through - case IResultSetHelper::NEXT: - if(eCursorPosition != IResultSetHelper::FIRST) - ++m_nRowPos; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - - m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos)); - - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - nCurPos = m_pFileStream->Tell(); - break; - case IResultSetHelper::PRIOR: - --m_nRowPos; - if(m_nRowPos > 0) - { - m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - m_nRowPos = 0; - - break; - case IResultSetHelper::LAST: - if(m_nMaxRowCount) - { - m_nFilePos = m_aRowToFilePos.rbegin()->second; - m_nRowPos = m_aRowToFilePos.rbegin()->first; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - { - while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row - // now I know all - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::RELATIVE: - if(nOffset > 0) - { - for(sal_Int32 i = 0;i<nOffset;++i) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else if(nOffset < 0) - { - for(sal_Int32 i = nOffset;i;++i) - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::ABSOLUTE: - { - if(nOffset < 0) - nOffset = m_nRowPos + nOffset; - ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset); - if(aIter != m_aRowToFilePos.end()) - { - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table - { - m_nRowPos = m_nMaxRowCount; - return sal_False; - } - else - { - aIter = m_aRowToFilePos.upper_bound(nOffset); - if(aIter == m_aRowToFilePos.end()) - { - m_nRowPos = m_aRowToFilePos.rbegin()->first; - nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second; - while(m_nRowPos != nOffset) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else - { - --aIter; - m_nRowPos = aIter->first; - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - } - } - - break; - case IResultSetHelper::BOOKMARK: - m_pFileStream->Seek(nOffset); - if (m_pFileStream->IsEof()) - return sal_False; - - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - break; - } - - //OSL_TRACE("OEvoabTable::(after SeekRow)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); - - return sal_True; -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab/LTable.hxx b/connectivity/source/drivers/evoab/LTable.hxx deleted file mode 100644 index 37c5017e98fb..000000000000 --- a/connectivity/source/drivers/evoab/LTable.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LTABLE_HXX_ -#define _CONNECTIVITY_EVOAB_LTABLE_HXX_ - -#include "file/FTable.hxx" -#include "connectivity/sdbcx/VColumn.hxx" -#include "connectivity/CommonTools.hxx" -#include <tools/urlobj.hxx> -#include "file/quotedstring.hxx" -#include <vector> - -namespace connectivity -{ - namespace evoab - { - typedef file::OFileTable OEvoabTable_BASE; - class OEvoabConnection; - - typedef ::std::map< ::rtl::OUString, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer; - - class OEvoabTable : public OEvoabTable_BASE - { - private: - // maps a row postion to a file position - ::std::map<sal_Int32,sal_Int32> m_aRowToFilePos; - ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset - ::std::vector<sal_Int32> m_aPrecisions; // same as aboth - ::std::vector<sal_Int32> m_aScales; - QuotedTokenizedString m_aCurrentLine; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; - sal_Int32 m_nRowPos; - sal_Int32 m_nMaxRowCount; // will be set if stream is once eof - ::std::vector< ::rtl::OUString> m_aColumnRawNames; - sal_Bool setColumnAliases(); - void fillColumns(const ::com::sun::star::lang::Locale& _aLocale); - sal_Bool checkHeaderLine(); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName); - - public: - virtual void refreshColumns(); - virtual void refreshIndexes(); - - public: - // DECLARE_CTY_DEFAULTS( OFlatTable_BASE); - OEvoabTable( sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection); - OEvoabTable( sdbcx::OCollection* _pTables,OEvoabConnection* _pConnection, - const ::rtl::OUString& _Name, - const ::rtl::OUString& _Type, - const ::rtl::OUString& _Description = ::rtl::OUString(), - const ::rtl::OUString& _SchemaName = ::rtl::OUString(), - const ::rtl::OUString& _CatalogName = ::rtl::OUString() - ); - - void construct(); // can throw any exception - - virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); - virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData); - - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL disposing(void); - - // com::sun::star::lang::XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); - - String getEntry(); - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LTABLE_HXX_ - diff --git a/connectivity/source/drivers/evoab/LTables.cxx b/connectivity/source/drivers/evoab/LTables.cxx deleted file mode 100644 index 3b3e4215d723..000000000000 --- a/connectivity/source/drivers/evoab/LTables.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "LTables.hxx" -#include "LTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include "file/FCatalog.hxx" -#include "file/FConnection.hxx" -#include <comphelper/types.hxx> - -using namespace connectivity; -using namespace ::comphelper; -using namespace connectivity::evoab; -using namespace connectivity::file; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::container; -namespace starutil = ::com::sun::star::util; - -sdbcx::ObjectType OEvoabTables::createObject(const ::rtl::OUString& _rName) -{ - OEvoabTable* pRet = new OEvoabTable(this,(OEvoabConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), - _rName,::rtl::OUString::createFromAscii("TABLE")); - sdbcx::ObjectType xRet = pRet; - pRet->construct(); - return xRet; -} -// ------------------------------------------------------------------------- - diff --git a/connectivity/source/drivers/evoab/LTables.hxx b/connectivity/source/drivers/evoab/LTables.hxx deleted file mode 100644 index 10f00aee9ab1..000000000000 --- a/connectivity/source/drivers/evoab/LTables.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_EVOAB_LTABLES_HXX_ -#define _CONNECTIVITY_EVOAB_LTABLES_HXX_ - -#include "file/FTables.hxx" - -namespace connectivity -{ - namespace evoab - { - // namespace ::com::sun::star::sdbcx = ::com::sun::star::sdbcx; - typedef file::OTables OEvoabTables_BASE; - - class OEvoabTables : public OEvoabTables_BASE - { - protected: - virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); - public: - OEvoabTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const TStringVector &_rVector) : OEvoabTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) - {} - }; - } -} -#endif // _CONNECTIVITY_EVOAB_LTABLES_HXX_ - diff --git a/connectivity/source/drivers/evoab/evoab.xcu b/connectivity/source/drivers/evoab/evoab.xcu deleted file mode 100644 index 68c297b096a3..000000000000 --- a/connectivity/source/drivers/evoab/evoab.xcu +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed"> - <node oor:name="sdbc:address:evolution:ldap" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Evolution LDAP</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Groupwise</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/drivers/evoab/evoab.xml b/connectivity/source/drivers/evoab/evoab.xml deleted file mode 100644 index b52c0556956f..000000000000 --- a/connectivity/source/drivers/evoab/evoab.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd"> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> -<module-description> - <module-name>file</module-name> - <component-description> - <author>Xibei(Berry) Jia</author> - <name>com.sun.star.comp.sdbc.evoab.OEvoabDriver</name> - <description>This library implements the database driver for evolution address book formats. -</description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service>com.sun.star.sdbc.Driver</supported-service> - <supported-service>com.sun.star.sdbcx.Driver</supported-service> - <service-dependency> ... </service-dependency> - </component-description> - <project-build-dependency>cppuhelper</project-build-dependency> - <project-build-dependency>cppu</project-build-dependency> - <project-build-dependency>sal</project-build-dependency> - <project-build-dependency>vos</project-build-dependency> - <runtime-module-dependency>file</runtime-module-dependency> - <runtime-module-dependency>cppuhelper</runtime-module-dependency> - <runtime-module-dependency>cppu</runtime-module-dependency> - <runtime-module-dependency>sal</runtime-module-dependency> - <runtime-module-dependency>vos</runtime-module-dependency> - <runtime-module-dependency>osl</runtime-module-dependency> - <runtime-module-dependency>svtools-light1</runtime-module-dependency> - <runtime-module-dependency>svtools</runtime-module-dependency> - <runtime-module-dependency>ucbhelper</runtime-module-dependency> - <runtime-module-dependency>dbtools</runtime-module-dependency> - <runtime-module-dependency>unotools</runtime-module-dependency> - <runtime-module-dependency>comphelper</runtime-module-dependency> -</module-description> diff --git a/connectivity/source/drivers/evoab/exports.dxp b/connectivity/source/drivers/evoab/exports.dxp deleted file mode 100644 index f0e1c69934bc..000000000000 --- a/connectivity/source/drivers/evoab/exports.dxp +++ /dev/null @@ -1,2 +0,0 @@ -component_getImplementationEnvironment -component_getFactory diff --git a/connectivity/source/drivers/evoab/makefile.mk b/connectivity/source/drivers/evoab/makefile.mk deleted file mode 100644 index 734a55a91b07..000000000000 --- a/connectivity/source/drivers/evoab/makefile.mk +++ /dev/null @@ -1,100 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=..$/..$/.. -PRJINC=..$/.. -PRJNAME=connectivity -TARGET=evoab - -VISIBILITY_HIDDEN=TRUE - -# --- Settings ---------------------------------- -.IF "$(DBGUTIL_OJ)"!="" -ENVCFLAGS+=/FR$(SLO)$/ -.ENDIF - -.INCLUDE : $(PRJ)$/version.mk -.INCLUDE : $(PRJ)$/makefile.pmk - -.IF "$(GUI)"=="UNX" - -# --- Files ------------------------------------- - -EXCEPTIONSFILES=\ - $(SLO)$/LResultSet.obj \ - $(SLO)$/LStatement.obj \ - $(SLO)$/LPreparedStatement.obj \ - $(SLO)$/LFolderList.obj \ - $(SLO)$/LConfigAccess.obj \ - $(SLO)$/LColumnAlias.obj \ - $(SLO)$/LTable.obj \ - $(SLO)$/LDatabaseMetaData.obj \ - $(SLO)$/LCatalog.obj \ - $(SLO)$/LColumns.obj \ - $(SLO)$/LTables.obj \ - $(SLO)$/LConnection.obj \ - $(SLO)$/LServices.obj \ - $(SLO)$/LDriver.obj - -SLOFILES=\ - $(EXCEPTIONSFILES) \ - $(SLO)$/LDebug.obj - - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - - -# --- Library ----------------------------------- -#SHL1TARGET=$(TARGET)$(DLLPOSTFIX) -SHL1TARGET= $(EVOAB_TARGET)$(DLLPOSTFIX) -SHL1OBJS=$(SLOFILES) -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(VOSLIB) \ - $(TOOLSLIB) \ - $(SVTOOLLIB) \ - $(UNOTOOLSLIB) \ - $(UCBHELPERLIB) \ - $(SALLIB) \ - $(DBTOOLSLIB) \ - $(DBFILELIB) \ - $(COMPHELPERLIB) - -.IF "$(DBFILELIB)" == "" -SHL1STDLIBS+= ifile.lib -.ENDIF - -SHL1DEPN= -SHL1IMPLIB= i$(TARGET) - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) - -.ELSE -dummy: - @echo "Nothing to build for GUI $(GUI)" -.ENDIF -# --- Targets ---------------------------------- -.INCLUDE : $(PRJ)$/target.pmk diff --git a/connectivity/source/drivers/evoab2/NCatalog.hxx b/connectivity/source/drivers/evoab2/NCatalog.hxx index 2b62b6f792ba..145c726b7d1e 100644 --- a/connectivity/source/drivers/evoab2/NCatalog.hxx +++ b/connectivity/source/drivers/evoab2/NCatalog.hxx @@ -48,5 +48,5 @@ namespace connectivity }; } } -#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_ +#endif // _CONNECTIVITY_EVOAB_CATALOG_HXX_ diff --git a/connectivity/source/drivers/mozab/MCatalog.cxx b/connectivity/source/drivers/mozab/MCatalog.cxx deleted file mode 100644 index 4f510773f323..000000000000 --- a/connectivity/source/drivers/mozab/MCatalog.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MCatalog.hxx" -#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_ -#include "MConnection.hxx" -#endif -#include "MTables.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <cppuhelper/interfacecontainer.h> - -// ------------------------------------------------------------------------- -using namespace connectivity::mozab; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace ::cppu; - -// ------------------------------------------------------------------------- -OCatalog::OCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) - ,m_pConnection(_pCon) - ,m_xMetaData(m_pConnection->getMetaData( )) -{ -// osl_incrementInterlockedCount( &m_refCount ); -// refreshTables(); -// refreshViews(); -// refreshGroups(); -// refreshUsers(); -// osl_decrementInterlockedCount( &m_refCount ); -} -// ------------------------------------------------------------------------- -void OCatalog::refreshTables() -{ - TStringVector aVector; - Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")); - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - ::rtl::OUString aName; - while(xResult->next()) - { - aName = xRow->getString(3); - aVector.push_back(aName); - } - } - if(m_pTables) - m_pTables->reFill(aVector); - else - m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector); -} -// ------------------------------------------------------------------------- -void OCatalog::refreshViews() -{ -} -// ------------------------------------------------------------------------- -void OCatalog::refreshGroups() -{ -} -// ------------------------------------------------------------------------- -void OCatalog::refreshUsers() -{ -} -// ------------------------------------------------------------------------- -const ::rtl::OUString& OCatalog::getDot() -{ - static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".")); - return sDot; -} -// ----------------------------------------------------------------------------- - -// XTablesSupplier -Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(rBHelper.bDisposed); - - try - { - if(!m_pTables || m_pConnection->getForceLoadTables()) - refreshTables(); - } - catch( const RuntimeException& ) - { - // allowed to leave this method - throw; - } - catch( const Exception& ) - { - // allowed - } - - return const_cast<OCatalog*>(this)->m_pTables; -} diff --git a/connectivity/source/drivers/mozab/MCatalog.hxx b/connectivity/source/drivers/mozab/MCatalog.hxx deleted file mode 100644 index cc642c7cea52..000000000000 --- a/connectivity/source/drivers/mozab/MCatalog.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_ -#define _CONNECTIVITY_MOZAB_CATALOG_HXX_ - -#include "connectivity/sdbcx/VCatalog.hxx" -// #ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ -// #include "odbc/OFunctiondefs.hxx" -// #endif - -namespace connectivity -{ - namespace mozab - { - // please don't name the class the same name as in an other namespaces - // some compilers have problems with this task as I noticed on windows - class OConnection; - class OCatalog : public connectivity::sdbcx::OCatalog - { - OConnection* m_pConnection; // used to get the metadata - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier - - public: - // implementation of the pure virtual methods - virtual void refreshTables(); - virtual void refreshViews() ; - virtual void refreshGroups(); - virtual void refreshUsers() ; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException); - public: - OCatalog(OConnection* _pCon); - - OConnection* getConnection() const { return m_pConnection; } - sdbcx::OCollection* getPrivateTables() const { return m_pTables;} - sdbcx::OCollection* getPrivateViews() const { return m_pViews; } - - static const ::rtl::OUString& getDot(); - }; - } -} -#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_ - diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx deleted file mode 100644 index cbd87afe3203..000000000000 --- a/connectivity/source/drivers/mozab/MColumnAlias.cxx +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MColumnAlias.hxx" -#include "MConnection.hxx" -#include "MExtConfigAccess.hxx" - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> - -#include <tools/diagnose_ex.h> - -#include <algorithm> -#include <functional> - -using namespace ::connectivity; -using namespace ::connectivity::mozab; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; - -//------------------------------------------------------------------------------ -OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ) -{ - static const sal_Char* s_pProgrammaticNames[] = - { - "FirstName", - "LastName", - "DisplayName", - "NickName", - "PrimaryEmail", - "SecondEmail", - "PreferMailFormat", - "WorkPhone", - "HomePhone", - "FaxNumber", - "PagerNumber", - "CellularNumber", - "HomeAddress", - "HomeAddress2", - "HomeCity", - "HomeState", - "HomeZipCode", - "HomeCountry", - "WorkAddress", - "WorkAddress2", - "WorkCity", - "WorkState", - "WorkZipCode", - "WorkCountry", - "JobTitle", - "Department", - "Company", - "WebPage1", - "WebPage2", - "BirthYear", - "BirthMonth", - "BirthDay", - "Custom1", - "Custom2", - "Custom3", - "Custom4", - "Notes", - }; - - for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i ) - m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i ); - - initialize( _rxORB ); -} - -//------------------------------------------------------------------------------ -void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ) -{ - // open our driver settings config node - - // the config path for our own driver's settings - Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB ); - if ( xDriverNode.is() ) - { - try - { - //............................................................. - Reference< XNameAccess > xAliasesNode; - xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xAliasesNode; - OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" ); - - // this is a set of string nodes - Sequence< ::rtl::OUString > aProgrammaticNames; - if ( xAliasesNode.is() ) - aProgrammaticNames = xAliasesNode->getElementNames(); - - //............................................................. - // travel through all the set elements - const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray(); - const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength(); - ::rtl::OUString sAssignedAlias; - - for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames ) - { - OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias ); - - // normalize in case the config data is corrupted - // (what we really don't need is an empty alias ...) - if ( 0 == sAssignedAlias.getLength() ) - sAssignedAlias = *pProgrammaticNames; - - ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) ); - //............................................................. - #if OSL_DEBUG_LEVEL > 0 - bool bFound = false; - #endif - for ( AliasMap::iterator search = m_aAliasMap.begin(); - ( search != m_aAliasMap.end() ); - ++search - ) - { - if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) ) - { - AliasEntry entry( search->second ); - m_aAliasMap.erase( search ); - m_aAliasMap[ sAssignedAlias ] = entry; - - #if OSL_DEBUG_LEVEL > 0 - bFound = true; - #endif - - break; - } - } - - OSL_ENSURE( bFound, "OColumnAlias::setAlias: did not find a programmatic name which exists in the configuration!" ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } -} - -//------------------------------------------------------------------ -::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const -{ - AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias ); - if ( pos == m_aAliasMap.end() ) - { - OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" ); - return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 ); - } - return pos->second.programmaticAsciiName; -} - -//------------------------------------------------------------------ -bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const -{ - ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias ); - - return ( !sProgrammatic.equals( "HomeCountry" ) - && !sProgrammatic.equals( "WorkCountry" ) - ); - // for those, we know that they're not searchable in the Mozilla/LDAP implementation. - // There might be more ... -} diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx deleted file mode 100644 index f715c7ffc465..000000000000 --- a/connectivity/source/drivers/mozab/MColumnAlias.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - - -#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_ -#define _CONNECTIVITY_MAB_COLUMNALIAS_HXX_ - -#include <unotools/confignode.hxx> - -#include <osl/mutex.hxx> -#include <vector> -#include <hash_map> - -namespace connectivity -{ - namespace mozab - { - class OColumnAlias - { - public: - struct AliasEntry - { - ::rtl::OString programmaticAsciiName; - sal_Int32 columnPosition; - - AliasEntry() - :programmaticAsciiName() - ,columnPosition( 0 ) - { - } - AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition ) - :programmaticAsciiName( _programmaticAsciiName ) - ,columnPosition( _columnPosition ) - { - } - }; - typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap; - - private: - AliasMap m_aAliasMap; - - public: - OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); - - inline bool hasAlias( const ::rtl::OUString& _rAlias ) const - { - return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end(); - } - ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const; - - inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); } - inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); } - - bool isColumnSearchable( const ::rtl::OUString _alias ) const; - - private: - void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); - }; - } -} -#endif // _CONNECTIVITY_MAB_COLUMNALIAS_HXX_ diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx deleted file mode 100644 index 7faf5ab9baa5..000000000000 --- a/connectivity/source/drivers/mozab/MColumns.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MColumns.hxx" -#include "connectivity/sdbcx/VColumn.hxx" -#include "connectivity/sdbcx/VColumn.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include "MTable.hxx" -#include "MTables.hxx" -#include "MCatalog.hxx" -#include <comphelper/types.hxx> -#include "connectivity/dbtools.hxx" - -using namespace ::comphelper; - - -using namespace connectivity::mozab; -using namespace connectivity::sdbcx; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) -{ - Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), - m_pTable->getSchema(),m_pTable->getTableName(),_rName); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - if(xRow->getString(4) == _rName) - { - sal_Int32 nType = xRow->getInt(5); - ::rtl::OUString sTypeName = xRow->getString(6); - sal_Int32 nPrec = xRow->getInt(7); - - OColumn* pRet = new OColumn(_rName, - sTypeName, - xRow->getString(13), - xRow->getString(12), - xRow->getInt(11), - nPrec, - xRow->getInt(9), - nType, - sal_False,sal_False,sal_False,sal_True); - xRet = pRet; - break; - } - } - } - - return xRet; -} - -// ------------------------------------------------------------------------- -void OColumns::impl_refresh() throw(RuntimeException) -{ - m_pTable->refreshColumns(); -} -// ----------------------------------------------------------------------------- - - - diff --git a/connectivity/source/drivers/mozab/MColumns.hxx b/connectivity/source/drivers/mozab/MColumns.hxx deleted file mode 100644 index 30ae159d3f5f..000000000000 --- a/connectivity/source/drivers/mozab/MColumns.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_ -#define _CONNECTIVITY_MOZAB_COLUMNS_HXX_ - -#include "connectivity/sdbcx/VCollection.hxx" -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#include "connectivity/sdbcx/IRefreshable.hxx" -#include "MTable.hxx" - -namespace connectivity -{ - namespace mozab - { - class OColumns : public sdbcx::OCollection - { - protected: - OTable* m_pTable; - - virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - public: - OColumns( OTable* _pTable, - ::osl::Mutex& _rMutex, - const TStringVector &_rVector - ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) - ,m_pTable(_pTable) - {} - }; - } -} -#endif // _CONNECTIVITY_MOZAB_COLUMNS_HXX_ - diff --git a/connectivity/source/drivers/mozab/MConfigAccess.cxx b/connectivity/source/drivers/mozab/MConfigAccess.cxx deleted file mode 100644 index 33467ec03105..000000000000 --- a/connectivity/source/drivers/mozab/MConfigAccess.cxx +++ /dev/null @@ -1,269 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX -#include "MConfigAccess.hxx" -#endif -#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX -#include "MExtConfigAccess.hxx" -#endif -#include "MConnection.hxx" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; - -//......................................................................... -namespace connectivity -{ - namespace mozab - { - //----------------------------------------------------------------- - Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB ) - { - Reference< XPropertySet > xNode; - try - { - //============================================================= - // create the config provider - Reference< XMultiServiceFactory > xConfigProvider( - _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider" )) ), - UNO_QUERY - ); - OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" ); - - if ( xConfigProvider.is() ) - { - ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" ); - sCompleteNodePath += OConnection::getDriverImplementationName(); - - //========================================================= - // arguments for creating the config access - Sequence< Any > aArguments(2); - // the path to the node to open - aArguments[0] <<= PropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath")), - 0, - makeAny( sCompleteNodePath ), - PropertyState_DIRECT_VALUE - ); - // the depth: -1 means unlimited - aArguments[1] <<= PropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("depth")), - 0, - makeAny( (sal_Int32)-1 ), - PropertyState_DIRECT_VALUE - ); - - //========================================================= - // create the access - Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess" )), - aArguments - ); - OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" ); - - xNode = xNode.query( xAccess ); - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); - } - - // outta here - return xNode; - } - - //----------------------------------------------------------------- - namespace - { - // a private helper to accessing the point where we store the reference - // to the factory - Reference< XMultiServiceFactory >& accessFactoryStorage( ) - { - static Reference< XMultiServiceFactory > xMozabServiceFactory; - return xMozabServiceFactory; - } - } - - //----------------------------------------------------------------- - void setMozabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory ) - { - accessFactoryStorage( ) = _rxFactory; - } - - //----------------------------------------------------------------- - const Reference< XMultiServiceFactory >& getMozabServiceFactory( ) - { - return accessFactoryStorage( ); - } - - //----------------------------------------------------------------- - ::rtl::OUString getDescription(const sal_Char* sNode,const ::rtl::OUString & sDefault) - { - ::rtl::OUString sPreferredName; - ::rtl::OUString sDescription; - - Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory(); - OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" ); - if ( xFactory.is() ) - { - try - { - Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory ); - Reference< XPropertySet > xMozPrefsNode; - if ( xDriverNode.is() ) - xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode; - OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" ); - if ( xMozPrefsNode.is() ) - xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName; - if ( xMozPrefsNode.is() ) - xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii(sNode) ) >>= sDescription; - if (sDescription.getLength() == 0) - sDescription = sDefault; - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "getDescription: caught an exception!" ); - } - } - if (sDescription.getLength() == 0) - sDescription = sDefault; - return sDescription; - } - //----------------------------------------------------------------- - ::rtl::OUString getPreferredProfileName( ) - { - ::rtl::OUString sPreferredName; - - Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory(); - OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" ); - if ( xFactory.is() ) - { - try - { - Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory ); - Reference< XPropertySet > xMozPrefsNode; - if ( xDriverNode.is() ) - xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode; - OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" ); - if ( xMozPrefsNode.is() ) - xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName; - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "getPreferredProfileName: caught an exception!" ); - } - } - return sPreferredName; - } - } -} - -//......................................................................... - -//------------------------------------------------------------------------- -extern "C" const sal_Unicode* SAL_CALL getUserProfile( void ) -{ - static sal_Bool bReadConfig = sal_False; - static ::rtl::OUString sUserProfile; - if ( !bReadConfig ) - { - sUserProfile = ::connectivity::mozab::getPreferredProfileName( ); - bReadConfig = sal_True; - } - - return sUserProfile.getStr(); -} -//------------------------------------------------------------------------ -extern "C" const sal_Char* SAL_CALL getPabDescription( void ) -{ - static sal_Bool bReadConfig = sal_False; - static ::rtl::OUString usPabDescription; - static ::rtl::OString sPabDescription; - - if ( !bReadConfig ) - { - usPabDescription = ::connectivity::mozab::getDescription( - "PabDescription" , - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Personal Address Book" ))); - sPabDescription = ::rtl::OUStringToOString( usPabDescription, - RTL_TEXTENCODING_UTF8); - bReadConfig = sal_True; - } - - return sPabDescription.getStr(); -} - -//------------------------------------------------------------------------- -extern "C" const sal_Char* SAL_CALL getHisDescription( void ) -{ - static sal_Bool bReadConfig = sal_False; - static ::rtl::OUString usHisDescription; - static ::rtl::OString sHisDescription; - - if ( !bReadConfig ) - { - usHisDescription = ::connectivity::mozab::getDescription( - "HisDescription" , - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Collected Addresses" ))); - sHisDescription = ::rtl::OUStringToOString( usHisDescription, - RTL_TEXTENCODING_UTF8); - bReadConfig = sal_True; - } - - return sHisDescription.getStr(); -} - -//------------------------------------------------------------------------- -// MConfigAccess was invented to allow non-UNO parts access to the configuration. -// Unfortunately, configuration access requires a XMultiServiceFactory - which the -// mozilla side does not have. -// So we create a "library-local" service factory here: Every need for a service -// factory can be fullfilled by this factory (similar to the get/setProcessServiceFactory -// in comphelper). -// This is halfway valid, as usually, the mozabdrv library is invoked from the mozab library -// only. The latter contains the driver class (and only this class and nothing more), and -// the driver class is a singleton. The driver itself is created with a service factory, -// which (by definition) can and should be used for all subsequent service requests. -// And this is exactly what we're allowing with the following functions .... - -/** _pFactory must point to an XMultiServiceFactory, which must be aquired once - for purpose of safely transfering it. The callee will release this interface - when it has stored the pointer somewhere else. -*/ -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL setMozabServiceFactory( - void* _pFactory ) -{ - Reference< XMultiServiceFactory > xFactory = static_cast< XMultiServiceFactory* >( _pFactory ); - ::connectivity::mozab::setMozabServiceFactory( xFactory ); - - // by definition, the object behind the interface pointer has been acquired once for purpose - // of safely transporting it - xFactory->release(); -} - diff --git a/connectivity/source/drivers/mozab/MConfigAccess.hxx b/connectivity/source/drivers/mozab/MConfigAccess.hxx deleted file mode 100644 index 67f182ede32d..000000000000 --- a/connectivity/source/drivers/mozab/MConfigAccess.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX - -#include <sal/types.h> - -extern "C" const sal_Unicode* SAL_CALL getUserProfile( void ); - -extern "C" const sal_Char* SAL_CALL getPabDescription( void ); - -extern "C" const sal_Char* SAL_CALL getHisDescription( void ); - -#endif // CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX - diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx deleted file mode 100644 index 0e467b2687fc..000000000000 --- a/connectivity/source/drivers/mozab/MConnection.cxx +++ /dev/null @@ -1,599 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "diagnose_ex.h" -#include "MConnection.hxx" -#include "MDatabaseMetaData.hxx" -#include "MDriver.hxx" -#include "MColumnAlias.hxx" -#include "MStatement.hxx" -#include "MPreparedStatement.hxx" - -#include <connectivity/dbcharset.hxx> -#include <connectivity/dbexception.hxx> -#include <connectivity/sqlerror.hxx> - -#include "resource/mozab_res.hrc" -#include "resource/common_res.hrc" - -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/TransactionIsolation.hpp> - -#include <comphelper/officeresourcebundle.hxx> - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozabConnection_CreateInstance( - void* _pDriver) -{ - return (new connectivity::mozab::OConnection( reinterpret_cast<connectivity::mozab::MozabDriver*>(_pDriver) )); -} - -using namespace dbtools; - -//------------------------------------------------------------------------------ -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -// -------------------------------------------------------------------------------- - -namespace connectivity { namespace mozab { - -// ===================================================================== -// = ConnectionImplData -// ===================================================================== -struct ConnectionImplData -{ - ::boost::shared_ptr< ::comphelper::OfficeResourceBundle > pResourceBundle; -}; - -// ----------------------------------------------------------------------------- -#ifdef __MINGW32__ -extern "C" -#endif -const sal_Char* getSdbcScheme( SdbcScheme _eScheme ) -{ - switch ( _eScheme ) - { - case SDBC_MOZILLA: return "mozilla"; - case SDBC_THUNDERBIRD: return "thunderbird"; - case SDBC_LDAP: return "ldap"; - case SDBC_OUTLOOK_MAPI: return "outlook"; - case SDBC_OUTLOOK_EXPRESS: return "outlookexp"; - } - return NULL; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OConnection::getDriverImplementationName() -{ - return rtl::OUString::createFromAscii(MOZAB_DRIVER_IMPL_NAME); -} - -// ----------------------------------------------------------------------------- -const sal_Char* getSchemeURI( MozillaScheme _eScheme ) -{ - switch ( _eScheme ) - { - case SCHEME_MOZILLA : return "moz-abdirectory://"; - case SCHEME_MOZILLA_MDB : return "moz-abmdbdirectory://"; - case SCHEME_LDAP : return "moz-abldapdirectory://"; - case SCHEME_OUTLOOK_MAPI : return "moz-aboutlookdirectory://op/"; - case SCHEME_OUTLOOK_EXPRESS : return "moz-aboutlookdirectory://oe/"; - } - return NULL; -} - -// ----------------------------------------------------------------------------- - -OConnection::OConnection(MozabDriver* _pDriver) - :OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this) - ,m_pDriver(_pDriver) - ,m_pImplData( new ConnectionImplData ) - ,m_aColumnAlias( _pDriver->getMSFactory() ) - ,m_nMaxResultRecords( -1 ) - ,m_aNameMapper(NULL) - ,m_eSDBCAddressType(SDBCAddress::Unknown) -{ - m_pDriver->acquire(); - -} -//----------------------------------------------------------------------------- -OConnection::~OConnection() -{ - acquire(); - if(!isClosed()) - close(); - m_pDriver->release(); - m_pDriver = NULL; -} -//----------------------------------------------------------------------------- -void SAL_CALL OConnection::release() throw() -{ - relase_ChildImpl(); -} -// ----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) -{ - OSL_TRACE("IN OConnection::construct()\n" ); - // open file - setURL(url); - // - // Skip 'sdbc:mozab: part of URL - // - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - OSL_ENSURE( url.copy( 0, nLen ).equalsAscii( "sdbc:address" ), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" ); - - ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); - // Get Scheme - nLen = aAddrbookURI.indexOf(':'); - ::rtl::OUString aAddrbookScheme; - ::rtl::OUString sAdditionalInfo; - if ( nLen == -1 ) - { - // There isn't any subschema: - but could be just subschema - if ( aAddrbookURI.getLength() > 0 ) - { - aAddrbookScheme= aAddrbookURI; - } - else - { - OSL_TRACE( "No subschema given!!!\n"); - throwSQLException( STR_URI_SYNTAX_ERROR, *this ); - } - } - else - { - aAddrbookScheme = aAddrbookURI.copy(0, nLen); - sAdditionalInfo = aAddrbookURI.copy( nLen + 1 ); - } - - OSL_TRACE("URI = %s\n", ((OUtoCStr(aAddrbookURI)) ? (OUtoCStr(aAddrbookURI)):("NULL")) ); - OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ? (OUtoCStr(aAddrbookScheme)):("NULL")) ); - - // - // Now we have a URI convert it to a MozillaURI - // - // The Mapping being used is: - // - // * for Mozilla - // "sdbc:address:mozilla:" -> abdirectory:// - // * for LDAP - // "sdbc:address:ldap:" -> abldapdirectory:// - // * for Outlook (using MAPI API) - // "sdbc:address:outlook:" -> aboutlookdirectory://op/ - // * for windows system address book - // "sdbc:address:outlookexp:" -> aboutlookdirectory://oe/ - // - m_sBindDN = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")); - m_sPassword = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")); - m_bUseSSL = sal_False; - - if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_MOZILLA ) ) == 0 ) { - m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) ); - m_eSDBCAddressType = SDBCAddress::Mozilla; - if(sAdditionalInfo.getLength()) - m_sMozillaProfile = sAdditionalInfo; - } - else - if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_THUNDERBIRD ) ) == 0 ) { - //Yes. I am sure it is SCHEME_MOZILLA - m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) ); - m_eSDBCAddressType = SDBCAddress::ThunderBird; - if(sAdditionalInfo.getLength()) - m_sMozillaProfile = sAdditionalInfo; - } - else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_LDAP ) ) == 0 ) { - rtl::OUString sBaseDN; - sal_Int32 nPortNumber = -1; - - m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_LDAP ) ); - m_eSDBCAddressType = SDBCAddress::LDAP; - - if ( !m_sHostName.getLength() ) - { - // see whether the URI contains a hostname/port - if ( sAdditionalInfo.getLength() ) - { - sal_Int32 nPortSeparator = sAdditionalInfo.indexOf( ':' ); - if ( nPortSeparator == -1 ) - m_sHostName = sAdditionalInfo; - else - { - m_sHostName = sAdditionalInfo.copy( 0, nPortSeparator ); - nPortNumber = sAdditionalInfo.copy( nPortSeparator + 1 ).toInt32(); - OSL_ENSURE( nPortNumber != 0, "OConnection::construct: invalid LDAP port number in the URL!" ); - if ( nPortNumber == 0 ) - nPortNumber = -1; - } - } - } - - const PropertyValue* pInfo = info.getConstArray(); - const PropertyValue* pInfoEnd = pInfo + info.getLength(); - - for (; pInfo != pInfoEnd; ++pInfo) - { - OSL_TRACE( "info[%d].Name = %s\n", pInfo - info.getConstArray(), OUtoCStr( pInfo->Name ) ); - - if ( 0 == pInfo->Name.compareToAscii("HostName") ) - { - pInfo->Value >>= m_sHostName; - } - else if ( 0 == pInfo->Name.compareToAscii("BaseDN") ) - { - pInfo->Value >>= sBaseDN; - } - else if ( 0 == pInfo->Name.compareToAscii("user") ) - { - pInfo->Value >>= m_sBindDN; - } - else if ( 0 == pInfo->Name.compareToAscii("password") ) - { - pInfo->Value >>= m_sPassword; - } - else if ( 0 == pInfo->Name.compareToAscii("UseSSL") ) - { - pInfo->Value >>= m_bUseSSL; - } - else if ( 0 == pInfo->Name.compareToAscii("PortNumber") ) - { - OSL_VERIFY( pInfo->Value >>= nPortNumber ); - } - else if ( 0 == pInfo->Name.compareToAscii("MaxRowCount") ) - { - pInfo->Value >>= m_nMaxResultRecords; - } - } - - if ( m_sHostName.getLength() != 0 ) { - m_sMozillaURI += m_sHostName; - } - else - throwSQLException( STR_NO_HOSTNAME, *this ); - - if ( nPortNumber > 0 ) { - m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(":") ); - m_sMozillaURI += rtl::OUString::valueOf( nPortNumber ); - } - - if ( sBaseDN.getLength() != 0 ) { - m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ); - m_sMozillaURI += sBaseDN; - } - else - throwSQLException( STR_NO_BASEDN, *this ); - - // Addition of a fake query to enable the Mozilla LDAP directory to work correctly. - m_sMozillaURI += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?(or(DisplayName,=,DontDoThisAtHome)))")); - - } - else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_MAPI ) ) == 0 ) { - m_sMozillaURI = ::rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_MAPI ) ); - m_eSDBCAddressType = SDBCAddress::Outlook; - } - else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_EXPRESS ) ) == 0 ) { - m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_EXPRESS ) ); - m_eSDBCAddressType = SDBCAddress::OutlookExp; - } - else - { - OSL_TRACE("Invalid subschema given!!!\n"); - throwSQLException( STR_URI_SYNTAX_ERROR, *this ); - } - - OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")), usesFactory() ? "uses factory" : "no factory"); - OSL_TRACE( "\tOUT OConnection::construct()\n" ); - - MDatabaseMetaDataHelper _aDbHelper; - - // The creation of the nsIAbDirectory i/f for LDAP doesn't actually test - // the validity of the connection, it's normally delayed until the query - // is executed, but it's a bit late then to fail... - if ( isLDAP() ) - { - if ( !_aDbHelper.testLDAPConnection( this ) ) - { - OSL_TRACE("testLDAPConnection : FAILED\n" ); - throwSQLException( _aDbHelper.getError(), *this ); - } - else - { - OSL_TRACE("testLDAPConnection : SUCCESS\n" ); - } - } - - // Test connection by getting to get the Table Names - ::std::vector< ::rtl::OUString > tables; - ::std::vector< ::rtl::OUString > types; - if ( !_aDbHelper.getTableStrings( this, tables, types ) ) - { - throwSQLException( _aDbHelper.getError(), *this ); - } - -} -// XServiceInfo -// -------------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mozab.OConnection", "com.sun.star.sdbc.Connection") - -// -------------------------------------------------------------------------------- -Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // create a statement - // the statement can only be executed once - Reference< XStatement > xReturn = new OStatement(this); - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} -// -------------------------------------------------------------------------------- -Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - OSL_TRACE("OConnection::prepareStatement( %s )", OUtoCStr( _sSql ) ); - // the pre - // create a statement - // the statement can only be executed more than once - OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql); - Reference< XPreparedStatement > xReturn = pPrepared; - pPrepared->lateInit(); - - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} -// -------------------------------------------------------------------------------- -Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) -{ - OSL_UNUSED( _sSql ); - ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this ); - OSL_TRACE("OConnection::prepareCall( %s )", OUtoCStr( _sSql ) ); - return NULL; -} -// -------------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - // when you need to transform SQL92 to you driver specific you can do it here - OSL_TRACE("OConnection::nativeSQL( %s )", OUtoCStr( _sSql ) ); - - return _sSql; -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::setAutoCommit( sal_Bool /*autoCommit*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::setAutoCommit", *this ); -} -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) -{ - // you have to distinguish which if you are in autocommit mode or not - // at normal case true should be fine here - - return sal_True; -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) -{ - // when you database does support transactions you should commit here -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) -{ - // same as commit but for the other case -} -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent) - return OConnection_BASE::rBHelper.bDisposed; -} -// -------------------------------------------------------------------------------- -Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // here we have to create the class with biggest interface - // The answer is 42 :-) - Reference< XDatabaseMetaData > xMetaData = m_xMetaData; - if(!xMetaData.is()) - { - xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it - m_xMetaData = xMetaData; - } - - return xMetaData; -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::setReadOnly( sal_Bool /*readOnly*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::setReadOnly", *this ); -} -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) -{ - // return if your connection to readonly - return sal_False; -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::setCatalog", *this ); -} -// -------------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) -{ - // return your current catalog - return ::rtl::OUString(); -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this ); -} -// -------------------------------------------------------------------------------- -sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) -{ - // please have a look at @see com.sun.star.sdbc.TransactionIsolation - return TransactionIsolation::NONE; -} -// -------------------------------------------------------------------------------- -Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) -{ - // if your driver has special database types you can return it here - return NULL; -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this ); -} -// -------------------------------------------------------------------------------- -// XCloseable -void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) -{ - // we just dispose us - { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - } - dispose(); -} -// -------------------------------------------------------------------------------- -// XWarningsSupplier -Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) -{ - // when you collected some warnings -> return it - return Any(); -} -// -------------------------------------------------------------------------------- -void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) -{ - // you should clear your collected warnings here -} -//------------------------------------------------------------------------------ -void OConnection::disposing() -{ - // we noticed that we should be destroied in near future so we have to dispose our statements - ::osl::MutexGuard aGuard(m_aMutex); - - m_pImplData->pResourceBundle.reset(); - - OConnection_BASE::disposing(); - if ( m_aNameMapper ) { - MQuery::FreeNameMapper( m_aNameMapper ); - m_aNameMapper = NULL; - } - - dispose_ChildImpl(); -} -// ----------------------------------------------------------------------------- - -Reference< XTablesSupplier > SAL_CALL OConnection::createCatalog() -{ - OSL_TRACE("IN OConnection::createCatalog()\n" ); - ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XTablesSupplier > xTab = m_xCatalog; - if(!m_xCatalog.is()) - { - OCatalog *pCat = new OCatalog(this); - xTab = pCat; - m_xCatalog = xTab; - } - OSL_TRACE( "\tOUT OConnection::createCatalog()\n" ); - return xTab; -} -// ----------------------------------------------------------------------------- - -MNameMapper* OConnection::getNameMapper () -{ - if (m_aNameMapper==NULL) - m_aNameMapper = MQuery::CreateNameMapper(); - - return m_aNameMapper; -} - -// ----------------------------------------------------------------------------- -void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext ) -{ - if ( _rError.getResId() != 0 ) - { - OSL_ENSURE( ( _rError.getErrorCondition() == 0 ), - "OConnection::throwSQLException: unsupported error code combination!" ); - - ::rtl::OUString sParameter( _rError.getParameter() ); - if ( sParameter.getLength() ) - { - const ::rtl::OUString sError( getResources().getResourceStringWithSubstitution( - _rError.getResId(), - "$1$", sParameter - ) ); - ::dbtools::throwGenericSQLException( sError, _rxContext ); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (1)!" ); - } - - throwGenericSQLException( _rError.getResId(), _rxContext ); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (2)!" ); - } - - if ( _rError.getErrorCondition() != 0 ) - { - SQLError aErrorHelper( getDriver()->getMSFactory() ); - ::rtl::OUString sParameter( _rError.getParameter() ); - if ( sParameter.getLength() ) - aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter ); - else - aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (3)!" ); - } - - throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext ); -} - -// ----------------------------------------------------------------------------- -void OConnection::throwSQLException( const sal_uInt16 _nErrorResourceId, const Reference< XInterface >& _rxContext ) -{ - ErrorDescriptor aError; - aError.setResId( _nErrorResourceId ); - throwSQLException( aError, _rxContext ); -} - -} } // namespace connectivity::mozab diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx deleted file mode 100644 index 10b327d9ef79..000000000000 --- a/connectivity/source/drivers/mozab/MConnection.hxx +++ /dev/null @@ -1,227 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SCONNECTION_HXX -#define CONNECTIVITY_SCONNECTION_HXX - -#include "connectivity/CommonTools.hxx" - -#include "MCatalog.hxx" -#include "MColumnAlias.hxx" -#include "OSubComponent.hxx" -#include "TConnection.hxx" - -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#include <com/sun/star/sdbc/SQLWarning.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> - -#include <cppuhelper/weakref.hxx> - -#include <memory> - -namespace connectivity -{ - namespace mozab - { - - class MozabDriver; - class ODatabaseMetaData; - class MNameMapper; - class ErrorDescriptor; - - namespace SDBCAddress { - typedef enum { - Unknown = 0, - Mozilla = 1, - ThunderBird = 2, - LDAP = 3, - Outlook = 4, - OutlookExp = 5 - } sdbc_address_type; - } - - // For the moment, we will connect the Mozilla address book to the Mozilla - // top-level address book which will display whatever is in the preferences - // file of Mozilla. - enum MozillaScheme - { - // This one is a base uri which will be completed with the connection data. - SCHEME_MOZILLA, - // This one is for mozilla native address book - SCHEME_MOZILLA_MDB, - // This one is for LDAP address book - SCHEME_LDAP, - // These two uris will be used to obtain directory factories to access all - // address books of the given type. - SCHEME_OUTLOOK_MAPI, - SCHEME_OUTLOOK_EXPRESS - }; - const sal_Char* getSchemeURI( MozillaScheme _eScheme ); - - enum SdbcScheme - { - SDBC_MOZILLA, - SDBC_THUNDERBIRD, - SDBC_LDAP, - SDBC_OUTLOOK_MAPI, - SDBC_OUTLOOK_EXPRESS - }; -#ifdef __MINGW32__ - extern "C" -#endif - const sal_Char* getSdbcScheme( SdbcScheme _eScheme ); - - typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding - - struct ConnectionImplData; - class OConnection : public OConnection_BASE, - public connectivity::OSubComponent<OConnection, OConnection_BASE> - { - friend class connectivity::OSubComponent<OConnection, OConnection_BASE>; - - protected: - //==================================================================== - // Data attributes - //==================================================================== - ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by - // an operation - MozabDriver* m_pDriver; // Pointer to the owning - // driver object - ::std::auto_ptr< ConnectionImplData > m_pImplData; - // This is to be able to hold a boost::shared_ptr. If we would hold it as member, it would - // not compile the mozillasrc directory, since this directory is compiled without RTTI support - // and boost seems to require RTTI on some platforms. - // Store Catalog - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; - // Start of Additions from the land of mozilla - OColumnAlias m_aColumnAlias; - rtl::OUString m_sMozillaURI; - rtl::OUString m_sMozillaProfile; - sal_Int32 m_nMaxResultRecords; - MNameMapper* m_aNameMapper; - //LDAP only - rtl::OUString m_sHostName; - sal_Bool m_bUseSSL; - rtl::OUString m_sBindDN; - rtl::OUString m_sUser; // the user name - rtl::OUString m_sPassword; - - SDBCAddress::sdbc_address_type m_eSDBCAddressType; - - sal_Bool m_bForceLoadTable; - - public: - virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); - OConnection(MozabDriver* _pDriver); - virtual ~OConnection(); - - void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); - - // OComponentHelper - virtual void SAL_CALL disposing(void); - // XInterface - virtual void SAL_CALL release() throw(); - - // XServiceInfo - DECLARE_SERVICE_INFO(); - // XConnection - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XCloseable - virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XWarningsSupplier - virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // - MozabDriver* getDriver() const { return m_pDriver;} - - // Added to enable me to use SQLInterpreter which requires an - // XNameAccess i/f to access tables. - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog(); - - - // Additions from the land of mozilla - rtl::OUString getMozURI() const { return m_sMozillaURI; } - rtl::OUString getMozProfile() const { return m_sMozillaProfile; } - void setMozProfile(rtl::OUString &aNewProfile) { m_sMozillaProfile = aNewProfile; } - - ::com::sun::star::mozilla::MozillaProductType getProduct() - { - if (m_eSDBCAddressType == SDBCAddress::ThunderBird) - return ::com::sun::star::mozilla::MozillaProductType_Thunderbird; - return ::com::sun::star::mozilla::MozillaProductType_Mozilla; - } - - // Get Ldap BindDN (user name) - rtl::OUString getBindDN() const { return m_sBindDN; } - // Get Ldap Password - rtl::OUString getPassword() const { return m_sPassword; } - // Get Ldap Host name - rtl::OUString getHost() const { return m_sHostName; } - // Get whether use ssl to connect to ldap - sal_Bool getUseSSL() const {return m_bUseSSL;} - - sal_Bool usesFactory(void) const { return (m_eSDBCAddressType == SDBCAddress::Outlook) || (m_eSDBCAddressType == SDBCAddress::OutlookExp); } - sal_Bool isLDAP(void) const { return m_eSDBCAddressType == SDBCAddress::LDAP; } - sal_Bool isThunderbird(void) const { return m_eSDBCAddressType == SDBCAddress::ThunderBird; } - - sal_Bool isOutlookExpress() const { return m_eSDBCAddressType == SDBCAddress::OutlookExp;} - sal_Int32 getMaxResultRecords() const { return m_nMaxResultRecords; } - - SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;} - - const OColumnAlias & getColumnAlias() const { return (m_aColumnAlias); } - - static ::rtl::OUString getDriverImplementationName(); - - MNameMapper* getNameMapper(); - void setForceLoadTables(sal_Bool aForce){ m_bForceLoadTable = aForce;} - sal_Bool getForceLoadTables() { return m_bForceLoadTable;} - - void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext ); - void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext ); - - private: - // make this private - clients should use throwSQLException instead - using OConnection_BASE::throwGenericSQLException; - }; - } -} -#endif // CONNECTIVITY_SCONNECTION_HXX - diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx deleted file mode 100644 index fb2720b2e312..000000000000 --- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx +++ /dev/null @@ -1,1027 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MDatabaseMetaData.hxx" -#include "FDatabaseMetaDataResultSet.hxx" -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdbc/TransactionIsolation.hpp> -#include <connectivity/dbexception.hxx> -#include <connectivity/FValue.hxx> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/ColumnSearch.hpp> -#include "resource/common_res.hrc" -#include <vector> - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -using namespace connectivity::mozab; -using namespace connectivity; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; - - -namespace connectivity -{ - namespace mozab - { - static sal_Int32 const s_nCOLUMN_SIZE = 256; - static sal_Int32 const s_nDECIMAL_DIGITS = 0; - static sal_Int32 const s_nNULLABLE = 1; - static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535; - } -} - - -ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) - : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo()) - ,m_pConnection(_pCon) -{ - OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!"); - m_pDbMetaDataHelper = new MDatabaseMetaDataHelper(); -} -// ------------------------------------------------------------------------- -ODatabaseMetaData::~ODatabaseMetaData() -{ - delete m_pDbMetaDataHelper; -} - -// ------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows( - const ::rtl::OUString& tableNamePattern, - const ::rtl::OUString& columnNamePattern ) throw(SQLException) -{ - static ODatabaseMetaDataResultSet::ORows aRows; - ODatabaseMetaDataResultSet::ORow aRow(19); - aRows.clear(); - - ::osl::MutexGuard aGuard( m_aMutex ); - - ::std::vector< ::rtl::OUString > tables; - ::std::vector< ::rtl::OUString > types; - if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types) ) { - getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this ); - } - - // **************************************************** - // Some entries in a row never change, so set them now - // **************************************************** - - // Catalog - aRow[1] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""))); - // Schema - aRow[2] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""))); - // DATA_TYPE - aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR)); - // TYPE_NAME, not used - aRow[6] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))); - // COLUMN_SIZE - aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE); - // BUFFER_LENGTH, not used - aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue(); - // DECIMAL_DIGITS. - aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS); - // NUM_PREC_RADIX - aRow[10] = new ORowSetValueDecorator((sal_Int32)10); - // NULLABLE - aRow[11] = new ORowSetValueDecorator(s_nNULLABLE); - // REMARKS - aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue(); - // COULUMN_DEF, not used - aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue(); - // SQL_DATA_TYPE, not used - aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue(); - // SQL_DATETIME_SUB, not used - aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue(); - // CHAR_OCTET_LENGTH, refer to [5] - aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH); - // IS_NULLABLE - aRow[18] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("YES"))); - - const OColumnAlias& colNames = m_pConnection->getColumnAlias(); - - // Iterate over all tables - for(size_t j = 0; j < tables.size(); j++ ) { - if(match(tableNamePattern, tables[j],'\0')) { - // TABLE_NAME - aRow[3] = new ORowSetValueDecorator( tables[j] ); - - OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] )); - - // Iterate over all collumns in the table. - for ( OColumnAlias::AliasMap::const_iterator compare = colNames.begin(); - compare != colNames.end(); - ++compare - ) - { - if ( match( columnNamePattern, compare->first, '\0' ) ) - { - OSL_TRACE( "\t\t\tColumnName = %s;\n", OUtoCStr( compare->first ) ); - // COLUMN_NAME - aRow[4] = new ORowSetValueDecorator( compare->first ); - // ORDINAL_POSITION - aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 ); - aRows.push_back(aRow); - } - } - } - } - return( aRows ); -} -// ------------------------------------------------------------------------- -::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( ) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 65535; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 254; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 20; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( ) -{ - return 0; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( ) -{ - // We only support a single table - return 1; -} -// ------------------------------------------------------------------------- -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aVal; - return aVal; -} -// ------------------------------------------------------------------------- -::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) -{ - // normally this is " - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\"")); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aVal; - return aVal; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( ) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) -{ - //We support create table - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) -{ - return sal_True; // should be supported at least -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) -{ - return 0;// 0 means no limit -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) -{ - // We allow you to select from any table. - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) -{ - //we support insert/update/delete now - //But we have to set this to return sal_True otherwise the UI will add create "table/edit table" - //entry to the popup menu. We should avoid them. - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) -{ - // Support added for this. - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) -{ - // Any case may be used - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - return m_pConnection->getURL(); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1); - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0); - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) -{ - return 1; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) -{ - return TransactionIsolation::NONE; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) -{ - return 0; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue; - return aValue; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; // 0 means no limit - return nValue; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -// here follow all methods which return a resultset -// the first methods is an example implementation how to use this resultset -// of course you could implement it on your and you should do this because -// the general way is more memory expensive -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) -{ - // there exists no possibility to get table types so we have to check - static ::rtl::OUString sTableTypes[] = - { - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW")) - // Currently we only support a 'TABLE' and 'VIEW' nothing more complex - // - // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")), - // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")), - // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")), - // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ALIAS")), - // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYNONYM")) - }; - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes); - Reference< XResultSet > xRef = pResult; - - // here we fill the rows which should be visible when ask for data from the resultset returned here - const sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString); - ODatabaseMetaDataResultSet::ORows aRows; - for(sal_Int32 i=0;i < nSize;++i) - { - ODatabaseMetaDataResultSet::ORow aRow; - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(sTableTypes[i])); - // bound row - aRows.push_back(aRow); - } - // here we set the rows at the resultset - pResult->setRows(aRows); - return xRef; -} -// ------------------------------------------------------------------------- -Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( ) -{ - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); - Reference< XResultSet > xResultSet = pResultSet; - static ODatabaseMetaDataResultSet::ORows aRows; - - if(aRows.empty()) - { - ODatabaseMetaDataResultSet::ORow aRow; - aRow.reserve(19); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR")))); - aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH)); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); - - aRows.push_back(aRow); - - } - pResultSet->setRows(aRows); - return xResultSet; -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( - const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, - const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) -{ - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns); - Reference< XResultSet > xResultSet = pResultSet; - pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern )); - return xResultSet; -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( - const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, - const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) -{ - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); - Reference< XResultSet > xResultSet = pResultSet; - - // ODatabaseMetaDataResultSet::ORows aRows; - // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern ); - // pResultSet->setRows( aRows ); - ODatabaseMetaDataResultSet::ORows _rRows; - if ( !m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern, types,_rRows ) ) { - getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this ); - } - pResultSet->setRows( _rRows ); - - return xResultSet; -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( - const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) -{ - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges); - Reference< XResultSet > xRef = NULL; - - xRef = pResult; - - ::std::vector< ::rtl::OUString > tables; - ::std::vector< ::rtl::OUString > types; - if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types ) ) - getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this ); - - ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; - ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); - aRows.reserve(8); - aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName()); - aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NO"))); - - - // Iterate over all tables - for(size_t j = 0; j < tables.size(); j++ ) { - if(match(tableNamePattern, tables[j],'\0')) - { - // TABLE_NAME - aRow[2] = new ORowSetValueDecorator( tables[j] ); - - OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] )); - - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue(); - aRows.push_back(aRow); - } - } - pResult->setRows(aRows); - return xRef; - -} -// ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} -// ----------------------------------------------------------------------------- - - - diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx deleted file mode 100644 index f43ad2e30af6..000000000000 --- a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX -#define CONNECTIVITY_SDATABASEMETADATA_HXX -#include "MConnection.hxx" -#include "mozillasrc/MDatabaseMetaDataHelper.hxx" -#include "TDatabaseMetaDataBase.hxx" - -namespace connectivity -{ - namespace mozab - { - //************************************************************** - //************ Class: ODatabaseMetaData - //************************************************************** - - class ODatabaseMetaData : public ODatabaseMetaDataBase - { - OConnection* m_pConnection; - MDatabaseMetaDataHelper* m_pDbMetaDataHelper; - - ODatabaseMetaDataResultSet::ORows& SAL_CALL getColumnRows( const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw( ::com::sun::star::sdbc::SQLException ); - - protected: - virtual ~ODatabaseMetaData(); - public: - - inline OConnection* getOwnConnection() const { return m_pConnection; } - - ODatabaseMetaData(OConnection* _pCon); - - private: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); - // cached database information - virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ); - virtual sal_Bool impl_isCatalogAtStart_throw( ); - virtual ::rtl::OUString impl_getCatalogSeparator_throw( ); - virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ); - virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ; - virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ); - virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ; - virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) ; - virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ); - virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ); - virtual sal_Int32 impl_getMaxStatements_throw( ); - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ); - virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); - - // as I mentioned before this interface is really BIG - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - }; - } -} - -#endif // CONNECTIVITY_SDATABASEMETADATA_HXX diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx deleted file mode 100644 index 842aea48838c..000000000000 --- a/connectivity/source/drivers/mozab/MDriver.cxx +++ /dev/null @@ -1,325 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MDriver.hxx" -#include "MConnection.hxx" -#include "connectivity/dbexception.hxx" -#include "resource/mozab_res.hrc" -#include "resource/common_res.hrc" - -#include <tools/solar.h> -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace connectivity::mozab; - -namespace connectivity -{ - namespace mozab - { - //------------------------------------------------------------------ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) - { - return *(new MozabDriver( _rxFactory )); - } - } -} -// -------------------------------------------------------------------------------- -MozabDriver::MozabDriver( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) - : ODriver_BASE(m_aMutex), m_xMSFactory( _rxFactory ) - ,m_hModule(NULL) - ,m_pCreationFunc(NULL) -{ -} -// ----------------------------------------------------------------------------- -MozabDriver::~MozabDriver() -{ -} -// -------------------------------------------------------------------------------- -void MozabDriver::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - - // when driver will be destroied so all our connections have to be destroied as well - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) - { - Reference< XComponent > xComp(i->get(), UNO_QUERY); - if (xComp.is()) - xComp->dispose(); - } - m_xConnections.clear(); - connectivity::OWeakRefArray().swap(m_xConnections); // this really clears - - ODriver_BASE::disposing(); - if(m_hModule) - { - m_pCreationFunc = NULL; - osl_unloadModule(m_hModule); - m_hModule = NULL; - } -} - -// static ServiceInfo -//------------------------------------------------------------------------------ -rtl::OUString MozabDriver::getImplementationName_Static( ) throw(RuntimeException) -{ - return rtl::OUString::createFromAscii(MOZAB_DRIVER_IMPL_NAME); - // this name is referenced in the configuration and in the mozab.xml - // Please take care when changing it. -} -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > MozabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) -{ - // which service is supported - // for more information @see com.sun.star.sdbc.Driver - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); - return aSNS; -} - -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL MozabDriver::getImplementationName( ) throw(RuntimeException) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------ -sal_Bool SAL_CALL MozabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; -} - -//------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL MozabDriver::getSupportedServiceNames( ) throw(RuntimeException) -{ - return getSupportedServiceNames_Static(); -} - -// -------------------------------------------------------------------------------- -Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) -{ - if ( !ensureInit() ) - return NULL; - - if ( ! acceptsURL( url ) ) - return NULL; - // create a new connection with the given properties and append it to our vector - Reference< XConnection > xCon; - if (m_pCreationFunc) - { - ::osl::MutexGuard aGuard(m_aMutex); - //We must make sure we create an com.sun.star.mozilla.MozillaBootstrap brfore call any mozilla codes - Reference<XInterface> xInstance = m_xMSFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - - OConnection* pCon = reinterpret_cast<OConnection*>((*m_pCreationFunc)(this)); - xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0) - pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so - m_xConnections.push_back(WeakReferenceHelper(*pCon)); - - } - else - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( - STR_COULD_NOT_LOAD_LIB, - "$libname$", ::rtl::OUString::createFromAscii( SVLIBRARY( "mozabdrv" ) ) - ) ); - - ::dbtools::throwGenericSQLException(sError,*this); - } - - return xCon; -} -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL MozabDriver::acceptsURL( const ::rtl::OUString& url ) - throw(SQLException, RuntimeException) -{ - if ( !ensureInit() ) - return sal_False; - - // here we have to look if we support this url format - return impl_classifyURL(url) != Unknown; -} -// -------------------------------------------------------------------------------- -Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) -{ - if ( !ensureInit() ) - return Sequence< DriverPropertyInfo >(); - - if ( acceptsURL(url) ) - { - if ( impl_classifyURL(url) != LDAP ) - return Sequence< DriverPropertyInfo >(); - - ::std::vector< DriverPropertyInfo > aDriverInfo; - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Base DN.")) - ,sal_False - ,::rtl::OUString() - ,Sequence< ::rtl::OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Records (max.)")) - ,sal_False - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100")) - ,Sequence< ::rtl::OUString >()) - ); - return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); - } - ::connectivity::SharedResources aResources; - const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); - ::dbtools::throwGenericSQLException(sMessage ,*this); - // if you have somthing special to say return it here :-) - return Sequence< DriverPropertyInfo >(); -} -// -------------------------------------------------------------------------------- -sal_Int32 SAL_CALL MozabDriver::getMajorVersion( ) throw(RuntimeException) -{ - return 1; // depends on you -} -// -------------------------------------------------------------------------------- -sal_Int32 SAL_CALL MozabDriver::getMinorVersion( ) throw(RuntimeException) -{ - return 0; // depends on you -} -// -------------------------------------------------------------------------------- -EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url ) -{ - // Skip 'sdbc:mozab: part of URL - // - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); - // Get Scheme - nLen = aAddrbookURI.indexOf(':'); - ::rtl::OUString aAddrbookScheme; - if ( nLen == -1 ) - { - // There isn't any subschema: - but could be just subschema - if ( aAddrbookURI.getLength() > 0 ) - aAddrbookScheme= aAddrbookURI; - else if(url == ::rtl::OUString::createFromAscii("sdbc:address:") ) - return Unknown; // TODO check - else - return Unknown; - } - else - aAddrbookScheme = aAddrbookURI.copy(0, nLen); - - struct __scheme_map - { - EDriverType eType; - const sal_Char* pScheme; - } aSchemeMap[] = - { -#if defined(WNT) - { Outlook, "outlook" }, - { OutlookExpress, "outlookexp" }, -#endif - { Mozilla, "mozilla" }, - { ThunderBird, "thunderbird" }, - { LDAP, "ldap" } - }; - - for ( size_t i=0; i < sizeof( aSchemeMap ) / sizeof( aSchemeMap[0] ); ++i ) - { - if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 ) - return aSchemeMap[i].eType; - } - - return Unknown; -} - -// -------------------------------------------------------------------------------- -namespace -{ - template< typename FUNCTION > - void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule, const sal_Char* _pAsciiSymbolName, FUNCTION& _rFunction ) - { - _rFunction = NULL; - if ( _rModule ) - { - const ::rtl::OUString sSymbolName = ::rtl::OUString::createFromAscii( _pAsciiSymbolName ); - _rFunction = (FUNCTION)( osl_getFunctionSymbol( _rModule, sSymbolName.pData ) ); - - if ( !_rFunction ) - { // did not find the symbol - OSL_ENSURE( false, ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); - osl_unloadModule( _rModule ); - _rModule = NULL; - } - } - } -} - -// ----------------------------------------------------------------------------- -extern "C" { static void SAL_CALL thisModule() {} } - -bool MozabDriver::ensureInit() -{ - if ( m_hModule ) - return true; - - OSL_ENSURE(NULL == m_pCreationFunc, "MozabDriver::ensureInit: inconsistence: already have a factory function!"); - - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" )); - - // load the mozabdrv library - m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0); - OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the mozabdrv library!"); - if ( !m_hModule ) - return false; - - OSetMozabServiceFactory pSetFactoryFunc( NULL ); - - lcl_getFunctionFromModuleOrUnload( m_hModule, "setMozabServiceFactory", pSetFactoryFunc ); - lcl_getFunctionFromModuleOrUnload( m_hModule, "OMozabConnection_CreateInstance", m_pCreationFunc ); - - if ( !m_hModule ) - // one of the symbols did not exist - return false; - - if ( m_xMSFactory.is() ) - { - // for purpose of transfer safety, the interface needs to be acuired once - // (will be release by the callee) - m_xMSFactory->acquire(); - ( *pSetFactoryFunc )( m_xMSFactory.get() ); - } - - return true; -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MDriver.hxx b/connectivity/source/drivers/mozab/MDriver.hxx deleted file mode 100644 index 6cc1c57844ac..000000000000 --- a/connectivity/source/drivers/mozab/MDriver.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SDRIVER_HXX -#define CONNECTIVITY_SDRIVER_HXX - -#include <com/sun/star/sdbc/XDriver.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/compbase2.hxx> -#include "connectivity/CommonTools.hxx" -#include <osl/module.h> - - -#define MOZAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.MozabDriver" - -namespace connectivity -{ - namespace mozab - { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); - - typedef void* (SAL_CALL * OMozabConnection_CreateInstanceFunction)(void* _pDriver ); - typedef void (SAL_CALL * OSetMozabServiceFactory)( void* _pFactory ); - typedef const void* (SAL_CALL * OGetSdbcScheme_Function)( short ); - - - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, - ::com::sun::star::lang::XServiceInfo > ODriver_BASE; - - enum EDriverType - { - Mozilla, - ThunderBird, - LDAP, - Outlook, - OutlookExpress, - Unknown - }; - - class MozabDriver : public ODriver_BASE - { - protected: - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory; - - ::osl::Mutex m_aMutex; // mutex is need to control member access - connectivity::OWeakRefArray m_xConnections; // vector containing a list - // of all the Connection objects - // for this Driver - oslModule m_hModule; - OMozabConnection_CreateInstanceFunction m_pCreationFunc; - OGetSdbcScheme_Function m_pSchemeFunction; - - bool ensureInit(); - virtual ~MozabDriver(); - public: - - MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); - - // OComponentHelper - virtual void SAL_CALL disposing(void); - // XInterface - static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XDriver - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); - - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - & getMSFactory(void) const { return m_xMSFactory; } - - private: - EDriverType impl_classifyURL( const ::rtl::OUString& url ); - }; - } - -} - -#endif // CONNECTIVITY_SDRIVER_HXX diff --git a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx b/connectivity/source/drivers/mozab/MExtConfigAccess.hxx deleted file mode 100644 index a9cb5904d79e..000000000000 --- a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX - -// This is the extended version (for use on the SO side of the driver) of MConfigAccess -// (which is for use on the mozilla side only) - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -namespace connectivity -{ - namespace mozab - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB ); - } -} - -#endif // CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX - diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx deleted file mode 100644 index 4bcae50f3b2e..000000000000 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ /dev/null @@ -1,540 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <stdio.h> -#include <osl/diagnose.h> -#include "connectivity/sdbcx/VColumn.hxx" -#include "MPreparedStatement.hxx" -#include <com/sun/star/sdbc/DataType.hpp> -#include "MResultSetMetaData.hxx" -#include <cppuhelper/typeprovider.hxx> -#include <comphelper/sequence.hxx> -#include <com/sun/star/lang/DisposedException.hpp> -#include "connectivity/dbexception.hxx" -#include "connectivity/dbtools.hxx" -#include <comphelper/types.hxx> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include "diagnose_ex.h" - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::mozab; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; - -IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); - - -OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql) - :OCommonStatement(_pConnection) - ,m_nNumParams(0) - ,m_sSqlStatement(sql) - ,m_bPrepared(sal_False) - ,m_pResultSet() -{ -} -// ----------------------------------------------------------------------------- -OPreparedStatement::~OPreparedStatement() -{ -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::lateInit() -{ - if ( eSelect != parseSql( m_sSqlStatement ) ) - throw SQLException(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - - OCommonStatement::disposing(); - - m_xMetaData.clear(); - if(m_aParameterRow.isValid()) - { - m_aParameterRow->get().clear(); - m_aParameterRow = NULL; - } - m_xParamColumns = NULL; -} -// ----------------------------------------------------------------------------- - -OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted ) - throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) -{ - StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted ); - if ( eStatementType != eSelect ) - return eStatementType; - - m_xParamColumns = new OSQLColumns(); - - // describe all parameters need for the resultset - describeParameter(); - - Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); - OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping ); - - return eStatementType; -} - -// ----------------------------------------------------------------------------- -void OPreparedStatement::initializeResultSet( OResultSet* _pResult ) -{ - OCommonStatement::initializeResultSet( _pResult ); - _pResult->setParameterColumns( m_xParamColumns ); - _pResult->setParameterRow( m_aParameterRow ); -} - -// ----------------------------------------------------------------------------- -void OPreparedStatement::clearCachedResultSet() -{ - OCommonStatement::clearCachedResultSet(); - m_pResultSet.clear(); - m_xMetaData.clear(); -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult ) -{ - OCommonStatement::cacheResultSet( _pResult ); - OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" ); - m_pResultSet = _pResult; -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::acquire() throw() -{ - OCommonStatement::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::release() throw() -{ - OCommonStatement::release(); -} -// ----------------------------------------------------------------------------- -Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = OCommonStatement::queryInterface(rType); - if(!aRet.hasValue()) - aRet = OPreparedStatement_BASE::queryInterface(rType); - return aRet; -} -// ------------------------------------------------------------------------- -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) -{ - return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes()); -} -// ------------------------------------------------------------------------- - -Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - sal_Bool bReadOnly = sal_True; - if ( m_pResultSet.is() ) - bReadOnly = m_pResultSet->determineReadOnly(); - // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is - // okay, /me thinks. - - if ( !m_xMetaData.is() ) - m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly ); - - return m_xMetaData; -} - -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - Reference< XResultSet> xResult = executeQuery(); - return xResult.is(); -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this ); - return 0; -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) ); - setParameter( parameterIndex, x ); -} -// ------------------------------------------------------------------------- - -Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - return (Reference< XConnection >)m_pConnection; -} -// ------------------------------------------------------------------------- - -Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_TRACE("In: OPreparedStatement::executeQuery" ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - // our statement has already been parsed in lateInit, no need to do all this (potentially expensive) - // stuff again. Just execute. - return impl_executeCurrentQuery(); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setBoolean", *this ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setByte", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setDate", *this ); -} -// ------------------------------------------------------------------------- - - -void SAL_CALL OPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const Time& /*aVal*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setTime", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setTimestamp", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setDouble", *this ); -} - -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setFloat", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setInt", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setLong", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - checkAndResizeParameters(parameterIndex); - - (m_aParameterRow->get())[parameterIndex].setNull(); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setObjectWithInfo", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException) -{ - setNull(parameterIndex,sqlType); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) -{ - ::dbtools::implSetObject(this,parameterIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setShort", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setBytes", *this ); -} -// ------------------------------------------------------------------------- - - -void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setCharacterStream", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XParameters::setBinaryStream", *this ); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) -{ - switch(nHandle) - { - case PROPERTY_ID_RESULTSETCONCURRENCY: - break; - case PROPERTY_ID_RESULTSETTYPE: - break; - case PROPERTY_ID_FETCHDIRECTION: - break; - case PROPERTY_ID_USEBOOKMARKS: - break; - default: - OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue); - } -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) -{ - if( !_parameterIndex || _parameterIndex > m_nNumParams) - ::dbtools::throwInvalidIndexException(*this); -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex) -{ - ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - if ( !m_aParameterRow.isValid() ) { - m_aParameterRow = new OValueVector(); - m_aParameterRow->get().push_back(sal_Int32(0)); - } - - if ((sal_Int32)(m_aParameterRow->get()).size() <= parameterIndex) - (m_aParameterRow->get()).resize(parameterIndex+1); -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const -ORowSetValue& x) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkAndResizeParameters(parameterIndex); - - OSL_TRACE("setParameter( %d, '%s')", parameterIndex, OUtoCStr(x) ); - (m_aParameterRow->get())[parameterIndex] = x; -} - -//------------------------------------------------------------------ -sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol) -{ - OSL_UNUSED( pParameter ); - // Nr. des neu hinzuzufuegenden Parameters: - sal_uInt32 nParameter = m_xParamColumns->get().size()+1; - - OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter"); - OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree"); -#if OSL_DEBUG_LEVEL > 0 - OSQLParseNode * pMark = pParameter->getChild(0); - OSL_UNUSED( pMark ); -#endif - - ::rtl::OUString sParameterName; - - // Parameter-Column aufsetzen: - sal_Int32 eType = DataType::VARCHAR; - sal_uInt32 nPrecision = 255; - sal_Int32 nScale = 0; - sal_Int32 nNullable = ColumnValue::NULLABLE; - - if (_xCol.is()) - { - // Typ, Precision, Scale ... der angegebenen Column verwenden, - // denn dieser Column wird der Wert zugewiesen bzw. mit dieser - // Column wird der Wert verglichen. - eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); - nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); - nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); - nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); - _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName; - } - - Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName - ,::rtl::OUString() - ,::rtl::OUString() - ,::rtl::OUString() - ,nNullable - ,nPrecision - ,nScale - ,eType - ,sal_False - ,sal_False - ,sal_False - ,m_pSQLIterator->isCaseSensitive()); - m_xParamColumns->get().push_back(xParaColumn); - return nParameter; -} -// ----------------------------------------------------------------------------- -void OPreparedStatement::describeColumn(OSQLParseNode* -_pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable) -{ - Reference<XPropertySet> xProp; - if(SQL_ISRULE(_pNode,column_ref)) - { - ::rtl::OUString sColumnName,sTableRange; - m_pSQLIterator->getColumnRange(_pNode,sColumnName,sTableRange); - if(sColumnName.getLength()) - { - Reference<XNameAccess> xNameAccess = _xTable->getColumns(); - if(xNameAccess->hasByName(sColumnName)) - xNameAccess->getByName(sColumnName) >>= xProp; - AddParameter(_pParameter,xProp); - } - } - // else - // AddParameter(_pParameter,xProp); -} -// ------------------------------------------------------------------------- -void OPreparedStatement::describeParameter() -{ - ::std::vector< OSQLParseNode*> aParseNodes; - scanParameter(m_pParseTree,aParseNodes); - if(aParseNodes.size()) - { - m_xParamColumns = new OSQLColumns(); - const OSQLTables& xTabs = m_pSQLIterator->getTables(); - if(xTabs.size()) - { - OSQLTable xTable = xTabs.begin()->second; - ::std::vector< OSQLParseNode*>::const_iterator aIter = -aParseNodes.begin(); - for (;aIter != aParseNodes.end();++aIter ) - { - describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable); - } - } - } -} - -// ----------------------------------------------------------------------------- -void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes) -{ - OSL_ENSURE(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode"); - - // Parameter Name-Regel gefunden? - if (SQL_ISRULE(pParseNode,parameter)) - { - OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); - OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); - - _rParaNodes.push_back(pParseNode); - // Weiterer Abstieg nicht erforderlich - return; - } - - // Weiter absteigen im Parse Tree - for (sal_uInt32 i = 0; i < pParseNode->count(); i++) - scanParameter(pParseNode->getChild(i),_rParaNodes); -} -// ----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OPreparedStatement::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL OPreparedStatement::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - return 0; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OPreparedStatement::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} -// ----------------------------------------------------------------------------- - - diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx deleted file mode 100644 index d3af1fde28e9..000000000000 --- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX -#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX - -#ifndef CONNECTIVITY_SRESULTSET_HXX -#include "MResultSet.hxx" -#endif -#include "MStatement.hxx" -#include <com/sun/star/sdbc/XPreparedStatement.hpp> -#include <com/sun/star/sdbc/XParameters.hpp> -#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/sdbc/XMultipleResults.hpp> -#include <cppuhelper/compbase5.hxx> - -namespace connectivity -{ - namespace mozab - { - - class OBoundParam; - typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, - ::com::sun::star::sdbc::XParameters, - ::com::sun::star::sdbc::XResultSetMetaDataSupplier, - ::com::sun::star::sdbc::XMultipleResults, - ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE; - - class OPreparedStatement : public OCommonStatement, - public OPreparedStatement_BASE - { - protected: - struct Parameter - { - ::com::sun::star::uno::Any aValue; - sal_Int32 nDataType; - - Parameter(const ::com::sun::star::uno::Any& rValue, - sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType) - { - } - - }; - - ::std::vector< Parameter> m_aParameters; - //==================================================================== - // Data attributes - //==================================================================== - sal_Int32 m_nNumParams; // Number of parameter markers - // for the prepared statement - - ::rtl::OUString m_sSqlStatement; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; - sal_Bool m_bPrepared; - ::rtl::Reference< OResultSet > m_pResultSet; - ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns - OValueRow m_aParameterRow; - - - void checkParameterIndex(sal_Int32 _parameterIndex); - - protected: - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue) - throw (::com::sun::star::uno::Exception); - virtual ~OPreparedStatement(); - - virtual void SAL_CALL disposing(); - - // OCommonStatement overridables - virtual StatementType - parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); - virtual void initializeResultSet( OResultSet* _pResult ); - virtual void clearCachedResultSet(); - virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult ); - - - void checkAndResizeParameters(sal_Int32 parameterIndex); - void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x); - - sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol); - void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes); - void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable); - void describeParameter(); - - public: - DECLARE_SERVICE_INFO(); - // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql); - void lateInit(); - - //XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - - // XPreparedStatement - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XParameters - virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XResultSetMetaDataSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XMultipleResults - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - public: - using OCommonStatement::executeQuery; - using OCommonStatement::executeUpdate; - using OCommonStatement::execute; - protected: - using OPropertySetHelper::getFastPropertyValue; - }; - } -} -#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx deleted file mode 100644 index 621cfb8307a5..000000000000 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ /dev/null @@ -1,1976 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <comphelper/property.hxx> -#include <comphelper/sequence.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <comphelper/extract.hxx> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/FetchDirection.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <comphelper/types.hxx> -#include <connectivity/dbexception.hxx> -#include <connectivity/dbtools.hxx> - -#include <TSortIndex.hxx> -#include <rtl/string.hxx> -#include <vector> -#include <algorithm> -#include "MResultSet.hxx" -#include "MResultSetMetaData.hxx" -#include "FDatabaseMetaDataResultSet.hxx" -#include "resource/mozab_res.hrc" -#include "resource/common_res.hrc" - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::mozab; -using namespace ::cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; - -//------------------------------------------------------------------------------ -// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); -::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.mozab.ResultSet")); -} -// ------------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) -{ - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); - aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); - return aSupported; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; -} - -// ------------------------------------------------------------------------- -OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator ) - : OResultSet_BASE(m_aMutex) - ,OPropertySetHelper(OResultSet_BASE::rBHelper) - ,m_pStatement(pStmt) - ,m_xStatement(*pStmt) - ,m_xMetaData(NULL) - ,m_nRowPos(0) - ,m_nOldRowPos(0) - ,m_nFetchSize(0) - ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE) - ,m_nFetchDirection(FetchDirection::FORWARD) - ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE) - ,m_pSQLIterator( _pSQLIterator ) - ,m_pParseTree( _pSQLIterator->getParseTree() ) - ,m_aQuery( pStmt->getOwnConnection()->getColumnAlias() ) - ,m_pTable(NULL) - ,m_CurrentRowCount(0) - ,m_nParamIndex(0) - ,m_bIsAlwaysFalseQuery(sal_False) - ,m_pKeySet(NULL) - ,m_nNewRow(0) - ,m_nUpdatedRow(0) - ,m_RowStates(0) - ,m_bIsReadOnly(-1) -{ - - m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords()); -} -// ------------------------------------------------------------------------- -OResultSet::~OResultSet() -{ -} - -// ------------------------------------------------------------------------- -void OResultSet::disposing(void) -{ - OPropertySetHelper::disposing(); - - ::osl::MutexGuard aGuard(m_aMutex); - - m_xStatement.clear(); - m_xMetaData.clear(); - m_pParseTree = NULL; - m_xColumns = NULL; - m_xParamColumns = NULL; - m_pKeySet = NULL; - if(m_pTable) - { - m_pTable->release(); - m_pTable = NULL; - } -} -// ------------------------------------------------------------------------- -Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = OPropertySetHelper::queryInterface(rType); - if(!aRet.hasValue()) - aRet = OResultSet_BASE::queryInterface(rType); - return aRet; -} -// ------------------------------------------------------------------------- - Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException) -{ - OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), - ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), - ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); - - return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); -} -// ------------------------------------------------------------------------- -void OResultSet::methodEntry() -{ - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - if ( !m_pTable ) - { - OSL_ENSURE( false, "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" ); - throw DisposedException( ::rtl::OUString(), *this ); - } -} - -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - // find the first column with the name columnName - Reference< XResultSetMetaData > xMeta = getMetaData(); - sal_Int32 nLen = xMeta->getColumnCount(); - sal_Int32 i = 1; - for(;i<=nLen;++i) - if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : - columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) - break; - return i; -} -// ------------------------------------------------------------------------- -Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} -// ------------------------------------------------------------------------- -Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} - -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - m_bWasNull = sal_True; - return sal_False; -} -// ------------------------------------------------------------------------- - -sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return 0; -} -// ------------------------------------------------------------------------- - -Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return Sequence< sal_Int8 >(); -} -// ------------------------------------------------------------------------- - -Date SAL_CALL OResultSet::getDate( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return Date(); -} -// ------------------------------------------------------------------------- - -double SAL_CALL OResultSet::getDouble( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return 0.0; -} -// ------------------------------------------------------------------------- - -float SAL_CALL OResultSet::getFloat( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return 0; -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return 0; -} - -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_TRACE("In/Out: OResultSet::getRow, return = %u", m_nRowPos ); - return m_nRowPos; -} -// ------------------------------------------------------------------------- - -sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return sal_Int64(); -} -// ------------------------------------------------------------------------- - -Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - if(!m_xMetaData.is()) - m_xMetaData = new OResultSetMetaData( - m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,determineReadOnly()); - return m_xMetaData; -} -// ------------------------------------------------------------------------- -Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} - -// ------------------------------------------------------------------------- - -Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} -// ------------------------------------------------------------------------- -Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} -// ------------------------------------------------------------------------- - -Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return NULL; -} -// ------------------------------------------------------------------------- - -Any SAL_CALL OResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) -{ - return Any(); -} -// ------------------------------------------------------------------------- - -sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - return 0; -} -// ------------------------------------------------------------------------- - -void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException) -{ - if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->get().size()) - ::dbtools::throwInvalidIndexException(*this); -} -// ------------------------------------------------------------------------- -sal_uInt32 OResultSet::currentRowCount() -{ - if ( m_bIsAlwaysFalseQuery ) - return 0; - return m_aQuery.getRealRowCount() - deletedCount(); -} - -// ------------------------------------------------------------------------- - -sal_Bool OResultSet::fetchCurrentRow( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("fetchCurrentRow, m_nRowPos = %u", m_nRowPos ); - return fetchRow(getCurrentCardNumber()); -} - -// ------------------------------------------------------------------------- -sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, RuntimeException) -{ - if (cardNumber == 0) - return sal_True; - // Check whether we are storing the updated row - if ( (m_aRow->get())[0].isNull() || (sal_Int32)(m_aRow->get())[0] != (sal_Int32)cardNumber ) - return sal_False; - - sal_Int32 nCount = m_aColumnNames.getLength(); - m_aQuery.setRowStates(cardNumber,m_RowStates); - for( sal_Int32 i = 1; i <= nCount; i++ ) - { - if ( (m_aRow->get())[i].isBound() ) - { - // - // Everything in the addressbook is a string! - // - if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) - { - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - } - } - return sal_True; - -} -// ------------------------------------------------------------------------- -sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(SQLException, RuntimeException) -{ - OSL_TRACE("fetchRow, cardNumber = %u", cardNumber ); - if (!bForceReload) - { - // Check whether we've already fetched the row... - if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == (sal_Int32)cardNumber ) - return sal_True; - //Check whether the old row has been changed - if (cardNumber == m_nUpdatedRow) - { - //write back the changes first - if (!pushCard(cardNumber)) //error write back the changes - throw SQLException(); - } - } - else - m_aQuery.resyncRow(cardNumber); - - if ( validRow( cardNumber ) == sal_False ) - return sal_False; - - (m_aRow->get())[0] = (sal_Int32)cardNumber; - sal_Int32 nCount = m_aColumnNames.getLength(); - m_RowStates = m_aQuery.getRowStates(cardNumber); - for( sal_Int32 i = 1; i <= nCount; i++ ) - { - if ( (m_aRow->get())[i].isBound() ) - { - // - // Everything in the addressbook is a string! - // - if ( !m_aQuery.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) - { - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - } - } - return sal_True; -} -// ------------------------------------------------------------------------- - -const ORowSetValue& OResultSet::getValue(sal_Int32 cardNumber, sal_Int32 columnIndex ) throw(SQLException, RuntimeException) -{ - if ( fetchRow( cardNumber ) == sal_False ) - { - OSL_ASSERT("fetchRow() returned False" ); - m_bWasNull = sal_True; - return *ODatabaseMetaDataResultSet::getEmptyValue(); - } - - m_bWasNull = (m_aRow->get())[columnIndex].isNull(); - return (m_aRow->get())[columnIndex]; - -} -// ------------------------------------------------------------------------- - - -::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!"); - OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->get().size(), "Trying to access invalid columns number"); - checkIndex( columnIndex ); - - // If this query was sorted then we should have a valid KeySet, so use it - return getValue(getCurrentCardNumber(), mapColumn( columnIndex ) ); - -} -// ------------------------------------------------------------------------- - -Time SAL_CALL OResultSet::getTime( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return Time(); -} -// ------------------------------------------------------------------------- - - -DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - return DateTime(); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - // here you have to implement your movements - // return true means there is no data - OSL_TRACE("In/Out: OResultSet::isBeforeFirst" ); - return( m_nRowPos < 1 ); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_TRACE("In/Out: OResultSet::isAfterLast" ); - return m_nRowPos > currentRowCount() && m_aQuery.queryComplete(); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_TRACE("In/Out: OResultSet::isFirst" ); - return m_nRowPos == 1; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_TRACE("In/Out: OResultSet::isLast" ); - return m_nRowPos == currentRowCount() && m_aQuery.queryComplete(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - // move before the first row so that isBeforeFirst returns false - OSL_TRACE("In/Out: OResultSet::beforeFirst" ); - if ( first() ) - previous(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::afterLast" ); - - if(last()) - next(); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::close" ); - dispose(); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::first" ); - return seekRow( FIRST_POS ); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::last" ); - return seekRow( LAST_POS ); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::absolute" ); - return seekRow( ABSOLUTE_POS, row ); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::relative" ); - return seekRow( RELATIVE_POS, row ); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::previous" ); - return seekRow( PRIOR_POS ); -} -// ------------------------------------------------------------------------- -Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_TRACE("In/Out: OResultSet::getStatement" ); - return m_xStatement; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::rowDeleted, m_RowStates=%u",m_RowStates ); - return ((m_RowStates & RowStates_Deleted) == RowStates_Deleted) ; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::rowInserted,m_RowStates=%u",m_RowStates ); - return ((m_RowStates & RowStates_Inserted) == RowStates_Inserted); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::rowUpdated,m_RowStates=%u",m_RowStates ); - return ((m_RowStates & RowStates_Updated) == RowStates_Updated) ; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) -{ - return seekRow( NEXT_POS ); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - return m_bWasNull; -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("In/Out: OResultSet::cancel" ); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::clearWarnings" ); -} -// ------------------------------------------------------------------------- -Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::getWarnings" ); - return Any(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::refreshRow" ); - if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row - m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this ); -} -// ------------------------------------------------------------------------- -IPropertyArrayHelper* OResultSet::createArrayHelper( ) const -{ - Sequence< Property > aProps(5); - Property* pProperties = aProps.getArray(); - sal_Int32 nPos = 0; - DECL_PROP0(FETCHDIRECTION, sal_Int32); - DECL_PROP0(FETCHSIZE, sal_Int32); - DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); - DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); - DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); - - return new OPropertyArrayHelper(aProps); -} -// ------------------------------------------------------------------------- -IPropertyArrayHelper & OResultSet::getInfoHelper() -{ - return *const_cast<OResultSet*>(this)->getArrayHelper(); -} -// ------------------------------------------------------------------------- -sal_Bool OResultSet::convertFastPropertyValue( - Any & /*rConvertedValue*/, - Any & /*rOldValue*/, - sal_Int32 nHandle, - const Any& /*rValue*/ ) - throw (::com::sun::star::lang::IllegalArgumentException) -{ - OSL_ENSURE( false, "OResultSet::convertFastPropertyValue: not implemented!" ); - switch(nHandle) - { - case PROPERTY_ID_ISBOOKMARKABLE: - case PROPERTY_ID_RESULTSETCONCURRENCY: - case PROPERTY_ID_RESULTSETTYPE: - throw ::com::sun::star::lang::IllegalArgumentException(); - case PROPERTY_ID_FETCHDIRECTION: - case PROPERTY_ID_FETCHSIZE: - default: - ; - } - return sal_False; -} -// ------------------------------------------------------------------------- -void OResultSet::setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const Any& /*rValue*/ - ) - throw (Exception) -{ - OSL_ENSURE( false, "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" ); - switch(nHandle) - { - case PROPERTY_ID_ISBOOKMARKABLE: - case PROPERTY_ID_RESULTSETCONCURRENCY: - case PROPERTY_ID_RESULTSETTYPE: - throw Exception(); - case PROPERTY_ID_FETCHDIRECTION: - break; - case PROPERTY_ID_FETCHSIZE: - break; - default: - ; - } -} -// ------------------------------------------------------------------------- -void OResultSet::getFastPropertyValue( - Any& rValue, - sal_Int32 nHandle - ) const -{ - switch(nHandle) - { - case PROPERTY_ID_RESULTSETCONCURRENCY: - rValue <<= (sal_Int32)m_nResultSetConcurrency; - break; - case PROPERTY_ID_RESULTSETTYPE: - rValue <<= m_nResultSetType; - break; - case PROPERTY_ID_FETCHDIRECTION: - rValue <<= m_nFetchDirection; - break; - case PROPERTY_ID_FETCHSIZE: - rValue <<= m_nFetchSize; - break; - case PROPERTY_ID_ISBOOKMARKABLE: - const_cast< OResultSet* >( this )->determineReadOnly(); - rValue <<= !m_bIsReadOnly; - break; - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OResultSet::acquire() throw() -{ - OResultSet_BASE::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OResultSet::release() throw() -{ - OResultSet_BASE::release(); -} -// ----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) -{ - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); -} -// ----------------------------------------------------------------------------- -void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount) -{ - if(!_rRow.isValid()) - { - _rRow = new OValueVector(_nColumnCount); - (_rRow->get())[0].setBound(sal_True); - ::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetBound(sal_False)); - } -} - -// ------------------------------------------------------------------------- -void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString ) -{ - OSL_ENSURE(pNode->count() > 0,"Error parsing parameter in Parse Tree"); - OSQLParseNode *pMark = pNode->getChild(0); - - // Initialize to empty string - rMatchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")); - - rtl::OUString aParameterName; - if (SQL_ISPUNCTUATION(pMark,"?")) { - aParameterName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?")); - } - else if (SQL_ISPUNCTUATION(pMark,":")) { - aParameterName = pNode->getChild(1)->getTokenValue(); - } - // XXX - Now we know name, what's value???? - m_nParamIndex ++; - OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex,OUtoCStr(aParameterName) ); - - if ( m_aParameterRow.isValid() ) { - OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->get().size() + 1, "More parameters than values found" ); - rMatchString = (m_aParameterRow->get())[(sal_uInt16)m_nParamIndex]; -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Prop Value : %s\n", OUtoCStr( rMatchString ) ); -#endif - } -#if OSL_DEBUG_LEVEL > 0 - else { - OSL_TRACE("Prop Value : Invalid ParameterRow!\n" ); - } -#endif -} - -void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, - MQueryExpression &queryExpression) -{ - ::rtl::OUString columnName; - MQueryOp::cond_type op( MQueryOp::Is ); - ::rtl::OUString matchString; - - if ( parseTree == NULL ) - return; - - if ( m_pSQLIterator->getParseTree() != NULL ) { - ::vos::ORef<OSQLColumns> xColumns = m_pSQLIterator->getParameters(); - if(xColumns.isValid()) - { - ::rtl::OUString aTabName,aColName,aParameterName,aParameterValue; - OSQLColumns::Vector::iterator aIter = xColumns->get().begin(); - sal_Int32 i = 1; - for(;aIter != xColumns->get().end();++aIter) - { - (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; - OSL_TRACE("Prop Column Name : %s\n", OUtoCStr( aColName ) ); - if ( m_aParameterRow.isValid() ) { - aParameterValue = (m_aParameterRow->get())[(sal_uInt16)i]; -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Prop Value : %s\n", OUtoCStr( aParameterValue ) ); -#endif - } -#if OSL_DEBUG_LEVEL > 0 - else { - OSL_TRACE("Prop Value : Invalid ParameterRow!\n" ); - } -#endif - i++; - } - } - - } - - if ( SQL_ISRULE(parseTree,where_clause) ) - { - OSL_TRACE("analyseSQL : Got WHERE clause\n"); - // Reset Parameter Counter - resetParameters(); - analyseWhereClause( parseTree->getChild( 1 ), queryExpression ); - } - else if ( parseTree->count() == 3 && // Handle ()'s - SQL_ISPUNCTUATION(parseTree->getChild(0),"(") && - SQL_ISPUNCTUATION(parseTree->getChild(2),")")) - { - - OSL_TRACE("analyseSQL : Got Punctuation ()\n"); - MQueryExpression *subExpression = new MQueryExpression(); - analyseWhereClause( parseTree->getChild( 1 ), *subExpression ); - queryExpression.getExpressions().push_back( subExpression ); - } - else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term))) - && parseTree->count() == 3) // Handle AND/OR - { - - OSL_TRACE("analyseSQL : Got AND/OR clause\n"); - - // TODO - Need to take care or AND, for now match is always OR - analyseWhereClause( parseTree->getChild( 0 ), queryExpression ); - analyseWhereClause( parseTree->getChild( 2 ), queryExpression ); - - if (SQL_ISTOKEN(parseTree->getChild(1),OR)) { // OR-Operator - queryExpression.setExpressionCondition( MQueryExpression::OR ); - } - else if (SQL_ISTOKEN(parseTree->getChild(1),AND)) { // AND-Operator - queryExpression.setExpressionCondition( MQueryExpression::AND ); - } - else { - OSL_ASSERT("analyseSQL: Error in Parse Tree"); - } - } - else if (SQL_ISRULE(parseTree,comparison_predicate)) - { - OSL_ENSURE(parseTree->count() == 3, "Error parsing COMPARE predicate"); - if (!(SQL_ISRULE(parseTree->getChild(0),column_ref) || - parseTree->getChild(2)->getNodeType() == SQL_NODE_STRING || - parseTree->getChild(2)->getNodeType() == SQL_NODE_INTNUM || - parseTree->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM || - SQL_ISTOKEN(parseTree->getChild(2),TRUE) || - SQL_ISTOKEN(parseTree->getChild(2),FALSE) || - SQL_ISRULE(parseTree->getChild(2),parameter) || - // odbc date - (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{")))) - { - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); - } - - OSQLParseNode *pPrec = parseTree->getChild(1); - if (pPrec->getNodeType() == SQL_NODE_EQUAL) - op = MQueryOp::Is; - else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL) - op = MQueryOp::IsNot; - - ::rtl::OUString sTableRange; - if(SQL_ISRULE(parseTree->getChild(0),column_ref)) - m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange); - else if(parseTree->getChild(0)->isToken()) - columnName = parseTree->getChild(0)->getTokenValue(); - - if ( SQL_ISRULE(parseTree->getChild(2),parameter) ) { - parseParameter( parseTree->getChild(2), matchString ); - } - else { - matchString = parseTree->getChild(2)->getTokenValue(); - } - - if ( columnName.compareToAscii("0") ==0 && op == MQueryOp::Is && - matchString.compareToAscii("1") == 0 ) { - OSL_TRACE("Query always evaluates to FALSE"); - m_bIsAlwaysFalseQuery = sal_True; - } - queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString )); - } - else if (SQL_ISRULE(parseTree,like_predicate)) - { - OSL_ENSURE(parseTree->count() == 2, "Error parsing LIKE predicate"); - - OSL_TRACE("analyseSQL : Got LIKE rule\n"); - - if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) ) - { - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_COLUMN, *this ); - } - - - OSQLParseNode *pColumn; - OSQLParseNode *pAtom; - OSQLParseNode *pOptEscape; - const OSQLParseNode* pPart2 = parseTree->getChild(1); - pColumn = parseTree->getChild(0); // Match Item - pAtom = pPart2->getChild(pPart2->count()-2); // Match String - pOptEscape = pPart2->getChild(pPart2->count()-1); // Opt Escape Rule - const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT); - - if (!(pAtom->getNodeType() == SQL_NODE_STRING || - pAtom->getNodeType() == SQL_NODE_NAME || - SQL_ISRULE(pAtom,parameter) || - ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_NAME ) || - ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING ) - ) ) - { - OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() ); - - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_STRING, *this ); - } - - const sal_Unicode WILDCARD = '%'; - const sal_Unicode ALT_WILDCARD = '*'; - const sal_Unicode MATCHCHAR = '_'; - - ::rtl::OUString sTableRange; - if(SQL_ISRULE(pColumn,column_ref)) - m_pSQLIterator->getColumnRange(pColumn,columnName,sTableRange); - - OSL_TRACE("ColumnName = %s\n", OUtoCStr( columnName ) ); - - if ( SQL_ISRULE(pAtom,parameter) ) { - parseParameter( pAtom, matchString ); - // Replace all '*' with '%' : UI Usually does this but not with - // Parameters for some reason. - matchString = matchString.replace( ALT_WILDCARD, WILDCARD ); - } - else - { - matchString = pAtom->getTokenValue(); - } - - // Determine where '%' character is... - - if ( matchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) ) - { - // String containing only a '%' and nothing else - op = MQueryOp::Exists; - // Will be ignored for Exists case, but clear anyway. - matchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")); - } - else if ( matchString.indexOf ( WILDCARD ) == -1 && - matchString.indexOf ( MATCHCHAR ) == -1 ) - { - // Simple string , eg. "to match" - if ( bNot ) - op = MQueryOp::DoesNotContain; - else - op = MQueryOp::Contains; - } - else if ( matchString.indexOf ( WILDCARD ) == 0 - && matchString.lastIndexOf ( WILDCARD ) == matchString.getLength() -1 - && matchString.indexOf ( WILDCARD, 1 ) == matchString.lastIndexOf ( WILDCARD ) - && matchString.indexOf( MATCHCHAR ) == -1 - ) - { - // Relatively simple "%string%" - ie, contains... - // Cut '%' from front and rear - matchString = matchString.replaceAt( 0, 1, rtl::OUString() ); - matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() ); - - if (bNot) - op = MQueryOp::DoesNotContain; - else - op = MQueryOp::Contains; - } - else if ( bNot ) - { - // We currently can't handle a 'NOT LIKE' when there are '%' or - // '_' dispersed throughout - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_NOT_LIKE_TOO_COMPLEX, *this ); - } - else - { - if ( (matchString.indexOf ( WILDCARD ) == matchString.lastIndexOf ( WILDCARD )) - && matchString.indexOf( MATCHCHAR ) == -1 - ) - { - // One occurance of '%' - no '_' matches... - if ( matchString.indexOf ( WILDCARD ) == 0 ) - { - op = MQueryOp::EndsWith; - matchString = matchString.replaceAt( 0, 1, rtl::OUString()); - } - else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 ) - { - op = MQueryOp::BeginsWith; - matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() ); - } - else - { - sal_Int32 pos = matchString.indexOf ( WILDCARD ); - matchString = matchString.replaceAt( pos, 1,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) ); - op = MQueryOp::RegExp; - } - - } - else - { - // Most Complex, need to use an RE - sal_Int32 pos = matchString.indexOf ( WILDCARD ); - while ( (pos = matchString.indexOf ( WILDCARD )) != -1 ) - { - matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) ); - } - - pos = matchString.indexOf ( MATCHCHAR ); - while ( (pos = matchString.indexOf( MATCHCHAR )) != -1 ) - { - matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".")) ); - } - - op = MQueryOp::RegExp; - } - } - - queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString )); - } - else if (SQL_ISRULE(parseTree,test_for_null)) - { - OSL_ENSURE(parseTree->count() == 2,"Error in ParseTree"); - const OSQLParseNode* pPart2 = parseTree->getChild(1); - OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"Error in ParseTree"); - - if (!SQL_ISRULE(parseTree->getChild(0),column_ref)) - { - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this ); - } - - if (SQL_ISTOKEN(pPart2->getChild(1),NOT)) - { - op = MQueryOp::Exists; - } - else - op = MQueryOp::DoesNotExist; - - ::rtl::OUString sTableRange; - m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange); - - queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op )); - } - else - { - OSL_TRACE( "Unexpected statement!!!" ); - - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); - } -} - - -// ----------------------------------------------------------------------------- - -void OResultSet::fillRowData() - throw( ::com::sun::star::sdbc::SQLException ) -{ - OSL_ENSURE( m_pStatement, "Require a statement" ); - - MQueryExpression queryExpression; - - OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get()); - m_xColumns = m_pSQLIterator->getSelectColumns(); - - OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!"); - - OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin(); - const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - ::rtl::OUString sName; - m_aAttributeStrings.clear(); - m_aAttributeStrings.reserve(m_xColumns->get().size()); - for (sal_Int32 i = 1; aIter != m_xColumns->get().end();++aIter, i++) - { - (*aIter)->getPropertyValue(sProprtyName) >>= sName; -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Query Columns : (%d) %s\n", i, OUtoCStr(sName) ); -#endif - m_aAttributeStrings.push_back( sName ); - } - - - // Generate Match Conditions for Query - const OSQLParseNode* pParseTree = m_pSQLIterator->getWhereTree(); - - // const OSQLParseNode* pParseTree = NULL; - - m_bIsAlwaysFalseQuery = sal_False; - if ( pParseTree != NULL ) - { - // Extract required info - - OSL_TRACE("\tHave a Where Clause\n"); - - analyseWhereClause( pParseTree, queryExpression ); - } - else - { - OSL_TRACE("\tDon't have a Where Clause\n"); - - MQueryExpression::ExprVector eVector; - - // LDAP does not allow a query without restriction, so we add a dummy - // for PrimaryEmail - // For other types we stick to the old behaviour of using - // card:nsIAbCard. - OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement"); - ::rtl::OUString aStr; - if (xConnection->isLDAP()) - aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")); - else - aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("card:nsIAbCard")); - eVector.push_back( new MQueryExpressionString(aStr, MQueryOp::Exists) ); - - queryExpression.setExpressions( eVector ); - } - - // If the query is a 0=1 then set Row count to 0 and return - if ( m_bIsAlwaysFalseQuery ) - { - m_bIsReadOnly = 1; - return; - } - - m_aQuery.setExpression( queryExpression ); - - rtl::OUString aStr( m_pTable->getName() ); - m_aQuery.setAddressbook( aStr ); - - sal_Int32 rv = m_aQuery.executeQuery(xConnection); - if ( rv == -1 ) { - m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this ); - } - //determine whether the address book is readonly - determineReadOnly(); - -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE( "executeQuery returned %d\n", rv ); - - OSL_TRACE( "\tOUT OResultSet::fillRowData()\n" ); -#endif -} - -// ----------------------------------------------------------------------------- -static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 ) -{ - OValueVector::Vector::iterator row1Iter = row1->get().begin(); - OValueVector::Vector::iterator row2Iter = row2->get().begin(); - for ( ++row1Iter,++row2Iter; // the first column is the bookmark column - row1Iter != row1->get().end(); ++row1Iter,++row2Iter) - { - if ( row1Iter->isBound()) - { - // Compare values, if at anytime there's a mismatch return false - if ( !( (*row1Iter) == (*row2Iter) ) ) - return sal_False; - } - } - - // If we get to here the rows match - return sal_True; -} -sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum) -{ - OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, nCardNum = %u", nCardNum ); - - if ( m_pKeySet.isValid() ) - { - sal_Int32 nPos; - for(nPos=0;nPos < (sal_Int32)m_pKeySet->get().size();nPos++) - { - if (nCardNum == (m_pKeySet->get())[nPos]) - { - OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, return = %u", nPos+1 ); - return nPos+1; - } - } - } - - m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this ); - return 0; -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException, - ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - OSL_ENSURE( m_pTable, "Need a Table object"); - if(!m_pTable) - { - const OSQLTables& xTabs = m_pSQLIterator->getTables(); - if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is()) - m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); - - m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get()); - - } - - m_nRowPos = 0; - - fillRowData(); - - OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!"); - - // sal_Int32 nColumnCount = m_xColumns->size(); - // initializeRow(m_aRow,nColumnCount); - // initializeRow(m_aEvaluateRow,nColumnCount); - - switch( m_pSQLIterator->getStatementType() ) - { - case SQL_STATEMENT_SELECT: - { - if(m_bIsAlwaysFalseQuery) { - break; - } - else if(isCount()) - { - m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this ); - } - else - { - sal_Bool bDistinct = sal_False; - sal_Bool bWasSorted = sal_False; - OSQLParseNode *pDistinct = m_pParseTree->getChild(1); - if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT) - { - if(!IsSorted()) - { - m_aOrderbyColumnNumber.push_back(m_aColMapping[1]); - m_aOrderbyAscending.push_back(SQL_DESC); - } - else - bWasSorted = sal_True; - bDistinct = sal_True; - } - - OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size()); - ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); - for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) - { - OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index"); - switch ((m_aRow->get().begin()+*aOrderByIter)->getTypeKind()) - { - case DataType::CHAR: - case DataType::VARCHAR: - eKeyType[i] = SQL_ORDERBYKEY_STRING; - break; - - case DataType::OTHER: - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BIT: - eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; - break; - - // Andere Typen sind nicht implementiert (und damit immer - // FALSE) - default: - eKeyType[i] = SQL_ORDERBYKEY_NONE; - OSL_ASSERT("MResultSet::executeQuery: Order By Data Type not implemented"); - break; - } - } - - if (IsSorted()) - { - // Implement Sorting - - // So that we can sort we need to wait until the executed - // query to the mozilla addressbooks has returned all - // values. - - OSL_TRACE("Query is to be sorted"); - if( ! m_aQuery.queryComplete() ) - if ( !m_aQuery.waitForQueryComplete() ) - { - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - - OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!"); - - m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); - - OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size()); -#if OSL_DEBUG_LEVEL > 0 - for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ ) - OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] ); -#endif - for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) { - - OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow)); - - ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); - for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) - { - const ORowSetValue& value = getValue(nRow, *aIter); - - OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value )); - - pKeyValue->pushKey(new ORowSetValueDecorator(value)); - } - - m_pSortIndex->AddKeyValue( pKeyValue ); - } - - m_pKeySet = m_pSortIndex->CreateKeySet(); - m_CurrentRowCount = m_pKeySet->get().size(); -#if OSL_DEBUG_LEVEL > 0 - for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ ) - OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] ); -#endif - - m_pSortIndex = NULL; - beforeFirst(); // Go back to start - } - else //we always need m_pKeySet now - m_pKeySet = new OKeySet(); - - // Handle the DISTINCT case - if ( bDistinct && m_pKeySet.isValid() ) - { - OValueRow aSearchRow = new OValueVector( m_aRow->get().size() ); - - for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ ) - { - fetchRow( (m_pKeySet->get())[i] ); // Fills m_aRow - if ( matchRow( m_aRow, aSearchRow ) ) - { - (m_pKeySet->get())[i] = 0; // Marker for later to be removed - } - else - { - // They don't match, so it's not a duplicate. - // Use the current Row as the next one to match against - *aSearchRow = *m_aRow; - } - } - // Now remove any keys marked with a 0 - m_pKeySet->get().erase(::std::remove_if(m_pKeySet->get().begin(),m_pKeySet->get().end() - ,::std::bind2nd(::std::equal_to<sal_Int32>(),0)) - ,m_pKeySet->get().end()); - - } - } - } break; - - case SQL_STATEMENT_UPDATE: - case SQL_STATEMENT_DELETE: - case SQL_STATEMENT_INSERT: - break; - default: - m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this ); - break; - } -} - -// ----------------------------------------------------------------------------- - -void OResultSet::setBoundedColumns(const OValueRow& _rRow, - const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, - const Reference<XIndexAccess>& _xNames, - sal_Bool _bSetColumnMapping, - const Reference<XDatabaseMetaData>& _xMetaData, - ::std::vector<sal_Int32>& _rColMapping) -{ - ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers()); - - Reference<XPropertySet> xTableColumn; - ::rtl::OUString sTableColumnName, sSelectColumnRealName; - - const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME); - - ::std::vector< ::rtl::OUString> aColumnNames; - aColumnNames.reserve(_rxColumns->get().size()); - OValueVector::Vector::iterator aRowIter = _rRow->get().begin()+1; - for (sal_Int32 i=0; // the first column is the bookmark column - aRowIter != _rRow->get().end(); - ++i, ++aRowIter - ) - { - try - { - // get the table column and it's name - _xNames->getByIndex(i) >>= xTableColumn; - OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!"); - if (xTableColumn.is()) - xTableColumn->getPropertyValue(sName) >>= sTableColumnName; - else - sTableColumnName = ::rtl::OUString(); - - // look if we have such a select column - // TODO: would like to have a O(log n) search here ... - sal_Int32 nColumnPos = 0; - for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin(); - aIter != _rxColumns->get().end(); - ++aIter,++nColumnPos - ) - { - if ( nColumnPos < (sal_Int32)aColumnNames.size() ) - sSelectColumnRealName = aColumnNames[nColumnPos]; - else - { - if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName)) - (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName; - else - (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName; - aColumnNames.push_back(sSelectColumnRealName); - } - - if (aCase(sTableColumnName, sSelectColumnRealName)) - { - if(_bSetColumnMapping) - { - sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1; - // the getXXX methods are 1-based ... - sal_Int32 nTableColumnPos = i + 1; - // get first table column is the bookmark column - // ... -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos ); -#endif - _rColMapping[nSelectColumnPos] = nTableColumnPos; - } - - aRowIter->setBound(sal_True); - aRowIter->setTypeKind(DataType::VARCHAR); - } - } - } - catch (Exception&) - { - OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!"); - } - } -} - - -// ----------------------------------------------------------------------------- -sal_Bool OResultSet::isCount() const -{ - return (m_pParseTree && - m_pParseTree->count() > 2 && - SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) && - SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) && - SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) && - m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4 - ); -} - -// ----------------------------------------------------------------------------- -// -// Check for valid row in m_aQuery -// -sal_Bool OResultSet::validRow( sal_uInt32 nRow ) -{ - sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount(); - - while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) { -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("validRow: waiting..."); -#endif - m_aQuery.checkRowAvailable( nRow ); - if ( m_aQuery.hadError() ) - { - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - nNumberOfRecords = m_aQuery.getRealRowCount(); - } - - if (( nRow == 0 ) || - ( nRow > (sal_uInt32)nNumberOfRecords && m_aQuery.queryComplete()) ){ - OSL_TRACE("validRow(%u): return False", nRow); - return sal_False; - } -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("validRow(%u): return True", nRow); -#endif - return sal_True; -} -sal_Bool OResultSet::fillKeySet(sal_Int32 nMaxCardNumber) -{ - impl_ensureKeySet(); - if (m_CurrentRowCount < nMaxCardNumber) - { - sal_Int32 nKeyValue; - if ( (sal_Int32)m_pKeySet->get().capacity() < nMaxCardNumber ) - m_pKeySet->get().reserve(nMaxCardNumber + 20 ); - - for (nKeyValue = m_CurrentRowCount+1; nKeyValue <= nMaxCardNumber; nKeyValue ++) - m_pKeySet->get().push_back( nKeyValue ); - m_CurrentRowCount = nMaxCardNumber; - } - return sal_True; -} - -sal_Int32 OResultSet::deletedCount() -{ - impl_ensureKeySet(); - return m_CurrentRowCount - m_pKeySet->get().size(); - -} -// ----------------------------------------------------------------------------- -sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) -{ - ResultSetEntryGuard aGuard( *this ); - if ( !m_pKeySet.isValid() ) - m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this ); - - sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount(); - sal_Int32 nRetrivedRows = currentRowCount(); - sal_Int32 nCurPos = m_nRowPos; - - OSL_TRACE("seekRow: nCurPos = %d", nCurPos ); - switch( pos ) { - case NEXT_POS: - OSL_TRACE("seekRow: NEXT"); - nCurPos++; - break; - case PRIOR_POS: - OSL_TRACE("seekRow: PRIOR"); - if ( nCurPos > 0 ) - nCurPos--; - break; - - case FIRST_POS: - OSL_TRACE("seekRow: FIRST"); - nCurPos = 1; - break; - - case LAST_POS: - OSL_TRACE("seekRow: LAST"); - nCurPos = nRetrivedRows; - break; - case ABSOLUTE_POS: - OSL_TRACE("seekRow: ABSOLUTE : %d", nOffset); - nCurPos = nOffset; - break; - case RELATIVE_POS: - OSL_TRACE("seekRow: RELATIVE : %d", nOffset); - nCurPos += sal_uInt32( nOffset ); - break; - } - - if ( nCurPos <= 0 ) { - m_nRowPos = 0; - OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos ); - return sal_False; - } - sal_Int32 nCurCard = nCurPos; - if ( nCurPos < (sal_Int32)m_pKeySet->get().size() ) //The requested row is exist in m_pKeySet, so we just use it - { - nCurCard = (m_pKeySet->get())[nCurPos-1]; - } - else //The requested row has not been retrived until now. We should get the right card for it. - nCurCard = nCurPos + deletedCount(); - - while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) { - m_aQuery.checkRowAvailable( nCurCard ); - if ( m_aQuery.hadError() ) - { - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - nNumberOfRecords = m_aQuery.getRealRowCount(); - } - - if ( nCurCard > nNumberOfRecords && m_aQuery.queryComplete()) { - fillKeySet(nNumberOfRecords); - m_nRowPos = m_pKeySet->get().size() + 1; - OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos ); - return sal_False; - } - //Insert new retrived items for later use - fillKeySet(nNumberOfRecords); - m_nRowPos = (sal_uInt32)nCurPos; - OSL_TRACE("seekRow: return True, m_nRowPos = %u", m_nRowPos ); - fetchCurrentRow(); - return sal_True; -} -// ----------------------------------------------------------------------------- -void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) -{ - m_aColMapping = _aColumnMapping; -#if OSL_DEBUG_LEVEL > 0 - for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ ) - OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] ); -#endif -} -// ----------------------------------------------------------------------------- - -::com::sun::star::uno::Any OResultSet::getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - if ( fetchCurrentRow() == sal_False ) - m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this ); - - OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row"); - return makeAny((sal_Int32)(m_aRow->get())[0]); -} -sal_Bool OResultSet::moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("moveToBookmark, bookmark = %u", comphelper::getINT32(bookmark) ); - sal_Int32 nCardNum = comphelper::getINT32(bookmark); - m_nRowPos = getRowForCardNumber(nCardNum); - fetchCurrentRow(); - return sal_True; -} -sal_Bool OResultSet::moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("moveRelativeToBookmark, bookmark = %u rows= %u", comphelper::getINT32(bookmark),rows ); - sal_Int32 nCardNum = comphelper::getINT32(bookmark); - m_nRowPos = getRowForCardNumber(nCardNum); - return seekRow(RELATIVE_POS,rows ); -} -sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("compareBookmarks, m_nRowPos = %u", m_nRowPos ); - sal_Int32 nFirst=0; - sal_Int32 nSecond=0; - sal_Int32 nResult=0; - - if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) - m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this ); - - if(nFirst < nSecond) - nResult = -1; - else if(nFirst > nSecond) - nResult = 1; - else - nResult = 0; - - return nResult; -} -sal_Bool OResultSet::hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("hasOrderedBookmarks, m_nRowPos = %u", m_nRowPos ); - return sal_True; -} -sal_Int32 OResultSet::hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("hashBookmark, m_nRowPos = %u", m_nRowPos ); - return comphelper::getINT32(bookmark); -} - -sal_Int32 OResultSet::getCurrentCardNumber() -{ - if ( ( m_nRowPos == 0 ) || !m_pKeySet.isValid() ) - return 0; - if (m_pKeySet->get().size() < m_nRowPos) - return 0; - return (m_pKeySet->get())[m_nRowPos-1]; -} -void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException) -{ - OSL_TRACE("checkPendingUpdate, m_nRowPos = %u", m_nRowPos ); - const sal_Int32 nCurrentRow = getCurrentCardNumber(); - - if ((m_nNewRow && nCurrentRow != m_nNewRow) - || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow)) - { - const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( - STR_COMMIT_ROW, - "$position$", ::rtl::OUString::valueOf(nCurrentRow) - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - -} -void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException) -{ - OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - if ( fetchCurrentRow() == sal_False ) - m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this ); - - - checkPendingUpdate(); - - checkIndex(columnIndex ); - columnIndex = mapColumn(columnIndex); - - (m_aRow->get())[columnIndex].setBound(sal_True); - (m_aRow->get())[columnIndex] = x; - m_nUpdatedRow = getCurrentCardNumber(); - m_RowStates = m_RowStates | RowStates_Updated; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) -{ - OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - if ( fetchCurrentRow() == sal_False ) - m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this ); - - checkPendingUpdate(); - checkIndex(columnIndex ); - columnIndex = mapColumn(columnIndex); - - (m_aRow->get())[columnIndex].setBound(sal_True); - (m_aRow->get())[columnIndex].setNull(); - m_nUpdatedRow = getCurrentCardNumber(); - m_RowStates = m_RowStates | RowStates_Updated; -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this ); -} -// ----------------------------------------------------------------------- -void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) -{ - updateValue(columnIndex,x); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - - if(!x.is()) - ::dbtools::throwFunctionSequenceException(*this); - - Sequence<sal_Int8> aSeq; - x->readBytes(aSeq,length); - updateValue(columnIndex,aSeq); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) -{ - updateBinaryStream(columnIndex,x,length); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) -{ - if (!::dbtools::implUpdateObject(this, columnIndex, x)) - { - const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( - STR_COLUMN_NOT_UPDATEABLE, - "$position$", ::rtl::OUString::valueOf(columnIndex) - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } // if (!::dbtools::implUpdateObject(this, columnIndex, x)) - } -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) -{ - if (!::dbtools::implUpdateObject(this, columnIndex, x)) - { - const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( - STR_COLUMN_NOT_UPDATEABLE, - "$position$", ::rtl::OUString::valueOf(columnIndex) - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } -} - -// XResultSetUpdate -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("insertRow in, m_nRowPos = %u", m_nRowPos ); - m_RowStates = RowStates_Inserted; - updateRow(); - m_nOldRowPos = 0; - m_nNewRow = 0; - m_aQuery.setRowStates(getCurrentCardNumber(),m_RowStates); - OSL_TRACE("insertRow out, m_nRowPos = %u", m_nRowPos ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - OSL_TRACE("updateRow in, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - impl_ensureKeySet(); - - if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos ) - m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this ); - - const sal_Int32 nCurrentCard = getCurrentCardNumber(); - - if (!pushCard(nCurrentCard)) - { - m_RowStates = RowStates_Error; - m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this ); - } - - if (!m_aQuery.commitRow(nCurrentCard)) - { - m_RowStates = RowStates_Error; - m_nUpdatedRow = 0; - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - } - - m_nUpdatedRow = 0; - fetchCurrentRow(); - OSL_TRACE("updateRow out, m_nRowPos = %u", m_nRowPos ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - if (rowDeleted()) - m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this ); - - const sal_Int32 nCurrentRow = getCurrentCardNumber(); - //fetchRow(nCurrentRow); - if (!nCurrentRow) - m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this ); - - sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 ); - if (!m_bRowDeleted) - m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); - - m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted); - m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1); - m_RowStates = RowStates_Deleted; - OSL_TRACE("deleteRow out, m_nRowPos = %u", m_nRowPos ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos ); - if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row - m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CANCEL_ROW_UPDATE, *this ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - OSL_TRACE("moveToInsertRow in, m_nRowPos = %u", m_nRowPos ); - ResultSetEntryGuard aGuard( *this ); - m_nOldRowPos = m_nRowPos; - - if (!m_nNewRow) //no new row now, insert one - { - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - checkPendingUpdate(); - if (rowUpdated()) - { - if (m_nRowPos && !pushCard(getCurrentCardNumber())) - throw SQLException(); - } - m_nNewRow = m_aQuery.createNewCard(); - if (!m_nNewRow) - m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this ); - - m_RowStates = RowStates_Normal; - fillKeySet(m_nNewRow); - } - else - m_nUpdatedRow = 0; - - m_nRowPos = m_pKeySet->get().size(); - fetchCurrentRow(); - OSL_TRACE("moveToInsertRow out, m_nRowPos = %u", m_nRowPos ); -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - ResultSetEntryGuard aGuard( *this ); - OSL_TRACE("moveToCurrentRow, m_nRowPos = %u", m_nRowPos ); - if (rowInserted()) - { - m_nRowPos = m_nOldRowPos; - fetchCurrentRow(); - } -} - -sal_Bool OResultSet::determineReadOnly() -{ - if (m_bIsReadOnly == -1) - { - OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get()); - m_bIsReadOnly = !m_aQuery.isWritable(xConnection) || m_bIsAlwaysFalseQuery; - } - - return m_bIsReadOnly != 0; -} - -void OResultSet::setTable(OTable* _rTable) -{ - OSL_TRACE("In : setTable"); - m_pTable = _rTable; - m_pTable->acquire(); - m_xTableColumns = m_pTable->getColumns(); - if(m_xTableColumns.is()) - m_aColumnNames = m_xTableColumns->getElementNames(); - OSL_TRACE("Out : setTable"); -} - -void OResultSet::setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy) -{ - m_aOrderbyColumnNumber = _aColumnOrderBy; -} - -void OResultSet::setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc) -{ - m_aOrderbyAscending = _aOrderbyAsc; -} -Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this ); - return Sequence< sal_Int32 >(); -}; diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx deleted file mode 100644 index f6cc7fedec82..000000000000 --- a/connectivity/source/drivers/mozab/MResultSet.hxx +++ /dev/null @@ -1,362 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SRESULTSET_HXX -#define CONNECTIVITY_SRESULTSET_HXX - -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#include <com/sun/star/sdbc/XCloseable.hpp> -#include <com/sun/star/sdbc/XColumnLocate.hpp> -#include <com/sun/star/util/XCancellable.hpp> -#include <com/sun/star/sdbc/XWarningsSupplier.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#include <com/sun/star/sdbc/XRowUpdate.hpp> -#include <cppuhelper/compbase12.hxx> -#include <comphelper/proparrhlp.hxx> -#include "MStatement.hxx" -#include "connectivity/CommonTools.hxx" -#include "connectivity/FValue.hxx" -#include "connectivity/sqliterator.hxx" -#include "TSortIndex.hxx" -#include "mozillasrc/MQuery.hxx" - - -namespace connectivity -{ - namespace mozab - { - - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, - ::com::sun::star::sdbc::XRow, - ::com::sun::star::sdbc::XResultSetMetaDataSupplier, - ::com::sun::star::util::XCancellable, - ::com::sun::star::sdbc::XWarningsSupplier, - ::com::sun::star::sdbc::XCloseable, - ::com::sun::star::sdbc::XColumnLocate, - ::com::sun::star::sdbc::XResultSetUpdate, - ::com::sun::star::sdbc::XRowUpdate, - ::com::sun::star::sdbcx::XRowLocate, - ::com::sun::star::sdbcx::XDeleteRows, - ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; - - - typedef sal_Int64 TVoidPtr; - typedef ::std::allocator< TVoidPtr > TVoidAlloc; - typedef ::std::vector<TVoidPtr> TVoidVector; - - class OResultSet : public comphelper::OBaseMutex, - public OResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> - { - protected: - OCommonStatement* m_pStatement; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; - sal_uInt32 m_nRowPos; - sal_uInt32 m_nOldRowPos; - sal_Bool m_bWasNull; - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - - - - ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator > - m_pSQLIterator; - const connectivity::OSQLParseNode* m_pParseTree; - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any & rConvertedValue, - ::com::sun::star::uno::Any & rOldValue, - sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue - ) - throw (::com::sun::star::uno::Exception); - virtual void SAL_CALL getFastPropertyValue( - ::com::sun::star::uno::Any& rValue, - sal_Int32 nHandle - ) const; - - // you can't delete objects of this type - virtual ~OResultSet(); - public: - DECLARE_SERVICE_INFO(); - - OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator ); - - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() - { - return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); - } - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing(void); - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - // XResultSet - virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XRow - virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XResultSetMetaDataSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XCancellable - virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); - // XCloseable - virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XWarningsSupplier - virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XRowLocate - virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XDeleteRows - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - -protected: - MQuery m_aQuery; - OTable* m_pTable; - sal_Int32 m_CurrentRowCount; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - m_xTableColumns; - - ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime - ::std::vector<sal_Int32> m_aOrderbyColumnNumber; - ::std::vector<TAscendingOrder> m_aOrderbyAscending; - ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aColumnNames; - OValueRow m_aRow; - OValueRow m_aParameterRow; - ::std::vector< ::rtl::OUString> m_aAttributeStrings; - sal_Int32 m_nParamIndex; - sal_Bool m_bIsAlwaysFalseQuery; - ::vos::ORef<OKeySet> m_pKeySet; - OSortIndex* m_pSortIndex; - sal_Int32 m_nNewRow; //inserted row - sal_Int32 m_nUpdatedRow; //updated row - sal_Int32 m_RowStates; - sal_Int32 m_bIsReadOnly; - inline void resetParameters() { m_nParamIndex = 0; } - - ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns - ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; - - void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString ); - void fillRowData() throw( ::com::sun::star::sdbc::SQLException ); - void initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount); - void analyseWhereClause( const OSQLParseNode* parseTree, - MQueryExpression &queryExpression); - - sal_Bool isCount() const; - - // XXX sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != STRING_NOTFOUND ;} - sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty(); } - - enum eRowPosition { - NEXT_POS, PRIOR_POS, FIRST_POS, LAST_POS, ABSOLUTE_POS, RELATIVE_POS - }; - - sal_uInt32 currentRowCount(); - - sal_Bool fetchRow(sal_Int32 rowIndex,sal_Bool bForceReload=sal_False) throw( ::com::sun::star::sdbc::SQLException, - ::com::sun::star::uno::RuntimeException); - sal_Bool fetchCurrentRow() throw( ::com::sun::star::sdbc::SQLException, - ::com::sun::star::uno::RuntimeException); - sal_Bool pushCard(sal_uInt32 rowIndex) throw( ::com::sun::star::sdbc::SQLException, - ::com::sun::star::uno::RuntimeException); - sal_Bool validRow( sal_uInt32 nRow ); - sal_Bool seekRow( eRowPosition pos, sal_Int32 nOffset = 0 ); - sal_Int32 deletedCount(); - sal_Bool fillKeySet(sal_Int32 nMaxCardNumber); //When we get new rows, fill the m_pKeySet items for them - sal_Int32 getRowForCardNumber(sal_Int32 nCardNum); - const ORowSetValue& getValue(sal_Int32 rowIndex, sal_Int32 columnIndex) - throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - void checkPendingUpdate() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - sal_Int32 getCurrentCardNumber(); - -public: - sal_Bool determineReadOnly(); - // MozAddressbook Specific methods - void SAL_CALL executeQuery() throw( ::com::sun::star::sdbc::SQLException, - ::com::sun::star::uno::RuntimeException); - - void setTable(OTable* _rTable); - - void setParameterRow(const OValueRow& _rParaRow) - { m_aParameterRow = _rParaRow; } - - void setParameterColumns(const ::vos::ORef<connectivity::OSQLColumns>& _xParamColumns) - { m_xParamColumns = _xParamColumns; } - - void setBindingRow(const OValueRow& _aRow) - { m_aRow = _aRow; } - - void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping); - - void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy); - - void setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc); - - inline sal_Int32 mapColumn(sal_Int32 column); - - void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); - - static void setBoundedColumns( - const OValueRow& _rRow, - const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames, - sal_Bool _bSetColumnMapping, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData, - ::std::vector<sal_Int32>& _rColMapping); - - ::osl::Mutex& getMutex() { return m_aMutex; } - void methodEntry(); - - private: - inline void impl_ensureKeySet() - { - if ( !m_pKeySet.isValid() ) - m_pKeySet = new OKeySet(); - } - - protected: - using OPropertySetHelper::getFastPropertyValue; - }; - - inline sal_Int32 OResultSet::mapColumn(sal_Int32 column) - { - sal_Int32 map = column; - - OSL_ENSURE(column > 0, "OResultSet::mapColumn: invalid column index!"); - // the first column (index 0) is for convenience only. The - // first real select column is no 1. - if ((column > 0) && (column < (sal_Int32)m_aColMapping.size())) - map = m_aColMapping[column]; - - return map; - } - - class ResultSetEntryGuard : public ::osl::MutexGuard - { - public: - ResultSetEntryGuard( OResultSet& _rRS ) : ::osl::MutexGuard( _rRS.getMutex() ) - { - _rRS.methodEntry(); - } - }; - - } -} -#endif // CONNECTIVITY_SRESULTSET_HXX diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx deleted file mode 100644 index 62c24c5e9cf6..000000000000 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "connectivity/dbexception.hxx" -#include "connectivity/dbtools.hxx" -#include <comphelper/types.hxx> -#include <comphelper/extract.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <tools/diagnose_ex.h> -#include "MResultSetMetaData.hxx" -#include <com/sun/star/sdbc/DataType.hpp> - -using namespace connectivity::mozab; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::beans; -using namespace ::dbtools; -using namespace ::comphelper; - -// ------------------------------------------------------------------------- -OResultSetMetaData::~OResultSetMetaData() -{ - m_xColumns = NULL; -} - -// ----------------------------------------------------------------------------- -void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException) -{ - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size()) - throwInvalidIndexException(*this); -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - return getPrecision(column); -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return DataType::VARCHAR; // at the moment there exists only this type -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) -{ - return (m_xColumns->get()).size(); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- - -::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- - -::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - - ::rtl::OUString sColumnName; - try - { - Reference< XPropertySet > xColumnProps( (m_xColumns->get())[column-1], UNO_QUERY_THROW ); - OSL_VERIFY( xColumnProps->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= sColumnName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return sColumnName; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return m_aTableName; -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - return getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - return getColumnName(column); -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return ::rtl::OUString(); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - return getBOOL((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) -{ - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - checkColumnIndex(column); - return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); -} -// ------------------------------------------------------------------------- - -sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString sColumnName( getColumnName( column ) ); - - if ( !m_pTable || !m_pTable->getConnection() ) - { - OSL_ENSURE( false, "OResultSetMetaData::isSearchable: suspicious: called without table or connection!" ); - return sal_False; - } - - if ( m_pTable->getConnection()->isLDAP() ) - { - const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() ); - if ( !aAliases.isColumnSearchable( sColumnName ) ) - return sal_False; - } - - return sal_True; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - checkColumnIndex(column); - sal_Bool bReadOnly = (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && - ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION))); - - return m_bReadOnly || bReadOnly || m_pTable->isReadOnly(); -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - return !isReadOnly(column); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - return !isReadOnly(column); -} -// ------------------------------------------------------------------------- - diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx deleted file mode 100644 index 166494969381..000000000000 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX -#define CONNECTIVITY_SRESULSETMETADATA_HXX - -#include <com/sun/star/sdbc/XResultSetMetaData.hpp> -#include <cppuhelper/implbase1.hxx> -#include <vector> -#include <vos/ref.hxx> -#include "MConnection.hxx" -#include "MTable.hxx" - -namespace connectivity -{ - namespace mozab - { - //************************************************************** - //************ Class: ResultSetMetaData - //************************************************************** - typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; - - class OResultSetMetaData : public OResultSetMetaData_BASE - { - ::rtl::OUString m_aTableName; - ::vos::ORef<connectivity::OSQLColumns> m_xColumns; - OTable* m_pTable; - sal_Bool m_bReadOnly; - - protected: - virtual ~OResultSetMetaData(); - public: - // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - // OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){} - OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, - const ::rtl::OUString& _aTableName,OTable* _pTable,sal_Bool aReadOnly - ) - :m_aTableName(_aTableName) - ,m_xColumns(_rxColumns) - ,m_pTable(_pTable) - ,m_bReadOnly(aReadOnly) - {} - - - /// Avoid ambigous cast error from the compiler. - inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() - { return this; } - - void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - }; - } -} - -#endif // CONNECTIVITY_SRESULSETMETADATA_HXX diff --git a/connectivity/source/drivers/mozab/MServices.cxx b/connectivity/source/drivers/mozab/MServices.cxx deleted file mode 100644 index c939aceff482..000000000000 --- a/connectivity/source/drivers/mozab/MServices.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MDriver.hxx" -#include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> -#include "bootstrap/MMozillaBootstrap.hxx" -#include <tools/solar.h> - -using namespace connectivity::mozab; -using ::rtl::OUString; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::mozilla::XMozillaBootstrap; - -typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* _pTemp - ); - -//--------------------------------------------------------------------------------------- -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - sal_Char const* pImplementationName - ) - : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - inline - sal_Bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); - } - catch(...) - { - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - -//--------------------------------------------------------------------------------------- - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL -component_getImplementationEnvironment( - const sal_Char **ppEnvTypeName, - uno_Environment ** /*ppEnv*/ - ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -typedef void* (SAL_CALL * OMozillaBootstrap_CreateInstanceFunction)(const Reference< XMultiServiceFactory >& _rxFactory ); -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createMozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) -{ - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" )); - - // load the dbtools library - oslModule s_hModule = osl_loadModuleRelative( - reinterpret_cast< oslGenericFunction >(&createMozillaBootstrap), - sModuleName.pData, 0); - OSL_ENSURE(NULL != s_hModule, "MozabDriver::registerClient: could not load the dbtools library!"); - if (NULL != s_hModule) - { - - // get the symbol for the method creating the factory - const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OMozillaBootstrap_CreateInstance")); - // reinterpret_cast<OMozabConnection_CreateInstanceFunction> removed GNU C - OMozillaBootstrap_CreateInstanceFunction s_pCreationFunc = (OMozillaBootstrap_CreateInstanceFunction)osl_getFunctionSymbol(s_hModule, sFactoryCreationFunc.pData); - - if (NULL == s_pCreationFunc) - { // did not find the symbol - OSL_ENSURE(sal_False, "MozabDriver::registerClient: could not find the symbol for creating the factory!"); - osl_unloadModule(s_hModule); - s_hModule = NULL; - } - MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>((*s_pCreationFunc)(_rxFactory)); - return *pBootstrap; - } - return NULL; -} -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = 0; - if (pServiceManager) - { - OUString aImplName( OUString::createFromAscii( pImplementationName ) ); - ProviderRequest aReq(pServiceManager,pImplementationName); - if (aImplName.equals( MozabDriver::getImplementationName_Static() )) - { - aReq.CREATE_PROVIDER( - MozabDriver::getImplementationName_Static(), - MozabDriver::getSupportedServiceNames_Static(), - MozabDriver_CreateInstance, ::cppu::createSingleFactory); - } - else if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) )) - { - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")); - aReq.CREATE_PROVIDER( - aImplName, - aSNS, - createMozillaBootstrap, ::cppu::createSingleFactory); - } - if(aReq.xRet.is()) - aReq.xRet->acquire(); - pRet = aReq.getProvider(); - } - - return pRet; -}; - - diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx deleted file mode 100644 index ec584cfd7252..000000000000 --- a/connectivity/source/drivers/mozab/MStatement.cxx +++ /dev/null @@ -1,557 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <stdio.h> -#include <osl/diagnose.h> -#include <comphelper/property.hxx> -#include <comphelper/uno3.hxx> -#include <osl/thread.h> -#include <tools/diagnose_ex.h> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/FetchDirection.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <comphelper/sequence.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <comphelper/extract.hxx> -#include <comphelper/types.hxx> -#include <connectivity/dbexception.hxx> -#include <com/sun/star/container/XIndexAccess.hpp> - -#include <algorithm> - -#include "diagnose_ex.h" -#include "MDriver.hxx" -#include "MStatement.hxx" -#include "MConnection.hxx" -#include "MResultSet.hxx" -#include "MDatabaseMetaData.hxx" -#include "resource/mozab_res.hrc" -#include "resource/common_res.hrc" - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -static ::osl::Mutex m_ThreadMutex; - -using namespace ::comphelper; -using namespace connectivity::mozab; -using namespace connectivity; -//------------------------------------------------------------------------------ -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; -//------------------------------------------------------------------------------ -OCommonStatement::OCommonStatement(OConnection* _pConnection ) - :OCommonStatement_IBASE(m_aMutex) - ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper) - ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this) - ,m_xDBMetaData(_pConnection->getMetaData()) - ,m_pTable(NULL) - ,m_pConnection(_pConnection) - ,m_aParser(_pConnection->getDriver()->getMSFactory()) - ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) ) - ,m_pParseTree(NULL) - ,rBHelper(OCommonStatement_IBASE::rBHelper) -{ - m_pConnection->acquire(); - OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" ); -} -// ----------------------------------------------------------------------------- -OCommonStatement::~OCommonStatement() -{ -} - -//------------------------------------------------------------------------------ -void OCommonStatement::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - - clearWarnings(); - clearCachedResultSet(); - - if (m_pConnection) - m_pConnection->release(); - m_pConnection = NULL; - - m_pSQLIterator->dispose(); - - dispose_ChildImpl(); - OCommonStatement_IBASE::disposing(); -} -//----------------------------------------------------------------------------- -Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = OCommonStatement_IBASE::queryInterface(rType); - if(!aRet.hasValue()) - aRet = OPropertySetHelper::queryInterface(rType); - return aRet; -} -// ------------------------------------------------------------------------- -Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException) -{ - ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ), - ::getCppuType( (const Reference< XFastPropertySet > *)0 ), - ::getCppuType( (const Reference< XPropertySet > *)0 )); - - return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes()); -} -// ------------------------------------------------------------------------- -void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException) -{ - { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - } - dispose(); -} - - -// ------------------------------------------------------------------------- -void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException ) -{ - if(m_pParseTree) - { - ::vos::ORef<connectivity::OSQLColumns> xCreateColumn; - if (m_pSQLIterator->getStatementType() == SQL_STATEMENT_CREATE_TABLE) - { - const OSQLTables& xTabs = m_pSQLIterator->getTables(); - OSL_ENSURE( !xTabs.empty(), "Need a Table"); - ::rtl::OUString ouTableName=xTabs.begin()->first; - xCreateColumn = m_pSQLIterator->getCreateColumns(); - OSL_ENSURE(xCreateColumn.isValid(), "Need the Columns!!"); - - const OColumnAlias& aColumnAlias = m_pConnection->getColumnAlias(); - - OSQLColumns::Vector::const_iterator aIter = xCreateColumn->get().begin(); - const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - ::rtl::OUString sName; - for (sal_Int32 i = 1; aIter != xCreateColumn->get().end();++aIter, i++) - { - (*aIter)->getPropertyValue(sProprtyName) >>= sName; - if ( !aColumnAlias.hasAlias( sName ) ) - { - - const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution( - STR_INVALID_COLUMNNAME, - "$columnname$", sName - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - } - MDatabaseMetaDataHelper _aDbHelper; - if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName)) - { - getOwnConnection()->throwSQLException( _aDbHelper.getError(), *this ); - } - m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator( - m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) ); - } - - } - else - getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); -} -// ------------------------------------------------------------------------- -OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted) - throw ( SQLException, RuntimeException ) -{ - ::rtl::OUString aErr; - - m_pParseTree = m_aParser.parseTree(aErr,sql); - -#if OSL_DEBUG_LEVEL > 0 - { - const char* str = OUtoCStr(sql); - OSL_UNUSED( str ); - OSL_TRACE("ParseSQL: %s\n", OUtoCStr( sql ) ); - } -#endif // OSL_DEBUG_LEVEL - - if(m_pParseTree) - { - m_pSQLIterator->setParseTree(m_pParseTree); - m_pSQLIterator->traverseAll(); - const OSQLTables& xTabs = m_pSQLIterator->getTables(); - if(xTabs.empty()) - getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this ); - -#if OSL_DEBUG_LEVEL > 0 - OSQLTables::const_iterator citer; - for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) { - OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) ); - } -#endif - - Reference<XIndexAccess> xNames; - switch(m_pSQLIterator->getStatementType()) - { - case SQL_STATEMENT_SELECT: - - // at this moment we support only one table per select statement - - OSL_ENSURE( xTabs.begin() != xTabs.end(), "Need a Table"); - - m_pTable = static_cast< OTable* > (xTabs.begin()->second.get()); - m_xColNames = m_pTable->getColumns(); - xNames = Reference<XIndexAccess>(m_xColNames,UNO_QUERY); - // set the binding of the resultrow - m_aRow = new OValueVector(xNames->getCount()); - (m_aRow->get())[0].setBound(sal_True); - ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetBound(sal_False)); - // create the column mapping - createColumnMapping(); - - analyseSQL(); - return eSelect; - - case SQL_STATEMENT_CREATE_TABLE: - createTable(); - return eCreateTable; - - default: - break; - } - } - else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo" - // So we append ("E-mail" varchar) to the last of it to make it work - { - return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True); - } - - getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); - OSL_ENSURE( false, "OCommonStatement::parseSql: unreachable!" ); - return eSelect; - -} -// ------------------------------------------------------------------------- -Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery() -{ - clearCachedResultSet(); - - ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) ); - initializeResultSet( pResult.get() ); - - pResult->executeQuery(); - cacheResultSet( pResult ); // only cache if we survived the execution - - return pResult.get(); - -} - -// ------------------------------------------------------------------------- -void OCommonStatement::initializeResultSet( OResultSet* _pResult ) -{ - ENSURE_OR_THROW( _pResult, "invalid result set" ); - - _pResult->setColumnMapping(m_aColMapping); - _pResult->setOrderByColumns(m_aOrderbyColumnNumber); - _pResult->setOrderByAscending(m_aOrderbyAscending); - _pResult->setBindingRow(m_aRow); - _pResult->setTable(m_pTable); -} - -// ------------------------------------------------------------------------- -void OCommonStatement::clearCachedResultSet() -{ - Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY ); - if ( !xResultSet.is() ) - return; - - try - { - Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW ); - xCloseable->close(); - } - catch( const DisposedException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - m_xResultSet = Reference< XResultSet >(); -} - -// ------------------------------------------------------------------------- -void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult ) -{ - ENSURE_OR_THROW( _pResult.is(), "invalid result set" ); - m_xResultSet = Reference< XResultSet >( _pResult.get() ); -} - -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) ); - - Reference< XResultSet > xRS = executeQuery( sql ); - // returns true when a resultset is available - return xRS.is(); -} -// ------------------------------------------------------------------------- - -Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_ThreadMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) ); - - // parse the statement - StatementType eStatementType = parseSql( sql ); - if ( eStatementType != eSelect ) - return NULL; - - return impl_executeCurrentQuery(); -} -// ------------------------------------------------------------------------- - -Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - // just return our connection here - return (Reference< XConnection >)m_pConnection; -} -// ----------------------------------------------------------------------------- -Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this)); - if(!aRet.hasValue()) - aRet = OCommonStatement::queryInterface(rType); - return aRet; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException) -{ - ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this ); - return 0; - -} -// ------------------------------------------------------------------------- -Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - return makeAny(m_aLastWarning); -} -// ------------------------------------------------------------------------- - -// ------------------------------------------------------------------------- -void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - - - m_aLastWarning = SQLWarning(); -} -// ------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const -{ - // this properties are define by the service resultset - // they must in alphabetic order - Sequence< Property > aProps(9); - Property* pProperties = aProps.getArray(); - sal_Int32 nPos = 0; - DECL_PROP0(CURSORNAME, ::rtl::OUString); - DECL_BOOL_PROP0(ESCAPEPROCESSING); - DECL_PROP0(FETCHDIRECTION,sal_Int32); - DECL_PROP0(FETCHSIZE, sal_Int32); - DECL_PROP0(MAXFIELDSIZE,sal_Int32); - DECL_PROP0(MAXROWS, sal_Int32); - DECL_PROP0(QUERYTIMEOUT,sal_Int32); - DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); - DECL_PROP0(RESULTSETTYPE,sal_Int32); - - return new ::cppu::OPropertyArrayHelper(aProps); -} - -// ------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper() -{ - return *const_cast<OCommonStatement*>(this)->getArrayHelper(); -} -// ------------------------------------------------------------------------- -sal_Bool OCommonStatement::convertFastPropertyValue( - Any & /*rConvertedValue*/, - Any & /*rOldValue*/, - sal_Int32 /*nHandle*/, - const Any& /*rValue*/ ) - throw (::com::sun::star::lang::IllegalArgumentException) -{ - sal_Bool bConverted = sal_False; - // here we have to try to convert - return bConverted; -} -// ------------------------------------------------------------------------- -void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception) -{ - // set the value to what ever is nescessary - switch(nHandle) - { - case PROPERTY_ID_QUERYTIMEOUT: - case PROPERTY_ID_MAXFIELDSIZE: - case PROPERTY_ID_MAXROWS: - case PROPERTY_ID_RESULTSETCONCURRENCY: - case PROPERTY_ID_RESULTSETTYPE: - case PROPERTY_ID_FETCHDIRECTION: - case PROPERTY_ID_FETCHSIZE: - case PROPERTY_ID_ESCAPEPROCESSING: - default: - ; - } -} -// ------------------------------------------------------------------------- -void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const -{ - switch(nHandle) - { - case PROPERTY_ID_QUERYTIMEOUT: - case PROPERTY_ID_MAXFIELDSIZE: - case PROPERTY_ID_MAXROWS: - case PROPERTY_ID_RESULTSETCONCURRENCY: - case PROPERTY_ID_RESULTSETTYPE: - case PROPERTY_ID_FETCHDIRECTION: - case PROPERTY_ID_FETCHSIZE: - case PROPERTY_ID_ESCAPEPROCESSING: - default: - ; - } -} -// ------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement"); -// ----------------------------------------------------------------------------- -void SAL_CALL OCommonStatement::acquire() throw() -{ - OCommonStatement_IBASE::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OCommonStatement::release() throw() -{ - relase_ChildImpl(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStatement::acquire() throw() -{ - OCommonStatement::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStatement::release() throw() -{ - OCommonStatement::release(); -} -// ----------------------------------------------------------------------------- -Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException) -{ - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); -} -// ----------------------------------------------------------------------------- -void OCommonStatement::createColumnMapping() -{ - size_t i; - - // initialize the column index map (mapping select columns to table columns) - ::vos::ORef<connectivity::OSQLColumns> xColumns = m_pSQLIterator->getSelectColumns(); - m_aColMapping.resize(xColumns->get().size() + 1); - for (i=0; i<m_aColMapping.size(); ++i) - m_aColMapping[i] = i; - - Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); - // now check which columns are bound -#if OSL_DEBUG_LEVEL > 0 - for ( i = 0; i < m_aColMapping.size(); i++ ) - OSL_TRACE("BEFORE Mapped: %d -> %d", i, m_aColMapping[i] ); -#endif - OResultSet::setBoundedColumns(m_aRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping); -#if OSL_DEBUG_LEVEL > 0 - for ( i = 0; i < m_aColMapping.size(); i++ ) - OSL_TRACE("AFTER Mapped: %d -> %d", i, m_aColMapping[i] ); -#endif -} -// ----------------------------------------------------------------------------- - -void OCommonStatement::analyseSQL() -{ - const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree(); - if(pOrderbyClause) - { - OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2); - OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree"); - - for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++) - { - OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m); - OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree"); - OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree"); - - OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0); - if(!SQL_ISRULE(pColumnRef,column_ref)) - { - throw SQLException(); - } - OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1); - setOrderbyColumn(pColumnRef,pAscendingDescending); - } - } -} -//------------------------------------------------------------------ -void OCommonStatement::setOrderbyColumn( OSQLParseNode* pColumnRef, - OSQLParseNode* pAscendingDescending) -{ - ::rtl::OUString aColumnName; - if (pColumnRef->count() == 1) - aColumnName = pColumnRef->getChild(0)->getTokenValue(); - else if (pColumnRef->count() == 3) - { - pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False ); - } - else - { - throw SQLException(); - } - - Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY); - if(!xColLocate.is()) - return; - - m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName)); - - // Ascending or Descending? - m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC); -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx deleted file mode 100644 index 4f6dc424009f..000000000000 --- a/connectivity/source/drivers/mozab/MStatement.hxx +++ /dev/null @@ -1,209 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SSTATEMENT_HXX -#define CONNECTIVITY_SSTATEMENT_HXX - -#include <com/sun/star/sdbc/XStatement.hpp> -#include <com/sun/star/sdbc/XWarningsSupplier.hpp> -#include <com/sun/star/sdbc/XBatchExecution.hpp> -#include <com/sun/star/sdbc/XCloseable.hpp> -#include <com/sun/star/sdbc/SQLWarning.hpp> -#include <comphelper/proparrhlp.hxx> -#include <cppuhelper/compbase3.hxx> -#include <comphelper/uno3.hxx> -#include "connectivity/CommonTools.hxx" -#ifndef INCLUDED_LIST -#include <list> -#define INCLUDED_LIST -#endif -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <comphelper/broadcasthelper.hxx> -#include "connectivity/sqliterator.hxx" -#ifndef _CONNECTIVITY_PARSE_SQLPARSE_HXX_ -#include "connectivity/sqlparse.hxx" -#endif -#include <connectivity/FValue.hxx> -#include "TSortIndex.hxx" -#include "MConnection.hxx" -#include "MTable.hxx" - -#include <boost/shared_ptr.hpp> - -namespace connectivity -{ - namespace mozab - { - class OResultSet; - - typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement, - ::com::sun::star::sdbc::XWarningsSupplier, - ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE; - - //************************************************************** - //************ Class: OCommonStatement - // is a base class for the normal statement and for the prepared statement - //************************************************************** - class OCommonStatement; - typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE > OCommonStatement_SBASE; - - class OCommonStatement :public comphelper::OBaseMutex - ,public OCommonStatement_IBASE - ,public ::cppu::OPropertySetHelper - ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement > - ,public OCommonStatement_SBASE - { - friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >; - - private: - ::com::sun::star::sdbc::SQLWarning m_aLastWarning; - - protected: - ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet > m_xResultSet; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns - - // for this Statement - - ::std::list< ::rtl::OUString> m_aBatchList; - - OTable* m_pTable; - OConnection* m_pConnection; // The owning Connection object - - OValueRow m_aRow; - - connectivity::OSQLParser m_aParser; - ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator > - m_pSQLIterator; - - connectivity::OSQLParseNode* m_pParseTree; - - ::std::vector<sal_Int32> m_aColMapping; - ::std::vector<sal_Int32> m_aOrderbyColumnNumber; - ::std::vector<TAscendingOrder> m_aOrderbyAscending; - - ::cppu::OBroadcastHelper& rBHelper; - - protected: - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any & rConvertedValue, - ::com::sun::star::uno::Any & rOldValue, - sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); - virtual void SAL_CALL getFastPropertyValue( - ::com::sun::star::uno::Any& rValue, - sal_Int32 nHandle) const; - virtual ~OCommonStatement(); - - protected: - // - // Driver Internal Methods - // - enum StatementType { eSelect, eCreateTable }; - /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed - */ - virtual StatementType - parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); - /** called to initialize a result set, according to a previously parsed SQL statement - */ - virtual void initializeResultSet( OResultSet* _pResult ); - /** called when a possible cached instance of our last result set should be cleared - */ - virtual void clearCachedResultSet(); - /** caches a result set which has just been created by an execution of an SQL statement - */ - virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult ); - - - /** executes the current query (the one which has been passed to the last parseSql call) - */ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > - impl_executeCurrentQuery(); - - void createColumnMapping(); - void analyseSQL(); - void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef, - connectivity::OSQLParseNode* pAscendingDescending); - virtual void createTable( ) throw ( - ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); - - public: - // other methods - OConnection* getOwnConnection() const { return m_pConnection;} - - OCommonStatement(OConnection* _pConnection ); - using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; - - // OComponentHelper - virtual void SAL_CALL disposing(void); - - // XInterface - virtual void SAL_CALL release() throw(); - virtual void SAL_CALL acquire() throw(); - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - // XStatement - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; - virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; - virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; - // XWarningsSupplier - virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XCloseable - virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - protected: - using OPropertySetHelper::getFastPropertyValue; - }; - - class OStatement : public OCommonStatement, - public ::com::sun::star::lang::XServiceInfo - { - protected: - ~OStatement(){} - public: - // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - }; - } -} -#endif // CONNECTIVITY_SSTATEMENT_HXX diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx deleted file mode 100644 index 5b01723dcb74..000000000000 --- a/connectivity/source/drivers/mozab/MTable.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MTable.hxx" -#include "MTables.hxx" -#include "MColumns.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <cppuhelper/typeprovider.hxx> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <comphelper/sequence.hxx> -#include <comphelper/extract.hxx> -#include <comphelper/types.hxx> -#include "connectivity/dbtools.hxx" -#include "connectivity/TKeys.hxx" -#include "connectivity/TIndexes.hxx" -#include "MCatalog.hxx" - - -using namespace ::comphelper; -using namespace connectivity::mozab; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection) - :OTable_Base( _pTables, _pConnection, sal_True ) - ,m_pConnection( _pConnection ) -{ - construct(); -} -// ------------------------------------------------------------------------- -OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection, - const ::rtl::OUString& _Name, const ::rtl::OUString& _Type, const ::rtl::OUString& _Description ) - :OTable_Base(_pTables, _pConnection, sal_True, _Name, _Type, _Description ) - ,m_pConnection( _pConnection ) -{ - construct(); -} - -//-------------------------------------------------------------------------- -sdbcx::OCollection* OTable::createColumns( const TStringVector& _rNames ) -{ - return new OColumns( this, m_aMutex, _rNames ); -} - -//-------------------------------------------------------------------------- -sdbcx::OCollection* OTable::createKeys(const TStringVector& _rNames) -{ - return new OKeysHelper( this, m_aMutex, _rNames ); -} - -//-------------------------------------------------------------------------- -sdbcx::OCollection* OTable::createIndexes(const TStringVector& _rNames) -{ - return new OIndexesHelper( this, m_aMutex, _rNames ); -} - -// ----------------------------------------------------------------------------- - - - diff --git a/connectivity/source/drivers/mozab/MTable.hxx b/connectivity/source/drivers/mozab/MTable.hxx deleted file mode 100644 index 8c79ecca5633..000000000000 --- a/connectivity/source/drivers/mozab/MTable.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_ -#define _CONNECTIVITY_MOZAB_TABLE_HXX_ - -#include "connectivity/TTableHelper.hxx" -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_ -#include "MConnection.hxx" -#endif - -namespace connectivity -{ - namespace mozab - { - typedef ::connectivity::OTableHelper OTable_Base; - - class OTable : public OTable_Base - { - OConnection* m_pConnection; - - public: - OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection); - OTable( sdbcx::OCollection* _pTables, - OConnection* _pConnection, - const ::rtl::OUString& _Name, - const ::rtl::OUString& _Type, - const ::rtl::OUString& _Description ); - - OConnection* getConnection() { return m_pConnection;} - - sal_Bool isReadOnly() const { return sal_False; } - - ::rtl::OUString getTableName() const { return m_Name; } - ::rtl::OUString getSchema() const { return m_SchemaName; } - - // OTableHelper overridables - virtual sdbcx::OCollection* createColumns( const TStringVector& _rNames ); - virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); - virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); - private: - using OTable_Base::getConnection; - }; - } -} -#endif // _CONNECTIVITY_MOZAB_TABLE_HXX_ - diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx deleted file mode 100644 index 5ae182581b4f..000000000000 --- a/connectivity/source/drivers/mozab/MTables.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MTables.hxx" -#include "MTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include "MCatalog.hxx" -#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_ -#include "MConnection.hxx" -#endif -#include <comphelper/extract.hxx> -#include "connectivity/dbtools.hxx" -#include "connectivity/dbexception.hxx" -#include <cppuhelper/interfacecontainer.h> -#include <comphelper/types.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace ::cppu; -using namespace connectivity::mozab; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace dbtools; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName) -{ - ::rtl::OUString aName,aSchema; - // sal_Int32 nLen = _rName.indexOf('.'); - // aSchema = _rName.copy(0,nLen); - // aName = _rName.copy(nLen+1); - aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")); - aName = _rName; - - Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")); - // aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")); - // aTypes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEMTABLE")); - ::rtl::OUString sEmpty; - - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - if(xResult->next()) // there can be only one table with this name - { - OTable* pRet = new OTable( this, static_cast<OCatalog&>(m_rParent).getConnection(), - aName,xRow->getString(4),xRow->getString(5)); - xRet = pRet; - } - } - ::comphelper::disposeComponent(xResult); - - return xRet; -} -// ------------------------------------------------------------------------- -void OTables::impl_refresh( ) throw(RuntimeException) -{ - static_cast<OCatalog&>(m_rParent).refreshTables(); -} -// ------------------------------------------------------------------------- -void OTables::disposing(void) -{ -m_xMetaData.clear(); - OCollection::disposing(); -} -// ----------------------------------------------------------------------------- - diff --git a/connectivity/source/drivers/mozab/MTables.hxx b/connectivity/source/drivers/mozab/MTables.hxx deleted file mode 100644 index 7169f58f5396..000000000000 --- a/connectivity/source/drivers/mozab/MTables.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_ -#define _CONNECTIVITY_MOZAB_TABLES_HXX_ - -#include "connectivity/sdbcx/VCollection.hxx" -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -namespace connectivity -{ - namespace mozab - { - class OTables : public sdbcx::OCollection - { - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; - // OCatalog* m_pParent; - protected: - virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - public: - OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) - ,m_xMetaData(_rMetaData) - {} - - // only the name is identical to ::cppu::OComponentHelper - virtual void SAL_CALL disposing(void); - }; - } -} -#endif // _CONNECTIVITY_MOZAB_TABLES_HXX_ - diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx deleted file mode 100644 index 1d09e409b3f2..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx +++ /dev/null @@ -1,285 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MMozillaBootstrap.hxx" - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::mozilla; -using namespace connectivity::mozab; -#include <MNSFolders.hxx> -#include "MNSProfileDiscover.hxx" -#ifndef MINIMAL_PROFILEDISCOVER -# include "MNSProfileManager.hxx" -# include "MNSRunnable.hxx" -#endif -#include <MNSInit.hxx> - -static MozillaBootstrap *pMozillaBootstrap=NULL; -static Reference<XMozillaBootstrap> xMozillaBootstrap; -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozillaBootstrap_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) -{ - if (!pMozillaBootstrap) - { - pMozillaBootstrap=new connectivity::mozab::MozillaBootstrap( _rxFactory ); - pMozillaBootstrap->Init(); - xMozillaBootstrap = pMozillaBootstrap; - } - return pMozillaBootstrap; -} - -// -------------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------------- -MozillaBootstrap::MozillaBootstrap( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) - : OMozillaBootstrap_BASE(m_aMutex), m_xMSFactory( _rxFactory ) -{ -} -// ----------------------------------------------------------------------------- -MozillaBootstrap::~MozillaBootstrap() -{ -} -// ----------------------------------------------------------------------------- -void MozillaBootstrap::Init() -{ - sal_Bool aProfileExists=sal_False; - -#ifndef MINIMAL_PROFILEDISCOVER - //This must be call before any mozilla code - MNS_Init(aProfileExists); - - m_ProfileManager = new ProfileManager(); -#else - (void)aProfileExists; /* avoid warning about unused parameter */ -#endif - m_ProfileAccess = new ProfileAccess(); - bootupProfile(::com::sun::star::mozilla::MozillaProductType_Mozilla,rtl::OUString()); -} - -// -------------------------------------------------------------------------------- -void MozillaBootstrap::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - OMozillaBootstrap_BASE::disposing(); -} - -// static ServiceInfo -//------------------------------------------------------------------------------ -rtl::OUString MozillaBootstrap::getImplementationName_Static( ) throw(RuntimeException) -{ - return rtl::OUString::createFromAscii(MOZAB_MozillaBootstrap_IMPL_NAME); -} -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > MozillaBootstrap::getSupportedServiceNames_Static( ) throw (RuntimeException) -{ - // which service is supported - // for more information @see com.sun.star.mozilla.MozillaBootstrap - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")); - return aSNS; -} - -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL MozillaBootstrap::getImplementationName( ) throw(RuntimeException) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------ -sal_Bool SAL_CALL MozillaBootstrap::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; -} - -//------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( ) throw(RuntimeException) -{ - return getSupportedServiceNames_Static(); -} - - -// XProfileDiscover -::sal_Int32 SAL_CALL MozillaBootstrap::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->getProfileCount(product); -} -::sal_Int32 SAL_CALL MozillaBootstrap::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->getProfileList(product,list); -} -::rtl::OUString SAL_CALL MozillaBootstrap::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->getDefaultProfile(product); -} -::rtl::OUString SAL_CALL MozillaBootstrap::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->getProfilePath(product,profileName); -} -::sal_Bool SAL_CALL MozillaBootstrap::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->isProfileLocked(product,profileName); -} -::sal_Bool SAL_CALL MozillaBootstrap::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_ProfileAccess->getProfileExists(product,profileName); -} - -// XProfileManager -::sal_Int32 SAL_CALL MozillaBootstrap::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return m_ProfileManager->bootupProfile(product,profileName); -#else - (void)product; /* avoid warning about unused parameter */ - (void)profileName; /* avoid warning about unused parameter */ - return -1; -#endif -} -::sal_Int32 SAL_CALL MozillaBootstrap::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return m_ProfileManager->shutdownProfile(); -#else - return -1; -#endif -} -::com::sun::star::mozilla::MozillaProductType SAL_CALL MozillaBootstrap::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return m_ProfileManager->getCurrentProduct(); -#else - return ::com::sun::star::mozilla::MozillaProductType_Default; -#endif -} -::rtl::OUString SAL_CALL MozillaBootstrap::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return m_ProfileManager->getCurrentProfile(); -#else - return ::rtl::OUString(); -#endif -} -::sal_Bool SAL_CALL MozillaBootstrap::isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return isProfileLocked(getCurrentProduct(),m_ProfileManager->getCurrentProfile()); -#else - return true; -#endif -} -::rtl::OUString SAL_CALL MozillaBootstrap::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - return m_ProfileManager->setCurrentProfile(product,profileName); -#else - (void)product; /* avoid warning about unused parameter */ - (void)profileName; /* avoid warning about unused parameter */ - return ::rtl::OUString(); -#endif -} - -// XProxyRunner -::sal_Int32 SAL_CALL MozillaBootstrap::Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException) -{ -#ifndef MINIMAL_PROFILEDISCOVER - ::rtl::OUString profileName = aCode->getProfileName(); - ::rtl::OUString currProfileName = getCurrentProfile(); - ::com::sun::star::mozilla::MozillaProductType currProduct = getCurrentProduct(); - - //if client provides a profileName, we will use it - if (profileName.getLength() - && ( aCode->getProductType() != currProduct || !profileName.equals(currProfileName)) ) - setCurrentProfile(aCode->getProductType(),profileName); - MNSRunnable xRunnable; - - return xRunnable.StartProxy(aCode);; -#else - (void)aCode; /* avoid warning about unused parameter */ - return -1; -#endif -} - -#ifdef MINIMAL_PROFILEDISCOVER -#include <cppuhelper/factory.hxx> -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::lang::XMultiServiceFactory; - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL -component_getImplementationEnvironment( - const sal_Char **ppEnvTypeName, - uno_Environment ** /*ppEnv*/ - ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) -{ - MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>(OMozillaBootstrap_CreateInstance(rServiceManager)); - return *pBootstrap; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = 0; - - if (pServiceManager) - { - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) ); - Reference< XSingleServiceFactory > xFactory; - if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) )) - { - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")); - - xFactory = ::cppu::createSingleFactory( - reinterpret_cast< XMultiServiceFactory* > ( pServiceManager), - aImplName, createInstance, aSNS ); - } - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -}; - -#endif diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx deleted file mode 100644 index 980395ec3a87..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef CONNECTIVITY_SMOZILLABOOTSTRAP_HXX -#define CONNECTIVITY_SMOZILLABOOTSTRAP_HXX - -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/compbase2.hxx> -#include <osl/module.h> - - -#define MOZAB_MozillaBootstrap_IMPL_NAME "com.sun.star.comp.mozilla.MozillaBootstrap" - -namespace connectivity -{ - namespace mozab - { - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::mozilla::XMozillaBootstrap, - ::com::sun::star::lang::XServiceInfo > OMozillaBootstrap_BASE; - class ProfileAccess; - class ProfileManager; - class MozillaBootstrap : public OMozillaBootstrap_BASE - { - protected: - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory; - - ::osl::Mutex m_aMutex; // mutex is need to control member access - virtual ~MozillaBootstrap(); - protected: - ProfileAccess * m_ProfileAccess; - ProfileManager * m_ProfileManager; - public: - - void Init(); - MozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); - - // OComponentHelper - virtual void SAL_CALL disposing(void); - // XInterface - static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XMozillaBootstrap - - // XProfileDiscover - virtual ::sal_Int32 SAL_CALL getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - - // XProfileManager - virtual ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - - // XProxyRunner - virtual ::sal_Int32 SAL_CALL Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException); - - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - & getMSFactory(void) const { return m_xMSFactory; } - - }; - } - -} - -#endif // CONNECTIVITY_SMozillaBootstrap_HXX diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx deleted file mode 100644 index 337ec20cd210..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <MNSFolders.hxx> - -#ifdef UNIX -#include <sys/types.h> -#include <strings.h> -#include <string.h> -#endif // End UNIX - -#ifdef WNT -#include "pre_include_windows.h" -#include <windows.h> -#include <stdlib.h> -#include <shlobj.h> -#include <objidl.h> -#include "post_include_windows.h" -#endif // End WNT -#include <osl/security.hxx> -#include <osl/file.hxx> -#include <osl/thread.h> - -using namespace ::com::sun::star::mozilla; - -namespace -{ - // ------------------------------------------------------------------- - static ::rtl::OUString lcl_getUserDataDirectory() - { - ::osl::Security aSecurity; - ::rtl::OUString aConfigPath; - - aSecurity.getConfigDir( aConfigPath ); - return aConfigPath + ::rtl::OUString::createFromAscii( "/" ); - } - - // ------------------------------------------------------------------- - static const char* DefaultProductDir[3][3] = - { - #if defined(XP_WIN) - { "Mozilla/SeaMonkey/", NULL, NULL }, - { "Mozilla/Firefox/", NULL, NULL }, - { "Thunderbird/", "Mozilla/Thunderbird/", NULL } - #elif(MACOSX) - { "../Mozilla/SeaMonkey/", NULL, NULL }, - { "Firefox/", NULL, NULL }, - { "../Thunderbird/", NULL, NULL } - #else - { ".mozilla/seamonkey/", NULL, NULL }, - { ".mozilla/firefox/", NULL, NULL }, - { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" } - #endif - }; - - static const char* ProductRootEnvironmentVariable[3] = - { - "MOZILLA_PROFILE_ROOT", - "MOZILLA_FIREFOX_PROFILE_ROOT", - "MOZILLA_THUNDERBIRD_PROFILE_ROOT", - }; - - // ------------------------------------------------------------------- - static ::rtl::OUString lcl_guessProfileRoot( MozillaProductType _product ) - { - size_t productIndex = _product - 1; - - static ::rtl::OUString s_productDirectories[3]; - - if ( !s_productDirectories[ productIndex ].getLength() ) - { - ::rtl::OUString sProductPath; - - // check whether we have an anevironment variable which helps us - const char* pProfileByEnv = getenv( ProductRootEnvironmentVariable[ productIndex ] ); - if ( pProfileByEnv ) - { - sProductPath = ::rtl::OUString( pProfileByEnv, rtl_str_getLength( pProfileByEnv ), osl_getThreadTextEncoding() ); - // asume that this is fine, no further checks - } - else - { - ::rtl::OUString sProductDirCandidate; - const char* pProfileRegistry = "profiles.ini"; - - // check all possible candidates - for ( size_t i=0; i<3; ++i ) - { - if ( NULL == DefaultProductDir[ productIndex ][ i ] ) - break; - - sProductDirCandidate = lcl_getUserDataDirectory() + - ::rtl::OUString::createFromAscii( DefaultProductDir[ productIndex ][ i ] ); - - // check existence - ::osl::DirectoryItem aRegistryItem; - ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + ::rtl::OUString::createFromAscii( pProfileRegistry ), aRegistryItem ); - if ( result == ::osl::FileBase::E_None ) - { - ::osl::FileStatus aStatus( FileStatusMask_Validate ); - result = aRegistryItem.getFileStatus( aStatus ); - if ( result == ::osl::FileBase::E_None ) - { - // the registry file exists - break; - } - } - } - - ::osl::FileBase::getSystemPathFromFileURL( sProductDirCandidate, sProductPath ); - } - - s_productDirectories[ productIndex ] = sProductPath; - } - - return s_productDirectories[ productIndex ]; - } -} - -// ----------------------------------------------------------------------- -::rtl::OUString getRegistryDir(MozillaProductType product) -{ - if (product == MozillaProductType_Default) - return ::rtl::OUString(); - - return lcl_guessProfileRoot( product ); -} diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx deleted file mode 100644 index 64582d868856..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _MNSFOLDERS_HXX_ -#define _MNSFOLDERS_HXX_ - -#include <sal/types.h> -#include <osl/diagnose.h> -#include <osl/conditn.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_ -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#endif - -#include <rtl/ustring.hxx> - -::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product); - -#endif - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx deleted file mode 100644 index d9dc13ed6069..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <MNSINIParser.hxx> -#include <rtl/byteseq.hxx> - -IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ) -{ - OUString iniUrl; - if (osl_File_E_None != osl_getFileURLFromSystemPath(rIniName.pData, &iniUrl.pData)) - return; - - -#if OSL_DEBUG_LEVEL > 0 - OString sFile = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE(__FILE__" -- parser() - %s\n", sFile.getStr()); -#endif - oslFileHandle handle=NULL; - oslFileError fileError = osl_File_E_INVAL; - try{ - if (iniUrl.getLength()) - fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read); - } - catch(::com::sun::star::io::IOException e) - { -#if OSL_DEBUG_LEVEL > 0 - OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() ); -#endif - } - - if (osl_File_E_None == fileError) - { - rtl::ByteSequence seq; - sal_uInt64 nSize = 0; - - osl_getFileSize(handle, &nSize); - OUString sectionName = OUString::createFromAscii("no name section"); - while (true) - { - sal_uInt64 nPos; - if (osl_File_E_None != osl_getFilePos(handle, &nPos) || nPos >= nSize) - break; - if (osl_File_E_None != osl_readLine(handle , (sal_Sequence **) &seq)) - break; - OString line( (const sal_Char *) seq.getConstArray(), seq.getLength() ); - sal_Int32 nIndex = line.indexOf('='); - if (nIndex >= 1) - { - ini_Section *aSection = &mAllSection[sectionName]; - struct ini_NameValue nameValue; - nameValue.sName = OStringToOUString( - line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US ); - nameValue.sValue = OStringToOUString( - line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); - - aSection->lList.push_back(nameValue); - - } - else - { - sal_Int32 nIndexStart = line.indexOf('['); - sal_Int32 nIndexEnd = line.indexOf(']'); - if ( nIndexEnd > nIndexStart && nIndexStart >=0) - { - sectionName = OStringToOUString( - line.copy(nIndexStart + 1,nIndexEnd - nIndexStart -1).trim(), RTL_TEXTENCODING_ASCII_US ); - if (!sectionName.getLength()) - sectionName = OUString::createFromAscii("no name section"); - - ini_Section *aSection = &mAllSection[sectionName]; - aSection->sName = sectionName; - } - } - } - osl_closeFile(handle); - } -#if OSL_DEBUG_LEVEL > 0 - else - { - OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() ); - } -#endif -} -#if OSL_DEBUG_LEVEL > 0 -void IniParser::Dump() -{ - IniSectionMap::iterator iBegin = mAllSection.begin(); - IniSectionMap::iterator iEnd = mAllSection.end(); - for(;iBegin != iEnd;iBegin++) - { - ini_Section *aSection = &(*iBegin).second; - OString sec_name_tmp = OUStringToOString(aSection->sName, RTL_TEXTENCODING_ASCII_US); - for(NameValueList::iterator itor=aSection->lList.begin(); - itor != aSection->lList.end(); - itor++) - { - struct ini_NameValue * aValue = &(*itor); - OString name_tmp = OUStringToOString(aValue->sName, RTL_TEXTENCODING_ASCII_US); - OString value_tmp = OUStringToOString(aValue->sValue, RTL_TEXTENCODING_UTF8); - OSL_TRACE( - " section=%s name=%s value=%s\n", - sec_name_tmp.getStr(), - name_tmp.getStr(), - value_tmp.getStr() ); - - } - } - -} -#endif - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx deleted file mode 100644 index f2aaaf4805b9..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef __MNSINIPARSER_HXX__ -#define __MNSINIPARSER_HXX__ - -#include <rtl/ustring.hxx> -#include <com/sun/star/io/IOException.hpp> -#include <osl/process.h> -using namespace rtl; - -#include <map> -#include <list> - -#if OSL_DEBUG_LEVEL > 0 -#include <stdio.h> -#endif - -struct ini_NameValue -{ - rtl::OUString sName; - rtl::OUString sValue; - - inline ini_NameValue() SAL_THROW( () ) - {} - inline ini_NameValue( - OUString const & name, OUString const & value ) SAL_THROW( () ) - : sName( name ), - sValue( value ) - {} -}; - -typedef std::list< - ini_NameValue -> NameValueList; - -struct ini_Section -{ - rtl::OUString sName; - NameValueList lList; -}; -typedef std::map<rtl::OUString, - ini_Section - >IniSectionMap; - - -class IniParser -{ - IniSectionMap mAllSection; -public: - IniSectionMap * getAllSection(){return &mAllSection;}; - IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ); -#if OSL_DEBUG_LEVEL > 0 - void Dump(); -#endif - -}; - -#endif - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx deleted file mode 100644 index c83cc7a841a7..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <MNSInclude.hxx> - -#include "mozilla_nsinit.h" - -#include <MNSInit.hxx> - -#include <sal/types.h> -#include <osl/diagnose.h> -#include <osl/conditn.hxx> -#include <osl/file.hxx> -#include <rtl/bootstrap.hxx> - -#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX -#include "MConfigAccess.hxx" -#endif -#include "MNSDeclares.hxx" -#include <osl/thread.hxx> -#include <MNSTerminateListener.hxx> - -static nsIServiceManager* sServiceManager = nsnull; -static sal_Int32 sInitCounter = 0; -static sal_Bool s_bProfilePresentAfterInitialized = sal_False; - -static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - -static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); -static oslThread m_Mozilla_UI_Thread; -static PRBool aLive=1; -static ::osl::Condition m_aUI_Thread_Condition; - -#define HACK_AROUND_THREADING_ISSUES -#define HACK_AROUND_NONREENTRANT_INITXPCOM - -#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM -// XXX hack class to clean up XPCOM when this module is unloaded -static PRBool sXPCOMInitializedFlag = PR_FALSE; -#endif - - -extern "C" void NS_SetupRegistry(); - - const PRUnichar* determineProfile( PRUnichar const* const* _pValidProfiles, const PRUint32 _nValidProfiles ) -{ - // the fallback for the to-be-used user profile: the first profile - const PRUnichar* pUsedProfile = *_pValidProfiles; - - // have a look what the configuration suggests as preferred profile - // PRUnichar != sal_Unicode in mingw - const PRUnichar* pPreferredProfile = reinterpret_cast_mingw_only< const PRUnichar* >( getUserProfile( ) ); - if ( pPreferredProfile && *pPreferredProfile ) - { - PRUnichar const* const* pLoop = _pValidProfiles; - PRUnichar const* const* pLoopEnd = pLoop + _nValidProfiles; - for ( ; pLoop != pLoopEnd; ++pLoop ) - { - // compare the current and the preferred profile - // (by looping through the characters) - const PRUnichar* pCurrent = *pLoop; - const PRUnichar* pPref = pPreferredProfile; - while ( *pCurrent && ( *pCurrent == *pPref ) ) // testing one of them against 0 is enough because of the second clause - { - ++pCurrent; - ++pPref; - } - if ( *pCurrent == *pPref ) - // the are equal - break; - } - - if ( pLoop != pLoopEnd ) - pUsedProfile = *pLoop; - return pUsedProfile; - } - else - return NULL; -} - - -sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists) -{ - nsresult rv; - OSL_TRACE( "IN : MNS_InitXPCOM() \n" ); - // Reentrant calls to this method do nothing except increment a counter - -#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM - // The first time, add another increment so that it'll be left until exit - // for the final cleanup to happen - sInitCounter++; -#endif // HACK_AROUND_NONREENTRANT_INITXPCOM - - // Initialise XPCOM -#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM - // Can't call NS_InitXPCom more than once or things go boom! - if (!sXPCOMInitializedFlag) -#endif - { - nsCOMPtr<nsILocalFile> binDir; - // Note: if path3 construction fails, mozilla will default to using MOZILLA_FIVE_HOME in the NS_InitXPCOM2() - rtl::OUString path1( RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program") ); - rtl::Bootstrap::expandMacros(path1); - rtl::OString path2; - if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) == - osl::FileBase::E_None) && - path1.convertToString( - &path2, osl_getThreadTextEncoding(), - (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | - RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) - { - nsDependentCString sPath(path2.getStr()); - rv = NS_NewNativeLocalFile(sPath, PR_TRUE, getter_AddRefs(binDir)); - if (NS_FAILED(rv)) - return sal_False; - } - - - - // Initialise XPCOM - NS_InitXPCOM2(&sServiceManager, binDir, NULL); - -// if (!sServiceManager) -// return sal_False; - -#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM - sXPCOMInitializedFlag = PR_TRUE; -#endif - } - - - // Create the Event Queue for the UI thread... - // - // If an event queue already exists for the thread, then - // CreateThreadEventQueue(...) will fail... - // CreateThread0ueue(...) will fail... - nsCOMPtr<nsIEventQueueService> eventQService( - do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID, &rv)); - if (NS_FAILED(rv)) - return NS_SUCCEEDED( rv ) ? sal_True : sal_False; - - eventQService->CreateThreadEventQueue(); - -// nsCOMPtr<nsIObserver> mStartupNotifier = do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID, &rv); -// if(NS_FAILED(rv)) -// return rv; -// mStartupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull); - -#ifdef HACK_AROUND_THREADING_ISSUES - // XXX force certain objects to be created on the main thread - nsCOMPtr<nsIStringBundleService> sBundleService; - sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) - { - nsCOMPtr<nsIStringBundle> stringBundle; - const char* propertyURL = "chrome://necko/locale/necko.properties"; - rv = sBundleService->CreateBundle(propertyURL, - getter_AddRefs(stringBundle)); - } -#endif - - // Need to create a Pref Service - nsCOMPtr< nsIPref > thePref = do_GetService( kPrefCID, &rv ); - if (NS_SUCCEEDED(rv) ) - { - OSL_TRACE("Created an nsIPref i/f\n"); - thePref->ReadUserPrefs( nsnull ); - *aProfileExists = sal_True ; - s_bProfilePresentAfterInitialized = sal_True; - } - OSL_TRACE( "OUT : MNS_InitXPCOM() - XPCOM Init\n" ); - - return sal_True; -} - -void MNS_XPCOM_EventLoop() -{ - OSL_TRACE( "IN : MNS_XPCOM_EventLoop() \n" ); - nsresult rv; - nsCOMPtr<nsIEventQueue> eventQ; - nsCOMPtr<nsIEventQueueService> eventQService; - rv=nsServiceManager::GetService(kEventQueueServiceCID, - NS_GET_IID(nsIEventQueueService), - getter_AddRefs(eventQService)); - - if (NS_SUCCEEDED(rv)) - { - rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD , getter_AddRefs(eventQ)); - if (NS_FAILED(rv)) - { - rv = eventQService->CreateThreadEventQueue(); - if (NS_FAILED(rv)) - return ; - else - rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ)); - } - } - - if (NS_FAILED(rv)) return ; - - PLEvent* event = nsnull; - m_aUI_Thread_Condition.set(); //we are ready to recive event - do - { - rv = eventQ->GetEvent(&event); - if (NS_FAILED(rv)) - return ; - if (event) - eventQ->HandleEvent(event); - }while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) && aLive ); - - eventQ->ProcessPendingEvents(); - OSL_TRACE( "OUT : MNS_XPCOM_EventLoop() \n" ); -} - -extern "C" void MNS_Mozilla_UI_Thread( void *arg ) -{ - aLive=1; - OSL_TRACE( "IN : MNS_Mozilla_UI_Thread() \n" ); - UI_Thread_ARGS * args = (UI_Thread_ARGS*) arg; - sal_Bool* aProfileExists=args->bProfileExists; - delete args; - args=NULL; - - //Init xpcom - if (!MNS_InitXPCOM(aProfileExists)) - { - m_aUI_Thread_Condition.set(); // error happened - return; - } - - //do the mozilla event loop - MNS_XPCOM_EventLoop(); - //we are interupted - - if (sServiceManager) - { - NS_RELEASE(sServiceManager); - - // Terminate XPCOM & cleanup -#ifndef HACK_AROUND_NONREENTRANT_INITXPCOM - NS_ShutdownXPCOM(sServiceManager); -#endif - } - - m_aUI_Thread_Condition.set(); //release all blocks - - OSL_TRACE( "OUT : MNS_Mozilla_UI_Thread() \n" ); - -} - - -sal_Bool MNS_Init(sal_Bool& aProfileExists) -{ - aProfileExists = sal_False ; - - OSL_TRACE( "IN : MNS_Init() \n" ); - // Reentrant calls to this method do nothing except increment a counter - sInitCounter++; - if (sInitCounter > 1) { - OSL_TRACE( "IN : MNS_Init() wait for xpcom to be initted \n" ); - //wait for xpcom to be initted - m_aUI_Thread_Condition.wait(); - - OSL_TRACE( "OUT : MNS_Init() : counter = %d\n", sInitCounter ); - aProfileExists = s_bProfilePresentAfterInitialized; - return sal_True; - } - - UI_Thread_ARGS * args = new UI_Thread_ARGS; - args->bProfileExists = &aProfileExists; - - m_aUI_Thread_Condition.reset(); - m_Mozilla_UI_Thread=osl_createThread(MNS_Mozilla_UI_Thread, - (void*)args); - if (!m_Mozilla_UI_Thread) - { - return sal_False; - } - - //wait for xpcom to be initted - m_aUI_Thread_Condition.wait(); - - //Add Terminate Listener to XDesktop to get application exit event - MNSTerminateListener::addTerminateListener(); - - OSL_TRACE( "OUT : MNS_Init() - First Init\n" ); - - return sal_True; -} - -sal_Bool MNS_Term(sal_Bool aForce) -{ - // Reentrant calls to this method do nothing except decrement a counter - OSL_TRACE( "IN : MNS_Term() \n" ); - if (!aForce && sInitCounter > 1) - { - --sInitCounter; - OSL_TRACE( "OUT : MNS_Term() : counter = %d\n", sInitCounter ); - return sal_True; - } - sInitCounter = 0; - - aLive=0; - - //wait for xpcom to be finished - TimeValue timeValue = { 1, 0 }; - m_aUI_Thread_Condition.wait(&timeValue); - - - OSL_TRACE( "OUT : MNS_Term() - Final Term\n" ); - return sal_True; -} - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx deleted file mode 100644 index e7be32272eda..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_NS_INIT_HXX_ -#define _CONNECTIVITY_MAB_NS_INIT_HXX_ 1 -#include "MNSDeclares.hxx" - -#include <sal/types.h> - -sal_Bool MNS_Init(sal_Bool& aProfileExists); -sal_Bool MNS_Term(sal_Bool aForce=sal_False); - -sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists); -typedef struct UI_Thread_ARGS -{ - sal_Bool* bProfileExists; -}UI_Thread_ARGS; -void MNS_XPCOM_EventLoop(); - -#endif // _CONNECTIVITY_MAB_NS_INIT_HXX_ 1 - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx deleted file mode 100644 index 0d2a1bf7671c..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx +++ /dev/null @@ -1,627 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MNSProfile.hxx" -#include "MNSProfileDirServiceProvider.hxx" - -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <unotools/processfactory.hxx> -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::mozilla; -using namespace rtl; - -// Interfaces Needed - -static Reference<XMozillaBootstrap> xMozillaBootstrap; - - -static PRInt32 gInstanceCount = 0; - -// Profile database to remember which profile has been -// created with UILocale and contentLocale on profileManager -static nsProfileDirServiceProvider *gDirServiceProvider = nsnull; - - - - -/* - * Constructor/Destructor - */ -nsProfile::nsProfile() -{ - mStartingUp = PR_FALSE; - mCurrentProfileAvailable = PR_FALSE; - - mShutdownProfileToreDownNetwork = PR_FALSE; - - mProfileChangeVetoed = PR_FALSE; - mProfileChangeFailed = PR_FALSE; - Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); - - Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY); - - -} - -nsProfile::~nsProfile() -{ -} - - -nsresult -nsProfile::Init() -{ - nsresult rv = NS_OK; - RegisterProfileManager(this); - if (gInstanceCount++ == 0) { - rv = NS_NewProfileDirServiceProvider( &gDirServiceProvider); - if (NS_SUCCEEDED(rv)) - rv = gDirServiceProvider->Register(); - } - return rv; -} - -/* - * nsISupports Implementation - */ -NS_IMPL_THREADSAFE_ADDREF(nsProfile) -NS_IMPL_THREADSAFE_RELEASE(nsProfile) - -NS_INTERFACE_MAP_BEGIN(nsProfile) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProfile) - NS_INTERFACE_MAP_ENTRY(nsIProfile) - NS_INTERFACE_MAP_ENTRY(nsIProfileInternal) - NS_INTERFACE_MAP_ENTRY(nsIProfileChangeStatus) - NS_INTERFACE_MAP_ENTRY(nsIFactory) -NS_INTERFACE_MAP_END - -/* - * nsIProfileChangeStatus Implementation - */ - -NS_IMETHODIMP nsProfile::VetoChange() -{ - mProfileChangeVetoed = PR_TRUE; - return NS_OK; -} - -NS_IMETHODIMP nsProfile::ChangeFailed() -{ - mProfileChangeFailed = PR_TRUE; - return NS_OK; -} -/* - * nsIProfile Implementation - */ - -NS_IMETHODIMP nsProfile::GetProfileCount(PRInt32 *numProfiles) -{ - NS_ENSURE_ARG_POINTER(numProfiles); - - *numProfiles = 0; - - *numProfiles = xMozillaBootstrap->getProfileCount(xMozillaBootstrap->getCurrentProduct()); - return NS_OK; -} -NS_IMETHODIMP nsProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames) -{ - NS_ENSURE_ARG_POINTER(length); - NS_ENSURE_ARG_POINTER(profileNames); - *profileNames = nsnull; - - ::com::sun::star::uno::Sequence< ::rtl::OUString > list; - - *length = xMozillaBootstrap->getProfileList(xMozillaBootstrap->getCurrentProduct(),list); - - const OUString * pArray = list.getConstArray(); - - nsresult rv = NS_OK; - PRInt32 count = list.getLength(); - PRUnichar **outArray, **next; - - next = outArray = (PRUnichar **)nsMemory::Alloc(count * sizeof(PRUnichar *)); - if (!outArray) - return NS_ERROR_OUT_OF_MEMORY; - - for (PRInt32 index=0; index < count; index++) - { - *next = (PRUnichar *)nsMemory::Clone(pArray[index].getStr(),(pArray[index].getLength()+1) * sizeof(PRUnichar )); - if (*next == nsnull) - { - rv = NS_ERROR_OUT_OF_MEMORY; - break; - } - next++; - } - *profileNames = outArray; - return rv; -} -NS_IMETHODIMP nsProfile::ProfileExists(const PRUnichar *profileName, PRBool *exists) -{ - NS_ENSURE_ARG_POINTER(profileName); - NS_ENSURE_ARG_POINTER(exists); - - // PRUnichar != sal_Unicode in mingw - *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName)); - return NS_OK; -} -// Returns the name of the current profile i.e., the last used profile -NS_IMETHODIMP -nsProfile::GetCurrentProfile(PRUnichar **profileName) -{ - NS_ENSURE_ARG_POINTER(profileName); - *profileName = nsnull; - - if (mCurrentProfileName.Length()) - *profileName = (PRUnichar *)nsMemory::Clone(mCurrentProfileName.get(),(mCurrentProfileName.Length() + 1) * sizeof(PRUnichar )); - else - { - rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(xMozillaBootstrap->getCurrentProduct()); - *profileName = (PRUnichar *)nsMemory::Clone(profile.getStr(),( profile.getLength() + 1) * sizeof(PRUnichar )); - SetCurrentProfile(*profileName); - } - - return (*profileName == nsnull) ? NS_ERROR_FAILURE : NS_OK; -} - -NS_IMETHODIMP -nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile) -{ - NS_ENSURE_ARG(aCurrentProfile); - - nsresult rv; - nsCOMPtr<nsIFile> profileDir; - PRBool exists; - - // Ensure that the profile exists and its directory too. - rv = GetProfileDir(aCurrentProfile, getter_AddRefs(profileDir)); - if (NS_FAILED(rv)) return rv; - rv = profileDir->Exists(&exists); - if (NS_FAILED(rv)) return rv; - if (!exists) return NS_ERROR_FILE_NOT_FOUND; - - PRBool isSwitch = PRBool(); - - if (mCurrentProfileAvailable) - { - nsXPIDLString currProfileName; - rv = GetCurrentProfile(getter_Copies(currProfileName)); - if (NS_FAILED(rv)) return rv; - if (nsCRT::strcmp(aCurrentProfile, currProfileName.get()) == 0) - return NS_OK; - else - isSwitch = PR_TRUE; - } - else - isSwitch = PR_FALSE; - - - nsCOMPtr<nsIObserverService> observerService = - do_GetService("@mozilla.org/observer-service;1", &rv); - NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); - - nsISupports *subject = (nsISupports *)((nsIProfile *)this); - NS_NAMED_LITERAL_STRING(switchString, "switch"); - NS_NAMED_LITERAL_STRING(startupString, "startup"); - const nsAFlatString& context = isSwitch ? switchString : startupString; - - if (isSwitch) - { - rv = ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST); - if (NS_FAILED(rv)) return NS_ERROR_ABORT; - - // Phase 1: See if anybody objects to the profile being changed. - mProfileChangeVetoed = PR_FALSE; - observerService->NotifyObservers(subject, "profile-approve-change", context.get()); - if (mProfileChangeVetoed) - return NS_OK; - - // Phase 2a: Send the network teardown notification - observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get()); - mShutdownProfileToreDownNetwork = PR_TRUE; - - // Phase 2b: Send the "teardown" notification - observerService->NotifyObservers(subject, "profile-change-teardown", context.get()); - if (mProfileChangeVetoed) - { - // Notify we will not proceed with changing the profile - observerService->NotifyObservers(subject, "profile-change-teardown-veto", context.get()); - - // Bring network back online and return - observerService->NotifyObservers(subject, "profile-change-net-restore", context.get()); - return NS_OK; - } - - // Phase 3: Notify observers of a profile change - observerService->NotifyObservers(subject, "profile-before-change", context.get()); - if (mProfileChangeFailed) - return NS_ERROR_ABORT; - - } - -// -// // Do the profile switch - gDirServiceProvider->SetProfileDir(profileDir); - mCurrentProfileName.Assign(aCurrentProfile); -// gProfileDataAccess->SetCurrentProfile(aCurrentProfile); - - if (NS_FAILED(rv)) return rv; - mCurrentProfileAvailable = PR_TRUE; - - if (!isSwitch) - { - // Ensure that the prefs service exists so it can respond to - // the notifications we're about to send around. It needs to. - nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get prefs service"); - } - - if (mShutdownProfileToreDownNetwork) - { - // Bring network back online - observerService->NotifyObservers(subject, "profile-change-net-restore", context.get()); - mShutdownProfileToreDownNetwork = PR_FALSE; - if (mProfileChangeFailed) - return NS_ERROR_ABORT; - } - - // Phase 4: Notify observers that the profile has changed - Here they respond to new profile - observerService->NotifyObservers(subject, "profile-do-change", context.get()); - if (mProfileChangeFailed) - return NS_ERROR_ABORT; - - // Phase 5: Now observers can respond to something another observer did in phase 4 - observerService->NotifyObservers(subject, "profile-after-change", context.get()); - if (mProfileChangeFailed) - return NS_ERROR_ABORT; - - // Phase 6: One last notification after the new profile is established - observerService->NotifyObservers(subject, "profile-initial-state", context.get()); - if (mProfileChangeFailed) - return NS_ERROR_ABORT; - - return NS_OK; -} -/* void shutDownCurrentProfile (in unsigned long shutDownType); */ -NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType) -{ - nsresult rv; - - // if shutDownType is not a well know value, skip the notifications - // see DoOnShutdown() in nsAppRunner.cpp for where we use this behaviour to our benefit - if (shutDownType == (PRUint32)SHUTDOWN_PERSIST || shutDownType == (PRUint32)SHUTDOWN_CLEANSE ) { - nsCOMPtr<nsIObserverService> observerService = - do_GetService("@mozilla.org/observer-service;1", &rv); - NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); - - nsISupports *subject = (nsISupports *)((nsIProfile *)this); - - NS_NAMED_LITERAL_STRING(cleanseString, "shutdown-cleanse"); - NS_NAMED_LITERAL_STRING(persistString, "shutdown-persist"); - const nsAFlatString& context = (shutDownType == (PRUint32)SHUTDOWN_CLEANSE) ? cleanseString : persistString; - - // Phase 1: See if anybody objects to the profile being changed. - mProfileChangeVetoed = PR_FALSE; - observerService->NotifyObservers(subject, "profile-approve-change", context.get()); - if (mProfileChangeVetoed) - return NS_OK; - - // Phase 2a: Send the network teardown notification - observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get()); - mShutdownProfileToreDownNetwork = PR_TRUE; - - // Phase 2b: Send the "teardown" notification - observerService->NotifyObservers(subject, "profile-change-teardown", context.get()); - - - // Phase 3: Notify observers of a profile change - observerService->NotifyObservers(subject, "profile-before-change", context.get()); - } - - - gDirServiceProvider->SetProfileDir(nsnull); - mCurrentProfileAvailable = PR_FALSE; - mCurrentProfileName.Truncate(0); - - return NS_OK; -} -/* void createNewProfile (in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir); */ -NS_IMETHODIMP nsProfile::CreateNewProfile(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*langcode*/, PRBool /*useExistingDir*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void renameProfile (in wstring oldName, in wstring newName); */ -NS_IMETHODIMP nsProfile::RenameProfile(const PRUnichar* /*oldName*/, const PRUnichar* /*newName*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void deleteProfile (in wstring name, in boolean canDeleteFiles); */ -NS_IMETHODIMP nsProfile::DeleteProfile(const PRUnichar* /*name*/, PRBool /*canDeleteFiles*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void cloneProfile (in wstring profileName); */ -NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* /*profileName*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -//nsIProfileInternal Implementation - -/* [noscript] void startupWithArgs (in nsICmdLineService cmdLine, in boolean canInteract); */ -class nsICmdLineService; - -NS_IMETHODIMP nsProfile::StartupWithArgs(nsICmdLineService* /*cmdLineArgs*/, PRBool /*canInteract*/) -{ - Init(); - return NS_OK; -} - -/* [noscript] readonly attribute boolean isStartingUp; */ -NS_IMETHODIMP nsProfile::GetIsStartingUp(PRBool *aIsStartingUp) -{ - NS_ENSURE_ARG_POINTER(aIsStartingUp); - *aIsStartingUp = mStartingUp; - return NS_OK; -} - -/* long get4xProfileCount (); */ -NS_IMETHODIMP nsProfile::Get4xProfileCount(PRInt32* /*_retval*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void getProfileListX (in unsigned long which, out unsigned long length, [array, size_is (length), retval] out wstring profileNames); */ -NS_IMETHODIMP nsProfile::GetProfileListX(PRUint32 /*whichKind*/, PRUint32* /*length*/, PRUnichar*** /*profileNames*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void migrateProfileInfo (); */ -NS_IMETHODIMP nsProfile::MigrateProfileInfo() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void migrateAllProfiles (); */ -NS_IMETHODIMP nsProfile::MigrateAllProfiles() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void migrateProfile (in wstring profileName); */ -NS_IMETHODIMP nsProfile::MigrateProfile(const PRUnichar* /*profileName*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void remigrateProfile (in wstring profileName); */ -NS_IMETHODIMP nsProfile::RemigrateProfile(const PRUnichar* /*profileName*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void forgetCurrentProfile (); */ -NS_IMETHODIMP nsProfile::ForgetCurrentProfile() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void createDefaultProfile (); */ -NS_IMETHODIMP nsProfile::CreateDefaultProfile() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* nsIFile getProfileDir (in wstring profileName); */ -// Gets the profiles directory for a given profile -// Sets the given profile to be a current profile -NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **profileDir) -{ - NS_ENSURE_ARG(profileName); - NS_ENSURE_ARG_POINTER(profileDir); - *profileDir = nsnull; - - nsresult rv = NS_OK; - - // PRUnichar != sal_Unicode in mingw - rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName)); - - nsCOMPtr<nsILocalFile> localFile; - // PRUnichar != sal_Unicode in mingw - nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr())); - - rv = NS_NewLocalFile(filePath, PR_TRUE, - getter_AddRefs(localFile)); - if (localFile && NS_SUCCEEDED(rv)) - return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)profileDir); - return rv; -} - -/* wstring getProfilePath (in wstring profileName); */ -NS_IMETHODIMP nsProfile::GetProfilePath(const PRUnichar* /*profileName*/, PRUnichar** /*_retval*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* nsILocalFile getOriginalProfileDir (in wstring profileName); */ -NS_IMETHODIMP nsProfile::GetOriginalProfileDir(const PRUnichar* /*profileName*/, nsILocalFile** /*originalDir*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* PRInt64 getProfileLastModTime (in wstring profileName); */ -NS_IMETHODIMP nsProfile::GetProfileLastModTime(const PRUnichar* /*profileName*/, PRInt64* /*_retval*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* attribute boolean automigrate; */ -NS_IMETHODIMP nsProfile::GetAutomigrate(PRBool* /*aAutomigrate*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -NS_IMETHODIMP nsProfile::SetAutomigrate(PRBool /*aAutomigrate*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* readonly attribute nsIFile defaultProfileParentDir; */ -NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile** /*aDefaultProfileParentDir*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* readonly attribute wstring firstProfile; */ -NS_IMETHODIMP nsProfile::GetFirstProfile(PRUnichar **profileName) -{ - NS_ENSURE_ARG_POINTER(profileName); - - return GetCurrentProfile(profileName); -} - -/* attribute boolean startWithLastUsedProfile; */ -NS_IMETHODIMP nsProfile::GetStartWithLastUsedProfile(PRBool* /*aStartWithLastUsedProfile*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -NS_IMETHODIMP nsProfile::SetStartWithLastUsedProfile(PRBool /*aStartWithLastUsedProfile*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] void updateRegistry (in nsIFile regName); */ -NS_IMETHODIMP nsProfile::UpdateRegistry(nsIFile* /*regName*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] void getRegStrings (in wstring profileName, out wstring regString, out wstring regName, out wstring regEmail, out wstring regOption); */ -NS_IMETHODIMP nsProfile::GetRegStrings(const PRUnichar* /*profileName*/, PRUnichar** /*regString*/, PRUnichar** /*regName*/, PRUnichar** /*regEmail*/, PRUnichar** /*regOption*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] void setRegStrings (in wstring profileName, in wstring regString, in wstring regName, in wstring regEmail, in wstring regOption); */ -NS_IMETHODIMP nsProfile::SetRegStrings(const PRUnichar* /*profileName*/, const PRUnichar* /*regString*/, const PRUnichar* /*regName*/, const PRUnichar* /*regEmail*/, const PRUnichar* /*regOption*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] string isRegStringSet (in wstring profileName); */ -NS_IMETHODIMP nsProfile::IsRegStringSet(const PRUnichar* /*profileName*/, char** /*_retval*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void createNewProfileWithLocales (in wstring profileName, in wstring nativeProfileDir, in wstring UILocale, in wstring contentLocale, in boolean useExistingDir); */ -NS_IMETHODIMP nsProfile::CreateNewProfileWithLocales(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*UILocale*/, const PRUnichar* /*contentLocale*/, PRBool /*useExistingDir*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* boolean isCurrentProfileAvailable (); */ -NS_IMETHODIMP nsProfile::IsCurrentProfileAvailable(PRBool *available) -{ - NS_ENSURE_ARG_POINTER(available); - - *available = mCurrentProfileAvailable; - return NS_OK; -} - -/* [noscript] void getCurrentProfileDir (out nsIFile profileDir); */ -// Returns the name of the current profile directory -NS_IMETHODIMP nsProfile::GetCurrentProfileDir(nsIFile **profileDir) -{ - NS_ENSURE_ARG_POINTER(profileDir); - nsresult rv; - - nsXPIDLString profileName; - rv = GetCurrentProfile(getter_Copies(profileName)); - if (NS_FAILED(rv)) return rv; - - rv = GetProfileDir(profileName, profileDir); - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - -//Implementation nsIFactory -NS_IMETHODIMP -nsProfile::LockFactory(PRBool /*aVal*/) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsProfile::CreateInstance(nsISupports* aOuter, const nsID& aIID, - void** aResult) -{ - if (aOuter) - return NS_ERROR_NO_AGGREGATION; - // return this object - return QueryInterface(aIID, aResult); -} - -//Register profile manager -#include "nsIComponentManager.h" -#include "nsIComponentRegistrar.h" - -static const nsCID kProfileManagerCID = NS_PROFILE_CID; - -#define NS_PROFILE_CONTRACTID \ - "@mozilla.org/profile/manager;1" - -nsresult -nsProfile::RegisterProfileManager(nsIProfile* aProfileService) -{ - nsCOMPtr<nsIServiceManager> mgr; - NS_GetServiceManager(getter_AddRefs(mgr)); - - NS_ASSERTION(mgr, "Not initialized!"); - - nsCOMPtr<nsIFactory> factory = do_QueryInterface(aProfileService); - NS_ASSERTION(factory, "Supposed to be an nsIFactory!"); - - nsCOMPtr<nsIComponentRegistrar> reg (do_QueryInterface(mgr)); - if (!reg) - return NS_ERROR_NO_INTERFACE; - - return reg->RegisterFactory(kProfileManagerCID, - "Profile Manager", - NS_PROFILE_CONTRACTID, - factory); -} diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx deleted file mode 100644 index 058358cf5184..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "mozilla_nsprofile.h" - -#define _MAX_LENGTH 256 - -class nsProfile: public nsIProfileInternal, - public nsIProfileChangeStatus, - public nsIFactory -{ - NS_DECL_ISUPPORTS - NS_DECL_NSIPROFILE - NS_DECL_NSIPROFILEINTERNAL - NS_DECL_NSIPROFILECHANGESTATUS - NS_DECL_NSIFACTORY - -private: - PRBool mStartingUp; - PRBool mProfileChangeVetoed; - PRBool mProfileChangeFailed; - - nsString mCurrentProfileName; - PRBool mCurrentProfileAvailable; - - PRBool mIsContentLocaleSpecified; - nsCString mContentLocaleName; - - PRBool mShutdownProfileToreDownNetwork; - nsresult Init(); - -public: - nsProfile(); - virtual ~nsProfile(); - -public: - //We register an factory for Mozilla profile service its CID and CONTRACTID are NS_PROFILE_CID and NS_PROFILE_CONTRACTID - //After that, we does not need profile.dll/libprofile.so any more. Our profile service are diffrent from the orginal one in - //these areas: - //1. We do not lock Mozilla Profile, - //2. We do not change Mozilla Profile settings. We do not change default profile, do not create new profiles and - // do not write changes back to profile register - //3. We support can load both Thunderbird profile and Mozilla profiles - static nsresult RegisterProfileManager(nsIProfile* aProfileService); - -}; - -extern nsresult ConvertStringToUnicode(nsCString& aCharset, const char* inString, nsAString& outString); -extern nsresult GetPlatformCharset(nsCString& aCharset); - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx deleted file mode 100644 index d86f3feb7b60..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx +++ /dev/null @@ -1,236 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#if defined _MSC_VER - #pragma warning(disable:4710) -#endif - -#include "pre_include_mozilla.h" -#include "MNSProfileDirServiceProvider.hxx" -#include "nsIAtom.h" -#include "nsStaticAtom.h" -#include "nsILocalFile.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsISupportsUtils.h" -#include "post_include_mozilla.h" - - - -#define PREFS_FILE_50_NAME NS_LITERAL_CSTRING("prefs.js") - - -nsIAtom* nsProfileDirServiceProvider::sApp_PrefsDirectory50; -nsIAtom* nsProfileDirServiceProvider::sApp_PreferencesFile50; -nsIAtom* nsProfileDirServiceProvider::sApp_UserProfileDirectory50; - - -//***************************************************************************** -// nsProfileDirServiceProvider::nsProfileDirServiceProvider -//***************************************************************************** - -nsProfileDirServiceProvider::nsProfileDirServiceProvider() -{ -} - - -nsProfileDirServiceProvider::~nsProfileDirServiceProvider() -{ -} - -nsresult -nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir) -{ - if (mProfileDir) { - PRBool isEqual; - if (aProfileDir && - NS_SUCCEEDED(aProfileDir->Equals(mProfileDir, &isEqual)) && isEqual) { - NS_WARNING("Setting profile dir to same as current"); - return NS_OK; - } - UndefineFileLocations(); - } - mProfileDir = aProfileDir; - if (!mProfileDir) - return NS_OK; - - nsresult rv = EnsureProfileFileExists(mProfileDir); - return rv; - -} - -nsresult -nsProfileDirServiceProvider::Register() -{ - nsCOMPtr<nsIDirectoryService> directoryService = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); - if (!directoryService) - return NS_ERROR_FAILURE; - return directoryService->RegisterProvider(this); -} - -nsresult -nsProfileDirServiceProvider::Shutdown() -{ - nsCOMPtr<nsIDirectoryService> directoryService = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); - if (!directoryService) - return NS_ERROR_FAILURE; - return directoryService->UnregisterProvider(this); -} - -// nsProfileDirServiceProvider::nsISupports - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsProfileDirServiceProvider, - nsIDirectoryServiceProvider) - -// nsProfileDirServiceProvider::nsIDirectoryServiceProvider - -NS_IMETHODIMP -nsProfileDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFile **_retval) -{ - NS_ENSURE_ARG(prop); - NS_ENSURE_ARG_POINTER(persistant); - NS_ENSURE_ARG_POINTER(_retval); - - if (!mProfileDir) - return NS_ERROR_FAILURE; - - *persistant = PR_TRUE; - nsIFile* domainDir = mProfileDir; - - - nsCOMPtr<nsIFile> localFile; - nsresult rv = NS_ERROR_FAILURE; - - nsIAtom* inAtom = NS_NewAtom(prop); - NS_ENSURE_TRUE(inAtom, NS_ERROR_OUT_OF_MEMORY); - - if (inAtom == sApp_PrefsDirectory50) { - rv = domainDir->Clone(getter_AddRefs(localFile)); - } - else if (inAtom == sApp_PreferencesFile50) { - rv = domainDir->Clone(getter_AddRefs(localFile)); - if (NS_SUCCEEDED(rv)) - rv = localFile->AppendNative(PREFS_FILE_50_NAME); - } - else if (inAtom == sApp_UserProfileDirectory50) { - rv = domainDir->Clone(getter_AddRefs(localFile)); - } - - NS_RELEASE(inAtom); - - if (localFile && NS_SUCCEEDED(rv)) - return CallQueryInterface(localFile, _retval); - - return rv; -} - -//***************************************************************************** -// Protected methods -//***************************************************************************** - -nsresult -nsProfileDirServiceProvider::Initialize() -{ - - static const nsStaticAtom provider_atoms[] = { - { NS_APP_PREFS_50_DIR, &sApp_PrefsDirectory50 }, - { NS_APP_PREFS_50_FILE, &sApp_PreferencesFile50 }, - { NS_APP_USER_PROFILE_50_DIR, &sApp_UserProfileDirectory50 }, - { NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, nsnull }, - }; - - // Register our directory atoms - NS_RegisterStaticAtoms(provider_atoms, NS_ARRAY_LENGTH(provider_atoms)); - - return NS_OK; -} - -nsresult -nsProfileDirServiceProvider::EnsureProfileFileExists(nsIFile *aFile) -{ - nsresult rv; - PRBool exists; - - rv = aFile->Exists(&exists); - if (NS_FAILED(rv)) - return rv; - if (exists) - return NS_OK; - - nsCOMPtr<nsIFile> defaultsFile; - - // Attempt first to get the localized subdir of the defaults - rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR, getter_AddRefs(defaultsFile)); - if (NS_FAILED(rv)) { - // If that has not been defined, use the top level of the defaults - rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(defaultsFile)); - if (NS_FAILED(rv)) - return rv; - } - - mProfileDir = defaultsFile; - return rv; -} - - -nsresult -nsProfileDirServiceProvider::UndefineFileLocations() -{ - nsresult rv; - - nsCOMPtr<nsIProperties> directoryService = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - NS_ENSURE_TRUE(directoryService, NS_ERROR_FAILURE); - - (void) directoryService->Undefine(NS_APP_PREFS_50_DIR); - (void) directoryService->Undefine(NS_APP_PREFS_50_FILE); - (void) directoryService->Undefine(NS_APP_USER_PROFILE_50_DIR); - - return NS_OK; -} - -//***************************************************************************** -// Global creation function -//***************************************************************************** - -nsresult NS_NewProfileDirServiceProvider(nsProfileDirServiceProvider** aProvider) -{ - NS_ENSURE_ARG_POINTER(aProvider); - *aProvider = nsnull; - - nsProfileDirServiceProvider *prov = new nsProfileDirServiceProvider(); - if (!prov) - return NS_ERROR_OUT_OF_MEMORY; - nsresult rv = prov->Initialize(); - if (NS_FAILED(rv)) { - delete prov; - return rv; - } - NS_ADDREF(*aProvider = prov); - return NS_OK; -} diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx deleted file mode 100644 index d518d0f69be6..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - - -#include "mozilla_nsprofiledirserviceprovider.h" - -// Forward Declarations -class nsIAtom; - -// -------------------------------------------------------------------------------------- -// nsProfileDirServiceProvider - The nsIDirectoryServiceProvider implementation used for -// profile-relative file locations. -// -------------------------------------------------------------------------------------- - -class nsProfileDirServiceProvider: public nsIDirectoryServiceProvider -{ - NS_DECL_ISUPPORTS - NS_DECL_NSIDIRECTORYSERVICEPROVIDER - - friend nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider**); - -public: - - virtual nsresult SetProfileDir(nsIFile* aProfileDir); - virtual nsresult Register(); - virtual nsresult Shutdown(); - -protected: - nsProfileDirServiceProvider(); - virtual ~nsProfileDirServiceProvider(); - - nsresult Initialize(); - nsresult EnsureProfileFileExists(nsIFile* profileDir); - nsresult UndefineFileLocations(); - -protected: - - // Atoms for file locations - static nsIAtom* sApp_PrefsDirectory50; - static nsIAtom* sApp_PreferencesFile50; - static nsIAtom* sApp_UserProfileDirectory50; - - nsCOMPtr<nsIFile> mProfileDir; - -}; - - -// -------------------------------------------------------------------------------------- - -/** - * Global method to create an instance of nsProfileDirServiceProvider - * - * @param aNotifyObservers If true, will send out profile startup - * notifications when the profile directory is set. - * See nsIProfileChangeStatus. - */ - -nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider** aProvider); - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx deleted file mode 100644 index 6973a9969b83..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ /dev/null @@ -1,417 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MNSProfileDiscover.hxx" -#ifndef MINIMAL_PROFILEDISCOVER -#include "MNSProfile.hxx" - -#include "pratom.h" -#include "prmem.h" -#include "plstr.h" -#include "prenv.h" - -#include "nsIEnumerator.h" -#include "prprf.h" -#include "nsCOMPtr.h" -#include "nsIComponentManager.h" -#include "nsEscape.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsILocalFile.h" -#include "nsReadableUtils.h" - - -#if defined(XP_MAC) || defined(XP_MACOSX) -#include <Processes.h> -#include <CFBundle.h> -#include "nsILocalFileMac.h" -#endif - -#ifdef XP_UNIX -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <signal.h> -#include "prnetdb.h" -#include "prsystem.h" -#endif - -#ifdef VMS -#include <rmsdef.h> -#endif - -#include "nsICharsetConverterManager.h" -#include "nsIPlatformCharset.h" - - -#if defined (XP_UNIX) -#define USER_ENVIRONMENT_VARIABLE "USER" -#define LOGNAME_ENVIRONMENT_VARIABLE "LOGNAME" -#define HOME_ENVIRONMENT_VARIABLE "HOME" -#define PROFILE_NAME_ENVIRONMENT_VARIABLE "PROFILE_NAME" -#define PROFILE_HOME_ENVIRONMENT_VARIABLE "PROFILE_HOME" -#define DEFAULT_UNIX_PROFILE_NAME "default" -#ifndef XP_MACOSX /* Don't use symlink-based locking on OS X */ -#define USE_SYMLINK_LOCKING -#endif -#elif defined (XP_BEOS) -#endif - -// IID and CIDs of all the services needed -static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); -#endif - -// Registry Keys - -static ::rtl::OUString szProfileSubtreeString=::rtl::OUString::createFromAscii("Profiles"); -static ::rtl::OUString szCurrentProfileString= ::rtl::OUString::createFromAscii("CurrentProfile"); -static ::rtl::OUString szDirectoryString =::rtl::OUString::createFromAscii("directory"); - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif -#include <MNSFolders.hxx> -#include <MNSINIParser.hxx> - -namespace connectivity -{ - namespace mozab - { - ProfileStruct::ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName, -#ifdef MINIMAL_PROFILEDISCOVER - const ::rtl::OUString& aProfilePath -#else - nsILocalFile * aProfilePath -#endif - ) - { - product=aProduct; - profileName = aProfileName; - profilePath = aProfilePath; - } - ::rtl::OUString ProfileStruct::getProfilePath() - { -#ifdef MINIMAL_PROFILEDISCOVER - return profilePath; -#else - if (profilePath) - { - nsAutoString path; - nsresult rv = profilePath->GetPath(path); - NS_ENSURE_SUCCESS(rv, ::rtl::OUString()); - // PRUnichar != sal_Unicode in mingw - return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(path.get())); - } - else - return ::rtl::OUString(); -#endif - } - - ProfileAccess::~ProfileAccess() - { - } - ProfileAccess::ProfileAccess() - { - LoadProductsInfo(); - } - - sal_Int32 ProfileAccess::LoadProductsInfo() - { - //load SeaMonkey 2 profiles to m_ProductProfileList - sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla); - - //load thunderbird profiles to m_ProductProfileList - count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird); - - //load firefox profiles to m_ProductProfileList - //firefox profile does not containt address book, but maybe others need them - count += LoadXPToolkitProfiles(MozillaProductType_Firefox); - return count; - } - //Thunderbird and firefox profiles are saved in profiles.ini - sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - -#ifndef MINIMAL_PROFILEDISCOVER - nsresult rv; -#endif - ::rtl::OUString regDir = getRegistryDir(product); - ::rtl::OUString profilesIni( regDir ); - profilesIni += ::rtl::OUString::createFromAscii( "profiles.ini" ); - IniParser parser( profilesIni ); - IniSectionMap &mAllSection = *(parser.getAllSection()); - - IniSectionMap::iterator iBegin = mAllSection.begin(); - IniSectionMap::iterator iEnd = mAllSection.end(); - for(;iBegin != iEnd;iBegin++) - { - ini_Section *aSection = &(*iBegin).second; - ::rtl::OUString profileName; - ::rtl::OUString profilePath; - ::rtl::OUString sIsRelative; - ::rtl::OUString sIsDefault; - - for(NameValueList::iterator itor=aSection->lList.begin(); - itor != aSection->lList.end(); - itor++) - { - struct ini_NameValue * aValue = &(*itor); - if (aValue->sName.equals(::rtl::OUString::createFromAscii("Name"))) - { - profileName = aValue->sValue; - } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("IsRelative"))) - { - sIsRelative = aValue->sValue; - } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("Path"))) - { - profilePath = aValue->sValue; - } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("Default"))) - { - sIsDefault = aValue->sValue; - } - } - if (profileName.getLength() != 0 || profilePath.getLength() != 0) - { - sal_Int32 isRelative = 0; - if (sIsRelative.getLength() != 0) - { - isRelative = sIsRelative.toInt32(); - } - -#ifndef MINIMAL_PROFILEDISCOVER - nsCOMPtr<nsILocalFile> rootDir; - rv = NS_NewLocalFile(EmptyString(), PR_TRUE, - getter_AddRefs(rootDir)); - if (NS_FAILED(rv)) continue; - - OString sPath = OUStringToOString(profilePath, RTL_TEXTENCODING_UTF8); - nsCAutoString filePath(sPath.getStr()); - - if (isRelative) { - // PRUnichar != sal_Unicode in mingw - nsAutoString registryDir( reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()) ); - nsCOMPtr<nsILocalFile> mAppData; - rv = NS_NewLocalFile(registryDir, PR_TRUE, - getter_AddRefs(mAppData)); - if (NS_FAILED(rv)) continue; - rv = rootDir->SetRelativeDescriptor(mAppData, filePath); - } else { - rv = rootDir->SetPersistentDescriptor(filePath); - } - if (NS_FAILED(rv)) continue; -#endif - - ProfileStruct* profileItem = new ProfileStruct(product,profileName, -#ifdef MINIMAL_PROFILEDISCOVER - regDir + profilePath -#else - rootDir -#endif - ); - m_Product.mProfileList[profileName] = profileItem; - - sal_Int32 isDefault = 0; - if (sIsDefault.getLength() != 0) - { - isDefault = sIsDefault.toInt32(); - } - if (isDefault) - m_Product.mCurrentProfileName = profileName; - - } - - } - return static_cast< ::sal_Int32 >(m_Product.mProfileList.size()); - } - - ::rtl::OUString ProfileAccess::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end()) - { - //Profile not found - return ::rtl::OUString(); - } - else - return m_Product.mProfileList[profileName]->getProfilePath(); - } - - ::sal_Int32 ProfileAccess::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - return static_cast< ::sal_Int32 >(m_Product.mProfileList.size()); - } - ::sal_Int32 ProfileAccess::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - list.realloc(static_cast<sal_Int32>(m_Product.mProfileList.size())); - sal_Int32 i=0; - for(ProfileList::iterator itor=m_Product.mProfileList.begin(); - itor != m_Product.mProfileList.end(); - itor++) - { - ProfileStruct * aProfile = (*itor).second; - list[i] = aProfile->getProfileName(); - i++; - } - - return static_cast< ::sal_Int32 >(m_Product.mProfileList.size()); - } - - ::rtl::OUString ProfileAccess::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - if (m_Product.mCurrentProfileName.getLength() != 0) - { - //default profile setted in mozilla registry - return m_Product.mCurrentProfileName; - } - if (m_Product.mProfileList.size() == 0) - { - //there are not any profiles - return ::rtl::OUString(); - } - ProfileStruct * aProfile = (*m_Product.mProfileList.begin()).second; - return aProfile->getProfileName(); - } -#ifndef MINIMAL_PROFILEDISCOVER - nsresult ProfileAccess::isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist) - { - nsresult rv; - nsAutoString path; - aFile->GetPath(path); - rv = aFile->Exists(bExist); - NS_ENSURE_SUCCESS(rv, rv); - if (!*bExist) - { - rv = aFile->IsSymlink(bExist); - NS_ENSURE_SUCCESS(rv, rv); - } - return rv; - } - nsresult ProfileAccess::isLockExist(nsILocalFile* aFile) - { -#if defined (XP_MACOSX) - NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock"); - NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock"); -#elif defined (XP_UNIX) - NS_ConvertASCIItoUTF16 OLD_LOCKFILE_NAME("lock"); - NS_ConvertASCIItoUTF16 LOCKFILE_NAME(".parentlock"); -#else - NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock"); - NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, "parent.lock"); -#endif - - nsresult rv; - - PRBool isDir; - rv = aFile->IsDirectory(&isDir); - NS_ENSURE_SUCCESS(rv, rv); - if (!isDir) - return NS_ERROR_FILE_NOT_DIRECTORY; - - nsCOMPtr<nsILocalFile> lockFile; - rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(lockFile))); - NS_ENSURE_SUCCESS(rv, rv); - - rv = lockFile->Append(LOCKFILE_NAME); - NS_ENSURE_SUCCESS(rv, rv); - PRBool nExist=PR_FALSE; - rv = isExistFileOrSymlink(lockFile,&nExist); - NS_ENSURE_SUCCESS(rv, rv); - if (!nExist) // Check OLD_LOCKFILE_NAME - { - nsCOMPtr<nsILocalFile> oldlockFile; - rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(oldlockFile))); - NS_ENSURE_SUCCESS(rv, rv); - - rv = oldlockFile->Append(OLD_LOCKFILE_NAME); - NS_ENSURE_SUCCESS(rv, rv); - rv = isExistFileOrSymlink(oldlockFile,&nExist); - NS_ENSURE_SUCCESS(rv, rv); - } - return nExist; - } - -#endif - ::sal_Bool ProfileAccess::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) - { -#ifdef MINIMAL_PROFILEDISCOVER - (void)product; /* avoid warning about unused parameter */ - (void)profileName; /* avoid warning about unused parameter */ - return sal_True; -#else - ::rtl::OUString path = getProfilePath(product,profileName); - if (!path.getLength()) - return sal_True; - - // PRUnichar != sal_Unicode in mingw - nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr())); - - nsresult rv; - nsCOMPtr<nsILocalFile> localFile; - rv = NS_NewLocalFile(filePath, PR_TRUE, - getter_AddRefs(localFile)); - NS_ENSURE_SUCCESS(rv,sal_True); - - PRBool exists = PR_FALSE; - rv = localFile->Exists(&exists); - NS_ENSURE_SUCCESS(rv, sal_True); - if (!exists) - return sal_True; - - // If the profile is locked, we return true - rv = isLockExist(localFile); - if (rv) - return sal_True; - return sal_False; -#endif - } - - ::sal_Bool ProfileAccess::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) - { - sal_Int32 index=product; - ProductStruct &m_Product = m_ProductProfileList[index]; - if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end()) - { - return sal_False; - } - else - return sal_True; - } - } -} - - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx deleted file mode 100644 index 3fe58e55b7c0..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef __MNSProfileDiscover_h___ -#define __MNSProfileDiscover_h___ - -#ifndef MINIMAL_PROFILEDISCOVER -#include "mozilla_profile_discover.h" -#endif - -#include <sal/types.h> -#include <osl/diagnose.h> -#include <osl/conditn.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_ -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#endif -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#include <rtl/ustring.hxx> - -#include <vector> -#include <map> - -#ifdef XP_OS2 -#define INCL_DOSERRORS -#define INCL_DOSFILEMGR -#include <os2.h> -#endif - -using namespace com::sun::star::mozilla; -namespace connectivity -{ - namespace mozab - { - class ProfileStruct; - } -} -typedef ::std::map < ::rtl::OUString, ::connectivity::mozab::ProfileStruct* > ProfileList; -namespace connectivity -{ - namespace mozab - { - class ProfileStruct - { - public: - ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName, -#ifdef MINIMAL_PROFILEDISCOVER - const ::rtl::OUString &aProfilePath -#else - nsILocalFile * aProfilePath -#endif - ); - MozillaProductType getProductType() { return product;} - ::rtl::OUString getProfileName(){ return profileName;} - ::rtl::OUString getProfilePath() ; -#ifndef MINIMAL_PROFILEDISCOVER - nsILocalFile *getProfileLocal(){ return profilePath;} -#endif - protected: - MozillaProductType product; - ::rtl::OUString profileName; -#ifdef MINIMAL_PROFILEDISCOVER - ::rtl::OUString profilePath; -#else - nsCOMPtr<nsILocalFile> profilePath; -#endif - }; - - class ProductStruct - { - public: - void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;} - - ::rtl::OUString mCurrentProfileName; - - ProfileList mProfileList; - }; - - //Used to query profiles information - class ProfileAccess - { - public: - - virtual ~ProfileAccess(); - ProfileAccess(); - ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException); - ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException); - protected: - ProductStruct m_ProductProfileList[4]; - sal_Int32 LoadProductsInfo(); - sal_Int32 LoadXPToolkitProfiles(MozillaProductType product); -#ifndef MINIMAL_PROFILEDISCOVER - //used by isProfileLocked - nsresult isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist); - nsresult isLockExist(nsILocalFile* aFile); -#endif - }; - - } -} - -#endif // __MNSProfileDiscover_h___ - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx deleted file mode 100644 index 3afa0028f278..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MNSProfileManager.hxx" -#include "MNSProfile.hxx" - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif -#include <MNSFolders.hxx> -#include <MNSINIParser.hxx> - -static ::sal_Int32 nInitCounter=0; -namespace connectivity -{ - namespace mozab - { - - ProfileManager::~ProfileManager() - { - } - ProfileManager::ProfileManager() - :m_CurrentProduct(MozillaProductType_Mozilla) - ,aProfile(NULL) - { - } - ::sal_Int32 ProfileManager::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) - { - if (!aProfile) - { - aProfile=new nsProfile(); - aProfile->StartupWithArgs(NULL,sal_False); - } - - setCurrentProfile(product,profileName); - return ++nInitCounter; - } - ::sal_Int32 ProfileManager::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException) - { - return --nInitCounter; - } - ::com::sun::star::mozilla::MozillaProductType ProfileManager::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException) - { - return m_CurrentProduct; - } - ::rtl::OUString ProfileManager::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException) - { - nsresult rv; - nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv)); - if (NS_FAILED(rv)) return ::rtl::OUString(); - nsXPIDLString currentProfileStr; - //call GetCurrentProfile before call SetCurrentProfile will get the default profile - rv = theProfile->GetCurrentProfile(getter_Copies(currentProfileStr)); - if (NS_FAILED(rv) || currentProfileStr.get() == nsnull) - return ::rtl::OUString(); - // PRUnichar != sal_Unicode in mingw - return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(currentProfileStr.get())); - } - ::rtl::OUString ProfileManager::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) - { - ::rtl::OUString currentProfile = getCurrentProfile(); - //if profileName not given, then skip and return curernt profile - if (!profileName.getLength() && m_CurrentProduct == product) - return currentProfile; - - if (m_CurrentProduct == product && profileName.equals(currentProfile)) - return currentProfile; - //set current product - m_CurrentProduct = product; - - //get profile mozilla profile service - nsresult rv; - nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv)); - if (NS_FAILED(rv)) return ::rtl::OUString(); - - // PRUnichar != sal_Unicode in mingw - const PRUnichar* pUsedProfile = reinterpret_cast_mingw_only<const PRUnichar *>(profileName.getStr()); - //set current profile - rv = theProfile->SetCurrentProfile( pUsedProfile ); - if (NS_FAILED(rv)) return ::rtl::OUString(); - return currentProfile; - } - - - } -} diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx deleted file mode 100644 index dab54fc99233..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef __MNSProfileManager_h___ -#define __MNSProfileManager_h___ - -#include "mozilla_profilemanager.h" - -#include <sal/types.h> -#include <osl/diagnose.h> -#include <osl/conditn.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_ -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#endif -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/uno/Sequence.hxx> - -#include <rtl/ustring.hxx> -#include <vector> -#include <map> - -#ifdef XP_OS2 -#define INCL_DOSERRORS -#define INCL_DOSFILEMGR -#include <os2.h> -#endif - -using namespace com::sun::star::mozilla; -class nsProfile; -namespace connectivity -{ - namespace mozab - { - class ProfileManager - { - public: - - virtual ~ProfileManager(); - ProfileManager(); - - ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ; - ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException) ; - ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException) ; - ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException) ; - ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ; - - protected: - ::com::sun::star::mozilla::MozillaProductType m_CurrentProduct; - nsProfile *aProfile; - }; - - } -} - -#endif // __MNSProfileManager_h___ - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx deleted file mode 100644 index bdfd444b3e58..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MNSRunnable.hxx" -#include "MDatabaseMetaDataHelper.hxx" -#include "MQuery.hxx" -#include <osl/mutex.hxx> -#include <osl/conditn.hxx> - -#include "pre_include_mozilla.h" -#include <nsIProxyObjectManager.h> -// More Mozilla includes for LDAP Connection Test -#include "prprf.h" -#include "nsILDAPURL.h" -#include "nsILDAPMessage.h" -#include "nsILDAPMessageListener.h" -#include "nsILDAPErrors.h" -#include "nsILDAPConnection.h" -#include "nsILDAPOperation.h" -#include "post_include_mozilla.h" - -using namespace connectivity::mozab; - -/* Implementation file */ -NS_IMPL_ISUPPORTS1(MNSRunnable, nsIRunnable) - -static ::osl::Mutex m_aThreadMutex; - -nsIRunnable * MNSRunnable::ProxiedObject() -{ - if (!_ProxiedObject) - { - - nsresult rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ, - NS_GET_IID(nsIRunnable), - this, - PROXY_SYNC, - (void**)&_ProxiedObject); - (void)rv; - - _ProxiedObject->AddRef(); - } - return _ProxiedObject; -} - -MNSRunnable::MNSRunnable() -{ - NS_INIT_ISUPPORTS(); - _ProxiedObject=NULL; -#if OSL_DEBUG_LEVEL > 0 - m_oThreadID = osl_getThreadIdentifier(NULL); -#endif - AddRef(); -} - -MNSRunnable::~MNSRunnable() -{ -} -sal_Int32 MNSRunnable::StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode) -{ - OSL_TRACE( "IN : MNSRunnable::StartProxy() \n" ); - ::osl::MutexGuard aGuard(m_aThreadMutex); - xCode = aCode; - return ProxiedObject()->Run(); -} - - -NS_IMETHODIMP MNSRunnable::Run() -{ - return static_cast<nsresult>(xCode->run()); -} - diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx deleted file mode 100644 index 8097b6a84e8f..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_ -#define _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_ -#include "MNSDeclares.hxx" -#include <osl/thread.hxx> - -#include <MNSInclude.hxx> -#include <com/sun/star/uno/Reference.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_XCODEPROXY_HDL_ -#include <com/sun/star/mozilla/XCodeProxy.hpp> -#endif - - -using namespace com::sun::star::uno; -using namespace com::sun::star::mozilla; - -namespace connectivity -{ - namespace mozab - { - class MNSRunnable : public nsIRunnable - { - public: - nsIRunnable * ProxiedObject(); - MNSRunnable(); - virtual ~MNSRunnable(); - NS_DECL_ISUPPORTS - NS_DECL_NSIRUNNABLE - - public: - sal_Int32 StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode); //Call this to start proxy - - private: - nsIRunnable* _ProxiedObject; - Reference<XCodeProxy> xCode; -#if OSL_DEBUG_LEVEL > 0 - oslThreadIdentifier m_oThreadID; -#endif - }; - } -} -#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_ diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk deleted file mode 100644 index b4696e4d021b..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk +++ /dev/null @@ -1,96 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - -CALL_CDECL=TRUE - -PRJ=..$/..$/..$/.. -PRJINC=..$/..$/.. -PRJNAME=connectivity -TARGET=mozbootstrap - -.IF "$(OS)" == "OS2" -all: - @echo " Not building under OS/2" -.ENDIF - -# --- Settings ---------------------------------- - -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- begin of mozilla specific stuff -MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) -MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla -# --- end of mozilla specific stuff - -.INCLUDE : settings.mk - -.INCLUDE : $(PRJ)$/version.mk - -.INCLUDE : ../makefile_mozab.mk - -INCPRE += -I../mozillasrc - -# --- Files ------------------------------------- - -SLOFILES += \ - $(SLO)$/MNSINIParser.obj \ - $(SLO)$/MNSProfileDiscover.obj \ - $(SLO)$/MMozillaBootstrap.obj \ - $(SLO)$/MNSFolders.obj - -.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES" ) || ( "$(WITH_MOZILLA)" == "NO" ) || ( "$(OS)" == "MACOSX" ) -CDEFS+=-DMINIMAL_PROFILEDISCOVER - -SHL1TARGET=$(TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1OBJS=$(SLOFILES) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(COMPHELPERLIB) - -ALLTAR : $(MISC)/mozbootstrap.component - -$(MISC)/mozbootstrap.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component - -.ELSE -SLOFILES += \ - $(SLO)$/MNSInit.obj \ - $(SLO)$/MNSProfileManager.obj \ - $(SLO)$/MNSRunnable.obj \ - $(SLO)$/MNSProfile.obj \ - $(SLO)$/MNSProfileDirServiceProvider.obj -.ENDIF - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk diff --git a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component deleted file mode 100644 index 8e716259043f..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap"> - <service name="com.sun.star.mozilla.MozillaBootstrap"/> - </implementation> -</component> diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h deleted file mode 100644 index e6b78dea6904..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include "nsIServiceManager.h" -#include "nsIEventQueueService.h" -#include "nsIChromeRegistry.h" - -#include "nsIStringBundle.h" - -#include "nsIDirectoryService.h" -#include "nsIProfile.h" -#include "nsIProfileInternal.h" -#include "nsIPref.h" -#include "nsXPIDLString.h" - -#include "nsString.h" -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif -#include "nsEmbedAPI.h" - -#include "nsDirectoryService.h" - -#include "post_include_mozilla.h" diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h deleted file mode 100644 index 326043dbd56f..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include "nscore.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch.h" - -#include "pratom.h" -#include "prmem.h" -#include "plstr.h" -#include "prenv.h" - -#include "nsIFactory.h" -#include "nsIComponentManager.h" -#include "nsIEnumerator.h" -#include "nsXPIDLString.h" -#include "nsEscape.h" -#include "nsIURL.h" - -#include "prprf.h" - -#include "nsIProfile.h" -#include "nsIProfileInternal.h" -#include "nsIProfileStartupListener.h" -#include "nsIProfileChangeStatus.h" -#include "nsCOMPtr.h" -#include "nsISupports.h" -#include "nsIRegistry.h" -#include "nsString.h" -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsIDirectoryService.h" -#include "nsIFactory.h" - -#include "nsIIOService.h" -#include "nsNetUtil.h" -#include "nsFileStream.h" -#include "nsIStreamListener.h" -#include "nsIServiceManager.h" -#include "nsCOMPtr.h" -#include "nsIModule.h" -#include "nsIGenericFactory.h" -#include "nsICategoryManager.h" -#include "nsXPCOM.h" -#include "nsISupportsPrimitives.h" -#include "nsIDirectoryService.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsIChromeRegistry.h" // chromeReg -#include "nsIStringBundle.h" -#include "nsIObserverService.h" -#include "nsHashtable.h" -#include "nsIAtom.h" -#include "nsCRT.h" - -#include "post_include_mozilla.h" diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h deleted file mode 100644 index f67c673c34d1..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include "nsIDirectoryService.h" -#include "nsILocalFile.h" -#include "nsString.h" -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif - -#include "post_include_mozilla.h" diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h deleted file mode 100644 index 4e9341684dc3..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include "nsCOMPtr.h" -#include "nsISupports.h" -#include "nsString.h" -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif -#include "nsIRegistry.h" -#include "nsXPIDLString.h" -#include "nsVoidArray.h" -#include "nsIFile.h" -#include "nsILocalFile.h" - -#include "post_include_mozilla.h" diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h deleted file mode 100644 index 07351229def4..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include "nsCOMPtr.h" -#include "nsISupports.h" -#include "nsString.h" -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif -#include "nsIRegistry.h" -#include "nsXPIDLString.h" -#include "nsVoidArray.h" -#include "nsIFile.h" -#include "nsILocalFile.h" - -#include "pratom.h" -#include "prmem.h" -#include "plstr.h" -#include "prenv.h" - -#include "nsIEnumerator.h" -#include "prprf.h" -#include "nsCOMPtr.h" -#include "nsIComponentManager.h" -#include "nsEscape.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsILocalFile.h" -#include "nsReadableUtils.h" - - -#if defined(XP_MAC) || defined(XP_MACOSX) -#include <Processes.h> -#include <CFBundle.h> -#include "nsILocalFileMac.h" -#endif - -#ifdef XP_UNIX -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <signal.h> -#include "prnetdb.h" -#include "prsystem.h" -#endif - -#ifdef VMS -#include <rmsdef.h> -#endif - -#include "nsIPlatformCharset.h" -#include <MNSInit.hxx> - -#include "post_include_mozilla.h" diff --git a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h deleted file mode 100644 index ee75d44cfb5f..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifdef _MSC_VER - #pragma warning(pop) -#endif diff --git a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h deleted file mode 100644 index c03ca6da97cd..000000000000 --- a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifdef _MSC_VER - #pragma warning(push,1) - #pragma warning(disable:4668 4917) -#endif diff --git a/connectivity/source/drivers/mozab/exports.dxp b/connectivity/source/drivers/mozab/exports.dxp deleted file mode 100644 index f0e1c69934bc..000000000000 --- a/connectivity/source/drivers/mozab/exports.dxp +++ /dev/null @@ -1,2 +0,0 @@ -component_getImplementationEnvironment -component_getFactory diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk deleted file mode 100644 index 1149021686e4..000000000000 --- a/connectivity/source/drivers/mozab/makefile.mk +++ /dev/null @@ -1,190 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - -PRJ=..$/..$/.. -PRJINC=..$/.. -PRJNAME=connectivity -TARGET=mozab -TARGET2=$(TARGET)drv -VISIBILITY_HIDDEN=TRUE - -.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" ) || ( "$(OS)" == "OS2" ) -all: - @echo " Not building the mozilla address book driver" - @echo " dependency to Mozilla developer snapshots not feasable at the moment" - @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137" - @echo " see http://www.mozilla.org/issues/show_bug.cgi?id=91209" -.ENDIF - -# --- begin of mozilla specific stuff -MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) -MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla - -.IF "$(OS)"=="WNT" - MOZ_EMBED_LIB := $(shell @-test -f $(MOZ_LIB)$/embed_base_s.lib && echo $(MOZ_LIB)$/embed_base_s.lib ) - MOZ_REG_LIB := $(shell @-test -f $(MOZ_LIB)$/mozreg_s.lib && echo $(MOZ_LIB)$/mozreg_s.lib ) - - MOZ_EMBED_LIB *:= $(MOZ_LIB)$/baseembed_s.lib - MOZ_REG_LIB *:= $(MOZ_LIB)$/mozreg.lib - - .IF "$(COM)"=="GCC" - MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core - .ELSE - LIB += $(MOZ_LIB) - MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib - .ENDIF - -.ELSE "$(OS)"=="WNT" - MOZ_LIB_XPCOM = -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s -.ENDIF -# --- end of mozilla specific stuff - -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -.IF "$(OS)"!="WNT" -COMPONENT_CONFIG_DATA=$(TARGET)2.xcu -COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs -.ENDIF - -# --- Settings ---------------------------------- - -.INCLUDE : $(PRJ)$/makefile.pmk - -.INCLUDE : $(PRJ)$/version.mk - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/MDriver.obj \ - $(SLO)$/MServices.obj - -# --- MOZAB BASE Library ----------------------------------- - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1OBJS=$(SLOFILES) -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(DBTOOLSLIB) - -SHL1DEPN= -SHL1IMPLIB= i$(TARGET)$(DLLPOSTFIX) - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \ - $(SLB)$/$(TARGET).lib -DEFLIB1NAME=$(TARGET) - - -# --- Files ------------------------------------- -MOZSLOFILES=\ - $(SLO)$/MNSInit.obj \ - $(SLO)$/MQueryHelper.obj \ - $(SLO)$/MDatabaseMetaDataHelper.obj \ - $(SLO)$/MQuery.obj \ - $(SLO)$/MTypeConverter.obj \ - $(SLO)$/MNameMapper.obj \ - $(SLO)$/MNSMozabProxy.obj \ - $(SLO)$/MNSTerminateListener.obj \ - $(SLO)$/MMozillaBootstrap.obj \ - $(SLO)$/MNSFolders.obj \ - $(SLO)$/MNSProfileDiscover.obj \ - $(SLO)$/MNSProfileManager.obj \ - $(SLO)$/MNSINIParser.obj \ - $(SLO)$/MNSRunnable.obj \ - $(SLO)$/MNSProfile.obj \ - $(SLO)$/MNSProfileDirServiceProvider.obj \ - $(SLO)$/MLdapAttributeMap.obj - - -SLO2FILES=\ - $(SLO)$/MConfigAccess.obj \ - $(SLO)$/MCatalog.obj \ - $(SLO)$/MColumns.obj \ - $(SLO)$/MTable.obj \ - $(SLO)$/MTables.obj \ - $(SLO)$/MColumnAlias.obj \ - $(SLO)$/MPreparedStatement.obj \ - $(SLO)$/MStatement.obj \ - $(SLO)$/MResultSetMetaData.obj \ - $(SLO)$/MResultSet.obj \ - $(SLO)$/MDatabaseMetaData.obj \ - $(SLO)$/MConnection.obj \ - $(MOZSLOFILES) - -DEPOBJFILES=$(SLO2FILES) - -# --- MOZAB BASE Library ----------------------------------- - -SHL2VERSIONMAP= $(TARGET2).map -SHL2NOCHECK=TRUE -SHL2TARGET= $(TARGET2)$(DLLPOSTFIX) -SHL2OBJS=$(SLO2FILES) -SHL2STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(VOSLIB) \ - $(SALLIB) \ - $(DBTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(MOZ_LIB_XPCOM) - -.IF "$(GUI)"=="WNT" - SHL2STDLIBS += \ - $(SHELL32LIB) -.ENDIF # "$(GUI)"=="WNT" - -SHL2DEPN= -SHL2IMPLIB= i$(TARGET2) -SHL2DEF= $(MISC)$/$(SHL2TARGET).def -DEF2NAME= $(SHL2TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : $(PRJ)$/target.pmk - -# --- filter file ------------------------------ - -$(MISC)$/$(SHL1TARGET).flt: makefile.mk - @echo ------------------------------ - @echo _TI >$@ - @echo _real >>$@ - -$(MISC)$/$(SHL2TARGET).flt: makefile.mk - @echo ------------------------------ - @echo _TI >$@ - @echo _real >>$@ - - -ALLTAR : $(MISC)/mozab.component - -$(MISC)/mozab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - mozab.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt mozab.component diff --git a/connectivity/source/drivers/mozab/makefile_mozab.mk b/connectivity/source/drivers/mozab/makefile_mozab.mk deleted file mode 100644 index 7a94ea4b03e2..000000000000 --- a/connectivity/source/drivers/mozab/makefile_mozab.mk +++ /dev/null @@ -1,124 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -CDEFS += -DMOZILLA_INTERNAL_API - -.IF "$(GUI)"=="UNX" - .IF "$(COMNAME)"=="sunpro5" - CFLAGS += -features=tmplife - #This flag is needed to build mozilla 1.7 code - .ENDIF # "$(COMNAME)"=="sunpro5" -.ENDIF - -MOZINC = . \ - -I.. \ - -I$(MOZ_INC) \ - -I$(MOZ_INC)$/nspr \ - -I$(MOZ_INC)$/xpcom \ - -I$(MOZ_INC)$/string \ - -I$(MOZ_INC)$/rdf \ - -I$(MOZ_INC)$/msgbase \ - -I$(MOZ_INC)$/addrbook \ - -I$(MOZ_INC)$/mork \ - -I$(MOZ_INC)$/locale \ - -I$(MOZ_INC)$/pref \ - -I$(MOZ_INC)$/mime \ - -I$(MOZ_INC)$/chrome \ - -I$(MOZ_INC)$/necko \ - -I$(MOZ_INC)$/intl \ - -I$(MOZ_INC)$/profile \ - -I$(MOZ_INC)$/embed_base \ - -I$(MOZ_INC)$/mozldap \ - -I$(MOZ_INC)$/uconv \ - -I$(MOZ_INC)$/xpcom_obsolete \ - -I$(MOZ_INC)$/content - -.IF "$(GUI)" == "WNT" - CDEFS += \ - -DMOZILLA_CLIENT \ - -DXP_PC \ - -DXP_WIN \ - -DXP_WIN32 \ - -DOJI \ - -DWIN32 \ - -D_X86_ \ - -D_WINDOWS \ - -DMOZ_XUL \ - -DMOZ_REFLOW_PERF \ - -DMOZ_REFLOW_PERF_DSP - .IF "$(COM)" == "GCC" - INCPOST += $(MOZINC) - CFLAGSCXX += \ - -fno-rtti -DBOOST_NO_TYPEID \ - -Wall \ - -Wconversion \ - -Wpointer-arith \ - -Wcast-align \ - -Woverloaded-virtual \ - -Wsynth \ - -Wno-long-long - .ELSE # .IF "$(COM)" == "GCC" - INCPRE += $(MOZINC) - .IF "$(DBG_LEVEL)" != "0" - .IF "$(CCNUMVER)" >= "001399999999" - CDEFS += -D_STL_NOFORCE_MANIFEST - .ENDIF # .IF "$(CCNUMVER)" >= "001399999999" - .ENDIF # .IF "$(DBG_LEVEL)" != "0" - .ENDIF # .IF "$(COM)" == "GCC" -.ENDIF # .IF "$(GUI)" == "WNT" - -.IF "$(GUI)" == "UNX" - INCPOST += $(MOZINC) - CDEFS+= -DMOZILLA_CLIENT \ - -DXP_UNIX - .IF "$(OS)" == "LINUX" - CFLAGS += -fPIC -g - CDEFS += -DOJI - CFLAGSCXX += \ - -fno-rtti -DBOOST_NO_TYPEID \ - -Wconversion \ - -Wpointer-arith \ - -Wcast-align \ - -Woverloaded-virtual \ - -Wsynth \ - -Wno-long-long \ - -pthread - CDEFS += -DTRACING - .ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" - CFLAGS += -fPIC - CFLAGSCXX += \ - -fno-rtti -DBOOST_NO_TYPEID \ - -Wconversion \ - -Wpointer-arith \ - -Wcast-align \ - -Woverloaded-virtual \ - -Wsynth \ - -Wno-long-long \ - -Wno-deprecated - CDEFS += -DTRACING - .ENDIF # "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" - - SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR) - -.ENDIF # "$(GUI)" == "UNX" - diff --git a/connectivity/source/drivers/mozab/mozab.component b/connectivity/source/drivers/mozab/mozab.component deleted file mode 100644 index a16d44e0b860..000000000000 --- a/connectivity/source/drivers/mozab/mozab.component +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap"> - <service name="com.sun.star.mozilla.MozillaBootstrap"/> - </implementation> - <implementation name="com.sun.star.comp.sdbc.MozabDriver"> - <service name="com.sun.star.sdbc.Driver"/> - </implementation> -</component> diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu deleted file mode 100644 index d5a84017e32d..000000000000 --- a/connectivity/source/drivers/mozab/mozab.xcu +++ /dev/null @@ -1,150 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed"> - <node oor:name="sdbc:address:outlook" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Microsoft Outlook Address Book</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:outlookexp" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Microsoft Windows Address Book</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:mozilla:" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">SeaMonkey Address Book</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:thunderbird:" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Thunderbird Address Book</value> - </prop> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:ldap:*" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">LDAP Address Book</value> - </prop> - <node oor:name="Properties"> - <node oor:name="BaseDN" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value></value> - </prop> - </node> - <node oor:name="MaxRowCount" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>100</value> - </prop> - </node> - <node oor:name="PortNumber" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>389</value> - </prop> - </node> - <node oor:name="UseSSL" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - </node> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsTableCreation" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="Authentication" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value>UserPassword</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml deleted file mode 100644 index 4b81280330f6..000000000000 --- a/connectivity/source/drivers/mozab/mozab.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version='1.0' encoding="UTF-8"?> -<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd"> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> mozabdrv2 </module-name> - <component-description> - <Author>Your name</Author> - <Name>com.sun.star.comp.sdbc.MozabDriver</Name> - <Description> - This is the implementation of the sdbc-mozab bridge. - </Description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service> com.sun.star.sdbc.Driver </supported-service> - <service-dependency> ... </service-dependency> - </component-description> - <component-description> - <Author>Wind Li</Author> - <Name>com.sun.star.comp.mozilla.MozillaBootstrap</Name> - <Description> - This is the implementation of the MozillaBootstrap for sdbc-mozab bridge and xmlsec. - </Description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service> com.sun.star.mozilla.MozillaBootstrap</supported-service> - <service-dependency> ... </service-dependency> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <project-build-dependency> vos </project-build-dependency> - - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu1 </runtime-module-dependency> - <runtime-module-dependency> sal1 </runtime-module-dependency> - <runtime-module-dependency> vos </runtime-module-dependency> - - - - <type> com.sun.star.util.XCancellable </type> - <type> com.sun.star.util.XNumberFormatter </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.beans.XPropertyState </type> - <type> com.sun.star.beans.XPropertySet </type> - <type> com.sun.star.beans.PropertyValue </type> - <type> com.sun.star.beans.XMultiPropertySet </type> - <type> com.sun.star.beans.XFastPropertySet </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.EventObject </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.java.XJavaThreadRegister_11 </type> - <type> com.sun.star.java.XJavaVM </type> - <type> com.sun.star.sdbc.XConnection </type> - <type> com.sun.star.sdbc.XStatement </type> - <type> com.sun.star.sdbc.XResultSet </type> - <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type> - <type> com.sun.star.sdbc.XColumnLocate </type> - <type> com.sun.star.sdbc.XResultSetUpdate </type> - <type> com.sun.star.sdbc.XWarningsSupplier </type> - <type> com.sun.star.sdbc.XRowUpdate </type> - <type> com.sun.star.sdbc.XMultipleResults </type> - <type> com.sun.star.sdbc.XBatchExecution </type> - <type> com.sun.star.sdbc.XPreparedBatchExecution </type> - <type> com.sun.star.sdbc.XParameters </type> - <type> com.sun.star.sdbc.XOutParameters </type> - <type> com.sun.star.sdbc.DriverPropertyInfo </type> - <type> com.sun.star.sdbc.XRow </type> - <type> com.sun.star.sdb.XColumnUpdate </type> - <type> com.sun.star.sdb.XColumn </type> - <type> com.sun.star.sdbc.XResultSetUpdate </type> - <type> com.sun.star.sdbc.XRowUpdate </type> - <type> com.sun.star.sdbcx.XRowLocate </type> - <type> com.sun.star.sdbcx.XDeleteRows </type> - -</module-description> - - diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu deleted file mode 100644 index 30561e8476f3..000000000000 --- a/connectivity/source/drivers/mozab/mozab2.xcu +++ /dev/null @@ -1,114 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed"> - <node oor:name="sdbc:address:mozilla:" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">SeaMonkey Address Book</value> - </prop> - <node oor:name="MetaData"> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:thunderbird:" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Thunderbird Address Book</value> - </prop> - <node oor:name="MetaData"> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - <node oor:name="sdbc:address:ldap:*" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MozabDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">LDAP Address Book</value> - </prop> - <node oor:name="Properties"> - <node oor:name="BaseDN" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value></value> - </prop> - </node> - <node oor:name="MaxRowCount" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>100</value> - </prop> - </node> - <node oor:name="PortNumber" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>389</value> - </prop> - </node> - <node oor:name="UseSSL" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsTableCreation" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="Authentication" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value>UserPassword</value> - </prop> - </node> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/drivers/mozab/mozabdrv.map b/connectivity/source/drivers/mozab/mozabdrv.map deleted file mode 100644 index f247d1a2b5c5..000000000000 --- a/connectivity/source/drivers/mozab/mozabdrv.map +++ /dev/null @@ -1,28 +0,0 @@ -############################################################### -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -############################################################### -UDK_3_0_0 { - global: - OMozabConnection_CreateInstance; - OMozillaBootstrap_CreateInstance; - setMozabServiceFactory; - local: - *; -}; diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx deleted file mode 100644 index 0de7bc4defea..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx +++ /dev/null @@ -1,802 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -// Mozilla includes. -#include <MNSInclude.hxx> - -#include "resource/mozab_res.hrc" -#include "MDatabaseMetaDataHelper.hxx" -#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_ -#include "MTypeConverter.hxx" -#endif -#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX -#include "MConfigAccess.hxx" -#endif -#include <connectivity/dbexception.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/sequence.hxx> -#include <osl/mutex.hxx> -#include <osl/conditn.hxx> - -#include <nsIAbDirFactoryService.h> -#include <MNSInit.hxx> -#include <MNameMapper.hxx> -#include "MNSMozabProxy.hxx" -#include <MNSDeclares.hxx> - -static ::osl::Mutex m_aMetaMutex; - -#include <osl/diagnose.h> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/Property.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/sdb/ErrorCondition.hpp> -#include <unotools/processfactory.hxx> -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> - - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - - -static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kAbDirFactoryServiceCID, NS_ABDIRFACTORYSERVICE_CID); -static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID); - -using namespace connectivity::mozab; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace com::sun::star::mozilla; -using namespace com::sun::star::sdb; - -namespace connectivity -{ - namespace mozab - { - static const char * const s_pADDRESSBOOKROOTDIR = "moz-abdirectory://"; - } -} - -extern sal_Bool MNS_Init(sal_Bool& aProfileExists); - -// ------------------------------------------------------------------------- -MDatabaseMetaDataHelper::MDatabaseMetaDataHelper() - :m_bProfileExists(sal_False) -{ - OSL_TRACE( "IN MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" ); - - OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" ); - -} -// ------------------------------------------------------------------------- -MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper() -{ - m_aTableNames.clear(); - m_aTableTypes.clear(); - - if (m_bProfileExists) - { - Reference<XMozillaBootstrap> xMozillaBootstrap; - Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); - - Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY); - m_bProfileExists = xMozillaBootstrap->shutdownProfile() > 0; - } - - OSL_TRACE( "IN/OUT MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()\n" ); -} - -static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array); -//enum all sub folders -static nsresult enumSubs(nsIAbDirectory * parentDir,nsISupportsArray * array) -{ - nsresult rv = NS_OK ; - nsCOMPtr<nsISimpleEnumerator> subDirectories; - rv = parentDir->GetChildNodes(getter_AddRefs(subDirectories)); - if (NS_FAILED(rv)) { return rv; } - - rv = enumSubs(subDirectories,array); - return rv; -} - -#include <prmem.h> //need for PR_FREEIF -static nsresult insertPABDescription() -{ - nsresult rv = NS_OK ; - // mozilla loads the descriptions of pab and history from a file named addressbook.properties - // we never deliver it with OOo,so mozab does not auot load personal addressbook and Collected addresses - // If we want to deliver addressbook.properties with OOo,we have to deal with hole mozilla chrome mechanism. - // So I insert the descriptiones as user prefes,they will cover the default value. - - //"Personal Address Book" "Collected Addresses" are loaded from officecfg - nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - nsCAutoString pabPrefName(NS_LITERAL_CSTRING("ldap_2.servers.pab.description")); - - sal_Bool bSetted=sal_False; - char *value = nsnull; - if (0 == prefs->CopyCharPref(pabPrefName.get(), &value)) - { - if (!(value == nsnull || value[0] == 0)) - { - bSetted = sal_True; - } - } - PR_FREEIF (value); - value=nsnull; - if (bSetted == sal_True) - { - const char* pPabDescription = static_cast< const char* >( getPabDescription( ) ); - rv = prefs->SetCharPref (pabPrefName.get(), pPabDescription); - NS_ENSURE_SUCCESS(rv, rv); - } - - nsCAutoString hisPrefName(NS_LITERAL_CSTRING("ldap_2.servers.history.description")); - - bSetted=sal_False; - if (0 == prefs->CopyCharPref(hisPrefName.get(), &value)) - { - if (!(value == nsnull || value[0] == 0)) - { - bSetted = sal_True; - } - } - PR_FREEIF (value); - value=nsnull; - if (bSetted == sal_True) - { - const char* pHisDescription = static_cast< const char* >( getHisDescription( ) ); - - rv = prefs->SetCharPref (hisPrefName.get(), pHisDescription); - NS_ENSURE_SUCCESS(rv, rv); - } - return rv; -} -// -// nsAbDirectoryDataSource -// -#define NS_RDF_CONTRACTID "@mozilla.org/rdf" -#define NS_RDF_DATASOURCE_CONTRACTID NS_RDF_CONTRACTID "/datasource;1" -#define NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_RDF_DATASOURCE_CONTRACTID "?name=" -#define NS_ABDIRECTORYDATASOURCE_CONTRACTID \ - NS_RDF_DATASOURCE_CONTRACTID_PREFIX "addressdirectory" -#define database_uri "@mozilla.org/rdf/datasource;1?name=addressdirectory" -#define NS_ABDIRECTORYDATASOURCE_CID \ -{ /* 0A79186D-F754-11d2-A2DA-001083003D0C */ \ - 0xa79186d, 0xf754, 0x11d2, \ - {0xa2, 0xda, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \ -} - -// ------------------------------------------------------------------------- -// Case where we get a parent uri, and need to list its children. -static nsresult getSubsFromParent(const rtl::OString& aParent, nsIEnumerator **aSubs) -{ - - if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; } - *aSubs = nsnull ; - nsresult retCode = NS_OK ; - nsCOMPtr<nsISupportsArray> array ; - - NS_NewISupportsArray(getter_AddRefs(array)) ; - - retCode = insertPABDescription(); - NS_ENSURE_SUCCESS(retCode, retCode) ; - - nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsIRDFResource> rdfResource ; - - nsCOMPtr<nsIRDFDataSource> rdfDirectory ; - - rtl::OString dir("rdf:addressdirectory"); - retCode = rdfService->GetDataSource(dir.getStr(),getter_AddRefs(rdfDirectory)) ; - - - - OSL_TRACE("uri: %s\n", aParent.getStr()) ; - retCode = rdfService->GetResource(nsDependentCString(aParent.getStr(),aParent.getLength()), getter_AddRefs(rdfResource)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ; - nsCOMPtr<nsISimpleEnumerator> tempEnum ; - - NS_ENSURE_SUCCESS(retCode, retCode) ; - retCode = directory->GetChildNodes(getter_AddRefs(tempEnum)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - - PRBool hasMore = PR_TRUE ; - while (NS_SUCCEEDED(tempEnum->HasMoreElements(&hasMore)) && hasMore) { - nsCOMPtr<nsIAbDirectory> element ; - retCode = tempEnum->GetNext(getter_AddRefs(element)) ; - if (NS_SUCCEEDED(retCode)) - { - array->AppendElement(element) ; - enumSubs(element,array); - } - } - - array->Enumerate(aSubs) ; - return retCode ; -} - -static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array) -{ - PRBool hasMore = PR_TRUE ; - nsresult rv = NS_OK ; - while (NS_SUCCEEDED(subDirs->HasMoreElements(&hasMore)) && hasMore) { - nsCOMPtr<nsISupports> newDirSupports ; - - rv = subDirs->GetNext(getter_AddRefs(newDirSupports)) ; - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &rv) ; - NS_ENSURE_SUCCESS(rv, rv); - array->AppendElement(childDir); - - rv = enumSubs(childDir,array); - } - return rv; -} - -// Case where we get a factory uri and need to have it build the directories. -static nsresult getSubsFromFactory(const rtl::OString& aFactory, nsIEnumerator **aSubs) -{ - if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; } - *aSubs = nsnull ; - nsresult retCode = NS_OK ; - - nsCOMPtr<nsIAbDirFactoryService> dirFactoryService = do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &retCode); - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsIAbDirFactory> dirFactory ; - - retCode = dirFactoryService->GetDirFactory(aFactory.getStr(), getter_AddRefs(dirFactory)) ; - NS_ENSURE_SUCCESS (retCode, retCode) ; - nsCOMPtr <nsIAbDirectoryProperties> properties; - properties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &retCode); - NS_ENSURE_SUCCESS(retCode, retCode) ; - - retCode = properties->SetURI(aFactory.getStr()); - NS_ENSURE_SUCCESS(retCode,retCode); - - nsCOMPtr<nsISimpleEnumerator> subDirs ; - retCode = dirFactory->CreateDirectory(properties, getter_AddRefs(subDirs)); - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsISupportsArray> array ; - - NS_NewISupportsArray(getter_AddRefs(array)) ; - retCode = enumSubs(subDirs,array); - NS_ENSURE_SUCCESS(retCode, retCode) ; - array->Enumerate(aSubs) ; - return retCode ; -} - -// Case where the uri itself is the directory we're looking for. -static nsresult getSubsFromURI(const rtl::OString& aUri, nsIEnumerator **aSubs) -{ - if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; } - *aSubs = nsnull ; - nsresult retCode = NS_OK ; - - nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsIRDFResource> rdfResource ; - - retCode = rdfService->GetResource(nsDependentCString(aUri.getStr(),aUri.getLength()), getter_AddRefs(rdfResource)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - retCode = rdfService->UnregisterResource(rdfResource) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - - nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ; - - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsAutoString nameAB ; - - nameAB.AssignWithConversion("LDAP Directory") ; - directory->SetDirName(nameAB.get()) ; - nsCOMPtr<nsISupportsArray> array ; - - NS_NewISupportsArray(getter_AddRefs(array)) ; - array->AppendElement(directory) ; - array->Enumerate(aSubs) ; - return retCode ; -} - -namespace -{ - static void lcl_setNoAddressBookFoundError( ErrorDescriptor& _rError, OConnection& _rCon, MozillaProductType _eProductType, - sal_Bool bGivenURI ) - { - sal_uInt16 nAddressBookNameRes = 0; - if ( !bGivenURI && _eProductType == MozillaProductType_Mozilla) - { - nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS; - } - else - { - if ( _eProductType == MozillaProductType_Thunderbird ) - { - nAddressBookNameRes = STR_THUNDERBIRD_ADDRESSBOOKS; - } - else - { - if ( _rCon.usesFactory() ) - { - if ( _rCon.isOutlookExpress() ) - { - nAddressBookNameRes = STR_OE_ADDRESSBOOK; - } - else - { - nAddressBookNameRes = STR_OUTLOOK_MAPI_ADDRESSBOOK; - } - } - else - { - OSL_ENSURE( !_rCon.isLDAP(), "lcl_setNoAddressBookFoundError: not to be called for LDAP connections!" ); - nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS; - } - } - } - _rError.set( 0, ErrorCondition::AB_ADDRESSBOOK_NOT_FOUND, _rCon.getResources().getResourceString( nAddressBookNameRes ) ); - } -} - -nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap, - ::std::vector< ::rtl::OUString >* _rStrings, - ::std::vector< ::rtl::OUString >* _rTypes, - sal_Int32* pErrorId ) -{ - if (!sAbURI || !nmap || !_rStrings || !_rTypes || !pErrorId) - { - return NS_ERROR_NULL_POINTER; - } - OSL_TRACE("Using URI %s to getTables()\n",sAbURI ); - - // Get the mozilla addressbooks from the base directory. - nsresult rv = NS_OK; - nsCOMPtr<nsIEnumerator> subDirectories; - - switch(*nDirectoryType) - { - case SDBCAddress::Mozilla: - rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories)) ; - break; - case SDBCAddress::Outlook: - case SDBCAddress::OutlookExp: - rv = getSubsFromFactory(sAbURI, getter_AddRefs(subDirectories)) ; - break; - case SDBCAddress::LDAP: - rv = getSubsFromURI(sAbURI, getter_AddRefs(subDirectories)) ; - break; - default: - rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories)); - } - NS_ENSURE_SUCCESS(rv, rv); - - // At this point we have a list containing the nsIAbDirectory we need to map as tables - rv = subDirectories -> First(); - NS_ENSURE_SUCCESS(rv, rv); - - PRUnichar *name = nsnull; - PRBool bIsMailList = PR_FALSE; - - ::rtl::OUString aTableName; - nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ; - NS_ENSURE_SUCCESS(rv, rv) ; - - nmap->reset(); - do { - nsCOMPtr<nsIAbDirectory> subDirectory; - - nsCOMPtr<nsISupports> item; - rv = subDirectories -> CurrentItem(getter_AddRefs(item)); - if ( NS_FAILED( rv ) ) - { - *pErrorId = STR_COULD_NOT_RETRIEVE_AB_ENTRY; - return NS_ERROR_FAILURE; - } - - subDirectory = do_QueryInterface(item, &rv); - - subDirectory -> GetIsMailList(&bIsMailList); - // For now we're not interested in mailing lists. - rv = subDirectory -> GetDirName(&name); - if ( NS_FAILED( rv ) ) { - *pErrorId = STR_COULD_NOT_GET_DIRECTORY_NAME; - return NS_ERROR_FAILURE; - } - MTypeConverter::prUnicharToOUString(name, aTableName); - OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) ); - - ODatabaseMetaDataResultSet::ORow aRow(3); - - // Insert table into map - if ( aTableName.getLength() == 0 ) - aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook")); - - OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) ); - - rv = nmap->add( aTableName, subDirectory); - nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface(subDirectory, &rv) ; - if (!NS_FAILED(rv)) - rdfService->UnregisterResource(rdfResource); - - if (!NS_FAILED(rv)) //failed means we have added this directory - { - //map mailing lists as views - _rStrings->push_back( aTableName ); // Table name - if (!bIsMailList) { - ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE"))); - _rTypes->push_back( aTableType ); // Table type - } - else - { - ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW"))); - _rTypes->push_back( aTableType ); // Table type - } - } - rv = subDirectories -> Next(); - } while ( rv == NS_OK); - - return( NS_OK ); -} -sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, - ::std::vector< ::rtl::OUString >& _rStrings, - ::std::vector< ::rtl::OUString >& _rTypes) -{ - sal_Bool bGivenURI; - ::rtl::OUString sAbURI; - ::rtl::OString sAbURIString; - - OSL_TRACE( "IN MDatabaseMetaDataHelper::getTableStrings( 0x%08X, %s)\n", _pCon, _pCon->getForceLoadTables()?"True":"False" ); - - ::osl::MutexGuard aGuard( m_aMetaMutex ); - // Only do the query if we have to - performance degrades otherwise - if ( ! _pCon->getForceLoadTables() && m_aTableNames.size() > 0 ) { - _rStrings = m_aTableNames; - _rTypes = m_aTableTypes; - return( sal_True ); - } - - m_aTableNames.clear(); - m_aTableTypes.clear(); - - sAbURI = _pCon->getMozURI(); - - OSL_TRACE("AbURI = %s\n", OUtoCStr( sAbURI ) ); - if ( sAbURI.getLength() == 0 ) - bGivenURI = sal_False; - else { - sAbURIString = ::rtl::OUStringToOString( sAbURI, - RTL_TEXTENCODING_ASCII_US); - bGivenURI = sal_True; - } - - if ( bGivenURI ) - OSL_TRACE("Using URI %s to getTables()\n", sAbURIString.getStr() ); - else - OSL_TRACE("Using URI of ROOTDIR to getTables()\n"); - - // Get the mozilla addressbooks from the base directory. - nsresult rv = NS_OK; - nsCOMPtr<nsIEnumerator> subDirectories; - sal_Int32 nDirectoryType=0; - m_ProductType = MozillaProductType_Mozilla; - m_ProfileName = _pCon->getMozProfile(); - - - if (_pCon->isThunderbird()) - { - if (!bGivenURI) - sAbURIString = s_pADDRESSBOOKROOTDIR; - nDirectoryType = SDBCAddress::ThunderBird; - m_ProductType = MozillaProductType_Thunderbird; - } - else if (!bGivenURI) - { - sAbURIString = s_pADDRESSBOOKROOTDIR; - nDirectoryType = SDBCAddress::Mozilla; - } - else - { - if (_pCon->usesFactory()) - { - nDirectoryType = SDBCAddress::Outlook; - } - else - { - if (_pCon->isLDAP()) - { - nDirectoryType = SDBCAddress::LDAP; - } - else - { - sAbURIString = s_pADDRESSBOOKROOTDIR; - nDirectoryType = SDBCAddress::Mozilla; - } - } - } - - if ( !_pCon->isLDAP() && !m_bProfileExists ) - { // no need to boot up a Mozilla profile for an LDAP connection - Reference<XMozillaBootstrap> xMozillaBootstrap; - Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); - Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY); - m_bProfileExists = sal_False; - //If there are no profiles for this product - //Or the given profile name does not found - //We will reaise a "No Addressbook Directories Exist" error - if ( xMozillaBootstrap->getProfileCount(m_ProductType) == 0 || - ( m_ProfileName.getLength() && !(xMozillaBootstrap->getProfilePath(m_ProductType,m_ProfileName).getLength()))) - m_bProfileExists = sal_False; - else - if (xMozillaBootstrap->bootupProfile(m_ProductType,m_ProfileName) > 0) - m_bProfileExists = sal_True; - - } - if ( !m_bProfileExists - && !_pCon->isLDAP() - && ( ( nDirectoryType == SDBCAddress::Mozilla ) - || ( nDirectoryType == SDBCAddress::ThunderBird ) - ) - ) - { - lcl_setNoAddressBookFoundError( m_aError, *_pCon, m_ProductType, bGivenURI ); - return sal_False; - } - - MNameMapper *nmap = _pCon->getNameMapper(); - nmap->reset(); - - sal_Int32 nErrorResourceId( 0 ); - - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_GET_TABLE_STRINGS; - args.argCount = 6; - args.arg1 = (void*)sAbURIString.getStr(); - args.arg2 = (void*)&nDirectoryType; - args.arg3 = (void*)nmap; - args.arg4 = (void*)&m_aTableNames; - args.arg5 = (void*)&m_aTableTypes; - args.arg6 = (void*)&nErrorResourceId; - rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName); - m_aError.setResId( static_cast<sal_uInt16>(nErrorResourceId) ); - - if (NS_FAILED(rv)) - { - if ( nErrorResourceId == 0 ) - m_aError.setResId( STR_UNSPECIFIED_ERROR ); - return sal_False; - } - OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTableStrings()\n" ); - _rStrings = m_aTableNames; - _rTypes = m_aTableTypes; - - _pCon->setForceLoadTables(sal_False); - return( sal_True ); -} - -sal_Bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, - const ::rtl::OUString& tableNamePattern, - const Sequence< ::rtl::OUString >& types, - ODatabaseMetaDataResultSet::ORows& _rRows) -{ - - static ODatabaseMetaDataResultSet::ORows aRows; - - OSL_TRACE( "IN MDatabaseMetaDataHelper::getTables()\n" ); - ::osl::MutexGuard aGuard( m_aMetaMutex ); - - ODatabaseMetaDataResultSet::ORows().swap(aRows); // this makes real clear where memory is freed as well - aRows.clear(); - - ::std::vector< ::rtl::OUString > tables; - ::std::vector< ::rtl::OUString > tabletypes; - ::rtl::OUString matchAny = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));; - - if ( !getTableStrings( _pCon, tables,tabletypes ) ) - return sal_False; - - for ( size_t i = 0; i < tables.size(); i++ ) { - ODatabaseMetaDataResultSet::ORow aRow(3); - - ::rtl::OUString aTableName = tables[i]; - ::rtl::OUString aTableType = tabletypes[i]; - OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) ); - - - // return tables to caller - if (match( tableNamePattern, aTableName, '\0' ) && - ( 0 == types.getLength() || //types is null or types include aTableType or types include "%" - 0 != ::comphelper::findValue( types, aTableType, sal_True ).getLength() || - 0 != ::comphelper::findValue( types, matchAny, sal_True ).getLength())) { - if ( aTableName.getLength() == 0 ) { - aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook")); - } - - OSL_TRACE( "TableName = %s ; TableType = %s\n", OUtoCStr(aTableName), OUtoCStr(aTableType) ); - - aRow.push_back( new ORowSetValueDecorator( aTableName ) ); // Table name - aRow.push_back( new ORowSetValueDecorator( aTableType ) ); // Table type - aRow.push_back( ODatabaseMetaDataResultSet::getEmptyValue() ); // Remarks - aRows.push_back(aRow); - } - } - - OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTables()\n" ); - _rRows = aRows; - return(sal_True); -} - - -sal_Bool -MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon ) -{ - const sal_Unicode QUERY_CHAR = '?'; - const sal_Char* MOZ_SCHEMA = "moz-abldapdirectory://"; - const sal_Char* LDAP_SCHEMA = "ldap://"; - - rtl::OString sAbURI; - rtl::OUString sAbBindDN; - rtl::OUString sAbPassword; - sal_Bool useSSL = _pCon->getUseSSL(); - - nsresult rv(0); - - sAbURI = OUStringToOString( _pCon->getMozURI(), RTL_TEXTENCODING_ASCII_US ); - sAbBindDN = _pCon->getBindDN(); - sAbPassword = _pCon->getPassword(); - - - sal_Int32 pos = sAbURI.indexOf( MOZ_SCHEMA ); - if ( pos != -1 ) { - sAbURI = sAbURI.replaceAt (pos, rtl_str_getLength( MOZ_SCHEMA ), ::rtl::OString(LDAP_SCHEMA) ); - } - - pos = sAbURI.indexOf( QUERY_CHAR ); - if ( pos != -1 ) { - sal_Int32 len = sAbURI.getLength(); - sAbURI = sAbURI.replaceAt( pos, len - pos, ::rtl::OString("") ); - } - const sal_Unicode* bindDN=nsnull; - if (sAbBindDN.getLength() != 0) - { - bindDN = sAbBindDN.getStr(); - } - - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP; - args.argCount = 4; - args.arg1 = (void*)sAbURI.getStr(); - args.arg2 = (void*)bindDN; - args.arg3 = (void*)sAbPassword.getStr(); - args.arg4 = (void*)&useSSL; - - MNSMozabProxy xMProxy; - rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() ); - if ( NS_SUCCEEDED( rv ) ) //Init LDAP,pass OUString() to StarProxy to ignore profile switch - { - args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED; - TimeValue timeValue = { 1, 0 }; // 1 * 30 Seconds timeout - sal_Int32 times=0; - while ( times++ < 30 ) - { - rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() ); - if ( NS_SUCCEEDED( rv ) ) - // connected successfully - break; - - if ( rv == (nsresult)PR_NOT_CONNECTED_ERROR ) - // connection failed - break; - - // not yet decided - continue waiting - osl_waitThread( &timeValue ); - } - } - m_aError.setResId( STR_COULD_NOT_CONNECT_LDAP ); - return NS_SUCCEEDED( rv ) ? sal_True : sal_False; -} - -sal_Bool MDatabaseMetaDataHelper::NewAddressBook(OConnection* _pCon,const ::rtl::OUString & aTableName) -{ - sal_Bool bIsMozillaAB; - - bIsMozillaAB = !_pCon->usesFactory() && ! _pCon->isLDAP(); - - if ( !bIsMozillaAB ) - { - m_aError.setResId( STR_NO_TABLE_CREATION_SUPPORT ); - return sal_False; - } - else - OSL_TRACE("Create table\n"); - - // Get the mozilla addressbooks from the base directory. - nsresult rv = NS_OK; - - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_NEW_ADDRESS_BOOK; - args.argCount = 1; - args.arg1 = (void*)&aTableName; - rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName); - - _pCon->setForceLoadTables(sal_True); //force reload table next time - if (rv == NS_ERROR_FILE_IS_LOCKED) - { - m_aError.setResId( STR_MOZILLA_IS_RUNNING ); - } - else if (NS_FAILED(rv)) - { - m_aError.set( STR_COULD_NOT_CREATE_ADDRESSBOOK, 0, ::rtl::OUString::valueOf( sal_Int32(rv), 16 ) ); - } - OSL_TRACE( "OUT MDatabaseMetaDataHelper::NewAddressBook()\n" ); - return( NS_SUCCEEDED(rv) ? sal_True : sal_False ); -} -nsresult NewAddressBook(const ::rtl::OUString * aName) -{ - if (isProfileLocked(NULL)) - return NS_ERROR_FILE_IS_LOCKED; - nsresult rv; - nsCOMPtr<nsIAbDirectoryProperties> aProperties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &rv); - NS_ENSURE_ARG_POINTER(aProperties); - const ::rtl::OUString& uName = *aName; - nsString nsName; - MTypeConverter::ouStringToNsString(uName,nsName); - aProperties->SetDescription(nsName); - - nsCOMPtr<nsIRDFService> rdfService = do_GetService (kRDFServiceCID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr<nsIRDFResource> parentResource; - rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot), getter_AddRefs(parentResource)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr<nsIAbDirectory> parentDir = do_QueryInterface(parentResource, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - rv = parentDir->CreateNewDirectory(aProperties); - return rv; -} diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx deleted file mode 100644 index 19f91c28ed85..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_ -#define _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_ - -#include "MErrorResource.hxx" -#include <comphelper/proparrhlp.hxx> -#include <comphelper/propertycontainer.hxx> -#include "FDatabaseMetaDataResultSet.hxx" - -#ifndef _CONNECTIVITY_MAB_CONNECTION_HXX_ -#include <MConnection.hxx> -#endif -#include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_ -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#endif - -namespace connectivity -{ - namespace mozab - { - class MDatabaseMetaDataHelper - { - private: - sal_Bool m_bProfileExists ; - ::std::vector< ::rtl::OUString > m_aTableNames; - ::std::vector< ::rtl::OUString > m_aTableTypes; - ::com::sun::star::mozilla::MozillaProductType m_ProductType; - ::rtl::OUString m_ProfileName; - ErrorDescriptor m_aError; - - public: - MDatabaseMetaDataHelper(); - ~MDatabaseMetaDataHelper(); - - // - sal_Bool getTableStrings( OConnection* _pCon, - ::std::vector< ::rtl::OUString >& _rStrings, - ::std::vector< ::rtl::OUString >& _rTypes); - - sal_Bool getTables( OConnection* _pCon, - const ::rtl::OUString& tableNamePattern, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types, - ODatabaseMetaDataResultSet::ORows& _rRows); - sal_Bool testLDAPConnection( OConnection* _pCon ); - sal_Bool NewAddressBook( OConnection* _pCon,const ::rtl::OUString & aTableName); - - inline const ErrorDescriptor& getError() const { return m_aError; } - }; - } - -} -#endif // _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_ - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx deleted file mode 100644 index 2c3f63960dfa..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX -#define CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX - -#include <rtl/ustring.hxx> - -namespace connectivity -{ - namespace mozab - { - class ErrorDescriptor - { - private: - sal_uInt16 m_nErrorResourceId; - sal_Int32 m_nErrorCondition; - ::rtl::OUString m_sParameter; - - public: - ErrorDescriptor() - :m_nErrorResourceId(0) - ,m_nErrorCondition(0) - ,m_sParameter() - { - } - - inline void set( const sal_uInt16 _nErrorResourceId, const sal_Int32 _nErrorCondition, const ::rtl::OUString& _rParam ) - { - m_nErrorResourceId = _nErrorResourceId; - m_nErrorCondition = _nErrorCondition; - m_sParameter = _rParam; - } - inline void setResId( const sal_uInt16 _nErrorResourceId ) - { - m_nErrorResourceId = _nErrorResourceId; - } - inline void reset() - { - m_nErrorResourceId = 0; - m_nErrorCondition = 0; - } - - inline sal_uInt16 getResId() const { return m_nErrorResourceId; } - inline sal_Int32 getErrorCondition() const { return m_nErrorCondition; } - inline const ::rtl::OUString& getParameter() const { return m_sParameter; } - - inline bool is() const { return ( m_nErrorResourceId != 0 ) || ( m_nErrorCondition != 0 ); } - }; - } -} - -#endif // CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx deleted file mode 100644 index 2e51fa235d15..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx +++ /dev/null @@ -1,447 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <rtl/strbuf.hxx> - // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the - // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l" - // hiding objects "in an outer scope". - -#include "MLdapAttributeMap.hxx" -#include "MTypeConverter.hxx" -#include "MQueryHelper.hxx" - -#include <tools/diagnose_ex.h> - -#include <hash_map> - -//........................................................................ -namespace connectivity { namespace mozab { -//........................................................................ - - //==================================================================== - //= helper - //==================================================================== - namespace - { - typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName ); - typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName ); - struct CardPropertyData - { - const sal_Char* pLDAPAttributeList; - CardPropertyGetter PropGetter; - CardPropertySetter PropSetter; - - CardPropertyData() - :pLDAPAttributeList( NULL ) - ,PropGetter( NULL ) - ,PropSetter( NULL ) - { - } - CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter ) - :pLDAPAttributeList( _pLDAPAttributeList ) - ,PropGetter( _PropGetter ) - ,PropSetter( _PropSetter ) - { - } - }; - - typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes; - - #define DEF_CARD_ACCESS( PropertyName ) \ - &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName - - static const MapPropertiesToAttributes& lcl_getPropertyMap() - { - static MapPropertiesToAttributes aMap; - if ( aMap.empty() ) - { - struct MapEntry - { - const sal_Char* pAsciiPropertyName; - const sal_Char* pAsciiAttrributeList; - CardPropertyGetter PropGetter; - CardPropertySetter PropSetter; - }; - const MapEntry aEntries[] = { - { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) }, - { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) }, - { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) }, - { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) }, - { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) }, - { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) }, - { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) }, - { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) }, - { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) }, - { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) }, - { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) }, - { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) }, - { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) }, - { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) }, - { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) }, - { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) }, - { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) }, - { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) }, - { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) }, - { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) }, - { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) }, - { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) }, - { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) }, - { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) }, - { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) }, - { "Company", "o,company", DEF_CARD_ACCESS( Company ) }, - { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) }, - { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) }, - { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) }, - { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) }, - { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) }, - { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) }, - { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) }, - { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) }, - { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) }, - { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) }, - { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL }, - { NULL, NULL, NULL, NULL } - }; - const MapEntry* loop = aEntries; - while ( loop->pAsciiPropertyName ) - { - aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] = - CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter ); - ++loop; - } - } - return aMap; - } - } - - //==================================================================== - //= AttributeMap_Data - //==================================================================== - struct AttributeMap_Data - { - }; - - //==================================================================== - //= MLdapAttributeMap - //==================================================================== - // ------------------------------------------------------------------- - MLdapAttributeMap::MLdapAttributeMap() - :m_pData( new AttributeMap_Data ) - { - } - - // ------------------------------------------------------------------- - MLdapAttributeMap::~MLdapAttributeMap() - { - } - - // ------------------------------------------------------------------- - NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap ) - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval) - { - ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) ); - - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty ); - - if ( pos == rPropertyMap.end() ) - { - _retval.SetIsVoid( PR_TRUE ); - } - else - { - MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval ); - } - - return NS_OK; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs) - { - OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" ); - (void)aProperty; - (void)aCount; - (void)aAttrs; - return NS_ERROR_NOT_IMPLEMENTED; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval) - { - ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) ); - - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty ); - - if ( pos == rPropertyMap.end() ) - { - _retval.SetIsVoid( PR_TRUE ); - } - else - { - sal_Int32 tokenPos(0); - ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList ); - MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval ); - } - - return NS_OK; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies) - { - OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" ); - (void)aProperty; - (void)aAttributeList; - (void)allowInconsistencies; - return NS_ERROR_NOT_IMPLEMENTED; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval) - { - OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" ); - (void)aAttribute; - (void)_retval; - return NS_ERROR_NOT_IMPLEMENTED; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval) - { - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - - ::rtl::OStringBuffer aAllAttributes; - for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin(); - loop != rPropertyMap.end(); - ++loop - ) - { - aAllAttributes.append( loop->second.pLDAPAttributeList ); - if ( loop != rPropertyMap.end() ) - aAllAttributes.append( ',' ); - } - - MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval ); - return NS_OK; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::CheckState(void) - { - // we do not allow modifying the map, so we're always in a valid state - return NS_OK; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName) - { - OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" ); - (void)aPrefBranchName; - return NS_ERROR_NOT_IMPLEMENTED; - } - - // ------------------------------------------------------------------- - NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard) - { - NS_ENSURE_ARG_POINTER( aMessage ); - NS_ENSURE_ARG_POINTER( aCard ); - - // in case that's not present in the LDAP message: set the "preferred mail format" to "none" - aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown ); - - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin(); - prop != rPropertyMap.end(); - ++prop - ) - { - // split the list of attributes for the current property - ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList ); - ::rtl::OString sAttribute; - - sal_Int32 tokenPos = 0; - while ( tokenPos != -1 ) - { - sAttribute = sAttributeList.getToken( 0, ',', tokenPos ); - - // retrieve the values for the current attribute - PRUint32 valueCount = 0; - PRUnichar** values = NULL; - nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values ); - if ( NS_FAILED( rv ) ) - // try the next attribute - continue; - - if ( valueCount ) - { - CardPropertySetter propSetter = prop->second.PropSetter; - OSL_ENSURE( propSetter, - "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: " - "unexpected: could retrieve an attribute value, but have no setter for it!" ); - if ( propSetter ) - { - (aCard->*propSetter)( values[0] ); - } - - // we're done with this property - no need to handle the remaining attributes which - // map to it - break; - } - } - } - return NS_OK; - } - - // ------------------------------------------------------------------- - namespace - { - struct PreferMailFormatType - { - const sal_Char* description; - PRUint32 formatType; - - PreferMailFormatType() - :description( NULL ) - ,formatType( nsIAbPreferMailFormat::unknown ) - { - } - - PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType ) - :description( _description ) - ,formatType( _formatType ) - { - } - }; - - static const PreferMailFormatType* lcl_getMailFormatTypes() - { - static const PreferMailFormatType aMailFormatTypes[] = - { - PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ), - PreferMailFormatType( "text/html", nsIAbPreferMailFormat::html ), - PreferMailFormatType( "unknown", nsIAbPreferMailFormat::unknown ), - PreferMailFormatType() - }; - return aMailFormatTypes; - } - } - - // ------------------------------------------------------------------- - void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result ) - { - _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown ); - - ::rtl::OUString resultValue; - - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin(); - prop != rPropertyMap.end(); - ++prop - ) - { - resultValue = _result.getValue( prop->first ); - - CardPropertySetter propSetter = prop->second.PropSetter; - if ( propSetter ) - { - // PRUnichar != sal_Unicode in mingw - (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) ); - } - else - { - if ( prop->first.equals( "PreferMailFormat" ) ) - { - unsigned int format = nsIAbPreferMailFormat::unknown; - const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes(); - while ( pMailFormatType->description ) - { - if ( resultValue.equalsAscii( pMailFormatType->description ) ) - { - format = pMailFormatType->formatType; - break; - } - ++pMailFormatType; - } - _card.SetPreferMailFormat(format); - } - else - OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" ); - } - } - } - - // ------------------------------------------------------------------- - void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card ) - { - nsXPIDLString value; - ::rtl::OUString resultValue; - - const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() ); - for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin(); - prop != rPropertyMap.end(); - ++prop - ) - { - CardPropertyGetter propGetter = prop->second.PropGetter; - if ( propGetter ) - { - (_card.*propGetter)( getter_Copies( value ) ); - - nsAutoString temp( value ); - MTypeConverter::nsStringToOUString( temp, resultValue ); - } - else - { - if ( prop->first.equals( "PreferMailFormat" ) ) - { - unsigned int format = nsIAbPreferMailFormat::unknown; - _card.GetPreferMailFormat( &format ); - const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes(); - while ( pMailFormatType->description ) - { - if ( format == pMailFormatType->formatType ) - { - resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description ); - break; - } - ++pMailFormatType; - } - } - else - OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" ); - } - - _result.insert( prop->first, resultValue ); - } - } - -//........................................................................ -} } // namespace connectivity::mozab -//........................................................................ diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx deleted file mode 100644 index a6acb2556856..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX -#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX - -#include <MNSInclude.hxx> - -#include <memory> - -//........................................................................ -namespace connectivity { namespace mozab { -//........................................................................ - - struct AttributeMap_Data; - class MQueryHelperResultEntry; - - //==================================================================== - //= class MLdapAttributeMap - //==================================================================== - /** implements the nsIAbLDAPAttributeMap interface - - Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book - implementation was changed to take the attribute mapping (from LDAP attributes - to address book properties) not directly from the preferences. Instead, this mapping - is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap - interface). - - */ - class MLdapAttributeMap : public nsIAbLDAPAttributeMap - { - public: - MLdapAttributeMap(); - - NS_DECL_ISUPPORTS - NS_DECL_NSIABLDAPATTRIBUTEMAP - - static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result ); - static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card ); - - protected: - virtual ~MLdapAttributeMap(); - - private: - ::std::auto_ptr< AttributeMap_Data > m_pData; - }; - -//........................................................................ -} } // namespace connectivity::mozab -//........................................................................ - -#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx deleted file mode 100644 index fe482e05336e..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_NS_DECLARES_HXX_ -#define _CONNECTIVITY_MAB_NS_DECLARES_HXX_ - -#include <sal/types.h> - - -const sal_Int32 RowStates_Normal = 0; -const sal_Int32 RowStates_Inserted = 1; -const sal_Int32 RowStates_Updated = 2; -const sal_Int32 RowStates_Deleted = 4; -const sal_Int32 RowStates_Error = 32; - -namespace connectivity{ - namespace mozab{ - class OConnection; - } -} -sal_Bool isProfileLocked(connectivity::mozab::OConnection* _pCon); - -class nsIAbDirectory; -sal_Int32 getDirectoryType(const nsIAbDirectory* directory); - - -#endif // _CONNECTIVITY_MAB_NS_DECLARES_HXX_ 1 - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx deleted file mode 100644 index 7097e2bb0d8c..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ -#define _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ 1 - -// -// Only include Mozilla include files once and using this file... -// - -// moved this here and in first position due to "long l;" unxsoli4 warning -#include <rtl/ustrbuf.hxx> - -#include "pre_include_mozilla.h" -#if defined __GNUC__ - #pragma GCC system_header -#endif - -#include <nsDebug.h> - -#include <nsCOMPtr.h> -#include <nsISupportsArray.h> -#include <nsString.h> - -#if defined __SUNPRO_CC -#pragma disable_warn - // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again -#endif -#include <nsMemory.h> -#include <prtypes.h> -#include <nsRDFCID.h> -#include <nsXPIDLString.h> -#include <nsIRDFService.h> -#include <nsIRDFResource.h> -#include <nsReadableUtils.h> -#include <msgCore.h> -#include <nsIServiceManager.h> -#include <nsIAbCard.h> -#include <nsAbBaseCID.h> -#include <nsAbAddressCollecter.h> -#include <nsIPref.h> -#include <nsIAddrBookSession.h> -#include <nsIMsgHeaderParser.h> -#include <nsIAddrBookSession.h> -#include <nsIAbDirectory.h> -#include <nsAbDirectoryQuery.h> -#include <nsIAbDirectoryQuery.h> -#include <nsIAbDirectoryQueryProxy.h> -#include <nsIAbDirFactory.h> -#include <nsIRunnable.h> -#include <nsIAbLDAPAttributeMap.h> -#include <nsILDAPMessage.h> - -#include <prerr.h> - -#include "post_include_mozilla.h" - -#endif // _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx deleted file mode 100644 index 600406f92e3e..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx +++ /dev/null @@ -1,400 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "MNSMozabProxy.hxx" - -#include "resource/mozab_res.hrc" -#include "MDatabaseMetaDataHelper.hxx" -#include "MQuery.hxx" -#include <osl/mutex.hxx> -#include <osl/conditn.hxx> - -#include "pre_include_mozilla.h" -#include <nsIProxyObjectManager.h> -// More Mozilla includes for LDAP Connection Test -#include "prprf.h" -#include "nsILDAPURL.h" -#include "nsILDAPMessage.h" -#include "nsILDAPMessageListener.h" -#include "nsILDAPErrors.h" -#include "nsILDAPConnection.h" -#include "nsILDAPOperation.h" -#include "post_include_mozilla.h" -#include "MQuery.hxx" -#include <MQueryHelper.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <unotools/processfactory.hxx> -#include "com/sun/star/mozilla/XProxyRunner.hpp" - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::mozilla; - - -#define TYPEASSERT(value,type) if (value != type) return !NS_OK; - -using namespace connectivity::mozab; - -/* Implementation file */ - -static ::osl::Mutex m_aThreadMutex; -extern nsresult NewAddressBook(const ::rtl::OUString * aName); - - -MNSMozabProxy::MNSMozabProxy() -{ - m_Args = NULL; -#if OSL_DEBUG_LEVEL > 0 - m_oThreadID = osl_getThreadIdentifier(NULL); -#endif - acquire(); -} - -MNSMozabProxy::~MNSMozabProxy() -{ -} - -sal_Int32 MNSMozabProxy::StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile) -{ - OSL_TRACE( "IN : MNSMozabProxy::StartProxy() \n" ); - ::osl::MutexGuard aGuard(m_aThreadMutex); - m_Product = aProduct; - m_Profile = aProfile; - m_Args = args; - if (!xRunner.is()) - { - Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); - ::com::sun::star::uno::Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - xRunner = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner >(xInstance,UNO_QUERY); - } - const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy > aCode(this); - return xRunner->Run(aCode); -} - -extern nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap, - ::std::vector< ::rtl::OUString >* _rStrings, - ::std::vector< ::rtl::OUString >* _rTypes, - sal_Int32* pErrorId ); - -::com::sun::star::mozilla::MozillaProductType SAL_CALL MNSMozabProxy::getProductType( ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_Product; -} -::rtl::OUString SAL_CALL MNSMozabProxy::getProfileName( ) throw (::com::sun::star::uno::RuntimeException) -{ - return m_Profile; -} - -sal_Int32 SAL_CALL MNSMozabProxy::run( ) throw (::com::sun::star::uno::RuntimeException) -{ -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE( "IN : MNSMozabProxy::Run() Caller thread :%4d \n" , m_oThreadID ); -#else - OSL_TRACE( "IN : MNSMozabProxy::Run() \n" ); -#endif - nsresult rv = NS_ERROR_INVALID_ARG; - if (m_Args == NULL) - return NS_ERROR_INVALID_ARG; - switch(m_Args->funcIndex) - { - case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP: - case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED: - case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE: - rv = testLDAPConnection(); - break; - case ProxiedFunc::FUNC_GET_TABLE_STRINGS: - rv = getTableStringsProxied((const sal_Char*)m_Args->arg1, - (sal_Int32 *)m_Args->arg2, - (MNameMapper *)m_Args->arg3, - (::std::vector< ::rtl::OUString >*)m_Args->arg4, - (::std::vector< ::rtl::OUString >*)m_Args->arg5, - (sal_Int32 *)m_Args->arg6); - break; - case ProxiedFunc::FUNC_EXECUTE_QUERY: - if (m_Args->arg1 && m_Args->arg2) - { - rv = ((MQuery*)m_Args->arg1)->executeQueryProxied((OConnection*)m_Args->arg2); - } - break; - case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD: - case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD: - case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD: - case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD: - if (m_Args->arg1) - { - rv = QueryHelperStub(); - } - break; - case ProxiedFunc::FUNC_NEW_ADDRESS_BOOK: - if (m_Args->arg1) - { - rv = NewAddressBook((const ::rtl::OUString*)m_Args->arg1 ); - } - break; - default: - return NS_ERROR_INVALID_ARG; - } - return rv; -} - -nsresult MNSMozabProxy::QueryHelperStub() -{ - nsresult rv = NS_ERROR_INVALID_ARG; - MQueryHelper * mHelper=(MQueryHelper*) m_Args->arg1; - switch(m_Args->funcIndex) - { - case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD: - if (m_Args->arg2 ) //m_Args->arg2 used to return cord number - { - *((sal_Int32*)m_Args->arg2) = mHelper->createNewCard(); - rv = NS_OK; - } - break; - case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD: - if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number - { - rv = mHelper->deleteCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3); - } - break; - case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD: - if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number - { - rv = mHelper->commitCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3); - } - break; - case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD: - if (m_Args->arg2) //m_Args->arg2 used to get the cord number - { - rv = mHelper->resyncRow(*((sal_Int32*)m_Args->arg2)); - } - break; - default: - break; - } - return rv; -} -//------------------------------------------------------------------- - -#define NS_LDAPCONNECTION_CONTRACTID "@mozilla.org/network/ldap-connection;1" -#define NS_LDAPOPERATION_CONTRACTID "@mozilla.org/network/ldap-operation;1" -#define NS_LDAPMESSAGE_CONTRACTID "@mozilla.org/network/ldap-message;1" -#define NS_LDAPURL_CONTRACTID "@mozilla.org/network/ldap-url;1" - -namespace connectivity { - namespace mozab { - class MLDAPMessageListener : public nsILDAPMessageListener - { - NS_DECL_ISUPPORTS - NS_DECL_NSILDAPMESSAGELISTENER - - MLDAPMessageListener(); - virtual ~MLDAPMessageListener(); - - sal_Bool initialized() const; - sal_Bool goodConnection() const { return initialized() && m_GoodConnection; } - - protected: - - ::osl::Mutex m_aMutex; - ::osl::Condition m_aCondition; - - sal_Bool m_IsComplete; - sal_Bool m_GoodConnection; - - void setConnectionStatus( sal_Bool _good ); - }; - } -} - -NS_IMPL_THREADSAFE_ISUPPORTS1(MLDAPMessageListener, nsILDAPMessageListener) - -MLDAPMessageListener::MLDAPMessageListener() - : mRefCnt( 0 ) - , m_IsComplete( sal_False ) - , m_GoodConnection( sal_False ) -{ - m_aCondition.reset(); -} - -MLDAPMessageListener::~MLDAPMessageListener() -{ -} - -sal_Bool MLDAPMessageListener::initialized() const -{ - return const_cast< MLDAPMessageListener* >( this )->m_aCondition.check(); -} - -void MLDAPMessageListener::setConnectionStatus( sal_Bool _good ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_IsComplete = sal_True; - m_GoodConnection = _good; - - m_aCondition.set(); -} - -NS_IMETHODIMP MLDAPMessageListener::OnLDAPInit(nsILDAPConnection* /*aConn*/, nsresult aStatus ) -{ - setConnectionStatus( NS_SUCCEEDED( aStatus ) ? sal_True : sal_False ); - return aStatus; -} - -NS_IMETHODIMP MLDAPMessageListener::OnLDAPMessage( nsILDAPMessage* aMessage ) -{ - nsresult rv; - - PRInt32 messageType; - rv = aMessage->GetType(&messageType); - NS_ENSURE_SUCCESS(rv, rv); - PRInt32 errCode; - switch (messageType) - { - case nsILDAPMessage::RES_BIND: - rv = aMessage->GetErrorCode(&errCode); - // if the login failed - if (errCode != (PRInt32)nsILDAPErrors::SUCCESS) { - setConnectionStatus( sal_False ); - } - else - setConnectionStatus( sal_True ); - break; - case nsILDAPMessage::RES_SEARCH_RESULT: - setConnectionStatus( sal_True ); - break; - default: - break; - } - - return NS_OK; -} - -//------------------------------------------------------------------- - -nsresult -MNSMozabProxy::testLDAPConnection( ) -{ - nsresult rv=NS_ERROR_INVALID_ARG; - switch(m_Args->funcIndex) - { - case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP: - if (m_Args->arg1 && m_Args->arg4 ) - { - rv = InitLDAP((sal_Char*)m_Args->arg1,(sal_Unicode*)m_Args->arg2,(sal_Unicode*)m_Args->arg3,(sal_Bool*)m_Args->arg4); - } - break; - case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED: - if (m_Args->arg5) - { - const MLDAPMessageListener* pListener( static_cast< const MLDAPMessageListener* >( m_Args->arg5 ) ); - if ( pListener->initialized() ) - rv = pListener->goodConnection() ? 0 : (nsresult)PR_NOT_CONNECTED_ERROR; - else - rv = (nsresult)PR_CONNECT_TIMEOUT_ERROR; - } - break; - case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE: - if (m_Args->arg5) - { - ((MLDAPMessageListener*)m_Args->arg5)->Release(); - delete (MLDAPMessageListener*)m_Args->arg5; - m_Args->arg5 = NULL; - rv = 0; - } - break; - default: - return NS_ERROR_INVALID_ARG; - } - return rv; -} -nsresult -MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPasswd,sal_Bool * nUseSSL) -{ - sal_Bool useSSL = *nUseSSL; - nsresult rv; - - nsCOMPtr<nsILDAPURL> url; - url = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv); - if ( NS_FAILED(rv) ) - return NS_ERROR_INVALID_ARG; - - rv = url->SetSpec( nsDependentCString(sUri) ); - NS_ENSURE_SUCCESS(rv, rv); - - nsCAutoString host; - rv = url->GetAsciiHost(host); - NS_ENSURE_SUCCESS(rv, rv); - - PRInt32 port; - rv = url->GetPort(&port); - NS_ENSURE_SUCCESS(rv, rv); - - nsCString dn; - rv = url->GetDn(dn); - NS_ENSURE_SUCCESS(rv, rv); - - - - // Get the ldap connection - nsCOMPtr<nsILDAPConnection> ldapConnection; - ldapConnection = do_CreateInstance(NS_LDAPCONNECTION_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - MLDAPMessageListener* messageListener = - new MLDAPMessageListener ( ); - if (messageListener == NULL) - return NS_ERROR_INVALID_ARG; - - messageListener->AddRef(); - - nsCAutoString nsBind; - // PRUnichar != sal_Unicode in mingw - nsBind.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(sBindDN)); - - // Now lets initialize the LDAP connection properly. - rv = ldapConnection->Init(host.get(), port, useSSL, nsBind, - messageListener,NULL,nsILDAPConnection::VERSION3); - // Initiate the LDAP operation - nsCOMPtr<nsILDAPOperation> ldapOperation = - do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv); - - rv = ldapOperation->Init(ldapConnection, messageListener, nsnull); - if (NS_FAILED(rv)) - return NS_ERROR_UNEXPECTED; // this should never happen - - if ( pPasswd && *pPasswd ) - { - nsCAutoString nsPassword; - // PRUnichar != sal_Unicode in mingw - nsPassword.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(pPasswd)); - rv = ldapOperation->SimpleBind(nsPassword); - } - - if (NS_SUCCEEDED(rv)) - m_Args->arg5 = messageListener; - return rv; -} diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx deleted file mode 100644 index aacab604f2b0..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_MOZABHELPER_HXX_ -#define _CONNECTIVITY_MAB_MOZABHELPER_HXX_ -#include "MNSDeclares.hxx" -#include <osl/thread.hxx> - -#include <MNSInclude.hxx> -#ifndef _CPPUHELPER_COMPBASE2_HXX_ -#include <cppuhelper/compbase1.hxx> -#endif -#ifndef _COM_SUN_STAR_MOZILLA_XCODEPROXY_HDL_ -#include <com/sun/star/mozilla/XCodeProxy.hpp> -#endif -#ifndef _COM_SUN_STAR_MOZILLA_XPROXYRUNNER_HDL_ -#include "com/sun/star/mozilla/XProxyRunner.hdl" -#endif - -namespace connectivity -{ - namespace mozab - { - namespace ProxiedFunc - { - enum - { - FUNC_TESTLDAP_INIT_LDAP=1, - FUNC_TESTLDAP_IS_LDAP_CONNECTED, - FUNC_TESTLDAP_RELEASE_RESOURCE, - FUNC_GET_TABLE_STRINGS, - FUNC_EXECUTE_QUERY, - FUNC_QUERYHELPER_CREATE_NEW_CARD, - FUNC_QUERYHELPER_DELETE_CARD, - FUNC_QUERYHELPER_COMMIT_CARD, - FUNC_QUERYHELPER_RESYNC_CARD, - FUNC_NEW_ADDRESS_BOOK - }; - } - - struct RunArgs - { - sal_Int32 funcIndex; //Function Index - sal_Int32 argCount; //parameter count - void * arg1; - void * arg2; - void * arg3; - void * arg4; - void * arg5; - void * arg6; - RunArgs() - { - arg1 = NULL; - arg2 = NULL; - arg3 = NULL; - arg4 = NULL; - arg5 = NULL; - arg6 = NULL; - } - }; - typedef RunArgs RunArgs; - typedef ::cppu::WeakImplHelper1< ::com::sun::star::mozilla::XCodeProxy > MNSMozabProxy_BASE; - - - class MNSMozabProxy : public MNSMozabProxy_BASE - { - public: - MNSMozabProxy(); - virtual ~MNSMozabProxy(); - - //XCodeProxy - virtual sal_Int32 SAL_CALL run( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getProductType( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getProfileName( ) throw (::com::sun::star::uno::RuntimeException); - - public: - sal_Int32 StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile); //Call this to start proxy - - protected: - nsresult testLDAPConnection(); - nsresult InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* sPasswd,sal_Bool * nUseSSL); - nsresult QueryHelperStub(); - private: - ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner > xRunner; - - RunArgs * m_Args; - ::com::sun::star::mozilla::MozillaProductType m_Product; - ::rtl::OUString m_Profile; -#if OSL_DEBUG_LEVEL > 0 - oslThreadIdentifier m_oThreadID; -#endif - }; - } -} -#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_ diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx deleted file mode 100644 index d8266799a702..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <MNSTerminateListener.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/frame/XDesktop.hpp> -#include <MNSInit.hxx> - - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::frame; -::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> MNSTerminateListener::mxTerminateListener = new MNSTerminateListener(); - -// ----------------------------------------- -// - MNSTerminateListener - -// ----------------------------------------- - -MNSTerminateListener::MNSTerminateListener( ) -{ -} - -// ----------------------------------------------------------------------------- - -MNSTerminateListener::~MNSTerminateListener() -{ -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL MNSTerminateListener::disposing( const EventObject& /*Source*/ ) throw( RuntimeException ) -{ -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL MNSTerminateListener::queryTermination( const EventObject& /*aEvent*/ ) throw( TerminationVetoException, RuntimeException ) -{ -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL MNSTerminateListener::notifyTermination( const EventObject& /*aEvent*/ ) throw( RuntimeException ) -{ - MNS_Term(sal_True); //Force XPCOM to shutdown -} - -void MNSTerminateListener::addTerminateListener() -{ - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->addTerminateListener(mxTerminateListener); - } -} - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx deleted file mode 100644 index fb572e9ab713..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _MNSTERMINATELISTENER_HXX -#define _MNSTERMINATELISTENER_HXX - -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> - -//class to implement the XTerminateListener interface -class MNSTerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener > -{ - -private: - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException ); - - // XTerminateListener - virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException ); - - -public: - MNSTerminateListener(); - virtual ~MNSTerminateListener(); -public: - static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> mxTerminateListener; - static void addTerminateListener(); -}; - -#endif diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx deleted file mode 100644 index c94e1e676509..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - - -#include <MNameMapper.hxx> - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - - -using namespace connectivity::mozab; -using namespace rtl; - -bool -MNameMapper::ltstr::operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const -{ - return s1.compareTo(s2) < 0; -} - -MNameMapper::MNameMapper() -{ - mDirMap = new MNameMapper::dirMap; - mUriMap = new MNameMapper::uriMap; -} -MNameMapper::~MNameMapper() -{ - clear(); -} - -void MNameMapper::reset() -{ - clear(); - mDirMap = new MNameMapper::dirMap; - mUriMap = new MNameMapper::uriMap; -} -void MNameMapper::clear() -{ - if ( mUriMap != NULL ) { - delete mUriMap; - } - if ( mDirMap != NULL ) { - MNameMapper::dirMap::iterator iter; - for (iter = mDirMap -> begin(); iter != mDirMap -> end(); ++iter) { - NS_IF_RELEASE(((*iter).second)); - } - delete mDirMap; - } -} -const char * getURI(const nsIAbDirectory* directory) -{ - nsresult retCode; - nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ; - if (NS_FAILED(retCode)) { return NULL; } - const char * uri; - retCode=rdfResource->GetValueConst(&uri); - if (NS_FAILED(retCode)) { return NULL; } - return uri; -} - -// May modify the name passed in so that it's unique -nsresult -MNameMapper::add( ::rtl::OUString& str, nsIAbDirectory* abook ) -{ - MNameMapper::dirMap::iterator iter; - - OSL_TRACE( "IN MNameMapper::add()\n" ); - - if ( abook == NULL ) { - OSL_TRACE( "\tOUT MNameMapper::add() called with null abook\n" ); - return NS_ERROR_NULL_POINTER; - } - - ::rtl::OUString ouUri=::rtl::OUString::createFromAscii(getURI(abook)); - if ( mUriMap->find (ouUri) != mUriMap->end() ) //There's already an entry with same uri - { - return NS_ERROR_FILE_NOT_FOUND; - } - mUriMap->insert( MNameMapper::uriMap::value_type( ouUri, abook ) ); - - ::rtl::OUString tempStr=str; - long count =1; - while ( mDirMap->find( tempStr ) != mDirMap->end() ) { - - tempStr = str + ::rtl::OUString::valueOf(count);; - count ++; - } - str = tempStr; - NS_IF_ADDREF(abook); - mDirMap->insert( MNameMapper::dirMap::value_type( str, abook ) ); - OSL_TRACE( "\tOUT MNameMapper::add()\n" ); - return 0; -} - -bool -MNameMapper::getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook ) -{ - MNameMapper::dirMap::iterator iter; - - OSL_TRACE( "IN MNameMapper::getDir( %s )\n", OUtoCStr(str)?OUtoCStr(str):"NULL" ); - - if ( (iter = mDirMap->find( str )) != mDirMap->end() ) { - *abook = (*iter).second; - NS_IF_ADDREF(*abook); - } else { - *abook = NULL; - } - - OSL_TRACE( "\tOUT MNameMapper::getDir() : %s\n", (*abook)?"True":"False" ); - - return( (*abook) != NULL ); -} - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx deleted file mode 100644 index f293721c35f6..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_NAMEMAPPER_HXX_ -#define _CONNECTIVITY_MAB_NAMEMAPPER_HXX_ 1 - -#include <map> - -// Mozilla includes -#include <MNSInclude.hxx> - -// Star Includes -#include <rtl/ustring.hxx> - -namespace connectivity -{ - namespace mozab - { - class MNameMapper - { - private: - - struct ltstr - { - bool operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const; - }; - - - typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > dirMap; - typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > uriMap; - - static MNameMapper *instance; - dirMap *mDirMap; - uriMap *mUriMap; - - //clear dirs - void clear(); - - public: - static MNameMapper* getInstance(); - - MNameMapper(); - ~MNameMapper(); - - // May modify the name passed in so that it's unique - nsresult add( ::rtl::OUString& str, nsIAbDirectory* abook ); - - //reset dirs - void reset(); - - // Get the directory corresponding to str - bool getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook ); - - }; - - } -} - -#endif //_CONNECTIVITY_MAB_NAMEMAPPER_HXX_ diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx deleted file mode 100644 index 0be40e14b92f..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx +++ /dev/null @@ -1,819 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <MQueryHelper.hxx> -#include <MNameMapper.hxx> -#include <MConnection.hxx> -#include <connectivity/dbexception.hxx> -#include "MQuery.hxx" -#include "MLdapAttributeMap.hxx" -#include "MTypeConverter.hxx" -#include "MNSMozabProxy.hxx" -#include <com/sun/star/uno/Reference.hxx> -#include <unotools/processfactory.hxx> -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> - -#if OSL_DEBUG_LEVEL > 0 -# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* OSL_DEBUG_LEVEL */ -# define OUtoCStr( x ) ("dummy") -#endif /* OSL_DEBUG_LEVEL */ - -static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS_CID); -static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID); -static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID); -static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID); -static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID); - -using namespace connectivity::mozab; -using namespace connectivity; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace connectivity; - -// ------------------------------------------------------------------------- -// Used to store an nsIAbDirectoryQuery member without the need to use Mozilla -// types in the MQuery.hxx file. -// -namespace connectivity { - namespace mozab { - struct MQueryDirectory { - nsCOMPtr<nsIAbDirectory> directory; - nsCOMPtr<nsIAbDirectoryQuery> directoryQuery; - PRInt32 contextId; - MQueryDirectory() : contextId(-1) {} - }; - } -} - -// ------------------------------------------------------------------------- -/* -MQuery::MQuery() -{ - OSL_TRACE( "IN MQuery::MQuery()\n" ); - - construct(); -#if OSL_DEBUG_LEVEL > 0 - m_oThreadID = osl_getThreadIdentifier(NULL); -#endif - - OSL_TRACE( "\tOUT MQuery::MQuery()\n" ); -} -*/ -// ------------------------------------------------------------------------- -MQuery::MQuery( const OColumnAlias& _ca ) - :m_rColumnAlias( _ca ) -{ - OSL_TRACE( "IN MQuery::MQuery( ca )\n" ); - - construct(); - -#if OSL_DEBUG_LEVEL > 0 - m_oThreadID = osl_getThreadIdentifier(NULL); -#endif - - OSL_TRACE( "\tOUT MQuery::MQuery( ca )\n" ); -} -// ------------------------------------------------------------------------- -MQuery::~MQuery() -{ - OSL_TRACE("IN MQuery::~MQuery()\n"); - - // MQueryHelper is reference counted, so we need to decrement the - // count here. - // - if ( m_aQueryDirectory->contextId != -1 && m_aQueryDirectory->directoryQuery != - NULL ) - m_aQueryDirectory->directoryQuery->StopQuery(m_aQueryDirectory->contextId); - - if ( m_aQueryDirectory ) - delete m_aQueryDirectory; - - NS_IF_RELEASE( m_aQueryHelper); - - OSL_TRACE("\tOUT MQuery::~MQuery()\n"); -} -// ----------------------------------------------------------------------------- -void MQuery::construct() -{ - // Set default values. (For now just as a reminder). - m_aError.reset(); - m_bQuerySubDirs = sal_True; // LDAP Queryies require this to be set! - m_nMaxNrOfReturns = -1; // Unlimited number of returns. - - m_aQueryDirectory = new MQueryDirectory(); - // MQueryHelper is reference counted, so we need to add to the - // count here to prevent accidental deletion else where... - // - m_aQueryHelper = new MQueryHelper(); - NS_IF_ADDREF( m_aQueryHelper); -} -// ------------------------------------------------------------------------- -void MQuery::setAddressbook(::rtl::OUString &ab) -{ - OSL_TRACE("IN MQuery::setAddressbook()\n"); - ::osl::MutexGuard aGuard(m_aMutex); - - m_aAddressbook = ab; - - OSL_TRACE("\tOUT MQuery::setAddressbook()\n"); -} -// ------------------------------------------------------------------------- -::rtl::OUString MQuery::getAddressbook() const -{ - OSL_TRACE("IN MQuery::getAddressbook()\n"); - - OSL_TRACE("\tOUT MQuery::getAddressbook()\n"); - - return(m_aAddressbook); -} -// ------------------------------------------------------------------------- -void MQuery::setMaxNrOfReturns(const sal_Int32 mnr) -{ - OSL_TRACE( "IN MQuery::setMaxNrOfReturns()\n" ); - ::osl::MutexGuard aGuard(m_aMutex); - - m_nMaxNrOfReturns = mnr; - OSL_TRACE("\tOUT MQuery::setMaxNrOfReturns()\n" ); -} -// ------------------------------------------------------------------------- -sal_Int32 MQuery::getMaxNrOfReturns() const -{ - OSL_TRACE("IN MQuery::getMaxNrOfReturns()\n"); - - OSL_TRACE("\tOUT MQuery::getMaxNrOfReturns()\n"); - - return(m_nMaxNrOfReturns); -} -// ------------------------------------------------------------------------- -void MQuery::setQuerySubDirs(sal_Bool &qsd) -{ - OSL_TRACE("IN MQuery::setQuerySubDirs()\n"); - ::osl::MutexGuard aGuard(m_aMutex); - - m_bQuerySubDirs = qsd; - OSL_TRACE("\tOUT MQuery::setQuerySubDirs()\n"); -} -// ------------------------------------------------------------------------- -sal_Bool MQuery::getQuerySubDirs() const -{ - OSL_TRACE("IN MQuery::getQuerySubDirs()\n"); - - OSL_TRACE("\tOUT MQuery::getQuerySubDirs()\n"); - - return(m_bQuerySubDirs); -} -// ------------------------------------------------------------------------- -void MQuery::setExpression( MQueryExpression &_expr ) -{ - OSL_TRACE("IN MQuery::setExpression()\n"); - ::osl::MutexGuard aGuard(m_aMutex); - - m_aExpr = _expr; - - OSL_TRACE("\tOUT MQuery::setExpression()\n"); -} -// ------------------------------------------------------------------------- -static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr, - nsIAbBooleanExpression* queryExpression ) -{ - nsresult rv; // Store return values. - // Array that holds all matchItems, to be passed to DoQuery(). - nsCOMPtr<nsISupportsArray> matchItems; - NS_NewISupportsArray(getter_AddRefs(matchItems)); - - // Add every individual boolString to matchItems array. - nsString matchValue; - // Initialise the matchItems container. - MQueryExpression::ExprVector::iterator evIter; - for( evIter = _aExpr->getExpressions().begin(); - evIter != _aExpr->getExpressions().end(); - ++evIter ) - { - if ( (*evIter)->isStringExpr() ) { - nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv); - NS_ENSURE_SUCCESS( rv, rv ); - - MQueryExpressionString* evStr = static_cast<MQueryExpressionString*> (*evIter); - - // Set the 'name' property of the boolString. - // Check if it's an alias first... - rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() ); - boolString->SetName( strdup( attrName.getStr() ) ); - OSL_TRACE("Name = %s ;", attrName.getStr() ); - // Set the 'matchType' property of the boolString. Check for equal length. - sal_Bool requiresValue = sal_True; - switch(evStr->getCond()) { - case MQueryOp::Exists: - OSL_TRACE("MQueryOp::Exists; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Exists); - requiresValue = sal_False; - break; - case MQueryOp::DoesNotExist: - OSL_TRACE("MQueryOp::DoesNotExist; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist); - requiresValue = sal_False; - break; - case MQueryOp::Contains: - OSL_TRACE("MQueryOp::Contains; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Contains); - break; - case MQueryOp::DoesNotContain: - OSL_TRACE("MQueryOp::DoesNotContain; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain); - break; - case MQueryOp::Is: - OSL_TRACE("MQueryOp::Is; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Is); - break; - case MQueryOp::IsNot: - OSL_TRACE("MQueryOp::IsNot; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot); - break; - case MQueryOp::BeginsWith: - OSL_TRACE("MQueryOp::BeginsWith; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith); - break; - case MQueryOp::EndsWith: - OSL_TRACE("MQueryOp::EndsWith; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith); - break; - case MQueryOp::SoundsLike: - OSL_TRACE("MQueryOp::SoundsLike; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike); - break; - case MQueryOp::RegExp: - OSL_TRACE("MQueryOp::RegExp; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp); - break; - default: - OSL_TRACE("(default) MQueryOp::Is; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Is); - break; - } - // Set the 'matchValue' property of the boolString. Value returned in unicode. - if ( requiresValue ) - { - OSL_TRACE("Value = %s \n", OUtoCStr( evStr->getValue() ) ); - MTypeConverter::ouStringToNsString( evStr->getValue(), matchValue); - boolString->SetValue(matchValue.get ()); - } - // Add the individual boolString to the container of matchItems. - matchItems->AppendElement(boolString); - } - else if ( (*evIter)->isExpr() ) { - nsCOMPtr< nsIAbBooleanExpression > subQueryExpr = do_CreateInstance( kBooleanExpressionCID , &rv); - NS_ENSURE_SUCCESS( rv, rv ); - rv = generateExpression( _aQuery, static_cast< MQueryExpression* >(*evIter), - subQueryExpr ); - NS_ENSURE_SUCCESS( rv, rv ); - matchItems->AppendElement(subQueryExpr); - } - else { - // Should never see this... - OSL_ASSERT("Unknown Expression Type!"); - return( NS_ERROR_UNEXPECTED ); - } - } - - queryExpression->SetExpressions(matchItems); - if ( _aExpr->getExpressionCondition() == MQueryExpression::AND ) - queryExpression->SetOperation(nsIAbBooleanOperationTypes::AND); - else - queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR); - - return( NS_OK ); -} -sal_uInt32 MQuery::InsertLoginInfo(OConnection* _pCon) -{ - nsresult rv; // Store return values. - - rtl::OUString nameAB = _pCon->getHost().replace('.','_'); - rtl::OUString bindDN = _pCon->getBindDN(); - rtl::OUString password = _pCon->getPassword(); - sal_Bool useSSL = _pCon->getUseSSL(); - - nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - // create the ldap maxHits entry for the preferences file. - // Note: maxHits is applicable to LDAP only in mozilla. - nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers.")); - const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(nameAB.getStr()); - prefName.Append(pAddressBook); - - if (bindDN.getLength()) - { - nsCAutoString bindPrefName=prefName; - bindPrefName.Append(NS_LITERAL_CSTRING(".auth.dn")); - rv = prefs->SetCharPref (bindPrefName.get(), - MTypeConverter::ouStringToCCharStringAscii( bindDN.getStr() ) ); - NS_ENSURE_SUCCESS(rv, rv); - - nsCAutoString pwdPrefName=prefName; - pwdPrefName.Append(NS_LITERAL_CSTRING(".auth.pwd")); - rv = prefs->SetCharPref (pwdPrefName.get(), - MTypeConverter::ouStringToCCharStringAscii( password.getStr() ) ); - NS_ENSURE_SUCCESS(rv, rv); - } - if (useSSL) - { - nsCAutoString sslPrefName=prefName; - sslPrefName.Append(NS_LITERAL_CSTRING(".UseSSL")); - rv = prefs->SetBoolPref (sslPrefName.get(),useSSL); - NS_ENSURE_SUCCESS(rv, rv); - } - return rv; -} - -//determine whether current profile is locked,any error will lead to return true -sal_Bool isProfileLocked(OConnection* _pCon) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap > xMozillaBootstrap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - xMozillaBootstrap = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap >(xInstance,::com::sun::star::uno::UNO_QUERY); - if (_pCon) - return xMozillaBootstrap->isProfileLocked(_pCon->getProduct(),_pCon->getMozProfile()); - else - return xMozillaBootstrap->isCurrentProfileLocked(); -} - - -// ------------------------------------------------------------------------- -sal_Int32 getDirectoryType(const nsIAbDirectory* directory) -{ - nsresult retCode; - nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ; - if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; } - const char * uri; - retCode=rdfResource->GetValueConst(&uri); - if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; } - const sal_Char *sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_LDAP ); - if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0) - { - return SDBCAddress::LDAP; - } - sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA ); - if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0) - { - return SDBCAddress::Mozilla; - } - sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA_MDB ); - if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0) - { - return SDBCAddress::Mozilla; - } - sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_EXPRESS ); - if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0) - { - return SDBCAddress::OutlookExp; - } - sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_MAPI ); - if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0) - { - return SDBCAddress::Outlook; - } - return SDBCAddress::Unknown; - -} -// ------------------------------------------------------------------------- -sal_Bool isForceQueryProxyUsed(const nsIAbDirectory* directory) -{ - sal_Int32 nType = getDirectoryType(directory); - if (nType == SDBCAddress::Outlook || nType == SDBCAddress::OutlookExp) - return sal_True; - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 MQuery::commitRow(const sal_Int32 rowIndex) -{ - if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery) - return sal_False; - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD; - args.argCount = 3; - args.arg1 = (void*)m_aQueryHelper; - args.arg2 = (void*)&rowIndex; - args.arg3 = (void*)m_aQueryDirectory->directory; - nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile); - m_aError = m_aQueryHelper->getError(); - return rv; -} - -// ------------------------------------------------------------------------- -sal_Int32 MQuery::deleteRow(const sal_Int32 rowIndex) -{ - if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery) - return sal_False; - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD; - args.argCount = 3; - args.arg1 = (void*)m_aQueryHelper; - args.arg2 = (void*)&rowIndex; - args.arg3 = (void*)m_aQueryDirectory->directory; - nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile); - m_aError = m_aQueryHelper->getError(); - return rv; - -} - -// ------------------------------------------------------------------------- -sal_Int32 MQuery::executeQuery(OConnection* _pCon) -{ - ::osl::MutexGuard aGuard(m_aMutex); - OSL_TRACE("IN MQuery::executeQuery()\n"); - m_Product = _pCon->getProduct(); - m_Profile = _pCon->getMozProfile(); - - nsresult rv; - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_EXECUTE_QUERY; - args.argCount = 2; - args.arg1 = (void*)this; - args.arg2 = (void*)_pCon; - rv = xMProxy.StartProxy(&args,m_Product,m_Profile); - return rv; -} -// ------------------------------------------------------------------------- -sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon) -{ -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("IN MQuery::executeQueryProxied() Caller thread: %4d \n", m_oThreadID); -#endif - - nsresult rv; // Store return values. - // MTypeConverter aTypeConverter; - // Create a nsIAbDirectory object to initialise the nsIAbDirectoryQuery object. - nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ; - if (NS_FAILED(rv)) - return(-1); - - nsCOMPtr<nsIAbDirectory> directory; - MNameMapper *nmap = _pCon->getNameMapper(); - - - if ( nmap->getDir( m_aAddressbook, getter_AddRefs( directory ) ) == sal_False ) - return( -1 ); - - - //insert ldap bind info to mozilla profile(in memery,none saved),so we can use it in mozilla part codes - if (_pCon->isLDAP()) - { - rv = InsertLoginInfo(_pCon); - NS_ENSURE_SUCCESS(rv, rv); - - } - // Since Outlook Express and Outlook in OCL mode support a very limited query capability, - // we use the following bool to judge whether we need bypass any use of a DirectoryQuery - // interface and instead force the use of the QueryProxy. - sal_Bool forceQueryProxyUse = isForceQueryProxyUsed(directory); - - m_aQueryDirectory->directory = directory; - // Initialize directory in cases of LDAP and Mozilla - if (!forceQueryProxyUse) m_aQueryDirectory->directoryQuery = do_QueryInterface(directory, &rv); - - if ( NS_FAILED(rv) || forceQueryProxyUse) - { - // Create a nsIAbDirectoryQuery object which eventually will execute - // the query by calling DoQuery(). - nsCOMPtr< nsIAbDirectoryQueryProxy > directoryQueryProxy = do_CreateInstance( kAbDirectoryQueryProxyCID, &rv); - - // Need to turn this off for anything using the Query Proxy since it - // treats Mailing Lists as directories! - - m_bQuerySubDirs = sal_False; - - rv = directoryQueryProxy->Initiate (directory); - NS_ENSURE_SUCCESS(rv, rv); - - m_aQueryDirectory->directoryQuery = do_QueryInterface (directoryQueryProxy, &rv); - NS_ENSURE_SUCCESS(rv, rv); - OSL_TRACE("Using the directoryQueryProxy\n"); - } -#if OSL_DEBUG_LEVEL > 0 - else - OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n"); -#endif /* OSL_DEBUG_LEVEL */ - - /* - // The problem here is that an LDAP Address Book may exist as - // a Mozilla Address Book. So we need to limit the number of - // records returned by the Server: - // 1. Determine if this is an LDAP Address Book - // [LDAP overrides the default operations(write|read|search) of all types with search only]. - // 2. Determine if the limit is already set by us. - // 3. Use the mozilla preferences to see if this value is set. - // 4. Use value or else default to 100. - */ - PRBool isWriteable; - rv = directory->GetOperations (&isWriteable); - NS_ENSURE_SUCCESS(rv, rv); - if (!(isWriteable & nsIAbDirectory::opWrite)) - { - if(m_nMaxNrOfReturns == -1) - { - // Determine if the limit maxHits has been set in the mozilla preferences - // if set, then use the value otherwise default to 100 - nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - // create the ldap maxHits entry for the preferences file. - // Note: maxHits is applicable to LDAP only in mozilla. - nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers.")); - const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(m_aAddressbook); - prefName.Append(pAddressBook); - prefName.Append(NS_LITERAL_CSTRING(".maxHits")); - - PRInt32 maxHits; - rv = prefs->GetIntPref(prefName.get(), &maxHits); - if (NS_FAILED(rv)) - m_nMaxNrOfReturns = 100; - else - m_nMaxNrOfReturns = maxHits; - } - } - - - nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv); - NS_ENSURE_SUCCESS( rv, rv ); - rv = generateExpression( this, &m_aExpr, queryExpression ); - NS_ENSURE_SUCCESS( rv, rv ); - - // Use the nsIAbCard to return the card properties. - const char *returnProperties[] = {"card:nsIAbCard"}; - PRInt32 count=1; - - nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv); - NS_ENSURE_SUCCESS( rv, rv ); - - rv = arguments->SetExpression(queryExpression); - NS_ENSURE_SUCCESS( rv, rv ); - - rv = arguments->SetReturnProperties(count, returnProperties); - NS_ENSURE_SUCCESS( rv, rv ); - - rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs); - NS_ENSURE_SUCCESS( rv, rv ); - - nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap ); - rv = arguments->SetTypeSpecificArg( attributeMap ); - NS_ENSURE_SUCCESS( rv, rv ); - - // Execute the query. - OSL_TRACE( "****** calling DoQuery\n"); - - m_aError.reset(); - - m_aQueryHelper->reset(); - - rv = m_aQueryDirectory->directoryQuery->DoQuery(arguments, m_aQueryHelper, m_nMaxNrOfReturns, -1, &m_aQueryDirectory->contextId); - - - if (NS_FAILED(rv)) { - m_aQueryDirectory->contextId = -1; - OSL_TRACE( "****** DoQuery failed\n"); - OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n"); - m_aQueryHelper->notifyQueryError() ; - return(-1); - } -#if OSL_DEBUG_LEVEL > 0 - else { - OSL_TRACE( "****** DoQuery succeeded \n"); - } -#endif - - OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n"); - - return(0); -} - -// ------------------------------------------------------------------------- -// -// -// If the query executed is being done asynchronously then this may return -// -1 as the count, ie. it's undetermined. -// -sal_Int32 -MQuery::getRowCount() -{ - return( m_aQueryHelper->getResultCount() ); -} - -// ------------------------------------------------------------------------- -// -// -// As opposed to getRowCount() this returns the actual number of rows fetched -// so far (if is an async query) -// -sal_uInt32 -MQuery::getRealRowCount() -{ - return( m_aQueryHelper->getRealCount() ); -} - -// -// If the query executed is being done asynchronously then this may be -// false -// -sal_Bool -MQuery::queryComplete( void ) -{ - return( hadError() || m_aQueryHelper->queryComplete() ); -} - -sal_Bool -MQuery::waitForQueryComplete( void ) -{ - if( m_aQueryHelper->waitForQueryComplete( ) ) - return sal_True; - m_aError = m_aQueryHelper->getError(); - return( sal_False ); -} - -// ------------------------------------------------------------------------- - -sal_Bool -MQuery::checkRowAvailable( sal_Int32 nDBRow ) -{ - while( !queryComplete() && m_aQueryHelper->getRealCount() <= (sal_uInt32)nDBRow ) - if ( !m_aQueryHelper->waitForRow( nDBRow ) ) { - m_aError = m_aQueryHelper->getError(); - return( sal_False ); - } - - return( getRowCount() > nDBRow ); -} -// ------------------------------------------------------------------------- -sal_Bool -MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const -{ - MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow ); - - OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL"); - if (xResEntry == NULL ) - { - const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError(); - return sal_False; - } - switch ( nType ) - { - case DataType::VARCHAR: - xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() ); - break; - default: - OSL_ENSURE( sal_False, "invalid data type!" ); - break; - } - - return sal_True; -} - -// ------------------------------------------------------------------------- -sal_Bool -MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const -{ - MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow ); - - OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL"); - if (xResEntry == NULL ) - { - const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError(); - rValue.setNull(); - return sal_False; - } - switch ( nType ) - { - case DataType::VARCHAR: - rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) ); - break; - - default: - rValue.setNull(); - break; - } - - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Int32 -MQuery::getRowStates(sal_Int32 nDBRow) -{ - MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow ); - - OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL"); - if (xResEntry == NULL ) - { - m_aError = m_aQueryHelper->getError(); - return RowStates_Error; - } - return xResEntry->getRowStates(); -} -sal_Bool -MQuery::setRowStates(sal_Int32 nDBRow,sal_Int32 aState) -{ - MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow ); - - OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL"); - if (xResEntry == NULL ) - { - m_aError = m_aQueryHelper->getError(); - return sal_False; - } - return xResEntry->setRowStates(aState); -} - -sal_Bool -MQuery::resyncRow(sal_Int32 nDBRow) -{ - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD; - args.argCount = 2; - args.arg1 = (void*)m_aQueryHelper; - args.arg2 = (void*)&nDBRow; - nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile); - m_aError = m_aQueryHelper->getError(); - return NS_SUCCEEDED( rv ) ? sal_True : sal_False; -} - -sal_Int32 -MQuery::createNewCard() -{ - sal_Int32 nNumber = 0; - MNSMozabProxy xMProxy; - RunArgs args; - args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD; - args.argCount = 2; - args.arg1 = (void*)m_aQueryHelper; - args.arg2 = (void*)&nNumber; - nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile); - - m_aError = m_aQueryHelper->getError(); - NS_ENSURE_SUCCESS(rv,0); - return nNumber; -} -// ------------------------------------------------------------------------- - -MNameMapper* -MQuery::CreateNameMapper() -{ - return( new MNameMapper() ); -} - -// ------------------------------------------------------------------------- -void -MQuery::FreeNameMapper( MNameMapper* _ptr ) -{ - delete _ptr; -} -// ------------------------------------------------------------------------- -sal_Bool MQuery::isWritable(OConnection* _pCon) -{ - if ( !m_aQueryDirectory ) - return sal_False; - - nsresult rv; // Store return values. - nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(m_aQueryDirectory->directory, &rv);; - if (NS_FAILED(rv)) - return sal_False; - if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(_pCon)) - return sal_False; - - PRBool isWriteable; - rv = directory->GetOperations (&isWriteable); - if (NS_FAILED(rv)) - return sal_False; - sal_Bool bWritable = ( isWriteable & nsIAbDirectory::opWrite ) == nsIAbDirectory::opWrite; - return bWritable; -} diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx deleted file mode 100644 index bfbb76eb68b3..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx +++ /dev/null @@ -1,278 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - - -#ifndef _CONNECTIVITY_MAB_QUERY_HXX_ -#define _CONNECTIVITY_MAB_QUERY_HXX_ - -#include "MColumnAlias.hxx" -#include "MErrorResource.hxx" -#include <connectivity/FValue.hxx> -#include "MNSDeclares.hxx" -#include <osl/thread.hxx> -#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_ -#include <com/sun/star/mozilla/MozillaProductType.hpp> -#endif - -namespace connectivity -{ - namespace mozab - { - - class MQueryHelper; - struct MQueryDirectory; - - namespace MQueryOp { - typedef enum { - Exists = 0, - DoesNotExist = 1, - Contains = 2, - DoesNotContain = 3, - Is = 4, - IsNot = 5, - BeginsWith = 6, - EndsWith = 7, - SoundsLike = 8, - RegExp = 9 - } cond_type; - } - - class MQueryExpressionBase { - public: - typedef enum { - Unknown, - StringExpr, - Expr - } node_type; - - protected: - node_type m_eNodeType; - - MQueryExpressionBase() : m_eNodeType( Unknown ) {} - MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {} - - public: - sal_Bool isUnknown( ) { return m_eNodeType == Unknown; } - sal_Bool isStringExpr( ) { return m_eNodeType == StringExpr; } - sal_Bool isExpr( ) { return m_eNodeType == Expr; } - }; - - class MQueryExpressionString : public MQueryExpressionBase { - protected: - ::rtl::OUString m_aName; // LHS - MQueryOp::cond_type m_aBooleanCondition; - ::rtl::OUString m_aValue; // RHS - - public: - - MQueryExpressionString( ::rtl::OUString& lhs, - MQueryOp::cond_type cond, - ::rtl::OUString rhs ) - : MQueryExpressionBase( MQueryExpressionBase::StringExpr ) - , m_aName( lhs ) - , m_aBooleanCondition( cond ) - , m_aValue( rhs ) - { - } - - MQueryExpressionString( ::rtl::OUString& lhs, - MQueryOp::cond_type cond ) - : MQueryExpressionBase( MQueryExpressionBase::StringExpr ) - , m_aName( lhs ) - , m_aBooleanCondition( cond ) - , m_aValue( ::rtl::OUString() ) - { - } - - const ::rtl::OUString& getName() const { return m_aName; } - MQueryOp::cond_type getCond() const { return m_aBooleanCondition; } - const ::rtl::OUString& getValue() const { return m_aValue; } - }; - - class MQuery; - - class MQueryExpression : public MQueryExpressionBase - { - friend class MQuery; - - public: - typedef ::std::vector< MQueryExpressionBase* > ExprVector; - - typedef enum { - AND, - OR - } bool_cond; - - void setExpressions( ExprVector& _exprVector ) - { m_aExprVector = _exprVector; } - - // All expressions on a peer level use same condition operator - void setExpressionCondition( bool_cond _cond ) - { m_aExprCondType = _cond; } - - ExprVector& getExpressions( ) - { return m_aExprVector; } - - // All expressions on a peer level use same condition operator - bool_cond getExpressionCondition( ) - { return m_aExprCondType; } - - MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ), - m_aExprCondType( OR ) - { m_aExprVector.clear(); } - - - protected: - ExprVector m_aExprVector; - bool_cond m_aExprCondType; - - }; - - - class MQuery - { - /* - * A query resultset with a maximum limit of - * m_nMaxNrOfReturns return items, is created from - * the following SQL statement: - * - * ------------------------------------------------- - * SELECT m_aAttributes FROM m_aAddressbook - * WHERE m_aMatchItems SQL_OPR m_aMatchValue - * ------------------------------------------------- - * - * We are\are not, depending on boolean m_bQuerySubDirs, - * interested in querying the sub-directories of the - * addressbook directory, if any. - * - * SQL_OPR: - * m_aSqlOppr contains the SQL operations for every - * attribute in m_aAttributes. - * This member must be initialised together with - * m_aAttributes. - * - * The SQL operations defined for 'SQL_OPR' are: - * matchExists = 0, - * matchDoesNotExist = 1, - * matchContains = 2, - * matchDoesNotContain = 3, - * matchIs = 4, - * matchIsNot = 5, - * matchBeginsWith = 6, - * matchEndsWith = 7, - * matchSoundsLike = 8, - * matchRegExp = 9. - * There must be mapping to one of these values. - * - * The following members MUST be initialised before - * a query is executed: - * m_Attributes, m_aMapAttrOppr, m_aAddressbook, - * m_aMatchItems and m_aMatchValue. - * - * m_bQuerySubDirs and m_nMaxNrReturns are set to a - * default value in the constructor which can be - * overridden. If (element of) m_aSqlOppr is not set, - * the default SQL operation is 'matchIs'. - * - */ - private: - MQueryDirectory *m_aQueryDirectory; - MQueryHelper *m_aQueryHelper; - ::rtl::OUString m_aAddressbook; - sal_Int32 m_nMaxNrOfReturns; - sal_Bool m_bQuerySubDirs; - MQueryExpression m_aExpr; - const OColumnAlias& m_rColumnAlias; - ::com::sun::star::mozilla::MozillaProductType - m_Product; - ::rtl::OUString m_Profile; - ErrorDescriptor m_aError; - - void construct(); - protected: - ::osl::Mutex m_aMutex; -#if OSL_DEBUG_LEVEL > 0 - oslThreadIdentifier m_oThreadID; -#endif - - public: - /* - * - Contains accessors to the members of this class. - * - executeQuery() initiates a non-blocking query. - */ - sal_Int32 executeQuery(OConnection* _pCon); - sal_Int32 executeQueryProxied(OConnection* _pCon); //Used only by MNSMozabProxy - - sal_Int32 createNewCard(); //return Row count number - sal_Int32 deleteRow(const sal_Int32 rowIndex); - sal_Int32 commitRow(const sal_Int32 rowIndex); - sal_Bool resyncRow(sal_Int32 nDBRow); - - sal_Bool isWritable(OConnection* _pCon); - - sal_uInt32 InsertLoginInfo(OConnection* _pCon); - - void setAddressbook( ::rtl::OUString&); - ::rtl::OUString getAddressbook(void) const; - - const OColumnAlias& getColumnAlias() const { return m_rColumnAlias; } - - void setExpression( MQueryExpression &_expr ); - - void setMaxNrOfReturns( const sal_Int32); - sal_Int32 getMaxNrOfReturns(void) const; - - void setQuerySubDirs( sal_Bool&); - sal_Bool getQuerySubDirs(void) const; - - sal_Int32 getRowCount( void ); - sal_uInt32 getRealRowCount( void ); - sal_Bool queryComplete( void ); - sal_Bool waitForQueryComplete( void ); - sal_Bool checkRowAvailable( sal_Int32 nDBRow ); - sal_Bool getRowValue( connectivity::ORowSetValue& rValue, - sal_Int32 nDBRow, - const rtl::OUString& aDBColumnName, - sal_Int32 nType ) const; - sal_Bool setRowValue( connectivity::ORowSetValue& rValue, - sal_Int32 nDBRow, - const rtl::OUString& aDBColumnName, - sal_Int32 nType ) const; - sal_Int32 getRowStates(sal_Int32 nDBRow); - sal_Bool setRowStates(sal_Int32 nDBRow,sal_Int32 aState); - - bool hadError() const { return m_aError.is(); } - inline const ErrorDescriptor& getError() const { return m_aError; } - - public: -// MQuery(); - MQuery( const OColumnAlias& _ca ); - virtual ~MQuery(); - static MNameMapper* CreateNameMapper(); - static void FreeNameMapper( MNameMapper* _ptr ); - }; - } -} - -#endif // _CONNECTIVITY_MAB_QUERY_HXX_ - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx deleted file mode 100644 index 18601fad6989..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx +++ /dev/null @@ -1,631 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "MQueryHelper.hxx" -#include "MTypeConverter.hxx" -#include "MConnection.hxx" -#include "MNSDeclares.hxx" -#include "MLdapAttributeMap.hxx" - -#include <connectivity/dbexception.hxx> - -#include "resource/mozab_res.hrc" - -using namespace connectivity::mozab; - - -NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener) - -// -// class MQueryHelperResultEntry -// - - -MQueryHelperResultEntry::MQueryHelperResultEntry() -{ - m_Card = NULL; - m_RowStates = 0; -} - -MQueryHelperResultEntry::~MQueryHelperResultEntry() -{ - OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n"); - OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n"); - -} -void -MQueryHelperResultEntry::setCard(nsIAbCard *card) -{ - m_Card = card; -} -nsIAbCard * -MQueryHelperResultEntry::getCard() -{ - return m_Card; -} -void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value ) -{ - m_Fields[ key ] = value; -} - -rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const -{ - FieldMap::const_iterator iter = m_Fields.find( key ); - if ( iter == m_Fields.end() ) - { - return rtl::OUString(); - } - else - { - return iter->second; - } -} - -void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue) -{ - m_Fields[ key ] = rValue; -} -// -// class MQueryHelper -// -MQueryHelper::MQueryHelper() - :m_nIndex( 0 ) - ,m_bHasMore( sal_True ) - ,m_bAtEnd( sal_False ) - ,m_bErrorCondition( sal_False ) - ,m_bQueryComplete( sal_False ) - ,mRefCnt( 0 ) // NSISUPPORTS - Initialize RefCnt to 0 -{ - m_aResults.clear(); -#if OSL_DEBUG_LEVEL > 0 - m_oThreadID = osl_getThreadIdentifier(NULL); -#endif -} - -MQueryHelper::~MQueryHelper() -{ - OSL_TRACE("IN MQueryHelper::~MQueryHelper()\n"); - clear_results(); - OSL_TRACE("OUT MQueryHelper::~MQueryHelper()\n"); -} - -void -MQueryHelper::append(MQueryHelperResultEntry* resEnt ) -{ - if ( resEnt != NULL ) { - m_aResults.push_back( resEnt ); - m_bAtEnd = sal_False; - } -} - -void -MQueryHelper::clear_results() -{ - resultsArray::iterator iter = m_aResults.begin(); - while ( iter != m_aResults.end() ) { - delete (*iter); - ++iter; - } - m_aResults.clear(); -} - -void -MQueryHelper::rewind() -{ - m_nIndex = 0; -} - -void -MQueryHelper::reset() -{ - m_nIndex = 0; - m_bHasMore = sal_True; - m_bQueryComplete = sal_False; - m_bAtEnd = sal_False; - m_bErrorCondition = sal_False; - clear_results(); -} - -void -MQueryHelper::clearResultOrComplete() -{ - // Don't use a Mutex, it should be called by a method already holding it. - OSL_TRACE("In/Out : clearResultOrComplete()"); - m_aCondition.reset(); -} - -void -MQueryHelper::notifyResultOrComplete() -{ - OSL_TRACE("In/Out : notifyResultOrComplete()"); - m_aCondition.set(); -} - -sal_Bool -MQueryHelper::waitForResultOrComplete( ) -{ - TimeValue timeValue = { 1, 0 }; // 20 Seconds 0 NanoSecond timeout - sal_Int32 times=0; - osl::Condition::Result rv = ::osl::Condition::result_ok; - - OSL_TRACE("In : waitForResultOrComplete()"); - // Can't hold mutex or condition would never get set... - while( (m_aCondition.check() == sal_False || rv == ::osl::Condition::result_error) && times < 20) { - rv = m_aCondition.wait( &timeValue ); - times ++; - } - if (times >= 20 && rv == ::osl::Condition::result_timeout ) { - OSL_TRACE("waitForResultOrComplete() : Timeout!"); - m_aError.setResId( STR_TIMEOUT_WAITING ); - return sal_False; - } - - if ( isError() ) { - OSL_TRACE("waitForResultOrComplete() : Error returned!"); - m_aError.setResId( STR_ERR_EXECUTING_QUERY ); - return sal_False; - } - m_aError.reset(); - OSL_TRACE(" Out : waitForResultOrComplete()"); - return sal_True; -} - - -MQueryHelperResultEntry* -MQueryHelper::next( ) -{ - MQueryHelperResultEntry* result; - sal_Int32 index; - - m_aMutex.acquire(); - index = m_nIndex; - m_aMutex.release(); - - result = getByIndex( m_nIndex + 1) ; // Add 1 as Row is numbered from 1 to N - - if ( result ) { - m_aMutex.acquire(); - m_nIndex++; - m_aMutex.release(); - } - - return( result ); -} - -MQueryHelperResultEntry* -MQueryHelper::getByIndex( sal_uInt32 nRow ) -{ - // Row numbers are from 1 to N, need to ensure this, and then - // substract 1 - if ( nRow < 1 ) { - return( NULL ); - } - - do { - // Obtain the Mutex - don't use a guard as we want to be able to release - // and acquire again... - m_aMutex.acquire(); - if ( nRow > m_aResults.size() ) - { - if ( m_bQueryComplete ) - { - m_bAtEnd = sal_True; - m_aMutex.release(); - return( NULL ); - } - else - { - clearResultOrComplete(); - m_aMutex.release(); - if ( !waitForResultOrComplete( ) ) - return( NULL ); - } - } - else - { - m_aMutex.release(); - return( m_aResults[ nRow -1 ] ); - } - } while ( sal_True ); -} - -sal_Bool -MQueryHelper::hasMore() const -{ - return m_bHasMore; -} - -sal_Bool -MQueryHelper::atEnd() const -{ - return m_bAtEnd; -} - -sal_Bool -MQueryHelper::isError() const -{ - return m_bErrorCondition; -} - -sal_Bool -MQueryHelper::queryComplete() const -{ - return m_bQueryComplete; -} - -sal_Bool -MQueryHelper::waitForQueryComplete( ) -{ - m_aMutex.acquire(); - - OSL_TRACE("In : waitForQueryComplete()"); - if ( ! m_bQueryComplete ) { - do - { - m_aMutex.release(); - clearResultOrComplete(); - if ( !waitForResultOrComplete( ) ) - return( sal_False ); - m_aMutex.acquire(); - } - while ( !m_bQueryComplete ); - } - - m_aMutex.release(); - OSL_TRACE("Out : waitForQueryComplete()"); - return( sal_True ); -} - -sal_Bool -MQueryHelper::waitForRow( sal_Int32 rowNum ) -{ - m_aMutex.acquire(); - do - { - m_aMutex.release(); - clearResultOrComplete(); - if ( !waitForResultOrComplete() ) - return( sal_False ); - m_aMutex.acquire(); - } - while ( !m_bQueryComplete && m_aResults.size() < (size_t)rowNum ); - - m_aMutex.release(); - return( sal_True ); -} - -// ------------------------------------------------------------------------- - -sal_Int32 -MQueryHelper::getResultCount() const -{ - OSL_TRACE( "IN MQueryHelper::getResultCount()" ); - if ( !m_bQueryComplete ) - { - OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = -1\n"); - return -1; - } - else - { - OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = %d\n", m_aResults.size() ); - return static_cast<sal_Int32>(m_aResults.size()); - } -} - -// ------------------------------------------------------------------------- - -sal_uInt32 -MQueryHelper::getRealCount() const -{ - OSL_TRACE( "IN/OUT MQueryHelper::getRealCount() = %d\n", m_aResults.size() ); - return static_cast<sal_Int32>(m_aResults.size()); -} - -// ------------------------------------------------------------------------- -NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result) -{ - ::osl::MutexGuard aGuard( m_aMutex ); -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE( "IN MQueryHelper::OnQueryItem() Caller thread: %4d \n",m_oThreadID ); -#endif - nsresult rv; - PRInt32 resultType; - - if ( result == NULL ) { - OSL_TRACE("\tresult ptr is NULL\n"); - return NS_OK; - } - - // Get return status of executeQuery() call. - rv = result -> GetType(&resultType); - NS_ENSURE_SUCCESS(rv, rv); - - // Check for errors of the executeQuery() call. - switch ( resultType ) { - case nsIAbDirectoryQueryResult::queryResultError: - OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultError\n"); - m_bQueryComplete = sal_True; - m_bErrorCondition = sal_True; - notifyResultOrComplete(); - return NS_OK; - case nsIAbDirectoryQueryResult::queryResultStopped: - OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultStopped\n"); - m_bQueryComplete = sal_True; - notifyResultOrComplete(); - return NS_OK; - case nsIAbDirectoryQueryResult::queryResultComplete: - OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultComplete\n"); - m_bQueryComplete = sal_True; - notifyResultOrComplete(); - return NS_OK; - case nsIAbDirectoryQueryResult::queryResultMatch: - OSL_TRACE("IN MQueryHelper::OnQueryItem --> queryResultMatch\n"); - // Don't return, continues onto rest of method. - break; - default: - OSL_TRACE("\t******** Unexpected : resultType\n"); - m_bQueryComplete = sal_True; - return NS_OK; - } - - // Initialise an array that holds the resultset of the query. - nsCOMPtr<nsISupportsArray> properties; - rv = result -> GetResult(getter_AddRefs (properties)); - NS_ENSURE_SUCCESS(rv, rv); - - - nsCOMPtr<nsISupports> item; - rv = properties -> GetElementAt(0, getter_AddRefs(item)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr<nsIAbDirectoryQueryPropertyValue> property(do_QueryInterface(item, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - char *name; - rv = property -> GetName(&name); - NS_ENSURE_SUCCESS(rv, rv); - if ( !strcmp(name,"card:nsIAbCard") ) - { - nsCOMPtr<nsISupports> cardSupports; - property->GetValueISupports (getter_AddRefs (cardSupports)); - nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - getCardValues(card); - } - nsMemory::Free(name); - - OSL_TRACE( "\tOUT MQueryHelper::OnQueryItem()\n" ); - - notifyResultOrComplete(); - - return(NS_OK); -} - -// ----------------------------------------------------------------------------- -void MQueryHelper::notifyQueryError() -{ - m_bQueryComplete = sal_True ; - notifyResultOrComplete() ; -} - -const char * getAddrURI(const nsIAbDirectory* directory) -{ - nsresult retCode; - nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ; - if (NS_FAILED(retCode)) { return NULL; } - const char * uri; - retCode=rdfResource->GetValueConst(&uri); - if (NS_FAILED(retCode)) { return NULL; } - return uri; - } - -#define ENSURE_GETUPDATECARD(x) \ - if (NS_FAILED(retCode)) \ - { \ - OSL_TRACE( x ); \ - return card; \ - } -static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); - -//Some address book does not support query uri on card -//In this case, we can't resync the cards, we just return the old cards -nsIAbCard * getUpdatedCard( nsIAbCard* card) -{ - OSL_ENSURE(card != NULL, "getUpdatedCard for NULL"); - nsresult retCode; - nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)card, &retCode) ; - ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not support nsIRDFResource\n" ); - - const char * uri; - retCode=rdfResource->GetValueConst(&uri); - ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" ); - - nsCOMPtr<nsIRDFService> rdfService (do_GetService(kRDFServiceCID, &retCode)) ; - ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" ); - - nsCOMPtr<nsIRDFResource> rdfCard; - - retCode = rdfService->GetResource(nsDependentCString(uri), getter_AddRefs(rdfCard)) ; - ENSURE_GETUPDATECARD( "IN getUpdatedCard: Can not get the updated card\n" ); - - nsCOMPtr<nsIAbCard> aNewCard=do_QueryInterface((nsISupports *)rdfCard, &retCode); - ENSURE_GETUPDATECARD( "IN getUpdatedCard: Error in get new card\n" ); - - return aNewCard; - } - -#define ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory) \ - if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(NULL)) \ - { \ - m_aError.setResId( STR_MOZILLA_IS_RUNNIG_NO_CHANGES ); \ - return sal_False; \ - } - -sal_Int32 MQueryHelper::commitCard(const sal_Int32 rowIndex,nsIAbDirectory * directory) -{ - ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory); - - MQueryHelperResultEntry *resEntry = getByIndex(rowIndex); - if (!resEntry) - { - return sal_False; - } - nsIAbCard *card=resEntry->getCard(); - if (!card) - { - return sal_False; - } - nsresult rv; - PRBool hasCard; - rv = directory->HasCard(card,&hasCard); - if (setCardValues(rowIndex) != sal_True) - return sal_False; - - if (!NS_FAILED(rv) && hasCard) - { - rv = card->EditCardToDatabase(getAddrURI(directory)); - } - else - { - nsIAbCard *addedCard=NULL; - rv = directory->AddCard(card,&addedCard); - if (!NS_FAILED(rv)) - resEntry->setCard(addedCard); - } - //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process - if (rv == NS_ERROR_FILE_ACCESS_DENIED ) - m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB ); - - return !(NS_FAILED(rv)); -} - -sal_Int32 MQueryHelper::deleteCard(const sal_Int32 rowIndex,nsIAbDirectory * directory) -{ - ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory); - MQueryHelperResultEntry *resEntry = getByIndex(rowIndex); - if (!resEntry) - { - return sal_False; - } - nsIAbCard *card=resEntry->getCard(); - if (!card) - { - return sal_False; - } - nsresult rv; - PRBool hasCard; - if (resEntry->getRowStates() == RowStates_Inserted) - { - rv = 0; - hasCard = sal_True; - } - else - rv = directory->HasCard(card,&hasCard); - - if (!NS_FAILED(rv) && hasCard) - { - nsCOMPtr <nsISupportsArray> cardsToDelete; - rv = NS_NewISupportsArray(getter_AddRefs(cardsToDelete)); - if (NS_SUCCEEDED(rv)) - { - nsCOMPtr<nsISupports> supports = do_QueryInterface(card, &rv); - if (NS_SUCCEEDED(rv)) - { - rv = cardsToDelete->AppendElement(supports); - if (NS_SUCCEEDED(rv)) - rv = directory->DeleteCards(cardsToDelete); - } - } - } - - if (NS_SUCCEEDED(rv)) - resEntry->setRowStates(RowStates_Deleted); - //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process - if (rv == NS_ERROR_FILE_ACCESS_DENIED ) - m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB ); - return !(NS_FAILED(rv)); -} - -sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex) -{ - MQueryHelperResultEntry *resEntry = getByIndex(rowIndex); - if (!resEntry) - { - m_aError.setResId( STR_CANT_FIND_ROW ); - return sal_False; - } - nsIAbCard *card=resEntry->getCard(); - if (!card) - { - m_aError.setResId( STR_CANT_FIND_CARD_FOR_ROW ); - return sal_False; - } - - MLdapAttributeMap::fillCardFromResult( *card, *resEntry ); - return sal_True; -} - -void MQueryHelper::getCardValues(nsIAbCard *card,sal_Int32 rowIndex) -{ - MQueryHelperResultEntry *resEntry; - if (rowIndex>0) - { - resEntry = getByIndex(rowIndex); - } - else - resEntry = new MQueryHelperResultEntry(); - - MLdapAttributeMap::fillResultFromCard( *resEntry, *card ); - resEntry->setCard(card); - if (!rowIndex) - append( resEntry ); -} -sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex) -{ - - MQueryHelperResultEntry *resEntry = getByIndex(rowIndex); - if (!resEntry) - { - m_aError.setResId( STR_CANT_FIND_ROW ); - return sal_False; - } - nsIAbCard *card=resEntry->getCard(); - card = getUpdatedCard(card); - getCardValues(card,rowIndex); - return sal_True; -} -// ------------------------------------------------------------------------- -sal_Int32 MQueryHelper::createNewCard() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - nsresult rv; - nsCOMPtr <nsIAbCard> card = do_CreateInstance(NS_ABCARDPROPERTY_CONTRACTID, &rv); - //set default values - getCardValues(card); - return static_cast<sal_Int32>(m_aResults.size()); -} - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx deleted file mode 100644 index 9a29e74e7034..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _CONNECTIVITY_MAB_QUERYHELPER_HXX_ -#define _CONNECTIVITY_MAB_QUERYHELPER_HXX_ - -#include <MNSInclude.hxx> -#include "MErrorResource.hxx" -#include <sal/types.h> -#include <rtl/ustring.hxx> -#include <osl/mutex.hxx> -#include <osl/conditn.hxx> -#include <comphelper/stl_types.hxx> -#include <osl/thread.hxx> - -#include <hash_map> - -namespace connectivity -{ - namespace mozab - { - class MQueryHelperResultEntry - { - private: - typedef ::std::hash_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap; - - mutable ::osl::Mutex m_aMutex; - FieldMap m_Fields; - nsCOMPtr<nsIAbCard> m_Card; - sal_Int32 m_RowStates; - - public: - MQueryHelperResultEntry(); - ~MQueryHelperResultEntry(); - - void insert( const rtl::OString &key, rtl::OUString &value ); - rtl::OUString getValue( const rtl::OString &key ) const; - void setValue( const rtl::OString &key, const rtl::OUString & rValue); - - void setCard(nsIAbCard *card); - nsIAbCard *getCard(); - sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;}; - sal_Int32 getRowStates() { return m_RowStates;}; - }; - - class MQueryHelper : public nsIAbDirectoryQueryResultListener - { - private: - typedef std::vector< MQueryHelperResultEntry* > resultsArray; - - mutable ::osl::Mutex m_aMutex; - ::osl::Condition m_aCondition; - resultsArray m_aResults; - sal_Int32 m_nIndex; - sal_Bool m_bHasMore; - sal_Bool m_bAtEnd; - sal_Bool m_bErrorCondition; - sal_Bool m_bQueryComplete; - ErrorDescriptor m_aError; - - void append(MQueryHelperResultEntry* resEnt ); - - void clear_results(); - - void clearResultOrComplete(); - void notifyResultOrComplete(); - sal_Bool waitForResultOrComplete( ); - void getCardValues(nsIAbCard *card,sal_Int32 rowIndex=0); -#if OSL_DEBUG_LEVEL > 0 - oslThreadIdentifier m_oThreadID; -#endif - - public: - - NS_DECL_ISUPPORTS - NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER - - MQueryHelper(); - - virtual ~MQueryHelper(); - - void reset(); - - void rewind(); - - MQueryHelperResultEntry* next( ); - - MQueryHelperResultEntry* getByIndex( sal_uInt32 nRow ); - - const ErrorDescriptor& getError() const { return m_aError; } - - sal_Bool isError() const; - - sal_Bool hasMore() const; - - sal_Bool atEnd() const; - - sal_Bool queryComplete() const; - - sal_Bool waitForQueryComplete( ); - - sal_Bool waitForRow( sal_Int32 rowNum ); - - sal_Int32 getResultCount() const; - - sal_uInt32 getRealCount() const; - sal_Int32 createNewCard(); //return Row count number - sal_Bool resyncRow(sal_Int32 rowIndex); - - void notifyQueryError() ; - sal_Bool setCardValues(const sal_Int32 rowIndex); - sal_Int32 commitCard(const sal_Int32 rowIndex, nsIAbDirectory * directory); - sal_Int32 deleteCard(const sal_Int32 rowIndex, nsIAbDirectory * directory); - }; - } -} -#endif // _CONNECTIVITY_MAB_QUERYHELPER_HXX_ - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx deleted file mode 100644 index 4a17ebcd545b..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include <MNSInclude.hxx> -#include "MTypeConverter.hxx" -#include <ucbhelper/content.hxx> - -using namespace connectivity::mozab; - -// ------------------------------------------------------------------------- -void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss) -{ - // Convert to ::rtl::OString (utf-8 encoding). - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); - - const char *cs = os.getStr(); - PRUint32 csLen = os.getLength(); - - NS_ConvertUTF8toUCS2 mozString(cs, csLen); - //const PRUnichar* uniMozString = (const PRUnichar*) mozString; - nss = mozString; // temp. -} -// ------------------------------------------------------------------------- -::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source ) -{ - const char* buffer = _source.BeginReading(); - const char* bufferEnd = _source.EndReading(); - return ::rtl::OUString( buffer, static_cast<sal_Int32>(bufferEnd - buffer), RTL_TEXTENCODING_ASCII_US ); -} -// ------------------------------------------------------------------------- -::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source ) -{ - const char* buffer = _source.BeginReading(); - const char* bufferEnd = _source.EndReading(); - return ::rtl::OString( buffer, static_cast<sal_Int32>(bufferEnd - buffer) ); -} -// ------------------------------------------------------------------------- -void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest ) -{ - ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US ); - asciiToNsACString( sAsciiVersion.getStr(), _dest ); -} -// ------------------------------------------------------------------------- -void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest ) -{ - _dest.Truncate(); - _dest.AppendASCII( _asciiString ); -} -// ------------------------------------------------------------------------- -void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous) -{ - // Get clone of buffer. - PRUnichar *uc = ToNewUnicode(nss); - sal_Int32 nssLen = nss.Length(); - - // TODO check if this is ok. - // PRUnichar != sal_Unicode in mingw - ::rtl::OUString _ous(reinterpret_cast_mingw_only<sal_Unicode *>(uc), nssLen); - ous = _ous; - - nsMemory::Free(uc); -} -// ------------------------------------------------------------------------- -void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous) -{ - // TODO, specify length. - // PRUnichar != sal_Unicode in mingw - ::rtl::OUString _ous(reinterpret_cast_mingw_only<const sal_Unicode *>(pru)); - ous = _ous; -} -// ------------------------------------------------------------------------- -char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous) -{ - // Convert to ::rtl::OString, - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); - - const char *cs = os.getStr(); - - return(strdup(cs)); -} -// ------------------------------------------------------------------------- -char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous) -{ - // Convert ::rtl::OUString to ::rtl::OString, - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_ASCII_US); - - return(strdup(os.getStr())); -} -// ------------------------------------------------------------------------- -char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss) -{ - char cs[1024]; - nss.ToCString(cs, 1024); - - return(strdup(cs)); -} -// ------------------------------------------------------------------------- -::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous) -{ - // Convert ::rtl::OUString to ::rtl::OString. - ::rtl::OString os(ous,ous.getLength(),RTL_TEXTENCODING_ASCII_US); - return( ::std::string(os.getStr())); -} -#if 0 -// ------------------------------------------------------------------------- -::std::string MTypeConverter::nsStringToStlString(nsString const &nss) -{ - return( ::std::string(nss.GetBuffer())); -} -#endif -// ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx deleted file mode 100644 index 4a81a311a6bc..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - - -#ifndef _CONNECTIVITY_MAB_TYPECONVERTER_HXX_ -#define _CONNECTIVITY_MAB_TYPECONVERTER_HXX_ - -#include <rtl/ustring.hxx> - -#include<string> - -namespace connectivity -{ - namespace mozab - { - class MTypeConverter - { - public: - static void ouStringToNsString(const ::rtl::OUString&, nsString&); - static void nsStringToOUString(const nsString&, ::rtl::OUString&); - static void prUnicharToOUString(const PRUnichar*, ::rtl::OUString&); - // Use free() for the following 3 calls. - static char *ouStringToCCharStringAscii(const ::rtl::OUString&); - static char *nsStringToCCharStringAscii(const nsString&); - static char *ouStringToCCharStringUtf8(const ::rtl::OUString&); - // Convert to stl-string. - static ::std::string ouStringToStlString(const ::rtl::OUString&); - static ::std::string nsStringToStlString(const nsString&); - - static ::rtl::OUString nsACStringToOUString( const nsACString& _source ); - static ::rtl::OString nsACStringToOString( const nsACString& _source ); - static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest ); - static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest ); - - private: - MTypeConverter() {}; - }; - } -} - -#endif // _CONNECTIVITY_MAB_TYPECONVERTER_HXX_ - diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk deleted file mode 100644 index eb29b63a54bc..000000000000 --- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk +++ /dev/null @@ -1,73 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - -CALL_CDECL=TRUE - -#mozilla specific stuff. -MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) -MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla -#End of mozilla specific stuff. - -PRJ=..$/..$/..$/.. -PRJINC=..$/..$/.. -PRJNAME=connectivity -TARGET=mozabsrc - -# --- Settings ---------------------------------- - -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -.INCLUDE : settings.mk - -.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || "$(OS)" == "OS2" -dummy: - @echo " Not building the mozillasrc stuff in OpenOffice.org build" - @echo " dependency to Mozilla developer snapshots not feasable at the moment" - @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137" -.ELSE - -.INCLUDE : $(PRJ)$/version.mk - -.INCLUDE : ../makefile_mozab.mk - -INCPRE += -I../bootstrap - -# --- Files ------------------------------------- - -SLOFILES = \ - $(SLO)$/MQueryHelper.obj \ - $(SLO)$/MDatabaseMetaDataHelper.obj \ - $(SLO)$/MQuery.obj \ - $(SLO)$/MTypeConverter.obj \ - $(SLO)$/MNameMapper.obj \ - $(SLO)$/MNSMozabProxy.obj \ - $(SLO)$/MNSTerminateListener.obj \ - $(SLO)$/MLdapAttributeMap.obj \ - -.ENDIF - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h deleted file mode 100644 index 43836455c7b0..000000000000 --- a/connectivity/source/drivers/mozab/post_include_mozilla.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#if defined __SUNPRO_CC -#pragma enable_warn -#elif defined _MSC_VER -#pragma warning(pop) -#endif - -#ifdef MOZ_BOOL -# undef BOOL -# undef Bool -#endif - -#ifdef DEBUG_WAS_DEFINED - #define DEBUG DEBUG_WAS_DEFINED -#endif - -#ifdef _DEBUG_WAS_DEFINED - #define _DEBUG _DEBUG_WAS_DEFINED -#endif - -#ifndef _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_ -#define _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_ - -#ifdef __cplusplus -#ifdef __MINGW32__ -template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return reinterpret_cast<T1>(p); } -#else -template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return p; } -#endif -#endif - -#endif diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h deleted file mode 100644 index bfeaa7608e24..000000000000 --- a/connectivity/source/drivers/mozab/pre_include_mozilla.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// Turn off DEBUG Assertions -#ifdef _DEBUG - #define _DEBUG_WAS_DEFINED _DEBUG - #ifndef MOZILLA_ENABLE_DEBUG - #undef _DEBUG - #endif -#else - #undef _DEBUG_WAS_DEFINED - #ifdef MOZILLA_ENABLE_DEBUG - #define _DEBUG 1 - #endif -#endif - -// and turn off the additional virtual methods which are part of some interfaces when compiled -// with debug -#ifdef DEBUG - #define DEBUG_WAS_DEFINED DEBUG - #ifndef MOZILLA_ENABLE_DEBUG - #undef DEBUG - #endif -#else - #undef DEBUG_WAS_DEFINED - #ifdef MOZILLA_ENABLE_DEBUG - #define DEBUG 1 - #endif -#endif - -#if defined __GNUC__ - #pragma GCC system_header -#elif defined __SUNPRO_CC - #pragma disable_warn -#elif defined _MSC_VER - #pragma warning(push, 1) - #pragma warning(disable:4946 4710) -#endif - diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src index dd2b0ec824dd..8009f629b643 100644 --- a/connectivity/source/resource/conn_shared_res.src +++ b/connectivity/source/resource/conn_shared_res.src @@ -123,7 +123,7 @@ String STR_STMT_TYPE_NOT_SUPPORTED String STR_UNSPECIFIED_ERROR { - Text [ en-US ] = "An unknown error occured."; + Text [ en-US ] = "An unknown error occurred."; }; String STR_COULD_NOT_CREATE_ADDRESSBOOK @@ -138,12 +138,12 @@ String STR_COULD_NOT_LOAD_LIB String STR_ERROR_REFRESH_ROW { - Text [ en-US ] = "An error occured while refreshing the current row."; + Text [ en-US ] = "An error occurred while refreshing the current row."; }; String STR_ERROR_GET_ROW { - Text [ en-US ] = "An error occured while getting the current row."; + Text [ en-US ] = "An error occurred while getting the current row."; }; String STR_CAN_NOT_CANCEL_ROW_UPDATE @@ -163,7 +163,7 @@ String STR_QUERY_INVALID_IS_NULL_COLUMN String STR_ILLEGAL_MOVEMENT { - Text [ en-US ] = "Illegal cursor movement occured."; + Text [ en-US ] = "Illegal cursor movement occurred."; }; String STR_COMMIT_ROW @@ -375,7 +375,7 @@ String STR_NO_CONNECTION // dbase String STR_COULD_NOT_DELETE_INDEX { - Text [ en-US ] = "The index could not be deleted. An unknown error while accessing the file system occured."; + Text [ en-US ] = "The index could not be deleted. An unknown error while accessing the file system occurred."; }; String STR_ONL_ONE_COLUMN_PER_INDEX { @@ -620,11 +620,11 @@ String STR_INVALID_FILE_URL }; String STR_NO_TABLE_CONTAINER { - Text [ en-US ] = "An error occured while obtaining the connection's table container."; + Text [ en-US ] = "An error occurred while obtaining the connection's table container."; }; String STR_NO_TABLE_EDITOR_DIALOG { - Text [ en-US ] = "An error occured while creating the table editor dialog."; + Text [ en-US ] = "An error occurred while creating the table editor dialog."; }; String STR_NO_TABLENAME { diff --git a/connectivity/version.mk b/connectivity/version.mk index cfc81adede56..04cec0a400ac 100644 --- a/connectivity/version.mk +++ b/connectivity/version.mk @@ -69,23 +69,10 @@ DBPOOL_MICRO=0 # target DBASE_TARGET=dbase -# ----------------------------MOZAB settings-----------------------------------# -# the major -MOZAB_MAJOR=2 -# the minor -MOZAB_MINOR=0 -# the micro -MOZAB_MICRO=0 - # ----------------------------MySQL settings-----------------------------------# # target MYSQL_TARGET=mysql - -# ----------------------------Evoab settings-----------------------------------# -# target -EVOAB_TARGET=evoab - # ----------------------------Kab settings-------------------------------------# # target KAB_TARGET=kab diff --git a/connectivity/workben/testmoz/initUNO.cxx b/connectivity/workben/testmoz/initUNO.cxx deleted file mode 100644 index 97517b9a98b5..000000000000 --- a/connectivity/workben/testmoz/initUNO.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "rtl/bootstrap.hxx" -#include "cppuhelper/bootstrap.hxx" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -using namespace cppu; -using namespace com::sun::star::lang; -using namespace com::sun::star; -using namespace com::sun::star::uno; - -Reference< XMultiServiceFactory > InitializeFac( void ) -{ - Reference<XComponentContext> xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); - Reference<XMultiServiceFactory> xMS(xComponentContext->getServiceManager(), UNO_QUERY); - return xMS; -} diff --git a/connectivity/workben/testmoz/main.cxx b/connectivity/workben/testmoz/main.cxx deleted file mode 100644 index 30c79df89dc2..000000000000 --- a/connectivity/workben/testmoz/main.cxx +++ /dev/null @@ -1,720 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <connectivity/sqlparse.hxx> -#include "connectivity/sqliterator.hxx" -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/XResultSetMetaData.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/PropertyState.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <unotools/processfactory.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/sdbc/XDriver.hpp> -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <com/sun/star/sdbc/XRowUpdate.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#include <com/sun/star/sdbc/XCloseable.hpp> -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#include <com/sun/star/uno/Any.hxx> - -#include "connectivity/sqlnode.hxx" -#include <ucbhelper/contentbroker.hxx> -#include <comphelper/regpathhelper.hxx> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <osl/process.h> - -#include <cppuhelper/bootstrap.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/registry/XImplementationRegistration.hpp> -#include <com/sun/star/ucb/XContentProviderManager.hpp> - -#include <ucbhelper/content.hxx> -#include <osl/module.h> -#include <tools/config.hxx> - -#include <stdio.h> - -using namespace comphelper; -using namespace cppu; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace com::sun::star::ucb; -using namespace com::sun::star::beans; - -//using namespace com::sun::star; -using namespace connectivity; -using namespace com::sun::star::sdb; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace ::com::sun::star::container; -using namespace com::sun::star::registry; - -#define OUtoCStr( x ) (OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US ).getStr()) -Reference< XContentProviderManager > globalUcb; -#define PRINTSTR(x) printf("%s",x); - -int autoTest(Reference<XResultSet> &xRes); - -void printColumns( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) { - char* aPat = " %-22s "; - char* aPat_Short = " %-12s "; - Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData(); - printf( "ColumnCount = %d\n", xMeta->getColumnCount()); - for(sal_Int32 i=1;i<=xMeta->getColumnCount();++i) - { - // printf(aPat.getStr(), xMeta->getColumnName(i).getStr()); - const char *str = OUtoCStr(xMeta->getColumnName(i)); -// if ( i < 3 ) { -// printf( aPat_Short, str ); -// } else { - printf( aPat, str ); -// } - } - printf("\n"); - printf("------------------------------------------------------------------------------------------\n"); - } else { - printf(": FAILED to get a ResultSet \n"); - } -} -void printXResultSet( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) { - char* aPat = " %-22s "; - char* aPat_Short = " %-12s "; - Reference<XRow> xRow(xRes,UNO_QUERY); - Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData(); - for(sal_Int32 j=1;j<=xMeta->getColumnCount();++j) - { - try { - const char *str = OUtoCStr(xRow->getString(j)); -// if ( j < 3 ) { -// printf( aPat_Short, str ); -// } else { - printf( aPat_Short, str ); -// } - } catch (...) { - printf(" Ex "); - } - } - printf("\n"); - } else { - printf(": FAILED to get a ResultSet \n"); - } -} - -void printXResultSets( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) { - printColumns(xRes); - sal_Int32 nRows = 0; - while( xRes.is() && xRes->next()) - { - printXResultSet(xRes); - nRows++; - } - printf( "%d Row(s)\n", nRows); - } else { - printf(": FAILED to get a ResultSet \n"); - } -} - -//#define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -static const char * const components[] = -{ - SAL_MODULENAME( "ucb1" ) // KSO, ABI - , SAL_MODULENAME( "ucpfile1" ) - , SAL_MODULENAME( "cfgmgr2" ) - , "sax.uno" SAL_DLLEXTENSION - , "stocservices.uno" SAL_DLLEXTENSION - , SAL_MODULENAME( "fileacc" ) - , SAL_MODULENAME( "mcnttype" ) //Clipboard Ask Oliver Braun - , "i18npool.uno" SAL_DLLEXTENSION - // Reading of files in specific encodings like UTF-8 using - // createUnoService( "com.sun.star.io.TextInputStream" ) and such - , "textinstream.uno" SAL_DLLEXTENSION - , "textoutstream.uno" SAL_DLLEXTENSION - , "introspection.uno" SAL_DLLEXTENSION - , "corereflection.uno" SAL_DLLEXTENSION - // RemoteUno - , "connector.uno" SAL_DLLEXTENSION - , "bridgefac.uno" SAL_DLLEXTENSION - , "remotebridge.uno" SAL_DLLEXTENSION - , "dbtools2" SAL_DLLEXTENSION - , "mozab2" SAL_DLLEXTENSION - , "mozabdrv2" SAL_DLLEXTENSION - , "sdbc2" SAL_DLLEXTENSION - , "dbpool2" SAL_DLLEXTENSION -#ifdef SAL_UNX - , SVLIBRARY( "dtransX11" ) // OBR -#endif -#ifdef SAL_W32 - , SAL_MODULENAME( "sysdtrans" ) - , SAL_MODULENAME( "ftransl" ) - , SAL_MODULENAME( "dnd" ) -#endif - , 0 -}; - -Reference< XMultiServiceFactory > InitializeFac( void ) -{ - OUString path; - if( osl_Process_E_None != osl_getExecutableFile( (rtl_uString**)&path ) ) - { - printf("Exit.\n"); - exit( 1 ); - } - OSL_ASSERT( path.lastIndexOf( '/' ) >= 0 ); - - - ::rtl::OUStringBuffer bufServices( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); - bufServices.appendAscii("services.rdb"); - OUString services = bufServices.makeStringAndClear(); - - ::rtl::OUStringBuffer bufTypes( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); - bufTypes.appendAscii("types.rdb"); - OUString types = bufTypes.makeStringAndClear(); - - printf("Create Registry.\n"); - - Reference< XMultiServiceFactory > xSMgr; - try - { - xSMgr = createRegistryServiceFactory( types, services, sal_True ); - } - catch( com::sun::star::uno::Exception & ) - { - try - { - { - Reference< XMultiServiceFactory > interimSmgr = - createRegistryServiceFactory( types, sal_True ); - Reference< XImplementationRegistration > xIR( - interimSmgr->createInstance( - OUString::createFromAscii( - "com.sun.star.registry.ImplementationRegistration" ) ), UNO_QUERY ); - - Reference< XSimpleRegistry > xReg( - interimSmgr->createInstance( - OUString::createFromAscii( - "com.sun.star.registry.SimpleRegistry" ) ), UNO_QUERY ); - if ( xReg.is() ) - { - xReg->open(services, sal_False, sal_True); - if ( xReg->isValid() ) - { - OUString loader( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.loader.SharedLibrary" )); - for( sal_Int32 i = 0; components[i] ; i ++ ) - { - printf("Registering %s ... ", components[i]); - xIR->registerImplementation( - loader, OUString::createFromAscii(components[i]),xReg); - printf("done\n"); - } - xReg->close(); - } else - { - printf("Cannot open Registry. Terminating Program\n"); - exit (1); - } - } - - Reference< XComponent > xComp( interimSmgr, UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); - } - - // now try it again readonly - printf("Opening Registry readonly\n"); - xSMgr = createRegistryServiceFactory( types, services, sal_True ); - } - catch( com::sun::star::uno::Exception & exc ) - { - fprintf( stderr, "Couldn't bootstrap uno servicemanager for reason : %s\n" , - OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - } - } - - printf("set global factory.\n"); - - ////////////////////////////////////////////////////////////////////// - // set global factory - setProcessServiceFactory( xSMgr ); - -/* // Create simple ConfigManager - Sequence< Any > aConfArgs(3); - aConfArgs[0] <<= PropertyValue( OUString::createFromAscii("servertype"), 0, makeAny( OUString::createFromAscii("local") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE ); - aConfArgs[1] <<= PropertyValue( OUString::createFromAscii("sourcepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE ); - aConfArgs[2] <<= PropertyValue( OUString::createFromAscii("updatepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE ); - - Reference< XContentProvider > xConfProvider - ( xSMgr->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), aConfArgs), UNO_QUERY ); -*/ - - -// Create unconfigured Ucb: -/* Sequence< Any > aArgs(1); - aArgs[1] = makeAny ( xConfProvider );*/ - Sequence< Any > aArgs; - ::ucb::ContentBroker::initialize( xSMgr, aArgs ); - Reference< XContentProviderManager > xUcb = - ucb::ContentBroker::get()->getContentProviderManagerInterface(); - - Reference< XContentProvider > xFileProvider - ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY ); - xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True ); - - -/* Reference< XContentProvider > xPackageProvider - ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.PackageContentProvider" ) ), UNO_QUERY ); - xUcb->registerContentProvider( xPackageProvider, OUString::createFromAscii( "vnd.sun.star.pkg" ), sal_True ); - */ - globalUcb = xUcb; - return xSMgr; -} - -int TestMetaData(Reference< ::com::sun::star::sdbc::XConnection> &pConnection) -{ - // Test some metadata - Reference< XDatabaseMetaData > xDmd = pConnection->getMetaData(); - if ( xDmd.is() ) { - printf(": got DatabaseMetaData \n"); - - OUString sQuoteStr = xDmd->getIdentifierQuoteString(); - printf( "Quote String : '%s'\n", OUtoCStr( sQuoteStr ) ); - - OUString sSQLCmds = xDmd->getSQLKeywords(); - printf( "SQL Commands : '%s'\n", OUtoCStr( sSQLCmds ) ); - - printf("Testing getColumns() : START\n"); - { - Reference<XResultSet> xRes = xDmd->getColumns( - makeAny(OUString::createFromAscii("")), // Catalog - OUString::createFromAscii("%"), // Schema - OUString::createFromAscii("%"), // TabName - OUString::createFromAscii("%") - ); - printXResultSets( xRes ); - } - printf("Testing getColumns() : END\n"); - - printf("Testing getTypeInfo() : START\n"); - { - Reference<XResultSet> xRes = xDmd-> getTypeInfo(); - printXResultSets( xRes ); - } - printf("Testing getTypeInfo() : END\n"); - - printf("Testing getTables() : START\n"); - { - Reference<XResultSet> xRes = xDmd->getTables( - makeAny(OUString::createFromAscii("")), // Catalog - OUString::createFromAscii("%"), // Schema - OUString::createFromAscii("%"), // TabName - Sequence<rtl::OUString>() - ); - printXResultSets( xRes ); - } - printf("Testing getTables() : END\n"); - - } else { - printf(": FAILED to get DatabaseMetaData \n"); - } - - return 0; -} -int TestBookMark(Reference<XResultSet> &xRes); -int TestRowUpdate(Reference<XResultSet> &xRes); - -Reference<XResultSet> TestQuery(Reference< ::com::sun::star::sdbc::XConnection> &pConnection,sal_Int32 choice) -{ - // Try a query - printf("Testing createStatement() & executeQuery() : START\n"); - Reference<XStatement> xStmt = pConnection->createStatement(); - Reference<XResultSet> xRes; - if(xStmt.is()) - { - printf(": got statement\n"); - printf(": excuteQuery() : START \n"); -// SELECT "First Name", "Display Name", "E-mail" FROM "addr" "addr" - char sql[256]="SELECT \"First Name\", \"Display Name\", \"E-mail\" FROM \"addr\""; - if (choice!=-1) - { - printf("Please input a query,end by \";\" and less then 256 char plz:\n"); - char ch=0; - int index=0; - while (ch != ';') - { - scanf("%c",&ch); - sql[index++] = ch; - } - sql[index]= 0; - printf("SQL:%s\n",sql); - } - try - { - sal_Int32 times=0; - for (times = 0;times< 100;times ++) - { - Reference<XResultSet> tmpRes = - //xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM \"addr\"")); - xStmt->executeQuery(OUString::createFromAscii(sql)); - // xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM \"Personal Address Book\" WHERE ( PrimaryEmail IS NULL )")); - // xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM \"Personal Address Book\" WHERE ( PrimaryEmail LIKE \"Darren\" )")); - // xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM \"Personal Address Book\"")); - // xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM \"myldap\" WHERE ( PrimaryEmail LIKE \"%Darren%\" OR DisplayName LIKE \"%Darren%\" )")); - - autoTest( tmpRes ); - Reference<XCloseable> clsRes(tmpRes,UNO_QUERY); - clsRes->close(); - printf("Current Times:%d\n",times); - } - TestBookMark(xRes); - TestRowUpdate(xRes); - } catch ( Exception &e ) { - printf( "Exception caught : %s\n", OUtoCStr( e.Message) ); - } catch (...) { - printf( "Non-UNO Exception caught\n" ); - } - printf(": excuteQuery() : END \n"); - } - else - { - printf(": FAILED to get statement\n"); - } - printf("Testing createStatement() & executeQuery() : END\n"); - return xRes; -} -Reference< ::com::sun::star::sdbc::XConnection> TestConnected - (Reference< ::com::sun::star::sdbc::XDriver> &pDriver,sal_Int32 choice) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> pConnection; - printf("Begin Connect!\n"); - OUString url; - Sequence<PropertyValue> aValue; - - switch (choice) - { - case -1: - case 1: //mozilla - url=OUString::createFromAscii("sdbc:address:mozilla://"); - break; - case 2: - url=OUString::createFromAscii("sdbc:address:ldap://"); - char hostname[40],basedn[40]; - scanf("%s %s",hostname,basedn); - aValue.realloc(2); - aValue[0].Name = ::rtl::OUString::createFromAscii("HostName"); - aValue[0].Value <<= rtl::OUString::createFromAscii(hostname); - aValue[1].Name = ::rtl::OUString::createFromAscii("BaseDN"); - aValue[1].Value <<= rtl::OUString::createFromAscii(basedn); - break; - case 3: - case 4: - break; - case 5: - //Default LDAP AB - url=OUString::createFromAscii("sdbc:address:ldap://"); - aValue.realloc(2); - aValue[0].Name = ::rtl::OUString::createFromAscii("HostName"); - aValue[0].Value <<= rtl::OUString::createFromAscii("sun-ds"); - aValue[1].Name = ::rtl::OUString::createFromAscii("BaseDN"); - aValue[1].Value <<= rtl::OUString::createFromAscii("dc=sun,dc=com"); - break; - default: - return pConnection; - break; - } - pConnection = - pDriver->connect(url,aValue); - return pConnection; - } - -void menuBookmark() -{ - PRINTSTR("0 Exit\n") - PRINTSTR("1 Show Max rowcount\n") - PRINTSTR("2 Move First\n") - PRINTSTR("3 Record bookmark 1\n") - PRINTSTR("4 Record bookmark 2\n") - PRINTSTR("5 Move to bookmark. Usage: 5 bookid\n") - PRINTSTR("6 moveRelativeToBookmark, follow bookid rows plz\n") - PRINTSTR("7 compareBookmark\n") - PRINTSTR("8 print boomark hash. Usage: 8 bookid\n") - PRINTSTR("9 print current row\n") - PRINTSTR("10 Auto test\n") - - PRINTSTR("Please Input you choice:") -} -int autoTest(Reference<XResultSet> &xRes) -{ - sal_Int32 nRows = 0; - printColumns(xRes); - if(xRes.is()) { - while( xRes.is() && xRes->next()) - { - nRows++; - } - printf( "%d Row(s)\n", nRows); - sal_Int32 times; - sal_Int32 pos; - for(times = 1;times < 100; times ++) - { - pos= rand() % nRows+1; - printf("pos:%d\n",pos); - xRes->absolute(pos); - printXResultSet(xRes); - } - } else { - printf(": FAILED to get a ResultSet \n"); - } - return 0; -} -int TestBookMark(Reference<XResultSet> &xRes) -{ - Reference<XResultSet> mRes(xRes); - if (!mRes.is() || !mRes->first()) - { - return sal_False; - } - - Reference<XRow> mRow(xRes,UNO_QUERY); - Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(mRes,UNO_QUERY)->getMetaData(); - printXResultSet(mRes); - Reference< ::com::sun::star::sdbcx::XRowLocate> xRowLocate(xRes, UNO_QUERY); - ::com::sun::star::uno::Any xBookMark[2]; - int index; - if (xRowLocate.is()) - { - int choice=-1; - while (choice) - { - menuBookmark(); - - scanf("%d",&choice); - printf("Your choice is:%d\n",choice); - switch (choice) - { - case 1: - printf("Rowcount:Current don't know\n"); - break; - case 2: - if (!mRes->isFirst()) mRes->first(); - break; - case 3: - xBookMark[0] = xRowLocate->getBookmark(); - break; - case 4: - xBookMark[1] = xRowLocate->getBookmark(); - break; - case 5: - scanf("%d",&index); - if (index == 1 || index == 2) - xRowLocate->moveToBookmark(xBookMark[index-1]); - break; - case 6: - int rows; - scanf("%d %d",&index,&rows); - if (index == 1 || index == 2) - xRowLocate->moveRelativeToBookmark(xBookMark[index-1],rows); - break; - case 7: - printf("compareBookmarks:%d\n",xRowLocate->compareBookmarks(xBookMark[0],xBookMark[1])); - break; - case 8: - scanf("%d",&index); - printf("HashBookmark[%d]:%d\n",index,xRowLocate->hashBookmark(xBookMark[index-1])); - break; - case 9: - printXResultSet(mRes); - break; - case 10: - autoTest(mRes); - break; - default: - break; - } - } - } - return 0; -} -void menuRowUpdate() -{ - PRINTSTR("0 Exit\n") - PRINTSTR("1 Print Columns\n") - PRINTSTR("2 Move to row. Usage:2 rowid\n") - PRINTSTR("3 Print Row values\n") - PRINTSTR("4 Change Column Value: 4 columnid newvalue\n") - PRINTSTR("5 Commit changes\n") - PRINTSTR("6 Delete Current Row\n") - PRINTSTR("Please Input Your choice:") -} -int TestRowUpdate(Reference<XResultSet> &xRes) -{ - if (!xRes.is() || !xRes->first()) - { - return sal_False; - } - printf("Test XRowUpdate START\n"); - Reference< ::com::sun::star::sdbc::XRowUpdate> xRowUpdate(xRes, UNO_QUERY); - Reference< ::com::sun::star::sdbc::XResultSetUpdate> xResultSetUpdate(xRes, UNO_QUERY); - int index; - if (xRowUpdate.is()) - { - int choice=-1; - char newString[256]; - while (choice) - { - menuRowUpdate(); - - scanf("%d",&choice); - printf("Your choice is:%d\n",choice); - switch (choice) - { - case 1: - printColumns(xRes); - break; - case 2: - scanf("%d",&index); - xRes->absolute(index); - break; - case 3: - printXResultSet(xRes); - break; - case 4: - scanf("%d %s",&index,newString); - xRowUpdate->updateString(index,OUString::createFromAscii(newString)); - printXResultSet(xRes); - break; - case 5: - if (xResultSetUpdate.is()) - { - xResultSetUpdate->updateRow(); - printXResultSet(xRes); - } - else - printf("Can't update!\n"); - break; - case 6: - if (xResultSetUpdate.is()) - { - xResultSetUpdate->deleteRow(); - printXResultSet(xRes); - } - else - printf("Can't update!\n"); - break; - - default: - break; - } - } - } - printf("Test XRowUpdate END\n"); - return 0; -} - -void menuMain() -{ - PRINTSTR("0 Exit\n") - PRINTSTR("1 Open Mozilla Address Book\n") - PRINTSTR("2 Open LDAP. Pleae follow hostname and base dn.\n") - PRINTSTR("3 Open Outlook Address Book\n") - PRINTSTR("4 Open OE Address Book\n") - PRINTSTR("Please Input your choice:") -} -#if (defined UNX) || (defined OS2) -int main( int argc, char * argv[] ) -#else -int _cdecl main( int argc, char * argv[] ) -#endif - -{ - Reference< XMultiServiceFactory > xMgr = InitializeFac(); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; - try - { - Reference< ::com::sun::star::sdbc::XDriver> - m_xDriver(xMgr->createInstance( - OUString::createFromAscii("com.sun.star.comp.sdbc.MozabDriver")), - UNO_QUERY); - if(m_xDriver.is()) - { - int choice=-1; - if (argc > 1 ) - { - menuMain(); - scanf("%d",&choice); - } - - while (choice) - { - - m_xConnection = TestConnected(m_xDriver,choice); - if(m_xConnection.is()) - { - if (!TestMetaData(m_xConnection)) - { - Reference<XResultSet> xRes=TestQuery(m_xConnection,choice); - if (xRes.is()) - { - } - } - }else printf("Can't connected!\n"); - - if (argc > 1) - { - menuMain(); - scanf("%d",&choice); - } - else - choice = 0; - - } - } else { - printf("No driver!\n"); - } - } - catch(...) - { - printf("Exception thrown!\n"); - } - printf("Exiting...\n"); - return 0; -} - diff --git a/connectivity/workben/testmoz/makefile.mk b/connectivity/workben/testmoz/makefile.mk deleted file mode 100644 index 1e9afc8354cc..000000000000 --- a/connectivity/workben/testmoz/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=..$/.. - -PRJNAME=connectivity -TARGET=testmoz -TARGETTYPE=CUI -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -OBJFILES= $(OBJ)$/main.obj - - -APPSTDLIBS=$(SALLIB) \ - $(VOSLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(UCBHELPERLIB) \ - $(DBTOOLSLIB) \ - $(COMPHELPERLIB) - - -# ... cfgapi .............................. - -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJFILES) -APP1STDLIBS = $(APPSTDLIBS) - - - -APP2TARGET = mozThread -APP2OBJS = $(OBJ)$/initUNO.obj \ - $(OBJ)$/mozthread.obj - -APP2STDLIBS = $(APPSTDLIBS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/connectivity/workben/testmoz/mozthread.cxx b/connectivity/workben/testmoz/mozthread.cxx deleted file mode 100644 index 73d44eef6001..000000000000 --- a/connectivity/workben/testmoz/mozthread.cxx +++ /dev/null @@ -1,473 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <connectivity/sqlparse.hxx> -#include "connectivity/sqliterator.hxx" -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/XResultSetMetaData.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/PropertyState.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <unotools/processfactory.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/sdbc/XDriver.hpp> -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <com/sun/star/sdbc/XRowUpdate.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#include <com/sun/star/sdbc/XCloseable.hpp> -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#include <com/sun/star/uno/Any.hxx> - -#include "connectivity/sqlnode.hxx" -#include <ucbhelper/contentbroker.hxx> -#include <comphelper/regpathhelper.hxx> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <osl/process.h> - -#include <cppuhelper/bootstrap.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/registry/XImplementationRegistration.hpp> -#include <com/sun/star/ucb/XContentProviderManager.hpp> - -#include <ucbhelper/content.hxx> -#include <osl/module.h> -#include <tools/config.hxx> - -#include <stdio.h> -#include <osl/thread.hxx> -#include <osl/diagnose.h> -#include <osl/conditn.hxx> -#include <time.h> - - -using namespace comphelper; -using namespace cppu; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace com::sun::star::ucb; -using namespace com::sun::star::beans; - -//using namespace com::sun::star; -using namespace connectivity; -using namespace com::sun::star::sdb; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace ::com::sun::star::container; -using namespace com::sun::star::registry; - -extern Reference< XMultiServiceFactory > InitializeFac( void ); -Reference< XMultiServiceFactory > mMgr; - -#define OUtoCStr( x ) (OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US ).getStr()) -#define PRINTSTR(x) printf("%s",x); -#define PRINTLN(x) printf("%s\n",x); - -const int testLDAP=0; -const int testMozilla=1; -const int testOp=2; -const int testOe=3; - -static int testCount = 0; -static int testList[4] = {0,0,0,0}; - -int autoTest(Reference<XResultSet> &xRes); - -void printColumns( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) - { - char* aPat = " %-22s "; - char* aPat_Short = " %-12s "; - Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData(); - OSL_TRACE( "ColumnCount = %d\n", xMeta->getColumnCount()); - for(sal_Int32 i=1;i<=xMeta->getColumnCount();++i) - { - const char *str = OUtoCStr(xMeta->getColumnName(i)); - OSL_TRACE( aPat, str ); - } - OSL_TRACE("\n"); - OSL_TRACE("------------------------------------------------------------------------------------------\n"); - } - else - { - OSL_TRACE(": FAILED to get a ResultSet \n"); - } -} -void printXResultSet( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) - { - char* aPat = " %-22s "; - char* aPat_Short = " %-12s "; - Reference<XRow> xRow(xRes,UNO_QUERY); - Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData(); - for(sal_Int32 j=1;j<=xMeta->getColumnCount();++j) - { - try - { - const char *str = OUtoCStr(xRow->getString(j)); - OSL_TRACE( aPat_Short, str ); - } catch (...) { - OSL_TRACE(" Ex "); - } - } - OSL_TRACE("\n"); - } - else - OSL_TRACE("FAILED to get a ResultSet \n"); -} - -void printXResultSets( Reference<XResultSet> &xRes ) -{ - if(xRes.is()) - { - printColumns(xRes); - sal_Int32 nRows = 0; - while( xRes.is() && xRes->next()) - { - printXResultSet(xRes); - nRows++; - } - OSL_TRACE( "%d Row(s)\n", nRows); - }else - OSL_TRACE("FAILED to get a ResultSet \n"); -} - - - -int TestMetaData(Reference< ::com::sun::star::sdbc::XConnection> &pConnection) -{ - // Test some metadata - Reference< XDatabaseMetaData > xDmd = pConnection->getMetaData(); - if ( xDmd.is() ) - { - OSL_TRACE(": got DatabaseMetaData \n"); - - OUString sQuoteStr = xDmd->getIdentifierQuoteString(); - OSL_TRACE( "Quote String : '%s'\n", OUtoCStr( sQuoteStr ) ); - - OUString sSQLCmds = xDmd->getSQLKeywords(); - OSL_TRACE( "SQL Commands : '%s'\n", OUtoCStr( sSQLCmds ) ); - - OSL_TRACE("Testing getColumns() : START\n"); - { - Reference<XResultSet> xRes = xDmd->getColumns( - makeAny(OUString::createFromAscii("")), // Catalog - OUString::createFromAscii("%"), // Schema - OUString::createFromAscii("%"), // TabName - OUString::createFromAscii("%") - ); - printXResultSets( xRes ); - } - OSL_TRACE("Testing getColumns() : END\n"); - - OSL_TRACE("Testing getTypeInfo() : START\n"); - { - Reference<XResultSet> xRes = xDmd-> getTypeInfo(); - printXResultSets( xRes ); - } - OSL_TRACE("Testing getTypeInfo() : END\n"); - - OSL_TRACE("Testing getTables() : START\n"); - { - Reference<XResultSet> xRes = xDmd->getTables( - makeAny(OUString::createFromAscii("")), // Catalog - OUString::createFromAscii("%"), // Schema - OUString::createFromAscii("%"), // TabName - Sequence<rtl::OUString>() ); - printXResultSets( xRes ); - } - OSL_TRACE("Testing getTables() : END\n"); - - } - else - OSL_TRACE(": FAILED to get DatabaseMetaData \n"); - return 0; -} - -void TestQuery(Reference< ::com::sun::star::sdbc::XConnection> &pConnection) -{ - // Try a query - OSL_TRACE("Testing createStatement() & executeQuery() : START\n"); - Reference<XStatement> xStmt = pConnection->createStatement(); - Reference<XResultSet> xRes; - if(xStmt.is()) - { - OSL_TRACE(": got statement\n"); - OSL_TRACE(": excuteQuery() : START \n"); -// SELECT "First Name", "Display Name", "E-mail" FROM tablename - OUString sqlPrefix= OUString::createFromAscii("SELECT \"First Name\", \"Display Name\", \"E-mail\" FROM "); - try - { - sal_Int32 times=0; - Reference< XDatabaseMetaData > xDmd = pConnection->getMetaData(); - if ( xDmd.is() ) - { - OSL_TRACE("getTables() : START\n"); - OUString qut = xDmd->getIdentifierQuoteString(); - - Reference<XResultSet> xRes = xDmd->getTables( - makeAny(OUString::createFromAscii("")), // Catalog - OUString::createFromAscii("%"), // Schema - OUString::createFromAscii("%"), // TabName - Sequence<rtl::OUString>() ); - sal_Int32 nTables = 0; - while( xRes.is() && xRes->next()) - { - Reference<XRow> xRow(xRes,UNO_QUERY); - const char *strTableName = OUtoCStr(xRow->getString(3)); - OSL_TRACE("Testing Table:%s\n",strTableName); - - Reference<XResultSet> tmpRes = - xStmt->executeQuery(sqlPrefix + qut + xRow->getString(3) + qut); - autoTest( tmpRes ); - Reference<XCloseable> clsRes(tmpRes,UNO_QUERY); - clsRes->close(); - nTables++; - } - OSL_TRACE("Tested Tables:%d\n",nTables); - } - } catch ( Exception &e ) { - OSL_TRACE( "Exception caught : %s\n", OUtoCStr( e.Message) ); - } -// catch (...) { -// OSL_TRACE( "Non-UNO Exception caught\n" ); -// } - OSL_TRACE("excuteQuery() : END \n"); - } - else - { - OSL_TRACE(": FAILED to get statement\n"); - } - OSL_TRACE("Testing createStatement() & executeQuery() : END\n"); -} -Reference< ::com::sun::star::sdbc::XConnection> TestConnected - (Reference< ::com::sun::star::sdbc::XDriver> &pDriver) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> pConnection; - OSL_TRACE("Begin Connect!\n"); - OUString url; - Sequence<PropertyValue> aValue; - int nType=0; - srand( (unsigned)time( NULL ) ); - nType = rand() % testCount + 1; - int nIndex=0,nCount=0; - for ( nIndex = 0; nIndex< 4;nIndex++) - { - if (testList[nIndex]) - nCount++; - if (nCount == nType) - break; - } - switch( nIndex) - { - case testLDAP: - url=OUString::createFromAscii("sdbc:address:ldap://"); - aValue.realloc(2); - aValue[0].Name = ::rtl::OUString::createFromAscii("HostName"); - aValue[0].Value <<= rtl::OUString::createFromAscii("sun-ds"); - aValue[1].Name = ::rtl::OUString::createFromAscii("BaseDN"); - aValue[1].Value <<= rtl::OUString::createFromAscii("dc=sun,dc=com"); - break; - case testMozilla: - url=OUString::createFromAscii("sdbc:address:mozilla://"); - break; - case testOp: - url=OUString::createFromAscii("sdbc:address:outlook://"); - break; - case testOe: - url=OUString::createFromAscii("sdbc:address:outlookexp://"); - break; - default: - url=OUString::createFromAscii("sdbc:address:mozilla://"); - break; - } - pConnection = - pDriver->connect(url,aValue); - return pConnection; - } - -int autoTest(Reference<XResultSet> &xRes) -{ - sal_Int32 nRows = 0; - printColumns(xRes); - if(xRes.is()) - { - while( xRes.is() && xRes->next()) - { - nRows++; - } - OSL_TRACE( "%d Row(s)\n", nRows); - sal_Int32 times; - sal_Int32 pos; - if (nRows) - { - for(times = 1;times < 10; times ++) - { - pos= rand() % nRows+1; - OSL_TRACE("pos:%d\n",pos); - xRes->absolute(pos); - printXResultSet(xRes); - } - } - } - else - { - OSL_TRACE(": FAILED to get a ResultSet \n"); - } - TimeValue timeValue = { 1, 0 }; //sleep 1 Seconds to give time to other threads - osl_waitThread(&timeValue); - return 0; -} -void SAL_CALL mozThread(void*) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; - try - { - Reference< ::com::sun::star::sdbc::XDriver> - m_xDriver(mMgr->createInstance( - OUString::createFromAscii("com.sun.star.comp.sdbc.MozabDriver")), - UNO_QUERY); - if(m_xDriver.is()) - { - - m_xConnection = TestConnected(m_xDriver); - if(m_xConnection.is()) - { - if (!TestMetaData(m_xConnection)) - { - TestQuery(m_xConnection); - } - } - else - OSL_TRACE("Can't connected!\n"); - - } - else - { - OSL_TRACE("No driver!\n"); - } - } catch ( Exception &e ) { - OSL_TRACE( "Exception caught : %s\n", OUtoCStr( e.Message) ); - } -// catch (...) { -// OSL_TRACE( "Non-UNO Exception caught\n" ); -// } -} -const int THREAD_COUNT=100; - - -void usage() -{ - PRINTLN("mozThread [opts] threadcount"); - PRINTLN("opts:"); - PRINTLN("-l test ldap"); - PRINTLN("-m test mozilla"); - PRINTLN("-p test outlook"); - PRINTLN("-e test outlook express"); - PRINTLN("0 < threadcount <= 100, default 100"); -} -#if (defined UNX) || (defined OS2) -int main( int argc, char * argv[] ) -#else -int _cdecl main( int argc, char * argv[] ) -#endif - -{ - OSL_TRACE("Init UNO\n"); - Reference< XMultiServiceFactory > xMgr =InitializeFac(); - int threadCount=THREAD_COUNT; - int nAc; - for (nAc = 1; nAc < argc; nAc ++) - { - if (strcmp(argv[nAc],"-l") ==0) - { - testList[testLDAP] = 1; - }else if(strcmp(argv[nAc],"-m") ==0) - { - testList[testMozilla]=1; - }else if(strcmp(argv[nAc],"-p") ==0) - { - testList[testOp]=1; - }else if(strcmp(argv[nAc],"-e") ==0) - { - testList[testOe]=1; - }else if(strcmp(argv[nAc],"-h") ==0 || strcmp(argv[nAc],"--help") ==0) - { - usage(); - return 0; - }else - { - int tmpCount = atoi(argv[nAc]); - if (tmpCount > 0 && tmpCount < threadCount) - { - threadCount = tmpCount; - } - } - } - testCount = testList[testLDAP] + testList[testMozilla] + testList[testOp] + testList[testOe]; - if ( testCount == 0) - { - testList[testLDAP] = 1; - testCount = 1; - } - - if (!xMgr.is()) - { - OSL_TRACE("Error init UNO\n"); - return 1; - } - else - OSL_TRACE("UNO initted\n"); - - mMgr = xMgr; - oslThread xThreads[THREAD_COUNT]; - int index=0; - for(index=0;index < threadCount; index++) - { - xThreads[index] = osl_createThread(mozThread,(void*)NULL); - TimeValue timeValue = { 1, 0 }; //sleep 1 Seconds to give time to other threads - osl_waitThread(&timeValue); - } - for(index=0;index < threadCount; index++) - { - if (osl_isThreadRunning(xThreads[index])) - osl_joinWithThread(xThreads[index]); - } - OSL_TRACE("Exiting...\n"); - return 0; -} - diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c index b0481eaa2f80..1600a359525e 100644 --- a/cppuhelper/source/findsofficepath.c +++ b/cppuhelper/source/findsofficepath.c @@ -97,14 +97,14 @@ static char* platformSpecific() if ( path == NULL ) { /* read the key's default value from HKEY_LOCAL_USER 64 */ - path = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, SUBKEYNAME64 ); + path = getPathFromRegistryKey( HKEY_CURRENT_USER, SUBKEYNAME64 ); } - else if ( path == NULL ) + if ( path == NULL ) { /* read the key's default value from HKEY_LOCAL_MACHINE */ path = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, SUBKEYNAME ); } - else if ( path == NULL ) + if ( path == NULL ) { /* read the key's default value from HKEY_LOCAL_MACHINE 64*/ path = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, SUBKEYNAME64 ); @@ -117,7 +117,7 @@ static char* platformSpecific() #include <unistd.h> #include <limits.h> - +#include <stdio.h> /* * Gets the installation path from the PATH environment variable. * @@ -129,12 +129,27 @@ static char* platformSpecific() */ static char* platformSpecific() { + char* path = NULL; + +#ifdef MACOSX + /* On MacOS we have no soffice link under /usr/bin but the default office location is known + and we check this only + */ + const char* MACDEFAULTOFFICEPATH = "/Applications/OpenOffice.app/Contents/MacOS"; + const char* MACDEFAULTSOFFICE = "/Applications/OpenOffice.app/Contents/MacOS/soffice"; + + if ( !access( MACDEFAULTSOFFICE, F_OK ) ) + { + path = (char*) malloc( strlen(MACDEFAULTOFFICEPATH) + 1 ); + strcpy( path, MACDEFAULTOFFICEPATH); + } + return path; +#else const int SEPARATOR = '/'; const char* PATHSEPARATOR = ":"; const char* PATHVARNAME = "PATH"; const char* APPENDIX = "/soffice"; - char* path = NULL; char* env = NULL; char* str = NULL; char* dir = NULL; @@ -145,7 +160,7 @@ static char* platformSpecific() char buffer[PATH_MAX]; int pos; - /* get the value of the PATH environment variable */ +/* get the value of the PATH environment variable */ env = getenv( PATHVARNAME ); str = (char*) malloc( strlen( env ) + 1 ); strcpy( str, env ); @@ -190,6 +205,7 @@ static char* platformSpecific() free( str ); return path; +#endif } #endif diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index a67b864b75a2..99d58e6be460 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -655,32 +655,29 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox ) /* -----------------------------05.04.01 13:10-------------------------------- ---------------------------------------------------------------------------*/ -OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties) +OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties) { - OUString sRet; - sal_Int32 nFlags; - const PropertyValue* pProperties = rProperties.getConstArray(); - for(int nProp = 0; nProp < rProperties.getLength(); nProp++) + OUString sName; + const PropertyValue* pPropVal = rProperties.getConstArray(); + const PropertyValue* const pEnd = pPropVal + rProperties.getLength(); + for( ; pPropVal != pEnd; pPropVal++ ) { - if(!pProperties[nProp].Name.compareToAscii("UIName")) + const OUString &rName = pPropVal->Name; + if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UIName" ) ) ) { - if ( pProperties[nProp].Value >>= sRet ) - break; + OUString sUIName; + if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() ) + return sUIName; } - else if(!pProperties[nProp].Name.compareToAscii("Flags")) + else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) ) ) { - if ( pProperties[nProp].Value >>= nFlags ) - { - nFlags &= 0x100; - } - } - else if(!pProperties[nProp].Name.compareToAscii("Name")) - { - if ( !sRet.getLength() ) - pProperties[nProp].Value >>= sRet; + pPropVal->Value >>= sName; } } - return sRet; + + OSL_ENSURE( false, "Filter without UIName!" ); + + return sName; } /* -----------------------------05.04.01 13:37-------------------------------- diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 54517b555715..e37921520e74 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -371,13 +371,14 @@ IMPL_LINK( SvxOnlineUpdateTabPage, CheckNowHdl_Impl, PushButton *, EMPTYARG ) uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), uno::UNO_QUERY ); - uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); + uno::Reference< frame::XDispatch > xDispatch; + if( xDispatchProvider.is() ) + xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); if( xDispatch.is() ) - { xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue > ()); - UpdateLastCheckedText(); - } + + UpdateLastCheckedText(); } catch( const uno::Exception& e ) { diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 17b0d7e764b6..7243ca9c6d02 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -397,29 +397,40 @@ IMPL_LINK( SvxBitmapTabPage, ChangeBitmapHdl_Impl, void *, EMPTYARG ) Color aPixelColor = aFront; Color aBackColor = aBack; - aBitmapCtl.SetPixelColor( aPixelColor ); - aBitmapCtl.SetBackgroundColor( aBackColor ); + // #123564# This causes the wrong color to be selected + // as foreground color when the 1st bitmap in the bitmap + // list is selected. I see no reason why this is done, + // thus I will take it out + // + //if( 0 == aLbBitmaps.GetSelectEntryPos() ) + //{ + // aLbColor.SelectEntry( Color( COL_BLACK ) ); + // ChangePixelColorHdl_Impl( this ); + //} + //else + + aLbColor.SelectEntry( aPixelColor ); - // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe - // temporaer hinzugenommen - if( 0 == aLbBitmaps.GetSelectEntryPos() ) - { - aLbColor.SelectEntry( Color( COL_BLACK ) ); - ChangePixelColorHdl_Impl( this ); - } - else - aLbColor.SelectEntry( aPixelColor ); if( aLbColor.GetSelectEntryCount() == 0 ) { aLbColor.InsertEntry( aPixelColor, String() ); aLbColor.SelectEntry( aPixelColor ); } + aLbBackgroundColor.SelectEntry( aBackColor ); + if( aLbBackgroundColor.GetSelectEntryCount() == 0 ) { aLbBackgroundColor.InsertEntry( aBackColor, String() ); aLbBackgroundColor.SelectEntry( aBackColor ); } + + // update aBitmapCtl, rXFSet and aCtlPreview + aBitmapCtl.SetPixelColor( aPixelColor ); + aBitmapCtl.SetBackgroundColor( aBackColor ); + rXFSet.Put(XFillBitmapItem(String(), Graphic(aBitmapCtl.GetBitmapEx()))); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); } else { @@ -756,9 +767,12 @@ IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) bLoop = sal_False; const BitmapEx aBitmapEx(aBitmapCtl.GetBitmapEx()); - const XBitmapEntry aEntry(Graphic(aBitmapEx), aName); - aLbBitmaps.Modify( rStyleSettings.GetListBoxPreviewDefaultPixelSize(), aEntry, nPos ); + // #123497# Need to replace the existing entry with a new one (old returned needs to be deleted) + XBitmapEntry* pEntry = new XBitmapEntry(Graphic(aBitmapEx), aName); + delete maBitmapList->Replace(pEntry, nPos); + + aLbBitmaps.Modify( rStyleSettings.GetListBoxPreviewDefaultPixelSize(), *pEntry, nPos ); aLbBitmaps.SelectEntryPos( nPos ); // Flag fuer modifiziert setzen diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index eea81a0a2b9a..98d0baff0114 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -631,13 +631,15 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) if (eCM != CM_RGB) ConvertColorValues (aTmpColor, CM_RGB); - const XColorEntry aEntry(aTmpColor, aName); + // #123497# Need to replace the existing entry with a new one (old returned needs to be deleted) + XColorEntry* pEntry = new XColorEntry(aTmpColor, aName); + delete maColorTab->Replace(pEntry, nPos); - aLbColor.Modify( aEntry, nPos ); + aLbColor.Modify( *pEntry, nPos ); aLbColor.SelectEntryPos( nPos ); - aValSetColorTable.SetItemColor( nPos + 1, aEntry.GetColor() ); - aValSetColorTable.SetItemText( nPos + 1, aEntry.GetName() ); + aValSetColorTable.SetItemColor( nPos + 1, pEntry->GetColor() ); + aValSetColorTable.SetItemText( nPos + 1, pEntry->GetName() ); aEdtName.SetText( aName ); aCtlPreviewOld.Invalidate(); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 8e30382a2689..ea5131070232 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -402,19 +402,28 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) // Wenn nicht vorhanden, wird Eintrag aufgenommen if( bDifferent ) { - const XLineEndEntry* pEntry = maLineEndList->GetLineEnd( nPos ); + const XLineEndEntry* pOldEntry = maLineEndList->GetLineEnd( nPos ); - aEdtName.SetText( aName ); + if(pOldEntry) + { + // #123497# Need to replace the existing entry with a new one (old returned needs to be deleted) + XLineEndEntry* pEntry = new XLineEndEntry(pOldEntry->GetLineEnd(), aName); + delete maLineEndList->Replace(pEntry, nPos); - const XLineEndEntry aEntry(pEntry->GetLineEnd(), aName); + aEdtName.SetText( aName ); - aLbLineEnds.Modify( aEntry, nPos, maLineEndList->GetUiBitmap( nPos ) ); - aLbLineEnds.SelectEntryPos( nPos ); + aLbLineEnds.Modify( *pEntry, nPos, maLineEndList->GetUiBitmap( nPos ) ); + aLbLineEnds.SelectEntryPos( nPos ); - // Flag fuer modifiziert setzen - *pnLineEndListState |= CT_MODIFIED; + // Flag fuer modifiziert setzen + *pnLineEndListState |= CT_MODIFIED; - *pPageType = 3; + *pPageType = 3; + } + else + { + OSL_ENSURE(false, "LineEnd to be modified not existing (!)"); + } } } return( 0L ); diff --git a/curl/curl-7.19.7_win.patch b/curl/curl-7.19.7_win.patch index bc59433b5ef1..3f08fd2ccc85 100644 --- a/curl/curl-7.19.7_win.patch +++ b/curl/curl-7.19.7_win.patch @@ -1,19 +1,19 @@ ---- misc/curl-7.19.7/lib/Makefile.vc9 2009-11-04 13:35:39.000000000 +0100 -+++ misc/build/curl-7.19.7/lib/Makefile.vc9 2009-11-18 12:32:57.234375000 +0100 -@@ -46,13 +46,13 @@ - # Stem for static libs and DLLs - # - LIB_NAME = libcurl --LIB_NAME_DEBUG = libcurld -+LIB_NAME_DEBUG = libcurl - - # - # Stem for DLL import libs - # --IMPLIB_NAME = libcurl_imp --IMPLIB_NAME_DEBUG = libcurld_imp -+IMPLIB_NAME = libcurl -+IMPLIB_NAME_DEBUG = libcurl - - !IFNDEF OPENSSL_PATH - OPENSSL_PATH = ../../openssl-0.9.8g +--- misc/curl-7.19.7/lib/Makefile.vc9 2009-11-04 13:35:39.000000000 +0100
++++ misc/build/curl-7.19.7/lib/Makefile.vc9 2009-11-18 12:32:57.234375000 +0100
+@@ -46,13 +46,13 @@
+ # Stem for static libs and DLLs
+ #
+ LIB_NAME = libcurl
+-LIB_NAME_DEBUG = libcurld
++LIB_NAME_DEBUG = libcurl
+
+ #
+ # Stem for DLL import libs
+ #
+-IMPLIB_NAME = libcurl_imp
+-IMPLIB_NAME_DEBUG = libcurld_imp
++IMPLIB_NAME = libcurl
++IMPLIB_NAME_DEBUG = libcurl
+
+ !IFNDEF OPENSSL_PATH
+ OPENSSL_PATH = ../../openssl-0.9.8g
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 156a7a0d232a..040455535ba9 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1408,23 +1408,26 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) thr { for ( ExternalFeaturesMap::iterator aLoop = m_aExternalFeatures.begin(); aLoop != m_aExternalFeatures.end(); - ++aLoop ) { - if ( aLoop->second.xDispatcher.get() == xSource.get() ) - { - ExternalFeaturesMap::iterator aPrevious = aLoop; - --aPrevious; + if ( aLoop->second.xDispatcher.get() != xSource.get() ) { + ++aLoop; + continue; + } - // remove it - m_aExternalFeatures.erase( aLoop ); + // prepare to erase the aLoop iterator + const sal_uInt16 nSlotId = aLoop->first; + ExternalFeaturesMap::iterator aNext = aLoop; + ++aNext; - // maybe update the UI - implCheckExternalSlot(aLoop->first); + // remove it + m_aExternalFeatures.erase( aLoop ); - // continue, the same XDispatch may be resposible for more than one URL - aLoop = aPrevious; - } + // maybe update the UI + implCheckExternalSlot( nSlotId ); + + // continue, the same XDispatch may be resposible for more than one URL + aLoop = aNext; } } else diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src index 89310815555a..5f13c213d514 100644 --- a/dbaccess/source/ui/querydesign/query.src +++ b/dbaccess/source/ui/querydesign/query.src @@ -371,14 +371,12 @@ String STR_QUERY_SAVEMODIFIED String STR_ERROR_PARSING_STATEMENT { - Text [ en-US ] = "$object$ is based on an SQL command which could not be parsed." - "(except \"SQL command\", which doesn't make sense here) will be inserted."; + Text [ en-US ] = "$object$ is based on an SQL command which could not be parsed."; }; String STR_INFO_OPENING_IN_SQL_VIEW { - Text [ en-US ] = "$object$ will be opened in SQL view." - "(except \"SQL command\", which doesn't make sense here) will be inserted."; + Text [ en-US ] = "$object$ will be opened in SQL view."; }; Resource RSC_QUERY_OBJECT_TYPE diff --git a/default_images/introabout/about.png b/default_images/introabout/about.png Binary files differindex c1a546485e5b..2e25ec177d74 100755 --- a/default_images/introabout/about.png +++ b/default_images/introabout/about.png diff --git a/desktop/os2/source/applauncher/launcher.cxx b/desktop/os2/source/applauncher/launcher.cxx index 3a41ed1f2151..bb3fe025c8cb 100644 --- a/desktop/os2/source/applauncher/launcher.cxx +++ b/desktop/os2/source/applauncher/launcher.cxx @@ -42,12 +42,7 @@ int main( int argc, char* argv[]) erridErrorCode = WinGetLastError(hab); // Calculate application name - CHAR szLibpath[_MAX_PATH*2]; CHAR szApplicationName[_MAX_PATH]; - CHAR szDrive[_MAX_PATH]; - CHAR szDir[_MAX_PATH]; - CHAR szFileName[_MAX_PATH]; - CHAR szExt[_MAX_PATH]; // get executable fullpath DosGetInfoBlocks(NULL, &pib); @@ -55,15 +50,13 @@ int main( int argc, char* argv[]) // adjust libpath #if OSL_DEBUG_LEVEL > 0 + CHAR szLibpath[_MAX_PATH*2]; rc = DosQueryExtLIBPATH( (PSZ)szLibpath, BEGIN_LIBPATH); fprintf( stderr, "1 BeginLibPath: %s\n", szLibpath); #endif - _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); - char* basedir = strstr( szDir, "\\PROGRAM\\"); + char* basedir = strrchr( szApplicationName, '\\'); if (basedir) *basedir = 0; - sprintf( szLibpath, "\"%s%s\\URE\\BIN\";\"%s%s\\BASIS\\PROGRAM\";%%BeginLIBPATH%%;", - szDrive, szDir, szDrive, szDir); - DosSetExtLIBPATH( (PCSZ)szLibpath, BEGIN_LIBPATH); + DosSetExtLIBPATH( (PCSZ)szApplicationName, BEGIN_LIBPATH); // make sure we load DLL from our path only, so multiple instances/versions // can be loaded. @@ -75,8 +68,7 @@ int main( int argc, char* argv[]) #endif // adjust exe name - _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); - _makepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, (".bin") ); + strcat( szApplicationName, "\\" OFFICE_IMAGE_NAME ".bin"); // copy command line parameters int i, len; diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 9eb1985236bf..6689f0498c18 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -801,8 +801,9 @@ void MinimalCommandEnv::handle( css::deployment::VersionException verExc; if ( xRequest->getRequest() >>= verExc ) { - // user interaction, if an extension is already been installed. - bApprove = handleVersionException( verExc ); + // choose newest version, if an extension is already been installed. + const bool bChooseNewestVersion = true; + bApprove = handleVersionException( verExc, 0, bChooseNewestVersion ); } const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > conts( xRequest->getContinuations()); @@ -954,6 +955,15 @@ static void installBundledExtensionBlobs() {} catch( css::deployment::DeploymentException&) {} + catch ( css::ucb::CommandFailedException& ) + { + } + catch ( css::ucb::CommandAbortedException& ) + { + } + catch ( css::lang::IllegalArgumentException& ) + { + } } } @@ -2235,6 +2245,21 @@ void Desktop::Main() OfficeIPCThread::SetDowning(); FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); } + catch( const ::com::sun::star::uno::Exception& exUNO) + { + OfficeIPCThread::SetDowning(); + FatalError( exUNO.Message); + } + catch( const std::exception& exSTD) + { + OfficeIPCThread::SetDowning(); + FatalError( OUString::createFromAscii( exSTD.what())); + } + catch( ...) + { + OfficeIPCThread::SetDowning(); + FatalError( OUString(RTL_CONSTASCII_USTRINGPARAM( "Caught Unknown Exception: Aborting!"))); + } } // CAUTION: you do not necessarily get here e.g. on the Mac. // please put all deinitialization code into doShutdown diff --git a/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx b/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx index 624ab45123b3..56d00f320884 100644 --- a/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx +++ b/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx @@ -53,7 +53,8 @@ extern "C" { bool handleVersionException( com::sun::star::deployment::VersionException verExc, - DialogHelper* pDialogHelper ) + DialogHelper* pDialogHelper, + const bool bChooseNewestVersion ) { bool bApprove = false; @@ -72,37 +73,45 @@ bool handleVersionException( break; } OSL_ASSERT( verExc.Deployed.is() ); - const bool bEqualNames = verExc.NewDisplayName.equals( - verExc.Deployed->getDisplayName()); + + if ( bChooseNewestVersion ) { - vos::OGuard guard(Application::GetSolarMutex()); - WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get())); - String s; - if (bEqualNames) - { - s = box.GetMessText(); - } - else if (id == RID_WARNINGBOX_VERSION_EQUAL) - { - //hypothetical: requires two instances of an extension with the same - //version to have different display names. Probably the developer forgot - //to change the version. - s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); - } - else if (id == RID_WARNINGBOX_VERSION_LESS) - { - s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); - } - else if (id == RID_WARNINGBOX_VERSION_GREATER) + bApprove = id == RID_WARNINGBOX_VERSION_GREATER; + } + else + { + const bool bEqualNames = verExc.NewDisplayName.equals( + verExc.Deployed->getDisplayName()); { - s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + vos::OGuard guard(Application::GetSolarMutex()); + WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get())); + String s; + if (bEqualNames) + { + s = box.GetMessText(); + } + else if (id == RID_WARNINGBOX_VERSION_EQUAL) + { + //hypothetical: requires two instances of an extension with the same + //version to have different display names. Probably the developer forgot + //to change the version. + s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + } + else if (id == RID_WARNINGBOX_VERSION_LESS) + { + s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + } + else if (id == RID_WARNINGBOX_VERSION_GREATER) + { + s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + } + s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName); + s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName()); + s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) ); + s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) ); + box.SetMessText(s); + bApprove = box.Execute() == RET_OK; } - s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName); - s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName()); - s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) ); - s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) ); - box.SetMessText(s); - bApprove = box.Execute() == RET_OK; } return bApprove; diff --git a/desktop/source/inc/dp_gui_handleversionexception.hxx b/desktop/source/inc/dp_gui_handleversionexception.hxx index 32272aaeaef4..2a4fd50cc7e4 100755 --- a/desktop/source/inc/dp_gui_handleversionexception.hxx +++ b/desktop/source/inc/dp_gui_handleversionexception.hxx @@ -30,10 +30,13 @@ namespace dp_gui{ class DialogHelper; } extern "C" { + // optional parameter <bChooseNewestVersion> indicates, if + // the newest version is chosen without user interaction. DESKTOP_DEPLOYMENTGUI_DLLPUBLIC bool handleVersionException( com::sun::star::deployment::VersionException verExc, - dp_gui::DialogHelper* pDialogHelper = 0 ); + dp_gui::DialogHelper* pDialogHelper = 0, + const bool bChooseNewestVersion = false ); } #endif diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 03dd9515a463..795d01fcc1b7 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -530,8 +530,9 @@ void TmpRepositoryCommandEnv::handle( deployment::VersionException verExc; if ( xRequest->getRequest() >>= verExc ) { - // user interaction, if an extension is already been installed. - approve = handleVersionException( verExc ); + // choose newest version, if an extension is already been installed. + const bool bChooseNewestVersion = true; + approve = handleVersionException( verExc, 0, bChooseNewestVersion ); abort = !approve; } diff --git a/desktop/win32/source/setup/setup.ulf b/desktop/win32/source/setup/setup.ulf index 4c892185968d..e6494608cf9e 100644 --- a/desktop/win32/source/setup/setup.ulf +++ b/desktop/win32/source/setup/setup.ulf @@ -67,7 +67,7 @@ en-US = "There is already a setup process running." [%UNKNOWN_ERROR%] -en-US = "An Unknown Error occured!" +en-US = "An Unknown Error occurred!" [%INVALID_PROFILE%] diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx index e47ad3e331d7..3247d11f92cb 100755 --- a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx @@ -19,13 +19,12 @@ * *************************************************************/ - - #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVEHELPER2D_HXX #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVEHELPER2D_HXX #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <svtools/grfmgr.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -49,6 +48,22 @@ namespace drawinglayer Primitive2DSequence create2DDecompositionOfGraphic( const Graphic& rGraphic, const basegfx::B2DHomMatrix& rTransform); + + /** Helper to embed given sequence of primitives to evtl. a stack + of ModifiedColorPrimitive2D's to get all the needed modifications + applied. + */ + Primitive2DSequence create2DColorModifierEmbeddingsAsNeeded( + const Primitive2DSequence& rChildren, + GraphicDrawMode aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD, + double fLuminance = 0.0, // [-1.0 .. 1.0] + double fContrast = 0.0, // [-1.0 .. 1.0] + double fRed = 0.0, // [-1.0 .. 1.0] + double fGreen = 0.0, // [-1.0 .. 1.0] + double fBlue = 0.0, // [-1.0 .. 1.0] + double fGamma = 1.0, // ]0.0 .. 10.0] + bool bInvert = false); + } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx index 1b011d5b5f25..af8b7b85c412 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX @@ -45,7 +43,7 @@ namespace drawinglayer For the possibilities of color modifications, please refer to the basegfx::BColorModifier definitions in basegfx. For processing there is tooling in basegfx to build a stack of - BColorModifiers to always be able to proccess the correct + BColorModifierSharedPtrs to always be able to proccess the correct colors. If a renderer does not handle this primitive, the content will @@ -55,16 +53,16 @@ namespace drawinglayer { private: /// The ColorModifier to use - basegfx::BColorModifier maColorModifier; + basegfx::BColorModifierSharedPtr maColorModifier; public: /// constructor ModifiedColorPrimitive2D( const Primitive2DSequence& rChildren, - const basegfx::BColorModifier& rColorModifier); + const basegfx::BColorModifierSharedPtr& rColorModifier); /// data read access - const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; } + const basegfx::BColorModifierSharedPtr& getColorModifier() const { return maColorModifier; } /// provide unique ID DeclPrimitrive2DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx index 3a40734ffb09..4e949d551bd3 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX @@ -45,16 +43,16 @@ namespace drawinglayer { private: /// The ColorModifier to use - basegfx::BColorModifier maColorModifier; + basegfx::BColorModifierSharedPtr maColorModifier; public: /// constructor ModifiedColorPrimitive3D( const Primitive3DSequence& rChildren, - const basegfx::BColorModifier& rColorModifier); + const basegfx::BColorModifierSharedPtr& rColorModifier); /// data read access - const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; } + const basegfx::BColorModifierSharedPtr& getColorModifier() const { return maColorModifier; } /// provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 5bc8240b9a14..4783040d5494 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" @@ -29,6 +27,8 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <drawinglayer/primitive2d/graphicprimitivehelper2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> @@ -49,79 +49,151 @@ namespace drawinglayer { Primitive2DSequence aRetval; - if(255L != getGraphicAttr().GetTransparency()) + if(255L == getGraphicAttr().GetTransparency()) { - // do not apply mirroring from GraphicAttr to the Metafile by calling - // GetTransformedGraphic, this will try to mirror the Metafile using Scale() - // at the Metafile. This again calls Scale at the single MetaFile actions, - // but this implementation never worked. I reworked that implementations, - // but for security reasons i will try not to use it. - basegfx::B2DHomMatrix aTransform(getTransform()); - - if(getGraphicAttr().IsMirrored()) - { - // content needs mirroring - const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ); - const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT); - - // mirror by applying negative scale to the unit primitive and - // applying the object transformation on it. - aTransform = basegfx::tools::createScaleB2DHomMatrix( - bHMirr ? -1.0 : 1.0, - bVMirr ? -1.0 : 1.0); - aTransform.translate( - bHMirr ? 1.0 : 0.0, - bVMirr ? 1.0 : 0.0); - aTransform = getTransform() * aTransform; - } + // content is invisible, done + return aRetval; + } + + // do not apply mirroring from GraphicAttr to the Metafile by calling + // GetTransformedGraphic, this will try to mirror the Metafile using Scale() + // at the Metafile. This again calls Scale at the single MetaFile actions, + // but this implementation never worked. I reworked that implementations, + // but for security reasons i will try not to use it. + basegfx::B2DHomMatrix aTransform(getTransform()); + + if(getGraphicAttr().IsMirrored()) + { + // content needs mirroring + const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ); + const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT); + + // mirror by applying negative scale to the unit primitive and + // applying the object transformation on it. + aTransform = basegfx::tools::createScaleB2DHomMatrix( + bHMirr ? -1.0 : 1.0, + bVMirr ? -1.0 : 1.0); + aTransform.translate( + bHMirr ? 1.0 : 0.0, + bVMirr ? 1.0 : 0.0); + aTransform = getTransform() * aTransform; + } + + // Get transformed graphic. Suppress rotation and cropping, only filtering is needed + // here (and may be replaced later on). Cropping is handled below as mask primitive (if set). + // Also need to suppress mirroring, it is part of the transformation now (see above). + // Also move transparency handling to embedding to a UnifiedTransparencePrimitive2D; do + // that by remembering original transparency and applying that later if needed + GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); + + aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); + aSuppressGraphicAttr.SetRotation(0); + aSuppressGraphicAttr.SetMirrorFlags(0); + aSuppressGraphicAttr.SetTransparency(0); + + const GraphicObject& rGraphicObject = getGraphicObject(); + Graphic aTransformedGraphic(rGraphicObject.GetGraphic()); + const bool isBitmap(GRAPHIC_BITMAP == aTransformedGraphic.GetType() && !aTransformedGraphic.getSvgData().get()); + const bool isAdjusted(getGraphicAttr().IsAdjusted()); + const bool isDrawMode(GRAPHICDRAWMODE_STANDARD != getGraphicAttr().GetDrawMode()); + + if(isBitmap && (isAdjusted || isDrawMode)) + { + // the pure primitive solution with the color modifiers works well, too, but when + // it is a bitmap graphic the old modification currently is faster; so use it here + // instead of creating all as in create2DColorModifierEmbeddingsAsNeeded (see below). + // Still, crop, rotation, mirroring and transparency is handled by primitives already + // (see above). + // This could even be done when vector graphic, but we explicitely want to have the + // pure primitive solution for this; this will allow vector graphics to stay vector + // geraphics, independent from the color filtering stuff. This will enhance e.g. + // SVG and print quality while reducing data size at the same time. + // The other way around the old modifications when only used on already bitmap objects + // will not loose any quality. + aTransformedGraphic = rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr); + + // reset GraphicAttr after use to not apply double + aSuppressGraphicAttr = GraphicAttr(); + } - // Get transformed graphic. Suppress rotation and cropping, only filtering is needed - // here (and may be replaced later on). Cropping is handled below as mask primitive (if set). - // Also need to suppress mirroring, it is part of the transformation now (see above). - GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); - aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); - aSuppressGraphicAttr.SetRotation(0); - aSuppressGraphicAttr.SetMirrorFlags(0); + // create sub-content; helper takes care of correct handling of + // bitmap, svg or metafile content + aRetval = create2DDecompositionOfGraphic( + aTransformedGraphic, + aTransform); - const GraphicObject& rGraphicObject = getGraphicObject(); - const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr)); + if(!aRetval.getLength()) + { + // content is invisible, done + return aRetval; + } + + if(isAdjusted || isDrawMode) + { + // embed to needed ModifiedColorPrimitive2D's if necessary. Do this for + // adjustments and draw mode specials + aRetval = create2DColorModifierEmbeddingsAsNeeded( + aRetval, + aSuppressGraphicAttr.GetDrawMode(), + basegfx::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0), + basegfx::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0), + basegfx::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0), + basegfx::clamp(aSuppressGraphicAttr.GetChannelG() * 0.01, -1.0, 1.0), + basegfx::clamp(aSuppressGraphicAttr.GetChannelB() * 0.01, -1.0, 1.0), + basegfx::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0), + aSuppressGraphicAttr.IsInvert()); + + if(!aRetval.getLength()) + { + // content is invisible, done + return aRetval; + } + } - aRetval = create2DDecompositionOfGraphic( - aTransformedGraphic, - aTransform); + if(getGraphicAttr().IsTransparent()) + { + // check for transparency + const double fTransparency(basegfx::clamp(getGraphicAttr().GetTransparency() * (1.0 / 255.0), 0.0, 1.0)); - if(aRetval.getLength()) + if(!basegfx::fTools::equalZero(fTransparency)) { - // check for cropping - if(getGraphicAttr().IsCropped()) - { - // calculate scalings between real image size and logic object size. This - // is necessary since the crop values are relative to original bitmap size - const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0)); - const basegfx::B2DVector aCropScaleFactor( - rGraphicObject.calculateCropScaling( - aObjectScale.getX(), - aObjectScale.getY(), - getGraphicAttr().GetLeftCrop(), - getGraphicAttr().GetTopCrop(), - getGraphicAttr().GetRightCrop(), - getGraphicAttr().GetBottomCrop())); - - // embed content in cropPrimitive - Primitive2DReference xPrimitive( - new CropPrimitive2D( - aRetval, - aTransform, - getGraphicAttr().GetLeftCrop() * aCropScaleFactor.getX(), - getGraphicAttr().GetTopCrop() * aCropScaleFactor.getY(), - getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(), - getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY())); - - aRetval = Primitive2DSequence(&xPrimitive, 1); - } + const Primitive2DReference aUnifiedTransparence( + new UnifiedTransparencePrimitive2D( + aRetval, + fTransparency)); + + aRetval = Primitive2DSequence(&aUnifiedTransparence, 1); } } + if(getGraphicAttr().IsCropped()) + { + // check for cropping + // calculate scalings between real image size and logic object size. This + // is necessary since the crop values are relative to original bitmap size + const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0)); + const basegfx::B2DVector aCropScaleFactor( + rGraphicObject.calculateCropScaling( + aObjectScale.getX(), + aObjectScale.getY(), + getGraphicAttr().GetLeftCrop(), + getGraphicAttr().GetTopCrop(), + getGraphicAttr().GetRightCrop(), + getGraphicAttr().GetBottomCrop())); + + // embed content in cropPrimitive + Primitive2DReference xPrimitive( + new CropPrimitive2D( + aRetval, + aTransform, + getGraphicAttr().GetLeftCrop() * aCropScaleFactor.getX(), + getGraphicAttr().GetTopCrop() * aCropScaleFactor.getY(), + getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(), + getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY())); + + aRetval = Primitive2DSequence(&xPrimitive, 1); + } + return aRetval; } diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 2a672f9b2870..7bbe1804546a 100755 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" @@ -31,8 +29,10 @@ #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> +#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/numeric/ftools.hxx> ////////////////////////////////////////////////////////////////////////////// // helper class for animated graphics @@ -783,4 +783,137 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence create2DColorModifierEmbeddingsAsNeeded( + const Primitive2DSequence& rChildren, + GraphicDrawMode aGraphicDrawMode, + double fLuminance, + double fContrast, + double fRed, + double fGreen, + double fBlue, + double fGamma, + bool bInvert) + { + Primitive2DSequence aRetval; + + if(!rChildren.getLength()) + { + // no child content, done + return aRetval; + } + + // set child content as retval; that is what will be used as child content in all + // embeddings from here + aRetval = rChildren; + + if(GRAPHICDRAWMODE_WATERMARK == aGraphicDrawMode) + { + // this is solved by applying fixed values additionally to luminance + // and contrast, do it here and reset DrawMode to GRAPHICDRAWMODE_STANDARD + // original in svtools uses: + // #define WATERMARK_LUM_OFFSET 50 + // #define WATERMARK_CON_OFFSET -70 + fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0); + fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0); + aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD; + } + + // DrawMode (GRAPHICDRAWMODE_WATERMARK already handled) + switch(aGraphicDrawMode) + { + case GRAPHICDRAWMODE_GREYS: + { + // convert to grey + const Primitive2DReference aPrimitiveGrey( + new ModifiedColorPrimitive2D( + aRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_gray()))); + + aRetval = Primitive2DSequence(&aPrimitiveGrey, 1); + break; + } + case GRAPHICDRAWMODE_MONO: + { + // convert to mono (black/white with threshold 0.5) + const Primitive2DReference aPrimitiveBlackAndWhite( + new ModifiedColorPrimitive2D( + aRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_black_and_white(0.5)))); + + aRetval = Primitive2DSequence(&aPrimitiveBlackAndWhite, 1); + break; + } + case GRAPHICDRAWMODE_WATERMARK: + { + OSL_ENSURE(false, "OOps, GRAPHICDRAWMODE_WATERMARK should already be handled (see above)"); + // fallthrough intended + } + default: // case GRAPHICDRAWMODE_STANDARD: + { + // nothing to do + break; + } + } + + // mnContPercent, mnLumPercent, mnRPercent, mnGPercent, mnBPercent + // handled in a single call + if(!basegfx::fTools::equalZero(fLuminance) + || !basegfx::fTools::equalZero(fContrast) + || !basegfx::fTools::equalZero(fRed) + || !basegfx::fTools::equalZero(fGreen) + || !basegfx::fTools::equalZero(fBlue)) + { + const Primitive2DReference aPrimitiveRGBLuminannceContrast( + new ModifiedColorPrimitive2D( + aRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_RGBLuminanceContrast( + fRed, + fGreen, + fBlue, + fLuminance, + fContrast)))); + + aRetval = Primitive2DSequence(&aPrimitiveRGBLuminannceContrast, 1); + } + + // gamma (boolean) + if(!basegfx::fTools::equal(fGamma, 1.0)) + { + const Primitive2DReference aPrimitiveGamma( + new ModifiedColorPrimitive2D( + aRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_gamma( + fGamma)))); + + aRetval = Primitive2DSequence(&aPrimitiveGamma, 1); + } + + // invert (boolean) + if(bInvert) + { + const Primitive2DReference aPrimitiveInvert( + new ModifiedColorPrimitive2D( + aRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_invert()))); + + aRetval = Primitive2DSequence(&aPrimitiveInvert, 1); + } + + return aRetval; + } + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index c131eed2d127..92fafaecf208 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -1063,7 +1063,9 @@ namespace rTargetHolders.Current().append( new drawinglayer::primitive2d::ModifiedColorPrimitive2D( aSubContent, - basegfx::BColorModifier(basegfx::BColor(0.0, 0.0, 0.0)))); + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_replace( + basegfx::BColor(0.0, 0.0, 0.0))))); } else // if(rPropertyHolders.Current().isRasterOpInvert()) { diff --git a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx index 0eef666e2aad..746a1c330cab 100644 --- a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" @@ -39,7 +37,7 @@ namespace drawinglayer { ModifiedColorPrimitive2D::ModifiedColorPrimitive2D( const Primitive2DSequence& rChildren, - const basegfx::BColorModifier& rColorModifier) + const basegfx::BColorModifierSharedPtr& rColorModifier) : GroupPrimitive2D(rChildren), maColorModifier(rColorModifier) { diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index e2c9cf4ad499..35c156025bbf 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -67,8 +67,13 @@ namespace drawinglayer if(getChildren().hasElements()) { // create a modifiedColorPrimitive containing the shadow color and the content - const basegfx::BColorModifier aBColorModifier(getShadowColor()); - const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier)); + const basegfx::BColorModifierSharedPtr aBColorModifier( + new basegfx::BColorModifier_replace( + getShadowColor())); + const Primitive2DReference xRefA( + new ModifiedColorPrimitive2D( + getChildren(), + aBColorModifier)); const Primitive2DSequence aSequenceB(&xRefA, 1L); // build transformed primitiveVector with shadow offset and add to target diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 43f89c666438..6b70f8f526dc 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -91,20 +91,44 @@ namespace drawinglayer if(bDefaultTextColor) { // emboss/engrave in black, original forced to white - const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.0)); - const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); - aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1))); + const basegfx::BColorModifierSharedPtr aBColorModifierToGray( + new basegfx::BColorModifier_replace( + basegfx::BColor(0.0))); + const Primitive2DReference xModifiedColor( + new ModifiedColorPrimitive2D( + getTextContent(), + aBColorModifierToGray)); + + aRetval[0] = Primitive2DReference( + new TransformPrimitive2D( + aTransform, + Primitive2DSequence(&xModifiedColor, 1))); // add original, too - const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0)); - aRetval[1] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); + const basegfx::BColorModifierSharedPtr aBColorModifierToWhite( + new basegfx::BColorModifier_replace( + basegfx::BColor(1.0))); + + aRetval[1] = Primitive2DReference( + new ModifiedColorPrimitive2D( + getTextContent(), + aBColorModifierToWhite)); } else { // emboss/engrave in gray, keep original's color - const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.75)); // 192 - const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); - aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1))); + const basegfx::BColorModifierSharedPtr aBColorModifierToGray( + new basegfx::BColorModifier_replace( + basegfx::BColor(0.75))); // 192 + const Primitive2DReference xModifiedColor( + new ModifiedColorPrimitive2D( + getTextContent(), + aBColorModifierToGray)); + + aRetval[0] = Primitive2DReference( + new TransformPrimitive2D( + aTransform, + Primitive2DSequence(&xModifiedColor, 1))); // add original, too aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getTextContent())); @@ -151,8 +175,13 @@ namespace drawinglayer aRetval[7] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); // at last, place original over it, but force to white - const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0, 1.0, 1.0)); - aRetval[8] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); + const basegfx::BColorModifierSharedPtr aBColorModifierToWhite( + new basegfx::BColorModifier_replace( + basegfx::BColor(1.0, 1.0, 1.0))); + aRetval[8] = Primitive2DReference( + new ModifiedColorPrimitive2D( + getTextContent(), + aBColorModifierToWhite)); break; } diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx index 78253848dd3d..3835ec593537 100644 --- a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" @@ -39,7 +37,7 @@ namespace drawinglayer { ModifiedColorPrimitive3D::ModifiedColorPrimitive3D( const Primitive3DSequence& rChildren, - const basegfx::BColorModifier& rColorModifier) + const basegfx::BColorModifierSharedPtr& rColorModifier) : GroupPrimitive3D(rChildren), maColorModifier(rColorModifier) { diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 77afaf8a60f5..f9331f22f821 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -254,8 +254,13 @@ namespace drawinglayer if(::com::sun::star::drawing::TextureKind2_LUMINANCE == aSdr3DObjectAttribute.getTextureKind()) { // use modified color primitive to force textures to gray - const basegfx::BColorModifier aBColorModifier(basegfx::BColor(), 0.0, basegfx::BCOLORMODIFYMODE_GRAY); - const Primitive3DReference xRef2(new ModifiedColorPrimitive3D(aRetval, aBColorModifier)); + const basegfx::BColorModifierSharedPtr aBColorModifier( + new basegfx::BColorModifier_gray()); + const Primitive3DReference xRef2( + new ModifiedColorPrimitive3D( + aRetval, + aBColorModifier)); + aRetval = Primitive3DSequence(&xRef2, 1L); } } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 4c5c10f1d529..b83383b21550 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -837,10 +837,13 @@ namespace drawinglayer sal_Int32(ceil(aCropRange.getMaxX())), sal_Int32(ceil(aCropRange.getMaxY()))); } + // #123295# 3rd param is uncropped rect, 4th is cropped. The primitive has the cropped + // object transformation, thus aCurrentRect *is* the clip region while aCropRect is the expanded, + // uncropped region. Thus, correct order is aCropRect, aCurrentRect mpPDFExtOutDevData->EndGroup(rGraphicPrimitive.getGraphicObject().GetGraphic(), rAttr.GetTransparency(), - aCurrentRect, - aCropRect); + aCropRect, + aCurrentRect); } break; diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 6400c76d5e43..0c5aec374bc1 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -410,27 +410,8 @@ namespace drawinglayer } } - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - - aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - const bool bRotated(!basegfx::fTools::equalZero(fRotate)); - const bool bSheared(!basegfx::fTools::equalZero(fShearX)); - - if(!aBitmapEx.IsTransparent() && (bSheared || bRotated)) - { - // parts will be uncovered, extend aBitmapEx with a mask bitmap - const Bitmap aContent(aBitmapEx.GetBitmap()); -#if defined(MACOSX) - const AlphaMask aMaskBmp( aContent.GetSizePixel()); -#else - Bitmap aMaskBmp( aContent.GetSizePixel(), 1); - aMaskBmp.Erase(Color(COL_BLACK)); // #122758# Initialize to non-transparent -#endif - aBitmapEx = BitmapEx(aContent, aMaskBmp); - } + // #122923# do no longer add Alpha channel here; the right place to do this is when really + // the own transformer is used (see OutputDevice::DrawTransformedBitmapEx). // draw using OutputDevice'sDrawTransformedBitmapEx mpOutputDevice->DrawTransformedBitmapEx(aLocalTransform, aBitmapEx); @@ -490,8 +471,9 @@ namespace drawinglayer aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform); // extract discrete size of graphic - const sal_Int32 nBWidth(basegfx::fround(aGraphicRange.getWidth())); - const sal_Int32 nBHeight(basegfx::fround(aGraphicRange.getHeight())); + // caution: when getting to zero, nothing would be painted; thus, do not allow this + const sal_Int32 nBWidth(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getWidth()))); + const sal_Int32 nBHeight(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getHeight()))); // only do something when bitmap fill has a size in discrete units if(nBWidth > 0 && nBHeight > 0) @@ -503,9 +485,17 @@ namespace drawinglayer static bool bEnablePreScaling(true); const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250)); + // ... but only up to a maximum size, else it gets too expensive if(bPreScaled) { - // ... but only up to a maximum size, else it gets too expensive + // if color depth is below 24bit, expand before scaling for better quality. + // This is even needed for low colors, else the scale will produce + // a bitmap in gray or Black/White (!) + if(aBitmapEx.GetBitCount() < 24) + { + aBitmapEx.Convert(BMP_CONVERSION_24BIT); + } + aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE); } @@ -673,7 +663,7 @@ namespace drawinglayer { case GRAPHIC_GDIMETAFILE: { - // metafiles are potentially transparent, cannot optimize, not done + // metafiles are potentially transparent, cannot optimize, not done break; } case GRAPHIC_BITMAP: @@ -685,9 +675,10 @@ namespace drawinglayer if(nBColorModifierStackCount) { - const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1); + const basegfx::BColorModifierSharedPtr& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1); + const basegfx::BColorModifier_replace* pReplacer = dynamic_cast< const basegfx::BColorModifier_replace* >(rTopmostModifier.get()); - if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode()) + if(pReplacer) { // the bitmap fill is in unified color, so we can replace it with // a single polygon fill. The form of the fill depends on tiling @@ -698,7 +689,7 @@ namespace drawinglayer aLocalPolyPolygon.transform(maCurrentTransformation); mpOutputDevice->SetLineColor(); - mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->SetFillColor(Color(pReplacer->getBColor())); mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); } else @@ -730,7 +721,7 @@ namespace drawinglayer { aTarget.transform(maCurrentTransformation); mpOutputDevice->SetLineColor(); - mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->SetFillColor(Color(pReplacer->getBColor())); mpOutputDevice->DrawPolyPolygon(aTarget); } } diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index 9faef9730820..9ce189ce5b4d 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -120,14 +120,12 @@ namespace drawinglayer maContent.Erase(); // embed primitives to paint them black - static basegfx::BColorModifyMode aMode = basegfx::BCOLORMODIFYMODE_REPLACE; const primitive2d::Primitive2DReference xRef( new primitive2d::ModifiedColorPrimitive2D( aSequence, - basegfx::BColorModifier( - basegfx::BColor(0.0, 0.0, 0.0), - 0.5, - aMode))); + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_replace( + basegfx::BColor(0.0, 0.0, 0.0))))); const primitive2d::Primitive2DSequence xSeq(&xRef, 1); // render diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index fdbe78447dd8..e5d8db781327 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -136,6 +136,21 @@ Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) Any aAny = makeAny( aUnicodeText ); return aAny; } + else if(CF_DIBV5 == fetc.getClipformat()) + { + // #123407# CF_DIBV5 has priority; if the try to fetch this failed, + // check CF_DIB availability as an alternative + fetc.setClipformat(CF_DIB); + + try + { + clipDataStream = getClipboardData( fetc ); + } + catch( UnsupportedFlavorException& ) + { + throw; // pass through, tried all possibilities + } + } else throw; // pass through exception } diff --git a/extensions.lst b/extensions.lst index 471781e5328c..9e47b4f68c4f 100644 --- a/extensions.lst +++ b/extensions.lst @@ -31,7 +31,7 @@ # the name has to be specified after the URL enclosed in double quotes. -# Some extensions that are installed indepently of the language. +# Some extensions that are installed independently of the language. # the presenter console extension # [ language=all && ENABLE_XXX ] @@ -39,7 +39,7 @@ # English dictionary [ language=en.* || language=de || language=it ] - b7ce02d25eb302e5b23572cdccaea461 http://sourceforge.net/projects/aoo-extensions/files/17102/0/dict-en.oxt/download "dict-en.oxt" + 3c3f841f5d40403bcc4d6bb685a38160 http://sourceforge.net/projects/aoo-extensions/files/17102/1/dict-en.oxt/download "dict-en.oxt" # English (USA, en_US) dictionary [ language==nl || language==ru ] @@ -55,15 +55,15 @@ # French dictionary. [ language=fr || language=nl || language=de || language=de_DE ] - 47ca39e385b02839c24a5d953495cb98 http://sourceforge.net/projects/aoo-extensions/files/3554/5/ooo-dictionnaire-fr-moderne-v4.2.oxt/download "ooo-dictionnaire-fr-moderne-v4.2.oxt" + 8f7ca241048c70bd7893995ac4bcca3b http://sourceforge.net/projects/aoo-extensions/files/17340/1/dict411.oxt/download "dict411.oxt" # Italian dictionary. [ language=it || language=de || language=de_DE ] - e7ad2666a727b594948cb672a31ba22d http://sourceforge.net/projects/aoo-extensions/files/1204/11/dict-it.oxt/download "dict-it.oxt" + 67eb02751dda7b2d312a66bcb0505fd2 http://sourceforge.net/projects/aoo-extensions/files/1204/13/dict-it.oxt/download "dict-it.oxt" # Spanish dictionary. [ language=es ] - 28776430bb77547fd70cf6db504bda63 http://sourceforge.net/projects/aoo-extensions/files/1657/2/es_ES.oxt/download "es_ES.oxt" + 59dd45e6785ed644adbbd73f4f126182 http://sourceforge.net/projects/aoo-extensions/files/1657/3/es_es.oxt/download "es_es.oxt" # Danish dictionary. [ language=da ] @@ -100,7 +100,7 @@ # Scottish Gaelic. [ language=gd ] - 867d5509958a867fec1096b445fe4cec http://sourceforge.net/projects/aoo-extensions/files/4587/8/hunspell-gd-2.6.oxt/download "hunspell-gd-2.6.oxt" + 88d92378c2bcf22f87f49bf594130238 http://sourceforge.net/projects/aoo-extensions/files/4587/9/hunspell-gd-2.7.oxt/download "hunspell-gd-2.7.oxt" # Basque. [ language=eu ] diff --git a/external/msvcp70/README_msvcp70.dll b/external/msvcp70/README_msvcp70.dll deleted file mode 100644 index ebc854be3579..000000000000 --- a/external/msvcp70/README_msvcp70.dll +++ /dev/null @@ -1,4 +0,0 @@ -Put the msvcp70.dll and msvcr70.dll in this directory for Windows builds using a .NET compiler. -The dll is part of the .NET installation and can be found in a directory similar -to: -"c:\Program Files\Microsoft Visual Studio .NET\Visual C++ .NET Professional - English\" diff --git a/external/msvcp71/README_msvcX71.dll b/external/msvcp71/README_msvcX71.dll deleted file mode 100644 index 54197f4ac462..000000000000 --- a/external/msvcp71/README_msvcX71.dll +++ /dev/null @@ -1,6 +0,0 @@ -Put the msvcp71.dll and msvcr71.dll in this directory for Windows builds using -a .NET compiler. The dlls are part of the .NET2003 installation and can be found -in a directory similar to: -"c:\Program Files\Microsoft Visual Studio .NET 2003\Visual C++ .NET Professional - English\" -If you use the --enable-dbgutil switch during configure, copy the appropriate msvcp71d.dll and -msvcr71d.dll into this directory. diff --git a/external/msvcp80/README_msvcX80.dll b/external/msvcp80/README_msvcX80.dll deleted file mode 100644 index 364f172bde84..000000000000 --- a/external/msvcp80/README_msvcX80.dll +++ /dev/null @@ -1,2 +0,0 @@ -Put the msvcp80.dll and msvcr80.dll in this directory for Windows builds using -a VS 2005 compiler. diff --git a/external_deps.lst b/external_deps.lst index 3c14624c1655..78b694a31c5a 100644 --- a/external_deps.lst +++ b/external_deps.lst @@ -76,7 +76,7 @@ if (SOLAR_JAVA==TRUE && SYSTEM_LUCENE!=YES) URL1 = http://archive.apache.org/dist/lucene/java/2.9.4/lucene-2.9.4-src.tar.gz URL2 = $(OOO_EXTRAS)$(MD5)-$(name) -if (WITH_MOZILLA != NO) +if (ENABLE_NSS_MODULE!=NO && SYSTEM_NSS!=YES) MD5 = 1f24ab1d39f4a51faf22244c94a6203f name = xmlsec1-1.2.14.tar.gz URL1 = ftp://ftp.aleksey.com/pub/xmlsec/releases/xmlsec1-1.2.14.tar.gz @@ -304,13 +304,6 @@ if (ENABLE_CATEGORY_B==YES && SOLAR_JAVA==TRUE && ENABLE_JAVASCRIPT==YES) URL1 = ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip URL2 = $(OOO_EXTRAS)$(MD5)-$(name) -if (ENABLE_CATEGORY_B==YES && WITH_MOZILLA!=NO && BUILD_MOZAB==TRUE) - MD5 = a169ab152209200a7bad29a275cb0333 - name = seamonkey-1.1.14.source.tar.gz - # This seems to be the original host, but the MD5 sum does not match. - # URL1 = ftp://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.4/seamonkey-1.1.4.source.tar.gz - URL2 = $(OOO_EXTRAS)$(MD5)-$(name) - if (ENABLE_CATEGORY_B==YES && ENABLE_NSS_MODULE==YES) MD5 = b92261a5679276c400555004937af965 name = nss-3.12.6-with-nspr-4.8.4.tar.gz diff --git a/extras/source/misc_config/wizard/web/layouts/layout.xsl b/extras/source/misc_config/wizard/web/layouts/layout.xsl index a1125679ed88..183cb9dad6c9 100644 --- a/extras/source/misc_config/wizard/web/layouts/layout.xsl +++ b/extras/source/misc_config/wizard/web/layouts/layout.xsl @@ -126,7 +126,7 @@ places... <xsl:template match="document/@update-date"> - <span class="doclastchangedate"> + <span class="doclastchangeddate"> <xsl:value-of select="."/> </span> <br/> diff --git a/extras/source/misc_config/wizard/web/layouts/layoutX.xsl b/extras/source/misc_config/wizard/web/layouts/layoutX.xsl index 751bb4e575d8..f22c93486d6d 100644 --- a/extras/source/misc_config/wizard/web/layouts/layoutX.xsl +++ b/extras/source/misc_config/wizard/web/layouts/layoutX.xsl @@ -213,7 +213,7 @@ <xsl:template match="document/@update-date"> - <span class="doclastchangedate"> + <span class="doclastchangeddate"> <xsl:value-of select="."/> </span> <br/> diff --git a/fpicker/source/aqua/CFStringUtilities.hxx b/fpicker/source/aqua/CFStringUtilities.hxx index c89124741e31..4df5b29f110b 100644 --- a/fpicker/source/aqua/CFStringUtilities.hxx +++ b/fpicker/source/aqua/CFStringUtilities.hxx @@ -72,7 +72,7 @@ inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, con inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const NSString* value1) { OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1); #if OSL_DEBUG_LEVEL > 1 - NSLog(value1); + NSLog( const_cast<NSString*>(value1)); #endif } @@ -106,7 +106,7 @@ inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, con inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const NSString* value2) { OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2); #if OSL_DEBUG_LEVEL > 1 - NSLog(value2); + NSLog( const_cast<NSString*>(value2)); #endif } @@ -146,7 +146,7 @@ inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, cons inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* retVal) { OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER); #if OSL_DEBUG_LEVEL > 1 - NSLog(retVal); + NSLog( const_cast<NSString*>(retVal)); #endif } diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index f44ba31780f5..42ebb619bc14 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -915,15 +915,18 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest) ::rtl::OUString aExt; UINT nFileType; hResult = iDialog->GetFileTypeIndex(&nFileType); - if ( SUCCEEDED(hResult) ) + if ( SUCCEEDED(hResult) && nFileType > 0 ) { ::sal_Int32 nRealIndex = (nFileType-1); // COM dialog base on 1 ... filter container on 0 .-) ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters); - LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec; + if ( nRealIndex < lFilters.size() ) + { + LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec; - lpFilterExt = wcsrchr( lpFilterExt, '.' ); - if ( lpFilterExt ) - aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt); + lpFilterExt = wcsrchr( lpFilterExt, '.' ); + if ( lpFilterExt ) + aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt); + } } } diff --git a/instsetoo_native/util/makefile.mk b/instsetoo_native/util/makefile.mk index 9f18a6cf992d..c6081037bb32 100644 --- a/instsetoo_native/util/makefile.mk +++ b/instsetoo_native/util/makefile.mk @@ -28,8 +28,6 @@ TARGET=util .INCLUDE: settings.mk .INCLUDE: $(SOLARINCDIR)$/rtlbootstrap.mk -# PERL:=@echo - # watch for the path delimiter .IF "$(GUI)"=="WNT" PYTHONPATH:=$(PWD)$/$(BIN);$(SOLARLIBDIR);$(SOLARLIBDIR)$/python;$(SOLARLIBDIR)$/python$/lib-dynload @@ -63,6 +61,26 @@ INSTALLDIR=$(OUT) .INCLUDE: target.mk +# The help target belongs after the inclusion of target.mk to not become the default target. +help .PHONY : + @echo "known targets:" + @echo " openoffice builds the default installation packages for the platform" + @echo " aoo_srcrelease packs the source release package" + @echo " updatepack" + @echo " openofficedev devloper snapshot" + @echo " openofficewithjre" + @echo " ooolanguagepack" + @echo " ooodevlanguagepack" + @echo " sdkoo" + @echo " sdkoodev" + @echo + @echo "Most targets (all except aoo_srcrelease and updatepack) accept suffixes" + @echo " add _<language> to build a target for one language only" + @echo " the default set of languages is alllangiso=$(alllangiso)" + @echo " add .<package_format> to build a target for one package format only" + @echo " the default set of package formats is archive and PKGFORMAT=$(PKGFORMAT)" + + LOCALPYFILES= \ $(BIN)$/uno.py \ $(BIN)$/unohelper.py \ @@ -83,7 +101,6 @@ ALLTAR : $(LOCALPYFILES) ALLTAR : openoffice .ELSE ALLTAR : openoffice sdkoo_en-US -#ALLTAR : openoffice sdkoo_en-US ure_en-US .ENDIF .ELSE # "$(UPDATER)"=="" || "$(USE_PACKAGER)"=="" ALLTAR : updatepack @@ -139,17 +156,10 @@ sdkoo: $(foreach,i,$(alllangiso) sdkoo_$i) sdkoodev: $(foreach,i,$(alllangiso) sdkoodev_$i) -#ure: $(foreach,i,$(alllangiso) ure_$i) - MSIOFFICETEMPLATESOURCE=$(PRJ)$/inc_openoffice$/windows$/msi_templates MSILANGPACKTEMPLATESOURCE=$(PRJ)$/inc_ooolangpack$/windows$/msi_templates MSISDKOOTEMPLATESOURCE=$(PRJ)$/inc_sdkoo$/windows$/msi_templates -.IF "$(BUILD_SPECIAL)"!="" -MSIOFFICETEMPLATEDIR=$(MSIOFFICETEMPLATESOURCE) -MSILANGPACKTEMPLATEDIR=$(MSILANGPACKTEMPLATESOURCE) -MSISDKOOTEMPLATEDIR=$(MSISDKOOTEMPLATESOURCE) -.ELSE # "$(BUILD_SPECIAL)"!="" NOLOGOSPLASH:=$(BIN)$/intro.zip DEVNOLOGOSPLASH:=$(BIN)$/dev$/intro.zip MSIOFFICETEMPLATEDIR=$(MISC)$/openoffice$/msi_templates @@ -159,7 +169,7 @@ MSISDKOOTEMPLATEDIR=$(MISC)$/sdkoo$/msi_templates ADDDEPS=$(NOLOGOSPLASH) $(DEVNOLOGOSPLASH) .IF "$(OS)" == "WNT" -ADDDEPS+=hack_msitemplates +ADDDEPS+=msitemplates .ENDIF $(foreach,i,$(alllangiso) openoffice_$i) : $(ADDDEPS) @@ -177,14 +187,10 @@ $(foreach,i,$(alllangiso) sdkoo_$i) : $(ADDDEPS) $(foreach,i,$(alllangiso) sdkoodev_$i) : $(ADDDEPS) -#$(foreach,i,$(alllangiso) ure_$i) : $(ADDDEPS) - .IF "$(MAKETARGETS)"!="" $(MAKETARGETS) : $(ADDDEPS) .ENDIF # "$(MAKETARGETS)"!="" -.ENDIF # "$(BUILD_SPECIAL)"!="" - $(foreach,i,$(alllangiso) openoffice_$i) : $$@{$(PKGFORMAT:^".")} .IF "$(MAKETARGETS)"!="" .IF "$(MAKETARGETS:e)"=="" && "$(MAKETARGETS:s/_//)"!="$(MAKETARGETS)" @@ -192,45 +198,80 @@ $(MAKETARGETS) : $$@{$(PKGFORMAT:^".")} $(MAKETARGETS){$(PKGFORMAT:^".")} : $(ADDDEPS) .ENDIF # "$(MAKETARGETS:e)"=="" && "$(MAKETARGETS:s/_//)"!="$(MAKETARGETS)" .ENDIF # "$(MAKETARGETS)"!="" -openoffice_%{$(PKGFORMAT:^".") .archive} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice -u $(OUT) -buildid $(BUILD) -msitemplate $(MSIOFFICETEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -format $(@:e:s/.//) $(VERBOSESWITCH) - $(PERL) -w $(SOLARENV)$/bin$/gen_update_info.pl --buildid $(BUILD) --arch "$(RTL_ARCH)" --os "$(RTL_OS)" --lstfile $(PRJ)$/util$/openoffice.lst --product Apache_OpenOffice --languages $(subst,$(@:s/_/ /:1)_, $(@:b)) $(PRJ)$/util$/update.xml > $(MISC)/$(@:b)_$(RTL_OS)_$(RTL_ARCH)$(@:e).update.xml + + +# This macro makes calling the make_installer.pl script a bit easier. +# Just add -p and -msitemplate switches. +MAKE_INSTALLER_COMMAND= \ + @$(PERL) -w $(SOLARENV)$/bin$/make_installer.pl \ + -f $(PRJ)$/util$/openoffice.lst \ + -l $(subst,$(@:s/_/ /:1)_, $(@:b)) \ + -u $(OUT) \ + -buildid $(BUILD) \ + -msilanguage $(MISC)$/win_ulffiles \ + -format $(@:e:s/.//) \ + $(VERBOSESWITCH) + +# This macro makes calling gen_update_info.pl a bit easier +# Just add --product switches, and xml input file and redirect output. +GEN_UPDATE_INFO_COMMAND= \ + @$(PERL) -w $(SOLARENV)$/bin$/gen_update_info.pl \ + --buildid $(BUILD) \ + --arch "$(RTL_ARCH)" \ + --os "$(RTL_OS)" \ + --lstfile $(PRJ)$/util$/openoffice.lst \ + --languages $(subst,$(@:s/_/ /:1)_, $(@:b)) + +openoffice_%{$(PKGFORMAT:^".")} : + $(MAKE_INSTALLER_COMMAND) \ + -p Apache_OpenOffice \ + -msitemplate $(MSIOFFICETEMPLATEDIR) + $(GEN_UPDATE_INFO_COMMAND) \ + --product Apache_OpenOffice \ + $(PRJ)$/util$/update.xml \ + > $(MISC)/$(@:b)_$(RTL_OS)_$(RTL_ARCH)$(@:e).update.xml + +openoffice_%{.archive} : + $(MAKE_INSTALLER_COMMAND) \ + -p Apache_OpenOffice \ + -msitemplate $(MSIOFFICETEMPLATEDIR) + $(GEN_UPDATE_INFO_COMMAND) \ + --product Apache_OpenOffice \ + $(PRJ)$/util$/update.xml \ + > $(MISC)/$(@:b)_$(RTL_OS)_$(RTL_ARCH)$(@:e).update.xml $(foreach,i,$(alllangiso) openofficewithjre_$i) : $$@{$(PKGFORMAT:^".")} openofficewithjre_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Aapche_OpenOffice_wJRE -u $(OUT) -buildid $(BUILD) -msitemplate $(MSIOFFICETEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -format $(@:e:s/.//) $(VERBOSESWITCH) + $(MAKE_INSTALLER_COMMAND) -p Apache_OpenOffice_wJRE -msitemplate $(MSIOFFICETEMPLATEDIR) $(foreach,i,$(alllangiso) openofficedev_$i) : $$@{$(PKGFORMAT:^".")} openofficedev_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice_Dev -u $(OUT) -buildid $(BUILD) -msitemplate $(MSIOFFICETEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -format $(@:e:s/.//) $(VERBOSESWITCH) - $(PERL) -w $(SOLARENV)$/bin$/gen_update_info.pl --buildid $(BUILD) --arch "$(RTL_ARCH)" --os "$(RTL_OS)" --lstfile $(PRJ)$/util$/openoffice.lst --product Apache_OpenOffice_Dev --languages $(subst,$(@:s/_/ /:1)_, $(@:b)) $(PRJ)$/util$/update.xml > $(MISC)/$(@:b)_$(RTL_OS)_$(RTL_ARCH)$(@:e).update.xml + $(MAKE_INSTALLER_COMMAND) \ + -p Apache_OpenOffice_Dev \ + -msitemplate $(MSIOFFICETEMPLATEDIR) + $(GEN_UPDATE_INFO_COMMAND) \ + --product Apache_OpenOffice_Dev \ + $(PRJ)$/util$/update.xml \ + > $(MISC)/$(@:b)_$(RTL_OS)_$(RTL_ARCH)$(@:e).update.xml $(foreach,i,$(alllangiso) ooolanguagepack_$i) : $$@{$(PKGFORMAT:^".")} ooolanguagepack_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice -u $(OUT) -buildid $(BUILD) -msitemplate $(MSILANGPACKTEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -languagepack -format $(@:e:s/.//) $(VERBOSESWITCH) + $(MAKE_INSTALLER_COMMAND) \ + -p Apache_OpenOffice \ + -msitemplate $(MSILANGPACKTEMPLATEDIR) \ + -languagepack $(foreach,i,$(alllangiso) ooodevlanguagepack_$i) : $$@{$(PKGFORMAT:^".")} ooodevlanguagepack_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice_Dev -u $(OUT) -buildid $(BUILD) -msitemplate $(MSILANGPACKTEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -languagepack -format $(@:e:s/.//) $(VERBOSESWITCH) + $(MAKE_INSTALLER_COMMAND) -p Apache_OpenOffice_Dev -msitemplate $(MSILANGPACKTEMPLATEDIR) -languagepack $(foreach,i,$(alllangiso) sdkoo_$i) : $$@{$(PKGFORMAT:^".")} sdkoo_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice_SDK -u $(OUT) -buildid $(BUILD) -msitemplate $(MSISDKOOTEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -dontstrip -format $(@:e:s/.//) $(VERBOSESWITCH) + $(MAKE_INSTALLER_COMMAND) -p Apache_OpenOffice_SDK -msitemplate $(MSISDKOOTEMPLATEDIR) -dontstrip $(foreach,i,$(alllangiso) sdkoodev_$i) : $$@{$(PKGFORMAT:^".")} sdkoodev_%{$(PKGFORMAT:^".")} : - $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.lst -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p Apache_OpenOffice_Dev_SDK -u $(OUT) -buildid $(BUILD) -msitemplate $(MSISDKOOTEMPLATEDIR) -msilanguage $(MISC)$/win_ulffiles -dontstrip -format $(@:e:s/.//) $(VERBOSESWITCH) - -#$(foreach,i,$(alllangiso) ure_$i) : $$@{$(PKGFORMAT:^".")} -#ure_%{$(PKGFORMAT:^".")} : -#.IF "$(OS)" == "MACOSX" -# @echo 'for now, there is no standalone URE for Mac OS X' -#.ELSE -# $(PERL) -w $(SOLARENV)$/bin$/make_installer.pl -f $(PRJ)$/util$/openoffice.#lst \ -# -l $(subst,$(@:s/_/ /:1)_, $(@:b)) -p URE -u $(OUT) -buildid $(BUILD) -#format $(@:e:s/.//) $(VERBOSESWITCH) \ -# -msitemplate $(MSIURETEMPLATEDIR) \ -# -msilanguage $(MISC)$/win_ulffiles -#.ENDIF + $(MAKE_INSTALLER_COMMAND) -p Apache_OpenOffice_Dev_SDK -msitemplate $(MSISDKOOTEMPLATEDIR) -dontstrip .IF "$(MAKETARGETS)"!="" .IF "$(MAKETARGETS:e)"=="" && "$(MAKETARGETS:s/_//)"!="$(MAKETARGETS)" @@ -261,18 +302,161 @@ $(BIN)$/dev$/intro.zip : $(SOLARCOMMONPCKDIR)$/openoffice_dev$/intro.zip @-$(MKDIR) $(@:d) $(COPY) $< $@ -hack_msitemplates .PHONY: - -$(MKDIRHIER) $(MSIOFFICETEMPLATEDIR) - -$(MKDIRHIER) $(MSILANGPACKTEMPLATEDIR) - -$(MKDIRHIER) $(MSISDKOOTEMPLATEDIR) - -$(MKDIRHIER) $(MSIOFFICETEMPLATEDIR)$/Binary - -$(MKDIRHIER) $(MSILANGPACKTEMPLATEDIR)$/Binary - -$(MKDIRHIER) $(MSISDKOOTEMPLATEDIR)$/Binary - $(GNUCOPY) $(MSIOFFICETEMPLATESOURCE)$/*.* $(MSIOFFICETEMPLATEDIR) - $(GNUCOPY) $(MSILANGPACKTEMPLATESOURCE)$/*.* $(MSILANGPACKTEMPLATEDIR) - $(GNUCOPY) $(MSISDKOOTEMPLATESOURCE)$/*.* $(MSISDKOOTEMPLATEDIR) - $(GNUCOPY) $(MSIOFFICETEMPLATESOURCE)$/Binary$/*.* $(MSIOFFICETEMPLATEDIR)$/Binary - $(GNUCOPY) $(MSILANGPACKTEMPLATESOURCE)$/Binary$/*.* $(MSILANGPACKTEMPLATEDIR)$/Binary - $(GNUCOPY) $(MSISDKOOTEMPLATESOURCE)$/Binary$/*.* $(MSISDKOOTEMPLATEDIR)$/Binary - - +msitemplates .PHONY: msi_template_files msi_langpack_template_files msi_sdk_template_files + +MSI_OFFICE_TEMPLATE_FILES= \ + ActionTe.idt \ + AdminExe.idt \ + AdminUIS.idt \ + AdvtExec.idt \ + AppSearc.idt \ + Binary.idt \ + CheckBox.idt \ + Control.idt \ + ControlC.idt \ + ControlE.idt \ + CustomAc.idt \ + Dialog.idt \ + Error.idt \ + EventMap.idt \ + InstallE.idt \ + InstallU.idt \ + LaunchCo.idt \ + ListBox.idt \ + Property.idt \ + RadioBut.idt \ + RegLocat.idt \ + Signatur.idt \ + TextStyl.idt \ + UIText.idt \ + _Validat.idt \ + codes.txt \ + codes_broo.txt \ + codes_broodev.txt \ + codes_ooodev.txt \ + components.txt \ + upgradecode_remove_ooo.txt \ + Binary/Banner.bmp \ + Binary/Image.bmp \ + Binary/caution.ico \ + Binary/dontinstall.ico \ + Binary/install.ico \ + Binary/installfirstuse.ico \ + Binary/installpartial.ico \ + Binary/installstatemenu.ico \ + Binary/networkinstall.ico \ + Binary/newfolder.ico \ + Binary/openfolder.ico \ + Binary/setup.ico \ + Binary/setupcomplete.ico \ + Binary/setuppartial.ico \ + Binary/setuprepair.ico \ + Binary/trashcan.ico \ + Binary/up.ico + +MSI_LANGPACK_TEMPLATE_FILES= \ + ActionTe.idt \ + AdminExe.idt \ + AdminUIS.idt \ + AdvtExec.idt \ + Binary.idt \ + CheckBox.idt \ + Control.idt \ + ControlC.idt \ + ControlE.idt \ + CustomAc.idt \ + Dialog.idt \ + Error.idt \ + EventMap.idt \ + InstallE.idt \ + InstallU.idt \ + LaunchCo.idt \ + ListBox.idt \ + Property.idt \ + RadioBut.idt \ + TextStyl.idt \ + UIText.idt \ + _Validat.idt \ + bro_patchcodes.txt \ + brodev_patchcodes.txt \ + codes.txt \ + codes_broo.txt \ + codes_ooodev.txt \ + components.txt \ + ooo_patchcodes.txt \ + ooodev_patchcodes.txt \ + Binary/Banner.bmp + +MSI_SDK_TEMPLATE_FILES= \ + ActionTe.idt \ + AdminExe.idt \ + AdminUIS.idt \ + AdvtExec.idt \ + AppSearc.idt \ + Binary.idt \ + CheckBox.idt \ + Control.idt \ + ControlC.idt \ + ControlE.idt \ + CustomAc.idt \ + Dialog.idt \ + Error.idt \ + EventMap.idt \ + InstallE.idt \ + InstallU.idt \ + LaunchCo.idt \ + ListBox.idt \ + Property.idt \ + RadioBut.idt \ + RegLocat.idt \ + Signatur.idt \ + TextStyl.idt \ + UIText.idt \ + _Validat.idt \ + codes.txt \ + components.txt \ + Binary/Banner.bmp \ + Binary/Image.bmp \ + Binary/caution.ico \ + Binary/dontinstall.ico \ + Binary/install.ico \ + Binary/installfirstuse.ico \ + Binary/installpartial.ico \ + Binary/installstatemenu.ico \ + Binary/networkinstall.ico \ + Binary/newfolder.ico \ + Binary/openfolder.ico \ + Binary/setup.ico \ + Binary/setupcomplete.ico \ + Binary/setuppartial.ico \ + Binary/setuprepair.ico \ + Binary/trashcan.ico \ + Binary/up.ico + +msi_template_files .PHONY: \ + $(MSIOFFICETEMPLATEDIR) \ + $(MSIOFFICETEMPLATEDIR)$/Binary \ + $(MSIOFFICETEMPLATEDIR)$/{$(MSI_OFFICE_TEMPLATE_FILES)} +$(MSIOFFICETEMPLATEDIR) $(MSIOFFICETEMPLATEDIR)$/Binary : + -$(MKDIRHIER) $@ +$(MSIOFFICETEMPLATEDIR)$/% : $(MSIOFFICETEMPLATESOURCE)$/% + $(GNUCOPY) $< $@ + +msi_langpack_template_files .PHONY : \ + $(MSILANGPACKTEMPLATEDIR) \ + $(MSILANGPACKTEMPLATEDIR)$/Binary \ + $(MSILANGPACKTEMPLATEDIR)$/{$(MSI_LANGPACK_TEMPLATE_FILES)} +$(MSILANGPACKTEMPLATEDIR) $(MSILANGPACKTEMPLATEDIR)$/Binary : + -$(MKDIRHIER) $@ +$(MSILANGPACKTEMPLATEDIR)$/% : $(MSILANGPACKTEMPLATESOURCE)$/% + $(GNUCOPY) $< $@ + + +msi_sdk_template_files .PHONY : \ + $(MSISDKOOTEMPLATEDIR) \ + $(MSISDKOOTEMPLATEDIR)$/Binary \ + $(MSISDKOOTEMPLATEDIR)$/{$(MSI_SDK_TEMPLATE_FILES)} +$(MSISDKOOTEMPLATEDIR) $(MSISDKOOTEMPLATEDIR)$/Binary : + -$(MKDIRHIER) $@ +$(MSISDKOOTEMPLATEDIR)/% : $(MSISDKOOTEMPLATESOURCE)$/% + $(GNUCOPY) $< $@ diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 815d65788a70..82ac49b0dc32 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -5,9 +5,9 @@ Globals variables { APACHEPROJECTNAME Apache OpenOffice - OOOBASEVERSION 4.0 - OOOPACKAGEVERSION 4.0.0 - UREPACKAGEVERSION 4.0.0 + OOOBASEVERSION 4.1 + OOOPACKAGEVERSION 4.1.0 + UREPACKAGEVERSION 4.1.0 URELAYERVERSION 1 BASISROOTNAME OpenOffice UNIXBASISROOTNAME openoffice @@ -41,9 +41,9 @@ Globals OOOXMLFILEFORMATNAME OpenOffice.org XML OOOXMLFILEFORMATVERSION 1.0 WRITERCOMPATIBILITYVERSIONOOO11 OpenOffice.org 1.1 - SERVICETAG_PRODUCTNAME Apache OpenOffice 4.0 - SERVICETAG_PRODUCTVERSION 4.0 - SERVICETAG_PARENTNAME Apache OpenOffice 4.0 + SERVICETAG_PRODUCTNAME Apache OpenOffice 4.1 + SERVICETAG_PRODUCTVERSION 4.1 + SERVICETAG_PARENTNAME Apache OpenOffice 4.1 SERVICETAG_SOURCE {buildsource}{minor}(Build:{buildid}) SERVICETAG_URN urn:uuid:500061aa-5666-11e0-8e00-080020a9ed93 REGISTRATION_HOST https://registration.openoffice.org @@ -61,7 +61,7 @@ Apache_OpenOffice { FULLPRODUCTNAME Apache OpenOffice PRODUCTNAME OpenOffice - PRODUCTVERSION 4.0.0 + PRODUCTVERSION 4.1.0 PRODUCTEXTENSION LONG_PRODUCTEXTENSION SHORT_PRODUCTEXTENSION @@ -69,15 +69,15 @@ Apache_OpenOffice POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4 USERDIRPRODUCTVERSION 4 - ABOUTBOXPRODUCTVERSION 4.0.0 - BASEPRODUCTVERSION 4.0 + ABOUTBOXPRODUCTVERSION 4.1.0 + BASEPRODUCTVERSION 4.1 PCPFILENAME openoffice.pcp - UPDATEURL https://ooo-updates.apache.org/aoo40/check.Update + UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,userland.txt,version.lst REMOVE_UPGRADE_CODE_FILE upgradecode_remove_ooo.txt ADDSYSTEMINTEGRATION 1 EVAL - PACKAGEVERSION 4.0.0 + PACKAGEVERSION 4.1.0 PACKAGEREVISION {milestone} LICENSENAME ALv2 GLOBALFILEGID gid_File_Lib_Vcl @@ -121,7 +121,7 @@ Apache_OpenOffice_wJRE { FULLPRODUCTNAME Apache OpenOffice PRODUCTNAME OpenOffice - PRODUCTVERSION 4.0.0 + PRODUCTVERSION 4.1.0 PRODUCTEXTENSION LONG_PRODUCTEXTENSION SHORT_PRODUCTEXTENSION @@ -129,14 +129,14 @@ Apache_OpenOffice_wJRE POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4 USERDIRPRODUCTVERSION 4 - ABOUTBOXPRODUCTVERSION 4.0.0 - BASEPRODUCTVERSION 4.0 - UPDATEURL https://ooo-site.apache.org/projects/update/aoo40/check.Update + ABOUTBOXPRODUCTVERSION 4.1.0 + BASEPRODUCTVERSION 4.1 + UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,javaversion2.dat,userland.txt,version.lst REMOVE_UPGRADE_CODE_FILE upgradecode_remove_ooo.txt ADDSYSTEMINTEGRATION 1 EVAL - PACKAGEVERSION 4.0.0 + PACKAGEVERSION 4.1.0 PACKAGEREVISION {milestone} LICENSENAME ALv2 WITHJREPRODUCT 1 @@ -181,7 +181,7 @@ Apache_OpenOffice_Dev { FULLPRODUCTNAME AOO-Developer-Build PRODUCTNAME AOO-Developer-Build - PRODUCTVERSION 4.0.0 + PRODUCTVERSION 4.1.0 PRODUCTEXTENSION LONG_PRODUCTEXTENSION SHORT_PRODUCTEXTENSION @@ -191,17 +191,17 @@ Apache_OpenOffice_Dev POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4 USERDIRPRODUCTVERSION 4 - ABOUTBOXPRODUCTVERSION 4.0.0 - BASEPRODUCTVERSION 4.0 + ABOUTBOXPRODUCTVERSION 4.1.0 + BASEPRODUCTVERSION 4.1 DEVELOPMENTPRODUCT 1 BASISPACKAGEPREFIX aoodev UREPACKAGEPREFIX aoodev SOLSUREPACKAGEPREFIX aoodev REGISTRYLAYERNAME LayerDev - UPDATEURL https://ooo-site.apache.org/projects/update/aoo40/check.Update + UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,javaversion2.dat,userland.txt,version.lst EVAL - PACKAGEVERSION 4.0.0 + PACKAGEVERSION 4.1.0 PACKAGEREVISION {milestone} LICENSENAME ALv2 GLOBALFILEGID gid_File_Lib_Vcl @@ -250,8 +250,8 @@ URE { FULLPRODUCTNAME URE PRODUCTNAME URE - PRODUCTVERSION 4.0.0 - PACKAGEVERSION 4.0 + PRODUCTVERSION 4.1.0 + PACKAGEVERSION 4.1 PACKAGEREVISION 1 PRODUCTEXTENSION LONG_PRODUCTEXTENSION @@ -293,14 +293,14 @@ Apache_OpenOffice_SDK { FULLPRODUCTNAME Apache OpenOffice PRODUCTNAME OpenOffice - PRODUCTVERSION 4.0.0 + PRODUCTVERSION 4.1.0 PRODUCTEXTENSION LONG_PRODUCTEXTENSION SHORT_PRODUCTEXTENSION POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk BRANDPACKAGEVERSION 4 - PACKAGEVERSION 4.0.0 + PACKAGEVERSION 4.1.0 PACKAGEREVISION {milestone} PACK_INSTALLED 1 POOLPRODUCT 0 @@ -341,7 +341,7 @@ Apache_OpenOffice_Dev_SDK { FULLPRODUCTNAME AOO-Developer-Build PRODUCTNAME AOO-Developer-Build - PRODUCTVERSION 4.0.0 + PRODUCTVERSION 4.1.0 PRODUCTEXTENSION LONG_PRODUCTEXTENSION SHORT_PRODUCTEXTENSION @@ -350,7 +350,7 @@ Apache_OpenOffice_Dev_SDK POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk BRANDPACKAGEVERSION 4 - PACKAGEVERSION 4.0.0 + PACKAGEVERSION 4.1.0 PACKAGEREVISION {milestone} BASISPACKAGEPREFIX aoodev UREPACKAGEPREFIX aoodev diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx index 878a18553ae0..e2ac57e70255 100644 --- a/io/source/TextOutputStream/TextOutputStream.cxx +++ b/io/source/TextOutputStream/TextOutputStream.cxx @@ -74,6 +74,7 @@ class OTextOutputStream : public TextOutputStreamHelper rtl_UnicodeToTextContext mContextUnicode2Text; Sequence<sal_Int8> implConvert( const OUString& rSource ); + void checkOutputStream() throw(IOException); public: OTextOutputStream(); @@ -174,6 +175,7 @@ Sequence<sal_Int8> OTextOutputStream::implConvert( const OUString& rSource ) void OTextOutputStream::writeString( const OUString& aString ) throw(IOException, RuntimeException) { + checkOutputStream(); if( !mbEncodingInitialized ) { OUString aUtf8Str( RTL_CONSTASCII_USTRINGPARAM("utf8") ); @@ -205,22 +207,35 @@ void OTextOutputStream::setEncoding( const OUString& Encoding ) void OTextOutputStream::writeBytes( const Sequence< sal_Int8 >& aData ) throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { + checkOutputStream(); mxStream->writeBytes( aData ); } void OTextOutputStream::flush( ) throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { + checkOutputStream(); mxStream->flush(); } void OTextOutputStream::closeOutput( ) throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { + checkOutputStream(); mxStream->closeOutput(); } +void OTextOutputStream::checkOutputStream() + throw(IOException) +{ + if (! mxStream.is() ) + throw IOException( + OUString(RTL_CONSTASCII_USTRINGPARAM("output stream is not initialized, you have to use setOutputStream first")), + Reference<XInterface>()); +} + + //=========================================================================== // XActiveDataSource diff --git a/libxmlsec/prj/build.lst b/libxmlsec/prj/build.lst index a4faaa8f00fa..579afce24459 100644 --- a/libxmlsec/prj/build.lst +++ b/libxmlsec/prj/build.lst @@ -1,3 +1,3 @@ -ls libxmlsec : stlport soltools LIBXML2:libxml2 MOZ:moz SO:moz_prebuilt NULL +ls libxmlsec : stlport soltools LIBXML2:libxml2 NSS:nss NULL ls libxmlsec usr1 - all ls_mkout NULL ls libxmlsec nmake - all ls_xmlsec1 NULL diff --git a/moz/README b/moz/README deleted file mode 100644 index 6b1d0a2e169e..000000000000 --- a/moz/README +++ /dev/null @@ -1,4 +0,0 @@ -Rebuild moz whenever changes have been made in the nss module. Those libs are
-merged into mozruntime.zip which is build in this project.
-
-Please read nss/readme.txt !!!
\ No newline at end of file diff --git a/moz/extractfiles.mk b/moz/extractfiles.mk deleted file mode 100644 index b3f2ca033572..000000000000 --- a/moz/extractfiles.mk +++ /dev/null @@ -1,455 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -MOZTARGET=$(OS)$(COM)$(CPU) -MOZ_DIST_DIR=$(MISC)$/build$/mozilla$/$(BUILD_DIR)$/dist -MOZ_BIN_DIR=$(MOZ_DIST_DIR)$/bin -RUNTIME_DIR=$(MISC)$/$(MOZTARGET)runtime -LIB_DIR=$(LB) -INCLUDE_DIR=$(INCCOM) - - - -#If we build the NSS module then we do not need the old nss libs from here -.IF "$(ENABLE_NSS_MODULE)"=="YES" - - -.IF "$(OS)" == "SOLARIS" -.IF "$(CPU)" == "S" #32bit -FREEBL_LIB=freebl_32fpu_3 freebl_32int64_3 freebl_32int_3 -.ELIF "$(CPU)" == "U" #64bit unxsolu4 -FREEBL_LIB=freebl_64int_3 freebl_64fpu_3 -.ELSE -FREEBL_LIB=freebl3 -.ENDIF #"$(CPU)" == "S" - -.ELSE # "$(OS)" == "SOLARIS" -FREEBL_LIB=freebl3 -.ENDIF # "$(OS)" == "SOLARIS" - - -NSS_MODULE_RUNTIME_LIST:= \ - $(FREEBL_LIB) \ - nspr4 \ - nss3 \ - nssckbi \ - nssdbm3 \ - nssutil3 \ - plc4 \ - plds4 \ - smime3 \ - softokn3 \ - sqlite/sqlite3 \ - ssl3 - -BIN_RUNTIMELIST= \ - xpcom \ - xpcom_core \ - xpcom_compat -.ELSE - -.IF "$(GUI)" == "WNT" - FREEBL_LIB=freebl3 -.ELSE # "$(GUI)" == "WNT" - .IF "$(OS)$(CPUNAME)" == "SOLARISSPARC" - FREEBL_LIB=freebl_32fpu_3 - .ELSE # "$(OS)$(CPUNAME)" == "SOLARISSPARC" - FREEBL_LIB=freebl3 - .ENDIF # "$(OS)$(CPUNAME)" == "SOLARISSPARC" -.ENDIF # "$(GUI)" == "WNT" - - -BIN_RUNTIMELIST= \ - nspr4 \ - plc4 \ - plds4 \ - xpcom \ - xpcom_core \ - xpcom_compat \ - nss3 \ - ssl3 \ - softokn3 \ - smime3 \ - $(FREEBL_LIB) -.ENDIF # "$(ENABLE_NSS_MODULE)"=="YES" - -.IF "$(GUI)"=="WNT" -BIN_RUNTIMELIST+= \ - js3250 \ - mozz \ - msgbsutl \ - nsldap32v50 \ - nsldappr32v50 -.ELSE #"$(GUI)"=="WNT" -BIN_RUNTIMELIST+= \ - mozjs \ - mozz \ - msgbaseutil \ - ldap50 \ - prldap50 -.ENDIF - -COMPONENT_RUNTIMELIST= \ - addrbook \ - mork \ - mozldap \ - necko \ - profile \ - xpcom_compat_c \ - rdf \ - uconv \ - vcard \ - i18n \ - pipnss - -.IF "$(GUI)"=="WNT" -COMPONENT_RUNTIMELIST+= \ - xppref32 \ - xpc3250 -.ELSE #"$(GUI)"=="WNT" -COMPONENT_RUNTIMELIST+= \ - pref \ - xpconnect -.ENDIF - -COMREGISTRY_FILELIST= \ - necko_dns.xpt \ - xpcom_base.xpt \ - xpcom_obsolete.xpt \ - xpcom_components.xpt \ - xpcom_ds.xpt \ - xpcom_io.xpt \ - xpcom_xpti.xpt \ - addrbook.xpt \ - mozldap.xpt \ - pref.xpt - -.IF "$(GUI)"=="WNT" -COMREGISTRY_FILELIST+= xpcom_thread.xpt -.ELSE #"$(GUI)"=="WNT" -COMREGISTRY_FILELIST+= xpcom_threads.xpt -.ENDIF - -DEFAULTS_RUNTIMELIST= \ - defaults$/pref$/browser-prefs.js \ - defaults$/pref$/mailnews.js \ - defaults$/pref$/mdn.js \ - defaults$/pref$/smime.js \ - defaults$/autoconfig$/platform.js \ - defaults$/autoconfig$/prefcalls.js \ - greprefs$/all.js \ - greprefs$/security-prefs.js - -.IF "$(ENABLE_NSS_MODULE)"=="YES" -#These headers come from the separate NSS module if enabled -NSS_INCLUDE_LIST= nspr nss - -.IF "$(GUI)"=="WNT" -.IF "$(COM)"=="GCC" - - -LIBLIST= \ - libembed_base_s.a \ - libmozreg_s.a \ - libnslber32v50.a \ - libnsldap32v50.a \ - libxpcom_core.dll.a \ - libxpcom.dll.a - -.ELSE #"$(COM)"=="GCC" - -LIBLIST= \ - embed_base_s.lib \ - mozreg_s.lib \ - nslber32v50.lib \ - nsldap32v50.lib \ - xpcom_core.lib \ - xpcom.lib - -.ENDIF #"$(COM)"=="GCC" - -.ELSE #"$(GUI)"=="WNT" - -LIBLIST= \ - libembed_base_s.a \ - libmozreg_s.a \ - liblber50.a \ - libxpcom_core$(DLLPOST) \ - libxpcom$(DLLPOST) \ - libmsgbaseutil$(DLLPOST) \ - libldap50$(DLLPOST) \ - -.ENDIF - -.ELSE # .IF"$(ENABLE_NSS_MODULE)"=="YES" - -.IF "$(GUI)"=="WNT" -.IF "$(COM)"=="GCC" - -LIBLIST= \ - libembed_base_s.a \ - libmozreg_s.a \ - libnslber32v50.a \ - libnsldap32v50.a \ - libnspr4.a \ - libxpcom_core.dll.a \ - libxpcom.dll.a \ - libnss3.a \ - libsmime3.a - -.ELSE - -LIBLIST= \ - embed_base_s.lib \ - mozreg_s.lib \ - nslber32v50.lib \ - nsldap32v50.lib \ - nspr4.lib \ - xpcom_core.lib \ - xpcom.lib \ - plc4.lib \ - plds4.lib \ - nss3.lib \ - ssl3.lib \ - smime3.lib - -.ENDIF - -.ELSE #"$(GUI)"=="WNT" - -LIBLIST= \ - libembed_base_s.a \ - libmozreg_s.a \ - liblber50.a \ - libnspr4$(DLLPOST) \ - libxpcom_core$(DLLPOST) \ - libxpcom$(DLLPOST) \ - libmsgbaseutil$(DLLPOST) \ - libldap50$(DLLPOST) \ - libsoftokn3$(DLLPOST) \ - libplc4$(DLLPOST) \ - libplds4$(DLLPOST) \ - libnss3$(DLLPOST) \ - libssl3$(DLLPOST) \ - libsmime3$(DLLPOST) - -.ENDIF -.ENDIF # .IF "$(ENABLE_NSS_MODULE)"=="YES" - -INCLUDE_PATH=$(MOZ_DIST_DIR)$/include$/ -PUBLIC_PATH=$(MOZ_DIST_DIR)$/public$/ - - -.IF "$(GUI)"=="WNT" -REG_SUBFIX= .exe -.ELSE #"$(GUI)"=="WNT" -REG_SUBFIX= -.ENDIF - -# --- Targets ------------------------------------------------------ - -extract_mozab_files: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) \ - make_temp_dir \ - $(MISC)$/build$/so_moz_runtime_files \ - $(MISC)$/build$/so_moz_include_files \ - $(MISC)$/build$/so_moz_lib_files - -make_temp_dir: - @@-$(MKDIR) $(RUNTIME_DIR) - @@-$(MKDIR) $(RUNTIME_DIR)$/components - @@-$(MKDIR) $(RUNTIME_DIR)$/defaults - @@-$(MKDIR) $(RUNTIME_DIR)$/defaults$/pref - @@-$(MKDIR) $(LIB_DIR) - @@-$(MKDIR) $(INCLUDE_DIR) -.IF "$(OS)"=="SOLARIS" - @@-$(MKDIR) $(RUNTIME_DIR)$/res -.ENDIF - -$(OUT)$/bin$/mozruntime.zip: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - noop - -$(MISC)$/build$/so_moz_runtime_files: $(OUT)$/bin$/mozruntime.zip -# copy files in BIN_RUNTIMELIST - $(foreach,file,$(BIN_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/$(DLLPRE)$(file)$(DLLPOST) \ - $(RUNTIME_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.IF "$(GUI)" == "UNX" - $(foreach,file,$(BIN_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/$(DLLPRE)$(file)$(DLLPOST) \ - $(LIB_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.IF "$(ENABLE_NSS_MODULE)" == "YES" -# We add the libraries from the separate nss module - $(foreach,file,$(NSS_MODULE_RUNTIME_LIST) $(COPY) $(SOLARLIBDIR)$/$(file:d:d)/$(DLLPRE)$(file:f)$(DLLPOST) \ - $(RUNTIME_DIR)$/$(DLLPRE)$(file:f)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.ENDIF -.ELSE # .IF "$(GUI)" == "UNX" -.IF "$(ENABLE_NSS_MODULE)" == "YES" -# We add the libraries from the separate nss module - $(foreach,file,$(NSS_MODULE_RUNTIME_LIST) $(COPY) $(SOLARBINDIR)$/$(DLLPRE)$(file)$(DLLPOST) \ - $(RUNTIME_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.ENDIF -.ENDIF # .IF "$(GUI)" == "UNX" - - -# copy files in RES_FILELIST -.IF "$(OS)"=="SOLARIS" - @$(COPY) $(MOZ_BIN_DIR)$/res$/charsetalias.properties $(RUNTIME_DIR)$/res$/charsetalias.properties -.ELSE - @echo No Res Files to copy. -.ENDIF - -# copy files in COMPONENT_RUNTIMELIST - $(foreach,file,$(COMPONENT_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/components$/$(DLLPRE)$(file)$(DLLPOST) \ - $(RUNTIME_DIR)$/components$/$(DLLPRE)$(file)$(DLLPOST) &&) \ - echo >& $(NULLDEV) - -# copy files in COMREGISTRY_FILELIST - $(foreach,file,$(COMREGISTRY_FILELIST) $(COPY) $(MOZ_BIN_DIR)$/components$/$(file) \ - $(RUNTIME_DIR)$/components$/$(file) &&) \ - echo >& $(NULLDEV) - -# copy files in DEFAULTS_RUNTIMELIST - @@-$(MKDIR) $(RUNTIME_DIR)$/defaults$/pref - @@-$(MKDIR) $(RUNTIME_DIR)$/defaults$/autoconfig - @@-$(MKDIR) $(RUNTIME_DIR)$/greprefs - $(foreach,file,$(DEFAULTS_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/$(file) $(RUNTIME_DIR)$/$(file) &&) \ - echo >& $(NULLDEV) - -.IF "$(GUI)"=="UNX" -.IF "$(OS)"!="MACOSX" - cd $(RUNTIME_DIR) && strip *$(DLLPOST) - cd $(RUNTIME_DIR)$/components && strip *$(DLLPOST) -.ENDIF -.ENDIF -.IF "$(OS)"=="MACOSX" - $(PERL) $(SOLARENV)$/bin$/macosx-change-install-names.pl extshl OOO \ - $(RUNTIME_DIR)$/*$(DLLPOST) -# A crude hack to adapt all the install names in the components subdir: - $(foreach,file,$(shell ls $(RUNTIME_DIR)$/components$/*$(DLLPOST)) \ - install_name_tool \ - -change @executable_path/libldap50.dylib \ - @loader_path/../libldap50.dylib \ - -change @executable_path/libmozjs.dylib @loader_path/../libmozjs.dylib \ - -change @executable_path/libmozz.dylib @loader_path/../libmozz.dylib \ - -change @executable_path/libmsgbaseutil.dylib \ - @loader_path/../libmsgbaseutil.dylib \ - -change @executable_path/libnspr4.dylib @loader_path/../libnspr4.dylib \ - -change @executable_path/libnss3.dylib @loader_path/../libnss3.dylib \ - -change @executable_path/libplc4.dylib @loader_path/../libplc4.dylib \ - -change @executable_path/libplds4.dylib @loader_path/../libplds4.dylib \ - -change @executable_path/libprldap50.dylib \ - @loader_path/../libprldap50.dylib \ - -change @executable_path/libsmime3.dylib \ - @loader_path/../libsmime3.dylib \ - -change @executable_path/libsoftokn3.dylib \ - @loader_path/../libsoftokn3.dylib \ - -change @executable_path/libssl3.dylib @loader_path/../libssl3.dylib \ - -change @executable_path/libxpcom.dylib @loader_path/../libxpcom.dylib \ - -change @executable_path/libxpcom_compat.dylib \ - @loader_path/../libxpcom_compat.dylib \ - $(file) &&) true -.ENDIF - -# zip runtime files to mozruntime.zip - cd $(RUNTIME_DIR) && zip -r ..$/..$/bin$/mozruntime.zip * - - $(TOUCH) $@ - -$(INCCOM)$/nsBuildID.h: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @-echo "You can delete $(INCCOM) to force it copy all include files again." - - -$(MISC)$/build$/so_moz_include_files: $(INCCOM)$/nsBuildID.h -.IF "$(OS)"!="SOLARIS" - $(GNUCOPY) -pRL $(INCLUDE_PATH)* $(INCLUDE_DIR) - $(GNUCOPY) -pRL $(PUBLIC_PATH)* $(INCLUDE_DIR) -.ELSE # "$(OS)"!="SOLARIS" - $(COPY) -pr $(INCLUDE_PATH)* $(INCLUDE_DIR) - $(COPY) -pr $(PUBLIC_PATH)* $(INCLUDE_DIR) -.ENDIF # "$(OS)"!="SOLARIS" - -.IF "$(GUI)"=="UNX" - chmod -R 775 $(INCCOM) -.ENDIF - $(TOUCH) $@ -.IF "$(ENABLE_NSS_MODULE)"=="YES" - +$(foreach,dir,$(NSS_INCLUDE_LIST) $(RENAME:s/+//) $(INCLUDE_DIR)$/$(dir) $(INCLUDE_DIR)$/$(dir)_remove_me &&) echo >& $(NULLDEV) - $(foreach,dir,$(NSS_INCLUDE_LIST) rm -rf $(INCLUDE_DIR)$/$(dir)_remove_me &&) echo >& $(NULLDEV) - -$(MKDIR) $(OUT)$/inc.nss - cd $(OUT)$/inc.nss && $(foreach,dir,$(NSS_INCLUDE_LIST) $(GNUCOPY) -pRL $(SOLARINCDIR)$/mozilla/$(dir) . &&) echo >& $(NULLDEV) -.ENDIF - -# On UNX the rules for so_moz_runtime_files copy files into the same directory -# used here (LIB_DIR), and on MACOSX all those files together need to be -# processed here, hence the dependency on so_moz_runtime_files: -$(MISC)$/build$/so_moz_lib_files: $(foreach,file,$(LIBLIST) $(LIB_DIR)$/$(file)) $(MISC)$/build$/so_moz_runtime_files - echo $(foreach,file,$(LIBLIST) $(MOZ_DIST_DIR)$/lib$/$(file)) - $(foreach,file,$(LIBLIST) $(COPY) $(MOZ_DIST_DIR)$/lib$/$(file) \ - $(LIB_DIR)$/$(file) &&) \ - echo >& $(NULLDEV) -.IF "$(OS)"=="MACOSX" - $(PERL) $(SOLARENV)$/bin$/macosx-change-install-names.pl extshl OOO \ - $(LIB_DIR)$/*$(DLLPOST) -.ENDIF -.IF "$(GUI)"=="UNX" - chmod -R 775 $(LB) -.ENDIF - $(TOUCH) $@ - -$(BIN_RUNTIMELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @$(COPY) $(MOZ_BIN_DIR)$/$(DLLPRE)$@$(DLLPOST) $(RUNTIME_DIR)$/$(DLLPRE)$@$(DLLPOST) - -$(COMPONENT_RUNTIMELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @$(COPY) $(MOZ_BIN_DIR)$/components$/$(DLLPRE)$@$(DLLPOST) $(RUNTIME_DIR)$/components$/$(DLLPRE)$@$(DLLPOST) - -$(COMREGISTRY_FILELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @$(COPY) $(MOZ_BIN_DIR)$/components$/$@ $(RUNTIME_DIR)$/components$/$@ - -$(DEFAULTS_RUNTIMELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @$(COPY) $(MOZ_BIN_DIR)$/$@ $(RUNTIME_DIR)$/$@ - -RES_FILELIST: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) -.IF "$(OS)"=="SOLARIS" - @$(COPY) $(MOZ_BIN_DIR)$/res$/charsetalias.properties $(RUNTIME_DIR)$/res$/charsetalias.properties -.ELSE - @echo No Res Files to copy. -.ENDIF - -$(LIB_DIR)$/%: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - noop - -$(MISC)$/CREATETARBALL: extract_mozab_files - @@-$(MKDIR) $(OUT)$/zipped - $(COPY) $(BIN)$/mozruntime.zip $(OUT)$/zipped$/$(MOZTARGET)runtime.zip -.IF "$(GUI)"=="UNX" -.IF "$(OS)"!="MACOSX" - cd $(LB) && strip *$(DLLPOST) -.ENDIF -.ENDIF - cd $(LB) && zip -r ..$/zipped$/$(MOZTARGET)lib.zip * - cd $(INCCOM) && zip -r ..$/zipped$/$(MOZTARGET)inc.zip * -.IF "$(ENABLE_NSS_MODULE)"=="YES" - cd $(OUT)$/inc.nss && zip -r ..$/zipped$/$(MOZTARGET)inc.zip * -.ENDIF diff --git a/moz/makefile.mk b/moz/makefile.mk deleted file mode 100644 index 65b786180a30..000000000000 --- a/moz/makefile.mk +++ /dev/null @@ -1,438 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=. - -PRJNAME=ooo_mozab -TARGET=ooo_mozab - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(WITH_MOZILLA)"=="NO" - -all: - @echo Support for mozilla is disabled. - -.ELIF "$(BUILD_MOZAB)"=="" - -all: - @echo Use of internal mozilla is disabled. - -.ELSE - - -# ----- pkg-config start ------- -.INCLUDE .IGNORE : pkgroot.mk -.IF "$(PKGCONFIG_ROOT)"!="" -PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config -PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig -.IF "$(LD_LIBRARY_PATH)"=="" # assume empty implies unset -LD_LIBRARY_PATH!:=$(PKGCONFIG_ROOT)$/lib -.ELSE -LD_LIBRARY_PATH!:=$(LD_LIBRARY_PATH)$(PATH_SEPERATOR)$(PKGCONFIG_ROOT)$/lib -.ENDIF -.EXPORT : PKG_CONFIG_PATH PKG_CONFIG LD_LIBRARY_PATH -.ENDIF # "$(PKGCONFIG_ROOT)"!="" - -# reduce prerequisites by disabling mozilla binary -DISABLE_MOZ_EXECUTABLE=TRUE -.EXPORT : DISABLE_MOZ_EXECUTABLE - -.IF "$(SYSBASE)"!="" && "$(OS)" == "LINUX" -## hmm... rather gcc specific switches... -CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib -LDFLAGS:= -Wl,--unresolved-symbols=ignore-in-shared-libs -L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/X11R6/lib -SYSBASE_X11:=--x-includes=$(SYSBASE)/usr/include/X11 --x-libraries=$(SYSBASE)/usr/X11R6/lib -MOZ_ENABLE_COREXFONTS=1 -MOZILLA_CONFIGURE_FLAGS +=--disable-xft -.EXPORT : CFLAGS LDFLAGS MOZ_ENABLE_COREXFONTS -.ENDIF # "$(SYSBASE)"!="" && "$(OS)" == "LINUX" - -.IF "$(SYSBASE)"!="" && "$(OS)" == "MACOSX" -PKGCONFIG_ROOT!:=$(ENV_ROOT)$/macports-1.7.0 -PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config -PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig -.EXPORT : PKG_CONFIG_PATH PKG_CONFIG -# hmm... rather gcc specific switches... -CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib -B$(SYSBASE)/usr/lib/system -L$(ENV_ROOT)/macports-1.7.0/lib -lmathCommon -LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/lib/system -XLDOPTS:= -B$(SYSBASE)/usr/lib -B$(SYSBASE)/usr/lib/system -lmathCommon -.EXPORT : CFLAGS LDFLAGS XLDOPTS -.ENDIF # "$(SYSBASE)"!="" && "$(OS)" == "MACOSX" - -# ----- pkg-config end ------- - -MOZILLA_VERSION=1.1.14 -TARFILE_NAME=seamonkey-$(MOZILLA_VERSION).source -TARFILE_MD5=a169ab152209200a7bad29a275cb0333 - -TARFILE_ROOTDIR=mozilla -PATCH_FILES = \ - seamonkey-source-$(MOZILLA_VERSION).patch \ - patches/gcc46.patch \ - patches/gcc47.patch \ - patches/dtoa.patch \ - patches/respect_disable_pango.patch \ - patches/arm_build_fix.patch \ - patches/link_fontconfig.patch \ - patches/brokenmakefile.patch - -.IF "$(OS)"=="LINUX" -PATCH_FILES+=patches/nss_linux.patch -.ENDIF - -# This file is needed for the W32 build when BUILD_MOZAB is set -# (currently only vc8/vs2005 is supported when BUILD_MOZAB is set) -.IF "$(COM)"=="GCC" -LIBIDL_VC71_ZIPFILE_NAME*=vc71-libIDL-0.6.8-bin.zip -LIBGLIB_VC71_ZIPFILE_NAME*=vc71-glib-1.2.10-bin.zip -MOZTOOLS_ZIPFILE_NAME*=wintools.zip -.ELSE -MOZTOOLS_ZIPFILE_NAME*=vc8-moztools.zip -.ENDIF - -ADDITIONAL_FILES=mailnews$/addrbook$/src$/nsAbMD5sum.cpp - -CONFIGURE_DIR= -.IF "$(GUIBASE)"!="aqua" -MOZILLA_CONFIGURE_FLAGS += $(SYSBASE_X11) -.ENDIF - -MOZILLA_CONFIGURE_FLAGS += --disable-tests \ - --enable-application=suite \ - --enable-ldap \ - --enable-crypto \ - --enable-optimize \ - --enable-strip \ - --disable-profilelocking \ - --disable-activex \ - --disable-activex-scripting \ - --disable-gnomevfs \ - --disable-debug \ - --disable-xprint \ - --disable-postscript \ - --without-system-zlib \ - --disable-installer \ - --disable-accessibility \ - --disable-xpfe-components \ - --disable-mathml \ - --disable-oji \ - --disable-profilesharing \ - --disable-boehm \ - --disable-jsloader \ - --disable-canvas \ - --disable-freetype2 \ - --disable-gnomeui \ - --disable-image-encoders \ - --disable-plugins \ - --disable-printing \ - --disable-pango \ - --enable-extensions="pref" - -#.IF "$(GUI)"!="WNT" -#MOZILLA_CONFIGURE_FLAGS += --enable-system-cairo -#.ENDIF - -#disable profilelocking to share profile with mozilla -#disable activex and activex-scripting to remove the dependence of Microsoft_SDK\src\mfc\atlbase.h -#disable gnomevfs to remove the needed of gnome develop files -#disable others to save build times - -.IF "$(GUI)"=="UNX" -.IF "$(GUIBASE)"=="aqua" -MACDEVSDK*=/Developer/SDKs/MacOSX10.4u.sdk -MOZILLA_CONFIGURE_FLAGS+= \ - --with-macos-sdk=$(MACDEVSDK) \ - --disable-glibtest \ - --enable-macos-target=10.4 \ - --disable-libxul -DEFAULT_MOZILLA_TOOLKIT=mac -.ELSE -#We do not need mozilla ui, but libIDL version are decided by default toolkit. -#default-toolkit=xlib need libIDL < 0.68 -#default-toolkit=gtk2 need libIDL > 0.8 (know as libIDL2) -DEFAULT_MOZILLA_TOOLKIT*=gtk2 -.ENDIF # "$(GUIBASE)"=="aqua" -MOZILLA_CONFIGURE_FLAGS+= --enable-default-toolkit=$(DEFAULT_MOZILLA_TOOLKIT) -.ENDIF - -# create a objdir build = build files in a seperate directory, not in the sourcetree directly -CONFIGURE_DIR=$(CPU)_objdir -BUILD_DIR=$(CONFIGURE_DIR) -MOZ_CROSSCOMPILE=CROSS_COMPILE=1 CC="$(CC) -arch $(MOZ_ARCH)" CXX="$(CXX) -arch $(MOZ_ARCH)" AR=ar - -CONFIGURE_ACTION=$(null,$(MOZ_ARCH) $(NULL) $(MOZ_CROSSCOMPILE)) ../configure $(MOZILLA_CONFIGURE_FLAGS) - -BUILD_ACTION:=$(GNUMAKE) -j$(EXTMAXPROCESS) - -.IF "$(GUI)"=="UNX" -.IF "$(COMNAME)"=="sunpro5" -CXXFLAGS:=-features=tmplife -.IF "$(CPU)"=="U" -CXXFLAGS+=-m64 -.ENDIF -.EXPORT : CXXFLAGS -.ENDIF # "$(COMNAME)"=="sunpro5" -.IF "$(COM)$(OS)$(CPUNAME)" == "GCCLINUXPOWERPC64" -CXXFLAGS:=-mminimal-toc -.EXPORT : CXXFLAGS -.ENDIF -.ENDIF - -.IF "$(OS)"=="SOLARIS" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U" -PKG_CONFIG_PATH=/usr/lib/64/pkgconfig -.EXPORT: PKG_CONFIG_PATH -MAKE=/usr/sfw/bin/gmake -.EXPORT: MAKE -CFLAGS=-I/usr/sfw/include -.EXPORT: CFLAGS -.ENDIF -.IF "$(COM)"=="C52" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U" -CFLAGS=-m64 -ASFLAGS=-m64 -.EXPORT: CFLAGS ASFLAGS -.ENDIF - -MOZDIR=$(MISC)$/build$/seamonkey -MOZTARGET=$(OS)$(COM)$(CPU) - -.IF "$(GUI)"=="WNT" -# "Our" build environment uses "NO" for the environment variable that -# indicate if system libraries should be used, the mozilla build uses -# "" in this case. This conflicts (at least for W32) with mozilla (1.7b) -# because it disables the library checks for msvc so that -# --without-system-* is not evaluated. To build the included libraries -# the affected variables have to be empty and not NO. -.IF "$(SYSTEM_ZLIB)"=="NO" -SYSTEM_ZLIB:= -.EXPORT : SYSTEM_ZLIB -.ENDIF -.IF "$(SYSTEM_JPEG)"=="NO" -SYSTEM_JPEG:= -.EXPORT : SYSTEM_JPEG -.ENDIF - -# For W32-tcsh CC and CXX must not contain the wrapper, and W32-4nt ( in -# some cases ) doesn't work with DOS path notation when building mozilla. -.IF "$(COM)"=="GCC" -CC:=$(CC:s/guw.exe //:s/ -mno-cygwin//) -CXX:=$(CXX:s/guw.exe //:s/ -mno-cygwin//) -CPP:=$(CC) -E -LD:=ld -LIBS:=-lsupc++ -.EXPORT : CPP LIBS -.ELSE -CC:=cl.exe -CXX:=cl.exe -.ENDIF - -# Variables to install/use our own wintools -.IF "$(COM)"=="GCC" -MOZTOOLSUNPACK:=$(MISC)$/build$/moztoolsunpack -MOZTOOLSINST:=$(MISC)$/build$/moztoolsinst -.ELSE -MOZTOOLS_EXTRACT:=$(MISC)$/build$/moztools -.ENDIF -.IF "$(COM)"=="GCC" -MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztoolsinst -PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin -SET_MOZ_TOOLS_INSTALL_BAT:=export "MOZ_TOOLS=$(MOZ_TOOLS_DOS)" -.ELSE -MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztools\vc8-moztools -PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH) -.ENDIF - -MOZ_TOOLS:=$(subst,\,/ $(MOZ_TOOLS_DOS)) -.IF "$(COM)"=="GCC" -GLIB_PREFIX:=$(MOZ_TOOLS)/vc71 -LIBIDL_PREFIX:=$(MOZ_TOOLS)/vc71 -.EXPORT : GLIB_PREFIX LIBIDL_PREFIX -.ENDIF - -.EXPORT : PATH MOZ_TOOLS -.ENDIF # "$(GUI)"=="WNT" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : set_ext.mk -.INCLUDE : target.mk -.INCLUDE : tg_ext.mk - -.IF "$(GUI)"=="WNT" -NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/moztools.complete -.ENDIF # "$(GUI)"=="WNT" - -ALLTAR: $(NEEDWINTOOLSFLAGFILE) \ - $(MISC)$/remove_build.flag \ - extract_mozab_files - -$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/remove_build.flag - -# Since you never know what will be in a patch (for example, it may already -# patch at configure level), we remove the entire package directory if a patch -# is newer. -$(MISC)$/remove_build.flag : $(PATCH_FILES) - $(REMOVE_PACKAGE_COMMAND) - $(TOUCH) $(MISC)$/remove_build.flag - -# Unpack/setup Windows build tools -.IF "$(GUI)"=="WNT" -$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/moztools.complete - -.IF "$(COM)"=="GCC" -$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) - -$(RENAME) $(MOZTOOLSUNPACK) $(MOZTOOLSUNPACK)_removeme - -$(RENAME) $(MOZTOOLSINST) $(MOZTOOLSINST)_removeme - -rm -rf $(MOZTOOLSUNPACK)_removeme $(MOZTOOLSINST)_removeme - @-$(MKDIRHIER) $(MOZTOOLSUNPACK) - unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLSUNPACK) - $(TOUCH) $(MISC)$/build$/moztools.unpack - -$(MISC)$/build$/moztools.install : $(MISC)$/build$/moztools.unpack - cd $(MOZTOOLSUNPACK)$/buildtools$/windows && $(SET_MOZ_TOOLS_INSTALL_BAT) && cmd /c install.bat - $(TOUCH) $(MISC)$/build$/moztools.install - -$(MISC)$/build$/moztools.complete : \ - $(MISC)$/build$/moztools.install \ - $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) \ - $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME) - unzip $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST) - unzip $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST) -# chmod is also needed for W32-4nt build (when cygwin unzip is used) - -chmod -R +x $(MOZTOOLSINST)$/vc71$/bin - $(TOUCH) $(MISC)$/build$/moztools.complete -.ELSE -$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) - -$(RENAME) $(MOZTOOLS_EXTRACT) $(MOZTOOLS_EXTRACT)_removeme - -rm -rf $(MOZTOOLS_EXTRACT)_removeme - @-$(MKDIRHIER) $(MOZTOOLS_EXTRACT) - unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLS_EXTRACT) -# chmod is also needed for W32-4nt build (when cygwin unzip is used) - -chmod -R +x $(MOZTOOLS_EXTRACT)$/vc8-moztools$/bin - $(TOUCH) $(MISC)$/build$/moztools.unpack - -$(MISC)$/build$/moztools.complete : $(MISC)$/build$/moztools.unpack - $(TOUCH) $(MISC)$/build$/moztools.complete -.ENDIF -.ENDIF # "$(GUI)"=="WNT" - -zip: \ - $(MISC)$/CREATETARBALL - -.IF "$(GUIBASE)"=="aqua" -MOZ_ARCH=$(eq,$(CPU),I i386 ppc) -MOZILLA_CONFIGURE_FLAGS+=$(eq,$(CPU),I --target=i386-apple-darwin8 --target=powerpc-apple-darwin8) - -force_clean : - @$(IFEXIST) $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) $(THEN) echo 'ERROR: get rid of your outputdir first (or refactor the makefiles to allow incremental creation of prebuilt zips). Remember to copy already created zips to a safe place '; exit 1 $(FI) - -zip_intel .SEQUENTIAL: force_clean $(MISC)$/CREATETARBALL - -zip_ppc .SEQUENTIAL: force_clean $(MISC)$/CREATETARBALL - -# target-conditionals, when building target -> Macro is set -zip_intel ?= MOZ_ARCH=i386 -zip_intel ?= MOZILLA_CONFIGURE_FLAGS+=--target=i386-apple-darwin8 -zip_intel ?= CPU=I - -zip_ppc ?= MOZ_ARCH=ppc -zip_ppc ?= MOZILLA_CONFIGURE_FLAGS+=--target=powerpc-apple-darwin8 -zip_ppc ?= CPU=P - -zip_universal: $(OUT)$/zipped$/$(OS)$(COM)UBinc.zip $(OUT)$/zipped$/$(OS)$(COM)UBlib.zip $(OUT)$/zipped$/$(OS)$(COM)UBruntime.zip - @echo "All zips created successfully - copy from $(OUT)$/zipped to \$$SRC_ROOT/moz/zipped and use --disable-build-mozilla to use them" - -$(OUT)$/zipped$/$(OS)$(COM)UBinc.zip : zipped$/$(OS)$(COM)Pinc.zip zipped$/$(OS)$(COM)Iinc.zip - @echo "setting up for $@" - @rm -rf $(MISC)$/UB_inc - @$(MKDIRHIER) $(MISC)$/UB_inc$/intel - @$(MKDIR) $(MISC)$/UB_inc$/ppc - @$(MKDIR) $(MISC)$/UB_inc$/uni - @unzip -q zipped$/$(OS)$(COM)Pinc.zip -d $(MISC)$/UB_inc$/ppc - @unzip -q zipped$/$(OS)$(COM)Iinc.zip -d $(MISC)$/UB_inc$/intel -# use one of the two as basis for the universal one - (saves manually creating directories/copying identical files) - @unzip -q zipped$/$(OS)$(COM)Pinc.zip -d $(MISC)$/UB_inc$/uni -# add safety-warning to host-autogenerated headers (aren't used anywhere in OOo currently, but doesn't hurt to be safe -# bail out on everything that differs and is not a *.h file - @echo "flagging endian-specific headers with #error.." - @diff --brief -r $(MISC)$/UB_inc$/ppc $(MISC)$/UB_inc$/intel | awk \ - '/^Only in/ {{print; print "ERROR - file sets differ!"; exit 1}} \ - /^Files .*\.h differ$$/ {{target="$(MISC)$/UB_inc$/uni$/" substr($$2,length("$(MISC)$/UB_inc$/ppc")+2); \ - system("echo \"#error use native moz-zips, this header is endian-specific!\" | cat - " $$2 " > " target); next}} \ - {{print; print "ERROR - unexpected files encountered!"; exit 2}}' - @cd $(MISC)$/UB_inc$/uni ; zip -q -r ..$/$(@:f) * - @$(MKDIRHIER) $(@:d) - @$(MV) $(MISC)$/UB_inc$/$(@:f) $@ - @echo "successfully created $@" - -$(OUT)$/zipped$/$(OS)$(COM)UBlib.zip : zipped$/$(OS)$(COM)Plib.zip zipped$/$(OS)$(COM)Ilib.zip - @echo "setting up for $@" - @rm -rf $(MISC)$/UB_lib - @$(MKDIRHIER) $(MISC)$/UB_lib$/intel - @$(MKDIR) $(MISC)$/UB_lib$/ppc - @$(MKDIR) $(MISC)$/UB_lib$/uni - @unzip -q zipped$/$(OS)$(COM)Plib.zip -d $(MISC)$/UB_lib$/ppc - @unzip -q zipped$/$(OS)$(COM)Ilib.zip -d $(MISC)$/UB_lib$/intel -# use lipo on .a and .dylib files - bail out on anything else - @echo "creating universal binaries from libs..." - @diff --brief -s -r $(MISC)$/UB_lib$/ppc $(MISC)$/UB_lib$/intel | awk \ - '/^Only in/ {{print "ERROR - file sets differ!"; print; exit 1}} \ - /^Files .*\.(a|dylib) differ$$/ {{target="$(MISC)$/UB_lib$/uni$/" substr($$2,length("$(MISC)$/UB_lib$/ppc")+2); \ - if(0!=system("lipo -create -arch ppc "$$2" -arch i386 "$$4" -output " target)) exit 11; next}} \ - {{print; print "ERROR - unexpected files encountered!"; exit 2}}' - @cd $(MISC)$/UB_lib$/uni ; zip -q -r ..$/$(@:f) * - @$(MKDIRHIER) $(@:d) - @$(MV) $(MISC)$/UB_lib$/$(@:f) $@ - @echo "successfully created $@" - -$(OUT)$/zipped$/$(OS)$(COM)UBruntime.zip : zipped$/$(OS)$(COM)Pruntime.zip zipped$/$(OS)$(COM)Iruntime.zip - @echo "setting up for $@" - @rm -rf $(MISC)$/UB_runtime - @$(MKDIRHIER) $(MISC)$/UB_runtime$/intel - @$(MKDIR) $(MISC)$/UB_runtime$/ppc - @$(MKDIR) $(MISC)$/UB_runtime$/uni - @unzip -q zipped$/$(OS)$(COM)Pruntime.zip -d $(MISC)$/UB_runtime$/ppc - @unzip -q zipped$/$(OS)$(COM)Iruntime.zip -d $(MISC)$/UB_runtime$/intel -# use one of the two as basis for the universal one - (saves manually creating directories/copying identical files) - @unzip -q zipped$/$(OS)$(COM)Pruntime.zip -d $(MISC)$/UB_runtime$/uni -# @line -comments in autogenerated files: contains path of source-file, ignore different objdirs - @echo "creating universal binaries from libs..." - @diff --brief -I "^//@line [0-9][0-9]*" -r $(MISC)$/UB_runtime$/ppc $(MISC)$/UB_runtime$/intel | awk \ - '/^Only in/ {{print; print "ERROR - file sets differ!"; exit 1}} \ - /^Files .*\.dylib differ$$/ {{target="$(MISC)$/UB_runtime$/uni$/" substr($$2,length("$(MISC)$/UB_runtime$/ppc")+2); \ - if(0!=system("lipo -create -arch ppc "$$2" -arch i386 "$$4" -output " target)) exit 11; next}} \ - {{print; print "ERROR - unexpected files encountered!"; exit 2}}' - @cd $(MISC)$/UB_lib$/uni ; zip -q -r ..$/$(@:f) * - @$(MKDIRHIER) $(@:d) - @$(MV) $(MISC)$/UB_lib$/$(@:f) $@ - @echo "successfully created $@" - -.ENDIF # $(GUIBASE)=="aqua" - -.INCLUDE : extractfiles.mk - -.ENDIF diff --git a/moz/patches/arm_build_fix.patch b/moz/patches/arm_build_fix.patch deleted file mode 100644 index 79368e5fe6db..000000000000 --- a/moz/patches/arm_build_fix.patch +++ /dev/null @@ -1,189 +0,0 @@ ---- misc/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp 2010-01-29 08:39:01.000000000 +0000 -+++ misc/build/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp 2010-01-29 08:41:01.000000000 +0000 -@@ -44,8 +44,21 @@ - #error "This code is for Linux ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour." - #endif - -+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)) -+/* This tells gcc3.4+ not to optimize away symbols. -+ * * @see http://gcc.gnu.org/gcc-3.4/changes.html -+ * */ -+#define DONT_DROP_OR_WARN __attribute__((used)) -+#else -+/* This tells older gccs not to warn about unused vairables. -+ * * @see http://docs.freebsd.org/info/gcc/gcc.info.Variable_Attributes.html -+ * */ -+#define DONT_DROP_OR_WARN __attribute__((unused)) -+#endif -+ - /* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */ --static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) asm("_PrepareAndDispatch"); -+static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) asm("_PrepareAndDispatch") -+DONT_DROP_OR_WARN; - - static nsresult - PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) ---- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2010-02-05 13:13:56.000000000 +0000 -+++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2010-02-05 13:14:16.000000000 +0000 -@@ -124,5 +124,5 @@ - endif - endif - --libs install :: $(CHECKLOC) -+libs install :: - ---- misc/mozilla/security/manager/Makefile.in 2010-02-05 13:27:25.000000000 +0000 -+++ misc/build/mozilla/security/manager/Makefile.in 2010-02-05 13:28:00.000000000 +0000 -@@ -53,7 +53,6 @@ - SMIME3_LIB \ - SSL3_LIB \ - SOFTOKEN3_LIB \ -- SOFTOKEN3_CHK \ - LOADABLE_ROOT_MODULE \ - HAVE_FREEBL_LIBS \ - HAVE_FREEBL_LIBS_32 \ -@@ -68,7 +67,6 @@ - SMIME3_LIB = $(DLL_PREFIX)smime3$(DLL_SUFFIX) - SSL3_LIB = $(DLL_PREFIX)ssl3$(DLL_SUFFIX) - SOFTOKEN3_LIB = $(DLL_PREFIX)softokn3$(DLL_SUFFIX) --SOFTOKEN3_CHK = $(DLL_PREFIX)softokn3.chk - - # Default - HAVE_FREEBL_LIBS = 1 -@@ -99,23 +97,17 @@ - - ifdef HAVE_FREEBL_LIBS - FREEBL_LIB = $(DLL_PREFIX)freebl3$(DLL_SUFFIX) --FREEBL_CHK = $(DLL_PREFIX)freebl3.chk - endif - ifdef HAVE_FREEBL_LIBS_32 - FREEBL_32INT_LIB = libfreebl_32int_3$(DLL_SUFFIX) --FREEBL_32INT_CHK = libfreebl_32int_3.chk - FREEBL_32FPU_LIB = libfreebl_32fpu_3$(DLL_SUFFIX) --FREEBL_32FPU_CHK = libfreebl_32fpu_3.chk - endif - ifdef HAVE_FREEBL_LIBS_32INT64 - FREEBL_32INT64_LIB = libfreebl_32int64_3$(DLL_SUFFIX) --FREEBL_32INT64_CHK = libfreebl_32int64_3.chk - endif - ifdef HAVE_FREEBL_LIBS_64 - FREEBL_64INT_LIB = libfreebl_64int_3$(DLL_SUFFIX) --FREEBL_64INT_CHK = libfreebl_64int_3.chk - FREEBL_64FPU_LIB = libfreebl_64fpu_3$(DLL_SUFFIX) --FREEBL_64FPU_CHK = libfreebl_64fpu_3.chk - endif - - ABS_DIST := $(shell cd $(DIST) && pwd) -@@ -210,7 +202,6 @@ - OS_ARCH="$(OS_ARCH)" \ - CPU_ARCH="$(TARGET_CPU)" \ - $(NULL) --SKIP_CHK=1 - endif - SUBMAKEFILES = boot/Makefile ssl/Makefile pki/Makefile locales/Makefile - -@@ -223,10 +214,6 @@ - ifndef MOZ_NATIVE_NSS - $(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean - $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean --ifndef SKIP_CHK -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean --endif - touch $@ - endif - -@@ -262,43 +249,22 @@ - # In NSS 3.11.8-3.11.9, lib/ssl/derive.c includes cmd/lib/secutil.h. - $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) export - $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) DIRS="util base dev pki pki1 certdb certhigh pk11wrap cryptohi nss ssl pkcs12 pkcs7 smime crmf jar ckfw ckfw/builtins" --ifndef SKIP_CHK -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) --endif - $(INSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DIST)/bin --ifndef SKIP_CHK -- $(INSTALL) -m 644 $(DIST)/lib/$(SOFTOKEN3_CHK) $(DIST)/bin --endif - $(INSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DIST)/bin - $(INSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DIST)/bin - $(INSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DIST)/bin - $(INSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DIST)/bin - ifdef HAVE_FREEBL_LIBS --ifndef SKIP_CHK -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_CHK) $(DIST)/bin --endif - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DIST)/bin - endif - ifdef HAVE_FREEBL_LIBS_32 --ifndef SKIP_CHK -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT_CHK) $(DIST)/bin -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32FPU_CHK) $(DIST)/bin --endif - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DIST)/bin - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DIST)/bin - endif - ifdef HAVE_FREEBL_LIBS_32INT64 --ifndef SKIP_CHK -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT64_CHK) $(DIST)/bin --endif - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DIST)/bin - endif - ifdef HAVE_FREEBL_LIBS_64 --ifndef SKIP_CHK -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_64INT_CHK) $(DIST)/bin -- $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_64FPU_CHK) $(DIST)/bin --endif - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DIST)/bin - $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DIST)/bin - endif -@@ -313,38 +279,21 @@ - install:: - ifndef MOZ_NATIVE_NSS - $(SYSINSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DESTDIR)$(mozappdir) --ifndef SKIP_CHK -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(SOFTOKEN3_CHK) $(DESTDIR)$(mozappdir) --endif - $(SYSINSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DESTDIR)$(mozappdir) - $(SYSINSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DESTDIR)$(mozappdir) - $(SYSINSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DESTDIR)$(mozappdir) - $(SYSINSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DESTDIR)$(mozappdir) - ifdef HAVE_FREEBL_LIBS --ifndef SKIP_CHK -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_CHK) $(DESTDIR)$(mozappdir) --endif - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DESTDIR)$(mozappdir) - endif - ifdef HAVE_FREEBL_LIBS_32 --ifndef SKIP_CHK -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT_CHK) $(DESTDIR)$(mozappdir) -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32FPU_CHK) $(DESTDIR)$(mozappdir) --endif - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DESTDIR)$(mozappdir) - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DESTDIR)$(mozappdir) - endif - ifdef HAVE_FREEBL_LIBS_32INT64 --ifndef SKIP_CHK -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT64_CHK) $(DESTDIR)$(mozappdir) --endif - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DESTDIR)$(mozappdir) - endif - ifdef HAVE_FREEBL_LIBS_64 --ifndef SKIP_CHK -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_64INT_CHK) $(DESTDIR)$(mozappdir) -- $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_64FPU_CHK) $(DESTDIR)$(mozappdir) --endif - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DESTDIR)$(mozappdir) - $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DESTDIR)$(mozappdir) - endif -@@ -366,10 +315,6 @@ - ifndef MOZ_NATIVE_NSS - $(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean - $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean --ifndef SKIP_CHK -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean -- $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean --endif - endif - - echo-requires-recursive:: diff --git a/moz/patches/brokenmakefile.patch b/moz/patches/brokenmakefile.patch deleted file mode 100644 index 20d88014b932..000000000000 --- a/moz/patches/brokenmakefile.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- misc/mozilla/mailnews/extensions/smime/build/Makefile.in 2010-09-04 16:00:38.000000000 +0100 -+++ misc/build/mozilla/mailnews/extensions/smime/build/Makefile.in 2010-09-04 16:02:24.000000000 +0100 -@@ -79,10 +79,6 @@ - $(DIST)/lib/$(LIB_PREFIX)msgsmime_s.$(LIB_SUFFIX) \ - $(NULL) - --ifndef MOZ_STATIC_MAIL_BUILD --SHARED_LIBRARY_LIBS + = $(DIST)/lib/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX) --endif -- - EXTRA_DSO_LDOPTS = \ - $(LIBS_DIR) \ - $(EXTRA_DSO_LIBS) \ diff --git a/moz/patches/consecutive_ldap_queries.patch b/moz/patches/consecutive_ldap_queries.patch deleted file mode 100644 index d82d594bce09..000000000000 --- a/moz/patches/consecutive_ldap_queries.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:39:32.054968600 +0100 -+++ mozilla.patched/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:35:35.633832119 +0100 -@@ -833,6 +833,10 @@ - if (msgListener) - { - msgListener->mUrl = url; -+ msgListener->mQueryListener = listener; -+ msgListener->mResultLimit = resultLimit; -+ msgListener->mTimeOut = timeOut; -+ msgListener->mQueryArguments = arguments; - return msgListener->DoSearch(); - } - } diff --git a/moz/patches/cygwin_paths_in_ldap_sdk.patch b/moz/patches/cygwin_paths_in_ldap_sdk.patch deleted file mode 100644 index e0983aecbe74..000000000000 --- a/moz/patches/cygwin_paths_in_ldap_sdk.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- mozilla.org/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100 -+++ mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-10-31 23:34:41.695625000 +0100 -@@ -85,6 +85,9 @@ - - ########################################################################### - -+INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR)) -+GENHEADERS:=$(shell cygpath -u $(GENHEADERS)) -+ - all export:: $(INCLUDEDIR) $(GENHEADERS) - $(NSINSTALL) -D $(PRIVATEINCDIR) - $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR) diff --git a/moz/patches/dtoa.patch b/moz/patches/dtoa.patch deleted file mode 100644 index fce3be38b10b..000000000000 --- a/moz/patches/dtoa.patch +++ /dev/null @@ -1,237 +0,0 @@ ---- misc/mozilla/nsprpub/pr/src/misc/prdtoa.c 20 Mar 2009 03:41:21 -0000 4.7 -+++ misc/build/mozilla/nsprpub/pr/src/misc/prdtoa.c 15 Sep 2009 00:10:20 -0000 -@@ -169,17 +169,22 @@ void _PR_CleanupDtoa(void) - * Llong, #define #ULLong to be the corresponding unsigned type. - * #define KR_headers for old-style C function headers. - * #define Bad_float_h if your system lacks a float.h or if it does not - * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, - * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. - * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) - * if memory is available and otherwise does something you deem - * appropriate. If MALLOC is undefined, malloc will be invoked -- * directly -- and assumed always to succeed. -+ * directly -- and assumed always to succeed. Similarly, if you -+ * want something other than the system's free() to be called to -+ * recycle memory acquired from MALLOC, #define FREE to be the -+ * name of the alternate routine. (FREE or free is only called in -+ * pathological cases, e.g., in a dtoa call after a dtoa return in -+ * mode 3 with thousands of digits requested.) - * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making - * memory allocations from a private pool of memory when possible. - * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, - * unless #defined to be a different length. This default length - * suffices to get rid of MALLOC calls except for unusual cases, - * such as decimal-to-binary conversion of a very long string of - * digits. The longest string dtoa can return is about 751 bytes - * long. For conversions by strtod of strings of 800 digits and -@@ -553,17 +558,17 @@ extern double rnd_prod(double, double), - #endif - #endif /* NO_LONG_LONG */ - - #ifndef MULTIPLE_THREADS - #define ACQUIRE_DTOA_LOCK(n) /*nothing*/ - #define FREE_DTOA_LOCK(n) /*nothing*/ - #endif - --#define Kmax 15 -+#define Kmax 7 - - struct - Bigint { - struct Bigint *next; - int k, maxwds, sign, wds; - ULong x[1]; - }; - -@@ -581,27 +586,28 @@ Balloc - { - int x; - Bigint *rv; - #ifndef Omit_Private_Memory - unsigned int len; - #endif - - ACQUIRE_DTOA_LOCK(0); -- if (rv = freelist[k]) { -+ /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ -+ /* but this case seems very unlikely. */ -+ if (k <= Kmax && (rv = freelist[k])) - freelist[k] = rv->next; -- } - else { - x = 1 << k; - #ifdef Omit_Private_Memory - rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); - #else - len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) - /sizeof(double); -- if (pmem_next - private_mem + len <= PRIVATE_mem) { -+ if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { - rv = (Bigint*)pmem_next; - pmem_next += len; - } - else - rv = (Bigint*)MALLOC(len*sizeof(double)); - #endif - rv->k = k; - rv->maxwds = x; -@@ -615,20 +621,28 @@ Balloc - Bfree - #ifdef KR_headers - (v) Bigint *v; - #else - (Bigint *v) - #endif - { - if (v) { -- ACQUIRE_DTOA_LOCK(0); -- v->next = freelist[v->k]; -- freelist[v->k] = v; -- FREE_DTOA_LOCK(0); -+ if (v->k > Kmax) -+#ifdef FREE -+ FREE((void*)v); -+#else -+ free((void*)v); -+#endif -+ else { -+ ACQUIRE_DTOA_LOCK(0); -+ v->next = freelist[v->k]; -+ freelist[v->k] = v; -+ FREE_DTOA_LOCK(0); -+ } - } - } - - #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ - y->wds*sizeof(Long) + 2*sizeof(int)) - - static Bigint * - multadd ---- misc/mozilla/js/src/jsdtoa.c 2 Sep 2007 22:20:41 -0000 3.41 -+++ misc/build/mozilla/js/src/jsdtoa.c 18 Sep 2009 16:15:13 -0000 -@@ -145,17 +145,22 @@ - * and if "unsigned Llong" does not work as an unsigned version of - * Llong, #define #ULLong to be the corresponding unsigned type. - * #define Bad_float_h if your system lacks a float.h or if it does not - * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, - * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. - * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) - * if memory is available and otherwise does something you deem - * appropriate. If MALLOC is undefined, malloc will be invoked -- * directly -- and assumed always to succeed. -+ * directly -- and assumed always to succeed. Similarly, if you -+ * want something other than the system's free() to be called to -+ * recycle memory acquired from MALLOC, #define FREE to be the -+ * name of the alternate routine. (FREE or free is only called in -+ * pathological cases, e.g., in a dtoa call after a dtoa return in -+ * mode 3 with thousands of digits requested.) - * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making - * memory allocations from a private pool of memory when possible. - * When used, the private pool is PRIVATE_MEM bytes long: 2000 bytes, - * unless #defined to be a different length. This default length - * suffices to get rid of MALLOC calls except for unusual cases, - * such as decimal-to-binary conversion of a very long string of - * digits. - * #define INFNAN_CHECK on IEEE systems to cause strtod to check for -@@ -320,17 +325,17 @@ static PRLock *freelist_lock; - JS_END_MACRO - #define RELEASE_DTOA_LOCK() PR_Unlock(freelist_lock) - #else - #undef MULTIPLE_THREADS - #define ACQUIRE_DTOA_LOCK() /*nothing*/ - #define RELEASE_DTOA_LOCK() /*nothing*/ - #endif - --#define Kmax 15 -+#define Kmax 7 - - struct Bigint { - struct Bigint *next; /* Free list link */ - int32 k; /* lg2(maxwds) */ - int32 maxwds; /* Number of words allocated for x */ - int32 sign; /* Zero if positive, 1 if negative. Ignored by most Bigint routines! */ - int32 wds; /* Actual number of words. If value is nonzero, the most significant word must be nonzero. */ - ULong x[1]; /* wds words of number in little endian order */ -@@ -400,26 +405,26 @@ static Bigint *Balloc(int32 k) - - #ifdef ENABLE_OOM_TESTING - if (++allocationNum == desiredFailure) { - printf("Forced Failing Allocation number %d\n", allocationNum); - return NULL; - } - #endif - -- if ((rv = freelist[k]) != NULL) -+ if (k <= Kmax && (rv = freelist[k]) != NULL) - freelist[k] = rv->next; - if (rv == NULL) { - x = 1 << k; - #ifdef Omit_Private_Memory - rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); - #else - len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) - /sizeof(double); -- if (pmem_next - private_mem + len <= PRIVATE_mem) { -+ if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { - rv = (Bigint*)pmem_next; - pmem_next += len; - } - else - rv = (Bigint*)MALLOC(len*sizeof(double)); - #endif - if (!rv) - return NULL; -@@ -428,18 +433,26 @@ static Bigint *Balloc(int32 k) - } - rv->sign = rv->wds = 0; - return rv; - } - - static void Bfree(Bigint *v) - { - if (v) { -- v->next = freelist[v->k]; -- freelist[v->k] = v; -+ if (v->k > Kmax) -+#ifdef FREE -+ FREE((void*)v); -+#else -+ free((void*)v); -+#endif -+ else { -+ v->next = freelist[v->k]; -+ freelist[v->k] = v; -+ } - } - } - - #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ - y->wds*sizeof(Long) + 2*sizeof(int32)) - - /* Return b*m + a. Deallocate the old b. Both a and m must be between 0 and - * 65535 inclusive. NOTE: old b is deallocated on memory failure. ---- misc/mozilla/js/src/jsdtoa.c 22 Sep 2009 06:16:27 -0000 3.42 -+++ misc/build/mozilla/js/src/jsdtoa.c 15 Oct 2009 10:34:38 -0000 -@@ -405,19 +405,19 @@ static Bigint *Balloc(int32 k) - - #ifdef ENABLE_OOM_TESTING - if (++allocationNum == desiredFailure) { - printf("Forced Failing Allocation number %d\n", allocationNum); - return NULL; - } - #endif - -- if (k <= Kmax && (rv = freelist[k]) != NULL) -+ if (k <= Kmax && (rv = freelist[k])) - freelist[k] = rv->next; -- if (rv == NULL) { -+ else { - x = 1 << k; - #ifdef Omit_Private_Memory - rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); - #else - len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) - /sizeof(double); - if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { - rv = (Bigint*)pmem_next; diff --git a/moz/patches/embed_manifest.patch b/moz/patches/embed_manifest.patch deleted file mode 100644 index 3b0e80b3ab81..000000000000 --- a/moz/patches/embed_manifest.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200 -+++ mozilla/configure 2008-11-09 23:59:19.984375000 +0100 -@@ -1068,6 +1068,8 @@ - GCONF_VERSION=1.2.1 - LIBGNOME_VERSION=2.0 - -+MSMANIFEST_TOOL= -+ - MISSING_X= - for ac_prog in gawk mawk nawk awk - do -@@ -3025,6 +3027,22 @@ - else - { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; } - fi -+ -+ # bug #249782 -+ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else) -+ if test "$_CC_SUITE" -ge "8"; then -+ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` -+ if test -n "MSMT_TOOL"; then -+ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"` -+ if test -z "MSMANIFEST_TOOL_VERSION"; then -+ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2 -+ fi -+ MSMANIFEST_TOOL=1 -+ unset MSMT_TOOL -+ else -+ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; } -+ fi -+ fi - - # Check linker version - _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"` ---- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200 -+++ mozilla/configure.in 2008-11-09 23:59:20.000000000 +0100 -@@ -126,6 +126,8 @@ - GCONF_VERSION=1.2.1 - LIBGNOME_VERSION=2.0 - -+MSMANIFEST_TOOL= -+ - dnl Set various checks - dnl ======================================================== - MISSING_X= -@@ -428,6 +430,22 @@ - else - AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.]) - fi -+ -+ # bug #249782 -+ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else) -+ if test "$_CC_SUITE" -ge "8"; then -+ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` -+ if test -n "MSMT_TOOL"; then -+ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"` -+ if test -z "MSMANIFEST_TOOL_VERSION"; then -+ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.]) -+ fi -+ MSMANIFEST_TOOL=1 -+ unset MSMT_TOOL -+ else -+ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.]) -+ fi -+ fi - - # Check linker version - _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"` -@@ -7319,6 +7339,7 @@ - AC_SUBST(USE_N32) - AC_SUBST(CC_VERSION) - AC_SUBST(CXX_VERSION) -+AC_SUBST(MSMANIFEST_TOOL) - - if test "$USING_HCC"; then - CC='${topsrcdir}/build/hcc' ---- mozilla.pure/config/rules.mk 2008-01-29 20:30:22.000000000 +0100 -+++ mozilla/config/rules.mk 2008-11-09 23:59:19.968750000 +0100 -@@ -811,6 +812,12 @@ - - ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - ifeq ($(CPP_PROG_LINK),1) - $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE) -@@ -843,6 +850,12 @@ - else - ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH)) - $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) - endif -@@ -866,6 +879,12 @@ - else - ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - ifeq ($(CPP_PROG_LINK),1) - $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS) -@@ -1019,6 +1038,14 @@ - endif # SHARED_LIBRARY_LIBS - endif # NO_LD_ARCHIVE_FLAGS - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) -+ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool -+endif # WINNT && !GCC - @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK) - else # os2 vacpp - $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) ---- mozilla.pure/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200 -+++ mozilla/config/autoconf.mk.in 2008-11-09 23:59:19.953125000 +0100 -@@ -543,6 +543,7 @@ - MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@ - MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ - MOZ_QUANTIFY = @MOZ_QUANTIFY@ -+MSMANIFEST_TOOL = @MSMANIFEST_TOOL@ - - #python options - PYTHON = @MOZ_PYTHON@ diff --git a/moz/patches/gcc46.patch b/moz/patches/gcc46.patch deleted file mode 100644 index 86a46581c355..000000000000 --- a/moz/patches/gcc46.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- misc/mozilla/intl/unicharutil/util/nsUnicharUtils.h 2008-08-30 01:14:52.000000000 +0200 -+++ misc/build/mozilla/intl/unicharutil/util/nsUnicharUtils.h 2011-06-18 23:51:31.000000000 +0200 -@@ -64,6 +64,7 @@ - : public nsStringComparator - { - public: -+ nsCaseInsensitiveStringComparator() { } - virtual int operator()( const PRUnichar*, const PRUnichar*, PRUint32 aLength ) const; - virtual int operator()( PRUnichar, PRUnichar ) const; - }; diff --git a/moz/patches/gcc47.patch b/moz/patches/gcc47.patch deleted file mode 100644 index bbad5c4046ed..000000000000 --- a/moz/patches/gcc47.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- misc/mozilla/xpcom/glue/nsBaseHashtable.h 2005-09-27 12:44:20.000000000 -0300 -+++ misc/build/mozilla/xpcom/glue/nsBaseHashtable.h 2012-07-02 07:27:03.872079682 -0300 -@@ -123,7 +123,7 @@ public: - */ - PRBool Get(KeyType aKey, UserDataType* pData) const - { -- EntryType* ent = GetEntry(aKey); -+ EntryType* ent = this->GetEntry(aKey); - - if (!ent) - return PR_FALSE; -@@ -142,7 +142,7 @@ public: - */ - PRBool Put(KeyType aKey, UserDataType aData) - { -- EntryType* ent = PutEntry(aKey); -+ EntryType* ent = this->PutEntry(aKey); - - if (!ent) - return PR_FALSE; -@@ -156,7 +156,7 @@ public: - * remove the data for the associated key - * @param aKey the key to remove from the hashtable - */ -- void Remove(KeyType aKey) { RemoveEntry(aKey); } -+ void Remove(KeyType aKey) { this->RemoveEntry(aKey); } - - /** - * function type provided by the application for enumeration. ---- misc/mozilla/xpcom/glue/nsClassHashtable.h 2005-08-11 16:42:37.000000000 -0300 -+++ misc/build/mozilla/xpcom/glue/nsClassHashtable.h 2012-07-02 07:27:24.649081115 -0300 -@@ -98,7 +98,7 @@ PRBool - nsClassHashtable<KeyClass,T>::Get(KeyType aKey, T** retVal) const - { - typename nsBaseHashtable<KeyClass,nsAutoPtr<T>,T*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { -@@ -126,7 +126,7 @@ nsClassHashtableMT<KeyClass,T>::Get(KeyT - PR_Lock(this->mLock); - - typename nsBaseHashtableMT<KeyClass,nsAutoPtr<T>,T*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { ---- misc/mozilla/xpcom/glue/nsInterfaceHashtable.h 2005-08-11 16:42:48.000000000 -0300 -+++ misc/build/mozilla/xpcom/glue/nsInterfaceHashtable.h 2012-07-02 07:26:54.023079003 -0300 -@@ -111,7 +111,7 @@ nsInterfaceHashtable<KeyClass,Interface> - (KeyType aKey, UserDataType* pInterface) const - { - typename nsBaseHashtable<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { -@@ -139,7 +139,7 @@ nsInterfaceHashtable<KeyClass,Interface> - (KeyType aKey, PRBool* aFound) const - { - typename nsBaseHashtable<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { -@@ -167,7 +167,7 @@ nsInterfaceHashtableMT<KeyClass,Interfac - PR_Lock(this->mLock); - - typename nsBaseHashtableMT<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { ---- misc/mozilla/xpcom/glue/nsRefPtrHashtable.h 2005-08-11 16:42:51.000000000 -0300 -+++ misc/build/mozilla/xpcom/glue/nsRefPtrHashtable.h 2012-07-02 07:27:04.145079700 -0300 -@@ -112,7 +112,7 @@ nsRefPtrHashtable<KeyClass,RefPtr>::Get - (KeyType aKey, UserDataType* pRefPtr) const - { - typename nsBaseHashtable<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { -@@ -140,7 +140,7 @@ nsRefPtrHashtable<KeyClass,RefPtr>::GetW - (KeyType aKey, PRBool* aFound) const - { - typename nsBaseHashtable<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { -@@ -168,7 +168,7 @@ nsRefPtrHashtableMT<KeyClass,RefPtr>::Ge - PR_Lock(this->mLock); - - typename nsBaseHashtableMT<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = -- GetEntry(aKey); -+ this->GetEntry(aKey); - - if (ent) - { diff --git a/moz/patches/index.txt b/moz/patches/index.txt deleted file mode 100644 index 2fb47aad1236..000000000000 --- a/moz/patches/index.txt +++ /dev/null @@ -1,86 +0,0 @@ -# *************************************************************
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# *************************************************************
-
-====================================================================================
-File name
----------
- embed_manifest.patch
-
-Description
------------
- When building Mozilla with MSVC2005, generated libraries and applications
- require the manifest file (name.dll.manifest) to reside beside the file
- itself, or to be embedded.
-
- The patch does the latter: embedding the manifest file into the
- library/application itself, using the Manifest Tool from the Platform SDK
- resp. MSVC installation.
-
- The patch is effectively the patch as was committed to the Mozilla trunk,
- taken from here: https://bugzilla.mozilla.org/show_bug.cgi?id=249782#c81.
-
-====================================================================================
-File name
----------
- wchart_on_msvc8.patch
-
-Description
------------
- For compiling with MSVC2005: See https://bugzilla.mozilla.org/show_bug.cgi?id=324842.
-
-====================================================================================
-File name
----------
- cygwin_paths_in_ldap_sdk.patch
-
-Description
------------
- make 1.81, as currently part of cygwin, does not support Windows paths anymore.
- So, targets, and target dependencies, in makefile may need to be converted to cygwin
- notation. This patch does this for directory/c-sdk/ldap/include, other occurances are
- not known, yet.
-
-====================================================================================
-File name
----------
- no_core_abspath_in_nss.patch
-
-Description
------------
- On various platforms, building security/nss/cmd/shlibsign fails. In all cases, the
- error messages indicate the core_abspath macro used in the Makefile is not resolved
- properly.
- This patch replaces the usage of core_abspath with platform-specific constructs.
-
-====================================================================================
-File name
----------
- consecutive_ldap_queries.patch
-
-Description
------------
- Consecutive LDAP address book queries (using the same instance of nsAbLDAPDirectoryQuery,
- but different parameters to the DoQuery method) do not work in OOo. The reason is that
- the second call to DoQuery ignores most of its arguments, including the listener which
- is to be notified about the query results, and re-uses the arguments from the first
- call.
- The patch changes the DoQuery behavior to respect the arguments of the second call.
-
diff --git a/moz/patches/link_fontconfig.patch b/moz/patches/link_fontconfig.patch deleted file mode 100644 index 66e82fa63e52..000000000000 --- a/moz/patches/link_fontconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- misc/mozilla/gfx/src/gtk/Makefile.in 2010-03-16 14:44:44.000000000 +0000 -+++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2010-03-16 14:45:08.000000000 +0000 -@@ -183,7 +183,7 @@ - endif - - ifdef MOZ_ENABLE_XFT --EXTRA_DSO_LDOPTS += $(FT2_LIBS) -+EXTRA_DSO_LDOPTS += $(FT2_LIBS) -lfontconfig - - libs:: fontEncoding.properties pangoFontEncoding.properties - $(INSTALL) $^ $(DIST)/bin/res/fonts diff --git a/moz/patches/no_core_abspath_in_nss.patch b/moz/patches/no_core_abspath_in_nss.patch deleted file mode 100644 index 026cc7e3eb92..000000000000 --- a/moz/patches/no_core_abspath_in_nss.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- mozilla.pure/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100 -+++ mozilla/security/nss/cmd/shlibsign/Makefile 2008-11-05 14:04:54.798875000 +0100 -@@ -86,18 +86,47 @@ - - include ../platrules.mk - --SRCDIR = $(call core_abspath,.) -- -+ifeq ($(OS_TARGET), Darwin) -+ SRCDIR = . -+else -+ifeq ($(OS_TARGET), Linux) -+ SRCDIR = . -+else -+ifeq ($(OS_TARGET), WIN95) -+ SRCDIR = $(shell cygpath -d $(SRCDIR)) -+else -+ SRCDIR = $(call core_abspath,.) -+endif -+endif -+endif - %.chk: %.$(DLL_SUFFIX) - ifeq ($(OS_TARGET), OS2) - cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \ - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<) - else -+ifeq ($(OS_TARGET), WIN95) -+ sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \ -+ $(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \ -+ $(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<) -+else -+ifeq ($(OS_TARGET), Darwin) -+ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+else -+ifeq ($(OS_TARGET), Linux) -+ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+else - cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \ - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<) - endif -+endif -+endif -+endif - - libs install :: $(CHECKLOC) - diff --git a/moz/patches/nss_linux.patch b/moz/patches/nss_linux.patch deleted file mode 100644 index 167b1f0cf904..000000000000 --- a/moz/patches/nss_linux.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -uNrp misc/mozilla/security/coreconf/config.mk misc/build/mozilla/security/coreconf/config.mk ---- misc/mozilla/security/coreconf/config.mk 2008-06-15 19:22:15.000000000 -0300 -+++ misc/build/mozilla/security/coreconf/config.mk 2011-12-14 22:27:52.383209720 -0300 -@@ -63,7 +63,7 @@ endif - ####################################################################### - - TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \ -- OpenVMS AIX -+ OpenVMS AIX Linux - - ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET))) - include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk -diff -uNrp misc/mozilla/security/coreconf/Linux.mk misc/build/mozilla/security/coreconf/Linux.mk ---- misc/mozilla/security/coreconf/Linux.mk 2011-12-14 22:26:12.391200222 -0300 -+++ misc/build/mozilla/security/coreconf/Linux.mk 2011-12-14 22:29:30.183219009 -0300 -@@ -177,3 +177,19 @@ G++INCLUDES = -I/usr/include/g++ - # Always set CPU_TAG on Linux, OpenVMS, WINCE. - # - CPU_TAG = _$(CPU_ARCH) -+ -+OS_REL_CFLAGS += -DLINUX2_1 -+MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) -+ -+ifdef MAPFILE -+ MKSHLIB += -Wl,--version-script,$(MAPFILE) -+endif -+PROCESS_MAP_FILE = grep -v ';-' $< | \ -+ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ -+ -+ifeq ($(OS_RELEASE),2.4) -+# Softoken 3.13 uses NO_FORK_CHECK only. -+# Softoken 3.12 uses NO_FORK_CHECK and NO_CHECK_FORK. -+# Don't use NO_CHECK_FORK in new code. -+DEFINES += -DNO_FORK_CHECK -DNO_CHECK_FORK -+endif diff --git a/moz/patches/respect_disable_pango.patch b/moz/patches/respect_disable_pango.patch deleted file mode 100644 index 07a83e9dd40a..000000000000 --- a/moz/patches/respect_disable_pango.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- misc/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp 2006-02-28 15:55:35.000000000 +0100 -+++ misc/build/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp 2009-11-13 15:12:24.000000000 +0100 -@@ -66,10 +66,12 @@ - #endif /* MOZ_WIDGET_GTK */ - - #ifdef MOZ_WIDGET_GTK2 -+#ifdef MOZ_ENABLE_PANGO - #include <pango/pango.h> - #include <pango/pangox.h> - #include <pango/pango-fontmap.h> - #endif -+#endif - - #ifdef MOZ_ENABLE_XFT - #include "nsFontMetricsUtils.h" -@@ -963,9 +965,11 @@ - #ifdef MOZ_WIDGET_GTK2 - - #ifdef MOZ_ENABLE_COREXFONTS -+#ifdef MOZ_ENABLE_PANGO - static void xlfd_from_pango_font_description(GtkWidget *aWidget, - const PangoFontDescription *aFontDesc, - nsString& aFontName); -+#endif - #endif /* MOZ_ENABLE_COREXFONTS */ - - nsresult -@@ -997,10 +1001,12 @@ - #endif /* MOZ_ENABLE_XFT */ - - #ifdef MOZ_ENABLE_COREXFONTS -+#ifdef MOZ_ENABLE_PANGO - // if name already set by Xft, do nothing - if (!aFont->name.Length()) { - xlfd_from_pango_font_description(aWidget, desc, aFont->name); - } -+#endif /* MOZ_ENABLE_PANGO */ - #endif /* MOZ_ENABLE_COREXFONTS */ - aFont->weight = pango_font_description_get_weight(desc); - -@@ -1104,6 +1110,7 @@ - #endif /* MOZ_ENABLE_XFT */ - - #if defined(MOZ_WIDGET_GTK2) && defined(MOZ_ENABLE_COREXFONTS) -+#ifdef MOZ_ENABLE_PANGO - // xlfd_from_pango_font_description copied from vte, which was - // written by nalin@redhat.com, and added some codes. - static void -@@ -1226,4 +1233,5 @@ - g_free(spec); - g_object_unref(font); - } -+#endif - #endif /* MOZ_WIDGET_GTK2 && MOZ_ENABLE_COREXFONTS */ diff --git a/moz/patches/wchart_on_msvc8.patch b/moz/patches/wchart_on_msvc8.patch deleted file mode 100644 index a8f31cd4c3e3..000000000000 --- a/moz/patches/wchart_on_msvc8.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200 -+++ mozilla/configure.in 2008-11-10 16:15:36.859375000 +0100 -@@ -425,6 +425,7 @@ - _CC_SUITE=7 - elif test "$_CC_MAJOR_VERSION" = "14"; then - _CC_SUITE=8 -+ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" - else - AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.]) - fi ---- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200 -+++ mozilla/configure 2008-11-10 16:15:30.437500000 +0100 -@@ -3022,6 +3022,7 @@ - _CC_SUITE=7 - elif test "$_CC_MAJOR_VERSION" = "14"; then - _CC_SUITE=8 -+ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" - else - { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; } - fi diff --git a/moz/prj/build.lst b/moz/prj/build.lst deleted file mode 100644 index 717c309da96e..000000000000 --- a/moz/prj/build.lst +++ /dev/null @@ -1,4 +0,0 @@ -moz moz : solenv SO:so_prereq NSS:nss NULL -moz moz usr1 - all moz_mkout NULL -moz moz nmake - all moz_mozilla NULL -moz moz\zipped nmake - all moz_zipped moz_mozilla NULL diff --git a/moz/prj/d.lst b/moz/prj/d.lst deleted file mode 100644 index 67bd28bb164b..000000000000 --- a/moz/prj/d.lst +++ /dev/null @@ -1,257 +0,0 @@ -mkdir: %_DEST%\inc%_EXT%\mozilla -mkdir: %COMMON_DEST%\inc%_EXT%\mozilla -mkdir: %_DEST%\inc%_EXT%\mozilla\absync -mkdir: %_DEST%\inc%_EXT%\mozilla\accessibility -mkdir: %_DEST%\inc%_EXT%\mozilla\AcctIdl -mkdir: %_DEST%\inc%_EXT%\mozilla\addrbook -mkdir: %_DEST%\inc%_EXT%\mozilla\appcomps -mkdir: %_DEST%\inc%_EXT%\mozilla\appshell -mkdir: %_DEST%\inc%_EXT%\mozilla\appstartup -mkdir: %_DEST%\inc%_EXT%\mozilla\bookmarks -mkdir: %_DEST%\inc%_EXT%\mozilla\caps -mkdir: %_DEST%\inc%_EXT%\mozilla\chardet -mkdir: %_DEST%\inc%_EXT%\mozilla\chrome -mkdir: %_DEST%\inc%_EXT%\mozilla\content -mkdir: %_DEST%\inc%_EXT%\mozilla\content_xsl -mkdir: %_DEST%\inc%_EXT%\mozilla\content_xul -mkdir: %_DEST%\inc%_EXT%\mozilla\cookie -mkdir: %_DEST%\inc%_EXT%\mozilla\docshell -mkdir: %_DEST%\inc%_EXT%\mozilla\dom -mkdir: %_DEST%\inc%_EXT%\mozilla\editor -mkdir: %_DEST%\inc%_EXT%\mozilla\embed_base -mkdir: %_DEST%\inc%_EXT%\mozilla\expat -mkdir: %_DEST%\inc%_EXT%\mozilla\exthandler -mkdir: %_DEST%\inc%_EXT%\mozilla\find -mkdir: %_DEST%\inc%_EXT%\mozilla\gfx -mkdir: %_DEST%\inc%_EXT%\mozilla\gfx2 -mkdir: %_DEST%\inc%_EXT%\mozilla\gfxwin -mkdir: %_DEST%\inc%_EXT%\mozilla\gkplugin -mkdir: %_DEST%\inc%_EXT%\mozilla\helperAppDlg -mkdir: %_DEST%\inc%_EXT%\mozilla\history -mkdir: %_DEST%\inc%_EXT%\mozilla\htmlparser -mkdir: %_DEST%\inc%_EXT%\mozilla\imgicon -mkdir: %_DEST%\inc%_EXT%\mozilla\imglib2 -mkdir: %_DEST%\inc%_EXT%\mozilla\import -mkdir: %_DEST%\inc%_EXT%\mozilla\intl -mkdir: %_DEST%\inc%_EXT%\mozilla\intlcmpt -mkdir: %_DEST%\inc%_EXT%\mozilla\jar -mkdir: %_DEST%\inc%_EXT%\mozilla\java -mkdir: %_DEST%\inc%_EXT%\mozilla\jpeg -mkdir: %_DEST%\inc%_EXT%\mozilla\js -mkdir: %_DEST%\inc%_EXT%\mozilla\jsconsole -mkdir: %_DEST%\inc%_EXT%\mozilla\jsurl -mkdir: %_DEST%\inc%_EXT%\mozilla\layout -mkdir: %_DEST%\inc%_EXT%\mozilla\layout_xul -mkdir: %_DEST%\inc%_EXT%\mozilla\ldap -mkdir: %_DEST%\inc%_EXT%\mozilla\ldap\ldap -mkdir: %_DEST%\inc%_EXT%\mozilla\ldap-nspr -mkdir: %_DEST%\inc%_EXT%\mozilla\locale -mkdir: %_DEST%\inc%_EXT%\mozilla\lwbrk -mkdir: %_DEST%\inc%_EXT%\mozilla\mailnews -mkdir: %_DEST%\inc%_EXT%\mozilla\mime -mkdir: %_DEST%\inc%_EXT%\mozilla\mimeemitter -mkdir: %_DEST%\inc%_EXT%\mozilla\mimetype -mkdir: %_DEST%\inc%_EXT%\mozilla\mng -mkdir: %_DEST%\inc%_EXT%\mozilla\mork -mkdir: %_DEST%\inc%_EXT%\mozilla\mozbrwsr -mkdir: %_DEST%\inc%_EXT%\mozilla\mozldap -mkdir: %_DEST%\inc%_EXT%\mozilla\mozreg -mkdir: %_DEST%\inc%_EXT%\mozilla\mpfilelocprovider -mkdir: %_DEST%\inc%_EXT%\mozilla\msgbase -mkdir: %_DEST%\inc%_EXT%\mozilla\msgbaseutil -mkdir: %_DEST%\inc%_EXT%\mozilla\msgcompo -mkdir: %_DEST%\inc%_EXT%\mozilla\msgdb -mkdir: %_DEST%\inc%_EXT%\mozilla\msgimap -mkdir: %_DEST%\inc%_EXT%\mozilla\msglocal -mkdir: %_DEST%\inc%_EXT%\mozilla\msgnews -mkdir: %_DEST%\inc%_EXT%\mozilla\msgsearch -mkdir: %_DEST%\inc%_EXT%\mozilla\necko -mkdir: %_DEST%\inc%_EXT%\mozilla\necko2 -mkdir: %_DEST%\inc%_EXT%\mozilla\nkcache -mkdir: %_DEST%\inc%_EXT%\mozilla\nspr -mkdir: %_DEST%\inc%_EXT%\mozilla\nspr\obsolete -mkdir: %_DEST%\inc%_EXT%\mozilla\nspr\private -mkdir: %_DEST%\inc%_EXT%\mozilla\nsprefm -mkdir: %_DEST%\inc%_EXT%\mozilla\nss -mkdir: %_DEST%\inc%_EXT%\mozilla\oji -mkdir: %_DEST%\inc%_EXT%\mozilla\obsolete -mkdir: %_DEST%\inc%_EXT%\mozilla\plugin -mkdir: %_DEST%\inc%_EXT%\mozilla\png -mkdir: %_DEST%\inc%_EXT%\mozilla\pref -mkdir: %_DEST%\inc%_EXT%\mozilla\prefmigr -mkdir: %_DEST%\inc%_EXT%\mozilla\profile -mkdir: %_DEST%\inc%_EXT%\mozilla\rdf -mkdir: %_DEST%\inc%_EXT%\mozilla\rdfutil -mkdir: %_DEST%\inc%_EXT%\mozilla\regviewer -mkdir: %_DEST%\inc%_EXT%\mozilla\related -mkdir: %_DEST%\inc%_EXT%\mozilla\search -mkdir: %_DEST%\inc%_EXT%\mozilla\setuprsc -mkdir: %_DEST%\inc%_EXT%\mozilla\shistory -mkdir: %_DEST%\inc%_EXT%\mozilla\sidebar -mkdir: %_DEST%\inc%_EXT%\mozilla\signonviewer -mkdir: %_DEST%\inc%_EXT%\mozilla\string -mkdir: %_DEST%\inc%_EXT%\mozilla\timer -mkdir: %_DEST%\inc%_EXT%\mozilla\transformiix -mkdir: %_DEST%\inc%_EXT%\mozilla\txmgr -mkdir: %_DEST%\inc%_EXT%\mozilla\txtsvc -mkdir: %_DEST%\inc%_EXT%\mozilla\uconv -mkdir: %_DEST%\inc%_EXT%\mozilla\unicharutil -mkdir: %_DEST%\inc%_EXT%\mozilla\uninstall -mkdir: %_DEST%\inc%_EXT%\mozilla\uriloader -mkdir: %_DEST%\inc%_EXT%\mozilla\urlbarhistory -mkdir: %_DEST%\inc%_EXT%\mozilla\util -mkdir: %_DEST%\inc%_EXT%\mozilla\view -mkdir: %_DEST%\inc%_EXT%\mozilla\wallet -mkdir: %_DEST%\inc%_EXT%\mozilla\walleteditor -mkdir: %_DEST%\inc%_EXT%\mozilla\walletpreview -mkdir: %_DEST%\inc%_EXT%\mozilla\webBrowser_core -mkdir: %_DEST%\inc%_EXT%\mozilla\webshell -mkdir: %_DEST%\inc%_EXT%\mozilla\widget -mkdir: %_DEST%\inc%_EXT%\mozilla\windowwatcher -mkdir: %_DEST%\inc%_EXT%\mozilla\xml-rpc -mkdir: %_DEST%\inc%_EXT%\mozilla\xmlextras -mkdir: %_DEST%\inc%_EXT%\mozilla\xpcom -mkdir: %_DEST%\inc%_EXT%\mozilla\xpconnect -mkdir: %_DEST%\inc%_EXT%\mozilla\xpicleanup -mkdir: %_DEST%\inc%_EXT%\mozilla\xpinstall -mkdir: %_DEST%\inc%_EXT%\mozilla\xpnet -mkdir: %_DEST%\inc%_EXT%\mozilla\zlib -mkdir: %_DEST%\inc%_EXT%\mozilla\xpcom_obsolete - -..\%__SRC%\inc\*.h %_DEST%\inc%_EXT%\mozilla -..\%__SRC%\inc\absync\* %_DEST%\inc%_EXT%\mozilla\absync -..\%__SRC%\inc\accessibility\* %_DEST%\inc%_EXT%\mozilla\accessibility -..\%__SRC%\inc\AcctIdl\* %_DEST%\inc%_EXT%\mozilla\AcctIdl -..\%__SRC%\inc\addrbook\* %_DEST%\inc%_EXT%\mozilla\addrbook -..\%__SRC%\inc\appcomps\* %_DEST%\inc%_EXT%\mozilla\appcomps -..\%__SRC%\inc\appshell\* %_DEST%\inc%_EXT%\mozilla\appshell -..\%__SRC%\inc\appstartup\* %_DEST%\inc%_EXT%\mozilla\appstartup -..\%__SRC%\inc\bookmarks\* %_DEST%\inc%_EXT%\mozilla\bookmarks -..\%__SRC%\inc\caps\* %_DEST%\inc%_EXT%\mozilla\caps -..\%__SRC%\inc\chardet\* %_DEST%\inc%_EXT%\mozilla\chardet -..\%__SRC%\inc\chrome\* %_DEST%\inc%_EXT%\mozilla\chrome -..\%__SRC%\inc\content\* %_DEST%\inc%_EXT%\mozilla\content -..\%__SRC%\inc\content_xsl\* %_DEST%\inc%_EXT%\mozilla\content_xsl -..\%__SRC%\inc\content_xul\* %_DEST%\inc%_EXT%\mozilla\content_xul -..\%__SRC%\inc\cookie\* %_DEST%\inc%_EXT%\mozilla\cookie -..\%__SRC%\inc\docshell\* %_DEST%\inc%_EXT%\mozilla\docshell -..\%__SRC%\inc\dom\* %_DEST%\inc%_EXT%\mozilla\dom -..\%__SRC%\inc\editor\* %_DEST%\inc%_EXT%\mozilla\editor -..\%__SRC%\inc\embed_base\* %_DEST%\inc%_EXT%\mozilla\embed_base -..\%__SRC%\inc\expat\* %_DEST%\inc%_EXT%\mozilla\expat -..\%__SRC%\inc\exthandler\* %_DEST%\inc%_EXT%\mozilla\exthandler -..\%__SRC%\inc\find\* %_DEST%\inc%_EXT%\mozilla\find -..\%__SRC%\inc\gfx\* %_DEST%\inc%_EXT%\mozilla\gfx -..\%__SRC%\inc\gfx2\* %_DEST%\inc%_EXT%\mozilla\gfx2 -..\%__SRC%\inc\gfxwin\* %_DEST%\inc%_EXT%\mozilla\gfxwin -..\%__SRC%\inc\gkplugin\* %_DEST%\inc%_EXT%\mozilla\gkplugin -..\%__SRC%\inc\helperAppDlg\* %_DEST%\inc%_EXT%\mozilla\helperAppDlg -..\%__SRC%\inc\history\* %_DEST%\inc%_EXT%\mozilla\history -..\%__SRC%\inc\htmlparser\* %_DEST%\inc%_EXT%\mozilla\htmlparser -..\%__SRC%\inc\imgicon\* %_DEST%\inc%_EXT%\mozilla\imgicon -..\%__SRC%\inc\imglib2\* %_DEST%\inc%_EXT%\mozilla\imglib2 -..\%__SRC%\inc\import\* %_DEST%\inc%_EXT%\mozilla\import -..\%__SRC%\inc\intl\* %_DEST%\inc%_EXT%\mozilla\intl -..\%__SRC%\inc\intlcmpt\* %_DEST%\inc%_EXT%\mozilla\intlcmpt -..\%__SRC%\inc\jar\* %_DEST%\inc%_EXT%\mozilla\jar -..\%__SRC%\inc\java\* %_DEST%\inc%_EXT%\mozilla\java -..\%__SRC%\inc\jpeg\* %_DEST%\inc%_EXT%\mozilla\jpeg -..\%__SRC%\inc\js\* %_DEST%\inc%_EXT%\mozilla\js -..\%__SRC%\inc\jsconsole\* %_DEST%\inc%_EXT%\mozilla\jsconsole -..\%__SRC%\inc\jsurl\* %_DEST%\inc%_EXT%\mozilla\jsurl -..\%__SRC%\inc\layout\* %_DEST%\inc%_EXT%\mozilla\layout -..\%__SRC%\inc\layout_xul\* %_DEST%\inc%_EXT%\mozilla\layout_xul -..\%__SRC%\inc\ldap\* %_DEST%\inc%_EXT%\mozilla\ldap -..\%__SRC%\inc\ldap\ldap\* %_DEST%\inc%_EXT%\mozilla\ldap\ldap -..\%__SRC%\inc\ldap-nspr\* %_DEST%\inc%_EXT%\mozilla\ldap-nspr -..\%__SRC%\inc\locale\* %_DEST%\inc%_EXT%\mozilla\locale -..\%__SRC%\inc\lwbrk\* %_DEST%\inc%_EXT%\mozilla\lwbrk -..\%__SRC%\inc\mailnews\* %_DEST%\inc%_EXT%\mozilla\mailnews -..\%__SRC%\inc\mime\* %_DEST%\inc%_EXT%\mozilla\mime -..\%__SRC%\inc\mimeemitter\* %_DEST%\inc%_EXT%\mozilla\mimeemitter -..\%__SRC%\inc\mimetype\* %_DEST%\inc%_EXT%\mozilla\mimetype -..\%__SRC%\inc\mng\* %_DEST%\inc%_EXT%\mozilla\mng -..\%__SRC%\inc\mork\* %_DEST%\inc%_EXT%\mozilla\mork -..\%__SRC%\inc\mozbrwsr\* %_DEST%\inc%_EXT%\mozilla\mozbrwsr -..\%__SRC%\inc\mozldap\* %_DEST%\inc%_EXT%\mozilla\mozldap -..\%__SRC%\inc\mozreg\* %_DEST%\inc%_EXT%\mozilla\mozreg -..\%__SRC%\inc\mpfilelocprovider\* %_DEST%\inc%_EXT%\mozilla\mpfilelocprovider -..\%__SRC%\inc\msgbase\* %_DEST%\inc%_EXT%\mozilla\msgbase -..\%__SRC%\inc\msgbaseutil\* %_DEST%\inc%_EXT%\mozilla\msgbaseutil -..\%__SRC%\inc\msgcompo\* %_DEST%\inc%_EXT%\mozilla\msgcompo -..\%__SRC%\inc\msgdb\* %_DEST%\inc%_EXT%\mozilla\msgdb -..\%__SRC%\inc\msgimap\* %_DEST%\inc%_EXT%\mozilla\msgimap -..\%__SRC%\inc\msglocal\* %_DEST%\inc%_EXT%\mozilla\msglocal -..\%__SRC%\inc\msgnews\* %_DEST%\inc%_EXT%\mozilla\msgnews -..\%__SRC%\inc\msgsearch\* %_DEST%\inc%_EXT%\mozilla\msgsearch -..\%__SRC%\inc\necko\* %_DEST%\inc%_EXT%\mozilla\necko -..\%__SRC%\inc\necko2\* %_DEST%\inc%_EXT%\mozilla\necko2 -..\%__SRC%\inc\nkcache\* %_DEST%\inc%_EXT%\mozilla\nkcache -..\%__SRC%\inc\nspr\* %_DEST%\inc%_EXT%\mozilla\nspr -..\%__SRC%\inc\nspr\obsolete\* %_DEST%\inc%_EXT%\mozilla\nspr\obsolete -..\%__SRC%\inc\nspr\private\* %_DEST%\inc%_EXT%\mozilla\nspr\private -..\%__SRC%\inc\nsprefm\* %_DEST%\inc%_EXT%\mozilla\nsprefm -..\%__SRC%\inc\nss\* %_DEST%\inc%_EXT%\mozilla\nss -..\%__SRC%\inc\oji\* %_DEST%\inc%_EXT%\mozilla\oji -..\%__SRC%\inc\obsolete\* %_DEST%\inc%_EXT%\mozilla\obsolete -..\%__SRC%\inc\plugin\* %_DEST%\inc%_EXT%\mozilla\plugin -..\%__SRC%\inc\png\* %_DEST%\inc%_EXT%\mozilla\png -..\%__SRC%\inc\pref\* %_DEST%\inc%_EXT%\mozilla\pref -..\%__SRC%\inc\prefmigr\* %_DEST%\inc%_EXT%\mozilla\prefmigr -..\%__SRC%\inc\profile\* %_DEST%\inc%_EXT%\mozilla\profile -..\%__SRC%\inc\rdf\* %_DEST%\inc%_EXT%\mozilla\rdf -..\%__SRC%\inc\rdfutil\* %_DEST%\inc%_EXT%\mozilla\rdfutil -..\%__SRC%\inc\regviewer\* %_DEST%\inc%_EXT%\mozilla\regviewer -..\%__SRC%\inc\related\* %_DEST%\inc%_EXT%\mozilla\related -..\%__SRC%\inc\search\* %_DEST%\inc%_EXT%\mozilla\search -..\%__SRC%\inc\setuprsc\* %_DEST%\inc%_EXT%\mozilla\setuprsc -..\%__SRC%\inc\shistory\* %_DEST%\inc%_EXT%\mozilla\shistory -..\%__SRC%\inc\sidebar\* %_DEST%\inc%_EXT%\mozilla\sidebar -..\%__SRC%\inc\signonviewer\* %_DEST%\inc%_EXT%\mozilla\signonviewer -..\%__SRC%\inc\string\* %_DEST%\inc%_EXT%\mozilla\string -..\%__SRC%\inc\timer\* %_DEST%\inc%_EXT%\mozilla\timer -..\%__SRC%\inc\transformiix\* %_DEST%\inc%_EXT%\mozilla\transformiix -..\%__SRC%\inc\txmgr\* %_DEST%\inc%_EXT%\mozilla\txmgr -..\%__SRC%\inc\txtsvc\* %_DEST%\inc%_EXT%\mozilla\txtsvc -..\%__SRC%\inc\uconv\* %_DEST%\inc%_EXT%\mozilla\uconv -..\%__SRC%\inc\unicharutil\* %_DEST%\inc%_EXT%\mozilla\unicharutil -..\%__SRC%\inc\uninstall\* %_DEST%\inc%_EXT%\mozilla\uninstall -..\%__SRC%\inc\uriloader\* %_DEST%\inc%_EXT%\mozilla\uriloader -..\%__SRC%\inc\urlbarhistory\* %_DEST%\inc%_EXT%\mozilla\urlbarhistory -..\%__SRC%\inc\util\* %_DEST%\inc%_EXT%\mozilla\util -..\%__SRC%\inc\view\* %_DEST%\inc%_EXT%\mozilla\view -..\%__SRC%\inc\wallet\* %_DEST%\inc%_EXT%\mozilla\wallet -..\%__SRC%\inc\walleteditor\* %_DEST%\inc%_EXT%\mozilla\walleteditor -..\%__SRC%\inc\walletpreview\* %_DEST%\inc%_EXT%\mozilla\walletpreview -..\%__SRC%\inc\webBrowser_core\* %_DEST%\inc%_EXT%\mozilla\webBrowser_core -..\%__SRC%\inc\webshell\* %_DEST%\inc%_EXT%\mozilla\webshell -..\%__SRC%\inc\widget\* %_DEST%\inc%_EXT%\mozilla\widget -..\%__SRC%\inc\windowwatcher\* %_DEST%\inc%_EXT%\mozilla\windowwatcher -..\%__SRC%\inc\xml-rpc\* %_DEST%\inc%_EXT%\mozilla\xml-rpc -..\%__SRC%\inc\xmlextras\* %_DEST%\inc%_EXT%\mozilla\xmlextras -..\%__SRC%\inc\xpcom\* %_DEST%\inc%_EXT%\mozilla\xpcom -..\%__SRC%\inc\xpconnect\* %_DEST%\inc%_EXT%\mozilla\xpconnect -..\%__SRC%\inc\xpicleanup\* %_DEST%\inc%_EXT%\mozilla\xpicleanup -..\%__SRC%\inc\xpinstall\* %_DEST%\inc%_EXT%\mozilla\xpinstall -..\%__SRC%\inc\xpnet\* %_DEST%\inc%_EXT%\mozilla\xpnet -..\%__SRC%\inc\zlib\* %_DEST%\inc%_EXT%\mozilla\zlib -..\%__SRC%\inc\xpcom_obsolete\* %_DEST%\inc%_EXT%\mozilla\xpcom_obsolete - -..\%__SRC%\lib\libldap50.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libmozjs.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libmozz.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libmsgbaseutil.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libnssckbi.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libnssdbm3.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libnssutil3.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libprldap50.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libxpcom.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libxpcom_compat.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\libxpcom_core.* %_DEST%\lib%_EXT% -..\%__SRC%\lib\*.a %_DEST%\lib%_EXT% -..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT% - -mkdir: %_DEST%\lib%_EXT%\sqlite -..\%__SRC%\lib\libsqlite3.* %_DEST%\lib%_EXT%\sqlite - -..\%__SRC%\bin\*.zip %_DEST%\bin%_EXT% diff --git a/moz/seamonkey-source-1.1.14.patch b/moz/seamonkey-source-1.1.14.patch deleted file mode 100644 index 3aabbe1a5f44..000000000000 --- a/moz/seamonkey-source-1.1.14.patch +++ /dev/null @@ -1,6346 +0,0 @@ ---- misc/mozilla/build/autoconf/mozconfig-find 2007-02-16 03:19:06.000000000 +0100 -+++ misc/build/mozilla/build/autoconf/mozconfig-find 2008-08-19 10:12:04.000000000 +0200 -@@ -51,10 +51,7 @@ - "$topsrcdir/.mozconfig" \ - "$topsrcdir/mozconfig" \ - "$topsrcdir/mozconfig.sh" \ -- "$topsrcdir/myconfig.sh" \ -- "$HOME/.mozconfig" \ -- "$HOME/.mozconfig.sh" \ -- "$HOME/.mozmyconfig.sh" -+ "$topsrcdir/myconfig.sh" - do - if test -f "$_config"; then - echo "$_config"; ---- misc/mozilla/build/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200 -+++ misc/build/mozilla/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200 -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - # - # Stupid wrapper to avoid win32 dospath/cygdrive issues - # Try not to spawn programs from within this file. If the stuff in here looks royally -@@ -57,12 +57,36 @@ - i=-I${mountpoint}/${driveletter}/${pathname} - fi - else -- eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}' -- if ! test "${leader}" = "${i}"; then -- eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}' -- eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}' -- driveletter=${no_mountpoint%%/*} -- i=${leader}${driveletter}:/${pathname} -+ # The original version missed mounted paths, the new version below -+ # doesn't transform /para as this is most likely a parameter. -+ eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}' -+ if ! test "$notinpath" = "$i"; then -+ # found $mountpoint -+ eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}' -+ eval 'withdrive=${i#'${notinpath}${mountpoint}'/}' -+ driveletter=${withdrive%%/*} -+ i=${notinpath}${driveletter}:/${restpath} -+ else -+ # check for potential path. Precheck using shell methods -+ doconvert="" -+ # Shortcut -X<path> when path does not begin with '/' -+ noswitch=${i#-[a-zA-Z]} -+ if test "$noswitch" != "$i"; then -+ test "${noswitch#/}" != "$noswitch" && doconvert="1" -+ fi -+ # Precheck for possible path. Consider only absolute paths that contain at least -+ # a second / to prevent converting of /abc parameters. -+ test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1" -+ if test -n "$doconvert"; then -+ # Can be a path. If forking grep would be faster or we could require bash 3 -+ # this regexp would be all that's needed to find pathnames that need converting -+ pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'` -+ eval 'notinpath=${i%'${pathname}'}' -+ if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then -+ pathname=`cygpath -am "$pathname"` -+ i=${notinpath}${pathname} -+ fi -+ fi - fi - fi - fi ---- misc/mozilla/config/Makefile.in 2006-12-22 14:50:41.000000000 +0100 -+++ misc/build/mozilla/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -166,7 +166,7 @@ - - ifdef MOZ_ENABLE_GTK2 - GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS) -- GLIB_LIBS = $(MOZ_GTK2_LIBS) -+ GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS)) - endif - - build_number: FORCE ---- misc/mozilla/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200 -+++ misc/build/mozilla/config/autoconf.mk.in 2008-11-07 16:08:52.937500000 +0100 -@@ -543,6 +543,7 @@ - MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@ - MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ - MOZ_QUANTIFY = @MOZ_QUANTIFY@ -+MSMANIFEST_TOOL = @MSMANIFEST_TOOL@ - - #python options - PYTHON = @MOZ_PYTHON@ ---- misc/mozilla/config/config.mk 2008-01-29 20:30:22.000000000 +0100 -+++ misc/build/mozilla/config/config.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -758,6 +758,23 @@ - endif - - # -+# Shared library RUNPATH linker option(s) -+# -+ifeq ($(OS_ARCH),Linux) -+EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib -+ifdef IS_COMPONENT -+EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib -+endif # IS_COMPONENT -+endif # Linux -+ -+ifeq ($(OS_ARCH),SunOS) -+EXTRA_DSO_LDOPTS += -R '$$ORIGIN' -+ifdef IS_COMPONENT -+EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..' -+endif # IS_COMPONENT -+endif # SunOS -+ -+# - # Include any personal overrides the user might think are needed. - # - -include $(MY_CONFIG) ---- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100 -+++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100 -@@ -529,8 +529,9 @@ - ifeq ($(OS_ARCH),WINNT) - ifdef GNU_CC - ifndef IS_COMPONENT --DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -+DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) - endif -+DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map - endif - endif - -@@ -811,6 +810,12 @@ - - ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - ifeq ($(CPP_PROG_LINK),1) - $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE) -@@ -843,6 +848,12 @@ - else - ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH)) - $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) - endif -@@ -866,6 +877,12 @@ - else - ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool - else - ifeq ($(CPP_PROG_LINK),1) - $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS) -@@ -1019,6 +1036,14 @@ - endif # SHARED_LIBRARY_LIBS - endif # NO_LD_ARCHIVE_FLAGS - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) -+ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) -+ifdef MSMANIFEST_TOOL -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ -+ rm -f $@.manifest; \ -+ fi -+endif # MSVC with manifest tool -+endif # WINNT && !GCC - @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK) - else # os2 vacpp - $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) -@@ -1043,7 +1070,7 @@ - if test -d $(@D); then \ - echo "Building deps for $<"; \ - touch $(_MDDEPFILE) && \ -- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \ -+ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \ - mv $(_MDDEPFILE) $(_MDDEPFILE).old && \ - cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \ - fi -@@ -1053,7 +1080,7 @@ - if test -d $(@D); then \ - echo "Building deps for $<"; \ - touch $(_MDDEPFILE) && \ -- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \ -+ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \ - mv $(_MDDEPFILE) $(_MDDEPFILE).old && \ - cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \ - fi -@@ -1325,6 +1352,7 @@ - - $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done - $(REPORT_BUILD) -+ echo "PATH=" $(PATH) - $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS) - @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \ - then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi -@@ -1696,14 +1724,14 @@ - define MAKE_DEPS_NOAUTO - set -e ; \ - touch $@ && \ -- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \ -+ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \ - mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old - endef - else - define MAKE_DEPS_NOAUTO - set -e ; \ - touch $@ && \ -- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \ -+ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \ - mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old - endef - endif # WINNT ---- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100 -+++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100 -@@ -1068,6 +1068,8 @@ - GCONF_VERSION=1.2.1 - LIBGNOME_VERSION=2.0 - -+MSMANIFEST_TOOL= -+ - MISSING_X= - for ac_prog in gawk mawk nawk awk - do -@@ -3022,9 +3024,26 @@ - _CC_SUITE=7 - elif test "$_CC_MAJOR_VERSION" = "14"; then - _CC_SUITE=8 -+ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" - else - { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; } - fi -+ -+ # bug #249782 -+ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else) -+ if test "$_CC_SUITE" -ge "8"; then -+ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` -+ if test -n "MSMT_TOOL"; then -+ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"` -+ if test -z "MSMANIFEST_TOOL_VERSION"; then -+ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2 -+ fi -+ MSMANIFEST_TOOL=1 -+ unset MSMT_TOOL -+ else -+ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; } -+ fi -+ fi - - # Check linker version - _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"` -@@ -3422,6 +3441,8 @@ - ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' - cross_compiling=$ac_cv_prog_cc_cross - fi -+else -+ ac_cv_prog_CXXCPP="$CXXCPP" - fi - CXXCPP="$ac_cv_prog_CXXCPP" - echo "$ac_t""$CXXCPP" 1>&6 -@@ -5726,6 +5747,7 @@ - if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then - _pwd=`pwd` - CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper" -+ CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER` - fi - if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then - AS_PERL=1 -@@ -6036,7 +6058,7 @@ - CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common" - DLL_SUFFIX=".dylib" - DSO_LDOPTS='' -- STRIP="$STRIP -x -S" -+ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails - _PLATFORM_DEFAULT_TOOLKIT='mac' - MOZ_ENABLE_POSTSCRIPT= - TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' -@@ -6075,7 +6097,7 @@ - ;; - - *-freebsd*) -- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then -+ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then - DLL_SUFFIX=".so.1.0" - DSO_LDOPTS="-shared" - fi -@@ -6455,12 +6477,12 @@ - - - case "$host" in -- *-mingw*) -- CYGPATH_W=echo -+ *-cygwin*|*-mingw*) -+ CYGPATH_W="cygpath -u" - CYGPATH_S=cat -- MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W` -+ MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S` - ;; -- *-cygwin*|*-msvc*|*-mks*) -+ *-msvc*|*-mks*) - CYGPATH_W="cygpath -a -w" - CYGPATH_S="sed -e s|\\\\|/|g" - MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S` -@@ -6718,7 +6740,7 @@ - MOZ_USER_DIR="Mozilla" - - if test "$MOZTOOLS"; then -- MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'` -+ MOZ_TOOLS_DIR=`echo $MOZTOOLS` - else - { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; } - fi -@@ -8614,6 +8636,8 @@ - case $target in - *-hpux11.*) - ;; -+*-freebsd*) -+ ;; - *) - echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6 - echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5 -@@ -19233,7 +19257,8 @@ - MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS" - - if test "$MOZ_X11"; then -- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype" -+# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype" -+ MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype" - fi - if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32" -@@ -20076,8 +20101,12 @@ - WIN_TOP_SRC=`cd $srcdir; pwd -W` - ;; - cygwin*|msvc*|mks*) -- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC" -- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX" -+# Don't add the wrapper for the HOST_* versions as they contain an -+# unexpanded $CC and therfore wil get the wrapper below. -+ if test -n "$GNU_CC"; then -+ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC" -+ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX" -+ fi - CC="\$(CYGWIN_WRAPPER) $CC" - CXX="\$(CYGWIN_WRAPPER) $CXX" - CPP="\$(CYGWIN_WRAPPER) $CPP" ---- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100 -+++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100 -@@ -126,6 +126,8 @@ - GCONF_VERSION=1.2.1 - LIBGNOME_VERSION=2.0 - -+MSMANIFEST_TOOL= -+ - dnl Set various checks - dnl ======================================================== - MISSING_X= -@@ -425,9 +427,26 @@ - _CC_SUITE=7 - elif test "$_CC_MAJOR_VERSION" = "14"; then - _CC_SUITE=8 -+ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" - else - AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.]) - fi -+ -+ # bug #249782 -+ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else) -+ if test "$_CC_SUITE" -ge "8"; then -+ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` -+ if test -n "MSMT_TOOL"; then -+ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"` -+ if test -z "MSMANIFEST_TOOL_VERSION"; then -+ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.]) -+ fi -+ MSMANIFEST_TOOL=1 -+ unset MSMT_TOOL -+ else -+ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.]) -+ fi -+ fi - - # Check linker version - _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"` -@@ -1530,7 +1549,7 @@ - CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common" - DLL_SUFFIX=".dylib" - DSO_LDOPTS='' -- STRIP="$STRIP -x -S" -+ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails - _PLATFORM_DEFAULT_TOOLKIT='mac' - MOZ_ENABLE_POSTSCRIPT= - TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' -@@ -1552,7 +1571,7 @@ - ;; - - *-freebsd*) -- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then -+ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then - DLL_SUFFIX=".so.1.0" - DSO_LDOPTS="-shared" - fi -@@ -1853,10 +1872,10 @@ - - dnl MinGW/MSYS doesn't provide or need cygpath - case "$host" in -- *-mingw*) -- CYGPATH_W=echo -+ *-cygwin*|*-mingw*) -+ CYGPATH_W="cygpath -u" - CYGPATH_S=cat -- MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W` -+ MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S` - ;; - *-cygwin*|*-msvc*|*-mks*) - CYGPATH_W="cygpath -a -w" -@@ -2749,6 +2768,8 @@ - case $target in - *-hpux11.*) - ;; -+*-freebsd*) -+ ;; - *) - AC_CHECK_LIB(c_r, gethostbyname_r) - ;; -@@ -7321,6 +7342,7 @@ - AC_SUBST(USE_N32) - AC_SUBST(CC_VERSION) - AC_SUBST(CXX_VERSION) -+AC_SUBST(MSMANIFEST_TOOL) - - if test "$USING_HCC"; then - CC='${topsrcdir}/build/hcc' -@@ -7416,8 +7438,12 @@ - WIN_TOP_SRC=`cd $srcdir; pwd -W` - ;; - cygwin*|msvc*|mks*) -- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC" -- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX" -+# Don't add the wrapper for the HOST_* versions as they contain an -+# unexpanded $CC and therfore wil get the wrapper below. -+ if test -n "$GNU_CC"; then -+ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC" -+ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX" -+ fi - CC="\$(CYGWIN_WRAPPER) $CC" - CXX="\$(CYGWIN_WRAPPER) $CXX" - CPP="\$(CYGWIN_WRAPPER) $CPP" ---- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -384,7 +384,7 @@ - ifdef NS_USE_GCC - LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS) - LINK_LIB = $(AR) cr $@ $(OBJS) --LINK_DLL = $(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS) -+LINK_DLL = $(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(LIB_PREFIX)$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS) - else - DEBUG_LINK_OPT=-DEBUG - ifeq ($(BUILD_OPT), 1) ---- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -70,7 +70,7 @@ - - ARCH = freebsd - --MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout) -+MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf) - - ifeq ($(MOZ_OBJFORMAT),elf) - DLL_SUFFIX = so ---- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200 -@@ -25,6 +25,7 @@ - LIB_SUFFIX = @LIB_SUFFIX@ - LIB_PREFIX = @LIB_PREFIX@ - DLL_SUFFIX = @DLL_SUFFIX@ -+DLL_PREFIX = @DLL_PREFIX@ - ASM_SUFFIX = @ASM_SUFFIX@ - PROG_SUFFIX = @PROG_SUFFIX@ - MOD_NAME = @NSPR_MODNAME@ ---- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200 -+++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200 -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - # - # Stupid wrapper to avoid win32 dospath/cygdrive issues - # Try not to spawn programs from within this file. If the stuff in here looks royally ---- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200 -@@ -2738,6 +2738,7 @@ - LIB_SUFFIX=a - LIB_PREFIX=lib - DLL_SUFFIX=so -+DLL_PREFIX=lib - ASM_SUFFIX=s - MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@' - PR_MD_ASFILES= -@@ -3444,7 +3445,7 @@ - EOF - - CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" -- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -+ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` - if test "$MOZ_OBJFORMAT" = "elf"; then - DLL_SUFFIX=so - else -@@ -3811,6 +3812,7 @@ - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' - DSO_CFLAGS=-fPIC - DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' -+ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'" - OS_LIBS="$OS_LIBS -lc" - _OPTIMIZE_FLAGS=-O2 - _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that -@@ -3880,7 +3882,8 @@ - CC="$CC -mno-cygwin" - CXX="$CXX -mno-cygwin" - DLL_SUFFIX=dll -- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@' -+ DLL_PREFIX= -+ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@' - # Use temp file for windres (bug 213281) - RC="$WINDRES -O coff --use-temp-file" - else -@@ -3897,6 +3900,7 @@ - LIB_SUFFIX=lib - LIB_PREFIX= - DLL_SUFFIX=dll -+ DLL_PREFIX= - - CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" - DLLFLAGS='-OUT:"$@"' -@@ -4293,6 +4297,7 @@ - NSINSTALL=nsinstall - LIB_PREFIX= - LIB_SUFFIX=lib -+ DLL_PREFIX= - DLL_SUFFIX=dll - DLLTOOL='' - RC=rc.exe -@@ -4660,6 +4665,7 @@ - LD=/usr/ccs/bin/ld - RANLIB=/usr/ccs/bin/ranlib - DSO_LDOPTS='-G -h $(notdir $@)' -+ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'" - if test -n "$GNU_CC"; then - DSO_CFLAGS=-fPIC - else -@@ -5844,6 +5850,7 @@ - s%@LIB_SUFFIX@%$LIB_SUFFIX%g - s%@LIB_PREFIX@%$LIB_PREFIX%g - s%@DLL_SUFFIX@%$DLL_SUFFIX%g -+s%@DLL_PREFIX@%$DLL_PREFIX%g - s%@ASM_SUFFIX@%$ASM_SUFFIX%g - s%@PROG_SUFFIX@%$PROG_SUFFIX%g - s%@MKSHLIB@%$MKSHLIB%g ---- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200 -+++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200 -@@ -549,6 +549,7 @@ - LIB_SUFFIX=a - LIB_PREFIX=lib - DLL_SUFFIX=so -+DLL_PREFIX=lib - ASM_SUFFIX=s - MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@' - PR_MD_ASFILES= -@@ -1037,7 +1038,7 @@ - AC_DEFINE(FREEBSD) - AC_DEFINE(HAVE_BSD_FLOCK) - CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" -- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -+ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` - if test "$MOZ_OBJFORMAT" = "elf"; then - DLL_SUFFIX=so - else -@@ -1285,6 +1286,7 @@ - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' - DSO_CFLAGS=-fPIC - DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' -+ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'" - OS_LIBS="$OS_LIBS -lc" - _OPTIMIZE_FLAGS=-O2 - _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that -@@ -1336,6 +1338,8 @@ - CC="$CC -mno-cygwin" - CXX="$CXX -mno-cygwin" - DLL_SUFFIX=dll -+ DLL_SUFFIX=dll -+ DLL_PREFIX= - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@' - # Use temp file for windres (bug 213281) - RC="$WINDRES -O coff --use-temp-file" -@@ -1353,6 +1357,7 @@ - LIB_SUFFIX=lib - LIB_PREFIX= - DLL_SUFFIX=dll -+ DLL_PREFIX= - - CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" - DLLFLAGS='-OUT:"$@"' -@@ -1820,6 +1825,7 @@ - LD=/usr/ccs/bin/ld - RANLIB=/usr/ccs/bin/ranlib - DSO_LDOPTS='-G -h $(notdir $@)' -+ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'" - if test -n "$GNU_CC"; then - DSO_CFLAGS=-fPIC - else -@@ -2410,6 +2416,7 @@ - AC_SUBST(LIB_SUFFIX) - AC_SUBST(LIB_PREFIX) - AC_SUBST(DLL_SUFFIX) -+AC_SUBST(DLL_PREFIX) - AC_SUBST(ASM_SUFFIX) - AC_SUBST(PROG_SUFFIX) - AC_SUBST(MKSHLIB) ---- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100 -@@ -85,6 +85,11 @@ - - ########################################################################### - -+ifeq ($(TERM),cygwin) -+INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR)) -+GENHEADERS:=$(shell cygpath -u $(GENHEADERS)) -+endif -+ - all export:: $(INCLUDEDIR) $(GENHEADERS) - $(NSINSTALL) -D $(PRIVATEINCDIR) - $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR) ---- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -109,7 +109,7 @@ - HDIR = $(topsrcdir)/ldap/include - - LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX)) --DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX)) -+DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX)) - - INSTALLDIR = $(DIST)/$(OBJDIR_NAME) - -@@ -320,6 +320,10 @@ - -$(RM) $(SO_FILES_TO_REMOVE) - endif - $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS) -+ if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ -+ rm -f $@.manifest; \ -+ fi - - veryclean:: clean - ---- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -62,7 +62,7 @@ - LIBPRLDAP = - endif - DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \ -- $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX)) -+ $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX)) - - INSTALLDIR = $(DIST)/$(OBJDIR_NAME) - ---- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200 -+++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200 -@@ -41,7 +41,7 @@ - HDIR = $(topsrcdir)/ldap/include - - LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX)) --DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX)) -+DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX)) - - INSTALLDIR = $(DIST)/$(OBJDIR_NAME) - -@@ -76,7 +92,7 @@ - - # variable definitions for exported symbols - ifeq ($(OS_ARCH), WINNT) -- SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def -+ SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def - else - SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp - endif ---- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100 -+++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -56,7 +56,7 @@ - HDIR = $(topsrcdir)/ldap/include - - LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX)) --DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX)) -+DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX)) - - INSTALLDIR = $(DIST)/$(OBJDIR_NAME) - ---- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100 -+++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -112,14 +112,14 @@ - gtkmozembed_internal.h - - ifdef MOZ_ENABLE_GTK --EXTRA_DSO_LDOPTS = \ -+EXTRA_DSO_LDOPTS += \ - $(MOZ_COMPONENT_LIBS) \ - -lgtksuperwin \ - $(NULL) - endif - - ifdef MOZ_ENABLE_GTK2 --EXTRA_DSO_LDOPTS = \ -+EXTRA_DSO_LDOPTS += \ - $(MOZ_COMPONENT_LIBS) \ - $(NULL) - endif ---- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100 -+++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -63,10 +63,11 @@ - TestGtkEmbedNotebook.cpp \ - TestGtkEmbedSocket.cpp \ - TestGtkEmbedChild.cpp --endif - - SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=) - -+endif -+ - # ENABLE_GNOME=1 - - ifdef ENABLE_GNOME ---- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200 -+++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100 -@@ -68,25 +68,15 @@ - - unexport CC CXX - --ABS_topsrcdir := $(shell cd $(topsrcdir); pwd) --ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT)) --export:: -- rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) . -- ln -fs $(srcdir)/src -- ln -fs $(srcdir)/res -- ln -fs $(srcdir)/public -- ln -fs $(srcdir)/Info-*.plist . --endif -- - libs:: - # Bug 297227: The next line doesn't need to stay around forever, only - # long enough to clean up existing depend builds from when xcodebuild - # was being instructed to "install" - if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi - -- $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG) -- mkdir -p $(DIST)/package -- $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package -+# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG) -+# mkdir -p $(DIST)/package -+# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package - - clean clobber:: - rm -rf build ---- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200 -+++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -110,7 +110,7 @@ - $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome - $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed - ifndef MINIMO -- -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components -+ -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components - endif - ifeq ($(OS_ARCH),WINNT) - ifeq ($(WINAPP),mfcembed) ---- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100 -+++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -85,7 +85,7 @@ - endif - - --EXTRA_DSO_LDOPTS = \ -+EXTRA_DSO_LDOPTS += \ - $(LIBS_DIR) \ - $(MOZ_JS_LIBS) \ - $(MOZ_COMPONENT_LIBS) \ ---- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100 -+++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200 -@@ -55,5 +55,5 @@ - bin/components/sqlpgsql.xpt \ - bin/components/sqlsqlite.xpt \ - bin/components/sqlmysql.xpt \ -- bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \ -+ bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \ - bin/chrome/sql.jar ---- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200 -+++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200 -@@ -76,10 +76,11 @@ - native FT_Sfnt_Tag(FT_Sfnt_Tag); - native FT_Size(FT_Size); - --[ptr] native FTC_Image_Desc_p(FTC_Image_Desc); -+[ptr] native FTC_ImageType_p(FTC_ImageType); - native FTC_Face_Requester(FTC_Face_Requester); - native FTC_Font(FTC_Font); --native FTC_Image_Cache(FTC_Image_Cache); -+native FTC_FaceID(FTC_FaceID); -+native FTC_ImageCache(FTC_ImageCache); - native FTC_Manager(FTC_Manager); - - // #ifdef MOZ_SVG -@@ -99,7 +100,7 @@ - - readonly attribute FT_Library library; - readonly attribute FTC_Manager FTCacheManager; -- readonly attribute FTC_Image_Cache ImageCache; -+ readonly attribute FTC_ImageCache ImageCache; - - void doneFace(in FT_Face face); - void doneFreeType(in FT_Library lib); -@@ -115,16 +116,16 @@ - void outlineDecompose(in FT_Outline_p outline, - in const_FT_Outline_Funcs_p funcs, in voidPtr p); - void setCharmap(in FT_Face face, in FT_CharMap charmap); -- void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc, -+ void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc, - in FT_UInt gindex, out FT_Glyph glyph); -- void managerLookupSize(in FTC_Manager manager, in FTC_Font font, -- out FT_Face face, out FT_Size size); -+ void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id, -+ out FT_Face face); - void managerDone(in FTC_Manager manager); - void managerNew(in FT_Library lib, in FT_UInt max_faces, - in FT_UInt max_sizes, in FT_ULong max_bytes, - in FTC_Face_Requester requester, in FT_Pointer req_data, - out FTC_Manager manager); -- void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache); -+ void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache); - /* #ifdef MOZ_SVG */ - void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix, - in FT_Vector_p delta); ---- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200 -+++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -111,7 +111,7 @@ - {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE}, - {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE}, - {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE}, -- {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE}, -+ {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE}, - {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE}, - {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE}, - {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE}, -@@ -288,7 +288,7 @@ - } - - NS_IMETHODIMP --nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc, -+nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc, - FT_UInt glyphID, FT_Glyph *glyph) - { - // call the FreeType2 function via the function pointer -@@ -297,11 +297,11 @@ - } - - NS_IMETHODIMP --nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font, -- FT_Face *face, FT_Size *size) -+nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font, -+ FT_Face *face) - { - // call the FreeType2 function via the function pointer -- FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size); -+ FT_Error error = nsFTC_Manager_LookupFace(manager, font, face); - return error ? NS_ERROR_FAILURE : NS_OK; - } - -@@ -326,7 +326,7 @@ - } - - NS_IMETHODIMP --nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache) -+nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache) - { - // call the FreeType2 function via the function pointer - FT_Error error = nsFTC_Image_Cache_New(manager, cache); -@@ -395,7 +395,7 @@ - } - - NS_IMETHODIMP --nsFreeType2::GetImageCache(FTC_Image_Cache *aCache) -+nsFreeType2::GetImageCache(FTC_ImageCache *aCache) - { - *aCache = mImageCache; - return NS_OK; ---- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200 -+++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200 -@@ -120,13 +120,13 @@ - typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*); - typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap); - typedef FT_Error (*FTC_Image_Cache_Lookup_t) -- (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*); --typedef FT_Error (*FTC_Manager_Lookup_Size_t) -- (FTC_Manager, FTC_Font, FT_Face*, FT_Size*); -+ (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*); -+typedef FT_Error (*FTC_Manager_LookupFace_t) -+ (FTC_Manager, FTC_FaceID, FT_Face*); - typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager); - typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong, - FTC_Face_Requester, FT_Pointer, FTC_Manager*); --typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*); -+typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*); - // #ifdef MOZ_SVG - typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*); - typedef FT_Error (*FT_Get_Kerning_t) -@@ -181,7 +181,7 @@ - FT_Outline_Decompose_t nsFT_Outline_Decompose; - FT_Set_Charmap_t nsFT_Set_Charmap; - FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup; -- FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size; -+ FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace; - FTC_Manager_Done_t nsFTC_Manager_Done; - FTC_Manager_New_t nsFTC_Manager_New; - FTC_Image_Cache_New_t nsFTC_Image_Cache_New; -@@ -229,7 +229,7 @@ - PRLibrary *mSharedLib; - FT_Library mFreeTypeLibrary; - FTC_Manager mFTCacheManager; -- FTC_Image_Cache mImageCache; -+ FTC_ImageCache mImageCache; - - static nsHashtable *sFontFamilies; - static nsHashtable *sRange1CharSetNames; ---- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200 -+++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -211,6 +211,10 @@ - CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) - CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) - -+ifeq ($(OS_ARCH), Darwin) -+EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) -+endif -+ - ifeq ($(OS_ARCH), SunOS) - ifndef GNU_CC - # When using Sun's WorkShop compiler, including ---- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100 -+++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -1870,10 +1870,10 @@ - - mPixelSize = NSToIntRound(app2dev * mFont->size); - -- mImageDesc.font.face_id = (void*)mEntry; -- mImageDesc.font.pix_width = mPixelSize; -- mImageDesc.font.pix_height = mPixelSize; -- mImageDesc.image_type = 0; -+ mImageDesc->face_id = (FTC_FaceID)&mEntry; -+ mImageDesc->width = mPixelSize; -+ mImageDesc->height = mPixelSize; -+ mImageDesc->flags = 0; - - nsresult rv; - mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv); -@@ -1907,7 +1907,7 @@ - if (!face) - return 0; - -- FTC_Image_Cache iCache; -+ FTC_ImageCache iCache; - nsresult rv = mFt2->GetImageCache(&iCache); - if (NS_FAILED(rv)) { - NS_ERROR("Failed to get Image Cache"); -@@ -1945,8 +1945,8 @@ - - FTC_Manager cManager; - mFt2->GetFTCacheManager(&cManager); -- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font, -- &face, nsnull); -+ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id, -+ &face); - NS_ASSERTION(rv==0, "failed to get face/size"); - if (rv) - return nsnull; -@@ -2392,16 +2392,16 @@ - mEntry->GetFamilyName(fontName); - mEntry->GetStyleName(styleName); - -- mImageDesc.font.face_id = (void*)mEntry; -+ mImageDesc->face_id = (FTC_FaceID)&mEntry; - // TT glyph has no relation to size -- mImageDesc.font.pix_width = 16; -- mImageDesc.font.pix_height = 16; -- mImageDesc.image_type = 0; -+ mImageDesc->width = 16; -+ mImageDesc->height = 16; -+ mImageDesc->flags = 0; - FT_Face face = nsnull; - FTC_Manager cManager; - mFt2->GetFTCacheManager(&cManager); -- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font, -- &face, nsnull); -+ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id, -+ &face); - if (NS_FAILED(rv)) - return; - ---- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200 -+++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200 -@@ -424,7 +424,7 @@ - nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID; - nsCOMPtr<nsIFreeType2> mFt2; - PRUint16 mPixelSize; -- FTC_Image_Desc mImageDesc; -+ FTC_ImageType mImageDesc; - nsCString mFontNameBase; // the base name of type 1 (sub) fonts - nscoord mHeight; - -@@ -493,7 +493,7 @@ - protected: - nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry; - nsCOMPtr<nsIFreeType2> mFt2; -- FTC_Image_Desc mImageDesc; -+ FTC_ImageType mImageDesc; - }; - #endif // MOZ_ENABLE_FREETYPE2 - #endif // MOZ_ENABLE_XFT ---- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200 -+++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -177,7 +177,7 @@ - FTC_Manager mgr; - nsresult rv; - mFt2->GetFTCacheManager(&mgr); -- rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull); -+ rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face); - NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size"); - if (NS_FAILED(rv)) - return nsnull; -@@ -191,22 +191,15 @@ - PRBool embedded_bimap = PR_FALSE; - mFaceID = aFaceID; - mPixelSize = aPixelSize; -- mImageDesc.font.face_id = (void*)mFaceID; -- mImageDesc.font.pix_width = aPixelSize; -- mImageDesc.font.pix_height = aPixelSize; -- mImageDesc.image_type = 0; -+ mImageDesc->face_id = (FTC_FaceID)&mFaceID; -+ mImageDesc->width = aPixelSize; -+ mImageDesc->height = aPixelSize; -+ mImageDesc->flags = 0; - - if (aPixelSize < nsFreeType2::gAntiAliasMinimum) { -- mImageDesc.image_type |= ftc_image_mono; - anti_alias = PR_FALSE; - } - -- if (nsFreeType2::gFreeType2Autohinted) -- mImageDesc.image_type |= ftc_image_flag_autohinted; -- -- if (nsFreeType2::gFreeType2Unhinted) -- mImageDesc.image_type |= ftc_image_flag_unhinted; -- - PRUint32 num_embedded_bitmaps, i; - PRInt32* embedded_bitmapheights; - mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps, -@@ -218,7 +211,6 @@ - if (embedded_bitmapheights[i] == aPixelSize) { - embedded_bimap = PR_TRUE; - // unhinted must be set for embedded bitmaps to be used -- mImageDesc.image_type |= ftc_image_flag_unhinted; - break; - } - } -@@ -312,7 +304,7 @@ - if (!face) - return NS_ERROR_FAILURE; - -- FTC_Image_Cache icache; -+ FTC_ImageCache icache; - mFt2->GetImageCache(&icache); - if (!icache) - return NS_ERROR_FAILURE; -@@ -401,7 +393,7 @@ - if (!face) - return 0; - -- FTC_Image_Cache icache; -+ FTC_ImageCache icache; - mFt2->GetImageCache(&icache); - if (!icache) - return 0; -@@ -723,7 +715,7 @@ - if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2); - #endif - -- FTC_Image_Cache icache; -+ FTC_ImageCache icache; - mFt2->GetImageCache(&icache); - if (!icache) - return 0; ---- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200 -+++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200 -@@ -110,7 +110,7 @@ - XImage *GetXImage(PRUint32 width, PRUint32 height); - nsITrueTypeFontCatalogEntry *mFaceID; - PRUint16 mPixelSize; -- FTC_Image_Desc mImageDesc; -+ FTC_ImageType mImageDesc; - nsCOMPtr<nsIFreeType2> mFt2; - }; - ---- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100 -+++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200 -@@ -108,7 +108,7 @@ - /* Defines for MMX/SSE2 support. */ - - #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__) --#define HAVE_MMX_INTEL_MNEMONICS -+//#define HAVE_MMX_INTEL_MNEMONICS - - /* SSE2 code appears broken for some cpus (bug 247437) */ - /* #define HAVE_SSE2_INTEL_MNEMONICS */ ---- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100 -+++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -423,19 +423,19 @@ - return; - } - -- FTC_Image_Desc imageDesc; -- imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref? -+ FTC_ImageType imageDesc; -+ imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref? - float twipstopixel = GetTwipsToPixels(); - float scale = GetPixelScale(); -- imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale); -- imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale); -- imageDesc.image_type |= ftc_image_grays; -+ imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale); -+ imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale); -+ imageDesc->flags |= /* ftc_image_grays */0; - - // get the face - nsresult rv; - FTC_Manager mgr; - nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr); -- rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull); -+ rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace); - NS_ASSERTION(mFace, "failed to get face/size"); - } - ---- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200 -@@ -106,6 +106,7 @@ - nsVCard.cpp \ - nsVCardObj.cpp \ - nsMsgVCardService.cpp \ -+ nsAbMD5sum.cpp \ - nsAbLDIFService.cpp \ - $(NULL) - -@@ -114,7 +115,9 @@ - nsDirPrefs.h \ - nsAbCardProperty.h \ - nsAbMDBCardProperty.h \ -- nsVCardObj.h \ -+ nsVCardObj.h \ -+ nsAbAddressCollecter.h \ -+ nsAbDirectoryQuery.h \ - $(NULL) - - ifeq ($(OS_ARCH),WINNT) ---- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200 -@@ -43,6 +43,7 @@ - #include "nsIAbBooleanExpression.h" - #include "nsCOMPtr.h" - #include "nsString.h" -+#include "nsAbUtils.h" - - class nsIAbLDAPAttributeMap; - -@@ -74,6 +75,16 @@ - nsIAbBooleanConditionString* condition, - nsCString& filter, - int flags); -+ static void GenerateMultipleFilter( -+ nsAbBooleanConditionType conditionType, -+ nsCString& filter, -+ NS_ConvertUCS2toUTF8 &vUTF8, -+ CharPtrArrayGuard *pAttrs); -+ static void GenerateSingleFilter( -+ nsAbBooleanConditionType conditionType, -+ nsCString& filter, -+ NS_ConvertUCS2toUTF8 &vUTF8, -+ const char *ldapProperty); - }; - - #endif ---- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200 -@@ -126,11 +126,13 @@ - - // use mURINoQuery to get a prefName - nsCAutoString prefName; -- prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri"); -+ prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen); - - // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri" - nsXPIDLCString URI; -- rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI)); -+ nsCAutoString uriPrefName; -+ uriPrefName = prefName + NS_LITERAL_CSTRING(".uri"); -+ rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI)); - if (NS_FAILED(rv)) - { - /* -@@ -154,6 +156,27 @@ - nsCAutoString tempLDAPURL(mURINoQuery); - tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:"); - rv = mURL->SetSpec(tempLDAPURL); -+ NS_ENSURE_SUCCESS(rv,rv); -+ -+ nsCAutoString aHost; -+ mURL->GetHost(aHost); -+ aHost.ReplaceChar('.','_'); -+ prefName = nsDependentCString("ldap_2.servers.") + aHost; -+ PRBool useSSL=0; -+ rv = prefs->GetBoolPref( -+ PromiseFlatCString(prefName -+ + NS_LITERAL_CSTRING(".UseSSL")).get(), -+ &useSSL -+ ); -+ -+ // If use SSL,ldap url will look like this ldaps://host:port/..... -+ if (!NS_FAILED(rv) && useSSL) -+ { -+ tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:"); -+ rv = mURL->SetSpec(tempLDAPURL); -+ } -+ //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist -+ rv = 0; - } - else - { -@@ -164,24 +187,29 @@ - // get the login information, if there is any - // - rv = prefs->GetCharPref( -- PromiseFlatCString( -- Substring(mURINoQuery, kLDAPDirectoryRootLen, -- mURINoQuery.Length() - kLDAPDirectoryRootLen) -+ PromiseFlatCString(prefName - + NS_LITERAL_CSTRING(".auth.dn")).get(), - getter_Copies(mLogin)); - if (NS_FAILED(rv)) { - mLogin.Truncate(); // zero out mLogin - } - -+ // get the password information, if there is any -+ // -+ rv = prefs->GetCharPref( -+ PromiseFlatCString(prefName -+ + NS_LITERAL_CSTRING(".auth.pwd")).get(), -+ getter_Copies(mPassword)); -+ if (NS_FAILED(rv)) { -+ mPassword.Truncate(); // zero out mLogin -+ } - // get the protocol version, if there is any. using a string pref - // here instead of an int, as protocol versions sometimes have names like - // "4bis". - // - nsXPIDLCString protocolVersion; - rv = prefs->GetCharPref( -- PromiseFlatCString( -- Substring(mURINoQuery, kLDAPDirectoryRootLen, -- mURINoQuery.Length() - kLDAPDirectoryRootLen) -+ PromiseFlatCString(prefName - + NS_LITERAL_CSTRING(".protocolVersion")).get(), - getter_Copies(protocolVersion)); - ---- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200 -@@ -74,7 +74,7 @@ - PRInt32 resultLimit = -1, - PRInt32 timeOut = 0); - virtual ~nsAbQueryLDAPMessageListener (); -- -+ void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;}; - protected: - nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage); - nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage, -@@ -108,6 +108,8 @@ - PRBool mCanceled; - PRBool mWaitingForPrevQueryToFinish; - -+ nsAutoString m_sPassword; -+ - nsCOMPtr<nsILDAPOperation> mSearchOperation; - - PRLock* mLock; -@@ -272,7 +274,7 @@ - - // If mLogin is set, we're expected to use it to get a password. - // -- if (!mDirectoryQuery->mLogin.IsEmpty()) { -+ if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) { - // XXX hack until nsUTF8AutoString exists - #define nsUTF8AutoString nsCAutoString - nsUTF8AutoString spec; -@@ -415,10 +417,13 @@ - rv = ldapOperation->Init(mConnection, proxyListener, nsnull); - NS_ENSURE_SUCCESS(rv, rv); - -- // Bind -- rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd)); -+ -+ // Bind -+ if (m_sPassword.Length()) -+ rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword)); -+ else -+ rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd)); - NS_ENSURE_SUCCESS(rv, rv); -- - return rv; - } - -@@ -707,7 +712,7 @@ - rv = getLdapReturnAttributes (arguments, returnAttributes); - NS_ENSURE_SUCCESS(rv, rv); - -- -+ - // Get the filter - nsCOMPtr<nsISupports> supportsExpression; - rv = arguments->GetExpression (getter_AddRefs (supportsExpression)); -@@ -828,6 +833,10 @@ - if (msgListener) - { - msgListener->mUrl = url; -+ msgListener->mQueryListener = listener; -+ msgListener->mResultLimit = resultLimit; -+ msgListener->mTimeOut = timeOut; -+ msgListener->mQueryArguments = arguments; - return msgListener->DoSearch(); - } - } -@@ -845,6 +854,11 @@ - timeOut); - if (_messageListener == NULL) - return NS_ERROR_OUT_OF_MEMORY; -+ -+ nsAutoString wPassword; -+ wPassword.AssignWithConversion(mPassword.get()); -+ _messageListener->SetPassword(wPassword); -+ - mListener = _messageListener; - *_retval = 1; - ---- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200 -@@ -72,6 +72,7 @@ - friend class nsAbQueryLDAPMessageListener; - nsresult Initiate (); - nsXPIDLCString mLogin; // authenticate to the LDAP server as... -+ nsXPIDLCString mPassword; // password to the LDAP server as... - nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server - PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl) - ---- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -1 +1,633 @@ --dummy -+/* -+ * The contents of this file are subject to the Mozilla Public -+ * License Version 1.1 (the "License"); you may not use this file -+ * except in compliance with the License. You may obtain a copy of -+ * the License at http://www.mozilla.org/MPL/ -+ * -+ * Software distributed under the License is distributed on an "AS -+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -+ * implied. See the License for the specific language governing -+ * rights and limitations under the License. -+ * -+ * The Original Code is the Netscape security libraries. -+ * -+ * The Initial Developer of the Original Code is Netscape -+ * Communications Corporation. Portions created by Netscape are -+ * Copyright (C) 1994-2000 Netscape Communications Corporation. All -+ * Rights Reserved. -+ * -+ * Contributor(s): -+ * -+ * Alternatively, the contents of this file may be used under the -+ * terms of the GNU General Public License Version 2 or later (the -+ * "GPL"), in which case the provisions of the GPL are applicable -+ * instead of those above. If you wish to allow use of your -+ * version of this file only under the terms of the GPL and not to -+ * allow others to use your version of this file under the MPL, -+ * indicate your decision by deleting the provisions above and -+ * replace them with the notice and other provisions required by -+ * the GPL. If you do not delete the provisions above, a recipient -+ * may use your version of this file under either the MPL or the -+ * GPL. -+ */ -+#include <stdio.h> -+#include <stdlib.h> -+ -+#include "prerr.h" -+ -+#include "prtypes.h" -+#include "prlong.h" -+#include "plstr.h" -+#include "nsMemory.h" -+ -+#define MD5_HASH_LEN 16 -+#define MD5_BUFFER_SIZE 64 -+#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8) -+ -+#define CV0_1 0x67452301 -+#define CV0_2 0xefcdab89 -+#define CV0_3 0x98badcfe -+#define CV0_4 0x10325476 -+ -+#define T1_0 0xd76aa478 -+#define T1_1 0xe8c7b756 -+#define T1_2 0x242070db -+#define T1_3 0xc1bdceee -+#define T1_4 0xf57c0faf -+#define T1_5 0x4787c62a -+#define T1_6 0xa8304613 -+#define T1_7 0xfd469501 -+#define T1_8 0x698098d8 -+#define T1_9 0x8b44f7af -+#define T1_10 0xffff5bb1 -+#define T1_11 0x895cd7be -+#define T1_12 0x6b901122 -+#define T1_13 0xfd987193 -+#define T1_14 0xa679438e -+#define T1_15 0x49b40821 -+ -+#define T2_0 0xf61e2562 -+#define T2_1 0xc040b340 -+#define T2_2 0x265e5a51 -+#define T2_3 0xe9b6c7aa -+#define T2_4 0xd62f105d -+#define T2_5 0x02441453 -+#define T2_6 0xd8a1e681 -+#define T2_7 0xe7d3fbc8 -+#define T2_8 0x21e1cde6 -+#define T2_9 0xc33707d6 -+#define T2_10 0xf4d50d87 -+#define T2_11 0x455a14ed -+#define T2_12 0xa9e3e905 -+#define T2_13 0xfcefa3f8 -+#define T2_14 0x676f02d9 -+#define T2_15 0x8d2a4c8a -+ -+#define T3_0 0xfffa3942 -+#define T3_1 0x8771f681 -+#define T3_2 0x6d9d6122 -+#define T3_3 0xfde5380c -+#define T3_4 0xa4beea44 -+#define T3_5 0x4bdecfa9 -+#define T3_6 0xf6bb4b60 -+#define T3_7 0xbebfbc70 -+#define T3_8 0x289b7ec6 -+#define T3_9 0xeaa127fa -+#define T3_10 0xd4ef3085 -+#define T3_11 0x04881d05 -+#define T3_12 0xd9d4d039 -+#define T3_13 0xe6db99e5 -+#define T3_14 0x1fa27cf8 -+#define T3_15 0xc4ac5665 -+ -+#define T4_0 0xf4292244 -+#define T4_1 0x432aff97 -+#define T4_2 0xab9423a7 -+#define T4_3 0xfc93a039 -+#define T4_4 0x655b59c3 -+#define T4_5 0x8f0ccc92 -+#define T4_6 0xffeff47d -+#define T4_7 0x85845dd1 -+#define T4_8 0x6fa87e4f -+#define T4_9 0xfe2ce6e0 -+#define T4_10 0xa3014314 -+#define T4_11 0x4e0811a1 -+#define T4_12 0xf7537e82 -+#define T4_13 0xbd3af235 -+#define T4_14 0x2ad7d2bb -+#define T4_15 0xeb86d391 -+ -+#define R1B0 0 -+#define R1B1 1 -+#define R1B2 2 -+#define R1B3 3 -+#define R1B4 4 -+#define R1B5 5 -+#define R1B6 6 -+#define R1B7 7 -+#define R1B8 8 -+#define R1B9 9 -+#define R1B10 10 -+#define R1B11 11 -+#define R1B12 12 -+#define R1B13 13 -+#define R1B14 14 -+#define R1B15 15 -+ -+#define R2B0 1 -+#define R2B1 6 -+#define R2B2 11 -+#define R2B3 0 -+#define R2B4 5 -+#define R2B5 10 -+#define R2B6 15 -+#define R2B7 4 -+#define R2B8 9 -+#define R2B9 14 -+#define R2B10 3 -+#define R2B11 8 -+#define R2B12 13 -+#define R2B13 2 -+#define R2B14 7 -+#define R2B15 12 -+ -+#define R3B0 5 -+#define R3B1 8 -+#define R3B2 11 -+#define R3B3 14 -+#define R3B4 1 -+#define R3B5 4 -+#define R3B6 7 -+#define R3B7 10 -+#define R3B8 13 -+#define R3B9 0 -+#define R3B10 3 -+#define R3B11 6 -+#define R3B12 9 -+#define R3B13 12 -+#define R3B14 15 -+#define R3B15 2 -+ -+#define R4B0 0 -+#define R4B1 7 -+#define R4B2 14 -+#define R4B3 5 -+#define R4B4 12 -+#define R4B5 3 -+#define R4B6 10 -+#define R4B7 1 -+#define R4B8 8 -+#define R4B9 15 -+#define R4B10 6 -+#define R4B11 13 -+#define R4B12 4 -+#define R4B13 11 -+#define R4B14 2 -+#define R4B15 9 -+ -+#define S1_0 7 -+#define S1_1 12 -+#define S1_2 17 -+#define S1_3 22 -+ -+#define S2_0 5 -+#define S2_1 9 -+#define S2_2 14 -+#define S2_3 20 -+ -+#define S3_0 4 -+#define S3_1 11 -+#define S3_2 16 -+#define S3_3 23 -+ -+#define S4_0 6 -+#define S4_1 10 -+#define S4_2 15 -+#define S4_3 21 -+ -+struct MD5ContextStr { -+ PRUint32 lsbInput; -+ PRUint32 msbInput; -+ PRUint32 cv[4]; -+ union { -+ PRUint8 b[64]; -+ PRUint32 w[16]; -+ } u; -+}; -+typedef struct MD5ContextStr MD5Context; -+ -+#define inBuf u.b -+ -+int MD5_Hash(unsigned char *dest, const char *src); -+int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length); -+MD5Context * MD5_NewContext(void); -+void MD5_DestroyContext(MD5Context *cx, PRBool freeit); -+void MD5_Begin(MD5Context *cx); -+static void md5_compress(MD5Context *cx); -+void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen); -+void MD5_End(MD5Context *cx, unsigned char *digest, -+ unsigned int *digestLen, unsigned int maxDigestLen); -+unsigned int MD5_FlattenSize(MD5Context *cx); -+int MD5_Flatten(MD5Context *cx, unsigned char *space); -+MD5Context * MD5_Resurrect(unsigned char *space, void *arg); -+void MD5_TraceState(MD5Context *cx); -+ -+int -+MD5_Hash(unsigned char *dest, const char *src) -+{ -+ return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src)); -+} -+ -+int -+MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) -+{ -+ unsigned int len; -+ MD5Context *cx = MD5_NewContext(); -+ if (cx == NULL) { -+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR); -+ return -1; -+ } -+ MD5_Begin(cx); -+ MD5_Update(cx, src, src_length); -+ MD5_End(cx, dest, &len, MD5_HASH_LEN); -+ MD5_DestroyContext(cx, PR_TRUE); -+ return 0; -+} -+ -+MD5Context * -+MD5_NewContext(void) -+{ -+ MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context)); -+ if (cx == NULL) { -+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR); -+ return NULL; -+ } -+ return cx; -+} -+ -+void -+MD5_DestroyContext(MD5Context *cx, PRBool freeit) -+{ -+ if (freeit) { -+ free(cx); -+ } -+} -+ -+void -+MD5_Begin(MD5Context *cx) -+{ -+ cx->lsbInput = 0; -+ cx->msbInput = 0; -+ memset(cx->inBuf, 0, sizeof(cx->inBuf)); -+ cx->cv[0] = CV0_1; -+ cx->cv[1] = CV0_2; -+ cx->cv[2] = CV0_3; -+ cx->cv[3] = CV0_4; -+} -+ -+#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s)) -+ -+#define MASK 0x00ff00ff -+#ifdef IS_LITTLE_ENDIAN -+#define lendian(i32) \ -+ (i32) -+#else -+#define lendian(i32) \ -+ (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK) -+#endif -+ -+#if defined(SOLARIS) || defined(HPUX) -+#define addto64(sumhigh, sumlow, addend) \ -+ sumlow += addend; sumhigh += (sumlow < addend); -+#else -+#define addto64(sumhigh, sumlow, addend) \ -+ sumlow += addend; if (sumlow < addend) ++sumhigh; -+#endif -+ -+#define F(X, Y, Z) \ -+ ((X & Y) | ((~X) & Z)) -+ -+#define G(X, Y, Z) \ -+ ((X & Z) | (Y & (~Z))) -+ -+#define H(X, Y, Z) \ -+ (X ^ Y ^ Z) -+ -+#define I(X, Y, Z) \ -+ (Y ^ (X | (~Z))) -+ -+#define FF(a, b, c, d, bufint, s, ti) \ -+ a = b + cls(a + F(b, c, d) + bufint + ti, s) -+ -+#define GG(a, b, c, d, bufint, s, ti) \ -+ a = b + cls(a + G(b, c, d) + bufint + ti, s) -+ -+#define HH(a, b, c, d, bufint, s, ti) \ -+ a = b + cls(a + H(b, c, d) + bufint + ti, s) -+ -+#define II(a, b, c, d, bufint, s, ti) \ -+ a = b + cls(a + I(b, c, d) + bufint + ti, s) -+ -+static void -+md5_compress(MD5Context *cx) -+{ -+ PRUint32 a, b, c, d; -+ PRUint32 tmp; -+ a = cx->cv[0]; -+ b = cx->cv[1]; -+ c = cx->cv[2]; -+ d = cx->cv[3]; -+#ifndef IS_LITTLE_ENDIAN -+ cx->u.w[0] = lendian(cx->u.w[0]); -+ cx->u.w[1] = lendian(cx->u.w[1]); -+ cx->u.w[2] = lendian(cx->u.w[2]); -+ cx->u.w[3] = lendian(cx->u.w[3]); -+ cx->u.w[4] = lendian(cx->u.w[4]); -+ cx->u.w[5] = lendian(cx->u.w[5]); -+ cx->u.w[6] = lendian(cx->u.w[6]); -+ cx->u.w[7] = lendian(cx->u.w[7]); -+ cx->u.w[8] = lendian(cx->u.w[8]); -+ cx->u.w[9] = lendian(cx->u.w[9]); -+ cx->u.w[10] = lendian(cx->u.w[10]); -+ cx->u.w[11] = lendian(cx->u.w[11]); -+ cx->u.w[12] = lendian(cx->u.w[12]); -+ cx->u.w[13] = lendian(cx->u.w[13]); -+ cx->u.w[14] = lendian(cx->u.w[14]); -+ cx->u.w[15] = lendian(cx->u.w[15]); -+#endif -+ FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0); -+ FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1); -+ FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2); -+ FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3); -+ FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4); -+ FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5); -+ FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6); -+ FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7); -+ FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8); -+ FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9); -+ FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10); -+ FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11); -+ FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12); -+ FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13); -+ FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14); -+ FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15); -+ GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0); -+ GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1); -+ GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2); -+ GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3); -+ GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4); -+ GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5); -+ GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6); -+ GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7); -+ GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8); -+ GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9); -+ GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10); -+ GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11); -+ GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12); -+ GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13); -+ GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14); -+ GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15); -+ HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0); -+ HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1); -+ HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2); -+ HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3); -+ HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4); -+ HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5); -+ HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6); -+ HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7); -+ HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8); -+ HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9); -+ HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10); -+ HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11); -+ HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12); -+ HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13); -+ HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14); -+ HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15); -+ II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0); -+ II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1); -+ II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2); -+ II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3); -+ II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4); -+ II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5); -+ II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6); -+ II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7); -+ II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8); -+ II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9); -+ II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10); -+ II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11); -+ II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12); -+ II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13); -+ II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14); -+ II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15); -+ cx->cv[0] += a; -+ cx->cv[1] += b; -+ cx->cv[2] += c; -+ cx->cv[3] += d; -+} -+ -+void -+MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen) -+{ -+ PRUint32 bytesToConsume; -+ PRUint32 inBufIndex = cx->lsbInput & 63; -+ -+ /* Add the number of input bytes to the 64-bit input counter. */ -+ addto64(cx->msbInput, cx->lsbInput, inputLen); -+ if (inBufIndex) { -+ /* There is already data in the buffer. Fill with input. */ -+ bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex); -+ memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume); -+ if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE) -+ /* The buffer is filled. Run the compression function. */ -+ md5_compress(cx); -+ /* Remaining input. */ -+ inputLen -= bytesToConsume; -+ input += bytesToConsume; -+ } -+ -+ /* Iterate over 64-byte chunks of the message. */ -+ while (inputLen >= MD5_BUFFER_SIZE) { -+ memcpy(cx->inBuf, input, MD5_BUFFER_SIZE); -+ md5_compress(cx); -+ inputLen -= MD5_BUFFER_SIZE; -+ input += MD5_BUFFER_SIZE; -+ } -+ -+ /* Tail of message (message bytes mod 64). */ -+ if (inputLen) -+ memcpy(cx->inBuf, input, inputLen); -+} -+ -+static const unsigned char padbytes[] = { -+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -+}; -+ -+void -+MD5_End(MD5Context *cx, unsigned char *digest, -+ unsigned int *digestLen, unsigned int maxDigestLen) -+{ -+#ifndef IS_LITTLE_ENDIAN -+ PRUint32 tmp; -+#endif -+ PRUint32 lowInput, highInput; -+ PRUint32 inBufIndex = cx->lsbInput & 63; -+ -+ if (maxDigestLen < MD5_HASH_LEN) { -+// PORT_SetError(SEC_ERROR_INVALID_ARGS); -+ return; -+ } -+ -+ /* Copy out the length of bits input before padding. */ -+ lowInput = cx->lsbInput; -+ highInput = (cx->msbInput << 3) | (lowInput >> 29); -+ lowInput <<= 3; -+ -+ if (inBufIndex < MD5_END_BUFFER) { -+ MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex); -+ } else { -+ MD5_Update(cx, padbytes, -+ MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex); -+ } -+ -+ /* Store the number of bytes input (before padding) in final 64 bits. */ -+ cx->u.w[14] = lendian(lowInput); -+ cx->u.w[15] = lendian(highInput); -+ -+ /* Final call to compress. */ -+ md5_compress(cx); -+ -+ /* Copy the resulting values out of the chain variables into return buf. */ -+ *digestLen = MD5_HASH_LEN; -+#ifndef IS_LITTLE_ENDIAN -+ cx->cv[0] = lendian(cx->cv[0]); -+ cx->cv[1] = lendian(cx->cv[1]); -+ cx->cv[2] = lendian(cx->cv[2]); -+ cx->cv[3] = lendian(cx->cv[3]); -+#endif -+ memcpy(digest, cx->cv, MD5_HASH_LEN); -+} -+ -+unsigned int -+MD5_FlattenSize(MD5Context *cx) -+{ -+ return sizeof(*cx); -+} -+ -+int -+MD5_Flatten(MD5Context *cx, unsigned char *space) -+{ -+ memcpy(space, cx, sizeof(*cx)); -+ return 0; -+} -+ -+MD5Context * -+MD5_Resurrect(unsigned char *space, void *arg) -+{ -+ MD5Context *cx = MD5_NewContext(); -+ if (cx) -+ memcpy(cx, space, sizeof(*cx)); -+ return cx; -+} -+ -+void -+MD5_TraceState(MD5Context *cx) -+{ -+// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); -+} -+ -+int -+md5_stream (FILE *stream, unsigned char *dest) -+{ -+ /* Important: BLOCKSIZE must be a multiple of 64. */ -+#define BLOCKSIZE 4096 -+ unsigned int len; -+ MD5Context *cx = MD5_NewContext(); -+ if (cx == NULL) { -+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR); -+ return -1; -+ } -+ -+ unsigned char buffer[BLOCKSIZE + 72]; -+ size_t sum; -+ -+ /* Initialize the computation context. */ -+ MD5_Begin(cx); -+ -+ /* Iterate over full file contents. */ -+ while (1) -+ { -+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the -+ computation function processes the whole buffer so that with the -+ next round of the loop another block can be read. */ -+ size_t n; -+ sum = 0; -+ -+ /* Read block. Take care for partial reads. */ -+ do -+ { -+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); -+ -+ sum += n; -+ } -+ while (sum < BLOCKSIZE && n != 0); -+ if (n == 0 && ferror (stream)) -+ return 1; -+ -+ /* If end of file is reached, end the loop. */ -+ if (n == 0) -+ break; -+ -+ /* Process buffer with BLOCKSIZE bytes. Note that -+ BLOCKSIZE % 64 == 0 -+ */ -+ MD5_Update(cx, buffer, BLOCKSIZE); -+ } -+ -+ /* Add the last bytes if necessary. */ -+ if (sum > 0) -+ MD5_Update(cx, buffer, sum); -+ -+ MD5_End(cx, dest, &len, MD5_HASH_LEN); -+ MD5_DestroyContext(cx, PR_TRUE); -+ return len; -+ -+} -+ -+int getMD5sum(const char * fileName,char * sum) -+{ -+ unsigned char bin_sum[16]; -+ int len=0; -+ if (fileName) -+ { -+ FILE *fp=fopen(fileName,"rb"); -+ if (fp) -+ { -+ len=md5_stream(fp,bin_sum); -+ memset(sum,0,33); -+ for (int i = 0; i < len; ++i) -+ sprintf (sum,"%s%02x",sum, bin_sum[i]); -+ fclose(fp); -+ return 0; -+ } -+ } -+ return 1; -+} -+ -+int testMD5sum(const char * fileName,char * sum) -+{ -+ char newSum[33]=""; -+ if (getMD5sum(fileName,newSum)) -+ return 1; -+ return strcmp(newSum,sum); -+} ---- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -273,8 +273,7 @@ - if (mCardDatabase) - { - mCardDatabase->EditCard(this, PR_TRUE); -- mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit); -- return NS_OK; -+ return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit); - } - else - return NS_ERROR_FAILURE; ---- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -561,7 +561,7 @@ - } - } - } -- mDatabase->Commit(nsAddrDBCommitType::kLargeCommit); -+ rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit); - } - return rv; - } -@@ -707,6 +707,7 @@ - return NS_ERROR_NOT_IMPLEMENTED; - - nsresult rv = NS_OK; -+ - if (!mDatabase) - rv = GetAbDatabase(); - -@@ -736,10 +737,11 @@ - mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */); - else - mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE); -- mDatabase->Commit(nsAddrDBCommitType::kLargeCommit); -+ rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit); - -+ NS_ENSURE_SUCCESS(rv, rv); - NS_IF_ADDREF(*addedCard = newCard); -- return NS_OK; -+ return rv; - } - - NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard) ---- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -94,6 +94,7 @@ - { - index_DisplayName = 0, - index_EmailAddress, -+ index_SecondEmailAddress, - index_FirstName, - index_LastName, - index_NickName, -@@ -121,32 +122,34 @@ - - static const ULONG OutlookCardMAPIProps [] = - { -- PR_DISPLAY_NAME_W, -- PR_EMAIL_ADDRESS_W, -- PR_GIVEN_NAME_W, -- PR_SURNAME_W, -- PR_NICKNAME_W, -- PR_BUSINESS_TELEPHONE_NUMBER_W, -- PR_HOME_TELEPHONE_NUMBER_W, -- PR_BUSINESS_FAX_NUMBER_W, -- PR_PAGER_TELEPHONE_NUMBER_W, -- PR_MOBILE_TELEPHONE_NUMBER_W, -- PR_HOME_ADDRESS_CITY_W, -- PR_HOME_ADDRESS_STATE_OR_PROVINCE_W, -- PR_HOME_ADDRESS_POSTAL_CODE_W, -- PR_HOME_ADDRESS_COUNTRY_W, -- PR_BUSINESS_ADDRESS_CITY_W, -- PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W, -- PR_BUSINESS_ADDRESS_POSTAL_CODE_W, -- PR_BUSINESS_ADDRESS_COUNTRY_W, -- PR_TITLE_W, -- PR_DEPARTMENT_NAME_W, -- PR_COMPANY_NAME_W, -- PR_BUSINESS_HOME_PAGE_W, -- PR_PERSONAL_HOME_PAGE_W, -- PR_COMMENT_W -+ PR_DISPLAY_NAME_A,//0x8035001E -+ PR_EMAIL_ADDRESS_A,//0x8034001E -+ PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address -+ PR_GIVEN_NAME_A, -+ PR_SURNAME_A, -+ PR_NICKNAME_A, -+ PR_BUSINESS_TELEPHONE_NUMBER_A, -+ PR_HOME_TELEPHONE_NUMBER_A, -+ PR_BUSINESS_FAX_NUMBER_A, -+ PR_PAGER_TELEPHONE_NUMBER_A, -+ PR_MOBILE_TELEPHONE_NUMBER_A, -+ PR_HOME_ADDRESS_CITY_A, -+ PR_HOME_ADDRESS_STATE_OR_PROVINCE_A, -+ PR_HOME_ADDRESS_POSTAL_CODE_A, -+ PR_HOME_ADDRESS_COUNTRY_A, -+ PR_BUSINESS_ADDRESS_CITY_A, -+ PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A, -+ PR_BUSINESS_ADDRESS_POSTAL_CODE_A, -+ PR_BUSINESS_ADDRESS_COUNTRY_A, -+ PR_TITLE_A, -+ PR_DEPARTMENT_NAME_A, -+ PR_COMPANY_NAME_A, -+ PR_BUSINESS_HOME_PAGE_A, -+ PR_PERSONAL_HOME_PAGE_A, -+ PR_COMMENT_A - } ; - -+ - nsresult nsAbOutlookCard::Init(const char *aUri) - { - nsresult retCode = nsRDFResource::Init(aUri) ; -@@ -173,6 +176,7 @@ - SetDisplayName(unichars [index_DisplayName]->get()) ; - SetNickName(unichars [index_NickName]->get()) ; - SetPrimaryEmail(unichars [index_EmailAddress]->get()) ; -+ SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ; - SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ; - SetHomePhone(unichars [index_HomePhoneNumber]->get()) ; - SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ; -@@ -207,12 +211,12 @@ - nsAutoString unichar ; - nsAutoString unicharBis ; - -- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) { -+ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) { - splitString(unichar, unicharBis) ; - SetHomeAddress(unichar.get()) ; - SetHomeAddress2(unicharBis.get()) ; - } -- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) { -+ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) { - splitString(unichar, unicharBis) ; - SetWorkAddress(unichar.get()) ; - SetWorkAddress2(unicharBis.get()) ; -@@ -290,6 +294,7 @@ - SetDisplayName(properties [index_DisplayName]) ; - GetNickName(getter_Copies(properties [index_NickName])) ; - GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ; -+ GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ; - GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ; - GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ; - GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ; -@@ -309,9 +314,16 @@ - GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ; - GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ; - GetNotes(getter_Copies(properties [index_Comments])) ; -- if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps, -- index_LastProp, properties)) { -- PRINTF(("Cannot set general properties.\n")) ; -+ -+ int i=0; -+ for (i=0;i<index_LastProp;i++) -+ { -+ if (!mapiAddBook->SetPropertyUString(*mMapiData, -+ OutlookCardMAPIProps[i], -+ properties[i])) -+ { -+ PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ; -+ } - } - delete [] properties ; - nsXPIDLString unichar ; ---- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -124,8 +124,8 @@ - nsCAutoString uri ; - nsCOMPtr<nsIRDFResource> resource ; - -- for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) { -- folders.mEntries [i].ToString(entryId) ; -+ for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) { -+ folders[i].ToString(entryId) ; - buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ; - uri.Append(entryId) ; - ---- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -126,7 +126,7 @@ - PRINTF(("Cannot get type.\n")) ; - return NS_ERROR_FAILURE ; - } -- if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) { -+ if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) { - PRINTF(("Cannot get name.\n")) ; - return NS_ERROR_FAILURE ; - } -@@ -163,45 +163,85 @@ - return retCode; - } - -+nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard, -+ PRBool aSearchForOld, PRBool& aIsNewCard) -+{ -+ nsresult retCode = NS_OK ; -+ if (aSearchForOld) { -+ nsCStringKey key(uriName) ; -+ nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ; -+ -+ if (existingCard) { -+ nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ; -+ -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ NS_IF_ADDREF(*aNewCard = card) ; -+ aIsNewCard = PR_FALSE ; -+ return retCode ; -+ } -+ } -+ aIsNewCard = PR_TRUE ; -+ nsCOMPtr<nsIRDFResource> resource ; -+ -+ nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode); -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ resource = do_QueryInterface(childCard, &retCode) ; -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ retCode = resource->Init(uriName.get()) ; -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ NS_IF_ADDREF(*aNewCard = childCard); -+ return retCode ; -+} -+ - NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards) - { - if (!aCards) { return NS_ERROR_NULL_POINTER ; } - *aCards = nsnull ; - nsCOMPtr<nsISupportsArray> cardList ; -+ nsCStringArray uriList ; -+ nsAbWinHelperGuard mapiAddBook (mAbWinType) ; - nsresult retCode ; - -- mCardList.Reset() ; - if (mIsQueryURI) { - retCode = StartSearch() ; -- NS_NewISupportsArray(getter_AddRefs(cardList)) ; - } - else { -- retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ; -+ retCode = GetChildCards(uriList, nsnull) ; - } -+ NS_NewISupportsArray(getter_AddRefs(cardList)) ; - if (NS_SUCCEEDED(retCode)) { - // Fill the results array and update the card list - // Also update the address list and notify any changes. - PRUint32 nbCards = 0 ; -- nsCOMPtr<nsISupports> element ; -+ nsCAutoString uriName; -+ nsCOMPtr <nsIAbCard> childCard; -+ PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ; -+ -+ nbCards = uriList.Count(); -+ NS_NewISupportsArray(getter_AddRefs(m_AddressList)); - -- cardList->Enumerate(aCards) ; -- cardList->Count(&nbCards) ; - for (PRUint32 i = 0 ; i < nbCards ; ++ i) { -- cardList->GetElementAt(i, getter_AddRefs(element)) ; -- nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ; -- nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ; -+ PRBool isNewCard = PR_FALSE ; - -- if (!oldElement) { -+ uriList.CStringAt(i,uriName); -+ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard); -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ cardList->AppendElement(childCard); -+ -+ if (isNewCard) { - // We are dealing with a new element (probably directly - // added from Outlook), we may need to sync m_AddressList -- mCardList.Put(&newKey, element) ; -- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ; -+ nsCStringKey newKey(uriName) ; -+ -+ mCardList.Put(&newKey, childCard) ; -+ nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ; - - NS_ENSURE_SUCCESS(retCode, retCode) ; - PRBool isMailList = PR_FALSE ; - - retCode = card->GetIsMailList(&isMailList) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; -+ - if (isMailList) { - // We can have mailing lists only in folder, - // we must add the directory to m_AddressList -@@ -224,18 +264,33 @@ - NotifyItemAddition(card) ; - } - } -- else { -- NS_ASSERTION(oldElement == element, "Different card stored") ; - } - } -+ return cardList->Enumerate(aCards) ; - } -+ -+static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) { -+ nsresult retCode = NS_OK ; -+ nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ; -+ -+ // Receiving a non-RDF card is accepted -+ if (NS_FAILED(retCode)) { return NS_OK ; } -+ nsXPIDLCString uri ; -+ -+ retCode = resource->GetValue(getter_Copies(uri)) ; -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ aUri = uri.get() ; - return retCode ; - } - - NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard) - { - if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; } -- nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ; -+ *aHasCard = PR_FALSE ; -+ nsCString uri ; -+ -+ ExtractUriFromCard(aCard, uri) ; -+ nsCStringKey key(uri) ; - - *aHasCard = mCardList.Exists(&key) ; - return NS_OK ; -@@ -317,7 +372,10 @@ - PRINTF(("Cannot delete card %s.\n", entryString.get())) ; - } - else { -- nsVoidKey key (NS_STATIC_CAST(void *, element)) ; -+ nsCString uri ; -+ -+ ExtractUriFromCard(card, uri) ; -+ nsCStringKey key(uri) ; - - mCardList.Remove(&key) ; - if (m_IsMailList) { m_AddressList->RemoveElement(element) ; } -@@ -386,7 +444,10 @@ - } - retCode = CreateCard(aData, addedCard) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; -- nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ; -+ nsCString uri ; -+ -+ ExtractUriFromCard(*addedCard, uri) ; -+ nsCStringKey newKey(uri) ; - - mCardList.Put(&newKey, *addedCard) ; - if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; } -@@ -457,7 +518,7 @@ - if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; } - retCode = GetDirName(getter_Copies(name)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; -- if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) { -+ if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) { - return NS_ERROR_FAILURE ; - } - retCode = CommitAddressList() ; -@@ -518,6 +579,7 @@ - {"DisplayName", PR_DISPLAY_NAME_A}, - {"NickName", PR_NICKNAME_A}, - {"PrimaryEmail", PR_EMAIL_ADDRESS_A}, -+ {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A}, - {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A}, - {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A}, - {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A}, -@@ -1027,7 +1089,10 @@ - - nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard) - { -- nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ; -+ nsCString uri ; -+ -+ ExtractUriFromCard(aCard, uri) ; -+ nsCStringKey newKey(uri) ; - nsresult retCode = NS_OK ; - - mCardList.Put(&newKey, aCard) ; -@@ -1051,14 +1116,14 @@ - retCode = BuildRestriction(aArguments, arguments) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr<nsISupportsArray> resultsArray ; -+ nsCStringArray uriArray ; - PRUint32 nbResults = 0 ; - -- retCode = GetChildCards(getter_AddRefs(resultsArray), -+ retCode = GetChildCards(uriArray, - arguments.rt == RES_COMMENT ? nsnull : &arguments) ; - DestroyRestriction(arguments) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; -- retCode = resultsArray->Count(&nbResults) ; -- NS_ENSURE_SUCCESS(retCode, retCode) ; -+ nbResults = uriArray.Count() ; - nsCOMPtr<nsIAbDirectoryQueryResult> result ; - nsAbDirectoryQueryResult *newResult = nsnull ; - -@@ -1066,15 +1131,18 @@ - nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ; - } - PRUint32 i = 0 ; -- nsCOMPtr<nsISupports> element ; - nsCOMPtr<nsISupportsArray> propertyValues ; - -+ nsCAutoString uriName; -+ nsCOMPtr <nsIAbCard> card; -+ - for (i = 0 ; i < nbResults ; ++ i) { -- retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ; -- NS_ENSURE_SUCCESS(retCode, retCode) ; -- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ; -+ PRBool isNewCard = PR_FALSE ; - -+ uriArray.CStringAt(i,uriName); -+ retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard); - NS_ENSURE_SUCCESS(retCode, retCode) ; -+ - FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ; - newResult = new nsAbDirectoryQueryResult(0, aArguments, - nsIAbDirectoryQueryResult::queryResultMatch, -@@ -1099,13 +1167,43 @@ - if (!aCards) { return NS_ERROR_NULL_POINTER ; } - *aCards = nsnull ; - nsresult retCode = NS_OK ; -- nsCOMPtr<nsISupportsArray> cards ; -+ -+ nsCOMPtr<nsISupportsArray> cards; -+ retCode = NS_NewISupportsArray(getter_AddRefs(cards)); -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ -+ nsCStringArray uriList; -+ retCode = GetChildCards(uriList,aRestriction); -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ -+ nsCAutoString uriName; -+ nsCOMPtr <nsIAbCard> childCard; -+ PRUint32 nbURIs = 0 ; -+ nbURIs = uriList.Count(); -+ PRUint32 i = 0 ; -+ -+ for (i = 0 ; i < nbURIs ; ++ i) { -+ PRBool isNewCard = PR_FALSE ; -+ -+ uriList.CStringAt(i,uriName); -+ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard); -+ NS_ENSURE_SUCCESS(retCode, retCode) ; -+ cards->AppendElement(childCard); -+ } -+ -+ NS_IF_ADDREF(*aCards = cards); -+ return retCode ; -+} -+ -+nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI, -+ void *aRestriction) -+{ -+ nsresult retCode = NS_OK ; - nsAbWinHelperGuard mapiAddBook (mAbWinType) ; - nsMapiEntryArray cardEntries ; - LPSRestriction restriction = (LPSRestriction) aRestriction ; - - if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; } -- retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ; - NS_ENSURE_SUCCESS(retCode, retCode) ; - if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) { - PRINTF(("Cannot get cards.\n")) ; -@@ -1114,22 +1212,14 @@ - nsCAutoString entryId ; - nsCAutoString uriName ; - nsCOMPtr<nsIRDFResource> resource ; -- nsCOMPtr <nsIAbCard> childCard; -- -- for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) { -- cardEntries.mEntries [card].ToString(entryId) ; -+ aURI.Clear(); -+ -+ for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) { -+ cardEntries [card].ToString(entryId) ; - buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ; - uriName.Append(entryId) ; -- childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode); -- NS_ENSURE_SUCCESS(retCode, retCode) ; -- resource = do_QueryInterface(childCard, &retCode) ; -- NS_ENSURE_SUCCESS(retCode, retCode) ; -- retCode = resource->Init(uriName.get()) ; -- NS_ENSURE_SUCCESS(retCode, retCode) ; -- cards->AppendElement(childCard) ; -+ aURI.AppendCString(uriName); - } -- *aCards = cards ; -- NS_ADDREF(*aCards) ; - return retCode ; - } - -@@ -1153,8 +1243,8 @@ - nsCAutoString uriName ; - nsCOMPtr <nsIRDFResource> resource ; - -- for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) { -- nodeEntries.mEntries [node].ToString(entryId) ; -+ for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) { -+ nodeEntries [node].ToString(entryId) ; - buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ; - uriName.Append(entryId) ; - retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ; -@@ -1275,7 +1365,7 @@ - // In the case of a mailing list, we cannot directly create a new card, - // we have to create a temporary one in a real folder (to be able to use - // templates) and then copy it to the mailing list. -- if (m_IsMailList) { -+ if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) { - nsMapiEntry parentEntry ; - nsMapiEntry temporaryEntry ; - ---- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200 -@@ -46,6 +46,7 @@ - #include "nsHashtable.h" - - #include "nsISupportsArray.h" -+#include "nsVoidArray.h" - - struct nsMapiEntry ; - -@@ -92,6 +93,8 @@ - protected: - // Retrieve hierarchy as cards, with an optional restriction - nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ; -+ // Retrieve hierarchy as URIs, with an optional restriction -+ nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ; - // Retrieve hierarchy as directories - nsresult GetChildNodes(nsISupportsArray **aNodes) ; - // Create a new card -@@ -103,6 +106,9 @@ - nsresult CommitAddressList(void) ; - // Read MAPI repository - nsresult UpdateAddressList(void) ; -+ // Search for an existing card or build a new one -+ nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard, -+ PRBool aSearchForOld, PRBool& aIsNewCard) ; - - nsMapiEntry *mMapiData ; - // Container for the query threads ---- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -42,6 +42,9 @@ - #define USES_IID_IABContainer - #define USES_IID_IMAPITable - #define USES_IID_IDistList -+#define USES_IID_IMsgStore -+#define USES_IID_IMessage -+#define USES_IID_IMAPIFolder - - #include "nsAbWinHelper.h" - #include "nsMapiAddressBook.h" -@@ -59,19 +62,6 @@ - - #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args) - --// Small utility to ensure release of all MAPI interfaces --template <class tInterface> struct nsMapiInterfaceWrapper --{ -- tInterface mInterface ; -- -- nsMapiInterfaceWrapper(void) : mInterface(NULL) {} -- ~nsMapiInterfaceWrapper(void) { -- if (mInterface != NULL) { mInterface->Release() ; } -- } -- operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; } -- tInterface operator -> (void) const { return mInterface ; } -- operator tInterface *(void) { return &mInterface ; } --} ; - - static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount) - { -@@ -249,24 +239,28 @@ - MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray) - - nsMapiEntryArray::nsMapiEntryArray(void) --: mEntries(NULL), mNbEntries(0) - { - MOZ_COUNT_CTOR(nsMapiEntryArray) ; - } - - nsMapiEntryArray::~nsMapiEntryArray(void) - { -- if (mEntries) { delete [] mEntries ; } -+ CleanUp(); - MOZ_COUNT_DTOR(nsMapiEntryArray) ; - } -- -+void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries) -+{ -+ m_array.AppendElement(aEntries); -+} - void nsMapiEntryArray::CleanUp(void) - { -- if (mEntries != NULL) { -- delete [] mEntries ; -- mEntries = NULL ; -- mNbEntries = 0 ; -+ nsMapiEntry *pEntries; -+ for (int i = 0; i < m_array.Count(); i++) -+ { -+ pEntries = (nsMapiEntry *)m_array.ElementAt( i); -+ delete pEntries; - } -+ m_array.Clear(); - } - - MOZ_DECL_CTOR_COUNTER(nsAbWinHelper) -@@ -280,100 +274,55 @@ - // same protection (MAPI is supposed to be thread-safe). - PRLock *nsAbWinHelper::mMutex = PR_NewLock() ; - -+int nsAbWinHelper::m_clients = 0; -+ -+PRUnichar * nsAbWinHelper::m_pUniBuff = NULL; -+int nsAbWinHelper::m_uniBuffLen = 0; -+char * nsAbWinHelper::m_pCStrBuff = NULL; -+int nsAbWinHelper::m_cstrBuffLen = 0; -+ - nsAbWinHelper::nsAbWinHelper(void) --: mAddressBook(NULL), mLastError(S_OK) -+:mLastError(S_OK) - { - MOZ_COUNT_CTOR(nsAbWinHelper) ; -+ m_clients++; - } - - nsAbWinHelper::~nsAbWinHelper(void) - { - MOZ_COUNT_DTOR(nsAbWinHelper) ; --} -- --BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders) -+ m_clients--; -+ if (!m_clients) - { -- aFolders.CleanUp() ; -- nsMapiInterfaceWrapper<LPABCONT> rootFolder ; -- nsMapiInterfaceWrapper<LPMAPITABLE> folders ; -- ULONG objType = 0 ; -- ULONG rowCount = 0 ; -- SRestriction restriction ; -- SPropTagArray folderColumns ; -- -- mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType, -- rootFolder) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot open root %08x.\n", mLastError)) ; -- return FALSE ; -+ delete [] m_pUniBuff; -+ m_pUniBuff = NULL; -+ m_uniBuffLen = 0; -+ delete [] m_pCStrBuff; -+ m_pCStrBuff = NULL; -+ m_cstrBuffLen = 0; - } -- mLastError = rootFolder->GetHierarchyTable(0, folders) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ; -- return FALSE ; - } -- // We only take into account modifiable containers, -- // otherwise, we end up with all the directory services... -- restriction.rt = RES_BITMASK ; -- restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ; -- restriction.res.resBitMask.relBMR = BMR_NEZ ; -- restriction.res.resBitMask.ulMask = AB_MODIFIABLE ; -- mLastError = folders->Restrict(&restriction, 0) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot restrict table %08x.\n", mLastError)) ; -- } -- folderColumns.cValues = 1 ; -- folderColumns.aulPropTag [0] = PR_ENTRYID ; -- mLastError = folders->SetColumns(&folderColumns, 0) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -- return FALSE ; -- } -- mLastError = folders->GetRowCount(0, &rowCount) ; -- if (HR_SUCCEEDED(mLastError)) { -- aFolders.mEntries = new nsMapiEntry [rowCount] ; -- aFolders.mNbEntries = 0 ; -- do { -- LPSRowSet rowSet = NULL ; -- -- rowCount = 0 ; -- mLastError = folders->QueryRows(1, 0, &rowSet) ; -- if (HR_SUCCEEDED(mLastError)) { -- rowCount = rowSet->cRows ; -- if (rowCount > 0) { -- nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ; -- SPropValue& currentValue = rowSet->aRow->lpProps [0] ; -- -- current.Assign(currentValue.Value.bin.cb, -- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -- } -- MyFreeProws(rowSet) ; -- } -- else { -- PRINTF(("Cannot query rows %08x.\n", mLastError)) ; -- } -- } while (rowCount > 0) ; -- } -- return HR_SUCCEEDED(mLastError) ; --} -+ - - BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction, - nsMapiEntryArray& aCards) - { - aCards.CleanUp() ; -- return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ; -+ return GetContents(aParent, aRestriction, &aCards, 0) ; - } - - BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes) - { - aNodes.CleanUp() ; -- return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ; -+ return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ; - } - - BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards) - { -- aNbCards = 0 ; -- return GetContents(aParent, NULL, NULL, aNbCards, 0) ; -+ nsMapiEntryArray aCards; -+ BOOL ret=GetContents(aParent, NULL, &aCards, 0) ; -+ aNbCards=aCards.GetSize(); -+ return ret; - } - - BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject, -@@ -390,7 +339,7 @@ - aName = values->Value.lpszA ; - } - else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) { -- aName.AssignWithConversion(values->Value.lpszW) ; -+ UnicodeToCStr(values->Value.lpszW,aName) ; - } - } - FreeBuffer(values) ; -@@ -410,7 +359,7 @@ - aName = values->Value.lpszW ; - } - else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) { -- aName.AssignWithConversion(values->Value.lpszA) ; -+ CStrToUnicode(values->Value.lpszA,aName) ; - } - } - FreeBuffer(values) ; -@@ -431,16 +380,22 @@ - ULONG i = 0 ; - - for (i = 0 ; i < valueCount ; ++ i) { -- if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) { -+ if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){ - if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) { - nsAutoString temp ; - -- temp.AssignWithConversion (values [i].Value.lpszA) ; -+ CStrToUnicode(values [i].Value.lpszA,temp) ; - aNames.AppendString(temp) ; - } - else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) { - aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ; - } -+ else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) { -+ nsAutoString temp ; -+ -+ CStrToUnicode (values [i].Value.lpszA,temp) ; -+ aNames.AppendString(temp) ; -+ } - else { - aNames.AppendString(nsAutoString((const PRUnichar *) "")) ; - } -@@ -466,7 +421,6 @@ - if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; } - if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) { - SYSTEMTIME readableTime ; -- - if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) { - aYear = readableTime.wYear ; - aMonth = readableTime.wMonth ; -@@ -518,7 +472,7 @@ - nsMapiInterfaceWrapper<LPMAPIPROP> subObject ; - ULONG objType = 0 ; - -- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, - &IID_IMAPIContainer, 0, &objType, - container) ; - if (HR_FAILED(mLastError)) { -@@ -537,7 +491,7 @@ - SBinary entry ; - SBinaryArray entryArray ; - -- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, - &IID_IABContainer, MAPI_MODIFY, &objType, - container) ; - if (HR_FAILED(mLastError)) { -@@ -567,14 +521,15 @@ - value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ; - } - else if (PROP_TYPE(aPropertyTag) == PT_STRING8) { -- alternativeValue.AssignWithConversion(aValue) ; -+ UnicodeToCStr(aValue,alternativeValue) ; - value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ; - } - else { - PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ; - return TRUE ; - } -- return SetMAPIProperties(aObject, 1, &value) ; -+ LPSPropValue values=&value; -+ return SetMAPIProperties(aObject, 1, values) ; - } - - BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag, -@@ -595,7 +550,7 @@ - values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ; - } - else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) { -- alternativeValue.AssignWithConversion(aValues [i].get()) ; -+ UnicodeToCStr(aValues [i].get(),alternativeValue) ; - char *av = nsCRT::strdup(alternativeValue.get()) ; - if (!av) { - retCode = FALSE ; -@@ -633,7 +588,8 @@ - readableTime.wSecond = 0 ; - readableTime.wMilliseconds = 0 ; - if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) { -- return SetMAPIProperties(aObject, 1, &value) ; -+ LPSPropValue values=&value; -+ return SetMAPIProperties(aObject, 1, values) ; - } - return TRUE ; - } -@@ -645,7 +601,7 @@ - nsMapiInterfaceWrapper<LPABCONT> container ; - ULONG objType = 0 ; - -- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, - &IID_IABContainer, MAPI_MODIFY, &objType, - container) ; - if (HR_FAILED(mLastError)) { -@@ -708,7 +664,7 @@ - nsMapiInterfaceWrapper<LPABCONT> container ; - ULONG objType = 0 ; - -- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, - &IID_IABContainer, MAPI_MODIFY, &objType, - container) ; - if (HR_FAILED(mLastError)) { -@@ -773,7 +729,7 @@ - nsMapiInterfaceWrapper<LPABCONT> container ; - ULONG objType = 0 ; - -- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, - &IID_IABContainer, MAPI_MODIFY, &objType, - container) ; - if (HR_FAILED(mLastError)) { -@@ -810,194 +766,77 @@ - return TRUE ; - } - --BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer) --{ -- LPENTRYID entryId = NULL ; -- ULONG byteCount = 0 ; -- -- mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot get PAB %08x.\n", mLastError)) ; -- return FALSE ; -- } -- aContainer.Assign(byteCount, entryId) ; -- FreeBuffer(entryId) ; -- return TRUE ; --} - --enum --{ -- ContentsColumnEntryId = 0, -- ContentsColumnObjectType, -- ContentsColumnsSize --} ; - --static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) = --{ -- ContentsColumnsSize, -- { -- PR_ENTRYID, -- PR_OBJECT_TYPE -- } --} ; - --BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -- nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType) -+void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset) - { -- if (aList != NULL) { *aList = NULL ; } -- aNbElements = 0 ; -- nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ; -- nsMapiInterfaceWrapper<LPMAPITABLE> contents ; -- ULONG objType = 0 ; -- ULONG rowCount = 0 ; -+ if (aRowset == NULL) { return ; } -+ ULONG i = 0 ; - -- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId, -- &IID_IMAPIContainer, 0, &objType, -- parent) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot open parent %08x.\n", mLastError)) ; -- return FALSE ; -- } -- // Here, flags for WAB and MAPI could be different, so this works -- // only as long as we don't want to use any flag in GetContentsTable -- mLastError = parent->GetContentsTable(0, contents) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot get contents %08x.\n", mLastError)) ; -- return FALSE ; -+ for (i = 0 ; i < aRowset->cRows ; ++ i) { -+ FreeBuffer(aRowset->aRow [i].lpProps) ; - } -- if (aRestriction != NULL) { -- mLastError = contents->Restrict(aRestriction, 0) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot set restriction %08x.\n", mLastError)) ; -- return FALSE ; -- } -- } -- mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -- return FALSE ; -- } -- mLastError = contents->GetRowCount(0, &rowCount) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot get result count %08x.\n", mLastError)) ; -- return FALSE ; -- } -- if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; } -- aNbElements = 0 ; -- do { -- LPSRowSet rowSet = NULL ; -- -- rowCount = 0 ; -- mLastError = contents->QueryRows(1, 0, &rowSet) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot query rows %08x.\n", mLastError)) ; -- return FALSE ; -- } -- rowCount = rowSet->cRows ; -- if (rowCount > 0 && -- (aMapiType == 0 || -- rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) { -- if (aList != NULL) { -- nsMapiEntry& current = (*aList) [aNbElements] ; -- SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ; -- -- current.Assign(currentValue.Value.bin.cb, -- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -+ FreeBuffer(aRowset) ; -+ } -+void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result) -+{ -+ result.Truncate( 0); -+ int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0); -+ if (wLen >= m_uniBuffLen) -+ { -+ delete [] m_pUniBuff; -+ m_pUniBuff = new PRUnichar[wLen + 64]; -+ m_uniBuffLen = wLen + 64; - } -- ++ aNbElements ; -+ if (wLen) -+ { -+ MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen); -+ result = m_pUniBuff; - } -- MyFreeProws(rowSet) ; -- } while (rowCount > 0) ; -- return TRUE ; - } -- --BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -- ULONG aNbProperties, LPSPropValue& aValue, -- ULONG& aValueCount) -+void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result) - { -- nsMapiInterfaceWrapper<LPMAPIPROP> object ; -- ULONG objType = 0 ; -- LPSPropTagArray properties = NULL ; -- ULONG i = 0 ; -- -- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId, -- &IID_IMAPIProp, 0, &objType, -- object) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -- return FALSE ; -+ result.Truncate( 0); -+ int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL); -+ if (cLen >= m_cstrBuffLen) { -+ if (m_pCStrBuff) -+ delete [] m_pCStrBuff; -+ m_pCStrBuff = new char[cLen + 64]; -+ m_cstrBuffLen = cLen + 64; - } -- AllocateBuffer(CbNewSPropTagArray(aNbProperties), -- NS_REINTERPRET_CAST(void **, &properties)) ; -- properties->cValues = aNbProperties ; -- for (i = 0 ; i < aNbProperties ; ++ i) { -- properties->aulPropTag [i] = aPropertyTags [i] ; -- } -- mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ; -- FreeBuffer(properties) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot get props %08x.\n", mLastError)) ; -+ if (cLen) { -+ WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL); -+ result = m_pCStrBuff; - } -- return HR_SUCCEEDED(mLastError) ; - } - --BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -- const LPSPropValue& aValues) --{ -- nsMapiInterfaceWrapper<LPMAPIPROP> object ; -- ULONG objType = 0 ; -- LPSPropProblemArray problems = NULL ; -+static nsAbWinHelper *getOutlookAddressBook(void) { -+ static nsMapiAddressBook *addressBook = NULL ; - -- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId, -- &IID_IMAPIProp, MAPI_MODIFY, &objType, -- object) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -- return FALSE ; -- } -- mLastError = object->SetProps(aNbProperties, aValues, &problems) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot update the object %08x.\n", mLastError)) ; -- return FALSE ; -- } -- if (problems != NULL) { -- for (ULONG i = 0 ; i < problems->cProblem ; ++ i) { -- PRINTF(("Problem %d: index %d code %08x.\n", i, -- problems->aProblem [i].ulIndex, -- problems->aProblem [i].scode)) ; -- } -- } -- mLastError = object->SaveChanges(0) ; -- if (HR_FAILED(mLastError)) { -- PRINTF(("Cannot commit changes %08x.\n", mLastError)) ; -- } -- return HR_SUCCEEDED(mLastError) ; -+ if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; } -+ return addressBook ; - } - --void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset) --{ -- if (aRowset == NULL) { return ; } -- ULONG i = 0 ; -+static nsAbWinHelper *getOutlookExpAddressBook(void) { -+ static nsWabAddressBook *addressBook = NULL ; - -- for (i = 0 ; i < aRowset->cRows ; ++ i) { -- FreeBuffer(aRowset->aRow [i].lpProps) ; -- } -- FreeBuffer(aRowset) ; -+ if (addressBook == NULL) { addressBook = new nsWabAddressBook ; } -+ return addressBook ; - } - - nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType) - : mHelper(NULL) - { - switch(aType) { -- case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ; -- case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ; -+ case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ; -+ case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ; - default: break ; - } - } - - nsAbWinHelperGuard::~nsAbWinHelperGuard(void) - { -- delete mHelper ; - } - - const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ; ---- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200 -@@ -45,6 +45,24 @@ - #include "nsVoidArray.h" - #include "nsXPIDLString.h" - -+#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E -+#define PR_SCREEN_NAME_A 0x805B001E -+ -+ -+// Small utility to ensure release of all MAPI interfaces -+template <class tInterface> struct nsMapiInterfaceWrapper -+{ -+ tInterface mInterface ; -+ -+ nsMapiInterfaceWrapper(void) : mInterface(NULL) {} -+ ~nsMapiInterfaceWrapper(void) { -+ if (mInterface ) { mInterface->Release() ; } -+ } -+ operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; } -+ tInterface operator -> (void) const { return mInterface ; } -+ operator tInterface *(void) { return &mInterface ; } -+} ; -+ - struct nsMapiEntry - { - ULONG mByteCount ; -@@ -62,14 +80,28 @@ - - struct nsMapiEntryArray - { -- nsMapiEntry *mEntries ; -- ULONG mNbEntries ; - - nsMapiEntryArray(void) ; - ~nsMapiEntryArray(void) ; - -- const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; } -+ void AddItem(nsMapiEntry * aEntries); -+ void AddItem( ULONG mByteCount , LPENTRYID mEntryId ) -+ { -+ nsMapiEntry * aEntries=new nsMapiEntry(); -+ aEntries->Assign(mByteCount,mEntryId); -+ AddItem(aEntries); -+ } -+ -+ ULONG GetSize( void) { return( m_array.Count());} -+ nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); } -+ nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); } - void CleanUp(void) ; -+ void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); } -+ void Remove(int index){ m_array.RemoveElementAt(index); } -+ ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);}; -+private: -+ nsVoidArray m_array; -+ - } ; - - class nsAbWinHelper -@@ -79,7 +111,7 @@ - virtual ~nsAbWinHelper(void) ; - - // Get the top address books -- BOOL GetFolders(nsMapiEntryArray& aFolders) ; -+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0; - // Get a list of entries for cards/mailing lists in a folder/mailing list - BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction, - nsMapiEntryArray& aCards) ; -@@ -97,18 +129,14 @@ - BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag, - ULONG aNbProperties, nsStringArray& aValues) ; - // Get the value of a MAPI property of type SYSTIME -- BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, -+ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, - WORD& aYear, WORD& aMonth, WORD& aDay) ; -- // Get the value of a MAPI property of type LONG -- BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ; - // Get the value of a MAPI property of type BIN - BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ; - // Tests if a container contains an entry - BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ; -- // Delete an entry in the address book -- BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ; - // Set the value of a MAPI property of type string in unicode -- BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag, -+ virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag, - const PRUnichar *aValue) ; - // Same as previous, but with a bunch of properties in one call - BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag, -@@ -117,32 +145,44 @@ - BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, - WORD aYear, WORD aMonth, WORD aDay) ; - // Create entry in the address book -- BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; -+ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; -+ // Delete an entry in the address book -+ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ; - // Create a distribution list in the address book -- BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; -+ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; - // Copy an existing entry in the address book -- BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ; -+ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ; - // Get a default address book container -- BOOL GetDefaultContainer(nsMapiEntry& aContainer) ; -+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0; - // Is the helper correctly initialised? -- BOOL IsOK(void) const { return mAddressBook != NULL ; } -+ virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/ -+ -+ // Get the value of a MAPI property of type LONG -+ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ; - - protected: - HRESULT mLastError ; -- LPADRBOOK mAddressBook ; - static PRUint32 mEntryCounter ; - static PRLock *mMutex ; - -+ virtual HRESULT OpenEntry(ULONG cbEntryID, -+ LPENTRYID lpEntryID, -+ LPCIID lpInterface, -+ ULONG ulFlags, -+ ULONG FAR * lpulObjType, -+ LPUNKNOWN FAR * lppUnk -+ ) = 0; -+ - // Retrieve the contents of a container, with an optional restriction -- BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -- nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ; -+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -+ nsMapiEntryArray *aList, ULONG aMapiType) =0; - // Retrieve the values of a set of properties on a MAPI object -- BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, - ULONG aNbProperties, -- LPSPropValue& aValues, ULONG& aValueCount) ; -+ LPSPropValue& aValues, ULONG& aValueCount) =0; - // Set the values of a set of properties on a MAPI object -- BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -- const LPSPropValue& aValues) ; -+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -+ LPSPropValue& aValues) =0; - // Clean-up a rowset returned by QueryRows - void MyFreeProws(LPSRowSet aSet) ; - // Allocation of a buffer for transmission to interfaces -@@ -150,7 +190,16 @@ - // Destruction of a buffer provided by the interfaces - virtual void FreeBuffer(LPVOID aBuffer) = 0 ; - -+ static void CStrToUnicode( const char *pStr, nsString& result); -+ static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result); -+ - private: -+ static int m_clients; -+ static PRUnichar * m_pUniBuff; -+ static int m_uniBuffLen; -+ static char * m_pCStrBuff; -+ static int m_cstrBuffLen; -+ - } ; - - enum nsAbWinType -@@ -168,6 +217,7 @@ - - nsAbWinHelper *operator ->(void) { return mHelper ; } - -+ static void FreeWinAbLibrarys(); - private: - nsAbWinHelper *mHelper ; - } ; ---- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200 -@@ -100,6 +100,9 @@ - - static const char kMailListAddressFormat[] = "Address%d"; - -+extern int getMD5sum(const char * fileName,char * sum); -+extern int testMD5sum(const char * fileName,char * sum); -+ - static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID); - - nsAddrDatabase::nsAddrDatabase() -@@ -171,6 +174,7 @@ - m_LastRecordKey(0), - m_dbDirectory(nsnull) - { -+ memset(m_dbMd5Sum,0,33); - } - - nsAddrDatabase::~nsAddrDatabase() -@@ -790,7 +794,11 @@ - if (NS_FAILED(ret)) - ret = NS_ERROR_FILE_ACCESS_DENIED; - } -- -+ -+ ret = getMD5sum(nativeFileName,m_dbMd5Sum); -+ if (ret == 1) -+ ret = NS_ERROR_FAILURE; -+ - nsCRT::free(nativeFileName); - - if (NS_SUCCEEDED(ret) && thumb) -@@ -883,6 +891,17 @@ - { - nsresult err = NS_OK; - nsIMdbThumb *commitThumb = nsnull; -+ -+ const char *pFilename = m_dbName.GetCString(); /* do not free */ -+ char *nativeFileName = nsCRT::strdup(pFilename); -+#if defined(XP_PC) || defined(XP_MAC) -+ UnixToNative(nativeFileName); -+#endif -+ if (testMD5sum(nativeFileName,m_dbMd5Sum)) -+ { -+ nsCRT::free(nativeFileName); -+ return NS_ERROR_FILE_ACCESS_DENIED; -+ } - - if (commitType == nsAddrDBCommitType::kLargeCommit || - commitType == nsAddrDBCommitType::kSessionCommit) -@@ -936,6 +955,10 @@ - // ### do something with error, but clear it now because mork errors out on commits. - if (m_mdbEnv) - m_mdbEnv->ClearErrors(); -+ if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum)) -+ err = NS_ERROR_FAILURE; -+ nsCRT::free(nativeFileName); -+ - return err; - } - ---- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200 -@@ -394,6 +394,7 @@ - nsIMdbTable *m_mdbPabTable; - nsIMdbTable *m_mdbDeletedCardsTable; - nsFileSpec m_dbName; -+ char m_dbMd5Sum[33]; - PRBool m_mdbTokensInitialized; - nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners; - ---- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -40,6 +40,22 @@ - - #include "prlog.h" - -+static char * stristr(const char *big, const char *little) -+{ -+ PRUint32 len; -+ -+ if (!big || !little || !*big || !*little) -+ return 0; -+ len = strlen(little); -+ -+ for( ; *big; big++ ) -+ if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) ) -+ return (char *)big; -+ -+ return (char *)0; -+ -+} -+ - #ifdef PR_LOGGING - static PRLogModuleInfo* gMapiAddressBookLog - = PR_NewLogModule("nsMapiAddressBookLog"); -@@ -47,6 +63,60 @@ - - #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args) - -+#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display -+#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address -+#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address -+#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name -+#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist -+#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table -+#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table -+ -+static const TagMap TagMaps[]={ -+ {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8}, -+ {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8}, -+ {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8}, -+ {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}}; -+ -+enum { -+ ieidPR_ENTRYID = 0, -+ ieidPR_OBJECT_TYPE, -+ ieidPR_DISPLAY_NAME, -+ ieidPR_MESSAGE_CLASS, -+ ieidPR_STORE_ENTRYID, -+ ieidPR_MESSAGE_RECIPIENTS, -+ ieidMax -+}; -+ -+static const SizedSPropTagArray(ieidMax, ptaEid)= -+{ -+ ieidMax, -+ { -+ PR_ENTRYID, -+ PR_OBJECT_TYPE, -+ PR_DISPLAY_NAME, -+ PR_MESSAGE_CLASS, -+ PR_STORE_ENTRYID, -+ PR_MESSAGE_RECIPIENTS -+ } -+}; -+ -+enum -+{ -+ ContentsColumnEntryId = 0, -+ ContentsColumnObjectType, -+ ContentsColumnMessageClass, -+ ContentsColumnsSize -+} ; -+ -+static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) = -+{ -+ ContentsColumnsSize, -+ { -+ PR_ENTRYID, -+ PR_OBJECT_TYPE, -+ PR_MESSAGE_CLASS -+ } -+} ; - - HMODULE nsMapiAddressBook::mLibrary = NULL ; - PRInt32 nsMapiAddressBook::mLibUsage = 0 ; -@@ -59,7 +129,7 @@ - BOOL nsMapiAddressBook::mInitialized = FALSE ; - BOOL nsMapiAddressBook::mLogonDone = FALSE ; - LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ; --LPADRBOOK nsMapiAddressBook::mRootBook = NULL ; -+#define MAPI_NO_COINIT 8 - - BOOL nsMapiAddressBook::LoadMapiLibrary(void) - { -@@ -91,7 +161,7 @@ - mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX, - GetProcAddress(mLibrary, "MAPILogonEx")) ; - if (!mMAPILogonEx) { return FALSE ; } -- MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ; -+ MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ; - HRESULT retCode = mMAPIInitialize(&mapiInit) ; - - if (HR_FAILED(retCode)) { -@@ -105,22 +175,19 @@ - MAPI_NEW_SESSION, - &mRootSession) ; - if (HR_FAILED(retCode)) { -- PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ; -+ PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; -+ return FALSE ; - } - mLogonDone = TRUE ; -- retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ; -- if (HR_FAILED(retCode)) { -- PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ; -- } -+ - return HR_SUCCEEDED(retCode) ; - } - - void nsMapiAddressBook::FreeMapiLibrary(void) - { - if (mLibrary) { -- if (-- mLibUsage == 0) { -+ if (--mLibUsage < 0) { - { -- if (mRootBook) { mRootBook->Release() ; } - if (mRootSession) { - if (mLogonDone) { - mRootSession->Logoff(NULL, 0, 0) ; -@@ -134,6 +201,7 @@ - } - } - FreeLibrary(mLibrary) ; -+ mRootSession = NULL; - mLibrary = NULL ; - } - } -@@ -145,7 +213,6 @@ - : nsAbWinHelper() - { - BOOL result = Initialize() ; -- - NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ; - MOZ_COUNT_CTOR(nsMapiAddressBook) ; - } -@@ -153,22 +220,882 @@ - nsMapiAddressBook::~nsMapiAddressBook(void) - { - nsAutoLock guard(mMutex) ; -- -+ CleanUpMDB(); - FreeMapiLibrary() ; - MOZ_COUNT_DTOR(nsMapiAddressBook) ; - } - -+LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag) -+{ -+ if (!pProp) -+ return( NULL); -+ -+ int sz = CbNewSPropTagArray( 1); -+ SPropTagArray *pTag = (SPropTagArray *) new char[sz]; -+ pTag->cValues = 1; -+ pTag->aulPropTag[0] = tag; -+ LPSPropValue lpProp = NULL; -+ ULONG cValues = 0; -+ HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp); -+ delete pTag; -+ if (HR_FAILED( hr) || (cValues != 1)) { -+ if (lpProp) -+ mMAPIFreeBuffer( lpProp); -+ return( NULL); -+ } -+ else { -+ if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) { -+ if (lpProp->Value.l == MAPI_E_NOT_FOUND) { -+ mMAPIFreeBuffer( lpProp); -+ lpProp = NULL; -+ } -+ } -+ } -+ -+ return( lpProp); -+} -+BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal) -+{ -+ if (!pVal) -+ return( FALSE); -+ -+ BOOL bResult = TRUE; -+ switch (PROP_TYPE(pVal->ulPropTag)) -+ { -+ case PT_BINARY: -+ cbEntryId = pVal->Value.bin.cb; -+ mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId); -+ memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId); -+ break; -+ -+ default: -+ PRINTF(( "EntryId not in BINARY prop value\n")); -+ bResult = FALSE; -+ break; -+ } -+ -+ if (pVal && delVal) -+ mMAPIFreeBuffer( pVal); -+ -+ return( bResult); -+} -+ -+BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders) -+{ -+ LPMDB lpMsgStore; -+ ULONG objType=0; -+ HRESULT hr; -+ -+ if (oType == MAPI_MESSAGE) -+ return FALSE; -+ if (oType == MAPI_STORE) -+ { -+ hr=mRootSession->OpenEntry( -+ cb, -+ pEntry, -+ &IID_IMsgStore, -+ MAPI_BEST_ACCESS, -+ &objType, -+ (IUnknown**)&lpMsgStore); -+ if (FAILED(hr)) -+ return FALSE ; -+ //Add MDB to a list to make it can be released when class destroyed. -+ //We must leave it openned or else we can't open address store in it. -+ AddToMDBArray(lpMsgStore); -+ -+ LPSPropValue pVal; -+ pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID); -+ -+ -+ if (pVal) { -+ ULONG cbEntry; -+ LPENTRYID pEntry; -+ nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree; -+ -+ if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) { -+ // Open up the folder! -+ BOOL bResult = TRUE; -+ bResult = lpMsgStore->OpenEntry( -+ cbEntry, -+ pEntry, -+ NULL, -+ MAPI_BEST_ACCESS, -+ &objType, -+ lpSubTree); -+ mMAPIFreeBuffer( pEntry); -+ if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) { -+ // Iterate the subtree with the results going into the folder list -+ bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders); -+ } -+ else { -+ PRINTF(( "GetStoreFolders: Error opening sub tree.\n")); -+ } -+ } -+ else { -+ PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n")); -+ } -+ } -+ else { -+ PRINTF(( "GetStoreFolders: Error getting sub tree property.\n")); -+ } -+ } -+ else -+ { -+ PRINTF(("Type:%d\n",oType)); -+ } -+ -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags) -+{ -+ // flags can be CONVENIENT_DEPTH or 0 -+ // CONVENIENT_DEPTH will return all depths I believe instead -+ // of just children -+ HRESULT hr; -+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable; -+ hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable); -+ if (HR_FAILED(hr)) { -+ PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr)); -+ return( FALSE); -+} -+ -+ ULONG rowCount; -+ hr = lpTable->GetRowCount( 0, &rowCount); -+ if (!rowCount) { -+ return( TRUE); -+ } -+ -+ hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0); -+ if (HR_FAILED(hr)) { -+ PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr)); -+ return( FALSE); -+ } -+ -+ hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL); -+ if (HR_FAILED(hr)) { -+ PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr)); -+ return( FALSE); -+ } -+ -+ int cNumRows = 0; -+ LPSRowSet lpRow; -+ BOOL keepGoing = TRUE; -+ BOOL bResult = TRUE; -+ do { -+ -+ lpRow = NULL; -+ hr = lpTable->QueryRows( 1, 0, &lpRow); -+ -+ if (HR_FAILED(hr)) -+{ -+ PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr)); -+ bResult = FALSE; -+ break; -+ } -+ -+ if (lpRow){ -+ cNumRows = lpRow->cRows; -+ -+ if (cNumRows) { -+ LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb; -+ ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb; -+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul; -+ -+ keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders); -+ -+ } -+ MyFreeProws(lpRow); -+ } -+ -+ } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing); -+ -+ -+ if (bResult && !keepGoing) -+ bResult = FALSE; -+ -+ return( bResult); -+} -+BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders) -+{ -+ ULONG objType=0; -+ if (oType == MAPI_FOLDER) -+ { -+ nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ; -+ if (!mRootSession->OpenEntry( -+ cb, -+ pEntry, -+ 0, -+ MAPI_BEST_ACCESS, -+ &objType, -+ pFolder)) -+ { -+ LPSPropValue pVal; -+ -+ -+ pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS); -+ if (pVal) -+ { -+ if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0) -+ { -+ SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID); -+ -+ aFolders.AddItem(currentValue->Value.bin.cb, -+ NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ; -+ -+ } -+ } -+ } -+ } -+ else -+ { -+ PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType)); -+ } -+ -+ return( TRUE); -+} -+ -+ -+BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders) -+{ -+ aFolders.CleanUp() ; -+ nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ; -+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ; -+ ULONG objType = 0 ; -+ ULONG rowCount = 0 ; -+ -+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable; -+ -+ mLastError = mRootSession->GetMsgStoresTable( 0, lpTable); -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError)); -+ return mLastError; -+ } -+ -+ mLastError = lpTable->GetRowCount( 0, &rowCount); -+ -+ mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0); -+ if (FAILED(mLastError)) -+ return( mLastError); -+ mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL); -+ if (FAILED(mLastError)) -+ return mLastError; -+ -+ int cNumRows = 0; -+ LPSRowSet lpRow; -+ BOOL keepGoing = TRUE; -+ BOOL bResult = TRUE; -+ do { -+ -+ lpRow = NULL; -+ mLastError = lpTable->QueryRows( 1, 0, &lpRow); -+ -+ if (HR_FAILED(mLastError)){ -+ bResult = FALSE; -+ break; -+ } -+ -+ if (lpRow){ -+ cNumRows = lpRow->cRows; -+ -+ if (cNumRows) { -+ LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb; -+ ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb; -+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul; -+ -+ -+ keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders); -+ } -+ MyFreeProws( lpRow); -+ } -+ -+ } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing); -+ -+ -+ return HR_SUCCEEDED(mLastError) ; -+} -+BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction) -+{ -+ ULONG conditionType = 0 ; -+ ULONG ulResIndex; -+ if (!aRestriction) -+ return FALSE; -+ for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++) -+ { -+ conditionType = aRestriction[ulResIndex].rt; -+ switch (conditionType) -+ { -+ case RES_EXIST : -+ aRestriction[ulResIndex].res.resExist.ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag); -+ break ; -+ case RES_BITMASK : -+ aRestriction[ulResIndex].res.resBitMask.ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag); -+ break ; -+ case RES_CONTENT : -+ aRestriction[ulResIndex].res.resContent.ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag); -+ aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag); -+ break ; -+ case RES_PROPERTY : -+ aRestriction[ulResIndex].res.resProperty.ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag); -+ aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag); -+ break ; -+ case RES_SIZE : -+ aRestriction[ulResIndex].res.resSize.ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag); -+ break ; -+ case RES_COMPAREPROPS : -+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1); -+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2); -+ break ; -+ case RES_NOT : -+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes); -+ break; -+ case RES_AND : -+ CorrectRestriction(aMapiProp, -+ aRestriction[ulResIndex].res.resAnd.cRes, -+ aRestriction[ulResIndex].res.resAnd.lpRes); -+ break; -+ case RES_OR : -+ CorrectRestriction(aMapiProp, -+ aRestriction[ulResIndex].res.resOr.cRes, -+ aRestriction[ulResIndex].res.resOr.lpRes); -+ break; -+ -+ case RES_COMMENT : -+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes); -+ aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag = -+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag); -+ break; -+ case RES_SUBRESTRICTION : -+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes); -+ break; -+ default: -+ return FALSE; -+ } -+ } -+ return TRUE; -+} -+BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList) -+{ -+ if (!aRestriction) -+ return FALSE; -+ -+ ULONG conditionType = 0 ; -+ -+ nsMapiEntryArray listOut; -+ ULONG listindex=0; -+ -+ nsMapiEntryArray listDel; -+ ULONG delindex=0; -+ -+ ULONG listsize; -+ ULONG resCount = 0; -+ ULONG resIndex = 0; -+ -+ listsize = aList->GetSize(); -+ conditionType = aRestriction->rt; -+ switch (conditionType) -+ { -+ case RES_EXIST : -+ case RES_BITMASK : -+ case RES_CONTENT : -+ case RES_PROPERTY : -+ case RES_SIZE : -+ case RES_COMPAREPROPS : -+ case RES_COMMENT : -+ case RES_SUBRESTRICTION : -+ { -+ while(listindex < aList->GetSize()) -+ { -+ if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction)) -+ aList->Remove(listindex); -+ else -+ listindex++; -+ } -+ } -+ break; -+ case RES_NOT : -+ aRestriction->res.resNot.ulReserved = 1; -+ case RES_AND : -+ case RES_OR : -+ { -+ if (conditionType == RES_OR) -+ { -+ for(listindex=0;listindex<aList->GetSize();listindex++) -+ { -+ listDel.AddItem(aList->ElementAt(listindex)); -+ } -+ } -+ -+ resCount = aRestriction->res.resAnd.cRes; -+ //notice that SAndRestriction ,SNotRestriction ,SOrRestriction -+ //use the same struct -+ for (resIndex = 0;resIndex < resCount;resIndex++) -+ { -+ //can't call listOut.CleanUp() here -+ //because it will destroy all Element too -+ while(listOut.GetSize()) -+ { -+ listOut.Remove(0); -+ } -+ -+ for(listindex=0;listindex<aList->GetSize();listindex++) -+ { -+ listOut.AddItem(aList->ElementAt(listindex)); -+ } -+ -+ Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut); -+ if (conditionType == RES_NOT) -+ { -+ for(listindex=0;listindex<listOut.GetSize();listindex++) -+ { -+ aList->Remove(listOut.ElementAt(listindex)); -+ } -+ } -+ else if (conditionType == RES_AND ) -+ { -+ for(listindex=0;listindex<listOut.GetSize();listindex++) -+ { -+ if (!aList->IndexOf(listOut.ElementAt(listindex))) -+ { -+ aList->Remove(listOut.ElementAt(listindex)); -+ } -+ } -+ } -+ else if (conditionType == RES_OR ) -+ { -+ for(listindex=0;listindex<listOut.GetSize();listindex++) -+ { -+ listDel.Remove(listOut.ElementAt(listindex)); -+ } -+ if (listDel.GetSize() == 0) -+ { -+ break; -+ } -+ } -+ } -+ if (conditionType == RES_OR) -+ { -+ for(listindex=0;listindex<listDel.GetSize();listindex++) -+ { -+ aList->Remove(listDel.ElementAt(listindex)); -+ } -+ } -+ } -+ -+ } -+ while(listDel.GetSize()) -+ { -+ listDel.Remove(0); -+ } -+ while(listOut.GetSize()) -+ { -+ listOut.Remove(0); -+ } -+ -+ -+ return TRUE; -+} -+ -+BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction) -+{ -+ LPMAPIPROP object ; -+ ULONG objType = 0 ; -+ LPSPropValue realValue = NULL ; -+ LPSPropValue resValue = NULL ; -+ ULONG valueCount = 0 ; -+ -+ mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ (IUnknown **)&object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ ULONG conditionType = 0 ; -+ conditionType = aRestriction->rt; -+ -+ switch (conditionType) -+ { -+ case RES_EXIST : -+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount)) -+ return FALSE; -+ resValue = NULL; -+ break ; -+ case RES_CONTENT : -+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount)) -+ return FALSE; -+ resValue = aRestriction->res.resContent.lpProp; -+ break ; -+ case RES_PROPERTY : -+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount)) -+ return FALSE; -+ resValue = aRestriction->res.resProperty.lpProp; -+ break ; -+ case RES_BITMASK : -+ return FALSE; //not support -+ break ; -+ case RES_SIZE : -+ return FALSE;//not been used now -+ break ; -+ case RES_COMPAREPROPS : -+ return FALSE;//not been used now -+ break ; -+ case RES_NOT : -+ return FALSE;//not need care here -+ break; -+ case RES_AND : -+ return FALSE;//not need care here -+ break; -+ case RES_OR : -+ return FALSE;//not need care here -+ break; -+ case RES_COMMENT : -+ return TRUE;//comment -+ break; -+ case RES_SUBRESTRICTION : -+ return FALSE;//not been used now -+ break ; -+} -+ return AtomyFilter(aRestriction,realValue,resValue); -+ -+} -+ -+BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue) -+{ -+ ULONG conditionType = 0 ; -+ conditionType = aRestriction->rt; -+ -+ BOOL bTagEq=(aRealValue && -+ PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) && -+ aFilterValue; -+ // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag )); -+ switch (conditionType) -+ { -+ case RES_EXIST : -+ return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ; -+ break ; -+ case RES_CONTENT : -+ if (bTagEq) -+ { -+ switch(aRestriction->res.resContent.ulFuzzyLevel) -+ { -+ case FL_FULLSTRING : -+ return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA); -+ break; -+ case FL_PREFIX : -+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA; -+ break; -+ case FL_SUBSTRING : -+ default: -+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL; -+ break; -+ } -+ } -+ return FALSE; -+ break ; -+ case RES_PROPERTY : -+ if (bTagEq) -+ { -+ switch(aRestriction->res.resProperty.relop) -+ { -+ case RELOP_GE : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0; -+ break; -+ case RELOP_GT : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0; -+ break; -+ case RELOP_LE : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0; -+ break; -+ case RELOP_LT : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0; -+ break; -+ case RELOP_EQ : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0; -+ break; -+ case RELOP_NE : -+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0; -+ break; -+ case RELOP_RE : -+ default: -+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL; -+ break; -+ -+ } -+ } -+ return FALSE; -+ break ; -+ case RES_BITMASK : -+ return FALSE; //not support -+ break ; -+ case RES_SIZE : -+ return FALSE;//not been used now -+ break ; -+ case RES_COMPAREPROPS : -+ return FALSE;//not been used now -+ break ; -+ case RES_NOT : -+ return FALSE;//not need care here -+ break; -+ case RES_AND : -+ return FALSE;//not need care here -+ break; -+ case RES_OR : -+ return FALSE;//not need care here -+ break; -+ case RES_COMMENT : -+ return TRUE;//comment -+ break; -+ case RES_SUBRESTRICTION : -+ return FALSE;//not been used now -+ break ; -+ } -+ return TRUE; -+} -+ -+BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -+ nsMapiEntryArray *aList, ULONG aMapiType) -+{ -+ if (aList) -+ aList->CleanUp(); -+ -+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ; -+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ; -+ ULONG objType = 0 ; -+ ULONG rowCount = 0 ; -+ -+ -+ nsMapiInterfaceWrapper<LPMAPIPROP> pFolder; -+ nsCString cs; -+ aParent.ToString(cs); -+ -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ 0, MAPI_BEST_ACCESS, &objType, pFolder); -+ if (HR_FAILED(mLastError)) -+ { -+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ -+ -+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS); -+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0) -+ { -+ HRESULT hr; -+ LPSPropValue aValue = NULL ; -+ ULONG aValueCount = 0 ; -+ -+ LPSPropTagArray properties = NULL ; -+ mMAPIAllocateBuffer(CbNewSPropTagArray(1), -+ (void **)&properties); -+ properties->cValues = 1; -+ properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1); -+ hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ; -+ -+ SBinaryArray *sa=&aValue->Value.MVbin; -+ -+ LPENTRYID lpEID; -+ ULONG cbEID; -+ -+ ULONG idx; -+ nsMapiEntry testEntry; -+ nsCString sClass; -+ for (idx=0;sa->lpbin && idx<sa->cValues ;idx++) -+ { -+ lpEID= (LPENTRYID) sa->lpbin[idx].lpb; -+ cbEID = sa->lpbin[idx].cb; -+ testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb)); -+ -+ if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property -+ { -+ aList->AddItem(cbEID,lpEID); -+ } -+ } -+ Filter(aRestriction,aList); -+ } -+ else -+ { -+ if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction)) -+ return FALSE; -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType, -+ parent) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ mLastError = parent->GetContentsTable(0, contents) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ if (aRestriction) { -+ mLastError = contents->Restrict(aRestriction, TBL_BATCH) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ } -+ mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0); -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ mLastError = contents->GetRowCount(0, &rowCount) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ do { -+ LPSRowSet rowSet = NULL ; -+ -+ rowCount = 0 ; -+ mLastError = contents->QueryRows(1, 0, &rowSet) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ rowCount = rowSet->cRows ; -+ if (rowCount > 0 && aList) -+ { -+ if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType) -+ { -+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ; -+ aList->AddItem(currentValue.Value.bin.cb, -+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -+ } -+ else if (aMapiType == MAPI_DISTLIST) -+ { -+ if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0) -+ { -+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ; -+ aList->AddItem(currentValue.Value.bin.cb, -+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -+ -+ } -+} -+ -+ } -+ MyFreeProws(rowSet) ; -+ } while (rowCount > 0) ; -+ } -+ -+ -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -+ ULONG aNbProperties, LPSPropValue& aValue, -+ ULONG& aValueCount) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object ; -+ ULONG objType = 0 ; -+ LPSPropTagArray properties = NULL ; -+ ULONG i = 0 ; -+ -+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ AllocateBuffer(CbNewSPropTagArray(aNbProperties), -+ NS_REINTERPRET_CAST(void **, &properties)); -+ properties->cValues = aNbProperties ; -+ for (i = 0 ; i < aNbProperties ; ++ i) -+ { -+ properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE); -+ } -+ mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ; -+ FreeBuffer(properties) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Error get props %08x.\n", mLastError)) ; -+ } -+ return HR_SUCCEEDED(mLastError); -+} -+ -+BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -+ LPSPropValue& aValues) -+{ -+ nsMapiInterfaceWrapper<LPMESSAGE> object; -+ ULONG objType = 0 ; -+ LPSPropProblemArray problems = NULL ; -+ ULONG i = 0 ; -+ -+ LPMDB lpMsgStore=GetMsgStore(aObject); -+ -+ if (!lpMsgStore) -+ { -+ return FALSE; -+ } -+ mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType, -+ object) ; -+ lpMsgStore->Release(); -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ for (i = 0 ; i < aNbProperties ; ++ i) -+ { -+ aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE); -+ } -+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ if (problems) { -+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) { -+ PRINTF(("Problem %d: index %d code %08x.\n", i, -+ problems->aProblem [i].ulIndex, -+ problems->aProblem [i].scode)) ; -+ } -+ } -+ mLastError = object->SaveChanges(0) ; -+ if (MAPI_E_OBJECT_CHANGED == mLastError) -+ { -+ mLastError = object->SaveChanges(FORCE_SAVE ) ; -+ } -+ return HR_SUCCEEDED(mLastError) ; -+} -+ -+BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer) -+{ -+ return FALSE ; -+} -+ -+BOOL nsMapiAddressBook::IsOK(void) -+{ -+ return mRootSession && mLibUsage; -+} -+ - BOOL nsMapiAddressBook::Initialize(void) - { -- if (mAddressBook) { return TRUE ; } -+ - nsAutoLock guard(mMutex) ; - - if (!LoadMapiLibrary()) { - PRINTF(("Cannot load library.\n")) ; - return FALSE ; - } -- mAddressBook = mRootBook ; -- return TRUE ; -+ return TRUE; - } - - void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) -@@ -181,7 +1108,803 @@ - mMAPIFreeBuffer(aBuffer) ; - } - -+ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID) -+{ -+ static GUID emailGUID = -+ { -+ 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 -+ }; -+ -+ -+ MAPINAMEID mapiNameID; -+ mapiNameID.lpguid = &emailGUID; -+ mapiNameID.ulKind = MNID_ID; -+ mapiNameID.Kind.lID = nameID; -+ -+ LPMAPINAMEID lpMapiNames = &mapiNameID; -+ LPSPropTagArray lpMailTagArray = NULL; -+ -+ HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray); -+ if (result == S_OK) -+ { -+ ULONG lTag = lpMailTagArray->aulPropTag[0]; -+ mMAPIFreeBuffer(lpMailTagArray); -+ return lTag; -+ } -+ return 0L; -+} -+ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest) -+{ -+ LPSPropValue addr; -+ ULONG upRealTag=aPropertyTag; -+ ULONG lSize=sizeof(TagMaps) / sizeof(TagMap); -+ -+ for(int i=0; i<lSize; i++) -+ { -+ if (TagMaps[i].AddressTag == aPropertyTag) -+ { -+ -+ ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID); -+ if (aTest) -+ { -+ if (PR_DISPLAY_NAME_A == aPropertyTag) -+ { -+ //We need not change PR_DISPLAY_NAME_A tag if we are not using an address -+ LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS); -+ if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA)) -+ { -+ if (kPriEmailColumn) -+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask; -+ } -+ else -+ { -+ FreeBuffer(msgClass); -+ upRealTag = aPropertyTag; -+ } -+ } -+ else //PR_DISPLAY_NAME_A == aPropertyTag -+ { -+ addr=GetMapiProperty(lpProp,aPropertyTag); -+ if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR || -+ addr->Value.l == MAPI_E_NOT_FOUND) -+ { -+ if (kPriEmailColumn) -+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask; -+ } -+ } -+ } -+ else //aTest -+ { -+ if (kPriEmailColumn) -+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask; -+ } -+ -+ break; //we find it,exit -+ } -+ } -+ -+ return upRealTag; -+} -+ -+BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject, -+ ULONG aPropertyTag, -+ ULONG& aValue) -+{ -+ aValue = 0 ; -+ LPSPropValue values = NULL ; -+ ULONG valueCount = 0 ; -+ -+ if (PR_OBJECT_TYPE == aPropertyTag) -+ { -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ; -+ ULONG objType=0; -+ mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId, -+ NULL,MAPI_BEST_ACCESS,&objType, pFolder); -+ if (HR_FAILED(mLastError)) -+ { -+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS); -+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0) -+ { -+ FreeBuffer(msgClass); -+ aValue = MAPI_DISTLIST; -+ return TRUE; -+ } -+ } - -+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) -+ return FALSE ; - -+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) { -+ aValue = values->Value.ul ; -+ } -+ FreeBuffer(values) ; -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, -+ WORD& aYear, WORD& aMonth, WORD& aDay) -+{ -+ aYear = 0; -+ aMonth = 0; -+ aDay = 0; -+ LPSPropValue values = NULL ; -+ ULONG valueCount = 0 ; -+ -+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) -+ return FALSE ; -+ -+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) { -+ SYSTEMTIME readableTime ; -+ FILETIME localTime ; -+ FileTimeToLocalFileTime(&values->Value.ft,&localTime); -+ if (FileTimeToSystemTime(&localTime, &readableTime)) { -+ aYear = readableTime.wYear ; -+ aMonth = readableTime.wMonth ; -+ aDay = readableTime.wDay ; -+ } -+ } -+ FreeBuffer(values) ; -+ return TRUE ; -+} -+ -+HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID, -+ LPENTRYID lpEntryID, -+ LPCIID lpInterface, -+ ULONG ulFlags, -+ ULONG FAR * lpulObjType, -+ LPUNKNOWN FAR * lppUnk -+ ) -+{ -+ -+ int err; -+ HRESULT rv; -+ __try -+ { -+ rv=mRootSession->OpenEntry(cbEntryID, -+ lpEntryID, -+ lpInterface, -+ ulFlags , -+ lpulObjType, -+ lppUnk -+ ); -+ }__except(err) -+ { -+ return (-1); -+ } -+ -+ if (HR_FAILED(rv) && !m_MDBArray.Count()) -+ { -+ //There are no openned Message store,so we have to open them all -+ nsMapiEntryArray aFolders; -+ if (GetFolders(aFolders)) -+ { -+ __try -+ { -+ rv=mRootSession->OpenEntry(cbEntryID, -+ lpEntryID, -+ lpInterface, -+ ulFlags , -+ lpulObjType, -+ lppUnk -+ ); -+ }__except(err) -+ { -+ return (-1); -+ } -+ } -+ } -+ return rv; -+ -+} -+ -+BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> container ; -+ ULONG objType = 0 ; -+ -+ nsMapiEntry parentEntry; -+ if (!GetEntryParent(aDistlist,parentEntry)) -+ return FALSE; -+ -+ LPMDB lpMsgStore=GetMsgStore(parentEntry); -+ -+ if (!lpMsgStore) -+ return FALSE; -+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ lpMsgStore->Release(); -+ -+ if (HR_FAILED(mLastError)) -+ return FALSE ; -+ -+ -+ /* -+ When add mail address to distlist,Mapi need update 2 tag. -+ */ -+ //update OUTLOOK_EMAIL_LIST1 -+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY; -+ SBinaryArray oldChilds; -+ LPSBinary bins=NULL; -+ SBinaryArray newChilds; -+ LPSPropValue oldChildValue = NULL ; -+ ULONG valueCount = 0 ; -+ -+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount)) -+ { -+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ -+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND)) -+ { -+ oldChilds = oldChildValue->Value.MVbin; -+ newChilds.cValues=oldChilds.cValues + 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ for (ULONG i=0;i<oldChilds.cValues;i++) -+ { -+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb; -+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb; -+ } -+ } -+ else -+ { -+ newChilds.cValues = 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ } -+ -+ nsMapiEntry orgEntryID; -+ if (!GetPropertyBin(aNewEntry, -+ GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY, -+ orgEntryID)) -+ { -+ return FALSE; -+ } -+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId); -+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount; -+ -+ SPropValue childs; -+ childs.ulPropTag = listTag; -+ childs.Value.MVbin = newChilds; -+ -+ LPSPropProblemArray problems = NULL ; -+ mLastError = container->SetProps(1, &childs, &problems) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ //update OUTLOOK_EMAIL_LIST2 -+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY; -+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount)) -+ { -+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ -+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND)) -+ { -+ oldChilds = oldChildValue->Value.MVbin; -+ newChilds.cValues=oldChilds.cValues + 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ for (ULONG i=0;i<oldChilds.cValues;i++) -+ { -+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb; -+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb; -+ } -+ } -+ else -+ { -+ newChilds.cValues = 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ } -+ -+ /* -+ Need more work here. -+ There are two kind of mail address in outlook DistList. -+ One is sample,not include in parent folder. -+ The other is a link to a unattached address in parents folders. -+ Currently we can only add first kind of address to a outlook distlist. -+ */ -+ -+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId); -+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount; -+ -+ childs.ulPropTag = listTag; -+ childs.Value.MVbin = newChilds; -+ -+ mLastError = container->SetProps(1, &childs, &problems) ; -+ if (HR_FAILED(mLastError)) -+ { -+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ mMAPIFreeBuffer(bins); -+ -+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ return TRUE ; -+} -+BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> container ; -+ ULONG objType = 0 ; -+ -+ nsMapiEntry parentEntry; -+ if (!GetEntryParent(aDistlist,parentEntry)) -+ return FALSE; -+ -+ LPMDB lpMsgStore=GetMsgStore(parentEntry); -+ if (!lpMsgStore) -+ return FALSE; -+ -+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ lpMsgStore->Release(); -+ -+ if (HR_FAILED(mLastError)) -+ return FALSE ; -+ /* -+ When delete mail address from distlist,Mapi need update 2 tag. -+ */ -+ //update OUTLOOK_EMAIL_LIST1 -+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY; -+ -+ SBinaryArray oldChilds; -+ LPSBinary bins=NULL; -+ SBinaryArray newChilds; -+ LPSPropValue oldChildValue = NULL ; -+ ULONG valueCount = 0 ; -+ -+ newChilds.lpbin=NULL; -+ -+ ULONG lDeleteEntry=0; -+ ULONG newIndex=0; -+ ULONG oldIndex=0; -+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount)) -+ { -+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ -+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND)) -+ { -+ oldChilds = oldChildValue->Value.MVbin; -+ newChilds.cValues=oldChilds.cValues - 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++) -+ { -+ if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount && -+ !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4), -+ (void*)(aNewEntry.mEntryId->ab), -+ oldChilds.lpbin[oldIndex].cb-4)) -+ { -+ lDeleteEntry=oldIndex; -+ } -+ else -+ { -+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb; -+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb; -+ newIndex++; -+ } -+ } -+ } -+ else -+ return FALSE; -+ -+ -+ SPropValue childs; -+ LPSPropProblemArray problems = NULL ; -+ -+ if (newChilds.cValues == 0) -+ { -+ SPropTagArray delTags; -+ delTags.cValues = 1; -+ delTags.aulPropTag[0] = listTag; -+ -+ mLastError = container->DeleteProps(&delTags, &problems) ; -+ } -+ else -+ { -+ childs.ulPropTag = listTag; -+ childs.Value.MVbin = newChilds; -+ mLastError = container->SetProps(1, &childs, &problems) ; -+ } -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ //update OUTLOOK_EMAIL_LIST2 -+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY; -+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount)) -+ { -+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ; -+ return FALSE; -+ } -+ -+ newIndex=0; -+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND)) -+ { -+ oldChilds = oldChildValue->Value.MVbin; -+ newChilds.cValues=oldChilds.cValues - 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++) -+ { -+ if (oldIndex != lDeleteEntry) -+ { -+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb; -+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb; -+ newIndex++; -+ } -+ } -+ } -+ else -+ { -+ newChilds.cValues = 1; -+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins); -+ newChilds.lpbin = bins; -+ } - - -+ -+ if (newChilds.cValues == 0) -+ { -+ SPropTagArray delTags; -+ delTags.cValues = 1; -+ delTags.aulPropTag[0] = listTag; -+ -+ mLastError = container->DeleteProps(&delTags, &problems) ; -+ } -+ else -+ { -+ childs.ulPropTag = listTag; -+ childs.Value.MVbin = newChilds; -+ mLastError = container->SetProps(1, &childs, &problems) ; -+ } -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ mMAPIFreeBuffer(bins); -+ -+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object ; -+ ULONG objType = 0 ; -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ (IUnknown **)&object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID); -+ -+ if (parentID->Value.l == MAPI_E_NOT_FOUND) -+ return FALSE; -+ aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb)); -+ return TRUE; -+} -+BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> container ; -+ ULONG objType = 0 ; -+ -+ nsMapiEntry parentEntry; -+ if (!GetEntryParent(aDistlist,parentEntry)) -+ { -+ return FALSE; -+ } -+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ; -+ if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder -+ return FALSE; -+ -+ return AddEntryToList(aDistlist,aNewEntry); -+} -+ -+BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ; -+ ULONG objType = 0 ; -+ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object; -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return NULL ; -+ } -+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS); -+ -+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0) -+ return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList -+ -+ LPMDB lpMsgStore=GetMsgStore(aParent); -+ -+ if (!lpMsgStore) -+ return FALSE; -+ -+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ lpMsgStore->Release(); -+ -+ if (HR_FAILED(mLastError)) -+ return FALSE; -+ -+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ; -+ -+ mLastError = container->CreateMessage(&IID_IMessage, -+ 0, -+ newEntry) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ SPropValue messageclass ; -+ LPSPropProblemArray problems = NULL ; -+ nsCString tempName ; -+ -+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ; -+ tempName.Assign("IPM.Contact") ; -+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ; -+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ SPropTagArray property ; -+ LPSPropValue value = NULL ; -+ ULONG valueCount = 0 ; -+ -+ property.cValues = 1 ; -+ property.aulPropTag [0] = PR_ENTRYID ; -+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ; -+ if (HR_FAILED(mLastError) || valueCount != 1) { -+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ; -+ FreeBuffer(value) ; -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ; -+ ULONG objType = 0 ; -+ -+ LPMDB lpMsgStore=GetMsgStore(aParent); -+ if (!lpMsgStore) -+ return FALSE; -+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ lpMsgStore->Release(); -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open container %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ; -+ mLastError = container->CreateMessage(&IID_IMAPIProp, -+ 0, -+ newEntry) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ SPropValue messageclass ; -+ LPSPropProblemArray problems = NULL ; -+ nsCString tempName ; -+ -+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ; -+ tempName.Assign("IPM.DistList") ; -+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ; -+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ ULONG valueCount = 0 ; -+ SPropTagArray property ; -+ LPSPropValue value = NULL ; -+ -+ property.cValues = 1 ; -+ property.aulPropTag [0] = PR_ENTRYID ; -+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ; -+ if (HR_FAILED(mLastError) || valueCount != 1) { -+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ; -+ -+ FreeBuffer(value) ; -+ return TRUE ; -+} -+ -+ -+BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, -+ nsMapiEntry& aTarget) -+{ -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ; -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ; -+ ULONG objType = 0 ; -+ nsMapiInterfaceWrapper<LPMAPIPROP> object; -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS); -+ -+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0) -+ { -+ //Add Entry To DistList -+ if (!AddEntryToList(aContainer,aSource)) -+ return FALSE; -+ aTarget.Assign(aSource.mByteCount,aSource.mEntryId); -+ return TRUE; -+ } -+ -+ SBinary entry ; -+ SBinaryArray entryArray ; -+ -+ entry.cb = aSource.mByteCount ; -+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ; -+ entryArray.cValues = 1 ; -+ entryArray.lpbin = &entry ; -+ -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open container %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId, -+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, -+ targetFolder) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ; -+ -+ mLastError = container->CopyMessages(&entryArray, -+ &IID_IMessage, -+ (void*)&targetFolder, -+ 0, -+ NULL, -+ NULL) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ return TRUE ; -+} -+ -+BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ; -+ ULONG objType = 0 ; -+ SBinary entry ; -+ SBinaryArray entryArray ; -+ -+ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object; -+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, -+ object) ; -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS); -+ -+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0) -+ return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList -+ -+ LPMDB lpMsgStore=GetMsgStore(aContainer); -+ if (!lpMsgStore) -+ return FALSE; -+ -+ mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId, -+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, -+ container) ; -+ lpMsgStore->Release(); -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open container %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ entry.cb = aEntry.mByteCount ; -+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ; -+ entryArray.cValues = 1 ; -+ entryArray.lpbin = &entry ; -+ mLastError = container->DeleteMessages(&entryArray, 0,0,0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot delete entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ return TRUE ; -+} -+ -+//Use to open message store in write mode -+LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object; -+ ULONG objType=0; -+ -+ mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId, -+ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType, -+ object) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return NULL ; -+ } -+ SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);; -+ -+ LPMDB lpMsgStore=NULL; -+ mLastError=mRootSession->OpenMsgStore(0, -+ svMsgSore->Value.bin.cb, -+ (ENTRYID*)svMsgSore->Value.bin.lpb, -+ &IID_IMsgStore, -+ MAPI_BEST_ACCESS , -+ &lpMsgStore); -+ -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ; -+ return NULL ; -+ } -+ -+ return lpMsgStore; -+} ---- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200 -@@ -40,12 +40,42 @@ - - #include "nsAbWinHelper.h" - -+struct TagMap -+{ -+ ULONG AddressTag; -+ ULONG NameID; -+ ULONG TypeMask; -+}; - class nsMapiAddressBook : public nsAbWinHelper - { - public : - nsMapiAddressBook(void) ; - virtual ~nsMapiAddressBook(void) ; - -+ // Get the top address books -+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders); -+ -+ // Get a default address book container -+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer); -+ // Is the helper correctly initialised? -+ virtual BOOL IsOK(void); -+ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, -+ ULONG aPropertyTag, -+ ULONG& aValue); -+ // Get the value of a MAPI property of type SYSTIME -+ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, -+ WORD& aYear, WORD& aMonth, WORD& aDay); -+ // Create entry in the address book -+ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; -+ // Delete an entry in the address book -+ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ; -+ // Create a distribution list in the address book -+ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ; -+ // Copy an existing entry in the address book -+ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ; -+ -+ static void FreeMapiLibrary(void) ; -+ - protected : - // Class members to handle the library/entry points - static HMODULE mLibrary ; -@@ -67,19 +97,77 @@ - static BOOL mInitialized ; - static BOOL mLogonDone ; - static LPMAPISESSION mRootSession ; -- static LPADRBOOK mRootBook ; -+ - - // Load the MAPI environment - BOOL Initialize(void) ; -+ -+ virtual HRESULT OpenEntry(ULONG cbEntryID, -+ LPENTRYID lpEntryID, -+ LPCIID lpInterface, -+ ULONG ulFlags, -+ ULONG FAR * lpulObjType, -+ LPUNKNOWN FAR * lppUnk -+ ); -+ -+ -+ // Retrieve the contents of a container, with an optional restriction -+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -+ nsMapiEntryArray *aList, ULONG aMapiType) ; -+ // Retrieve the values of a set of properties on a MAPI object -+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -+ ULONG aNbProperties, -+ LPSPropValue& aValues, ULONG& aValueCount) ; -+ // Set the values of a set of properties on a MAPI object -+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -+ LPSPropValue& aValues); -+ -+ - // Allocation of a buffer for transmission to interfaces - virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ; - // Destruction of a buffer provided by the interfaces - virtual void FreeBuffer(LPVOID aBuffer) ; - // Library management - static BOOL LoadMapiLibrary(void) ; -- static void FreeMapiLibrary(void) ; -+ -+ BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders); -+ LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag); -+ BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE); -+ BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders); -+ BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0); -+ ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID); -+ ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE); -+ LPMDB GetMsgStore(const nsMapiEntry& aEntry); -+ BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry); -+ BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry); -+ BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry); -+ BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry); -+ BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction); -+ -+ //filter -+ BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList); -+ BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction); -+ BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue); -+ -+ void AddToMDBArray(LPMDB aMDB) -+ { -+ m_MDBArray.AppendElement(aMDB); -+ } -+ void CleanUpMDB() -+ { -+ LPMDB mdb; -+ for (int i = 0; i < m_MDBArray.Count(); i++) -+ { -+ mdb = (LPMDB)m_MDBArray.ElementAt(i); -+ mdb->Release(); -+ } -+ m_MDBArray.Clear(); -+ } - - private : -+ //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it -+ //so we have to kill message stores openned -+ nsVoidArray m_MDBArray; - } ; - - #endif // nsMapiAddressBook_h___ ---- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100 -+++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200 -@@ -46,6 +46,22 @@ - - #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args) - -+enum -+{ -+ ContentsColumnEntryId = 0, -+ ContentsColumnObjectType, -+ ContentsColumnsSize -+} ; -+ -+static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) = -+{ -+ ContentsColumnsSize, -+ { -+ PR_ENTRYID, -+ PR_OBJECT_TYPE -+ } -+} ; -+ - HMODULE nsWabAddressBook::mLibrary = NULL ; - PRInt32 nsWabAddressBook::mLibUsage = 0 ; - LPWABOPEN nsWabAddressBook::mWABOpen = NULL ; -@@ -94,7 +110,7 @@ - MOZ_DECL_CTOR_COUNTER(nsWabAddressBook) - - nsWabAddressBook::nsWabAddressBook(void) --: nsAbWinHelper() -+: nsAbWinHelper(),mAddressBook(NULL) - { - BOOL result = Initialize() ; - -@@ -109,9 +125,254 @@ - MOZ_COUNT_DTOR(nsWabAddressBook) ; - } - -+BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders) -+{ -+ aFolders.CleanUp() ; -+ nsMapiInterfaceWrapper<LPABCONT> rootFolder ; -+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ; -+ ULONG objType = 0 ; -+ ULONG rowCount = 0 ; -+ SRestriction restriction ; -+ SPropTagArray folderColumns ; -+ -+ mLastError = OpenEntry(0, NULL, NULL, 0, &objType, -+ rootFolder); -+ if (HR_FAILED(mLastError)){ -+ PRINTF(("Cannot open root %08x.\n", mLastError)); -+ return FALSE; -+ } -+ mLastError = rootFolder->GetHierarchyTable(0, folders); -+ if (HR_FAILED(mLastError)){ -+ PRINTF(("Cannot get hierarchy %08x.\n", mLastError)); -+ return FALSE; -+ } -+ // We only take into account modifiable containers, -+ // otherwise, we end up with all the directory services... -+ restriction.rt = RES_BITMASK ; -+ restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ; -+ restriction.res.resBitMask.relBMR = BMR_NEZ ; -+ restriction.res.resBitMask.ulMask = AB_MODIFIABLE ; -+ mLastError = folders->Restrict(&restriction, 0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot restrict table %08x.\n", mLastError)) ; -+ } -+ folderColumns.cValues = 1 ; -+ folderColumns.aulPropTag [0] = PR_ENTRYID ; -+ mLastError = folders->SetColumns(&folderColumns, 0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ mLastError = folders->GetRowCount(0, &rowCount) ; -+ if (HR_SUCCEEDED(mLastError)) { -+ do { -+ LPSRowSet rowSet = NULL ; -+ -+ rowCount = 0 ; -+ mLastError = folders->QueryRows(1, 0, &rowSet) ; -+ if (HR_SUCCEEDED(mLastError)) { -+ rowCount = rowSet->cRows ; -+ if (rowCount > 0) { -+ SPropValue& currentValue = rowSet->aRow->lpProps [0] ; -+ -+ aFolders.AddItem(currentValue.Value.bin.cb, -+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -+ } -+ MyFreeProws(rowSet) ; -+ } -+ else { -+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ; -+ } -+ } while (rowCount > 0) ; -+ } -+ return HR_SUCCEEDED(mLastError) ; -+} -+BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -+ nsMapiEntryArray *aList, ULONG aMapiType) -+{ -+ if (aList) { aList->CleanUp(); } -+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ; -+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ; -+ ULONG objType = 0 ; -+ ULONG rowCount = 0 ; -+ -+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId, -+ &IID_IMAPIContainer, 0, &objType, -+ parent) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ // Here, flags for WAB and MAPI could be different, so this works -+ // only as long as we don't want to use any flag in GetContentsTable -+ mLastError = parent->GetContentsTable(0, contents) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ if (aRestriction) { -+ mLastError = contents->Restrict(aRestriction, 0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ } -+ int entryId = ContentsColumnEntryId ; -+ int objectType = ContentsColumnObjectType ; -+ -+ if (aRestriction) -+ { -+ LPSPropTagArray allColumns = NULL ; -+ -+ mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot query columns %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ -+ for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) { -+ if (allColumns->aulPropTag [j] == PR_ENTRYID) { -+ entryId = j ; -+ } -+ else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) { -+ objectType = j ; -+ } -+ } -+ mLastError = contents->SetColumns(allColumns, 0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ FreeBuffer(allColumns) ; -+ } -+ else -+ { -+ -+ mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ } -+ -+ mLastError = contents->GetRowCount(0, &rowCount) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ do { -+ LPSRowSet rowSet = NULL ; -+ -+ rowCount = 0 ; -+ mLastError = contents->QueryRows(1, 0, &rowSet) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ rowCount = rowSet->cRows ; -+ if (rowCount > 0 && -+ (aMapiType == 0 || -+ rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) { -+ if (aList) { -+ SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ; -+ -+ aList->AddItem(currentValue.Value.bin.cb, -+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ; -+ -+ } -+ } -+ MyFreeProws(rowSet) ; -+ } while (rowCount > 0) ; -+ return TRUE ; -+} -+ -+BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -+ ULONG aNbProperties, LPSPropValue& aValue, -+ ULONG& aValueCount) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object ; -+ IMsgStore * mdb=NULL; -+ ULONG objType = 0 ; -+ LPSPropTagArray properties = NULL ; -+ ULONG i = 0 ; -+ -+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId, -+ &IID_IMAPIProp, 0, &objType, -+ object) ; -+ -+ if (HR_FAILED(mLastError)){ -+ PRINTF(("Cannot open entry %08x.\n", mLastError)); -+ return FALSE; -+ } -+ AllocateBuffer(CbNewSPropTagArray(aNbProperties), -+ NS_REINTERPRET_CAST(void **, &properties)); -+ properties->cValues = aNbProperties; -+ for (i = 0 ; i < aNbProperties ; ++ i) { -+ properties->aulPropTag [i] = aPropertyTags [i]; -+ } -+ mLastError = object->GetProps(properties, 0, &aValueCount, &aValue); -+ FreeBuffer(properties); -+ if (HR_FAILED(mLastError)){ -+ PRINTF(("Cannot get props %08x.\n", mLastError)); -+ } -+ return HR_SUCCEEDED(mLastError) ; -+} -+ -+BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -+ LPSPropValue& aValues) -+{ -+ nsMapiInterfaceWrapper<LPMAPIPROP> object ; -+ ULONG objType = 0 ; -+ LPSPropProblemArray problems = NULL ; -+ -+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId, -+ &IID_IMAPIProp, MAPI_MODIFY, &objType, -+ object) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ; -+ return FALSE ; -+ } -+ if (problems) { -+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) { -+ PRINTF(("Problem %d: index %d code %08x.\n", i, -+ problems->aProblem [i].ulIndex, -+ problems->aProblem [i].scode)); -+ } -+ } -+ mLastError = object->SaveChanges(0) ; -+ if (HR_FAILED(mLastError)) { -+ PRINTF(("Cannot commit changes %08x.\n", mLastError)) ; -+ } -+ return HR_SUCCEEDED(mLastError) ; -+} -+ -+BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer) -+{ -+ LPENTRYID entryId = NULL; -+ ULONG byteCount = 0; -+ -+ mLastError = mAddressBook->GetPAB(&byteCount, &entryId); -+ if (HR_FAILED(mLastError)){ -+ PRINTF(("Cannot get PAB %08x.\n", mLastError)); -+ return FALSE; -+ } -+ aContainer.Assign(byteCount, entryId); -+ FreeBuffer(entryId) ; -+ return TRUE ; -+} -+ -+BOOL nsWabAddressBook::IsOK(void) -+{ -+ return mAddressBook != NULL ; -+} -+ - BOOL nsWabAddressBook::Initialize(void) - { -- if (mAddressBook) { return TRUE ; } - nsAutoLock guard(mMutex) ; - - if (!LoadWabLibrary()) { ---- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200 -+++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200 -@@ -47,6 +47,15 @@ - nsWabAddressBook(void) ; - virtual ~nsWabAddressBook(void) ; - -+ // Get the top address books -+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders); -+ -+ // Get a default address book container -+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer); -+ // Is the helper correctly initialised? -+ virtual BOOL IsOK(void); -+ static void FreeWabLibrary(void) ; -+ - protected : - // Session and address book that will be shared by all instances - // (see nsMapiAddressBook.h for details) -@@ -57,15 +66,46 @@ - static HMODULE mLibrary ; - static LPWABOPEN mWABOpen ; - -+ LPADRBOOK mAddressBook ; -+ - // Load the WAB environment - BOOL Initialize(void) ; -+ -+ virtual HRESULT OpenEntry(ULONG cbEntryID, -+ LPENTRYID lpEntryID, -+ LPCIID lpInterface, -+ ULONG ulFlags, -+ ULONG FAR * lpulObjType, -+ LPUNKNOWN FAR * lppUnk -+ ) -+ { -+ return mAddressBook->OpenEntry(cbEntryID, -+ lpEntryID, -+ lpInterface, -+ ulFlags, -+ lpulObjType, -+ lppUnk -+ ); -+ } -+ -+ -+ // Retrieve the contents of a container, with an optional restriction -+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, -+ nsMapiEntryArray *aList, ULONG aMapiType) ; -+ // Retrieve the values of a set of properties on a MAPI object -+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, -+ ULONG aNbProperties, -+ LPSPropValue& aValues, ULONG& aValueCount) ; -+ // Set the values of a set of properties on a MAPI object -+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, -+ LPSPropValue& aValues) ; -+ - // Allocation of a buffer for transmission to interfaces - virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ; - // Destruction of a buffer provided by the interfaces - virtual void FreeBuffer(LPVOID aBuffer) ; - // Manage the library - static BOOL LoadWabLibrary(void) ; -- static void FreeWabLibrary(void) ; - - private : - } ; ---- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100 -+++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -91,7 +91,7 @@ - PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt - endif - --EXTRA_DSO_LDOPTS = \ -+EXTRA_DSO_LDOPTS += \ - $(LIBS_DIR) \ - $(MOZ_JS_LIBS) \ - $(MOZ_COMPONENT_LIBS) \ ---- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200 -+++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200 -@@ -277,7 +277,7 @@ - nsresult - nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value) - { -- PRUint32 param = (PRUint32(name) << 16) | PRUint32(value); -+ PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value); - return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param); - } - ---- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100 -+++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200 -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - # - # Stupid wrapper to avoid win32 dospath/cygdrive issues - # Try not to spawn programs from within this file. If the stuff in here looks royally ---- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100 -+++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200 -@@ -22,6 +22,7 @@ - RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@ - OBJDIR_NAME = @OBJDIR_NAME@ - OBJDIR = @OBJDIR@ -+LIB_PREFIX = @LIB_PREFIX@ - OBJ_SUFFIX = @OBJ_SUFFIX@ - LIB_SUFFIX = @LIB_SUFFIX@ - DLL_SUFFIX = @DLL_SUFFIX@ ---- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100 -+++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100 -@@ -111,9 +111,9 @@ - # other platforms do not. - # - ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET))) --LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) -+LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) - SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) --IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) -+IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) - SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb - else - LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) -@@ -340,6 +340,10 @@ - else # AIX 4.1 - ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) - $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES) -+ @if test -f $@.manifest; then \ -+ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ -+ rm -f $@.manifest; \ -+ fi - else - ifeq ($(MOZ_OS2_TOOLS),VACPP) - $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE) ---- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100 -+++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200 -@@ -2737,6 +2737,7 @@ - LIB_SUFFIX=a - DLL_SUFFIX=so - ASM_SUFFIX=s -+LIB_PREFIX=lib - MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@' - PR_MD_ASFILES= - PR_MD_CSRCS= -@@ -3475,7 +3476,7 @@ - EOF - - CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" -- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -+ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` - if test "$MOZ_OBJFORMAT" = "elf"; then - DLL_SUFFIX=so - else -@@ -3941,7 +3942,7 @@ - CC="$CC -mno-cygwin" - CXX="$CXX -mno-cygwin" - DLL_SUFFIX=dll -- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))' -+ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))' - RC=$WINDRES - # Use temp file for windres (bug 213281) - RCFLAGS='-O coff --use-temp-file' -@@ -3958,6 +3959,7 @@ - OBJ_SUFFIX=obj - LIB_SUFFIX=lib - DLL_SUFFIX=dll -+ LIB_PREFIX= - - # Determine compiler version - CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'` -@@ -5766,6 +5768,7 @@ - CC="\$(CYGWIN_WRAPPER) $CC" - CXX="\$(CYGWIN_WRAPPER) $CXX" - RC="\$(CYGWIN_WRAPPER) $RC" -+ LD="\$(CYGWIN_WRAPPER) $LD" - ;; - esac - -@@ -6127,6 +6130,7 @@ - s%@LIB_SUFFIX@%$LIB_SUFFIX%g - s%@DLL_SUFFIX@%$DLL_SUFFIX%g - s%@ASM_SUFFIX@%$ASM_SUFFIX%g -+s%@LIB_PREFIX@%$LIB_PREFIX%g - s%@MKSHLIB@%$MKSHLIB%g - s%@DSO_CFLAGS@%$DSO_CFLAGS%g - s%@DSO_LDOPTS@%$DSO_LDOPTS%g ---- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100 -+++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200 -@@ -1137,7 +1137,7 @@ - AC_DEFINE(HAVE_BSD_FLOCK) - AC_DEFINE(HAVE_SOCKLEN_T) - CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" -- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -+ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` - if test "$MOZ_OBJFORMAT" = "elf"; then - DLL_SUFFIX=so - else ---- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100 -+++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -79,18 +79,22 @@ - OS_LIBS = -lc - endif - -+ifeq ($(OS_ARCH),Linux) -+MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib -+endif -+ - ifeq ($(OS_ARCH),SunOS) - OS_LIBS = -lc - MAPFILE = $(OBJDIR)/pldsmap.sun - GARBAGE += $(MAPFILE) - ifdef NS_USE_GCC - ifdef GCC_USE_GNU_LD --MKSHLIB += -Wl,--version-script,$(MAPFILE) -+MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib - else --MKSHLIB += -Wl,-M,$(MAPFILE) -+MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN' - endif - else --MKSHLIB += -M $(MAPFILE) -+MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN' - endif - # The -R '$ORIGIN' linker option instructs this library to search for its - # dependencies in the same directory where it resides. ---- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100 -+++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -89,18 +89,22 @@ - OS_LIBS = -lc - endif - -+ifeq ($(OS_ARCH),Linux) -+MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib -+endif -+ - ifeq ($(OS_ARCH),SunOS) - OS_LIBS = -lc - MAPFILE = $(OBJDIR)/plcmap.sun - GARBAGE += $(MAPFILE) - ifdef NS_USE_GCC - ifdef GCC_USE_GNU_LD --MKSHLIB += -Wl,--version-script,$(MAPFILE) -+MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib - else --MKSHLIB += -Wl,-M,$(MAPFILE) -+MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN' - endif - else --MKSHLIB += -M $(MAPFILE) -+MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN' - endif - # The -R '$ORIGIN' linker option instructs this library to search for its - # dependencies in the same directory where it resides. ---- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100 -+++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200 -@@ -113,7 +113,8 @@ - #define _PR_HAVE_5_ARG_GETPROTO_R - #endif - --#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) -+#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \ -+ (defined(__FreeBSD__) && __FreeBSD_version > 601103) - #define _PR_HAVE_GETPROTO_R - #define _PR_HAVE_5_ARG_GETPROTO_R - #endif ---- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100 -+++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -65,7 +65,7 @@ - - ARCH = freebsd - --MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout) -+MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf) - - ifeq ($(MOZ_OBJFORMAT),elf) - DLL_SUFFIX = so ---- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100 -+++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200 -@@ -139,7 +139,7 @@ - - ifeq ($(OS_RELEASE),2.0) - OS_REL_CFLAGS += -DLINUX2_0 -- MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) -+ MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) - ifdef MAPFILE - MKSHLIB += -Wl,--version-script,$(MAPFILE) - endif -@@ -166,6 +166,7 @@ - - DSO_CFLAGS = -fPIC - DSO_LDOPTS = -shared $(ARCHFLAG) -+DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib - DSO_LDFLAGS = - LDFLAGS += $(ARCHFLAG) - ---- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200 -+++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -161,12 +161,14 @@ - - # ld options: - # -G: produce a shared object -+# -R '$ORIGIN': search for dependencies in same directory - # -z defs: no unresolved symbols allowed - ifdef NS_USE_GCC - ifeq ($(USE_64), 1) - DSO_LDOPTS += -m64 - endif - DSO_LDOPTS += -shared -h $(notdir $@) -+ DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib - else - ifeq ($(USE_64), 1) - ifeq ($(OS_TEST),i86pc) -@@ -176,6 +178,7 @@ - endif - endif - DSO_LDOPTS += -G -h $(notdir $@) -+ DSO_LDOPTS += -R '$$ORIGIN' - endif - DSO_LDOPTS += -z combreloc -z defs -z ignore - ---- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200 -+++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200 -@@ -43,24 +43,24 @@ - DEFAULT_COMPILER = cl - - ifdef NS_USE_GCC -- CC = gcc -- CCC = g++ -- LINK = ld -- AR = ar -+ CC = $(CYGWIN_WRAPPER) gcc -+ CCC = $(CYGWIN_WRAPPER) g++ -+ LINK = $(CYGWIN_WRAPPER) ld -+ AR = $(CYGWIN_WRAPPER) ar - AR += cr $@ -- RANLIB = ranlib -+ RANLIB = $(CYGWIN_WRAPPER) ranlib - BSDECHO = echo -- RC = windres.exe -O coff --use-temp-file -- LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) -+ RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file -+ LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) - else -- CC = cl -- CCC = cl -- LINK = link -- AR = lib -+ CC = $(CYGWIN_WRAPPER) cl -+ CCC = $(CYGWIN_WRAPPER) cl -+ LINK = $(CYGWIN_WRAPPER) link -+ AR = $(CYGWIN_WRAPPER) lib - AR += -NOLOGO -OUT:"$@" - RANLIB = echo - BSDECHO = echo -- RC = rc.exe -+ RC = $(CYGWIN_WRAPPER) rc.exe - MT = mt.exe - endif - -@@ -69,7 +69,7 @@ - else - NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall - endif --NSINSTALL = nsinstall -+NSINSTALL = $(CYGWIN_WRAPPER) nsinstall - - MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend - MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe -@@ -95,7 +95,7 @@ - # dllimport cannot be used as as a constant address. - OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport - _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY) -- DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) -+ DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) - ifdef BUILD_OPT - OPTIMIZER += -O2 - DEFINES += -UDEBUG -U_DEBUG -DNDEBUG ---- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200 -+++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -72,3 +72,7 @@ - endif - endif - DEFINES += -DWIN95 -+ -+ifdef NS_USE_GCC -+NSPR31_LIB_PREFIX = lib -+endif ---- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200 -+++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200 -@@ -45,7 +45,7 @@ - CCF = $(CC) $(CFLAGS) - LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS) - LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS) --CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ -+CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ - $(XCFLAGS) - PERL = perl - RANLIB = echo ---- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200 -+++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200 -@@ -284,7 +284,7 @@ - $(PROGRAM): $(OBJS) $(EXTRA_LIBS) - @$(MAKE_OBJDIR) - ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) -- $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)) -+ $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) - ifdef MT - if test -f $@.manifest; then \ - $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ -@@ -305,11 +305,7 @@ - $(LIBRARY): $(OBJS) - @$(MAKE_OBJDIR) - rm -f $@ --ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) -- $(AR) $(subst /,\\,$(OBJS)) --else - $(AR) $(OBJS) --endif - $(RANLIB) $@ - - -@@ -344,7 +340,7 @@ - ifdef NS_USE_GCC - $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES) - else -- $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)) -+ $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES) - ifdef MT - if test -f $@.manifest; then \ - $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ -@@ -429,15 +425,15 @@ - endif - endif - --core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1))) -+mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1))) - - $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c - @$(MAKE_OBJDIR) - ifdef USE_NT_C_SYNTAX -- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<) - else - ifdef NEED_ABSOLUTE_PATH -- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<) - else - $(CC) -o $@ -c $(CFLAGS) $< - endif -@@ -445,10 +441,10 @@ - - $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c - ifdef USE_NT_C_SYNTAX -- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<) - else - ifdef NEED_ABSOLUTE_PATH -- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<) - else - $(CC) -o $@ -c $(CFLAGS) $< - endif -@@ -477,10 +473,10 @@ - $(OBJDIR)/$(PROG_PREFIX)%: %.cpp - @$(MAKE_OBJDIR) - ifdef USE_NT_C_SYNTAX -- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<) - else - ifdef NEED_ABSOLUTE_PATH -- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<) - else - $(CCC) -o $@ -c $(CFLAGS) $< - endif -@@ -501,10 +497,10 @@ - rm -f $(OBJDIR)/t_$*.cc - else - ifdef USE_NT_C_SYNTAX -- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<) - else - ifdef NEED_ABSOLUTE_PATH -- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) -+ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<) - else - $(CCC) -o $@ -c $(CFLAGS) $< - endif ---- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200 -+++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -123,8 +123,11 @@ - ifdef CYGDRIVE_MOUNT - ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g') - endif -+ifneq (,$(filter cygwin%,$(host_os))) -+ABS_DIST := $(shell cygpath -u $(ABS_DIST)) -+endif - ifneq (,$(filter mingw%,$(host_os))) --ABS_DIST := $(shell cd $(DIST) && pwd -W) -+ABS_DIST := $(shell cygpath -u $(ABS_DIST)) - endif - endif - NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS))) -@@ -172,6 +175,7 @@ - endif - ifeq ($(OS_ARCH),WINNT) - DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95 -+DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@ - ifdef MOZ_DEBUG - ifndef MOZ_NO_DEBUG_RTL - DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1 ---- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100 -+++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100 -@@ -86,17 +86,42 @@ - - include ../platrules.mk - --SRCDIR = $(call core_abspath,.) -- -+ifeq ($(OS_TARGET), Darwin) -+ SRCDIR = . -+else -+ifeq ($(OS_TARGET), Linux) -+ SRCDIR = . -+else -+ SRCDIR = . -+endif -+endif - %.chk: %.$(DLL_SUFFIX) - ifeq ($(OS_TARGET), OS2) - cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \ - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<) - else -- cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \ -- $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ -- $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<) -+ifeq ($(OS_TARGET), WIN95) -+ cd $(SRCDIR) ; sh $(CYGWIN_WRAPPER) ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+else -+ifeq ($(OS_TARGET), Darwin) -+ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+else -+ifeq ($(OS_TARGET), Linux) -+ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+else -+ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \ -+ $(OBJDIR) $(OS_TARGET) \ -+ $(NSPR_LIB_DIR) $< -+endif -+endif -+endif - endif - - libs install :: $(CHECKLOC) ---- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100 -+++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200 -@@ -63,9 +63,4 @@ - DSO_LDOPTS = -bundle - endif - --ifeq ($(OS_TARGET),SunOS) --# The -R '$ORIGIN' linker option instructs this library to search for its --# dependencies in the same directory where it resides. --MKSHLIB += -R '$$ORIGIN' --endif - ---- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200 -+++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200 -@@ -199,10 +199,6 @@ - endif - - ifeq ($(OS_TARGET),SunOS) -- --# The -R '$ORIGIN' linker option instructs this library to search for its --# dependencies in the same directory where it resides. --MKSHLIB += -R '$$ORIGIN' - ifdef NS_USE_GCC - ifdef GCC_USE_GNU_LD - MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text -@@ -210,7 +206,7 @@ - MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text - endif # GCC_USE_GNU_LD - else -- MKSHLIB += -B symbolic -z now -z text -+ MKSHLIB += -z now -z text - endif # NS_USE_GCC - - # Sun's WorkShop defines v8, v8plus and v9 architectures. ---- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100 -+++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200 -@@ -113,12 +113,10 @@ - # The -R '$ORIGIN' linker option instructs this library to search for its - # dependencies in the same directory where it resides. - ifeq ($(USE_64), 1) --MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64' -+DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64' - else --MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps' -+DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps' - endif --else --MKSHLIB += -R '$$ORIGIN' - endif - endif - -@@ -127,9 +125,9 @@ - # pa-risc - ifeq ($(USE_64), 1) - MKSHLIB += +b '$$ORIGIN' --endif --endif --endif -+endif # USE_64 -+endif # OS_TEST -+endif # OS_ARCH - - ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) - ifndef NS_USE_GCC ---- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200 -+++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200 -@@ -61,6 +61,7 @@ - CERT_CheckCertValidTimes; - CERT_CreateCertificateRequest; - CERT_ChangeCertTrust; -+CERT_DecodeDERCertificate; - CERT_DecodeDERCrl; - CERT_DestroyCertificateRequest; - CERT_DestroyCertList; ---- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100 -+++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200 -@@ -92,8 +92,3 @@ - ../pkcs7 \ - $(NULL) - --ifeq ($(OS_TARGET),SunOS) --# The -R '$ORIGIN' linker option instructs this library to search for its --# dependencies in the same directory where it resides. --MKSHLIB += -R '$$ORIGIN' --endif ---- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100 -+++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200 -@@ -87,13 +87,6 @@ - $(NULL) - endif - --ifeq ($(OS_TARGET),SunOS) --# The -R '$ORIGIN' linker option instructs this library to search for its --# dependencies in the same directory where it resides. --MKSHLIB += -R '$$ORIGIN' --OS_LIBS += -lbsm --endif -- - ifeq ($(OS_TARGET),WINCE) - DEFINES += -DDBM_USING_NSPR - endif ---- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200 -+++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200 -@@ -116,13 +116,6 @@ - EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib - endif - --ifeq ($(OS_TARGET),SunOS) --# The -R '$ORIGIN' linker option instructs this library to search for its --# dependencies in the same directory where it resides. --MKSHLIB += -R '$$ORIGIN' --#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs --endif -- - endif - - # indicates dependency on freebl static lib ---- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200 -+++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200 -@@ -181,7 +181,7 @@ - GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS) - - XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS)) --XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*) -+XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*) - - EXTRA_DEPS = \ - $(XP_DIST_DEP_LIBS) \ ---- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200 -+++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200 -@@ -132,7 +132,7 @@ - } - - PRBool IsArray() const -- {return (PRBool) TagPart() == T_ARRAY;} -+ {return (PRBool) (TagPart() == T_ARRAY);} - - // 'Dependent' means that params of this type are dependent upon other - // params. e.g. an T_INTERFACE_IS is dependent upon some other param at -@@ -152,7 +152,7 @@ - uint8 TagPart() const - {return (uint8) (flags & XPT_TDP_TAGMASK);} - -- enum -+ enum _xpttype - { - T_I8 = TD_INT8 , - T_I16 = TD_INT16 , ---- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200 -+++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200 -@@ -115,11 +115,14 @@ - - include $(topsrcdir)/config/config.mk - -+# reduce prerequisites by disabling mozilla binary -+ifndef DISABLE_MOZ_EXECUTABLE - ifeq ($(USE_SHORT_LIBNAME),1) - PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX) - else - PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX) - endif -+endif - - # Force applications to be built non-statically - # when building the mozcomps meta component -@@ -491,6 +494,7 @@ - APP_NAME = $(MOZ_APP_DISPLAYNAME) - endif - -+ifdef PROGRAM - libs:: $(PROGRAM) - mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS - rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app -@@ -505,6 +509,7 @@ - rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins - cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc - echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo -+endif - - clean clobber:: - rm -rf $(DIST)/$(APP_NAME).app diff --git a/moz/zipped/makefile.mk b/moz/zipped/makefile.mk deleted file mode 100644 index 3c557768ee4c..000000000000 --- a/moz/zipped/makefile.mk +++ /dev/null @@ -1,212 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=.. - -PRJNAME=moz -TARGET=moz_unzip - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(PREBUILD_MOZAB)" == "" || "$(SYSTEM_MOZILLA)" == "YES" || "$(WITH_MOZILLA)" == "NO" - -dummy: - @echo "No need to unpack the prebuilt mozab packages" - -.ELSE # unpack mozab zips -.INCLUDE : target.mk - -.IF "$(BUILD_MOZAB)"=="TRUE" -ALLTAR: - @echo "Does not need build mozab zipped!" -.ELSE -ALLTAR: \ - $(MISC)$/unpacked_$(TARGET)_inc \ - $(MISC)$/unpacked_$(TARGET)_lib \ - $(BIN)$/mozruntime.zip \ - $(MISC)$/replace_old_nss_libs -.ENDIF -.IF "$(GUI)" == "UNX" - -$(MISC)$/unpacked_%_lib : $(OS)$(COM)$(CPU)lib.zip '$(OS)$(COM)$(CPU)runtime.zip' - unzip -o -d $(LB) $(OS)$(COM)$(CPU)lib.zip && unzip -o -d $(LB) $(OS)$(COM)$(CPU)runtime.zip && $(TOUCH) $@ - chmod -R 775 $(LB) - -$(MISC)$/unpacked_%_inc : $(OS)$(COM)$(CPU)inc.zip - unzip -o -d $(INCCOM) $(OS)$(COM)$(CPU)inc.zip && $(TOUCH) $@ - chmod -R 775 $(INCCOM) - -.ELSE - -$(MISC)$/unpacked_$(TARGET)_lib : $(OS)$(COM)$(CPU)lib.zip - unzip -o -d $(LB) $(OS)$(COM)$(CPU)lib.zip && \ - $(TOUCH) $@ - -$(MISC)$/unpacked_$(TARGET)_inc : $(OS)$(COM)$(CPU)inc.zip - unzip -o -d $(INCCOM) $(OS)$(COM)$(CPU)inc.zip && $(TOUCH) $@ - -.ENDIF - -$(BIN)$/mozruntime%zip : $(OS)$(COM)$(CPU)runtime.zip - $(COPY) $(OS)$(COM)$(CPU)runtime.zip $(BIN)$/mozruntime.zip && \ - chmod u+w $(BIN)$/mozruntime.zip - -# add alternative rules for universal binary moz-zips -.IF "$(GUIBASE)" == "aqua" -$(MISC)$/unpacked_%_lib : $(OS)$(COM)UBlib.zip '$(OS)$(COM)UBruntime.zip' - unzip -o -d $(LB) $(OS)$(COM)UBlib.zip && unzip -o -d $(LB) $(OS)$(COM)UBruntime.zip && $(TOUCH) $@ - chmod -R 775 $(LB) - -$(MISC)$/unpacked_%_inc : $(OS)$(COM)UBinc.zip - unzip -o -d $(INCCOM) $(OS)$(COM)UBinc.zip && $(TOUCH) $@ - chmod -R 775 $(INCCOM) - -$(BIN)$/mozruntime%zip : $(OS)$(COM)UBruntime.zip - $(COPY) $(OS)$(COM)UBruntime.zip $(BIN)$/mozruntime.zip - -.ENDIF # "$(GUIBASE)"=="aqua" - -LIBLIST = -BIN_RUNTIMELIST = -NSS_INCLUDE_LIST = -NSS_MODULE_RUNTIME_LIST = -.IF "$(ENABLE_NSS_MODULE)"=="YES" -# The prebuilt moz files include all the old NSS stuff from moz and not the new -# NSS libs, headers, etc, from the separate nss module. If we use the nss module -# then we must take care not to deliver the old NSS stuff from the "prebuilts" -.IF "$(GUI)" == "WNT" - FREEBL_LIB_OLD=freebl3 -.ELSE # "$(GUI)" == "WNT" - .IF "$(OS)$(CPUNAME)" == "SOLARISSPARC" - FREEBL_LIB_OLD=freebl_32fpu_3 - .ELSE # "$(OS)$(CPUNAME)" == "SOLARISSPARC" - FREEBL_LIB_OLD=freebl3 - .ENDIF # "$(OS)$(CPUNAME)" == "SOLARISSPARC" -.ENDIF # "$(GUI)" == "WNT" - -BIN_RUNTIMELIST= \ - $(FREEBL_LIB_OLD) \ - nspr4 \ - plc4 \ - plds4 \ - nss3 \ - ssl3 \ - softokn3 \ - smime3 - -.IF "$(GUI)"=="WNT" -.IF "$(COM)"=="GCC" -LIBLIST= \ - libnspr4.a \ - libnss3.a \ - libsmime3.a \ - libplc4.a \ - libplds4.a \ - libssl3.a - -.ELSE -LIBLIST= \ - nspr4.lib \ - plc4.lib \ - plds4.lib \ - nss3.lib \ - ssl3.lib\ - smime3.lib -.ENDIF -.ELSE #"$(GUI)"=="WNT" -LIBLIST= \ - lib$(FREEBL_LIB_OLD)$(DLLPOST) \ - libnspr4$(DLLPOST) \ - libsoftokn3$(DLLPOST) \ - libplc4$(DLLPOST) \ - libplds4$(DLLPOST) \ - libnss3$(DLLPOST) \ - libssl3$(DLLPOST) \ - libsmime3$(DLLPOST) - -.ENDIF # .IF "$(GUI)"=="WNT" - - -# On MacOS no include dirs nspr and nss exists in the prebuilt zip, no need to remove them -.IF "$(OS)" != "MACOSX" -NSS_INCLUDE_LIST= nspr nss -.ENDIF - -.IF "$(OS)" == "SOLARIS" -.IF "$(CPU)" == "S" #32bit -FREEBL=freebl_32fpu_3 freebl_32int64_3 freebl_32int_3 -.ELIF "$(CPU)" == "U" #64bit unxsolu4 -FREEBL=freebl_64int_3 freebl_64fpu_3 -.ELSE -FREEBL=freebl3 -.ENDIF #"$(CPU)" == "S" - -.ELSE # "$(OS)" == "SOLARIS" -FREEBL=freebl3 -.ENDIF # "$(OS)" == "SOLARIS" - - -#On Linux/Unix sqlite is delivered to $(SOLARLIBDIR)/sqlite/libsqlite3.so -#See readme.txt in module nss -NSS_MODULE_RUNTIME_LIST:= \ - $(FREEBL) \ - nspr4 \ - nss3 \ - nssckbi \ - nssdbm3 \ - nssutil3 \ - plc4 \ - plds4 \ - smime3 \ - softokn3 \ - sqlite/sqlite3 \ - ssl3 - - -.ENDIF #.IF "$(ENABLE_NSS_MODULE)"=="YES" -# Remove the nss libs build in moz and those build in the nss module -$(MISC)$/replace_old_nss_libs : $(MISC)$/unpacked_$(TARGET)_lib \ -$(MISC)$/unpacked_$(TARGET)_inc $(BIN)$/mozruntime.zip - +$(foreach,dir,$(NSS_INCLUDE_LIST) $(RENAME:s/+//) $(INCCOM)$/$(dir) \ - $(INCCOM)$/$(dir)_remove_me &&) echo >& $(NULLDEV) - $(foreach,dir,$(NSS_INCLUDE_LIST) rm -r -f $(INCCOM)$/$(dir)_remove_me &&) \ - echo >& $(NULLDEV) - $(foreach,lib,$(LIBLIST) rm -f $(LB)$/$(lib) &&) \ - echo >& $(NULLDEV) - $(foreach,lib,$(BIN_RUNTIMELIST) zip -d $(BIN)$/mozruntime.zip $(DLLPRE)$(lib:f)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.IF "$(GUI)"=="WNT" - +$(foreach,lib,$(NSS_MODULE_RUNTIME_LIST) zip -g -j $(BIN)$/mozruntime.zip $(SOLARBINDIR)$/$(DLLPRE)$(lib:f)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.ELSE - +$(foreach,lib,$(NSS_MODULE_RUNTIME_LIST) zip -g -j $(BIN)$/mozruntime.zip $(SOLARLIBDIR)$/$(lib:d)$(DLLPRE)$(lib:f)$(DLLPOST) &&) \ - echo >& $(NULLDEV) -.ENDIF - $(TOUCH) $@ - -.ENDIF # unpack mozab zips - diff --git a/nss/makefile.mk b/nss/makefile.mk index fd2116cbd3a3..824008234393 100644 --- a/nss/makefile.mk +++ b/nss/makefile.mk @@ -32,10 +32,10 @@ TARGET=nss # --- Files -------------------------------------------------------- -.IF "$(ENABLE_NSS_MODULE)"!="YES" +.IF "$(ENABLE_NSS_MODULE)"!="YES" || "$(SYSTEM_NSS)"=="YES" all: - @echo "NSS will not be built. ENABLE_NSS_MODULE is '$(ENABLE_NSS_MODULE)'" + @echo "NSS will not be built because ENABLE_NSS_MODULE='$(ENABLE_NSS_MODULE)' and SYSTEM_NSS='$(SYSTEM_NSS)'" .ELSE diff --git a/nss/prj/d.lst b/nss/prj/d.lst index f1090ca8d91e..5313bb5e414c 100644 --- a/nss/prj/d.lst +++ b/nss/prj/d.lst @@ -1,7 +1,6 @@ mkdir: %_DEST%\inc%_EXT%\mozilla\nspr mkdir: %_DEST%\inc%_EXT%\mozilla\nspr\obsolete mkdir: %_DEST%\inc%_EXT%\mozilla\nss -mkdir: %_DEST%\lib%_EXT%\sqlite ..\%__SRC%\inc\include\* %_DEST%\inc%_EXT%\mozilla\nspr ..\%__SRC%\inc\include\obsolete\protypes.h %_DEST%\inc%_EXT%\mozilla\nspr\obsolete\protypes.h @@ -24,7 +23,8 @@ mkdir: %_DEST%\lib%_EXT%\sqlite ..\%__SRC%\lib\libsoftokn3.* %_DEST%\lib%_EXT%\libsoftokn3.* ..\%__SRC%\lib\libssl3.* %_DEST%\lib%_EXT%\libssl3.* -..\%__SRC%\lib\libsqlite3.* %_DEST%\lib%_EXT%\sqlite\libsqlite3.* +..\%__SRC%\lib\libsqlite3.so %_DEST%\lib%_EXT%\libsqlite3.so + ..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT% ..\%__SRC%\bin\* %_DEST%\bin%_EXT% diff --git a/odk/examples/CLI/CSharp/Spreadsheet/Makefile b/odk/examples/CLI/CSharp/Spreadsheet/Makefile index 9a597e22a3e2..bb03ccda1096 100644 --- a/odk/examples/CLI/CSharp/Spreadsheet/Makefile +++ b/odk/examples/CLI/CSharp/Spreadsheet/Makefile @@ -52,7 +52,7 @@ include $(SETTINGS)/stdtarget.mk # build executables -#csc -lib:"d:\StarOffice 8" does not work. csc does not understand the quotes. +#csc -lib:"d:\OpenOffice 4" does not work. csc does not understand the quotes. #but they are needed if the path contains a space. Therefore we use full path #with the -reference switch $(SPREADSHEET_OUT)/%.exe : %.cs SpreadsheetDocHelper.cs @@ -75,7 +75,7 @@ ViewSample : $(SPREADSHEET_OUT)/ViewSample.exe .PHONY : Info ifeq "$(OS)" "WIN" -Info : SpreadsheetSample GenerateTableSample ViewSample +Info : SpreadsheetSample GeneralTableSample ViewSample @echo ------------------------------------------------------------------------------- @echo Please use one of the following commands to execute the examples! @echo - diff --git a/odk/source/com/sun/star/lib/loader/InstallationFinder.java b/odk/source/com/sun/star/lib/loader/InstallationFinder.java index c3c161df96bf..3ccc2f0aa7f8 100644 --- a/odk/source/com/sun/star/lib/loader/InstallationFinder.java +++ b/odk/source/com/sun/star/lib/loader/InstallationFinder.java @@ -200,7 +200,7 @@ final class InstallationFinder { } catch ( WinRegKeyException e ) { try { // read the key's default value from HKEY_LOCAL_MACHINE - WinRegKey key = new WinRegKey( "HKEY_LOCAL_USER", + WinRegKey key = new WinRegKey( "HKEY_CURRENT_USER", SUBKEYNAME64 ); path = key.getStringValue( "" ); // default } catch ( WinRegKeyException e64 ) { diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c index 4e5240fa4016..44b7970fa392 100644 --- a/odk/source/unoapploader/unx/unoapploader.c +++ b/odk/source/unoapploader/unx/unoapploader.c @@ -206,8 +206,6 @@ int main( int argc, char *argv[] ) strcat( envstr, value ); } putenv( envstr ); - fprintf( stderr, "DYLD_LIBRARY_PATH=%s\n", envstr ); - } else { @@ -242,8 +240,7 @@ char const* getPath() if ( path == NULL ) { - fprintf( stderr, "Warning: getting path from PATH environment " - "variable failed!\n" ); + fprintf( stderr, "Warning: getting path from PATH environment variable failed!\n" ); fflush( stderr ); } diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c index 2f6605cb0144..abcd0e7e3136 100644 --- a/odk/source/unoapploader/win/unoapploader.c +++ b/odk/source/unoapploader/win/unoapploader.c @@ -72,7 +72,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, const char* PATHSEPARATOR = ";"; char const* path = NULL; - char path2[MAX_PATH]; char* value = NULL; char* envstr = NULL; char* cmdline = NULL; @@ -90,130 +89,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, if ( path != NULL ) { - wchar_t cmd[ - MY_LENGTH(L"\"") + MAX_PATH + - MY_LENGTH(L"\\unoinfo.exe\" c++")]; - /* hopefully does not overflow */ - int pathsize; - SECURITY_ATTRIBUTES sec; - HANDLE temp; - HANDLE stdoutRead; - HANDLE stdoutWrite; - STARTUPINFOW startinfo; - PROCESS_INFORMATION procinfo; - int ret; - cmd[0] = L'"'; - pathsize = MultiByteToWideChar(CP_ACP, 0, path, -1, cmd + 1, MAX_PATH); - if (pathsize == 0) { - writeError("Error: MultiByteToWideChar failed!\n"); - closeErrorFile(); - return 1; - } - if (wcschr(cmd + 1, L'"') != NULL) { - writeError("Error: bad characters in UNO installation path!\n"); - closeErrorFile(); - return 1; - } - wcscpy( - cmd + pathsize, - (L"\\unoinfo.exe\" c++" + - (pathsize == 1 || cmd[pathsize - 1] != L'\\' ? 0 : 1))); - sec.nLength = sizeof (SECURITY_ATTRIBUTES); - sec.lpSecurityDescriptor = NULL; - sec.bInheritHandle = TRUE; - if (CreatePipe(&temp, &stdoutWrite, &sec, 0) == 0 || - DuplicateHandle( - GetCurrentProcess(), temp, GetCurrentProcess(), &stdoutRead, 0, - FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS) == 0) - { - writeError("Error: CreatePipe/DuplicateHandle failed!\n"); - closeErrorFile(); - return 1; - } - memset(&startinfo, 0, sizeof (STARTUPINFOW)); - startinfo.cb = sizeof (STARTUPINFOW); - startinfo.lpDesktop = L""; - startinfo.dwFlags = STARTF_USESTDHANDLES; - startinfo.hStdOutput = stdoutWrite; - ret = CreateProcessW( - NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &startinfo, &procinfo); - if (ret != 0) { - char * buf = NULL; - size_t n = 1000; - size_t k = 0; - DWORD exitcode; - int path2size; - CloseHandle(stdoutWrite); - CloseHandle(procinfo.hThread); - for (;;) { - DWORD m; - buf = realloc(buf, n); - if (buf == NULL) { - writeError( - "Error: out of memory reading unoinfo output!\n"); - closeErrorFile(); - return 1; - } - if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL)) - { - DWORD err = GetLastError(); - if (err == ERROR_HANDLE_EOF || err == ERROR_BROKEN_PIPE) { - break; - } - writeError("Error: cannot read unoinfo output!\n"); - closeErrorFile(); - return 1; - } - if (m == 0) { - break; - } - k += m; - if (k >= n) { - if (n >= SAL_MAX_SIZE / 2) { - writeError( - "Error: out of memory reading unoinfo output!\n"); - closeErrorFile(); - return 1; - } - n *= 2; - } - } - if ((k & 1) == 1) { - writeError("Error: bad unoinfo output!\n"); - closeErrorFile(); - return 1; - } - CloseHandle(stdoutRead); - if (!GetExitCodeProcess(procinfo.hProcess, &exitcode) || - exitcode != 0) - { - writeError("Error: executing unoinfo failed!\n"); - closeErrorFile(); - return 1; - } - if (k == 0) { - path2size = 0; - } else { - path2size = WideCharToMultiByte( - CP_ACP, 0, (wchar_t *) buf, k / 2, path2, MAX_PATH - 1, - NULL, NULL); - if (path2size == 0) { - writeError("Error: converting unoinfo output failed!\n"); - closeErrorFile(); - return 1; - } - } - path2[path2size] = '\0'; - path = path2; - } else { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - writeError("Error: calling unoinfo failed!\n"); - closeErrorFile(); - return 1; - } - CloseHandle(stdoutRead); - CloseHandle(stdoutWrite); - } + /* The former code to call unoinfo first is removed because we can use the office path + from the registry or from the UNO_PATH variable directly. + Further cleanup can remove unoinfo from the installation when all places where it is + used are checked. + */ /* get the value of the PATH environment variable */ value = getenv( ENVVARNAME ); diff --git a/odk/util/makefile.pmk b/odk/util/makefile.pmk index 33174f5b29fd..eb1d4c0b319b 100644 --- a/odk/util/makefile.pmk +++ b/odk/util/makefile.pmk @@ -22,7 +22,7 @@ # used for sdk common files -PRODUCT_RELEASE=4.0 +PRODUCT_RELEASE=4.1 OFFICENAME=OpenOffice .IF "$(GUI)"=="WNT" SDKDIRNAME=OpenOffice_$(PRODUCT_RELEASE)_SDK diff --git a/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl index e19778abbe2e..83c576755c46 100644 --- a/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl @@ -120,9 +120,9 @@ published interface XMutableGridDataModel : XGridDataModel /** updates the content of a given row. <p>The change in the data model will be notified to registered listeners via - <member">XGridDataListener::dataChanged</member>. The <member>GridDataEvent::FirstColumn</member> and + <member>XGridDataListener::dataChanged</member>. The <member>GridDataEvent::FirstColumn</member> and <member>GridDataEvent::LastColumn</member> will denote the smallest respectively largest column - index from <argColumnIndexes</arg>.</p> + index from <arg>ColumnIndexes</arg>.</p> @param ColumnIndexes contains the column indexes of the cells, which should be updated diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 0bdf600ee98f..8e16ecc3388e 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -1067,6 +1067,13 @@ <it>com.sun.star.PresentationMinimizer-*</it> <!-- presentation screen is integrated since AOO 4.0 --> <it>com.sun.PresenterScreen-*</it> + <!-- Old French dictionaries are incompatible with the new unified French dictionary since AOO 4.0.1 --> + <it>french.modern-dictionary.from.Dicollecte.by.OlivierR</it> + <it>french.classic-dictionary.from.Dicollecte.by.OlivierR</it> + <it>french.reform1990-dictionary.from.Dicollecte.by.OlivierR</it> + <it>french.classic-and-reform1990-dictionary.from.Dicollecte.by.OlivierR</it> + <it>org.openoffice.comp.pyuno.lightproof.oxt.grammalecte</it> + <it>org.openoffice.comp.pyuno.lightproof.oxt.dicollecte_fr_FR</it> </value> </prop> </node> diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 9e941151977c..226734c7d250 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -1830,7 +1830,7 @@ <node oor:name="calibri" oor:op="replace"> <prop oor:name="SubstFonts"> - <value>hiraginomarugothicpronw3;hiraginomarugothicprow3</value> + <value>carlito;hiraginomarugothicpronw3;hiraginomarugothicprow3</value> </prop> <prop oor:name="FontType"><value>Normal,SansSerif</value></prop> </node> @@ -1840,7 +1840,7 @@ <node oor:name="cambria" oor:op="replace"> <prop oor:name="SubstFonts"> - <value>applelisung</value> + <value>caladea;applelisung</value> </prop> <prop oor:name="FontType"><value>Normal,Serif</value></prop> </node> diff --git a/officecfg/registry/schema/org/openoffice/Office/PresenterScreen.xcs b/officecfg/registry/schema/org/openoffice/Office/PresenterScreen.xcs index 9eef7c543ba6..3450fa4f4e01 100644 --- a/officecfg/registry/schema/org/openoffice/Office/PresenterScreen.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/PresenterScreen.xcs @@ -34,8 +34,8 @@ <prop oor:name="Name" oor:type="xs:string"> <info><desc>Name of the bitmap. Used to look-up the bitmap in a container.</desc></info> </prop> - <prop oor:name="Text" oor:type="xs:string"> - <info><desc>Text that is displayed together with the icon.</desc></info> + <prop oor:name="Text" oor:type="xs:string" oor:localized="true"> + <info><desc>Localized text that is displayed together with the icon.</desc></info> </prop> <prop oor:name="NormalFileName" oor:type="xs:string"> <info><desc>Relative file name to the bitmap for the normal icon.</desc></info> @@ -166,8 +166,8 @@ <node-ref oor:name="Icon" oor:node-type="BitmapDescriptor"> <info><desc>The icon to display.</desc></info> </node-ref> - <prop oor:name="Text" oor:type="xs:string"> - <info><desc>The text to display.</desc></info> + <prop oor:name="Text" oor:type="xs:string" oor:localized="true"> + <info><desc>The localized text to display.</desc></info> </prop> <prop oor:name="Action" oor:type="xs:string"> <info><desc>Action to execute when a button is triggered.</desc></info> @@ -211,8 +211,8 @@ <node-ref oor:name="Icon" oor:node-type="BitmapDescriptor"> <info><desc>The icon to display.</desc></info> </node-ref> - <prop oor:name="Text" oor:type="xs:string"> - <info><desc>The text to display.</desc></info> + <prop oor:name="Text" oor:type="xs:string" oor:localized="true"> + <info><desc>The localized text to display.</desc></info> </prop> <prop oor:name="Action" oor:type="xs:string"> <info><desc>Action to execute when a button is triggered.</desc></info> @@ -220,11 +220,11 @@ </group> <group oor:name="HelpEntry"> <info><desc>Describes a Help entry.</desc></info> - <prop oor:name="Left" oor:type="xs:string"> - <info><desc>Typically a list of keyboard key names.</desc></info> + <prop oor:name="Left" oor:type="xs:string" oor:localized="true"> + <info><desc>Typically a list of localized keyboard key names.</desc></info> </prop> - <prop oor:name="Right" oor:type="xs:string"> - <info><desc>Typically a description of the action triggered by pressing the keys on the left.</desc></info> + <prop oor:name="Right" oor:type="xs:string" oor:localized="true"> + <info><desc>Typically a localized description of the action triggered by pressing the keys on the left.</desc></info> </prop> </group> <group oor:name="PaneStyle"> @@ -289,7 +289,7 @@ </group> <group oor:name="PresenterString"> <info><desc>A Presenter string</desc></info> - <prop oor:name="String" oor:type="xs:string"> + <prop oor:name="String" oor:type="xs:string" oor:localized="true"> <info><desc>The localized string.</desc></info> </prop> </group> @@ -302,12 +302,12 @@ <prop oor:name="StyleName" oor:type="xs:string"> <info><desc>Name of a view style.</desc></info> </prop> - <prop oor:name="Title" oor:type="xs:string"> + <prop oor:name="Title" oor:type="xs:string" oor:localized="true"> <info><desc>Title displayed for the component. An empty or missing title means that no title is displayed.</desc></info> <value></value> </prop> - <prop oor:name="AccessibleTitle" oor:type="xs:string"> + <prop oor:name="AccessibleTitle" oor:type="xs:string" oor:localized="true"> <info><desc>Title displayed for the component when accessibility support is active. An empty or missing title means that no title is displayed.</desc></info> <value></value> diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 0ace8a4d7f36..8f7408c11338 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #include "oox/core/xmlfilterbase.hxx" #include <cstdio> @@ -120,6 +118,7 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxCo maFastParser.registerNamespace( NMSP_ax ); maFastParser.registerNamespace( NMSP_xm ); + maFastParser.registerNamespace( NMSP_markupCompat ); // i123528 } // ============================================================================ diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index 6300298303a5..bd45e8f35d9e 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -70,3 +70,4 @@ dc http://purl.org/dc/elements/1.1/ dcTerms http://purl.org/dc/terms/ xm http://schemas.microsoft.com/office/excel/2006/main sprm http://sprm +markupCompat http://schemas.openxmlformats.org/markup-compatibility/2006 diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt index 13c1a10ff9b4..643e661158d9 100644 --- a/oox/source/token/tokens.txt +++ b/oox/source/token/tokens.txt @@ -37,6 +37,7 @@ AbbreviatedCaseNumber Accel Accel2 AlbumTitle +AlternateContent Always Anchor AppVersion @@ -79,6 +80,7 @@ Characters CharactersWithSpaces Checkbox Checked +Choice City ClientData ColHidden @@ -2107,6 +2109,7 @@ factor fade fadeDir fallback +Fallback false family fans diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk index dab775bb99da..a6be1cc7e241 100644 --- a/postprocess/packcomponents/makefile.mk +++ b/postprocess/packcomponents/makefile.mk @@ -301,7 +301,7 @@ my_components += ScriptProviderForJavaScript my_components += ldapbe2 .END -.IF "$(WITH_MOZILLA)" != "NO" +.IF "$(ENABLE_NSS_MODULE)" != "NO" my_components += \ xmlsecurity \ xsec_fw \ @@ -359,14 +359,6 @@ my_components += directx5canvas my_components += adabas .END -.IF "$(OS)" != "MACOSX" && "$(SYSTEM_MOZILLA)" != "YES" && \ - "$(WITH_MOZILLA)" != "NO" -my_components += mozab -.ELIF "$(OS)" == "OS2" -.ELSE -my_components += mozbootstrap -.END - .IF "$(OS)" != "MACOSX" && "$(OS)" != "WNT" && "$(OS)" != "OS2" my_components += desktopbe1 .END diff --git a/postprocess/packregistry/makefile.mk b/postprocess/packregistry/makefile.mk index 52e165b1546b..cd99a00f917d 100644 --- a/postprocess/packregistry/makefile.mk +++ b/postprocess/packregistry/makefile.mk @@ -357,14 +357,7 @@ MY_FILES_main += \ .IF "$(ENABLE_KAB)" == "TRUE" MY_FILES_main += $(MY_MOD)/DataAccess/kab.xcu .END -.IF "$(SYSTEM_MOZILLA)" != "YES" && "$(WITH_MOZILLA)" != "NO" && \ - "$(OS)" != "MACOSX" -.IF "$(OS)" == "WNT" -MY_FILES_main += $(MY_MOD)/DataAccess/mozab.xcu -.ELSE -MY_FILES_main += $(MY_MOD)/DataAccess/mozab2.xcu -.END -.END + .IF "$(SYSTEM_LIBTEXTCAT_DATA)" != "" MY_FILES_main += $(MY_MOD)/org/openoffice/Office/Paths-externallibtextcatdata.xcu .ELSE diff --git a/postprocess/rebase/coffbase.txt b/postprocess/rebase/coffbase.txt index 55292b1e1b1b..ce0fdfc99dc1 100644 --- a/postprocess/rebase/coffbase.txt +++ b/postprocess/rebase/coffbase.txt @@ -159,8 +159,6 @@ localedata_euro.dll 0x0000000061b60000 0x000a0000 localedata_others.dll 0x0000000061aa0000 0x000b0000 logmi.dll 0x0000000061a70000 0x00020000 mcnttype.dll 0x0000000061950000 0x00010000 -mozabmi.dll 0x00000000597a0000 0x00020000 -mozabdrvmi.dll 0x00000000597d0000 0x00070000 msci_uno.dll 0x0000000061860000 0x00010000 mysql2.dll 0x0000000061820000 0x00030000 namingservice.uno.dll 0x0000000061800000 0x00010000 diff --git a/postprocess/rebase/no_rebase.txt b/postprocess/rebase/no_rebase.txt index a1462c9e9b6f..0d00b694183e 100644 --- a/postprocess/rebase/no_rebase.txt +++ b/postprocess/rebase/no_rebase.txt @@ -10,24 +10,10 @@ policy.1.0.cli_cppuhelper.dll policy.1.0.cli_basetypes.dll gdiplus.dll mingwm10.dll -msvcm80d.dll -msvcm80.dll msvcm90d.dll msvcm90.dll -msvcp70d.dll -msvcp70.dll -msvcp71d.dll -msvcp71.dll -msvcp80d.dll -msvcp80.dll msvcp90d.dll msvcp90.dll -msvcr70d.dll -msvcr70.dll -msvcr71d.dll -msvcr71.dll -msvcr80d.dll -msvcr80.dll msvcr90d.dll msvcr90.dll msvcr100.dll diff --git a/python/python-2.7.5-pcbuild.patch b/python/python-2.7.5-pcbuild.patch index 82b16ddfe4f4..c6c8cf1d9755 100644 --- a/python/python-2.7.5-pcbuild.patch +++ b/python/python-2.7.5-pcbuild.patch @@ -1062,7 +1062,7 @@ diff -u misc/Python-2.7.5/PCbuild/make_versioninfo.vcproj misc/build/Python-2.7. diff -u misc/Python-2.7.5/PCbuild/pcbuild.sln misc/build/Python-2.7.5/PCbuild/pcbuild.sln --- misc/Python-2.7.5/PCbuild/pcbuild.sln 2012-04-09 18:07:35.000000000 -0500 +++ misc/build/Python-2.7.5/PCbuild/pcbuild.sln 2012-07-30 21:04:33.000000000 -0500 -@@ -38,17 +38,17 @@ +@@ -38,12 +38,12 @@ {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
EndProjectSection
EndProject
@@ -1072,23 +1072,13 @@ diff -u misc/Python-2.7.5/PCbuild/pcbuild.sln misc/build/Python-2.7.5/PCbuild/pc - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- EndProjectSection
-EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}"
-- ProjectSection(ProjectDependencies) = postProject
-- {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
-- EndProjectSection
--EndProject
+#Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}"
+# ProjectSection(ProjectDependencies) = postProject
+# {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
+# {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
+# EndProjectSection
+#EndProject
-+#Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}"
-+# ProjectSection(ProjectDependencies) = postProject
-+# {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
-+# EndProjectSection
-+#EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{9EC7190A-249F-4180-A900-548FDCF3055F}"
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}"
ProjectSection(ProjectDependencies) = postProject
{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
@@ -69,12 +69,12 @@ diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index 04e4ec71e7bb..2fb708eb3092 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -93,51 +93,46 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { exit(EXIT_FAILURE); } } + wchar_t bootstrap[MY_LENGTH(L"vnd.sun.star.pathname:") + MAX_PATH] = L"vnd.sun.star.pathname:"; //TODO: overflow wchar_t * bootstrapEnd = tools::buildPath( bootstrap + MY_LENGTH(L"vnd.sun.star.pathname:"), path, pathEnd, MY_STRING(L"fundamental.ini")); - if (bootstrapEnd == NULL || - (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) - == NULL)) + if (bootstrapEnd == NULL) { exit(EXIT_FAILURE); } - pathEnd = tools::resolveLink(path); - wchar_t path1[MAX_PATH]; - wchar_t * path1End = tools::buildPath( - path1, path, pathEnd, MY_STRING(L"\\program")); - if (path1End == NULL) { - exit(EXIT_FAILURE); - } + wchar_t pythonpath2[MAX_PATH]; wchar_t * pythonpath2End = tools::buildPath( pythonpath2, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib")); if (pythonpath2End == NULL) { exit(EXIT_FAILURE); } + wchar_t pythonpath3[MAX_PATH]; wchar_t * pythonpath3End = tools::buildPath( pythonpath3, path, pathEnd, MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\lib\\site-packages")); + L"python-core-" MY_PYVERSION L"\\lib\\site-packages")); if (pythonpath3End == NULL) { exit(EXIT_FAILURE); } + #ifdef __MINGW32__ wchar_t pythonpath4[MAX_PATH]; wchar_t * pythonpath4End = tools::buildPath( pythonpath4, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); if (pythonpath4End == NULL) { exit(EXIT_FAILURE); } wchar_t pythonpath5[MAX_PATH]; wchar_t * pythonpath5End = tools::buildPath( pythonpath5, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); if (pythonpath5End == NULL) { exit(EXIT_FAILURE); } @@ -145,7 +140,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t pythonhome[MAX_PATH]; wchar_t * pythonhomeEnd = tools::buildPath( pythonhome, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION)); + MY_STRING(L"python-core-" MY_PYVERSION)); if (pythonhomeEnd == NULL) { exit(EXIT_FAILURE); } @@ -154,26 +149,15 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { pythonexe, path, pathEnd, #ifdef __MINGW32__ MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.bin")); + L"python-core-" MY_PYVERSION L"\\bin\\python.bin")); #else MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.exe")); + L"python-core-" MY_PYVERSION L"\\bin\\python.exe")); #endif if (pythonexeEnd == NULL) { exit(EXIT_FAILURE); } - if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) - { - exit(EXIT_FAILURE); - } - pathEnd = tools::resolveLink(path); - if (pathEnd == NULL) { - exit(EXIT_FAILURE); - } - pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin")); - if (pathEnd == NULL) { - exit(EXIT_FAILURE); - } + std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) + MY_LENGTH(L"\"\0"); //TODO: overflow // 4 * len: each char preceded by backslash, each trailing backslash @@ -221,9 +205,11 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { } } wchar_t * value = new wchar_t[ - (pathEnd - path) + MY_LENGTH(L";") + (path1End - path1) + - (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow - wsprintfW(value, L"%s;%s%s%s", path, path1, n == 0 ? L"" : L";", orig); + (pathEnd - path) + MY_LENGTH(L";") + + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow + + wsprintfW(value, L"%s%s%s", path, n == 0 ? L"" : L";", orig); + if (!SetEnvironmentVariableW(L"PATH", value)) { exit(EXIT_FAILURE); } @@ -258,11 +244,11 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { n == 0 ? L"" : L";", orig); #else value = new wchar_t[ - (path1End - path1) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + + (pythonpath2End - pythonpath2) + MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow wsprintfW( - value, L"%s;%s;%s%s%s", path1, pythonpath2, pythonpath3, + value, L"%s;%s%s%s", pythonpath2, pythonpath3, n == 0 ? L"" : L";", orig); #endif if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) { diff --git a/qadevOOo/objdsc/mozab/com.sun.star.comp.sdbc.MozabDriver.csv b/qadevOOo/objdsc/mozab/com.sun.star.comp.sdbc.MozabDriver.csv deleted file mode 100644 index acb7cac7a8be..000000000000 --- a/qadevOOo/objdsc/mozab/com.sun.star.comp.sdbc.MozabDriver.csv +++ /dev/null @@ -1,5 +0,0 @@ -"MozabDriver";"com::sun::star::sdbc::XDriver";"connect()" -"MozabDriver";"com::sun::star::sdbc::XDriver";"acceptsURL()" -"MozabDriver";"com::sun::star::sdbc::XDriver";"getPropertyInfo()" -"MozabDriver";"com::sun::star::sdbc::XDriver";"getMajorVersion()" -"MozabDriver";"com::sun::star::sdbc::XDriver";"getMinorVersion()" diff --git a/qadevOOo/runner/basicrunner/BasicTestCase.java b/qadevOOo/runner/basicrunner/BasicTestCase.java index c018cb247308..7a38ce2142ca 100644 --- a/qadevOOo/runner/basicrunner/BasicTestCase.java +++ b/qadevOOo/runner/basicrunner/BasicTestCase.java @@ -112,8 +112,6 @@ public class BasicTestCase extends TestCase { tParam.get("adabas.password") + "\""); oBasicHandler.perform("setValue", "adoUrl = \"sdbc:ado:" + tParam.get("ado.url") + "\""); - oBasicHandler.perform("setValue", "mozabUrl = \"sdbc:address:" + - tParam.get("mozab.url") + "\""); } catch (BasicException e) { log.println(e.info); throw new RuntimeException(e.info); diff --git a/qadevOOo/tests/java/mod/_mozab/MozabDriver.java b/qadevOOo/tests/java/mod/_mozab/MozabDriver.java deleted file mode 100644 index 7b95c63a7c1b..000000000000 --- a/qadevOOo/tests/java/mod/_mozab/MozabDriver.java +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package mod._mozab; - -import java.io.PrintWriter; - -import lib.Status; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; - -/** -* Here <code>com.sun.star.sdbc.Driver</code> service is tested.<p> -* Test allows to run object tests in several threads concurently. -* @see com.sun.star.sdbc.Driver -* @see com.sun.star.sdbc.XDriver -* @see com.sun.star.sdbcx.XCreateCatalog -* @see com.sun.star.sdbcx.XDropCatalog -* @see ifc.sdbc._XDriver -* @see ifc.sdbcx._XCreateCatalog -* @see ifc.sdbcx._XDropCatalog -*/ -public class MozabDriver extends TestCase { - /** - * Creates an instance of the service - * <code>com.sun.star.sdbc.Driver</code>. <p> - * Object relations created : - * <ul> - * <li> <code>'XDriver.URL'</code> for {@link ifc.sdbc._XDriver}: - * is the URL of the database to which to connect. - * The URL is obtained from the parameter <code>mozab.url</code></li> - * <li> <code>'XDriver.UNSUITABLE_URL'</code> for {@link ifc.sdbc._XDriver}: - * the wrong kind of URL to connect using given driver. - * The URL is obtained from the parameter <code>jdbc.url</code></li> - * <li> <code>'XDriver.INFO'</code> for {@link ifc.sdbc._XDriver}: - * a list of arbitrary string tag/value pairs as connection arguments. - * </li> - * </ul> - */ - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - - XInterface oObj = null; - - try { - oObj = (XInterface)((XMultiServiceFactory)Param.getMSF()). - createInstance("com.sun.star.comp.sdbc.MozabDriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(Status.failed("Couldn't create object")); - } - - log.println("creating a new environment for object"); - TestEnvironment tEnv = new TestEnvironment(oObj); - - //adding relation for sdbc.XDriver - String mozabURL = (String) Param.get("mozab.url"); - if (mozabURL == null) { - throw new StatusException(Status.failed( - "Couldn't get 'mozabURL' from ini-file")); - } - tEnv.addObjRelation("XDriver.URL", "sdbc:address:" + mozabURL); - - PropertyValue[] info = new PropertyValue[0]; - tEnv.addObjRelation("XDriver.INFO", info); - - String jdbcUrl = (String) Param.get("jdbc.url"); - if (jdbcUrl == null) { - throw new StatusException(Status.failed( - "Couldn't get 'jdbc.url' from ini-file")); - } - tEnv.addObjRelation("XDriver.UNSUITABLE_URL", "jdbc:" + jdbcUrl); - - return tEnv; - } -} diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm index 2757068fc64d..d2f34e8857bb 100644 --- a/readlicense_oo/docs/readme/readme.xrm +++ b/readlicense_oo/docs/readme/readme.xrm @@ -301,8 +301,8 @@ </div> <div id="ModifiedSourceCode"> - <h2 id="sdffd23r3cefwefew" xml:lang="en-US">Used / Modified Source Code</h2> - <p id="sdffd23red32efew">For detailed information about used and/or modified source code, see the NOTICE file which is part of the installation.</p> + <h2 id="ModifiedSourceCodeHeading" xml:lang="en-US">Used / Modified Source Code</h2> + <p id="ModifiedSourceCodePara" xml:lang="en-US">For detailed information about used and/or modified source code, see the NOTICE file which is part of the installation.</p> </div> </body> </html> diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index c695a04046f7..51ceea5fd2a6 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -33,6 +33,24 @@ extern "C" { void SAL_CALL sal_detail_initialize(int argc, char ** argv); void SAL_CALL sal_detail_deinitialize(); +#ifdef SAL_OS2 +#include <string.h> + +#define INCL_DOSPROCESS +#define INCL_DOSEXCEPTIONS +#define INCL_DOSMODULEMGR +#include <os2.h> +#define INCL_LOADEXCEPTQ +#include <exceptq.h> + +#define sal_detail_initialize(a,b) \ + EXCEPTIONREGISTRATIONRECORD exRegRec = {0}; \ + LoadExceptq(&exRegRec, NULL, NULL); \ + osl_setCommandArgs(argc, argv); +#define sal_detail_deinitialize() \ + UninstallExceptq(&exRegRec); +#endif // SAL_OS2 + #define SAL_MAIN_WITH_ARGS_IMPL \ int SAL_CALL main(int argc, char ** argv) \ { \ diff --git a/sal/osl/os2/salinit.cxx b/sal/osl/os2/salinit.cxx index 0412f9336922..ebafddba0171 100644 --- a/sal/osl/os2/salinit.cxx +++ b/sal/osl/os2/salinit.cxx @@ -19,99 +19,29 @@ * *************************************************************/ +#include <stdio.h> - -#define INCL_DOS -#include <os2.h> - -#include "precompiled_sal.hxx" -#include "sal/config.h" - -#include "osl/process.h" -#include "sal/main.h" #include "sal/types.h" -// for exception logging -#include <stdio.h> -#include <string.h> -#include <setjmp.h> - +#ifdef __cplusplus extern "C" { +#endif /*----------------------------------------------------------------------------*/ -static CHAR szOOoExe[CCHMAXPATH]; - -static FILE* APIENTRY _oslExceptOpenLogFile(VOID) -{ - FILE *file; - DATETIME DT; - PPIB pib; - PSZ slash; - - // get executable fullpath - DosGetInfoBlocks(NULL, &pib); - DosQueryModuleName(pib->pib_hmte, sizeof(szOOoExe), szOOoExe); - // truncate to exe name - slash = (PSZ)strrchr( szOOoExe, '.'); - *slash = '\0'; - // make log path - strcat( szOOoExe, ".log"); - - file = fopen( szOOoExe, "a"); - if (!file) { // e.g. readonly drive - // try again, usually C exist and is writable - file = fopen( "c:\\OOo.log", "a"); - } - if (file) { - DosGetDateTime(&DT); - fprintf(file, "\nTrap message -- Date: %04d-%02d-%02d, Time: %02d:%02d:%02d\n", - DT.year, DT.month, DT.day, - DT.hours, DT.minutes, DT.seconds); - fprintf(file, "-------------------------------------------------------\n" - "\nAn internal error occurred (Built " __DATE__ "-" __TIME__ ").\n"); - - } - - // ok, return handle - return (file); -} - -/*----------------------------------------------------------------------------*/ - -#if 0 // until exceptions restored OSL_DEBUG_LEVEL == 0 -static EXCEPTSTRUCT g_excptstruct = {0}; -#endif - +// replaced by macros in sal/main.h void SAL_CALL sal_detail_initialize(int argc, char ** argv) { - APIRET rc = -1; - -#if 0 // until exceptions restored OSL_DEBUG_LEVEL == 0 - excRegisterHooks(_oslExceptOpenLogFile, NULL, NULL, FALSE); - - g_excptstruct.RegRec2.pfnHandler = (PFN)excHandlerLoud; - g_excptstruct.arc = DosSetExceptionHandler( - (PEXCEPTIONREGISTRATIONRECORD)&(g_excptstruct.RegRec2)); - - if (g_excptstruct.arc) - if (G_pfnExcHookError) - G_pfnExcHookError(__FILE__, __LINE__, __FUNCTION__, g_excptstruct.arc); - else - DosBeep(1000, 1000); - g_excptstruct.ulExcpt = setjmp(g_excptstruct.RegRec2.jmpThread); -#endif - - osl_setCommandArgs(argc, argv); + printf("Dead code\n"); + exit(1); } void SAL_CALL sal_detail_deinitialize() { - APIRET rc = -1; - -#if 0 // until exceptions restored OSL_DEBUG_LEVEL == 0 - rc = DosUnsetExceptionHandler((PEXCEPTIONREGISTRATIONRECORD)&(g_excptstruct.RegRec2)); -#endif + printf("Dead code\n"); + exit(1); } -} +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c index 717458b76fe9..818f9dbb515b 100644 --- a/sal/osl/os2/thread.c +++ b/sal/osl/os2/thread.c @@ -30,6 +30,13 @@ #include <rtl/alloc.h> #include <rtl/tencinfo.h> +#define INCL_DOSPROCESS +#define INCL_DOSEXCEPTIONS +#define INCL_DOSMODULEMGR +#include <os2.h> +#define INCL_LOADEXCEPTQ +#include <exceptq.h> + /* Thread-data structure hidden behind oslThread: */ @@ -93,6 +100,8 @@ static void oslWorkerWrapperFunction(void* pData) { BOOL rc; osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)pData; + EXCEPTIONREGISTRATIONRECORD exRegRec = {0}; + LoadExceptq(&exRegRec, NULL, NULL); #if OSL_DEBUG_LEVEL>0 printf("oslWorkerWrapperFunction pThreadImpl %x, pThreadImpl->m_ThreadId %d\n", pThreadImpl, pThreadImpl->m_ThreadId); @@ -122,6 +131,9 @@ printf("pThreadImpl->m_ThreadId %d, about to terminate hab\n", pThreadImpl->m_Th rc = WinTerminate( pThreadImpl->m_hab ); #if OSL_DEBUG_LEVEL>0 printf("pThreadImpl->m_ThreadId %d, WinTerminate rc=%d (should be 1)\n", pThreadImpl->m_ThreadId, rc); + + UninstallExceptq(&exRegRec); + #endif } diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx index 3c436d9f3e98..ca244359a4b5 100644 --- a/sc/inc/dbcolect.hxx +++ b/sc/inc/dbcolect.hxx @@ -136,8 +136,10 @@ public: void GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const; SC_DLLPUBLIC void GetArea(ScRange& rRange) const; void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - //If the name of DBData is started with "unnamed", it will be recognized as build in DBData - sal_Bool IsBuildin(); + + bool IsInternalUnnamed() const; + bool IsInternalForAutoFilter() const; + void MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); sal_Bool IsByRow() const { return bByRow; } void SetByRow(sal_Bool bByR) { bByRow = bByR; } @@ -216,9 +218,13 @@ public: virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const; - ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + ScDBData* GetDBAtArea( + const SCTAB nTab, + const SCCOL nCol1, + const SCROW nRow1, + const SCCOL nCol2, + const SCROW nRow2 ) const; ScDBData* GetFilterDBAtTable(SCTAB nTab) const; - ScDBData* GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const; sal_Bool SearchName( const String& rName, sal_uInt16& rIndex ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index bcd8ee09dd70..d67bb09e3027 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -508,10 +508,7 @@ public: sal_Bool bStartOnly = sal_False) const; ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; ScDBData* GetFilterDBAtTable(SCTAB nTab) const; -//UNUSED2008-05 ScRangeData* GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, -//UNUSED2008-05 sal_Bool bStartOnly = sal_False) const; SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const; - ScDBData* GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const; SC_DLLPUBLIC ScDPCollection* GetDPCollection(); ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; @@ -1517,7 +1514,10 @@ public: TypedScStrCollection& rStrings, sal_Bool bLimit = sal_False ); sal_Bool GetFormulaEntries( TypedScStrCollection& rStrings ); - sal_Bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab ); + sal_Bool HasAutoFilter( + const SCCOL nCol, + const SCROW nRow, + const SCTAB nTab ); SC_DLLPUBLIC sal_Bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index d2206aa46bb2..2c5d8343b879 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -404,13 +404,10 @@ enum ScAnchorType // Verankerung eines Zeichenobjekts enum ScGetDBMode { - SC_DB_MAKE, // wenn noetig, "unbenannt" anlegen - SC_DB_IMPORT, // wenn noetig, "Importx" anlegen - SC_DB_OLD, // nicht neu anlegen - SC_DB_MAKE_FILTER, // to create a new filter/sort/subtotal - SC_DB_MAKE_SORT, - SC_DB_MAKE_SUBTOTAL, - SC_DB_OLD_FILTER //to find a existed filter + SC_DB_MAKE, // if needed create database range with name $STR_DB_NONAME + SC_DB_IMPORT, // if needed create database range with name $STR_DBNAME_IMPORT[X] + SC_DB_OLD, // do not create new database range, provide only existing one + SC_DB_MAKE_AUTOFILTER // if needed create database range with name $SC_DBNAME_UNNAMED[X] }; /// For ScDBFunc::GetDBData() diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index a86e153a04f5..237889d156c9 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef SC_SCPATATR_HXX #define SC_SCPATATR_HXX @@ -38,7 +36,6 @@ class ScStyleSheet; class SvNumberFormatter; class ScDocument; - // how to treat COL_AUTO in GetFont: enum ScAutoFontColorMode @@ -125,6 +122,7 @@ public: sal_Bool IsVisible() const; sal_Bool IsVisibleEqual( const ScPatternAttr& rOther ) const; + sal_Bool IsEqual( const ScPatternAttr& rOther ) const; /** If font is an old symbol font StarBats/StarMath with text encoding RTL_TEXTENC_SYMBOL */ diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx index c2226ace61ce..08915b3b43cd 100644 --- a/sc/inc/rangeutl.hxx +++ b/sc/inc/rangeutl.hxx @@ -302,7 +302,6 @@ private: ScDBCollection* pDBCollection; sal_Bool bFirstPass; sal_uInt16 nPos; - String aStrNoName; public: ScAreaNameIterator( ScDocument* pDoc ); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 72fc50662ee9..78e15940dfd3 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1927,21 +1927,38 @@ sal_Bool ScAttrArray::GetLastAttr( SCROW& rLastRow, SCROW nLastData ) const rLastRow = MAXROW; return sal_True; } + sal_Bool bFound = sal_False; - SCSIZE nEndPos = nCount - 1; - SCSIZE nStartPos = nEndPos; - while ( nStartPos > 0 && pData[nStartPos-1].nRow > nLastData && - !pData[nStartPos].pPattern->IsVisible() ) - --nStartPos; - if(nStartPos == 0 && !pData[nStartPos].pPattern->IsVisible()) // add this condition for handle only default pattern in one colume - rLastRow = nLastData; - else if(nStartPos >= 0 && pData[nStartPos].nRow > nLastData) + + // Loop backwards from the end instead of using Search, assuming that + // there usually aren't many attributes below the last cell. + SCSIZE nPos = nCount; + while ( nPos > 0 && pData[nPos - 1].nRow > nLastData ) { - bFound = sal_True; - rLastRow = pData[nStartPos].nRow; + SCSIZE nEndPos = nPos - 1; + SCSIZE nStartPos = nEndPos; + while ( nStartPos > 0 && pData[nStartPos - 1].nRow > nLastData && + pData[nStartPos - 1].pPattern->IsEqual( *pData[nStartPos].pPattern ) ) + --nStartPos; + + SCROW nAttrStartRow = ( nStartPos > 0 ) ? ( pData[nStartPos - 1].nRow + 1 ) : 0; + if ( nAttrStartRow <= nLastData ) + nAttrStartRow = nLastData + 1; + SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow; + if ( nAttrSize >= SC_VISATTR_STOP ) + { + bFound = sal_False; + } + else if ( !bFound ) + { + rLastRow = pData[nEndPos].nRow; + bFound = sal_True; + } + + // look further from the top of the range. + nPos = nStartPos; } - else - rLastRow = nLastData; + return bFound; } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index c6885f831050..ac5fb19bca9c 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -192,13 +192,6 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nC else return NULL; } -ScDBData* ScDocument::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const -{ - if (pDBCollection) - return pDBCollection->GetDBAtTable(nTab, eMode); - else - return NULL; -} ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const { @@ -1299,10 +1292,12 @@ sal_Bool ScDocument::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR return sal_False; } -sal_Bool ScDocument::HasAutoFilter( SCCOL /*nCurCol*/, SCROW /*nCurRow*/, SCTAB nCurTab ) +sal_Bool ScDocument::HasAutoFilter( + const SCCOL nCurCol, + const SCROW nCurRow, + const SCTAB nCurTab ) { - //ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab ); - ScDBData* pDBData = GetDBAtTable(nCurTab, SC_DB_OLD_FILTER); + ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab ); sal_Bool bHasAutoFilter = ( pDBData != NULL ); if ( pDBData ) diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 5dc7d8b0d583..a8be9629254b 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1144,6 +1144,19 @@ sal_Bool ScPatternAttr::IsVisibleEqual( const ScPatternAttr& rOther ) const //! auch hier nur wirklich sichtbare Werte testen !!! } +sal_Bool ScPatternAttr::IsEqual( const ScPatternAttr& rOther ) const +{ + const SfxItemSet& rThisSet = GetItemSet(); + const SfxItemSet& rOtherSet = rOther.GetItemSet(); + + return OneEqual( rThisSet, rOtherSet, ATTR_BACKGROUND ) && + OneEqual( rThisSet, rOtherSet, ATTR_BORDER ) && + OneEqual( rThisSet, rOtherSet, ATTR_BORDER_TLBR ) && + OneEqual( rThisSet, rOtherSet, ATTR_BORDER_BLTR ) && + OneEqual( rThisSet, rOtherSet, ATTR_VALUE_FORMAT ) && + OneEqual( rThisSet, rOtherSet, ATTR_SHADOW ); +} + const String* ScPatternAttr::GetStyleName() const { return pName ? pName : ( pStyle ? &pStyle->GetName() : NULL ); diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index 010643c6e474..f8bef323a788 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -28,6 +28,7 @@ #include <sfx2/objsh.hxx> #include <svl/smplhint.hxx> #include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include "cellform.hxx" #include "cell.hxx" @@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr rString.Erase(); else if ( pFCell->IsValue() ) { - if(pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL) + const SvNumberformat* pNumFmt = rFormatter.GetEntry( nFormat ); + const bool bHasTextFormatCode = pNumFmt != NULL && pNumFmt->HasTextFormatCode(); + if( pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL && bHasTextFormatCode ) { String aCellString; double fValue = pFCell->GetValue(); diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx index bc1c1db78c2e..e5e3334a89d3 100644 --- a/sc/source/core/tool/dbcolect.cxx +++ b/sc/source/core/tool/dbcolect.cxx @@ -691,11 +691,18 @@ ScDataObject* ScDBData::Clone() const { return new ScDBData(*this); } -sal_Bool ScDBData::IsBuildin() + + +bool ScDBData::IsInternalUnnamed() const { - String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED); - String aBeginName = aName.Copy(0,22); - return (sal_Bool)(!ScGlobal::GetpTransliteration()->compareString( aNoName, aBeginName )); + return GetName() == ScGlobal::GetRscString( STR_DB_NONAME ); +} + +bool ScDBData::IsInternalForAutoFilter() const +{ + const String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED); + const String aBeginName = aName.Copy( 0, aNoName.Len() ); + return aBeginName == aNoName; } //--------------------------------------------------------------------------------------- @@ -717,7 +724,7 @@ sal_Bool ScDBCollection::IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const { - ScDBData* pNoNameData = NULL; + ScDBData* pInternalDBData = NULL; if (pItems) { @@ -725,32 +732,42 @@ ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_ if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly)) { ScDBData* pDB = (ScDBData*)pItems[i]; - if ( pDB->IsBuildin() ) - pNoNameData = pDB; + if ( pDB->IsInternalUnnamed() + || pDB->IsInternalForAutoFilter() ) + { + pInternalDBData = pDB; + } else + { return pDB; + } } } - return pNoNameData; // "unbenannt" nur zurueck, wenn sonst nichts gefunden + return pInternalDBData; } -ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const +ScDBData* ScDBCollection::GetDBAtArea( + const SCTAB nTab, + const SCCOL nCol1, + const SCROW nRow1, + const SCCOL nCol2, + const SCROW nRow2 ) const { - ScDBData* pNoNameData = NULL; + ScDBData* pInternalDBData = NULL; if (pItems) { - for (sal_uInt16 i = 0; i < nCount; i++) if (((ScDBData*)pItems[i])->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2)) { ScDBData* pDB = (ScDBData*)pItems[i]; - if ( pDB->IsBuildin() ) - pNoNameData = pDB; + if ( pDB->IsInternalUnnamed() + || pDB->IsInternalForAutoFilter() ) + pInternalDBData = pDB; else return pDB; } } - return pNoNameData; // "unbenannt" nur zurueck, wenn sonst nichts gefunden + return pInternalDBData; } ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const @@ -920,54 +937,3 @@ String ScDBCollection::GetNewDefaultDBName() }while(SearchName(aNewName,nDummy)); return aNewName; } -/* -sal_Bool ScDBCollection::IsFiltered(SCTAB nTab, SCROW nRow) -{ - SCCOL nLastCol; - SCROW nLastRow; - pDoc->GetLastAttrCellArea(nTab, nLastCol, nLastRow); - - if ( pItems ) - { - for (unsigned short i = 0; i < nCount; i++) - { - ScDBData* pData = (ScDBData*)pItems[i]; - if ( pData->nTable == nTab && pData->HasQueryParam() && pData->bQueryInplace ) - if ( nRow >= (pData->nStartRow + (pData->HasHeader()?1:0)) && nRow <= pData->nEndRow && nRow <= nLastRow ) - return sal_True; - } - } - return sal_False; -} -*/ -ScDBData* ScDBCollection::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const -{ - ScDBData* pDataEmpty = NULL; - if (pItems) - { - for (unsigned short i = 0; i < nCount; i++) - { - ScDBData* pDBTemp = (ScDBData*)pItems[i]; - if ( pDBTemp->nTable == nTab ) //Sym2_7885 mod - { - sal_Bool bImport = pDBTemp->HasImportParam(); - sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam(); - sal_Bool bSort = pDBTemp->HasSortParam(); - sal_Bool bSubtotal = pDBTemp->HasSubTotalParam(); - sal_Bool bAnyParam = bImport || bFilter || bSort || bSubtotal; - if ( ((eMode == SC_DB_MAKE_SORT) && bSort && !bFilter) || //Sym2_7334 mod 20100420 - ((eMode == SC_DB_MAKE_SUBTOTAL) && bSubtotal && !bFilter ) || - ((eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_OLD_FILTER) && bFilter ) ) - { - return pDBTemp; - } - else if ( pDBTemp->IsBuildin() && !bAnyParam ) //Sym2_7885 mod - { - pDataEmpty = pDBTemp; - } - } - } - } - - return pDataEmpty; -} diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index ae36c671088a..2fb3271f7003 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -997,8 +997,7 @@ sal_Bool ScArea::operator==( const ScArea& r ) const //------------------------------------------------------------------------ -ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) : - aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) ) +ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) { pRangeName = pDoc->GetRangeName(); pDBCollection = pDoc->GetDBCollection(); @@ -1032,8 +1031,9 @@ sal_Bool ScAreaNameIterator::Next( String& rName, ScRange& rRange ) if ( pDBCollection && nPos < pDBCollection->GetCount() ) { ScDBData* pData = (*pDBCollection)[nPos++]; -// if (pData && pData->GetName() != aStrNoName) - if (pData && !pData->IsBuildin()) + if ( pData + && !pData->IsInternalUnnamed() + && !pData->IsInternalForAutoFilter() ) { pData->GetArea( rRange ); rName = pData->GetName(); diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index f6df37dc8176..9dd8692333bb 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -55,9 +55,10 @@ LOTUS_ROOT::LOTUS_ROOT( ScDocument* pDocP, CharSet eQ ) eFirstType( Lotus_X), eActType( Lotus_X), pRngNmBffWK3( new RangeNameBufferWK3), - pFontBuff( new LotusFontBuffer), - pAttrTable( new LotAttrTable) + pFontBuff( new LotusFontBuffer) { + pLotusRoot = this; // #122841# the singleton global var is already needed for LotAttrTable + pAttrTable = new LotAttrTable; } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 738f068db855..921305eb3149 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2751,7 +2751,7 @@ void ScXMLImport::SetNamedRanges() //xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));//String::CreateFromInt32( (*aItr)->nNameScope) String sTabName; GetDocument()->GetName( (*aItr)->nNameScope, sTabName); - xNamedRanges->addNewByScopeName( sTabName, (*aItr)->sName, (*aItr)->sContent, aCellAddress, GetRangeType((*aItr)->sRangeType) ); + xNamedRanges->addNewByScopeName( sTabName, (*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType) ); } catch( uno::RuntimeException& ) { @@ -2790,11 +2790,10 @@ void ScXMLImport::SetNamedRanges() if (ScRangeStringConverter::GetAddressFromString( aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset )) { + //uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY); String sTableName; GetDocument()->GetName( (*aItr)->nNameScope, sTableName ); rtl::OUString sRangeScope( sTableName); - //uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY); - //getByScopeName uno::Reference <sheet::XNamedRange2> xNamedRange(xNamedRanges->getByScopeName( sRangeScope,(*aItr)->sName), uno::UNO_QUERY); if (xNamedRange.is()) { diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 945091e27b63..a8764ff4231e 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -346,11 +346,15 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor ) } else if ( nFormat == SOT_FORMAT_GDIMETAFILE ) { - InitDocShell(); + // #123405# Do not limit visual size calculation for metafile creation. + // It seems unlikely that removing the limitation causes problems since + // metafile creation means that no real pixel device in the needed size is + // created. + InitDocShell(false); + SfxObjectShell* pEmbObj = aDocShellRef; // like SvEmbeddedTransfer::GetData: - GDIMetaFile aMtf; VirtualDevice aVDev; MapMode aMapMode( pEmbObj->GetMapUnit() ); @@ -372,7 +376,8 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor ) else if ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ) { //TODO/LATER: differentiate between formats?! - InitDocShell(); // set aDocShellRef + // #123405# Do limit visual size calculation to PageSize + InitDocShell(true); // set aDocShellRef SfxObjectShell* pEmbObj = aDocShellRef; bOK = SetObject( pEmbObj, SCTRANS_TYPE_EMBOBJ, rFlavor ); @@ -574,8 +579,10 @@ ScMarkData ScTransferObj::GetSourceMarkData() // // initialize aDocShellRef with a live document from the ClipDoc // +// #123405# added parameter to allow size calculation without limitation +// to PageSize, e.g. used for Metafile creation for clipboard. -void ScTransferObj::InitDocShell() +void ScTransferObj::InitDocShell(bool bLimitToPageSize) { if ( !aDocShellRef.Is() ) { @@ -697,14 +704,14 @@ void ScTransferObj::InitDocShell() for (nCol=nStartX; nCol<=nEndX; nCol++) { long nAdd = pDestDoc->GetColWidth( nCol, 0 ); - if ( nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit? + if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit? break; nSizeX += nAdd; } for (SCROW nRow=nStartY; nRow<=nEndY; nRow++) { long nAdd = pDestDoc->GetRowHeight( nRow, 0 ); - if ( nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit? + if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit? break; nSizeY += nAdd; } diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index cc843cc87688..7652853b1856 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -160,7 +160,6 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, aStrAdd ( ScResId( STR_ADD ) ), aStrModify ( ScResId( STR_MODIFY ) ), - aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ), aStrInvalid ( ScResId( STR_DB_INVALID ) ), // pViewData ( ptrViewData ), @@ -237,10 +236,10 @@ void ScDbNameDlg::Init() ScDBData* pDBData = NULL; pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab, - nEndCol, nEndRow, nEndTab ); + nEndCol, nEndRow, nEndTab ); theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ), - ScAddress( nEndCol, nEndRow, nEndTab ) ); + ScAddress( nEndCol, nEndRow, nEndTab ) ); theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails ); @@ -266,11 +265,15 @@ void ScDbNameDlg::Init() && (rEnd.Col() == nCol2) && (rEnd.Row() == nRow2 ) ) { pDBData->GetName( theDbName ); - //if ( theDbName != aStrNoName ) - if ( !pDBData->IsBuildin() ) + if ( !pDBData->IsInternalUnnamed() + && !pDBData->IsInternalForAutoFilter() ) + { aEdName.SetText( theDbName ); + } else + { aEdName.SetText( EMPTY_STRING ); + } aBtnHeader.Check( pDBData->HasHeader() ); aBtnDoSize.Check( pDBData->IsDoSize() ); aBtnKeepFmt.Check( pDBData->IsKeepFmt() ); @@ -379,8 +382,8 @@ void ScDbNameDlg::UpdateNames() if ( pDbData ) { pDbData->GetName( aString ); - //if ( aString != aStrNoName ) - if ( !pDbData->IsBuildin() ) + if ( !pDbData->IsInternalUnnamed() + && !pDbData->IsInternalForAutoFilter() ) aEdName.InsertEntry( aString ); } } diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx index 0e7c546b8313..fef0f5d62d01 100644 --- a/sc/source/ui/dbgui/foptmgr.cxx +++ b/sc/source/ui/dbgui/foptmgr.cxx @@ -178,15 +178,15 @@ void ScFilterOptionsMgr::Init() { ScAddress& rStart = theCurArea.aStart; ScAddress& rEnd = theCurArea.aEnd; - ScDBData* pDBData = pDBColl->GetDBAtArea( rStart.Tab(), - rStart.Col(), rStart.Row(), - rEnd.Col(), rEnd.Row() ); + ScDBData* pDBData = pDBColl->GetDBAtArea( + rStart.Tab(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() ); if ( pDBData ) { rBtnHeader.Check( pDBData->HasHeader() ); pDBData->GetName( theDbName ); - if ( !pDBData->IsBuildin() ) + if ( !pDBData->IsInternalUnnamed() + && !pDBData->IsInternalForAutoFilter() ) { rBtnHeader.Disable(); } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 40be175302be..0b97c5820bf8 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -592,7 +592,7 @@ sal_Bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, if (pDestData) pNewData = pDestData; // Bereich vorhanden -> anpassen else // Bereich ab Cursor/Markierung wird angelegt - pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE_SORT, SC_DBSEL_FORCE_MARK ); + pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { pNewData->SetArea( nTab, @@ -919,7 +919,7 @@ sal_Bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, pNewData = rDocShell.GetDBData( ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ), - SC_DB_MAKE_FILTER, SC_DBSEL_FORCE_MARK ); + SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 52d3c23d51e6..6f2129b0377a 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -111,17 +111,21 @@ void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCR aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); } -ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SCTAB nTab ) + +ScDBData* lcl_GetDBNearCursor( + const ScDBCollection* pColl, + const SCCOL nCol, + const SCROW nRow, + const SCTAB nTab ) { //! nach document/dbcolect verschieben if (!pColl) return NULL; - ScDBData* pNoNameData = NULL; + ScDBData* pInternalDBData = NULL; ScDBData* pNearData = NULL; sal_uInt16 nCount = pColl->GetCount(); - String aNoName = ScGlobal::GetRscString( STR_DB_NONAME ); SCTAB nAreaTab; SCCOL nStartCol, nEndCol; SCROW nStartRow, nEndRow; @@ -129,14 +133,20 @@ ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SC { ScDBData* pDB = (*pColl)[i]; pDB->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow ); - if ( nTab == nAreaTab && nCol+1 >= nStartCol && nCol <= nEndCol+1 && - nRow+1 >= nStartRow && nRow <= nEndRow+1 ) + if ( nTab == nAreaTab + && nCol+1 >= nStartCol + && nCol <= nEndCol+1 + && nRow+1 >= nStartRow + && nRow <= nEndRow+1 ) { - if ( pDB->GetName() == aNoName ) - pNoNameData = pDB; + if ( pDB->IsInternalUnnamed() + || pDB->IsInternalForAutoFilter() ) + { + pInternalDBData = pDB; + } else if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow ) { - if (!pNearData) + if ( !pNearData ) pNearData = pDB; // ersten angrenzenden Bereich merken } else @@ -145,60 +155,57 @@ ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SC } if (pNearData) return pNearData; // angrenzender, wenn nichts direkt getroffen - return pNoNameData; // "unbenannt" nur zurueck, wenn sonst nichts gefunden + return pInternalDBData; } ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) { - if ( eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_MAKE_SORT || eMode == SC_DB_MAKE_SUBTOTAL || eMode == SC_DB_OLD_FILTER ) - return GetDBDataAdd(rMarked, eMode, eSel); - SCCOL nCol = rMarked.aStart.Col(); - SCROW nRow = rMarked.aStart.Row(); - SCTAB nTab = rMarked.aStart.Tab(); + const SCCOL nCol = rMarked.aStart.Col(); + const SCROW nRow = rMarked.aStart.Row(); + const SCTAB nTab = rMarked.aStart.Tab(); SCCOL nStartCol = nCol; SCROW nStartRow = nRow; - SCTAB nStartTab = nTab; SCCOL nEndCol = rMarked.aEnd.Col(); SCROW nEndRow = rMarked.aEnd.Row(); - SCTAB nEndTab = rMarked.aEnd.Tab(); - - // Wegen #49655# nicht einfach GetDBAtCursor: Der zusammenhaengende Datenbereich - // fuer "unbenannt" (GetDataArea) kann neben dem Cursor legen, also muss auch ein - // benannter DB-Bereich dort gesucht werden. - ScDBData* pData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); - if (!pData) - pData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab ); + ScDBData* pFoundDBData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); + if ( pFoundDBData == NULL ) + { + pFoundDBData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab ); + } - sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || - (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) ); - bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); + const bool bSelected = + ( eSel == SC_DBSEL_FORCE_MARK + || ( rMarked.aStart != rMarked.aEnd + && eSel != SC_DBSEL_ROW_DOWN ) ); + const bool bOnlyDown = ( !bSelected + && eSel == SC_DBSEL_ROW_DOWN + && rMarked.aStart.Row() == rMarked.aEnd.Row()); - sal_Bool bUseThis = sal_False; - if (pData) + bool bUseFoundDBData = false; + if ( pFoundDBData ) { - // Bereich nehmen, wenn nichts anderes markiert - + // check, if found database range can be used SCTAB nDummy; SCCOL nOldCol1; SCROW nOldRow1; SCCOL nOldCol2; SCROW nOldRow2; - pData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 ); -// sal_Bool bIsNoName = ( pData->GetName() == ScGlobal::GetRscString( STR_DB_NONAME ) ); - sal_Bool bIsNoName = pData->IsBuildin(); + pFoundDBData->GetArea( nDummy, nOldCol1, nOldRow1, nOldCol2, nOldRow2 ); - if (!bSelected) + const bool bIsUnnamedOne = pFoundDBData->IsInternalUnnamed(); + const bool bIsInternalForAutoFilter = pFoundDBData->IsInternalForAutoFilter(); + if ( !bSelected ) { - bUseThis = sal_True; - if ( bIsNoName && eMode == SC_DB_MAKE ) + bUseFoundDBData = true; + if ( ( bIsUnnamedOne || bIsInternalForAutoFilter ) + && ( eMode == SC_DB_MAKE || eMode == SC_DB_MAKE_AUTOFILTER ) ) { - // If nothing marked or only one row marked, adapt - // "unbenannt"/"unnamed" to contiguous area. + // If nothing marked or only one row marked, adapt found database range to contiguous area. nStartCol = nCol; nStartRow = nRow; - if (bOnlyDown) + if ( bOnlyDown ) { nEndCol = rMarked.aEnd.Col(); nEndRow = rMarked.aEnd.Row(); @@ -210,50 +217,63 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe } aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow ) - bUseThis = sal_False; // passt gar nicht + { + bUseFoundDBData = false; + } else if ( nOldRow2 != nEndRow ) { - // Bereich auf neue End-Zeile erweitern - pData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow ); + // adapt found internal database range to new end row + pFoundDBData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow ); } } } else { - if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow && - nOldCol2 == nEndCol && nOldRow2 == nEndRow ) // genau markiert? - bUseThis = sal_True; + if ( nOldCol1 == nStartCol + && nOldRow1 == nStartRow + && nOldCol2 == nEndCol + && nOldRow2 == nEndRow ) + { + bUseFoundDBData = true; + } else - bUseThis = sal_False; // immer Markierung nehmen (Bug 11964) + { + bUseFoundDBData = false; + } } - // fuer Import nie "unbenannt" nehmen + // adapt internal unnamed database range to an auto filter one + // otherwise the auto filter is lost when the internal unnamed one is changed/reused/deleted + if ( bUseFoundDBData + && eMode == SC_DB_MAKE_AUTOFILTER + && bIsUnnamedOne ) + { + pFoundDBData->SetName( aDocument.GetDBCollection()->GetNewDefaultDBName() ); + } - if ( bUseThis && eMode == SC_DB_IMPORT && bIsNoName ) - bUseThis = sal_False; + // no internal database range for Import + if ( bUseFoundDBData + && eMode == SC_DB_IMPORT + && ( bIsUnnamedOne || bIsInternalForAutoFilter ) ) + { + bUseFoundDBData = false; + } } - if ( bUseThis ) + if ( bUseFoundDBData ) { - pData->GetArea( nStartTab, nStartCol,nStartRow, nEndCol,nEndRow ); - nEndTab = nStartTab; + return pFoundDBData; } - else if ( eMode == SC_DB_OLD ) + + if ( eMode == SC_DB_OLD ) { - pData = NULL; // nichts gefunden - nStartCol = nEndCol = nCol; - nStartRow = nEndRow = nRow; - nStartTab = nEndTab = nTab; -// bMark = sal_False; // nichts zu markieren + // no existing database range found + return NULL; } - else + else // eMode == SC_DB_MAKE||SC_DB_IMPORT||SC_DB_MAKE_AUTOFILTER { - if ( bSelected ) + if ( !bSelected ) { -// bMark = sal_False; - } - else - { // zusammenhaengender Bereich nStartCol = nCol; nStartRow = nRow; if (bOnlyDown) @@ -269,49 +289,52 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); } - sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab ); + const sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol, nStartRow, nEndCol, nEndRow, nTab ); - ScDBData* pNoNameData; - sal_uInt16 nNoNameIndex; + ScDBData* pDBData = NULL; + sal_uInt16 nUnnamedDBIndex; ScDBCollection* pColl = aDocument.GetDBCollection(); - if ( eMode != SC_DB_IMPORT && - pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nNoNameIndex ) ) + if ( eMode == SC_DB_MAKE && + pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nUnnamedDBIndex ) ) { - pNoNameData = (*pColl)[nNoNameIndex]; + // adapt existing unnamed database range + pDBData = (*pColl)[nUnnamedDBIndex]; if ( !pOldAutoDBRange ) { // store the old unnamed database range with its settings for undo // (store at the first change, get the state before all changes) - pOldAutoDBRange = new ScDBData( *pNoNameData ); + pOldAutoDBRange = new ScDBData( *pDBData ); } - SCCOL nOldX1; // alten Bereich sauber wegnehmen - SCROW nOldY1; //! (UNDO ???) + SCCOL nOldX1; + SCROW nOldY1; SCCOL nOldX2; SCROW nOldY2; SCTAB nOldTab; - pNoNameData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); + pDBData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); - pNoNameData->SetSortParam( ScSortParam() ); // Parameter zuruecksetzen - pNoNameData->SetQueryParam( ScQueryParam() ); - pNoNameData->SetSubTotalParam( ScSubTotalParam() ); + pDBData->SetSortParam( ScSortParam() ); + pDBData->SetQueryParam( ScQueryParam() ); + pDBData->SetSubTotalParam( ScSubTotalParam() ); - pNoNameData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); // neu setzen - pNoNameData->SetByRow( sal_True ); - pNoNameData->SetHeader( bHasHeader ); - pNoNameData->SetAutoFilter( sal_False ); + pDBData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); + pDBData->SetByRow( sal_True ); + pDBData->SetHeader( bHasHeader ); + pDBData->SetAutoFilter( sal_False ); } else { ScDBCollection* pUndoColl = NULL; String aNewName; - if (eMode==SC_DB_IMPORT) + switch ( eMode ) + { + case SC_DB_IMPORT: { - aDocument.CompileDBFormula( sal_True ); // CreateFormulaString - pUndoColl = new ScDBCollection( *pColl ); // Undo fuer Import1-Bereich + aDocument.CompileDBFormula( sal_True ); + pUndoColl = new ScDBCollection( *pColl ); String aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT ); long nCount = 0; @@ -324,197 +347,51 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe } while (pColl->SearchName( aNewName, nDummy )); } - else - //aNewName = ScGlobal::GetRscString( STR_DB_NONAME ); - aNewName = pColl->GetNewDefaultDBName(); - - pNoNameData = new ScDBData( aNewName, nTab, - nStartCol,nStartRow, nEndCol,nEndRow, - sal_True, bHasHeader ); - pColl->Insert( pNoNameData ); + break; - if ( pUndoColl ) + case SC_DB_MAKE_AUTOFILTER: { - aDocument.CompileDBFormula( sal_False ); // CompileFormulaString + aDocument.CompileDBFormula( sal_True ); + pUndoColl = new ScDBCollection( *pColl ); - ScDBCollection* pRedoColl = new ScDBCollection( *pColl ); - GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) ); + aNewName = pColl->GetNewDefaultDBName(); } + break; - // neuen Bereich am Sba anmelden nicht mehr noetig - - // "Import1" etc am Navigator bekanntmachen - if (eMode==SC_DB_IMPORT) - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); - } - pData = pNoNameData; - } - -// if (bMark) -// MarkRange( ScRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ), sal_False ); - - return pData; -} - -ScDBData* ScDocShell::GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) -{ - SCCOL nCol = rMarked.aStart.Col(); - SCROW nRow = rMarked.aStart.Row(); - SCTAB nTab = rMarked.aStart.Tab(); - - SCCOL nStartCol = nCol; - SCROW nStartRow = nRow; - SCCOL nEndCol = rMarked.aEnd.Col(); - SCROW nEndRow = rMarked.aEnd.Row(); - - ScDBData* pData = NULL; - ScDBData* pCursorData; - pCursorData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); - if ( !pCursorData ) - pCursorData = aDocument.GetDBAtCursor( nStartCol, nStartRow, nTab ); - - //Get DBData at current table - ScDBData* pTableData = aDocument.GetDBAtTable( nTab, eMode ); - - if ( eMode == SC_DB_OLD_FILTER ) - return pTableData; - - sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || rMarked.aStart != rMarked.aEnd ); - bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); - - sal_Bool bUseThis = sal_False; - if (pCursorData) - { - SCTAB nDummy; - SCCOL nOldCol1; - SCROW nOldRow1; - SCCOL nOldCol2; - SCROW nOldRow2; - pCursorData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 ); - if ( !bSelected ) - { - ScRange tmpRange; - if ( !pCursorData->IsBuildin() && pCursorData->GetAdvancedQuerySource(tmpRange)) - bUseThis = sal_True; - else - { - nStartCol = nCol; - nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); - if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow ) - bUseThis = sal_False; - else - { - bUseThis = sal_True; - if ( nOldRow2 != nEndRow )// Range of new end-line expand - pCursorData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow ); - } + case SC_DB_MAKE: + { + aNewName = ScGlobal::GetRscString( STR_DB_NONAME ); } + break; - } - else - { - if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow && nOldCol2 == nEndCol && nOldRow2 == nEndRow ) - bUseThis = sal_True; - else - bUseThis = sal_False; // Always take mark (Bug 11964) - } - } + default: + DBG_ERROR( "<ScDocShell::GetDBData(..)> - unexcepted <eMode>" ); + break; + } - if ( bUseThis ) - { - pData = pCursorData; - if ( pTableData && eMode == SC_DB_MAKE_FILTER && !(*pTableData == *pCursorData ) ) - { - if ( !pOldAutoDBRange ) - pOldAutoDBRange = new ScDBData(*pTableData); - SCCOL nOldX1; - SCROW nOldY1; - SCCOL nOldX2; - SCROW nOldY2; - SCTAB nOldTab; - pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); + pDBData = new ScDBData( + aNewName, nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_True, bHasHeader ); + pColl->Insert( pDBData ); - if (pTableData->HasQueryParam()) + if ( pUndoColl ) { - ScQueryParam aParam; - pTableData->GetQueryParam(aParam); - SCSIZE nEC = aParam.GetEntryCount(); - for (SCSIZE i=0; i<nEC; i++) - aParam.GetEntry(i).bDoQuery = sal_False; - aParam.bDuplicate = sal_True; - ScDBDocFunc aDBDocFunc( *this ); - aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False ); - } + aDocument.CompileDBFormula( sal_False ); - DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); - pTableData->SetQueryParam( ScQueryParam() ); - pTableData->SetAutoFilter( sal_False ); - } - - } - else - { - if ( bSelected ) - { -// bMark = sal_False; - } - else - { - nStartCol = nCol; - nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); - } - sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab ); - ScDBCollection* pColl = aDocument.GetDBCollection(); - if ( pTableData ) - { - if ( !pOldAutoDBRange ) - pOldAutoDBRange = new ScDBData(*pTableData); - SCCOL nOldX1; - SCROW nOldY1; - SCCOL nOldX2; - SCROW nOldY2; - SCTAB nOldTab; - pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); + ScDBCollection* pRedoColl = new ScDBCollection( *pColl ); + GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) ); + } - if (pTableData->HasQueryParam()) + // notify Navigator about database range "Import[X]" + if ( eMode==SC_DB_IMPORT ) { - ScQueryParam aParam; - pTableData->GetQueryParam(aParam); - SCSIZE nEC = aParam.GetEntryCount(); - for (SCSIZE i=0; i<nEC; i++) - aParam.GetEntry(i).bDoQuery = sal_False; - aParam.bDuplicate = sal_True; - ScDBDocFunc aDBDocFunc( *this ); - aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False ); + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) ); } - - DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); - - pTableData->SetSortParam( ScSortParam() ); - pTableData->SetQueryParam( ScQueryParam() ); - pTableData->SetSubTotalParam( ScSubTotalParam() ); - - pTableData->SetArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); - pTableData->SetByRow( sal_True ); - pTableData->SetHeader( bHasHeader ); - pTableData->SetAutoFilter( sal_False ); } - else - { - String aNewName = pColl->GetNewDefaultDBName(); - pTableData = new ScDBData( aNewName, nTab, nStartCol,nStartRow, nEndCol,nEndRow, sal_True, bHasHeader ); - pColl->Insert( pTableData ); - } - pData = pTableData; + + return pDBData; } - return pData; + return NULL; // never reached } @@ -657,18 +534,19 @@ void ScDocShell::RefreshPivotTables( const ScRange& rSource ) String lcl_GetAreaName( ScDocument* pDoc, ScArea* pArea ) { String aName; - sal_Bool bOk = sal_False; - ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart, - pArea->nColEnd, pArea->nRowEnd ); + bool bOk = false; + ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart, pArea->nColEnd, pArea->nRowEnd ); if (pData) { pData->GetName( aName ); - if ( aName != ScGlobal::GetRscString( STR_DB_NONAME ) ) - bOk = sal_True; + if ( !pData->IsInternalUnnamed() ) + bOk = true; } if (!bOk) + { pDoc->GetName( pArea->nTab, aName ); + } return aName; } diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index 39a9fae84d3c..141286bdeca4 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -75,7 +75,6 @@ public: // DB-Bereich vom Cursor ScDBData* GetDBData( sal_Bool bMarkArea = sal_True, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP ); - //ScRange GetDBRange( BOOL bMark, bool bIgnoreNotes ); void NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList ); void Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True ); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 905f81c72820..2d549f767703 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -158,7 +158,6 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener SC_DLLPRIVATE void EnableSharedSettings( bool bEnable ); SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument(); - ScDBData* GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); SC_DLLPRIVATE void UseSheetSaveEntries(); @@ -305,7 +304,6 @@ public: ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); ScDBData* GetOldAutoDBRange(); // has to be deleted by caller! void CancelAutoDBRange(); // called when dialog is cancelled - ScDBCollection* GetDBCollection(){ return aDocument.GetDBCollection();} void UpdateLinks(); // Link-Eintraege aktuallisieren sal_Bool ReloadTabLinks(); // Links ausfuehren (Inhalt aktualisieren) diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 9a1f1444ab47..8934fe82dcf9 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -245,7 +245,7 @@ public: void DrawSelectiveObjects(const sal_uInt16 nLayer); sal_Bool SetChangedClip(); // sal_False = nix - PolyPolygon GetChangedArea(); + Region GetChangedAreaRegion(); void FindChanged(); void SetPagebreakMode( ScPageBreakData* pPageData ); diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index d74bacc360b0..524614b2c93f 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -62,7 +62,9 @@ private: bool bHasFiltered; // if has filtered rows bool bUseInApi; // to recognize clipboard content copied from API - void InitDocShell(); + // #123405# added parameter to allow size calculation without limitation + // to PageSize, e.g. used for Metafile creation for clipboard. + void InitDocShell(bool bLimitToPageSize); static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, ScDocument* pDestDoc=0, diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index ee5059f14afb..f0de273cbbc8 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -728,14 +728,15 @@ void ScContentTree::GetDbNames() sal_uInt16 nCount = pDbNames->GetCount(); if ( nCount > 0 ) { - String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) ); for ( sal_uInt16 i=0; i<nCount; i++ ) { ScDBData* pData = (*pDbNames)[i]; String aStrName = pData->GetName(); - //if ( aStrName != aStrNoName ) - if ( !pData->IsBuildin() ) + if ( !pData->IsInternalUnnamed() + && !pData->IsInternalForAutoFilter() ) + { InsertContent( SC_CONTENT_DBAREA, aStrName ); + } } } } diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx index 16d3963e39ac..c4b345b4d256 100644 --- a/sc/source/ui/undo/undoutil.cxx +++ b/sc/source/ui/undo/undoutil.cxx @@ -82,33 +82,44 @@ void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell, ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab, - SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) { ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 ); if (!pRet) { - sal_Bool bWasTemp = sal_False; + bool bWasInternalUnnamed = false; + bool bWasInternalForAutoFilter = false; if ( pUndoData ) { String aName; pUndoData->GetName( aName ); -// if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) ) - if (pUndoData->IsBuildin()) - bWasTemp = sal_True; + if ( pUndoData->IsInternalUnnamed() ) + { + bWasInternalUnnamed = true; + } + else if (pUndoData->IsInternalForAutoFilter()) + { + bWasInternalForAutoFilter = true; + } } - DBG_ASSERT(bWasTemp, "Undo: didn't find database range"); + DBG_ASSERT( bWasInternalUnnamed || bWasInternalForAutoFilter, "Undo: didn't find database range"); sal_uInt16 nIndex; ScDBCollection* pColl = pDoc->GetDBCollection(); - if (pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex )) + if ( bWasInternalUnnamed + && pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex )) + { pRet = (*pColl)[nIndex]; + } else { - String aNoNamed = pColl->GetNewDefaultDBName(); - pRet = new ScDBData( aNoNamed/*ScGlobal::GetRscString( STR_DB_NONAME )*/, nTab, - nCol1,nRow1, nCol2,nRow2, sal_True, - pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) ); + String aNewNamed = bWasInternalForAutoFilter + ? pColl->GetNewDefaultDBName() + : ScGlobal::GetRscString( STR_DB_NONAME ); + pRet = new ScDBData( + aNewNamed, nTab, nCol1,nRow1, nCol2,nRow2, sal_True, + pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) ); pColl->Insert( pRet ); } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 94b4140f2edc..489a793eee75 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2535,6 +2535,7 @@ void ScChart2DataSequence::BuildDataCache() SCCOL nLastCol = -1; SCROW nLastRow = -1; + for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); ++nTab) { for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol) @@ -2564,6 +2565,7 @@ void ScChart2DataSequence::BuildDataCache() continue; if (pCell->HasStringData()) + rItem.maString = pCell->GetStringData(); else { @@ -3034,51 +3036,12 @@ uno::Sequence< double > SAL_CALL ScChart2DataSequence::getNumericalData() ::rtl::math::setNan(&fNAN); sal_Int32 nCount = m_aDataArray.size(); - // i121058: if there's too many points need to be painted, it doens't need to get all points for performance consideration - // and so many points are not useful for users to understand the chart. So only picked some points to paint - sal_Int32 nStep = nCount >= 10000 ? 50 : 1; - nCount = nCount >= 10000 ? ((nCount - nCount % nStep) / nStep) : nCount; - sal_Int32 nRealCount = nStep == 1 ? nCount : nCount * 2; - uno::Sequence<double> aSeq(nRealCount); - double* pArr = aSeq.getArray(); - ::std::list<Item>::const_iterator itr = m_aDataArray.begin(), itrEnd = m_aDataArray.end(); - for (sal_Int32 i = 0; i < nCount; i++) - { - if (nStep == 1) - { - *pArr++ = itr->mbIsValue ? itr->mfValue : fNAN; - itr++; - } - else - { - sal_Int32 nMax = 0, nMin = 0, nMaxStep = 0, nMinStep = 0; - for (sal_Int32 j = 0; j < nStep; j++) - { - sal_Int32 nValue = itr->mbIsValue ? itr->mfValue : fNAN; - if (nValue > nMax) - { - nMax = nValue; - nMaxStep = j; - } - if (nValue < nMin) - { - nMin = nValue; - nMinStep = j; - } - itr++; - } - if (nMaxStep > nMinStep) - { - *pArr++ = nMin; - *pArr++ = nMax; - } - else - { - *pArr++ = nMax; - *pArr++ = nMin; - } - } - } + uno::Sequence<double> aSeq(nCount); + double* pArr = aSeq.getArray(); + ::std::list<Item>::const_iterator itr = m_aDataArray.begin(), itrEnd = m_aDataArray.end(); + for (; itr != itrEnd; ++itr, ++pArr) + *pArr = itr->mbIsValue ? itr->mfValue : fNAN; + return aSeq; } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index f6c68fcc997a..c26936d6a4b1 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -357,8 +357,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScSubTotalParam aSubTotalParam; SfxItemSet aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA ); - //ScDBData* pDBData = pTabViewShell->GetDBData(); - ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SUBTOTAL); + ScDBData* pDBData = pTabViewShell->GetDBData(); pDBData->GetSubTotalParam( aSubTotalParam ); aSubTotalParam.bRemoveOnly = sal_False; @@ -412,7 +411,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data //the patch comes from maoyg ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); + ScDBData* pDBData = pTabViewShell->GetDBData(); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -463,7 +462,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pArgs ) // Basic { ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); + ScDBData* pDBData = pTabViewShell->GetDBData(); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -526,7 +525,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) else { ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); + ScDBData* pDBData = pTabViewShell->GetDBData(); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -681,7 +680,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) case SID_UNFILTER: { ScQueryParam aParam; - ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_OLD_FILTER); + ScDBData* pDBData = pTabViewShell->GetDBData(); pDBData->GetQueryParam( aParam ); SCSIZE nEC = aParam.GetEntryCount(); @@ -945,7 +944,6 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pDBCol ) { - const String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) ); List aList; sal_uInt16 nDBCount = pDBCol->GetCount(); ScDBData* pDbData = NULL; @@ -959,18 +957,13 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) pDBName = new String; pDbData->GetName( *pDBName ); - if ( *pDBName != aStrNoName ) + if ( !pDbData->IsInternalUnnamed() ) aList.Insert( pDBName ); else DELETEZ(pDBName); } } -//CHINA001 ScSelEntryDlg* pDlg = -//CHINA001 new ScSelEntryDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_SELECTDB, -//CHINA001 String(ScResId(SCSTR_SELECTDB)), -//CHINA001 String(ScResId(SCSTR_AREAS)), -//CHINA001 aList ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index f82507aea973..c0771d074bd4 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -332,119 +332,119 @@ void ScDBFunc::ToggleAutoFilter() ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); - ScQueryParam aParam; - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDBData* pDBData = GetDBData( sal_False, SC_DB_OLD_FILTER, SC_DBSEL_ROW_DOWN ); - - + ScDBData* pDBData = GetDBData( sal_False, SC_DB_MAKE_AUTOFILTER, SC_DBSEL_ROW_DOWN ); + if ( pDBData == NULL ) + { + return; + } + // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation + const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo ); - SCCOL nCol; - SCROW nRow; - SCTAB nTab = GetViewData()->GetTabNo(); - sal_Int16 nFlag; - //sal_Bool bHasAuto = sal_True; - sal_Bool bHeader; - sal_Bool bPaint = sal_False; + pDBData->SetByRow( sal_True ); + ScQueryParam aParam; + pDBData->GetQueryParam( aParam ); - //! stattdessen aus DB-Bereich abfragen? + ScDocument* pDoc = GetViewData()->GetDocument(); - /*for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++) + bool bHasAutoFilter = true; + const SCROW nRow = aParam.nRow1; + const SCTAB nTab = GetViewData()->GetTabNo(); + for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAutoFilter; ++nCol ) { - nFlag = ((ScMergeFlagAttr*) pDoc-> - GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); + const sal_Int16 nFlag = + ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); if ( (nFlag & SC_MF_AUTO) == 0 ) - bHasAuto = sal_False; - }*/ + bHasAutoFilter = false; + } - if (pDBData && pDBData->HasAutoFilter()) // aufheben + bool bPaint = false; + + if ( bHasAutoFilter ) { - // Filterknoepfe ausblenden - pDBData->SetByRow( sal_True ); //! Undo, vorher abfragen ?? - pDBData->GetQueryParam( aParam ); - nRow = aParam.nRow1; - bHeader = pDBData->HasHeader(); - for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++) + // switch filter buttons + for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol ) { - nFlag = ((ScMergeFlagAttr*) pDoc-> - GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); + const sal_Int16 nFlag = + ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); } - // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation - - String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo ); - ScRange aRange; pDBData->GetArea( aRange ); - pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) ); + pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) ); pDBData->SetAutoFilter(sal_False); - // Filter aufheben (incl. Paint / Undo) - - SCSIZE nEC = aParam.GetEntryCount(); - for (SCSIZE i=0; i<nEC; i++) + // switch off filter + const SCSIZE nEC = aParam.GetEntryCount(); + for ( SCSIZE i=0; i<nEC; ++i ) + { aParam.GetEntry(i).bDoQuery = sal_False; + } aParam.bDuplicate = sal_True; Query( aParam, NULL, sal_True ); - pDocSh->GetUndoManager()->LeaveListAction(); + // delete internal database range for auto filter + if ( pDBData->IsInternalForAutoFilter() ) + { + ScDBDocFunc aFunc(*pDocSh); + aFunc.DeleteDBRange( pDBData->GetName(), sal_False ); + } + pDBData = NULL; - bPaint = sal_True; + bPaint = true; } - else // Filterknoepfe einblenden + else { - pDBData = GetDBData(sal_False, SC_DB_MAKE_FILTER); - pDBData->SetByRow(sal_True); - pDBData->GetQueryParam(aParam); - nRow = aParam.nRow1; - bHeader = pDBData->HasHeader(); - - if ( !pDoc->IsBlockEmpty( nTab, - aParam.nCol1, aParam.nRow1, - aParam.nCol2, aParam.nRow2 ) ) + if ( !pDoc->IsBlockEmpty( + nTab, + aParam.nCol1, + aParam.nRow1, + aParam.nCol2, + aParam.nRow2 ) ) { - if (!bHeader) + if ( !pDBData->HasHeader() ) { - if ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), - ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), // "StarCalc" - ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) // Koepfe aus erster Zeile? - ).Execute() == RET_YES ) + if ( MessBox( + GetViewData()->GetDialogParent(), + WinBits(WB_YES_NO | WB_DEF_YES), + ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), + ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) ).Execute() == RET_YES ) { - pDBData->SetHeader( sal_True ); //! Undo ?? - bHeader = sal_True; + pDBData->SetHeader( sal_True ); } } ScRange aRange; pDBData->GetArea( aRange ); - pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) ); + pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) ); pDBData->SetAutoFilter(sal_True); - for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++) + for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol ) { - nFlag = ((ScMergeFlagAttr*) pDoc-> - GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); + const sal_Int16 nFlag = + ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) ); } - pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab, - PAINT_GRID ); - bPaint = sal_True; + pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab, PAINT_GRID ); + bPaint = true; } else { - ErrorBox aErrorBox( GetViewData()->GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ), - ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) ); + ErrorBox aErrorBox( + GetViewData()->GetDialogParent(), + WinBits( WB_OK | WB_DEF_OK ), + ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) ); aErrorBox.Execute(); } } + pDocSh->GetUndoManager()->LeaveListAction(); + if ( bPaint ) { aModificator.SetDocumentModified(); @@ -462,30 +462,41 @@ void ScDBFunc::HideAutoFilter() ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); - ScDocument* pDoc = pDocSh->GetDocument(); - - ScQueryParam aParam; - //ScDBData* pDBData = GetDBData( FALSE ); - ScDBData* pDBData = GetDBData(sal_False, SC_DB_OLD_FILTER); - + ScDBData* pDBData = GetDBData( sal_False ); SCTAB nTab; SCCOL nCol1, nCol2; SCROW nRow1, nRow2; pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2); - for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) { - sal_Int16 nFlag = ((ScMergeFlagAttr*) pDoc-> - GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue(); - pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); + ScDocument* pDoc = pDocSh->GetDocument(); + for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) + { + const sal_Int16 nFlag = + ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue(); + pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); + } } - ScRange aRange; - pDBData->GetArea( aRange ); - pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) ); + const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo ); + { + ScRange aRange; + pDBData->GetArea( aRange ); + pDocSh->GetUndoManager()->AddUndoAction( + new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) ); - pDBData->SetAutoFilter(sal_False); + pDBData->SetAutoFilter(sal_False); + + // delete internal database range for auto filter + if ( pDBData->IsInternalForAutoFilter() ) + { + ScDBDocFunc aFunc(*pDocSh); + aFunc.DeleteDBRange( pDBData->GetName(), sal_False ); + } + pDBData = NULL; + } + pDocSh->GetUndoManager()->LeaveListAction(); pDocSh->PostPaint( nCol1,nRow1,nTab, nCol2,nRow1,nTab, PAINT_GRID ); aModificator.SetDocumentModified(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 39344bc7c96b..c8b346c04083 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4468,10 +4468,12 @@ void ScGridWindow::UpdateFormulas() aOutputData.FindChanged(); - PolyPolygon aChangedPoly( aOutputData.GetChangedArea() ); // logic (PixelToLogic) - if ( aChangedPoly.Count() ) + // #122149# do not use old GetChangedArea() which used polygon-based Regions, but use + // the region-band based new version; anyways, only rectangles are added + Region aChangedRegion( aOutputData.GetChangedAreaRegion() ); // logic (PixelToLogic) + if(!aChangedRegion.IsEmpty()) { - Invalidate( aChangedPoly ); + Invalidate(aChangedRegion); } CheckNeedsRepaint(); // #i90362# used to be called via Draw() - still needed here diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 8b9e7d72fb3d..00727f2c7465 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1685,42 +1685,46 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) // Drucker -PolyPolygon ScOutputData::GetChangedArea() +Region ScOutputData::GetChangedAreaRegion() { - PolyPolygon aPoly; - + Region aRegion; Rectangle aDrawingRect; + bool bHad(false); + long nPosY = nScrY; + SCSIZE nArrY; + aDrawingRect.Left() = nScrX; aDrawingRect.Right() = nScrX+nScrW-1; - sal_Bool bHad = sal_False; - long nPosY = nScrY; - SCSIZE nArrY; - for (nArrY=1; nArrY+1<nArrCount; nArrY++) + for(nArrY=1; nArrY+1<nArrCount; nArrY++) { RowInfo* pThisRowInfo = &pRowInfo[nArrY]; - if ( pThisRowInfo->bChanged ) + if(pThisRowInfo->bChanged) { - if (!bHad) + if(!bHad) { aDrawingRect.Top() = nPosY; - bHad = sal_True; + bHad = true; } + aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1; } - else if (bHad) + else if(bHad) { - aPoly.Insert( Polygon( pDev->PixelToLogic(aDrawingRect) ) ); - bHad = sal_False; + aRegion.Union(pDev->PixelToLogic(aDrawingRect)); + bHad = false; } + nPosY += pRowInfo[nArrY].nHeight; } - if (bHad) - aPoly.Insert( Polygon( pDev->PixelToLogic(aDrawingRect) ) ); + if(bHad) + { + aRegion.Union(pDev->PixelToLogic(aDrawingRect)); + } - return aPoly; + return aRegion; } sal_Bool ScOutputData::SetChangedClip() diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 42c07bd8bd7f..f5bd19d25caf 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -171,7 +171,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); @@ -196,7 +196,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index d71c6bfc3899..d6056c707e11 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -830,7 +830,7 @@ inline double Complex::Imag( void ) const inline double Complex::Abs( void ) const { - return std::norm( Num ); + return std::abs( Num ); } diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index fd14700477ed..42769143ed97 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -57,7 +57,6 @@ Module gid_Module_Root_Brand gid_Brand_File_Bin_Unopkgcom, gid_Brand_File_Bin_Unopkgexe, gid_Brand_File_Bin_Unopkg, - gid_Brand_File_Bin_Msvcr71, // gid_Brand_File_Bin_Libxml2, gid_Brand_File_Bmp_IntroAbout, gid_Brand_File_Desktophelper_Txt, @@ -66,12 +65,8 @@ Module gid_Module_Root_Brand gid_Brand_File_Lib_Mingw_GccS, gid_Brand_File_Lib_Mingw_Stdcpp, gid_Brand_File_Lib_Mingwm10, - gid_Brand_File_Lib_Msvcr80, - gid_Brand_File_Lib_Msvcp80, - gid_Brand_File_Lib_Msvcm80, gid_Brand_File_Lib_Oirm, gid_Brand_File_Lib_Oirm2, - gid_Brand_File_Msvcm80crt_Manifest, gid_Brand_File_Lib_Npsoplugin, // gid_Brand_File_ServicesRdb, // gid_Brand_File_Share_Registry_Brand_Xcd, @@ -425,18 +420,6 @@ File gid_Brand_File_Bin_Unopkg End #endif -#if defined WNT && \ - (defined M1310 || \ - ((defined M1400 || defined M1500) && \ - !(defined SYSTEM_MOZILLA || defined WITHOUT_MOZILLA))) -File gid_Brand_File_Bin_Msvcr71 - TXT_FILE_BODY; - Dir = gid_Brand_Dir_Program; - Name = SCP2_URE_DL_NORMAL("msvcr71" SCP2_STDLP_DEBUG); - Styles = (PACKED); -End -#endif - // Due to Windows DLL search order, OOo executables might pick up a libxml2 DLL // from a Windows system directory instead of the one from the URE; to avoid // problems, as a HACK, for now a copy of the URE libxml2 DLL is placed next to @@ -602,23 +585,6 @@ File gid_Brand_File_Lib_Mingwm10 End #endif -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_Brand_File_Lib_Msvcr80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Brand_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcr80.dll"; -#else - Name = "msvcr80d.dll"; -#endif -End -#endif -#endif -#endif - #if defined(WNT) && defined( _gcc3 ) #if defined(MINGW_GCCDLL) @@ -645,57 +611,6 @@ End #endif -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_Brand_File_Lib_Msvcp80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Brand_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcp80.dll"; -#else - Name = "msvcp80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_Brand_File_Lib_Msvcm80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Brand_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcm80.dll"; -#else - Name = "msvcm80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_Brand_File_Msvcm80crt_Manifest - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Brand_Dir_Program; -#ifndef _STLP_DEBUG - Name = "Microsoft.VC80.CRT.manifest"; -#else - Name = "Microsoft.VC80.DebugCRT.manifest"; -#endif -End -#endif -#endif -#endif - // Profiles Profile gid_Brand_Profile_Bootstrap_Ini diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp index 24e85ccb7ca7..726783b9b3d0 100644 --- a/scp2/source/ooo/file_library_ooo.scp +++ b/scp2/source/ooo/file_library_ooo.scp @@ -921,28 +921,6 @@ File gid_File_Lib_Mcnttype #endif End -#if !defined(SYSTEM_MOZILLA) && !defined(WITHOUT_MOZILLA) && !defined(MACOSX) - // #i91209# -STD_LIB_FILE(gid_File_Lib_Mozab,mozab) -STD_LIB_FILE(gid_File_Lib_Mozabdrv,mozabdrv) - -#else - -#ifndef OS2 -File gid_File_Lib_Mozbootstrap - TXT_FILE_BODY; - Styles = (PACKED); - Dir = SCP2_OOO_BIN_DIR; - #ifdef UNX - Name = STRING(CONCAT2(libmozbootstrap,UNXSUFFIX)); - #else - Name = "mozbootstrap.dll"; - #endif -End -#endif - -#endif - #ifdef SYSTEM_LIBWPD STD_LIB_FILE(gid_File_Lib_Wpft,wpft) #endif @@ -969,60 +947,6 @@ End #endif #endif -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcr80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Dir_Common_Ure; -// Dir = gid_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcr80.dll"; -#else - Name = "msvcr80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcp80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Dir_Common_Ure; -// Dir = gid_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcp80.dll"; -#else - Name = "msvcp80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcm80 - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Dir_Common_Ure; -// Dir = gid_Dir_Program; -#ifndef _STLP_DEBUG - Name = "msvcm80.dll"; -#else - Name = "msvcm80d.dll"; -#endif -End -#endif -#endif -#endif - #if defined(WNT) && defined( _gcc3 ) #if defined(MINGW_GCCDLL) @@ -1051,24 +975,6 @@ End #endif -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Msvcm80crt_Manifest - BIN_FILE_BODY; - Styles = (PACKED); - Dir = gid_Dir_Common_Ure; -// Dir = gid_Dir_Program; -#ifndef _STLP_DEBUG - Name = "Microsoft.VC80.CRT.manifest"; -#else - Name = "Microsoft.VC80.DebugCRT.manifest"; -#endif -End -#endif -#endif -#endif - #if defined(OS2) STD_LIB_FILE(gid_File_Lib_Mysql,mysql) STD_LIB_FILE(gid_File_Lib_Odbc,odbc) @@ -1695,7 +1601,30 @@ SPECIAL_LIB_FILE( gid_File_Lib_AVMediaWin, avmediawin ) #endif #endif -#ifndef WITHOUT_MOZILLA + +#ifdef BUNDLE_NSS_LIBS + +STD_LIB_FILE( gid_File_Lib_Freebl3, freebl3) +STD_LIB_FILE( gid_File_Lib_Nspr4, nspr4) +STD_LIB_FILE( gid_File_Lib_Nss3, nss3) +STD_LIB_FILE( gid_File_Lib_Nsckbi, nssckbi) +STD_LIB_FILE( gid_File_Lib_Nssdbm3, nssdbm3) +STD_LIB_FILE( gid_File_Lib_Nssutil3, nssutil3) +STD_LIB_FILE( gid_File_Lib_Plc4, plc4) +STD_LIB_FILE( gid_File_Lib_Plds4, plds4) +STD_LIB_FILE( gid_File_Lib_Smime3, smime3) +STD_LIB_FILE( gid_File_Lib_Softokn3, softokn3) +STD_LIB_FILE( gid_File_Lib_Ssl3, ssl3) + +#ifndef MACOSX // #i108575# use system sqlite3 on MacOSX +STD_LIB_FILE( gid_File_Lib_Sqlite3, sqlite3) +#endif + +#endif // BUNDLE_NSS_LIBS + + +#ifdef ENABLE_XMLSEC + File gid_File_Lib_XSec_Framework TXT_FILE_BODY; #ifdef UNX @@ -1730,6 +1659,7 @@ File gid_File_Lib_XSec_XMLSecurity End #ifdef WNT + File gid_File_Lib_LibXMLSec_xmlseccore TXT_FILE_BODY; #ifdef _gcc3 @@ -1751,10 +1681,11 @@ File gid_File_Lib_LibXMLSec_xmlsecmscrypto Dir = SCP2_OOO_BIN_DIR; Styles = (PACKED); End -#endif -//i20156 - end -#endif +#endif // WNT + +#endif // ENABLE_XMLSEC + File gid_File_Lib_Migrationoo2 TXT_FILE_BODY; @@ -1854,24 +1785,6 @@ STD_LIB_FILE( gid_File_Lib_Oooimprovecore , oooimpc) STD_LIB_FILE( gid_File_Lib_Oooimprovecore , oooimprovecore) #endif -#if defined WNT && !defined _gcc3 && !defined SYSTEM_MOZILLA && !defined WITHOUT_MOZILLA && \ - !(defined M1400 && defined PROF_EDITION && !defined _STLP_DEBUG) - // see common_brand.scp gid_Brand_File_Lib_Msvcp80 and - // gid_Brand_File_Lib_Msvcr80 -File gid_File_Moz_Msvcp80 - TXT_FILE_BODY; - Dir = SCP2_OOO_BIN_DIR; - Name = SCP2_URE_DL_NORMAL("msvcp80"); - Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID); -End -File gid_File_Moz_Msvcr80 - TXT_FILE_BODY; - Dir = SCP2_OOO_BIN_DIR; - Name = SCP2_URE_DL_NORMAL("msvcr80"); - Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID); -End -#endif - #if defined(WNT) File gid_File_Lib_Msvcr100 TXT_FILE_BODY; diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index a206ed82aa3b..a8a7cbc50421 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -1091,17 +1091,6 @@ File gid_File_Mod_Text Name = "text.mod"; End -#if !defined(SYSTEM_MOZILLA) && !defined(WITHOUT_MOZILLA) - -File gid_File_Mozilla_Runtime - TXT_FILE_BODY; - Styles = (ARCHIVE); - Dir = SCP2_OOO_BIN_DIR; - Name = "mozruntime.zip"; -End - -#endif - File gid_File_Share_Registry_Main_Xcd TXT_FILE_BODY; Styles = (PACKED, SCPZIP_REPLACE); diff --git a/scp2/source/ooo/file_resource_ooo.scp b/scp2/source/ooo/file_resource_ooo.scp index 317f2fb3fb37..f062a0fba119 100644 --- a/scp2/source/ooo/file_resource_ooo.scp +++ b/scp2/source/ooo/file_resource_ooo.scp @@ -111,7 +111,7 @@ STD_RES_FILE( gid_File_Res_Xsltdlg, xsltdlg ) STD_RES_FILE( gid_File_Res_AVMedia, avmedia ) -#ifndef WITHOUT_MOZILLA +#ifdef ENABLE_XMLSEC STD_RES_FILE( gid_File_Res_XMLSecurity, xmlsec ) #endif diff --git a/scp2/source/ooo/makefile.mk b/scp2/source/ooo/makefile.mk index eed8ea88ffc3..dc076f1068eb 100644 --- a/scp2/source/ooo/makefile.mk +++ b/scp2/source/ooo/makefile.mk @@ -120,16 +120,15 @@ SCPDEFS+=-DLIBXSLT_MAJOR=$(LIBXSLT_MAJOR) SCPDEFS+=-DUSE_SYSTEM_STL .ENDIF -.IF "$(WITH_MOZILLA)" == "NO" -SCPDEFS+=-DWITHOUT_MOZILLA -.ENDIF - .IF "$(WITH_MYSPELL_DICTS)" == "NO" SCPDEFS+=-DWITHOUT_MYSPELL_DICTS .ENDIF -.IF "$(SYSTEM_MOZILLA)" == "YES" -SCPDEFS+=-DSYSTEM_MOZILLA +.IF "$(ENABLE_NSS_MODULE)" == "YES" +SCPDEFS+=-DENABLE_XMLSEC + .IF "$(SYSTEM_NSS)" != "YES" + SCPDEFS+=-DBUNDLE_NSS_LIBS + .ENDIF .ENDIF .IF "$(WITH_LDAP)" == "YES" diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index d2acefc802db..d014a3a1b40a 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -325,9 +325,6 @@ Module gid_Module_Root_Files_5 gid_File_Lib_Hsqldb_2, gid_File_Lib_Jdbc, gid_File_Lib_Mcnttype, - gid_File_Lib_Mozab_2, - gid_File_Lib_Mozabdrv, - gid_File_Lib_Mozbootstrap, gid_File_Lib_Mysql, gid_File_Lib_Odbc, gid_File_Lib_Officebean, @@ -407,8 +404,6 @@ Module gid_Module_Root_Files_5 gid_File_Lib_Mingw_GccS, gid_File_Lib_Mingw_Stdcpp, gid_File_Lib_Mingwm10, - gid_File_Lib_Msvcp70, - gid_File_Lib_Msvcr70, gid_File_Lib_Ole, gid_File_Lib_Patchmsi, gid_File_Lib_Reg4allmsdoc, @@ -419,8 +414,6 @@ Module gid_Module_Root_Files_5 gid_File_Lib_Gconfebe, gid_File_Lib_Wininetbe, gid_File_Lib_Macbe, - gid_File_Lib_Msvcp70_So, - gid_File_Lib_Msvcr70_So, gid_File_Lib_Gdiplus, gid_File_Lib_Stlport_Vc6, gid_File_Lib_Stlport_Vc7, @@ -716,10 +709,7 @@ Module gid_Module_Root_Files_7 Sortkey = "1900"; Default = YES; Styles = (HIDDEN_ROOT); - Files = (gid_File_Help_Help_Zip, - gid_File_Moz_Msvcp71, - gid_File_Moz_Msvcr71, - gid_File_Mozilla_Runtime); + Files = (gid_File_Help_Help_Zip); End Module gid_Module_Root_Files_Images diff --git a/scp2/source/ooo/ure.scp b/scp2/source/ooo/ure.scp index a908126741d3..5545ab8eed01 100644 --- a/scp2/source/ooo/ure.scp +++ b/scp2/source/ooo/ure.scp @@ -195,74 +195,6 @@ End // Public Dynamic Libraries: -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcr80_Ure - BIN_FILE_BODY; - Styles = (PACKED); - Dir = SCP2_URE_DL_DIR; -#ifndef _STLP_DEBUG - Name = "msvcr80.dll"; -#else - Name = "msvcr80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcp80_Ure - BIN_FILE_BODY; - Styles = (PACKED); - Dir = SCP2_URE_DL_DIR; -#ifndef _STLP_DEBUG - Name = "msvcp80.dll"; -#else - Name = "msvcp80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Lib_Msvcm80_Ure - BIN_FILE_BODY; - Styles = (PACKED); - Dir = SCP2_URE_DL_DIR; -#ifndef _STLP_DEBUG - Name = "msvcm80.dll"; -#else - Name = "msvcm80d.dll"; -#endif -End -#endif -#endif -#endif - -#if defined(WNT) -#if defined(M1400) -#if defined(PROF_EDITION) -File gid_File_Msvcm80crt_Manifest_Ure - BIN_FILE_BODY; - Styles = (PACKED); - Dir = SCP2_URE_DL_DIR; -#ifndef _STLP_DEBUG - Name = "Microsoft.VC80.CRT.manifest"; -#else - Name = "Microsoft.VC80.DebugCRT.manifest"; -#endif -End -#endif -#endif -#endif - File gid_File_Dl_Cppu TXT_FILE_BODY; Dir = SCP2_URE_DL_DIR; @@ -1042,38 +974,6 @@ End #endif -#ifdef WNT -#if defined(M1310) -File gid_File_Dl_Msvcr71 - TXT_FILE_BODY; - Dir = SCP2_URE_DL_DIR; -#if defined _STLP_DEBUG - Name = SCP2_URE_DL_NORMAL("msvcr71d"); -#else - Name = SCP2_URE_DL_NORMAL("msvcr71"); -#endif - Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID); - // CompID = "074DE395-C6EB-47F7-A587-6311F89C14B4"; -End -#endif -#endif - -#if defined(WNT) -#if defined(M1310) -File gid_File_Dl_Msvcp71 - TXT_FILE_BODY; - Dir = SCP2_URE_DL_DIR; -#if defined _STLP_DEBUG - Name = SCP2_URE_DL_NORMAL("msvcp71d"); -#else - Name = SCP2_URE_DL_NORMAL("msvcp71"); -#endif - Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID); - // CompID = "1AF2708A-AAE2-4F25-ADF5-E61A549A51C2"; -End -#endif -#endif - #if defined WNT File gid_File_Dl_Uwinapi TXT_FILE_BODY; @@ -1249,13 +1149,7 @@ Module gid_Module_Root_Ure_Hidden gid_File_Lib_Mingw_GccS_Ure, gid_File_Lib_Mingw_Stdcpp_Ure, gid_File_Lib_Mingwm10_Ure, - gid_File_Dl_Msvcr71, - gid_File_Dl_Msvcp71, gid_File_Dl_Uwinapi, - gid_File_Lib_Msvcr80_Ure, - gid_File_Lib_Msvcp80_Ure, - gid_File_Lib_Msvcm80_Ure, - gid_File_Msvcm80crt_Manifest_Ure, gid_File_Java_UnoloaderJar, gid_File_Java_JuhJar, gid_File_Java_JurtJar, diff --git a/scp2/source/winexplorerext/file_winexplorerext.scp b/scp2/source/winexplorerext/file_winexplorerext.scp index e3592912d518..d19996de0fde 100644 --- a/scp2/source/winexplorerext/file_winexplorerext.scp +++ b/scp2/source/winexplorerext/file_winexplorerext.scp @@ -89,15 +89,6 @@ End #endif -#if defined M1310 -File gid_File_Lib_Shlxthdl_Msvcr71 - TXT_FILE_BODY; - Dir = gid_Dir_Shlxthdl; - Name = SCP2_URE_DL_NORMAL("msvcr71" SCP2_STDLP_DEBUG); - Styles = (PACKED); -End -#endif - File gid_File_Lib_Shlxtmsi TXT_FILE_BODY; Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY); diff --git a/scp2/source/winexplorerext/module_winexplorerext.scp b/scp2/source/winexplorerext/module_winexplorerext.scp index 1dec1582b7ac..aae0aff3b007 100644 --- a/scp2/source/winexplorerext/module_winexplorerext.scp +++ b/scp2/source/winexplorerext/module_winexplorerext.scp @@ -34,7 +34,6 @@ Module gid_Module_Optional_Winexplorerext gid_File_Lib_Shlxthdl64, gid_File_Lib_OOoFilt, gid_File_Lib_OOoFilt64, - gid_File_Lib_Shlxthdl_Msvcr71, gid_File_Lib_Shlxtmsi, gid_File_Lib_Reg64, gid_File_Tmp_Userinstall_Winexplorerext_Inf); diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 0761dea2c60f..5c626aacb83d 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1704,7 +1704,7 @@ SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath(SdrModel& rTargetMod void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj ) { ::basegfx::B2DPolyPolygon xPolyPoly; - if( ::basegfx::tools::importFromSvgD( xPolyPoly, getPath() ) ) + if( ::basegfx::tools::importFromSvgD( xPolyPoly, getPath(), true, 0 ) ) { SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() ); if( pObj ) @@ -1743,7 +1743,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj } } - setPath(::basegfx::tools::exportToSvgD(aPolyPolygon)); + setPath( ::basegfx::tools::exportToSvgD( aPolyPolygon, true, true, true) ); } // ==================================================================== diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 23e16c2cf416..d981b7a0b974 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2853,9 +2853,56 @@ void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettin } SetChanged(); + if(TRG_HasMasterPage()) { TRG_GetMasterPageDescriptorViewContact().ActionChanged(); + + // #119056# For HeaderFooterSettings SdrObjects are used, but the properties + // used are not part of their model data, but kept in SD. This data is applied + // using a 'backdoor' on primitive creation. Thus, the normal mechanism to detect + // object changes does not work here. It is neccessary to trigger updates here + // directly. BroadcastObjectChange used for PagePreview invalidations, + // flushViewObjectContacts used to invalidate and flush all visualizations in + // edit views. + SdPage* pMasterPage = dynamic_cast< SdPage* >(&TRG_GetMasterPage()); + + if(pMasterPage) + { + SdrObject* pCandidate = 0; + + pCandidate = pMasterPage->GetPresObj( PRESOBJ_HEADER ); + + if(pCandidate) + { + const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pCandidate); + pCandidate->GetViewContact().flushViewObjectContacts(); + } + + pCandidate = pMasterPage->GetPresObj( PRESOBJ_DATETIME ); + + if(pCandidate) + { + const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pCandidate); + pCandidate->GetViewContact().flushViewObjectContacts(); + } + + pCandidate = pMasterPage->GetPresObj( PRESOBJ_FOOTER ); + + if(pCandidate) + { + const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pCandidate); + pCandidate->GetViewContact().flushViewObjectContacts(); + } + + pCandidate = pMasterPage->GetPresObj( PRESOBJ_SLIDENUMBER ); + + if(pCandidate) + { + const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pCandidate); + pCandidate->GetViewContact().flushViewObjectContacts(); + } + } } } diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index dcd53baa8a4a..c19f94f451df 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -178,6 +178,15 @@ void DrawViewShell::FuTable(SfxRequest& rReq) pObj->SetStyleSheet( GetDoc()->GetDefaultStyleSheet(), sal_True ); apply_table_style( pObj, GetDoc(), sTableStyle ); + // #123359# if an object is to be replaced/manipulated it may be that it is in text edit mode, + // so to be on the safe side call SdrEndTextEdit here + SdrTextObj* pCheckForTextEdit = dynamic_cast< SdrTextObj* >(pPickObj); + + if(pCheckForTextEdit && pCheckForTextEdit->IsInEditMode()) + { + mpView->SdrEndTextEdit(); + } + // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj if( pPickObj ) { diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 6cc2cb1b2841..3cbe32141814 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -53,7 +53,6 @@ #include <svx/fmglob.hxx> #include <editeng/outliner.hxx> - #include "misc.hxx" #ifdef STARIMAGE_AVAILABLE @@ -146,9 +145,15 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli ) |* \************************************************************************/ -void DrawViewShell::Deactivate(sal_Bool /*bIsMDIActivate*/) +void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate) { - // Do not forward to ViewShell::Deactivate() to prevent a context change. + // Temporarily disable context broadcasting while the Deactivate() + // call is forwarded to our base class. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + ViewShell::Deactivate(bIsMDIActivate); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); } namespace diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 16321bd22345..8878d5e544e1 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -246,7 +246,7 @@ namespace const char* sExportString = "m53570 7650-35430 24100"; CPPUNIT_ASSERT_MESSAGE( "Stroke is m535.7 518.5-354.3-241", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bGreenStrokeSeen = true; } @@ -270,7 +270,7 @@ namespace const char* sExportString = "m49890 5670.00000000001-35430 24090"; CPPUNIT_ASSERT_MESSAGE( "Stroke is m49890 5670.00000000001-35430 24090", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bDashedLineSeen = true; } @@ -328,7 +328,7 @@ namespace const char* sExportString = "m12050 49610c-4310 0-7800-3490-7800-7800 0-4300 " "3490-7790 7800-7790 4300 0 7790 3490 7790 7790 0 4310-3490 7800-7790 7800z"; CPPUNIT_ASSERT_MESSAGE( "Stroke is a 4-bezier circle", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bRedCircleSeen = true; } diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 1490d4c9428d..efa3809af37e 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -358,7 +358,7 @@ void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >:: aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly, true, true, false ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 95fc8b5089b8..76fbcf1b5e13 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -281,7 +281,7 @@ void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* > aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly, true, true, false ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); diff --git a/set_soenv.in b/set_soenv.in index ef96c7d750af..76363e42c561 100644 --- a/set_soenv.in +++ b/set_soenv.in @@ -109,10 +109,10 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL, $COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME, $USE_DIRECTX5, $ATL_LIB, $ATL_LIB_X64, $HAVE_ATLTHUNK, $ATL_INCLUDE, $MFC_LIB, $MFC_INCLUDE, $TMPDIR, $COMMON_BUILD_TOOLS, $WIN_GREP, $WIN_FIND, $WIN_LS, - $WIN_GNUCOPY, $WIN_TOUCH, $STLPORT4, $MOZILLA_VERSION, $MOZILLA_TOOLKIT, $PREBUILD_MOZAB, $MOZILLABUILD, + $WIN_GNUCOPY, $WIN_TOUCH, $STLPORT4, $MOZILLABUILD, $PROEXT, $TARFILE_LOCATION, $ENABLE_HUNSPELL, $ENABLE_HYPHEN, - $SYSTEM_PYTHON, $SYSTEM_MOZILLA, $EPM_FLAGS); + $SYSTEM_PYTHON, $EPM_FLAGS); # #------------------------------------------- # IId. Declaring the aliases. @@ -150,7 +150,6 @@ $warnfile = "warn"; # logfile configure warnings. $Warning = ""; # container for warning messages $STLPORT4 = '@STLPORT4@'; # Location of STLport4 $SYSTEM_PYTHON = '@SYSTEM_PYTHON@'; -$SYSTEM_MOZILLA = '@SYSTEM_MOZILLA@'; $JDK = '@JDK@'; $JAVAFLAGS = '@JAVAFLAGS@'; $MINGW = '@WITH_MINGWIN@'; # use MinGW for Windows build @@ -161,8 +160,6 @@ if ( $MINGW eq "yes" ) else { $CC = PathFormat('@CC@'); # C compiler $CXX = PathFormat('@CXX@'); } # C++ compiler -$MOZILLA_VERSION = '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla -$MOZILLA_TOOLKIT = '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla $FLIPCMD = ""; # Flip '/' to '\' wrapper (only for winnt) $GLIBC = ""; # Whether the platform uses glibc $PROEXT = "@PROEXT@"; @@ -870,40 +867,6 @@ if ($platform =~ m/cygwin/) { $ASM_PATH = PathFormat('@ASM_HOME@'); } -# Check for prebuild mozab libraries if we don't build them # ourselves -# and we're also not using the external system mozilla installation. -# -# FIXME! This check should be done in configure and not here, but -# the $OS, $COM, $CPU variables are not yet present there. -# -if ( "@WITH_MOZILLA@" eq "YES" and "@BUILD_MOZAB@" ne "TRUE" and "@SYSTEM_MOZILLA@" ne "YES" ) -{ print("\nChecking for prebuilt Mozilla libraries ..."); - my $mozbinfile = $SRC_ROOT."/moz/zipped/"; - if ( $^O eq 'MSWin32' ) { - chomp( $mozbinfile = qx{cygpath -d "$mozbinfile"} ); - } - $mozbinfile .= $OS.$COM.$CPU; - if ( -e $mozbinfile."inc.zip" - and -e $mozbinfile."lib.zip" - and -e $mozbinfile."runtime.zip" ) - { print " found.\n"; - $PREBUILD_MOZAB = "YES"; - } - else - { print " not found!\n\n"; - print "If you don\'t use the system mozilla and also not build the needed\n"; - print "mozilla libraries yourself you have to provide the needed files\n"; - print "$OS$COM$CPU\{inc,lib,runtime\}.zip in moz/zipped/ .\n"; - print "These files can be found here:\n"; - print " <http://tools.openoffice.org/moz_prebuild/680/>.\n\n"; - die; - } -} -else -{ - $PREBUILD_MOZAB = ""; -} - # # E. Determining the envionment values based on the information # that was gathered earlier on. @@ -991,6 +954,12 @@ $PERL_PATH = dirname('@PERL@'); # Perl Path $XLIB = PathFormat('@XLIB@'); # X11 libraries $XINC = PathFormat('@XINC@'); # X11 includes +# YD disable autodetection, use PATH +if ( $platform =~ m/os2/ ) +{ + $PERL = 'perl'; + $PERL_PATH = ''; +} # Mac OS X/Darwin only variables. if ( $platform =~ m/darwin/ ) @@ -1397,10 +1366,6 @@ elsif ($platform =~ m/darwin/) } -if ($SYSTEM_MOZILLA eq "YES") -{ - $SOLARLIB .= $L."@MOZ_LIB@" -} # Location of the compiler include search directory paths. $SOLARINC = $I.$cur_dir. @@ -1653,10 +1618,6 @@ ToFile( "PROFULLSWITCH", "@PROFULLSWITCH@", "e" ); ToFile( "PROEXT", $PROEXT, "e" ); ToFile( "VALGRIND_CFLAGS", "@VALGRIND_CFLAGS@", "e" ); ToFile( "UNIXWRAPPERNAME", "@UNIXWRAPPERNAME@","e" ); -ToFile( "BUILD_MOZAB", "@BUILD_MOZAB@", "e" ); -ToFile( "PREBUILD_MOZAB", $PREBUILD_MOZAB, "e" ); -ToFile( "MOZILLA_VERSION", $MOZILLA_VERSION, "e" ); -ToFile( "DEFAULT_MOZILLA_TOOLKIT", $MOZILLA_TOOLKIT, "e" ); ToFile( "ENABLE_NSS_MODULE", "@ENABLE_NSS_MODULE@", "e" ); ToFile( "MOZILLABUILD", "@MOZILLABUILD@", "e" ); ToFile( "BUILD_VER_STRING", "@BUILD_VER_STRING@", "e" ); @@ -1880,17 +1841,7 @@ ToFile( "THES_SYSTEM_DIR", "@THES_SYSTEM_DIR@", "e"); ToFile( "ENABLE_LOCKDOWN", "@ENABLE_LOCKDOWN@", "e" ); ToFile( "WITH_LDAP", "@WITH_LDAP@", "e" ); ToFile( "WITH_OPENLDAP", "@WITH_OPENLDAP@", "e" ); -ToFile( "WITH_MOZILLA", "@WITH_MOZILLA@", "e" ); -ToFile( "SYSTEM_MOZILLA", "@SYSTEM_MOZILLA@", "e" ); -ToFile( "MOZ_FLAVOUR", "@MOZ_FLAVOUR@", "e" ); -ToFile( "NSPR_LIB", "@NSPR_LIB@", "e" ); -ToFile( "NSS_LIB", "@NSS_LIB@", "e" ); ToFile( "MOZ_INC", "@MOZ_INC@", "e" ); -ToFile( "MOZ_LIB", "@MOZ_LIB@", "e" ); -ToFile( "MOZ_LIB_XPCOM", "@MOZ_LIB_XPCOM@", "e" ); -ToFile( "MOZ_NSPR_CFLAGS", "@MOZ_NSPR_CFLAGS@", "e" ); -ToFile( "MOZ_NSS_CFLAGS", "@MOZ_NSS_CFLAGS@", "e" ); -ToFile( "MOZ_LDAP_CFLAGS", "@MOZ_LDAP_CFLAGS@", "e" ); ToFile( "WITH_CATA_FONTS", "@WITH_CATA_FONTS@", "e" ); ToFile( "WITH_CATB_FONTS", "@WITH_CATB_FONTS@", "e" ); ToFile( "WITH_FONTS", "@WITH_FONTS@", "e" ); @@ -1912,6 +1863,7 @@ ToFile( "BUILD_EPM", "@BUILD_EPM@", "e" ); ToFile( "PKGFORMAT", "@PKGFORMAT@", "e" ); ToFile( "SYSTEM_STDLIBS", "@SYSTEM_STDLIBS@", "e" ); ToFile( "SYSTEM_ZLIB", "@SYSTEM_ZLIB@", "e" ); +ToFile( "SYSTEM_NSS", "@SYSTEM_NSS@", "e" ); ToFile( "SYSTEM_OPENSSL", "@SYSTEM_OPENSSL@", "e" ); ToFile( "OPENSSL_CFLAGS", "@OPENSSL_CFLAGS@", "e" ); ToFile( "OPENSSL_LIBS", "@OPENSSL_LIBS@", "e" ); @@ -2006,7 +1958,6 @@ ToFile( "SYSTEM_PANGO", "@SYSTEM_PANGO@", "e" ); ToFile( "SYSTEM_LIBPNG", "@SYSTEM_LIBPNG@", "e" ); ToFile( "SYSTEM_LIBJPEG", "@SYSTEM_LIBJPEG@", "e" ); ToFile( "RAT_JAR_HOME", "@RAT_JAR_HOME@", "e" ); -ToFile( "DISABLE_XAW", "@DISABLE_XAW@", "e" ); ToFile( "DMAKE_URL", "@DMAKE_URL@", "e" ); ToFile( "DMAKE_PATH", "@DMAKE_PATH@", "e" ); ToFile( "IS_SYSTEM_DMAKE", "@IS_SYSTEM_DMAKE@", "e" ); @@ -2080,6 +2031,7 @@ if ( $platform =~ m/os2/ ) ToFile( "LS", "ls.exe", "e" ); ToFile( "GNUCOPY", "cp.exe", "e" ); ToFile( "TOUCH", "touch", "e" ); + ToFile( "CONFIG_SITE", "/@unixroot/usr/share/config.site", "e" ); } # $perlpre is only used for the following three variables diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx index 6636be46ca7b..bcd8a182c222 100644 --- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -263,7 +263,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removing content of " + sCompleteFileName; + mystr = "An error occurred during removing content of " + sCompleteFileName; // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); } } @@ -277,7 +277,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removal of file " + sCompleteFileName; + mystr = "An error occurred during removal of file " + sCompleteFileName; // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK); } } @@ -302,7 +302,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removal of empty directory " + sPath; + mystr = "An error occurred during removal of empty directory " + sPath; // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); bDirectoryRemoved = false; } @@ -339,13 +339,13 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) // } // else // { -// mystr = "An error occured during execution!"; +// mystr = "An error occurred during execution!"; // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); // } if ( ! fSuccess ) { - mystr = "ERROR: An error occured during registration of extensions!"; + mystr = "ERROR: An error occurred during registration of extensions!"; MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK); registrationError = true; } @@ -418,7 +418,7 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle) // } // else // { -// mystr = "An error occured during execution!"; +// mystr = "An error occurred during execution!"; // MessageBox(NULL, mystr.c_str(), "Main methode", MB_OK); // } diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx index d288e62091b1..57f5dc2779f3 100644 --- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx +++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx @@ -127,7 +127,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removing content of " + sCompleteFileName; + mystr = "An error occurred during removing content of " + sCompleteFileName; // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); } } @@ -141,7 +141,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removal of file " + sCompleteFileName; + mystr = "An error occurred during removal of file " + sCompleteFileName; // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK); } } @@ -166,7 +166,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) } else { - mystr = "An error occured during removal of empty directory " + sPath; + mystr = "An error occurred during removal of empty directory " + sPath; // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); bDirectoryRemoved = false; } diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index 2591bcd408e2..a47ab9200059 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -439,14 +439,10 @@ struct CustomPropertyLine CustomPropertiesTimeField m_aTimeField; const String m_sDurationFormat; CustomPropertiesDurationField m_aDurationField; - CustomPropertiesEditButton m_aEditButton; + CustomPropertiesEditButton m_aEditButton; CustomPropertiesYesNoButton m_aYesNoButton; CustomPropertiesRemoveButton m_aRemoveButton; - Point m_aDatePos; - Point m_aTimePos; - Size m_aDateTimeSize; - bool m_bIsRemoved; bool m_bTypeLostFocus; @@ -470,6 +466,9 @@ private: CustomPropertiesYesNoButton m_aYesNoButton; ImageButton m_aRemoveButton; + long m_nDatePosX; + long m_nTimePosX; + sal_Int32 m_nLineHeight; sal_Int32 m_nScrollPos; SvtSysLocale m_aSysLocale; diff --git a/sfx2/inc/sfx2/shell.hxx b/sfx2/inc/sfx2/shell.hxx index 04ee03ed2887..ff16d7046334 100644 --- a/sfx2/inc/sfx2/shell.hxx +++ b/sfx2/inc/sfx2/shell.hxx @@ -265,6 +265,10 @@ public: */ void BroadcastContextForActivation (const bool bIsActivated); + /** Enabled or disable the context broadcaster. Returns the old state. + */ + bool SetContextBroadcasterEnabled (const bool bIsEnabled); + #ifndef _SFXSH_HXX SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); diff --git a/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx b/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx index c103ece0d099..78cea4d3111c 100644 --- a/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx +++ b/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx @@ -44,9 +44,18 @@ public: void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame); void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame); + /** Enable or disable the broadcaster. + @param bIsEnabled + The new value of the "enabled" state. + @return + The old value of the "enabled" state is returned. + */ + bool SetBroadcasterEnabled (const bool bIsEnabled); + private: rtl::OUString msContextName; bool mbIsContextActive; + bool mbIsBroadcasterEnabled; void BroadcastContextChange ( const cssu::Reference<css::frame::XFrame>& rxFrame, diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index cdb37c3528c3..28c18ec670d3 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -1286,6 +1286,7 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* pView ) + void SfxShell::BroadcastContextForActivation (const bool bIsActivated) { SfxViewFrame* pViewFrame = GetFrame(); @@ -1295,3 +1296,11 @@ void SfxShell::BroadcastContextForActivation (const bool bIsActivated) else pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface()); } + + + + +bool SfxShell::SetContextBroadcasterEnabled (const bool bIsEnabled) +{ + return pImp->maContextChangeBroadcaster.SetBroadcasterEnabled(bIsEnabled); +} diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ef1e0e7c8fe3..9bb2b9b0df01 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1844,8 +1844,9 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox ) } else if( nType == CUSTOM_TYPE_DATETIME) { - pLine->m_aDateField.SetPosSizePixel( pLine->m_aDatePos, pLine->m_aDateTimeSize ); - pLine->m_aTimeField.SetPosSizePixel(pLine->m_aTimePos, pLine->m_aDateTimeSize ); + const long nPosY( pLine->m_aDateField.GetPosPixel().Y() ); + pLine->m_aDateField.SetPosPixel( ::Point( m_nDatePosX, nPosY ) ); + pLine->m_aTimeField.SetPosPixel( ::Point( m_nTimePosX, nPosY ) ); } return 0; @@ -1868,10 +1869,15 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu if ( pLine->m_bIsRemoved ) continue; - Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, - &pLine->m_aDateField, &pLine->m_aTimeField, - &pLine->m_aDurationField, &pLine->m_aEditButton, - &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + Window* pWindows[] = { &pLine->m_aNameBox, + &pLine->m_aTypeBox, + &pLine->m_aValueEdit, + &pLine->m_aDateField, + &pLine->m_aTimeField, + &pLine->m_aDurationField, + &pLine->m_aEditButton, + &pLine->m_aYesNoButton, + &pLine->m_aRemoveButton, NULL }; Window** pCurrent = pWindows; while ( *pCurrent ) { @@ -2039,6 +2045,9 @@ void CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa m_nLineHeight = ( m_aRemoveButton.GetPosPixel().Y() * 2 ) + m_aRemoveButton.GetSizePixel().Height(); + + m_nDatePosX = m_aDateField.GetPosPixel().X(); + m_nTimePosX = m_aTimeField.GetPosPixel().X(); } sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const @@ -2093,10 +2102,6 @@ void CustomPropertiesWindow::AddLine( const ::rtl::OUString& sName, Any& rAny ) pCurrent++; pNewCurrent++; } - // - pNewLine->m_aDatePos = pNewLine->m_aDateField.GetPosPixel(); - pNewLine->m_aTimePos = pNewLine->m_aTimeField.GetPosPixel(); - pNewLine->m_aDateTimeSize = pNewLine->m_aDateField.GetSizePixel(); double nTmpValue = 0; bool bTmpValue = false; @@ -2205,8 +2210,15 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos ) if ( pLine->m_bIsRemoved ) continue; - Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField, - &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + Window* pWindows[] = { &pLine->m_aNameBox, + &pLine->m_aTypeBox, + &pLine->m_aValueEdit, + &pLine->m_aDurationField, + &pLine->m_aEditButton, + &pLine->m_aDateField, + &pLine->m_aTimeField, + &pLine->m_aYesNoButton, + &pLine->m_aRemoveButton, NULL }; Window** pCurrent = pWindows; while ( *pCurrent ) { diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx index dab1b3fa76fe..a922358bec00 100644 --- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -39,7 +39,8 @@ namespace sfx2 { namespace sidebar { ContextChangeBroadcaster::ContextChangeBroadcaster (void) : msContextName(), - mbIsContextActive(false) + mbIsContextActive(false), + mbIsBroadcasterEnabled(true) { } @@ -85,11 +86,24 @@ void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFr +bool ContextChangeBroadcaster::SetBroadcasterEnabled (const bool bIsEnabled) +{ + const bool bWasEnabled (mbIsBroadcasterEnabled); + mbIsBroadcasterEnabled = bIsEnabled; + return bWasEnabled; +} + + + + void ContextChangeBroadcaster::BroadcastContextChange ( const cssu::Reference<css::frame::XFrame>& rxFrame, const ::rtl::OUString& rsModuleName, const ::rtl::OUString& rsContextName) { + if ( ! mbIsBroadcasterEnabled) + return; + if (rsContextName.getLength() == 0) return; diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 7154b525bdaa..1bd129aae2f2 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -262,6 +262,7 @@ sal_Int32 DeckLayouter::PlacePanels ( // Place the panel. rPanel.SetPosSizePixel(0, nY, nWidth, nPanelHeight); + rPanel.Invalidate(); nY += nPanelHeight; } diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 184e13f7079e..5e1a2c57732c 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -309,7 +309,12 @@ Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG) { - maDeckActivationFunctor(msDeckId); + try + { + maDeckActivationFunctor(msDeckId); + } + catch( const ::com::sun::star::uno::Exception&) {} // workaround for #i123198# + return 1; } diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 500368707b89..8157119c00a1 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -234,7 +234,7 @@ namespace slideshow ::basegfx::B2DPolyPolygon aPolyPoly; - ENSURE_OR_THROW( ::basegfx::tools::importFromSvgD( aPolyPoly, rSVGDPath ), + ENSURE_OR_THROW( ::basegfx::tools::importFromSvgD( aPolyPoly, rSVGDPath, false, 0 ), "PathAnimation::PathAnimation(): failed to parse SVG:d path" ); ENSURE_OR_THROW( aPolyPoly.count() == 1, "PathAnimation::PathAnimation(): motion path consists of multiple/zero polygon(s)" ); diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index fe8c94496c7d..60f700688ed9 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -103,13 +103,18 @@ use installer::ziplist; ################################################# installer::logger::starttime(); +$installer::logger::Global->add_timestamp("starting logging"); + +# While there is no language set and logger::Lang is not yet tied to a log file, +# forward its output to logger::Global. +$installer::logger::Lang->set_forward($installer::logger::Global); ######################################### # Checking the environment and setting # most important variables ######################################### -installer::logger::print_message( "... checking environment variables ...\n" ); +$installer::logger::Info->print( "... checking environment variables ...\n" ); my $environmentvariableshashref = installer::control::check_system_environment(); installer::environment::set_global_environment_variables($environmentvariableshashref); @@ -153,7 +158,7 @@ my $current_install_number = ""; # Checking the system requirements ###################################### -installer::logger::print_message( "... checking required files ...\n" ); +$installer::logger::Info->print( "... checking required files ...\n" ); installer::control::check_system_path(); my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref); @@ -172,7 +177,7 @@ installer::logger::globallog("zip list file: $installer::globals::ziplistname"); my $ziplistref = installer::files::read_file($installer::globals::ziplistname); -installer::logger::print_message( "... analyzing $installer::globals::ziplistname ... \n" ); +$installer::logger::Info->print( "... analyzing $installer::globals::ziplistname ... \n" ); my ($productblockref, $parent) = installer::ziplist::getproductblock($ziplistref, $installer::globals::product, 1); # product block from zip.lst if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "productblock.log" ,$productblockref); } @@ -361,7 +366,7 @@ if ($installer::globals::setupscript_defined_in_productlist) { installer::setups installer::logger::globallog("setup script file: $installer::globals::setupscriptname"); -installer::logger::print_message( "... analyzing script: $installer::globals::setupscriptname ... \n" ); +$installer::logger::Info->print( "... analyzing script: $installer::globals::setupscriptname ... \n" ); my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname); # Reading the setup script file @@ -406,7 +411,7 @@ if ( $installer::globals::globallogging ) { installer::files::save_file($logging installer::logger::log_hashref($allvariableshashref); -installer::logger::print_message( "... analyzing directories ... \n" ); +$installer::logger::Info->print( "... analyzing directories ... \n" ); # Collect all directories in the script to get the destination dirs @@ -426,7 +431,7 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productdirectories2.log", $dirsinproductarrayref); } -installer::logger::print_message( "... analyzing files ... \n" ); +$installer::logger::Info->print( "... analyzing files ... \n" ); my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles1.log", $filesinproductarrayref); } @@ -470,7 +475,7 @@ if (( $installer::globals::packageformat ne "installed" ) && ( $installer::globa if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2cc.log", $filesinproductarrayref); } } -installer::logger::print_message( "... analyzing scpactions ... \n" ); +$installer::logger::Info->print( "... analyzing scpactions ... \n" ); my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productscpactions1.log", $scpactionsinproductarrayref); } @@ -492,12 +497,12 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productscpactions2.log", $scpactionsinproductarrayref); } -installer::logger::print_message( "... analyzing shortcuts ... \n" ); +$installer::logger::Info->print( "... analyzing shortcuts ... \n" ); my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productlinks1.log", $linksinproductarrayref); } -installer::logger::print_message( "... analyzing unix links ... \n" ); +$installer::logger::Info->print( "... analyzing unix links ... \n" ); my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks1.log", $unixlinksinproductarrayref); } @@ -505,12 +510,12 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash # $unixlinksinproductarrayref = installer::scriptitems::filter_layerlinks_from_unixlinks($unixlinksinproductarrayref); # if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks1b.log", $unixlinksinproductarrayref); } -installer::logger::print_message( "... analyzing profile ... \n" ); +$installer::logger::Info->print( "... analyzing profile ... \n" ); my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profiles1.log", $profilesinproductarrayref); } -installer::logger::print_message( "... analyzing profileitems ... \n" ); +$installer::logger::Info->print( "... analyzing profileitems ... \n" ); my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profileitems1.log", $profileitemsinproductarrayref); } @@ -523,12 +528,12 @@ my $mergemodulesarrayref; if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction { - installer::logger::print_message( "... analyzing folders ... \n" ); + $installer::logger::Info->print( "... analyzing folders ... \n" ); $folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folder1.log", $folderinproductarrayref); } - installer::logger::print_message( "... analyzing folderitems ... \n" ); + $installer::logger::Info->print( "... analyzing folderitems ... \n" ); $folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folderitems1.log", $folderitemsinproductarrayref); } @@ -539,7 +544,7 @@ if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, Fo installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2d.log", $filesinproductarrayref); } - installer::logger::print_message( "... analyzing registryitems ... \n" ); + $installer::logger::Info->print( "... analyzing registryitems ... \n" ); $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems1.log", $registryitemsinproductarrayref); } @@ -547,12 +552,12 @@ if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, Fo $registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems1b.log", $registryitemsinproductarrayref); } - installer::logger::print_message( "... analyzing Windows custom actions ... \n" ); + $installer::logger::Info->print( "... analyzing Windows custom actions ... \n" ); $windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "windowscustomactions1.log", $windowscustomactionsarrayref); } - installer::logger::print_message( "... analyzing Windows merge modules ... \n" ); + $installer::logger::Info->print( "... analyzing Windows merge modules ... \n" ); $mergemodulesarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "MergeModule"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "mergemodules1.log", $mergemodulesarrayref); } @@ -562,7 +567,7 @@ my $modulesinproductarrayref; if (!($installer::globals::is_copy_only_project)) { - installer::logger::print_message( "... analyzing modules ... \n" ); + $installer::logger::Info->print( "... analyzing modules ... \n" ); $modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "modules1.log", $modulesinproductarrayref); } @@ -616,6 +621,7 @@ if ( $installer::globals::debug ) { installer::logger::savedebug($installer::glo if ( $installer::globals::debug ) { installer::logger::debuginfo("\nPart 1b: The language dependent part\n"); } + for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproducts[$n], $allvariableshashref); @@ -623,8 +629,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) $installer::globals::alllanguagesinproductarrayref = $languagesarrayref; my $languagestringref = installer::languages::get_language_string($languagesarrayref); - installer::logger::print_message( "------------------------------------\n" ); - installer::logger::print_message( "... languages $$languagestringref ... \n" ); + $installer::logger::Info->print( "------------------------------------\n" ); + $installer::logger::Info->print( "... languages $$languagestringref ... \n" ); if ( $installer::globals::patch ) { @@ -649,7 +655,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Until now only global logging into default: logfile.txt ############################################################ - @installer::globals::logfileinfo = (); # new logfile array and new logfile name installer::logger::copy_globalinfo_into_logfile(); $installer::globals::globalinfo_copied = 1; @@ -667,13 +672,25 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) $loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id; } - $installer::globals::logfilename = "log_" . $installer::globals::build; - if ( $logminor ne "" ) { $installer::globals::logfilename .= "_" . $logminor; } - $installer::globals::logfilename .= "_" . $loglanguagestring; - $installer::globals::logfilename .= ".log"; + # Setup the directory where the language dependent log file will be stored. $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator; installer::systemactions::create_directory($loggingdir); + # Set language dependent logging. + $installer::globals::logfilename = sprintf("log_%s%s_%s.log", + $installer::globals::build, + $logminor ne "" ? "_" . $logminor : "", + $loglanguagestring); + $installer::logger::Lang->set_filename($loggingdir . $installer::globals::logfilename); + $installer::logger::Lang->copy_lines_from($installer::logger::Global); + $installer::logger::Lang->set_filter(\&installer::control::filter_log_error); + installer::control::prepare_error_processing(); + # All logging to the console is also forwarded to the language dependen log. + $installer::logger::Lang->set_forward(undef); + $installer::logger::Info->set_forward($installer::logger::Lang); + # Scan all log lines for error messages. + $installer::logger::Lang->add_timestamp("starting log for language ".$loglanguagestring); + if ($loglanguagestring ne $loglanguagestring_orig) { (my $dir = $loggingdir) =~ s!/$!!; open(my $F1, "> $dir.dir"); @@ -714,7 +731,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { if ( $allvariableshashref->{'UPDATE_DATABASE'} ) { - installer::logger::print_message( "... analyzing update database ...\n" ); + $installer::logger::Info->print( "... analyzing update database ...\n" ); $refdatabase = installer::windows::update::readdatabase($allvariableshashref, $languagestringref, $includepatharrayref); if ( $installer::globals::updatedatabase ) @@ -776,7 +793,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # files part, language dependent ##################################### - installer::logger::print_message( "... analyzing files ...\n" ); + $installer::logger::Info->print( "... analyzing files ...\n" ); my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles4.log", $filesinproductlanguageresolvedarrayref); } @@ -833,15 +850,11 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles10f.log", $filesinproductlanguageresolvedarrayref); } - # print "... calculating checksums ...\n"; - # my $checksumfile = installer::worker::make_checksum_file($filesinproductlanguageresolvedarrayref, $includepatharrayref); - # if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . $installer::globals::checksumfilename, $checksumfile); } - ###################################################################################### # Unzipping files with flag ARCHIVE and putting all included files into the file list ###################################################################################### - installer::logger::print_message( "... analyzing files with flag ARCHIVE ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag ARCHIVE ...\n" ); my @additional_paths_from_zipfiles = (); @@ -861,7 +874,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag SUBST_FILENAME ##################################### - installer::logger::print_message( "... analyzing files with flag SUBST_FILENAME ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag SUBST_FILENAME ...\n" ); installer::substfilenamefiles::resolving_subst_filename_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, $languagestringref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles12d.log", $filesinproductlanguageresolvedarrayref); } @@ -870,7 +883,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag SCPZIP_REPLACE ##################################### - installer::logger::print_message( "... analyzing files with flag SCPZIP_REPLACE ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag SCPZIP_REPLACE ...\n" ); # Editing files with flag SCPZIP_REPLACE. @@ -881,7 +894,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag PATCH_SO_NAME ##################################### - installer::logger::print_message( "... analyzing files with flag PATCH_SO_NAME ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag PATCH_SO_NAME ...\n" ); # Editing files with flag PATCH_SO_NAME. @@ -892,7 +905,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag HIDDEN ##################################### - installer::logger::print_message( "... analyzing files with flag HIDDEN ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag HIDDEN ...\n" ); installer::worker::resolving_hidden_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles13c.log", $filesinproductlanguageresolvedarrayref); } @@ -901,7 +914,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Collecting directories for epm list file ############################################ - installer::logger::print_message( "... analyzing all directories for this product ...\n" ); + $installer::logger::Info->print( "... analyzing all directories for this product ...\n" ); # There are two ways for a directory to be included into the epm directory list: # 1. Looking for all destination paths in the files array @@ -944,7 +957,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent links part ######################################################### - installer::logger::print_message( "... analyzing links ...\n" ); + $installer::logger::Info->print( "... analyzing links ...\n" ); my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productlinks2.log", $linksinproductlanguageresolvedarrayref); } @@ -973,7 +986,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent unix links part ######################################################### - installer::logger::print_message( "... analyzing unix links ...\n" ); + $installer::logger::Info->print( "... analyzing unix links ...\n" ); my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks3.log", $unixlinksinproductlanguageresolvedarrayref); } @@ -993,7 +1006,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack))) { - installer::logger::print_message( "... creating profiles ...\n" ); + $installer::logger::Info->print( "... creating profiles ...\n" ); $profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profiles2.log", $profilesinproductlanguageresolvedarrayref); } @@ -1035,7 +1048,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for folder ######################################################### - installer::logger::print_message( "... analyzing folder ...\n" ); + $installer::logger::Info->print( "... analyzing folder ...\n" ); $folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folder2.log", $folderinproductlanguageresolvedarrayref); } @@ -1047,7 +1060,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for folderitems ######################################################### - installer::logger::print_message( "... analyzing folderitems ...\n" ); + $installer::logger::Info->print( "... analyzing folderitems ...\n" ); $folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folderitems2.log", $folderitemsinproductlanguageresolvedarrayref); } @@ -1059,7 +1072,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for registryitems ######################################################### - installer::logger::print_message( "... analyzing registryitems ...\n" ); + $installer::logger::Info->print( "... analyzing registryitems ...\n" ); $registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems2.log", $registryitemsinproductlanguageresolvedarrayref); } @@ -1076,7 +1089,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (!($installer::globals::is_copy_only_project)) { - installer::logger::print_message( "... analyzing modules ...\n" ); + $installer::logger::Info->print( "... analyzing modules ...\n" ); $modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes_modules($loggingdir . "modules2.log", $modulesinproductlanguageresolvedarrayref); } @@ -1170,7 +1183,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (( $installer::globals::iswindowsbuild ) && ( ! $installer::globals::patch )) # Windows specific items: Folder, FolderItem, RegistryItem { - installer::logger::print_message( "... creating inf files ...\n" ); + $installer::logger::Info->print( "... creating inf files ...\n" ); installer::worker::create_inf_file($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $modulesinproductlanguageresolvedarrayref, $languagesarrayref, $languagestringref, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles16c.log", $filesinproductlanguageresolvedarrayref); } } @@ -1203,7 +1216,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Analyzing the package structure ########################################################### - installer::logger::print_message( "... analyzing package list ...\n" ); + $installer::logger::Info->print( "... analyzing package list ...\n" ); my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref); installer::packagelist::check_packagelist($packages); @@ -1240,13 +1253,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (!( $installer::globals::iswindowsbuild )) { #################################################### - # Writing log file before packages are packed - #################################################### - - installer::logger::print_message( "... creating log file " . $loggingdir . $installer::globals::logfilename . "\n" ); - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); - - #################################################### # Creating directories #################################################### @@ -1254,8 +1260,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref); my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); - # installer::packagelist::add_defaultpathes_into_filescollector($filesinproductlanguageresolvedarrayref); - # my $installchecksumdir = installer::systemactions::create_directory_next_to_directory($installdir, "checksum"); #################################################### # Reading for Solaris all package descriptions @@ -1362,9 +1366,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) push(@{$packages}, $onepackage); # ... and adding it to the end $installer::globals::poolshiftedpackages{$packagename} = 1; # only shifting each package once $k--; # decreasing the counter - my $localinfoline = "Pool: Package \"$packagename\" cannot be created at the moment. Trying again later (1).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename); + $installer::logger::Lang->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename); next; # repeating this iteration with new package } } @@ -1432,8 +1435,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( ! ( $#{$filesinpackage} > -1 )) { push(@installer::globals::emptypackages, $packagename); - $infoline = "\n\nNo file in package: $packagename \-\> Skipping\n\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n\n", $packagename); next; # next package, end of loop ! } @@ -1447,8 +1451,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $patchfiles = installer::worker::collect_all_items_with_special_flag($filesinpackage ,"PATCH"); if ( ! ( $#{$patchfiles} > -1 )) { - $infoline = "\n\nLinux Patch: No patch file in package: $packagename \-\> Skipping\n\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Linux Patch: No patch file in package: %s \-\> Skipping\n\n", + $packagename); next; } } @@ -1542,7 +1548,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $epmfilename = "epm_" . $onepackagename . $linkaddon . ".lst"; - installer::logger::print_message( "... creating epm list file $epmfilename ... \n" ); + $installer::logger::Info->print( "... creating epm list file $epmfilename ... \n" ); my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename; @@ -1559,8 +1565,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( ! ( $#{$filesinpackage} > -1 )) { push(@installer::globals::emptypackages, $packagename); - $infoline = "\nNo file in package: $packagename \-\> Skipping\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n", $packagename); next; # next package, end of loop ! } } @@ -1612,9 +1618,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) push(@{$packages}, $onepackage); # ... and adding it to the end $installer::globals::poolshiftedpackages{$packagename} = 1; # only shifting each package once $k--; # decreasing the counter - my $localinfoline = "\nPool: Package \"$packagename\" cannot be created at the moment. Trying again later (2).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename); next; # repeating this iteration with new package } } @@ -1622,9 +1629,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $use_package_from_pool == 4 ) # There was a problem with pooling. Repeat this package immediately. { $k--; # decreasing the counter - my $localinfoline = "\nPool: Package \"$packagename\" had pooling problems. Repeating packaging immediately (3).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename); next; # repeating this iteration } @@ -1654,7 +1662,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { # ... now epm can be started, to create the installation sets - installer::logger::print_message( "... starting patched epm ... \n" ); + $installer::logger::Info->print( "... starting patched epm ... \n" ); installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); @@ -1686,7 +1694,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { # ... now epm can be started, to create the installation sets - installer::logger::print_message( "... starting unpatched epm ... \n" ); + $installer::logger::Info->print( "... starting unpatched epm ... \n" ); if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); } @@ -1906,7 +1914,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Begin of functions that are used for the creation of idt files (Windows only) ################################################################################# - installer::logger::print_message( "... creating idt files ...\n" ); + $installer::logger::Info->print( "... creating idt files ...\n" ); installer::logger::include_header_into_logfile("Creating idt files:"); @@ -1998,8 +2006,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir); } - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); # Localizing the language dependent idt files # For every language there will be a localized msi database @@ -2019,7 +2026,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Copy the template idt files and the new created idt files into this language directory - installer::logger::print_message( "... copying idt files ...\n" ); + $installer::logger::Info->print( "... copying idt files ...\n" ); installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:"); @@ -2035,14 +2042,14 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $controlidttable = installer::files::read_file($controlidttablename); installer::windows::idtglobal::add_language_checkboxes_to_database($controlidttable, $languagesarrayref); installer::files::save_file($controlidttablename, $controlidttable); - $infoline = "Added checkboxes for language selection dialog into table $controlidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Added checkboxes for language selection dialog into table %s\n", + $controlidttablename); } # Now all files are copied into a language specific directory # The template idt files can be translated - installer::logger::print_message( "... localizing idt files (language: $onelanguage) ...\n" ); + $installer::logger::Info->print( "... localizing idt files (language: $onelanguage) ...\n" ); installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):"); @@ -2072,10 +2079,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::files::save_file($oneidtfilename, $oneidtfile); - $infoline = "Translated idt file: $oneidtfilename into language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Used languagefile: $languagefilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Translated idt file: %s into language %s\n", + $oneidtfilename, + $onelanguage); + $installer::logger::Lang->printf("Used languagefile: %s\n", $languagefilename); } # setting the encoding in every table (replacing WINDOWSENCODINGTEMPLATE) @@ -2101,8 +2108,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable); installer::files::save_file($controltablename, $controltable); - $infoline = "Added licensefile $licensefilesource into database $controltablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Added licensefile %s into database %s\n", + $licensefilesource, + $controltablename); } # include a component into environment table if required @@ -2160,7 +2168,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage); my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename; - installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" ); + $installer::logger::Info->print( "... creating msi database (language $onelanguage) ... \n" ); installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes @@ -2202,7 +2210,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $allvariableshashref->{'ADDLANGUAGEINDATABASENAME'} ) { installer::windows::msiglobal::add_language_to_msi_database($defaultlanguage, $installdir, $allvariableshashref); } - installer::logger::print_message( "... generating setup.ini ...\n" ); + $installer::logger::Info->print( "... generating setup.ini ...\n" ); if ( ! $allvariableshashref->{'NOLOADERREQUIRED'} ) { installer::windows::msiglobal::create_setup_ini($languagesarrayref, $defaultlanguage, $installdir, $allvariableshashref); } } @@ -2210,7 +2218,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Analyzing the ScpActions and copying the files into the installation set # At least the loader.exe - installer::logger::print_message( "... copying files into installation set ...\n" ); + $installer::logger::Info->print( "... copying files into installation set ...\n" ); # installer::windows::msiglobal::copy_scpactions_into_installset($defaultlanguage, $installdir, $scpactionsinproductlanguageresolvedarrayref); installer::worker::put_scpactions_into_installset($installdir); @@ -2230,7 +2238,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::msiglobal::copy_child_projects_into_installset($installdir, $allvariableshashref); } - installer::logger::print_message( "... creating ddf files ...\n" ); + $installer::logger::Info->print( "... creating ddf files ...\n" ); # Creating all needed ddf files and generating a list # for the package process containing all system calls @@ -2242,17 +2250,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Update and patch reasons the pack order needs to be saved installer::windows::msiglobal::save_packorder(); - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - - #################################### - # Writing log file - # before cab files are packed - #################################### - - installer::logger::print_message( "... creating log file $installer::globals::logfilename \n" ); - - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); + $installer::logger::Info->print("\n"); ####################################################### # Finally really create the installation packages, @@ -2261,17 +2259,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $installer::globals::iswin ) # only possible on a Windows platform { - installer::logger::print_message( "... packaging installation set ... \n" ); + $installer::logger::Info->print( "... packaging installation set ... \n" ); installer::windows::msiglobal::execute_packaging($installer::globals::packjobref, $loggingdir, $allvariableshashref); if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); } - - #################################### - # Writing log file - # after cab files are packed - #################################### - - installer::logger::print_message( "\n... creating log file $installer::globals::logfilename \n" ); - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); } ####################################################### diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm index 931c7eabd2a5..421c418c4afa 100644 --- a/solenv/bin/modules/installer/archivefiles.pm +++ b/solenv/bin/modules/installer/archivefiles.pm @@ -197,12 +197,10 @@ sub resolving_archive_flag { $select_files = 1; $selectlistfiles = get_patch_file_list( $onefile->{'Selectfiles'} ); - $infoline = "Selected file list defined at file: $onefile->{'Name'} :\n"; - push( @installer::globals::logfileinfo, $infoline); - for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ ) + $installer::logging::Lang->printf("Selected file list defined at file: %s :\n", $onefile->{'Name'}); + foreach my $line (@$selectlistfiles) { - $infoline = "\"${$selectlistfiles}[$k]\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logging::Lang->printf("\"%s\"\n", $line); } } @@ -216,12 +214,10 @@ sub resolving_archive_flag { $select_patch_files = 1; # special handling if a Patchlist is defined $patchlistfiles = get_patch_file_list( $onefile->{'Patchfiles'} ); - $infoline = "Patch file list defined at file: $onefile->{'Name'} :\n"; - push( @installer::globals::logfileinfo, $infoline); - for ( my $k = 0; $k <= $#{$patchlistfiles}; $k++ ) + $installer::logger::Lang->printf("Patch file list defined at file: %s :\n", $onefile->{'Name'}); + foreach my $line (@$patchlistfiles) { - $infoline = "\"${$patchlistfiles}[$k]\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\"%s\"\n", $line); } } @@ -254,8 +250,7 @@ sub resolving_archive_flag my $zip = Archive::Zip->new(); if ( $zip->read($sourcepath) != AZ_OK ) { - $infoline = "ERROR: Could not unzip $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not unzip %s\n", $sourcepath); } my $counter = 0; @@ -268,28 +263,27 @@ sub resolving_archive_flag if (! ( $counter > 0 )) # the zipfile is empty { - $infoline = "ERROR: Could not unzip $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("ERROR: Could not unzip %s\n", $sourcepath); } else { if ( $installer::globals::dounzip ) # really unpacking the files { - if ( $zip->extractTree("", $unzipdir) != AZ_OK ) { installer::exiter::exit_program("ERROR: $infoline", "resolving_archive_flag"); } + if ( $zip->extractTree("", $unzipdir) != AZ_OK ) + { + installer::exiter::exit_program("ERROR: can not unzip ".$sourcepath, "resolving_archive_flag"); + } if (( $^O =~ /cygwin/i ) && ( $contains_dll )) { # Make dll's executable $systemcall = "cd $unzipdir; find . -name \\*.dll -exec chmod 775 \{\} \\\;"; $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"\"!\n", $systemcall); } } @@ -299,13 +293,10 @@ sub resolving_archive_flag $systemcall = "cd $unzipdir; find . -type d -exec chmod 775 \{\} \\\;"; $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"\"!\n", $systemcall); } } @@ -363,8 +354,10 @@ sub resolving_archive_flag { my $value = sprintf("%o", (stat($newfile{'sourcepath'}))[2]); $newfile{'UnixRights'} = substr($value, 3); - $infoline = "Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Setting unix rights for \"%s\" to \"%s\"\n", + $newfile{'sourcepath'}, + $newfile{'UnixRights'}); } if ( $set_executable_privileges ) @@ -375,8 +368,10 @@ sub resolving_archive_flag if ( exists($executable_files_in_extensions{$compare_path}) ) { $newfile{'UnixRights'} = "775"; - $infoline = "Executable in Extension: Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Executable in Extension: Setting unix rights for \"%s\" to \"%s\"\n", + $newfile{'sourcepath'}, + $newfile{'UnixRights'}); } } @@ -384,14 +379,16 @@ sub resolving_archive_flag { if ( ! installer::existence::exists_in_array($zipname,$selectlistfiles) ) { - $infoline = "Removing from ARCHIVE file $onefilename: $zipname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Removing from ARCHIVE file %s: %s\n", + $onefilename, + $zipname); next; # ignoring files, that are not included in $selectlistfiles } else { - $infoline = "Keeping from ARCHIVE file $onefilename: $zipname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Keeping from ARCHIVE file %s: \n", + $onefilename, + $zipname); push( @keptfiles, $zipname); # collecting all kept files } } @@ -407,13 +404,9 @@ sub resolving_archive_flag $newfile{'Styles'} =~ s/\,\s*\,/\,/; $newfile{'Styles'} =~ s/\(\s*\,/\(/; $newfile{'Styles'} =~ s/\,\s*\)/\)/; - # $infoline = "Removing PATCH flag from: $zipname\n"; - # push( @installer::globals::logfileinfo, $infoline); } else { - # $infoline = "Keeping PATCH flag at: $zipname\n"; - # push( @installer::globals::logfileinfo, $infoline); push( @keptpatchflags, $zipname); # collecting all PATCH flags } } @@ -430,15 +423,15 @@ sub resolving_archive_flag $newfile{'destination'} = $destination . $newzipname; $newfile{'sourcepath'} = $unzipdir . $newzipname; - $infoline = "RENAME_TO_LANGUAGE: Using $newzipname instead of $zipname!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("RENAME_TO_LANGUAGE: Using %s instead of %s!\n", + $newzipname, + $zipname); } my $sourcefiletest = $unzipdir . $zipname; if ( ! -f $sourcefiletest ) { - $infoline = "ATTENTION: Unzip failed for $sourcefiletest!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Unzip failed for %s!\n", $sourcefiletest); $unziperror = 1; } @@ -455,35 +448,25 @@ sub resolving_archive_flag if ( $select_files ) { - my $number = $#{$selectlistfiles} + 1; - $infoline = "SELECTLIST: Number of files in file selection list: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - $number = $#keptfiles + 1; - $infoline = "SELECTLIST: Number of kept files: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#keptfiles; $k++ ) + $installer::logger::Lang->printf("SELECTLIST: Number of files in file selection list: %d\n", + scalar @$selectlistfiles); + $installer::logger::Lang->printf("SELECTLIST: Number of kept files: %d\n", + scalar @keptfiles); + + foreach my $name (@keptfiles) { - $infoline = "KEPT FILES: $keptfiles[$k]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("KEPT FILES: %s\n", $name); } - my @warningfiles = (); - - for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ ) + foreach my $name (@$selectlistfiles) { - if ( ! installer::existence::exists_in_array(${$selectlistfiles}[$k],\@keptfiles) ) + if ( ! installer::existence::exists_in_array($name,\@keptfiles) ) { - push(@warningfiles, ${$selectlistfiles}[$k]); + $installer::logger::Lang->printf( + "WARNING: %s not included in install set (does not exist in zip file)!\n", + $name);; } } - - for ( my $k = 0; $k <= $#warningfiles; $k++ ) - { - $infoline = "WARNING: $warningfiles[$k] not included in install set (does not exist in zip file)!\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } # Comparing the content of @keptpatchflags and $patchlistfiles @@ -493,41 +476,32 @@ sub resolving_archive_flag if ( $select_patch_files ) { - my $number = $#{$patchlistfiles} + 1; - $infoline = "PATCHLIST: Number of files in patch list: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - $number = $#keptpatchflags + 1; - $infoline = "PATCHLIST: Number of kept PATCH flags: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#keptpatchflags; $k++ ) + $installer::logger::Lang->printf("PATCHLIST: Number of files in patch list: %d\n", + scalar @$patchlistfiles); + $installer::logger::Lang->printf("PATCHLIST: Number of kept PATCH flags: %d\n", + scalar @keptpatchflags); + + foreach my $flag (@keptpatchflags) { - $infoline = "KEPT PATCH FLAGS: $keptpatchflags[$k]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("KEPT PATCH FLAGS: %s\n", + $flag); } - my @warningfiles = (); - - for ( my $k = 0; $k <= $#{$patchlistfiles}; $k++ ) + foreach my $name (@$patchlistfiles) { - if ( ! installer::existence::exists_in_array(${$patchlistfiles}[$k],\@keptpatchflags) ) + if ( ! installer::existence::exists_in_array($name,\@keptpatchflags) ) { - push(@warningfiles, ${$patchlistfiles}[$k]); + $installer::logger::Lang->printf( + "WARNING: %s did not keep PATCH flag (does not exist in zip file)!\n", + $name); } } - - for ( my $k = 0; $k <= $#warningfiles; $k++ ) - { - $infoline = "WARNING: $warningfiles[$k] did not keep PATCH flag (does not exist in zip file)!\n"; - push( @installer::globals::logfileinfo, $infoline); - } } if ( $unziperror ) { installer::logger::print_warning( "Repeating to unpack $sourcepath! \n" ); - $infoline = "ATTENTION: Repeating to unpack $sourcepath !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Repeating to unpack %s!\n", $sourcepath); $repeat_unzip = 1; $maxcounter++; @@ -538,8 +512,7 @@ sub resolving_archive_flag } else { - $infoline = "Info: $sourcepath unpacked without problems !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: %s unpacked without problems !\n", $sourcepath); $repeat_unzip = 0; $maxcounter = 0; } @@ -551,8 +524,7 @@ sub resolving_archive_flag } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); return \@newallfilesarray; } diff --git a/solenv/bin/modules/installer/configuration.pm b/solenv/bin/modules/installer/configuration.pm index 325e9fa96ce7..5444f946ff47 100644 --- a/solenv/bin/modules/installer/configuration.pm +++ b/solenv/bin/modules/installer/configuration.pm @@ -760,18 +760,16 @@ sub save_and_zip_configfile chdir($currentdir); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not zip $savefilename to $zipfilename\n"; + $installer::logger::Lang->printf("ERROR: Could not zip %s to %s\n", $savefilename, $zipfilename); } else { - $infoline = "SUCCESS: Zipped file $savefilename to $zipfilename\n"; + $installer::logger::Lang->printf("SUCCESS: Zipped file %s to %s\n", $savefilename, $zipfilename); } - push( @installer::globals::logfileinfo, $infoline); return $zipfilename; } @@ -889,9 +887,7 @@ sub create_configuration_files } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->print("\n"); } 1; diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index bad8c9835c0d..2974b949e5f1 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -32,6 +32,8 @@ use installer::pathanalyzer; use installer::scriptitems; use installer::systemactions; +our @ErrorMessages = undef; + ######################################################### # Function that can be used for additional controls. # Search happens in $installer::globals::patharray. @@ -41,9 +43,10 @@ sub check_needed_files_in_path { my ( $filesref ) = @_; - foreach $onefile ( @{$filesref} ) + my $error = 0; + foreach my $onefile ( @{$filesref} ) { - installer::logger::print_message( "...... searching $onefile ..." ); + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $installer::globals::patharray , 0); @@ -54,7 +57,7 @@ sub check_needed_files_in_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->print( "\tFound: $$fileref\n" ); } } @@ -73,7 +76,6 @@ sub check_system_path { # The following files have to be found in the environment variable PATH # All platforms: zip - # Windows only: msvcp70.dll, msvcr70.dll for regcomp.exe # Windows only: "msiinfo.exe", "msidb.exe", "uuidgen.exe", "makecab.exe", "msitran.exe", "expand.exe" for msi database and packaging my $onefile; @@ -101,19 +103,6 @@ sub check_system_path if (($installer::globals::iswin) && ($installer::globals::iswindowsbuild)) { @needed_files_in_path = ("zip.exe", "msiinfo.exe", "msidb.exe", "uuidgen.exe", "makecab.exe", "msitran.exe", "expand.exe"); - - if ( $installer::globals::compiler eq "wntmsci8" ) - { - push(@needed_files_in_path, "msvcp70.dll"); - push(@needed_files_in_path, "msvcr70.dll"); - } - - if ( $installer::globals::compiler eq "wntmsci10" ) - { - push(@needed_files_in_path, "msvcp71.dll"); - push(@needed_files_in_path, "msvcr71.dll"); - } - } elsif ($installer::globals::iswin || $installer::globals::isos2) { @@ -126,7 +115,7 @@ sub check_system_path foreach $onefile ( @needed_files_in_path ) { - installer::logger::print_message( "...... searching $onefile ..." ); + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $patharrayref , 0); @@ -137,7 +126,7 @@ sub check_system_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->print( "\tFound: $$fileref\n" ); # Saving the absolut path for msitran.exe. This is required for the determination of the checksum. if ( $onefile eq "msitran.exe" ) { $installer::globals::msitranpath = $$fileref; } } @@ -180,7 +169,7 @@ sub check_system_path { $installer::globals::upx_in_path = 1; $installer::globals::upxfile = $$upxfileref; - installer::logger::print_message( "\tFound: $$upxfileref\n" ); + $installer::logger::Info->print( "\tFound: $$upxfileref\n" ); } } @@ -204,13 +193,11 @@ sub get_makecab_version if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Success: Executed \"%s\" successfully!\n", $systemcall); my $versionline = ""; @@ -223,8 +210,7 @@ sub get_makecab_version } } - $infoline = $versionline; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("%s\n", $versionline); if ( $versionline =~ /\bVersion\b\s+(\d+[\d\.]+\d+)\s+/ ) { @@ -238,8 +224,7 @@ sub get_makecab_version $makecabversion = $1; } - $infoline = "Using version: " . $makecabversion . "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Using version: %s\n", $makecabversion); } return $makecabversion; @@ -258,8 +243,7 @@ sub check_makecab_version my $makecabversion = get_makecab_version(); - my $infoline = "Tested version: " . $installer::globals::controlledmakecabversion . "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Tested version: %s\n", $installer::globals::controlledmakecabversion); if ( $makecabversion < 0 ) { $do_check = 0; } # version could not be determined @@ -280,8 +264,7 @@ sub check_makecab_version } else { - $infoline = "Warning: No version check of makecab.exe\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Warning: No version check of makecab.exe\n"); } } @@ -317,113 +300,120 @@ sub check_system_environment return \%variables; } -############################################################# -# Controlling the log file at the end of the -# packaging process -############################################################# -sub check_logfile +sub prepare_error_processing () { - my ($logfile) = @_; + @ErrorMessages = (); +} - my @errors = (); - my @output = (); - my $contains_error = 0; +=item filter_log_error ($relative_time, $log_id, $process_id, $message) - my $ignore_error = 0; - my $make_error_to_warning = 0; + Process the given log message. Returns $message unaltered. - if (( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile )) { $ignore_error = 1; } +=cut +sub filter_log_error ($$$$) +{ + my ($relative_time, $log_id, $process_id, $message) = @_; - for ( my $i = 0; $i <= $#{$logfile}; $i++ ) + if ($message =~ /\berror\b/i) { - my $line = ${$logfile}[$i]; - - # Errors are all errors, but not the Windows installer table "Error.idt" + # Message contains the word "error". Now we have to find out if it is relevant. - my $compareline = $line; - $compareline =~ s/Error\.idt//g; # removing all occurences of "Error.idt" - $compareline =~ s/Error\.mlf//g; # removing all occurences of "Error.mlf" - $compareline =~ s/Error\.ulf//g; # removing all occurences of "Error.ulf" - $compareline =~ s/Error\.idl//g; # removing all occurences of "Error.idl" - $compareline =~ s/Error\.html//g; # removing all occurences of "Error.html" - # Ugly workaround for (boost) headers - $compareline =~ s/error\.hpp//g; # removing all occurences of "error.hpp" - $compareline =~ s/error\.ipp//g; # removing all occurences of "error.ipp" + # Remove all filenames that contain the word "Error". + my $work_string = $message; + $work_string =~ s/Error\.(idt|mlf|ulf|html|hpp|ipp)//g; - if ( $compareline =~ /\bError\b/i ) + if ($work_string =~ /\bError\b/i) { - $contains_error = 1; - push(@errors, $line); - - if ( $ignore_error ) - { - $contains_error = 0; - $make_error_to_warning = 1; - } + # This really is an error message. + push @ErrorMessages, {'relative_time' => $relative_time, + 'message' => $message}; } } - if ($contains_error) - { - my $line = "\n*********************************************************************\n"; - push(@output, $line); - $line = "ERROR: The following errors occured in packaging process:\n\n"; - push(@output, $line); + return $message; +} - for ( my $i = 0; $i <= $#errors; $i++ ) - { - $line = "$errors[$i]"; - push(@output, $line); - } - $line = "*********************************************************************\n"; - push(@output, $line); -# exit(-1); - } - else + + +sub printocessed_error_lines () +{ + my $lines = []; + + foreach my $line (@ErrorMessages) { - my $line = ""; + push @$lines, sprintf(" %12.6f : %s", $line->{'relative_time'}, $line->{'message'}); + } - if ( $make_error_to_warning ) - { - $line = "\n*********************************************************************\n"; - push(@output, $line); - $line = "The following errors in the log file were ignored:\n\n"; - push(@output, $line); + return $lines; +} - for ( my $i = 0; $i <= $#errors; $i++ ) - { - $line = "$errors[$i]"; - push(@output, $line); - } - $line = "*********************************************************************\n"; - push(@output, $line); + + +=item check_logfile() + + Print all error messages (typically at the end) on the console. + +=cut +sub check_logfile () +{ + my ($logfile) = @_; + + my @errors = (); + my @output = (); + + my $ignore_errors = ( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile ); + my $contains_errors = scalar @ErrorMessages > 0; + + # Format errors + if ($contains_errors) + { + push(@output, "\n"); + push(@output, "*********************************************************************\n"); + if ($ignore_errors) + { + push(@output, "The following errors in the log file were ignored:\n"); + } + else + { + push(@output, "ERROR: The following errors occured in packaging process:\n"); + } + push(@output, "\n"); + + foreach my $line (@ErrorMessages) + { + push @output, sprintf(" %12.6f : %s", $line->{'relative_time'}, $line->{'message'}); } - $line = "\n***********************************************************\n"; - push(@output, $line); - $line = "Successful packaging process!\n"; - push(@output, $line); - $line = "***********************************************************\n"; - push(@output, $line); + push(@output, "*********************************************************************\n"); } - # printing the output file and adding it to the logfile + # Claim success if there where no errors or if errors are treated as warnings. + if ( ! $contains_errors || $ignore_errors) + { + push(@output, "\n"); + push(@output, "***********************************************************\n"); + push(@output, "Successful packaging process!\n"); + push(@output, "***********************************************************\n"); + } + # Print the summary. installer::logger::include_header_into_logfile("Summary:"); - my $force = 1; # print this message even in 'quiet' mode - for ( my $i = 0; $i <= $#output; $i++ ) + foreach my $line (@output) { - my $line = "$output[$i]"; - installer::logger::print_message( "$line", $force ); - push( @installer::globals::logfileinfo, $line); - push( @installer::globals::errorlogfileinfo, $line); + $installer::logger::Info->print($line, $force); } - return $contains_error; + # Delete the accumulated error messages. The @ErrorMessages will now contain + # lines caused by printing those error messages. + @ErrorMessages = (); + + @installer::globals::errorlogfileinfo = @output; + + return $contains_error && ! $ignore_error; } ############################################################# @@ -471,8 +461,8 @@ sub determine_ship_directory $installer::globals::build . "_" . $installer::globals::lastminor . "_" . "native_inprogress-number_" . $languagestring . "\." . $installer::globals::buildid; - my $infoline = "\nSetting ship directory: $destdir\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Setting ship directory: %s\n", $destdir); return $destdir; } @@ -489,44 +479,40 @@ sub check_updatepack if ( $ENV{'UPDATER'} ) # the environment variable UPDATER has to be set { - $infoline = "\nEnvironment variable UPDATER set\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); + $installer::logger::Global->print("Environment variable UPDATER set\n"); if ( ! $ENV{'CWS_WORK_STAMP'} ) # the environment variable CWS_WORK_STAMP must not be set (set only in CWS) { - $infoline = "Environment variable CWS_WORK_STAMP not set\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable CWS_WORK_STAMP not set\n"); if ( $ENV{'SHIPDRIVE'} ) # the environment variable SHIPDRIVE must be set { $shipdrive = $ENV{'SHIPDRIVE'}; - $infoline = "Ship drive defined: $shipdrive\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Ship drive defined: %s\n", $shipdrive); if ( -d $shipdrive ) # SHIPDRIVE must be a directory { - $infoline = "Ship drive exists\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Ship drive exists\n"); # try to write into $shipdrive - $directory = $installer::globals::product . "_" . $installer::globals::compiler . "_" . $installer::globals::buildid . "_" . $installer::globals::languageproducts[0] . "_test_$$"; + my $directory = $installer::globals::product . "_" . $installer::globals::compiler . "_" . $installer::globals::buildid . "_" . $installer::globals::languageproducts[0] . "_test_$$"; $directory =~ s/\,/\_/g; # for the list of languages $directory =~ s/\-/\_/g; # for en-US, pt-BR, ... $directory = $shipdrive . $installer::globals::separator . $directory; - $infoline = "Try to create directory: $directory\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Try to create directory: %s\n", $directory); # saving this directory for later removal $installer::globals::shiptestdirectory = $directory; if ( installer::systemactions::try_to_create_directory($directory)) { - $infoline = "Write access on Ship drive\n"; - push(@installer::globals::globallogfileinfo, $infoline); - $infoline = "Ship test directory $installer::globals::shiptestdirectory was successfully created\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Write access on Ship drive\n"); + $installer::logger::Global->print( + "Ship test directory %s was successfully created\n", + $installer::globals::shiptestdirectory); my $systemcall = "rmdir $directory"; my $returnvalue = system($systemcall); @@ -537,8 +523,7 @@ sub check_updatepack my $sol_tmp; if ( $ENV{'SOLARENV'} ) { $solarenv = $ENV{'SOLARENV'}; } - $infoline = "Environment variable SOLARENV: $solarenv\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Environment variable SOLARENV: %s\n", $solarenv); if ( $ENV{'SOL_TMP'} ) { @@ -547,17 +532,15 @@ sub check_updatepack } else { $infoline = "Environment variable SOL_TMP not set\n"; } - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); if ( defined $sol_tmp && ( $solarenv =~ /^\s*\Q$sol_tmp\E/ )) { - $infoline = "Content of SOLARENV starts with the content of SOL_TMP\: Local environment -\> No Updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Content of SOLARENV starts with the content of SOL_TMP\: Local environment -\> No Updatepack\n"); } else { - $infoline = "Content of SOLARENV does not start with the content of SOL_TMP: No local environment\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Content of SOLARENV does not start with the content of SOL_TMP: No local environment\n"); $installer::globals::updatepack = 1; # That's it } @@ -566,48 +549,53 @@ sub check_updatepack if ( -d $installer::globals::shiptestdirectory ) { - $infoline = "Ship test directory $installer::globals::shiptestdirectory still exists. Trying removal later again.\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Ship test directory %s still exists. Trying removal later again.\n", + $installer::globals::shiptestdirectory); } else { - $infoline = "Ship test directory $installer::globals::shiptestdirectory was successfully removed.\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Ship test directory %s was successfully removed.\n", + $installer::globals::shiptestdirectory); } } else { - $infoline = "No write access on Ship drive\n"; - push(@installer::globals::globallogfileinfo, $infoline); - $infoline = "Failed to create directory $directory\n"; - push(@installer::globals::globallogfileinfo, $infoline); - if ( defined $ENV{'BSCLIENT'} && ( uc $ENV{'BSCLIENT'} eq 'TRUE' ) ) { + $installer::logger::Global->print("No write access on Ship drive\n"); + $installer::logger::Global->printf("Failed to create directory \n", $directory); + if ( defined $ENV{'BSCLIENT'} && ( uc $ENV{'BSCLIENT'} eq 'TRUE' ) ) + { installer::exiter::exit_program("ERROR: No write access to SHIPDRIVE allthough BSCLIENT is set.", "check_updatepack"); } } } else { - $infoline = "Ship drive not found: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Ship drive not found: No updatepack\n"); } } else { - $infoline = "Environment variable SHIPDRIVE not set: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable SHIPDRIVE not set: No updatepack\n"); } } else { - $infoline = "Environment variable CWS_WORK_STAMP defined: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable CWS_WORK_STAMP defined: No updatepack\n"); } } - if ( $installer::globals::updatepack ) { $infoline = "Setting updatepack true\n\n"; } - else { $infoline = "\nNo updatepack\n"; } - push(@installer::globals::globallogfileinfo, $infoline); + if ( $installer::globals::updatepack ) + { + $installer::logger::Global->print("Setting updatepack true\n"); + $installer::logger::Global->print("\n"); + } + else + { + $installer::logger::Global->print("\n"); + $installer::logger::Global->print("No updatepack\n"); + } } @@ -623,8 +611,7 @@ sub read_encodinglist if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Did not find Windows encoding list $installer::globals::encodinglistname!", "read_encodinglist"); } - my $infoline = "Found encoding file: $$fileref\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Found encoding file: %s\n", $$fileref); my $encodinglist = installer::files::read_file($$fileref); @@ -720,8 +707,9 @@ sub set_addchildprojects $installer::globals::addchildprojects = 0; # no child projects for patches } - my $infoline = "Value of \$installer::globals::addchildprojects: $installer::globals::addchildprojects\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addchildprojects: %s\n", + $installer::globals::addchildprojects); } #################################################################### @@ -738,8 +726,9 @@ sub set_addjavainstaller if ( $installer::globals::languagepack ) { $installer::globals::addjavainstaller = 0; } if ( $allvariableshashref->{'XPDINSTALLER'} ) { $installer::globals::addjavainstaller = 0; } - my $infoline = "Value of \$installer::globals::addjavainstaller: $installer::globals::addjavainstaller\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addjavainstaller: %s\n", + $installer::globals::addjavainstaller); } ####################################################################### @@ -756,8 +745,9 @@ sub set_addsystemintegration if ( $installer::globals::languagepack ) { $installer::globals::addsystemintegration = 0; } if (( $installer::globals::packageformat eq "native" ) || ( $installer::globals::packageformat eq "portable" )) { $installer::globals::addsystemintegration = 0; } - my $infoline = "Value of \$installer::globals::addsystemintegration: $installer::globals::addsystemintegration\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addsystemintegration: %s\n", + $installer::globals::addsystemintegration); } 1; diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm index 1d7d64d4aa36..bc6a994885bd 100644 --- a/solenv/bin/modules/installer/download.pm +++ b/solenv/bin/modules/installer/download.pm @@ -52,8 +52,7 @@ sub put_productname_into_script $productname =~ s/\.//g; # openoffice.org -> openofficeorg $productname =~ s/\s*//g; - my $infoline = "Adding productname $productname into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding productname %s into download shell script\n", $productname); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -71,8 +70,7 @@ sub put_linenumber_into_script my $linenumber = $#{$scriptfile} + 2; - my $infoline = "Adding linenumber $linenumber into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding linenumber %d into download shell script\n", $linenumber); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -92,8 +90,7 @@ sub determine_scriptfile_name $filename = $filename . $installer::globals::downloadfileextension; $installer::globals::downloadfilename = $filename; - my $infoline = "Setting download shell script file name to $filename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting download shell script file name to %s\n", $filename); return $filename; } @@ -109,8 +106,7 @@ sub save_script_file $newscriptfilename = $directory . $installer::globals::separator . $newscriptfilename; installer::files::save_file($newscriptfilename, $scriptfile); - my $infoline = "Saving script file $newscriptfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Saving script file %s\n", $newscriptfilename); if ( ! $installer::globals::iswindowsbuild ) { @@ -142,8 +138,8 @@ sub put_checksum_and_size_into_script installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/sum: $sumout", "put_checksum_and_size_into_script"); } - my $infoline = "Adding checksum $checksum and size $size into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Adding checksum %s and size %s into download shell script\n", $checksum, $size); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -175,18 +171,15 @@ sub call_md5sum my $returnvalue = $?; # $? contains the return value of the systemcall - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("Success: Executed \"%s\" successfully!\n", $systemcall); } return $md5sumoutput; @@ -211,8 +204,7 @@ sub get_md5sum installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/md5sum: $md5sumoutput", "get_md5sum"); } - my $infoline = "Setting md5sum: $md5sum\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting md5sum: %s\n", $md5sum); return $md5sum; } @@ -235,18 +227,15 @@ sub call_sum my $returnvalue = $?; # $? contains the return value of the systemcall - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } $sumoutput =~ s/\s+$filename\s$//; @@ -290,18 +279,15 @@ sub include_tar_into_script my $systemcall = "cat $temporary_tarfile >> $scriptfile && rm $temporary_tarfile"; my $returnvalue = system($systemcall); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } return $returnvalue; } @@ -321,18 +307,15 @@ sub tar_package my $returnvalue = system($systemcall); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"\" successfully!\n", $systemcall); } my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1"; @@ -349,7 +332,6 @@ sub create_tar_gz_file_from_package { my ($installdir, $getuidlibrary) = @_; - my $infoline = ""; my $alldirs = installer::systemactions::get_all_directories($installdir); my $onedir = ${$alldirs}[0]; $installdir = $onedir; @@ -362,18 +344,15 @@ sub create_tar_gz_file_from_package my $systemcall = "cd $installdir; rm $onefile"; my $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } } @@ -394,18 +373,15 @@ sub create_tar_gz_file_from_package my $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } } @@ -761,24 +737,20 @@ sub get_versionstring sub get_current_version { - my $infoline = ""; my $versionstring = ""; my $filename = "version.info"; # $filename = $installer::globals::ooouploaddir . $installer::globals::separator . $filename; if ( -f $filename ) { - $infoline = "File $filename exists. Trying to find current version.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("File %s exists. Trying to find current version.\n", $filename); my $versionfile = installer::files::read_file($filename); $versionstring = get_versionstring($versionfile); - $infoline = "Setting version string: $versionstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting version string: %s\n", $versionstring); } else { - $infoline = "File $filename does not exist. No version setting in download file name.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("File %s does not exist. No version setting in download file name.\n", $filename); } $installer::globals::oooversionstring = $versionstring; @@ -826,8 +798,6 @@ sub create_tar_gz_file_from_directory { my ($installdir, $getuidlibrary, $downloaddir, $downloadfilename) = @_; - my $infoline = ""; - my $packdir = $installdir; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packdir); my $changedir = $installdir; @@ -844,18 +814,15 @@ sub create_tar_gz_file_from_directory my $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } return $targzname; @@ -912,8 +879,7 @@ sub replace_one_variable { my ($templatefile, $placeholder, $value) = @_; - my $infoline = "Replacing $placeholder by $value in nsi file\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Replacing %s by %s in nsi file\n", $placeholder, $value); for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) { @@ -1107,7 +1073,7 @@ sub put_website_into_template { my ($templatefile) = @_; - my $website = "http\:\/\/www\.sun\.com\/staroffice"; + my $website = "http\:\/\/www\.openoffice\.org"; replace_one_variable($templatefile, "WEBSITEPLACEHOLDER", $website); } @@ -1309,11 +1275,10 @@ sub nsis_language_converter elsif ( $language eq "vi" ) { $nsislanguage = "Vietnamese"; } elsif ( $language eq "zh-CN" ) { $nsislanguage = "SimpChinese"; } elsif ( $language eq "zh-TW" ) { $nsislanguage = "TradChinese"; } - else { - my $infoline = "NSIS language_converter : Could not find nsis language for $language!\n"; - push( @installer::globals::logfileinfo, $infoline); + else + { + $installer::logger::Lang->printf("NSIS language_converter : Could not find nsis language for %s!\n", $language); $nsislanguage = "English"; - # installer::exiter::exit_program("ERROR: Could not find nsis language for $language!", "nsis_language_converter"); } return $nsislanguage; @@ -1472,8 +1437,11 @@ sub replace_identifier_in_nshfile { my $oldstring = $1; ${$nshfile}[$i] =~ s/\Q$oldstring\E/$newstring/; - my $infoline = "NSIS replacement in $nshfilename ($onelanguage): $oldstring \-\> $newstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("NSIS replacement in %s (%s): \-\> %s\n", + $nshfilename, + $onelanguage, + $oldstring, + $newstring); } } } @@ -1497,8 +1465,11 @@ sub replace_identifier_in_nlffile my $oldstring = ${$nlffile}[$next]; ${$nlffile}[$next] = $newstring . "\n"; $oldstring =~ s/\s*$//; - my $infoline = "NSIS replacement in $nlffilename ($onelanguage): $oldstring \-\> $newstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("NSIS replacement in %s (%s): %s \-\> %s\n", + $nlffilename, + $onelanguage, + $oldstring, + $newstring); } } } @@ -1620,8 +1591,6 @@ sub copy_and_translate_nsis_language_files my $nlffilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Language\ files" . $installer::globals::separator; my $nshfilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Modern\ UI" . $installer::globals::separator . "Language files" . $installer::globals::separator; - my $infoline = ""; - for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) { my $onelanguage = ${$languagesarrayref}[$i]; @@ -1656,8 +1625,7 @@ sub copy_and_translate_nsis_language_files if ( $installer::globals::unicodensis ) { - $infoline = "This is Unicode NSIS!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("This is Unicode NSIS!\n"); convert_utf16_to_utf8($nshfilename); convert_utf16_to_utf8($nlffilename); $nshfile = installer::files::read_file($nshfilename); # read nsh file again @@ -1776,8 +1744,9 @@ sub get_path_to_nsis_sdk if ( $nsispath eq "" ) { - installer::logger::print_message( "... no Environment variable \"SOLARROOT\", \"NSIS_PATH\" or \"NSISSDK_SOURCE\" found and NSIS not found in path!", "get_path_to_nsis_sdk"); - } elsif ( ! -d $nsispath ) + $installer::logger::Info->print("... no Environment variable \"SOLARROOT\", \"NSIS_PATH\" or \"NSISSDK_SOURCE\" found and NSIS not found in path!\n"); + } + elsif ( ! -d $nsispath ) { installer::exiter::exit_program("ERROR: NSIS path $nsispath does not exist!", "get_path_to_nsis_sdk"); } @@ -1795,14 +1764,13 @@ sub call_nsis my $makensisexe = $nsispath . $installer::globals::separator . "makensis.exe"; - installer::logger::print_message( "... starting $makensisexe ... \n" ); + $installer::logger::Info->printf("... starting %s ... \n", $makensisexe); if( $^O =~ /cygwin/i ) { $nsifile =~ s/\\/\//g; } my $systemcall = "$makensisexe $nsifile |"; - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); my @nsisoutput = (); @@ -1814,17 +1782,17 @@ sub call_nsis if ($returnvalue) { - $infoline = "ERROR: $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: %s !\n", $systemcall); } else { - $infoline = "Success: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: %s\n", $systemcall); } - for ( my $i = 0; $i <= $#nsisoutput; $i++ ) { push( @installer::globals::logfileinfo, "$nsisoutput[$i]"); } - + foreach my $line (@nsisoutput) + { + $installer::logger::Lang->print($line); + } } ################################################################################# @@ -1874,8 +1842,7 @@ sub get_translation_file my $translationfile = installer::files::read_file($translationfilename); replace_variables($translationfile, $allvariableshashref); - my $infoline = "Reading translation file: $translationfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Reading translation file: %s\n", $translationfilename); return $translationfile; } @@ -1904,8 +1871,7 @@ sub create_link_tree if ( ! $installer::globals::ooouploaddir ) { installer::exiter::exit_program("ERROR: Directory for AOO upload not defined!", "create_link_tree"); } my $versiondir = $installer::globals::ooouploaddir . $installer::globals::separator . $versionstring; - my $infoline = "Directory for the link: $versiondir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Directory for the link: %s\n", $versiondir); if ( ! -d $versiondir ) { installer::systemactions::create_directory_structure($versiondir); } @@ -1915,8 +1881,7 @@ sub create_link_tree # If there is an older version of this file (link), it has to be removed if ( -f $linkdestination ) { unlink($linkdestination); } - $infoline = "Creating hard link from $sourcedownloadfile to $linkdestination\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating hard link from %s to %s\n", $sourcedownloadfile, $linkdestination); installer::systemactions::hardlink_one_file($sourcedownloadfile, $linkdestination); } @@ -1948,12 +1913,10 @@ sub create_download_sets { my ($installationdir, $includepatharrayref, $allvariableshashref, $downloadname, $languagestringref, $languagesarrayref) = @_; - my $infoline = ""; - - my $force = 1; # print this message even in 'quiet' mode - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating download installation set ...\n", $force ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating download installation set ...\n", 1); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating download installation sets:"); @@ -2030,8 +1993,7 @@ sub create_download_sets if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "create_download_sets"); } my $scriptfile = installer::files::read_file($$scriptref); - $infoline = "Found script file $scriptfilename: $$scriptref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Found script file %s: %s \n", $scriptfilename, $$scriptref); # add product name into script template put_productname_into_script($scriptfile, $allvariableshashref); @@ -2054,7 +2016,7 @@ sub create_download_sets my $newscriptfilename = determine_scriptfile_name($downloadname); $newscriptfilename = save_script_file($downloaddir, $newscriptfilename, $scriptfile); - installer::logger::print_message( "... including installation set into $newscriptfilename ... \n" ); + $installer::logger::Info->printf("... including installation set into %s ... \n", $newscriptfilename); # Append tar file to script include_tar_into_script($newscriptfilename, $temporary_tarfile_name); } @@ -2070,9 +2032,9 @@ sub create_download_sets if ( $nsispath eq "" ) { # If nsis is not found just skip the rest of this function # and do not create the NSIS file. - $infoline = "\nNo NSIS SDK found. Skipping the generation of NSIS file.\n"; - push(@installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... no NSIS SDK found. Skipping the generation of NSIS file ... \n" ); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("No NSIS SDK found. Skipping the generation of NSIS file.\n"); + $installer::logger::Info->print("... no NSIS SDK found. Skipping the generation of NSIS file ... \n"); return $downloaddir; } @@ -2115,7 +2077,7 @@ sub create_download_sets my $nsifilename = save_script_file($localnsisdir, $templatefilename, $templatefile); - installer::logger::print_message( "... created NSIS file $nsifilename ... \n" ); + $installer::logger::Info->printf("... created NSIS file %s ... \n", $nsifilename); # starting the NSIS SDK to create the download file call_nsis($nsispath, $nsifilename); @@ -2132,14 +2094,14 @@ sub create_download_link_tree { my ($downloaddir, $languagestringref, $allvariableshashref) = @_; - my $infoline; - - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating download hard link ...\n" ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); # + $installer::logger::Info->print("... creating download hard link ...\n"); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating download hard link:"); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Creating hard link, start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, start"); if ( is_supported_platform() ) { @@ -2151,8 +2113,7 @@ sub create_download_link_tree # Is $versionstring empty? If yes, there is nothing to do now. - $infoline = "Version string is set to: $versionstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Version string is set to: %s\n", $versionstring); if ( $versionstring ) { @@ -2165,13 +2126,11 @@ sub create_download_link_tree { $destdownloadfilename = $destdownloadfilename . $installer::globals::downloadfileextension; - $infoline = "Setting destination download file name: $destdownloadfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting destination download file name: %s\n", $destdownloadfilename); my $sourcedownloadfile = $downloaddir . $installer::globals::separator . $installer::globals::downloadfilename; - $infoline = "Setting source download file name: $sourcedownloadfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting source download file name: %s\n", $sourcedownloadfile); create_link_tree($sourcedownloadfile, $destdownloadfilename, $versionstring); # my $md5sumoutput = call_md5sum($downloadfile); @@ -2181,17 +2140,15 @@ sub create_download_link_tree } else { - $infoline = "Version string is empty. Nothing to do!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Version string is empty. Nothing to do!\n"); } } else { - $infoline = "Platform not used for hard linking. Nothing to do!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Platform not used for hard linking. Nothing to do!\n"); } - installer::logger::include_timestamp_into_logfile("Performance Info: Creating hard link, stop"); + $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, stop"); } 1; diff --git a/solenv/bin/modules/installer/downloadsigner.pm b/solenv/bin/modules/installer/downloadsigner.pm index 3ecc2f0749d0..0bdf49edb16b 100644 --- a/solenv/bin/modules/installer/downloadsigner.pm +++ b/solenv/bin/modules/installer/downloadsigner.pm @@ -87,8 +87,6 @@ Ende sub getparameter { - # installer::logger::print_message("Checking parameter"); - while ( $#ARGV >= 0 ) { my $param = shift(@ARGV); @@ -193,7 +191,8 @@ sub set_temp_path exit(-1); } - installer::logger::print_message( "\n... using output path: $temppath ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("\n... using output path: %s ...\n", $temppath); push(@installer::globals::removedirs, $temppath); @@ -227,7 +226,8 @@ sub set_minor_into_pathes { my ($followmeinfohash, $temppath) = @_; - installer::logger::print_message( "\n... forcing into minor: $installer::globals::lastminor ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... forcing into minor: %s ...\n", $installer::globals::lastminor); my @pathnames = ("bin", "doc", "inc", "lib", "pck", "res", "xml"); my $sourcename = "src"; @@ -235,7 +235,8 @@ sub set_minor_into_pathes if ( $installer::globals::minor ne "" ) { - installer::logger::print_message( "\n... already defined minor: $installer::globals::minor -> ignoring parameter \"-useminor\" ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... already defined minor: %s -> ignoring parameter \"-useminor\" ...\n" , $installer::globals::minor); return; } @@ -247,19 +248,16 @@ sub set_minor_into_pathes # $installer::globals::idtlanguagepath installer::logger::include_header_into_logfile("Changing saved pathes to add the minor"); - my $infoline = "Old pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Include pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); } + $installer::logger::Lang->print("Old pathes:\n"); + $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'}); + $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath); + $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath); + $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath); + $installer::logger::Lang->printf("Include pathes:\n"); + foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) + { + $installer::logger::Lang->print($path); + } foreach $onepath ( @pathnames ) { @@ -302,19 +300,17 @@ sub set_minor_into_pathes if ( $installer::globals::idtlanguagepath =~ /\Q$srcpath\E/ ) { $installer::globals::idtlanguagepath =~ s/\Q$srcpath\E/$newsrcpath/; } foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { if ( $path =~ /\Q$srcpath\E/ ) { $path =~ s/\Q$srcpath\E/$newsrcpath/; } } - $infoline = "\nNew pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Include pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); } + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("New pathes:\n"); + $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'}); + $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath); + $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath); + $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath); + $installer::logger::Lang->printf("Include pathes:\n"); + foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) + { + $installer::logger::Lang->print($path); + } } ############################################# @@ -380,16 +376,17 @@ sub publishproductlist { my ($infofilelist) = @_; - installer::logger::print_message( "\n... found products: ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... found products: ...\n"); for ( my $i = 0; $i <= $#{$infofilelist}; $i++ ) { my $onefile = ${$infofilelist}[$i]; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$onefile); - installer::logger::print_message( "...... $onefile ...\n" ); + $installer::logger::Info->printf("...... $onefile ...\n"); } - installer::logger::print_message( "\n" ); + $installer::logger::Info->printf("\n"); } ######################################################### @@ -469,7 +466,8 @@ sub createproductlist } elsif ( -d $installer::globals::followmeinfofilename ) { - installer::logger::print_message( "\n... reading directory: $installer::globals::followmeinfofilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... reading directory: %s ...\n", $installer::globals::followmeinfofilename); $installer::globals::followmeinfofilename =~ s/$installer::globals::separator\s*$//; my $allfollowmefiles = installer::systemactions::find_file_with_file_extension("log", $installer::globals::followmeinfofilename); @@ -546,14 +544,26 @@ sub logfollowmeinfohash { my ( $followmehash ) = @_; - print "\n*****************************************\n"; - print "Content of follow-me info file:\n"; - print "finalinstalldir: $followmehash->{'finalinstalldir'}\n"; - print "downloadname: $followmehash->{'downloadname'}\n"; - print "languagestring: $followmehash->{'languagestring'}\n"; - foreach my $lang ( @{$followmehash->{'languagesarray'}} ) { print "languagesarray: $lang\n"; } - foreach my $path ( @{$followmehash->{'includepatharray'}} ) { print "includepatharray: $path"; } - foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} ) { print "allvariableshash: $key : $followmehash->{'allvariableshash'}->{$key}\n"; } + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("*****************************************\n"); + $installer::logger::Info->printf("Content of follow-me info file:\n"); + $installer::logger::Info->printf("finalinstalldir: %s\n", $followmehash->{'finalinstalldir'}); + $installer::logger::Info->printf("downloadname: %s\n", $followmehash->{'downloadname'}); + $installer::logger::Info->printf("languagestring: %s\n", $followmehash->{'languagestring'}); + foreach my $lang ( @{$followmehash->{'languagesarray'}} ) + { + $installer::logger::Info->printf("languagesarray: %s\n", $lang); + } + foreach my $path ( @{$followmehash->{'includepatharray'}} ) + { + $installer::logger::Info->printf("includepatharray: %s\n", $path); + } + foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} ) + { + $installer::logger::Info->printf("allvariableshash: %s : %s\n", + $key, + $followmehash->{'allvariableshash'}->{$key}); + } } ######################################################################## @@ -574,7 +584,11 @@ sub rename_followme_infofile if ( $filename ne $newfilename ) { my $returnvalue = rename($filename, $newfilename); - if ( $returnvalue ) { installer::logger::print_message( "\n... renamed file \"$filename\" to \"$newfilename\" ...\n" ); } + if ( $returnvalue ) + { + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... renamed file \"%s\" to \"%s\" ...\n", $filename, $newfilename); + } } } diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index cd370d998262..b6d6b96297c5 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -83,14 +83,12 @@ sub check_tilde_in_directory my $home = $ENV{'HOME'}; $home =~ s/\Q$installer::globals::separator\E\s*$//; $installer::globals::localinstalldir =~ s/~/$home/; - my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changing LOCALINSTALLDIR to %s\n", $installer::globals::localinstalldir); } else { # exit, because "~" is not allowed, if HOME is not set - my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n"); installer::exiter::exit_program("ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!", "check_tilde_in_directory"); } } diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index d0efdc0bbf40..e877595b35ac 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -36,7 +36,7 @@ use installer::remover; use installer::scriptitems; use installer::systemactions; use installer::worker; -use POSIX; +use POSIX qw(uname); ############################################################################ # Reading the package map to find Solaris package names for @@ -51,8 +51,9 @@ sub read_packagemap if ( $allvariables->{'PACKAGEMAP'} ) { $packagemapname = $allvariables->{'PACKAGEMAP'}; } if ( $packagemapname eq "" ) { installer::exiter::exit_program("ERROR: Property PACKAGEMAP must be defined!", "read_packagemap"); } - my $infoline = "\n\nCollected abbreviations and package names:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("nCollected abbreviations and package names:\n"); # Can be a comma separated list. All files have to be found in include pathes my $allpackagemapnames = installer::converter::convert_stringlist_into_hash(\$packagemapname, ","); @@ -90,8 +91,10 @@ sub read_packagemap $local_packagename =~ s/\%LANGUAGESTRING/$onelang/g; # Logging all abbreviations and packagenames - $infoline = "$onelang : $local_abbreviation : $local_packagename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s : %s : %s\n", + $onelang, + $local_abbreviation, + $local_packagename); if ( exists($installer::globals::dependfilenames{$local_abbreviation}) ) { @@ -106,8 +109,7 @@ sub read_packagemap else { # Logging all abbreviations and packagenames - $infoline = "$abbreviation : $packagename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s : %s\n", $abbreviation, $packagename); if ( exists($installer::globals::dependfilenames{$abbreviation}) ) { @@ -127,9 +129,8 @@ sub read_packagemap } } - $infoline = "\n\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); } ############################################################################ @@ -481,8 +482,7 @@ sub create_epm_header installer::files::save_file($$fileref, $copyrightfile); } - $infoline = "Using license file: \"$$fileref\"!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Using license file: \"%s\"!\n", $$fileref); $foundlicensefile = 1; $line = "%license" . " " . $$fileref . "\n"; @@ -824,8 +824,7 @@ sub find_epm_on_system if (!($$epmfileref eq "")) { $epmname = $$epmfileref; } } - my $infoline = "Using epmfile: $epmname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Using epmfile: %s\n", $epmname); return $epmname; } @@ -854,13 +853,15 @@ sub set_patch_state if ( $installer::globals::is_special_epm ) { - $infoline = "\nPatch state: This is a patched version of epm!\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Patch state: This is a patched version of epm!\n"); + $installer::logger::Lang->print("\n"); } else { - $infoline = "\nPatch state: This is an unpatched version of epm!\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Patch state: This is an unpatched version of epm!\n"); + $installer::logger::Lang->print("\n"); } if ( ( $installer::globals::is_special_epm ) && (($installer::globals::islinuxrpmbuild) || ($installer::globals::issolarispkgbuild)) ) @@ -927,7 +928,7 @@ sub call_epm my $systemcall = $ldpreloadstring . $epmname . " -f " . $packageformat . " " . $extraflags . " " . $localpackagename . " " . $epmlistfilename . $outdirstring . " " . $verboseflag . " " . " 2\>\&1 |"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $maxepmcalls = 3; @@ -941,26 +942,23 @@ sub call_epm my $returnvalue = $?; # $? contains the return value of the systemcall - my $infoline = "Systemcall (Try $i): $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall (Try %d): \n", $i, $systemcall); for ( my $j = 0; $j <= $#epmoutput; $j++ ) { if ( $i < $maxepmcalls ) { $epmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; } - push( @installer::globals::logfileinfo, "$epmoutput[$j]"); + $installer::logger::Lang->print($epmoutput[$j]); } if ($returnvalue) { - $infoline = "Try $i : Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Try %d : Could not execute \"%s\"!\n", $i, $systemcall); if ( $i == $maxepmcalls ) { installer::exiter::exit_program("ERROR: \"$systemcall\"!", "call_epm"); } } else { - installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" ); - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->printf("Success: Executed (Try %d): \"%s\" successfully\n", $i, $systemcall); + $installer::logger::Lang->printf("Success: Executed (Try %d): \"%s\" successfully\n", $i, $systemcall); last; } } @@ -1000,8 +998,7 @@ sub add_one_line_into_file } $insertline =~ s/\s*$//; # removing line end for correct logging - my $infoline = "Success: Added line $insertline into file $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Added line %s into file !\n", $insertline, $filename); } ##################################################################### @@ -1035,8 +1032,10 @@ sub set_revision_in_pkginfo my $oldstring = $1; my $newstring = $oldstring . $revisionstring; # also adding the date string ${$file}[$i] =~ s/$oldstring/$newstring/; - my $infoline = "Info: Changed in $filename file: \"$oldstring\" to \"$newstring\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changed in %s file: \"%s\" to \"\"!\n", + $filename, + $oldstring, + $newstring); last; } } @@ -1091,8 +1090,7 @@ sub set_revision_in_pkginfo ${$file}[$i] = $newstring; $oldstring =~ s/\s*$//; $newstring =~ s/\s*$//; - my $infoline = "Info: Changed in $filename file: \"$oldstring\" to \"$newstring\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changed in %s file: \"%s\" to \"\"!\n", $filename, $oldstring, $newstring); last; } } @@ -1324,8 +1322,7 @@ sub set_topdir_in_specfile my $removeline = ${$changefile}[$i]; $removeline =~ s/\s*$//; splice(@{$changefile},$i,1); - my $infoline = "Info: Removed line \"$removeline\" from file $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Removed line \"%s\" from file %s!\n", $removeline, $filename); last; } } @@ -1343,8 +1340,7 @@ sub set_topdir_in_specfile splice(@{$changefile},$i+1,0,$topdirline); $inserted_line = 1; $topdirline =~ s/\s*$//; - my $infoline = "Success: Added line $topdirline into file $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Added line %s into file %s!\n", $topdirline, $filename); } } @@ -1369,8 +1365,9 @@ sub set_packager_in_specfile { my $oldstring = $1; ${$changefile}[$i] =~ s/\Q$oldstring\E/$packager/; - my $infoline = "Info: Changed Packager in spec file from $oldstring to $packager!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changed Packager in spec file from %s to %s!\n", + $oldstring, + $packager); last; } } @@ -1393,8 +1390,9 @@ sub set_prereq_in_specfile { my $oldstring = ${$changefile}[$i]; ${$changefile}[$i] =~ s/Requires:/$prereq/; - my $infoline = "Info: Changed requirements in spec file from $oldstring to ${$changefile}[$i]!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changed requirements in spec file from %s to %s!\n", + $oldstring, + ${$changefile}[$i]); } } } @@ -1427,9 +1425,7 @@ sub set_autoprovreq_in_specfile { splice(@{$changefile},$i+1,0,$autoreqprovline); $autoreqprovline =~ s/\s*$//; - $infoline = "Success: Added line $autoreqprovline into spec file!\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Success: Added line %s into spec file!\n", $autoreqprovline); last; } } @@ -1451,8 +1447,7 @@ sub set_license_in_specfile if ( ${$changefile}[$i] =~ /^\s*Copyright\s*:\s*(.+?)\s*$/ ) { ${$changefile}[$i] = "License: $license\n"; - my $infoline = "Info: Replaced Copyright with License: $license !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Replaced Copyright with License: %s !\n", $license); last; } } @@ -1491,8 +1486,7 @@ sub make_prototypefile_relocatable my $line = ${$prototypefile}[$i]; splice(@{$prototypefile},$i,1); # removing the line $line =~ s/\s*$//; - my $infoline = "Info: Removed line \"$line\" from prototype file!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Removed line \"%s\" from prototype file!\n", $line); last; } } @@ -1504,8 +1498,7 @@ sub make_prototypefile_relocatable if ( ${$prototypefile}[$i] =~ /\\\$/ ) { ${$prototypefile}[$i] =~ s/\\\$/\$/g; - my $infoline2 = "Info: Changed line in prototype file: ${$prototypefile}[$i] !\n"; - push( @installer::globals::logfileinfo, $infoline2); + $installer::logger::Lang->printf("Info: Changed line in prototype file: %s !\n", ${$prototypefile}[$i]); } } } @@ -1541,8 +1534,10 @@ sub set_volatilefile_into_prototypefile my $newline = ${$prototypefile}[$j]; $oldline =~ s/\s*$//; $newline =~ s/\s*$//; - my $infoline = "Volatile file: Changing content from \"$oldline\" to \"$newline\" .\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Volatile file: Changing content from \"%s\" to \"%s\" .\n", + $oldline, + $newline); last; } } @@ -1566,8 +1561,8 @@ sub replace_variables_in_shellscripts_for_patch my $oldline = ${$scriptfile}[$i]; if (( $oldstring eq "PRODUCTDIRECTORYNAME" ) && ( $newstring eq "" )) { $oldstring = $oldstring . "/"; } ${$scriptfile}[$i] =~ s/\Q$oldstring\E/$newstring/g; - my $infoline = "Info: Substituting in $scriptfilename $oldstring by $newstring\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Substituting in %s %s by %s\n", + $scriptfilename, $oldstring, $newstring); } } } @@ -1595,14 +1590,14 @@ sub replace_variables_in_shellscripts my $oldline = ${$scriptfile}[$i]; ${$scriptfile}[$i] =~ s/\Q$oldstring\E/$newstring/g; ${$scriptfile}[$i] =~ s/\/\//\//g; # replacing "//" by "/" , if path $newstring is empty! - my $infoline = "Info: Substituting in $scriptfilename $oldstring by $newstring\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Substituting in %s %s by %s\n", + $scriptfilename, + $oldstring, + $newstring); if ( $debug ) { - $infoline = "Old Line: $oldline"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "New Line: ${$scriptfile}[$i]"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Old Line: %s", $oldline); + $installer::logger::Lang->printf("New Line: %s", ${$scriptfile}[$i]); } } } @@ -1626,8 +1621,7 @@ sub determine_installdir_ooo $dirname =~ s/\s*$//; - my $infoline = "Info: Directory created by epm: $dirname\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Directory created by epm: %s\n", $dirname); return $dirname; } @@ -1663,8 +1657,8 @@ sub set_tab_into_datafile $oldline =~ s/\s*$//; $newline =~ s/\s*$//; - my $infoline = "TAB: Changing content from \"$oldline\" to \"$newline\" .\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("TAB: Changing content from \"%s\" to \"%s\" .\n", + $oldline, $newline); # collecting all new classes if (! installer::existence::exists_in_array($onefile->{'SolarisClass'}, \@newclasses)) @@ -1705,8 +1699,8 @@ sub set_tab_into_datafile $oldline =~ s/\s*$//; $newline =~ s/\s*$//; - my $infoline = "TAB: Changing content from \"$oldline\" to \"$newline\" .\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "TAB: Changing content from \"%s\" to \"%s\" .\n", $oldline, $newline); last; } @@ -1736,8 +1730,8 @@ sub include_classes_into_pkginfo my $newline = ${$changefile}[$i]; $newline =~ s/\s*$//; - my $infoline = "pkginfo file: Changing content from \"$oldline\" to \"$newline\" .\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("pkginfo file: Changing content from \"%s\" to \"%s\" .\n", + $oldline, $newline); } } } @@ -2196,8 +2190,8 @@ sub check_requirements_in_specfile $oldline =~ s/\s*$//; $newline =~ s/\s*$//; - my $infoline = "Spec File: Changing content from \"$oldline\" to \"$newline\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Spec File: Changing content from \"%s\" to \"%s\".\n", + $oldline, $newline); } } } @@ -2261,13 +2255,16 @@ sub determine_rpm_version { $rpmout =~ s/\s*$//g; - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); - if ( $rpmout eq "" ) { $infoline = "ERROR: Could not find file \"rpm\" !\n"; } - else { $infoline = "Success: rpm version: $rpmout\n"; } - - push( @installer::globals::logfileinfo, $infoline); + if ( $rpmout eq "" ) + { + $installer::logger::Lang->printf("ERROR: Could not find file \"rpm\" !\n"); + } + else + { + $installer::logger::Lang->printf("Success: rpm version: %s\n", $rpmout); + } if ( $rpmout =~ /(\d+)\.(\d+)\.(\d+)/ ) { $rpmversion = $1; } elsif ( $rpmout =~ /(\d+)\.(\d+)/ ) { $rpmversion = $1; } @@ -2287,8 +2284,9 @@ sub log_rpm_info my $systemcall = ""; my $infoline = ""; - $infoline = "\nLogging rpmrc content using --showrc\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Logging rpmrc content using --showrc\n"); + $installer::logger::Lang->printf("\n"); if ( $installer::globals::rpm ne "" ) { @@ -2314,17 +2312,16 @@ sub log_rpm_info $infoline = "$rpmout\n"; $infoline =~ s/error/e_r_r_o_r/gi; # avoiding log problems - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } else { - $infoline = "Problem in systemcall: $systemcall : No return value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Problem in systemcall: %s : No return value\n", $systemcall); } - $infoline = "End of logging rpmrc\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("End of logging rpmrc\n"); + $installer::logger::Lang->print("\n"); } ################################################# @@ -2350,7 +2347,7 @@ sub create_packages_without_epm # my $systemcall = "pkgmk -o -f $prototypefile -d $destinationdir \> /dev/null 2\>\&1"; my $systemcall = "pkgmk -l 1073741824 -o -f $prototypefile -d $destinationdir 2\>\&1 |"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $maxpkgmkcalls = 3; @@ -2364,26 +2361,26 @@ sub create_packages_without_epm my $returnvalue = $?; # $? contains the return value of the systemcall - my $infoline = "Systemcall (Try $i): $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall (Try %d): %s\n", $i, $systemcall); for ( my $j = 0; $j <= $#pkgmkoutput; $j++ ) { if ( $i < $maxpkgmkcalls ) { $pkgmkoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; } - push( @installer::globals::logfileinfo, "$pkgmkoutput[$j]"); + $installer::logger::Lang->print($pkgmkoutput[$j]); } if ($returnvalue) { - $infoline = "Try $i : Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Try %s : Could not execute \"%s\"!\n", + $i, $systemcall); if ( $i == $maxpkgmkcalls ) { installer::exiter::exit_program("ERROR: \"$systemcall\"!", "create_packages_without_epm"); } } else { - installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" ); - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->printf("Success: (Try %d): Executed \"%s\" successfully\n", + $i, $systemcall); + $installer::logger::Lang->printf("Success: (Try %d): Executed \"%s\" successfully\n", + $i, $systemcall); last; } } @@ -2410,28 +2407,25 @@ sub create_packages_without_epm $systemcall = "cd $destinationdir; cp -p -R $packagename $installer::globals::saved_packages_path;"; make_systemcall($systemcall); - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); # Setting unix rights to "775" for all created directories inside the package, # that is saved in temp directory $systemcall = "cd $packagestempdir; find $packagename -type d -exec chmod 775 \{\} \\\;"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } } } @@ -2452,11 +2446,10 @@ sub create_packages_without_epm make_systemcall($systemcall); $faspac = $$compressorref; - $infoline = "Found compressor: $faspac\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Found compressor: %s\n", $faspac); - installer::logger::print_message( "... $faspac ...\n" ); - installer::logger::include_timestamp_into_logfile("Starting $faspac"); + $installer::logger::Info->printf("... %s ...\n", $faspac); + $installer::logger::Lang->add_timestamp("Starting $faspac"); $systemcall = "/bin/sh $faspac -a -q -d $destinationdir $packagename"; # $faspac has to be the absolute path! make_systemcall($systemcall); @@ -2467,83 +2460,31 @@ sub create_packages_without_epm make_systemcall($systemcall); if ( -f $pkginfotmp ) { unlink($pkginfotmp); } - installer::logger::include_timestamp_into_logfile("End of $faspac"); + $installer::logger::Lang->add_timestamp("End of $faspac"); } else { - $infoline = "Not found: $faspac\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Not found: %s\n", $faspac); } } # Setting unix rights to "775" for all created directories inside the package $systemcall = "cd $destinationdir; find $packagename -type d -exec chmod 775 \{\} \\\;"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } - - ###################### - # making pkg files - ###################### - - # my $streamname = $packagename . ".pkg"; - # $systemcall = "pkgtrans $destinationdir $streamname $packagename"; - # print "... $systemcall ...\n"; - - # $returnvalue = system($systemcall); - - # $infoline = "Systemcall: $systemcall\n"; - # push( @installer::globals::logfileinfo, $infoline); - - # if ($returnvalue) - # { - # $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - # push( @installer::globals::logfileinfo, $infoline); - # } - # else - # { - # $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - # push( @installer::globals::logfileinfo, $infoline); - # } - - ######################### - # making tar.gz files - ######################### - - # my $targzname = $packagename . ".tar.gz"; - # $systemcall = "cd $destinationdir; tar -cf - $packagename | gzip > $targzname"; - # print "... $systemcall ...\n"; - - # $returnvalue = system($systemcall); - - # $infoline = "Systemcall: $systemcall\n"; - # push( @installer::globals::logfileinfo, $infoline); - - # if ($returnvalue) - # { - # $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - # push( @installer::globals::logfileinfo, $infoline); - # } - # else - # { - # $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - # push( @installer::globals::logfileinfo, $infoline); - # } } # Linux: rpm -bb so8m35.spec ( -> dependency check abklemmen? ) @@ -2587,7 +2528,7 @@ sub create_packages_without_epm my $systemcall = "$rpmcommand -bb --define \"_unpackaged_files_terminate_build 0\" $specfilename --target $target $buildrootstring 2\>\&1 |"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $maxrpmcalls = 3; my $rpm_failed = 0; @@ -2602,27 +2543,24 @@ sub create_packages_without_epm my $returnvalue = $?; # $? contains the return value of the systemcall - my $infoline = "Systemcall (Try $i): $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall (Try %d): %s\n", $i, $systemcall); for ( my $j = 0; $j <= $#rpmoutput; $j++ ) { # if ( $i < $maxrpmcalls ) { $rpmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; } $rpmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; - push( @installer::globals::logfileinfo, "$rpmoutput[$j]"); + $installer::logger::Lang->print($rpmoutput[$j]); } if ($returnvalue) { - $infoline = "Try $i : Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Try %d : Could not execute \"%s\"!\n", $i, $systemcall); $rpm_failed = 1; } else { - installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" ); - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->printf("Success (Try %d): Executed \"%s\" successfully!\n", $i, $systemcall); + $installer::logger::Lang->printf("Success (Try %d): Executed \"%s\" successfully!\n", $i, $systemcall); $rpm_failed = 0; last; } @@ -2637,7 +2575,7 @@ sub create_packages_without_epm if ( $rpmprog ne "" ) { - installer::logger::print_message( "... $rpmprog ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $rpmprog); my $helpersystemcall = "$rpmprog -bb $specfilename --target $target $buildrootstring 2\>\&1 |"; @@ -2649,24 +2587,26 @@ sub create_packages_without_epm my $helperreturnvalue = $?; # $? contains the return value of the systemcall - $infoline = "\nLast try: Using $rpmprog directly (problem with LD_LIBARY_PATH)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Last try: Using %s directly (problem with LD_LIBARY_PATH)\n", + $rpmprog); - $infoline = "\nSystemcall: $helpersystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Systemcall: %s\n", $helpersystemcall); - for ( my $j = 0; $j <= $#helperrpmoutput; $j++ ) { push( @installer::globals::logfileinfo, "$helperrpmoutput[$j]"); } + foreach my $line (@helperrpmoutput) + { + $installer::logger::Lang->print($helperrpmoutput[$j]); + } if ($helperreturnvalue) { - $infoline = "Could not execute \"$helpersystemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Could not execute \"%s\"!\n", $helpersystemcall); } else { - installer::logger::print_message( "Success: \"$helpersystemcall\"\n" ); - $infoline = "Success: Executed \"$helpersystemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $helpersystemcall); + $installer::logger::Info->printf("Success: Executed \"%s\" successfully!\n", $helpersystemcall); $rpm_failed = 0; } } @@ -2707,33 +2647,8 @@ sub remove_temporary_epm_files my $systemcall = "mv -f $removefile $destfile"; system($systemcall); # ignoring the return value - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); } - - # removing the package - -# my $removedir = $epmdir . $packagename; -# -# my $systemcall = "rm -rf $removedir"; -# -# print "... $systemcall ...\n"; -# -# my $returnvalue = system($systemcall); -# -# my $infoline = "Systemcall: $systemcall\n"; -# push( @installer::globals::logfileinfo, $infoline); -# -# if ($returnvalue) -# { -# $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; -# push( @installer::globals::logfileinfo, $infoline); -# } -# else -# { -# $infoline = "Success: Executed \"$systemcall\" successfully!\n"; -# push( @installer::globals::logfileinfo, $infoline); -# } } if ( $installer::globals::islinuxrpmbuild ) @@ -2745,8 +2660,7 @@ sub remove_temporary_epm_files my $systemcall = "mv -f $removefile $destfile"; system($systemcall); # ignoring the return value - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); # removing the directory "buildroot" @@ -2754,7 +2668,7 @@ sub remove_temporary_epm_files $systemcall = "rm -rf $removedir"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $returnvalue = system($systemcall); @@ -2762,23 +2676,19 @@ sub remove_temporary_epm_files $systemcall = "rm -rf $removedir"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); $returnvalue = system($systemcall); - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } } } @@ -2793,18 +2703,15 @@ sub make_systemcall my $returnvalue = system($systemcall); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); } } @@ -2835,18 +2742,17 @@ sub create_new_directory_structure my $returnvalue = system($systemcall); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not move content of \"$rpmdir\" to \"$newdir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not move content of \"%s\" to \"%s\"!\n", + $rpmdir,$newdir); } else { - $infoline = "Success: Moved content of \"$rpmdir\" to \"$newdir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Moved content of \"%s\" to \"%s\"!\n", + $rpmdir, $newdir); } # and removing the empty directory @@ -2867,18 +2773,15 @@ sub create_new_directory_structure my $localcall = "chmod 775 $newdir \>\/dev\/null 2\>\&1"; my $callreturnvalue = system($localcall); - my $callinfoline = "Systemcall: $localcall\n"; - push( @installer::globals::logfileinfo, $callinfoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $localcall); if ($callreturnvalue) { - $callinfoline = "ERROR: Could not execute \"$localcall\"!\n"; - push( @installer::globals::logfileinfo, $callinfoline); + $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $localcall); } else { - $callinfoline = "Success: Executed \"$localcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $callinfoline); + $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $localcall); } } @@ -3139,8 +3042,7 @@ sub put_systemintegration_into_installset my $onemodule = ${$allmodules}[$i]; my $packagetarfilename = $onemodule->{'PackageName'}; - my $infoline = "Including into installation set: $packagetarfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Including into installation set: %s\n", $packagetarfilename); my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$packagetarfilename, $includepatharrayref, 1); if ( $$sourcepathref eq "" ) { installer::exiter::exit_program("ERROR: Source path not found for $packagetarfilename!", "copy_systemintegration_files"); } @@ -3260,8 +3162,8 @@ sub put_installsetfiles_into_installset else { $destfile = $destdir . $installer::globals::separator . $onefile->{'Name'}; } installer::systemactions::copy_one_file($sourcefile, $destfile); - my $infoline = "Adding to installation set \"$destfile\" from source \"$sourcefile\".\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding to installation set \"%s\" from source \"%s\".\n", + $destfile, $sourcefile); } } @@ -3375,8 +3277,7 @@ sub finalize_linux_patch if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find patch script template $scriptfilename!", "finalize_linux_patch"); } my $scriptfile = installer::files::read_file($$scriptref); - my $infoline = "Found script file $scriptfilename: $$scriptref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Found script file %s: %s \n", $scriptfilename, $$scriptref); # Collecting all RPMs in the patch directory @@ -3426,8 +3327,7 @@ sub finalize_linux_patch $productname = lc($productname); $productname =~ s/ /_/g; # abc office -> abc_office - $infoline = "Adding productname $productname into Linux patch script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding productname %s into Linux patch script\n", $productname); for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) { ${$scriptfile}[$j] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; } @@ -3436,8 +3336,7 @@ sub finalize_linux_patch my $newscriptfilename = "setup"; # $newepmdir . $installer::globals::separator . "setup"; installer::files::save_file($newscriptfilename, $scriptfile); - $infoline = "Saved Linux patch setup $newscriptfilename \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Saved Linux patch setup %s\n", $newscriptfilename); # Setting unix rights 755 my $localcall = "chmod 775 $newscriptfilename \>\/dev\/null 2\>\&1"; diff --git a/solenv/bin/modules/installer/exiter.pm b/solenv/bin/modules/installer/exiter.pm index 9e025152322c..e59caf2af68c 100644 --- a/solenv/bin/modules/installer/exiter.pm +++ b/solenv/bin/modules/installer/exiter.pm @@ -60,38 +60,26 @@ sub exit_program if ( $#installer::globals::logfileinfo > -1 ) { - $infoline = "\n***************************************************************\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("***************************************************************\n"); + $installer::logger::Lang->print($message."\n"); + $installer::logger::Lang->printf("in function: %s\n", $function); + $installer::logger::Lang->printf("***************************************************************\n"); - $infoline = "$message\n"; - push(@installer::globals::logfileinfo, $infoline); - - $infoline = "in function: $function\n"; - push(@installer::globals::logfileinfo, $infoline); - - $infoline = "***************************************************************\n"; - push(@installer::globals::logfileinfo, $infoline); - - installer::files::save_file($installer::globals::logfilename ,\@installer::globals::logfileinfo); +# installer::files::save_file($installer::globals::logfilename ,\@installer::globals::logfileinfo); } else { - $infoline = "\n***************************************************************\n"; - push(@installer::globals::globallogfileinfo, $infoline); - - $infoline = "$message\n"; - push(@installer::globals::globallogfileinfo, $infoline); - - $infoline = "in function: $function\n"; - push(@installer::globals::globallogfileinfo, $infoline); - - $infoline = "***************************************************************\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); + $installer::logger::Global->print("***************************************************************\n"); + $installer::logger::Global->print($message."\n"); + $installer::logger::Global->printf("in function: %s\n", $function); + $installer::logger::Global->printf("***************************************************************\n"); - installer::files::save_file($installer::globals::logfilename ,\@installer::globals::globallogfileinfo); +# installer::files::save_file($installer::globals::logfilename ,\@installer::globals::globallogfileinfo); } installer::logger::print_error("$message\nin function: $function"); - installer::logger::print_error("Saved logfile: $installer::globals::logfilename\n"); +# installer::logger::print_error("Saved logfile: $installer::globals::logfilename\n"); # Saving the debug info diff --git a/solenv/bin/modules/installer/files.pm b/solenv/bin/modules/installer/files.pm index c2e2f6532295..907521c70173 100644 --- a/solenv/bin/modules/installer/files.pm +++ b/solenv/bin/modules/installer/files.pm @@ -84,9 +84,9 @@ sub save_file if ( $savefile =~ /\.log/ ) { - print "\n*************************************************\n"; + print "*************************************************\n"; print "ERROR: Cannot write log file: $savefile"; - print "\n*************************************************\n"; + print "*************************************************\n"; exit(-1); # exiting the program to avoid endless loops } diff --git a/solenv/bin/modules/installer/followme.pm b/solenv/bin/modules/installer/followme.pm index 10d648bb02a9..975846cd5c11 100644 --- a/solenv/bin/modules/installer/followme.pm +++ b/solenv/bin/modules/installer/followme.pm @@ -93,7 +93,7 @@ sub save_followme_info # Saving file installer::files::save_file($downloadinfodir . $installer::globals::separator . $downloadinfofilename, \@filecontent); - installer::logger::print_message( "... creating \"follow me\" info file $downloadinfofilename.\n" ); + $installer::logger::Info->printf("... creating \"follow me\" info file %s.\n", $downloadinfofilename); } #################################################### @@ -107,7 +107,8 @@ sub read_followme_info if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file: $filename", "read_download_info"); } - installer::logger::print_message( "\n... reading \"follow me\" info file $filename\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... reading \"follow me\" info file %s\n", $filename); my %contenthash = (); diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 513e1e45dbb3..f4dcd0ff382f 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -245,9 +245,9 @@ BEGIN $globallogging = 0; $globalloggingform21 = 1; $logfilename = "logfile.log"; # the default logfile name for global errors - @logfileinfo = (); - @errorlogfileinfo = (); - @globallogfileinfo = (); +# @logfileinfo = (); +# @errorlogfileinfo = (); +# @globallogfileinfo = (); $ignore_error_in_logfile = 0; $exitlog = ""; $globalinfo_copied = 0; @@ -508,7 +508,7 @@ BEGIN $libextension = "\.dll"; $isunix = 0; $iswin = 1; - $archiveformat = ".zip"; + $archiveformat = ".zip"; %savedmapping = (); %savedrevmapping = (); %savedrev83mapping = (); @@ -526,7 +526,7 @@ BEGIN $isunix = 0; $iswin = 0; $isos2 = 1; - $archiveformat = ".zip"; + $archiveformat = ".zip"; } else { diff --git a/solenv/bin/modules/installer/javainstaller.pm b/solenv/bin/modules/installer/javainstaller.pm index a7001c483ebe..31f3709fc1ab 100644 --- a/solenv/bin/modules/installer/javainstaller.pm +++ b/solenv/bin/modules/installer/javainstaller.pm @@ -162,8 +162,8 @@ sub set_productname_and_productversion { my ($templatefile, $variableshashref) = @_; - my $infoline = "\nSetting product name and product version in Java template file\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Setting product name and product version in Java template file\n"); my $productname = $variableshashref->{'PRODUCTNAME'}; my $productversion = $variableshashref->{'PRODUCTVERSION'}; @@ -175,7 +175,7 @@ sub set_productname_and_productversion } $infoline = "End of: Setting product name and product version in Java template file\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ####################################################### @@ -186,8 +186,8 @@ sub set_component_name_and_description { my ($templatefile, $modulesarrayref, $onelanguage) = @_; - my $infoline = "\nSetting component names and description in Java template file\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Setting component names and description in Java template file\n"); for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) { @@ -204,7 +204,7 @@ sub set_component_name_and_description $oldstring = $1; $infoline = "Found: $oldstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $oldstring =~ /^\s*OOO_(gid_\w+)_(\w+?)\s*$/ ) { @@ -215,14 +215,14 @@ sub set_component_name_and_description my $newstring = get_module_name_description($modulesarrayref, $onelanguage, $gid, $type); $infoline = "\tReplacing (language $onelanguage): OLDSTRING: $oldstring NEWSTRING $newstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); ${$templatefile}[$i] =~ s/$oldstring/$newstring/; # always substitute, even if $newstring eq "" } } $infoline = "End of: Setting component names and description in Java template file\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ####################################################### @@ -276,7 +276,7 @@ sub get_licensefilesource if ($$licenseref eq "") { installer::exiter::exit_program("ERROR: Could not find License file $licensefilename!", "get_licensefilesource"); } my $infoline = "Found licensefile $licensefilename: $$licenseref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $$licenseref; } @@ -334,7 +334,7 @@ sub convert_licenstring if ($$converterref eq "") { installer::exiter::exit_program("ERROR: Could not find converter $converter!", "convert_licenstring"); } my $infoline = "Found converter file $converter: $$converterref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $systemcall = "$$converterref $licensefilename |"; open (CONV, "$systemcall"); @@ -357,12 +357,12 @@ sub convert_licenstring } $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $licensestring eq "" ) { $infoline = "ERROR: Could not convert $licensefilename !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $licensestring; @@ -402,7 +402,7 @@ sub make_systemcall my @returns = (); - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); open (REG, "$systemcall"); while (<REG>) {push(@returns, $_); } @@ -411,23 +411,26 @@ sub make_systemcall my $returnvalue = $?; # $? contains the return value of the systemcall my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $logreturn ) { - for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); } + foreach my $line (@returns) + { + $installer::logger::Lang->printf($line); + } } if ($returnvalue) { $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $error_occured = 1; } else { $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return \@returns; @@ -486,7 +489,7 @@ sub set_classpath_for_install_sdk $ENV{'CLASSPATH'} = $newclasspathstring; my $infoline = "Setting CLASSPATH to $ENV{'CLASSPATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ####################################################### @@ -619,7 +622,7 @@ sub remove_package if ( $do_delete ) { my $infoline = "\tReally removing package $packagename from xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); splice(@{$xmlfile},$i, $linecounter); # removing $linecounter lines, beginning in line $i $removed_packge = 1; last; @@ -630,12 +633,12 @@ sub remove_package if ( $removed_packge ) { $infoline = "Package $packagename successfully removed from xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Did not find package $packagename in xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -844,7 +847,7 @@ sub remove_empty_packages_in_xmlfile { my $packagename = $installer::globals::emptypackages[$i]; my $infoline = "Try to remove package $packagename from xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); remove_package($xmlfile, $packagename); } } @@ -877,7 +880,7 @@ sub get_rpm_unit_from_xmlfile my ($rpmname, $xmlfile) = @_; my $infoline = "Searching for $rpmname in xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my @rpmunit = (); my $includeline = 0; @@ -906,7 +909,7 @@ sub get_rpm_unit_from_xmlfile if ( ! $foundrpm ) { installer::exiter::exit_program("ERROR: Did not find rpmunit $rpmname in xml file!", "get_rpm_unit_from_xmlfile"); } $infoline = "Found $rpmname in xml file. Returning block lines: $#rpmunit + 1. Includeline: $includeline \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return (\@rpmunit, $includeline); } @@ -941,7 +944,7 @@ sub prepare_linkrpm_in_xmlfile my $rpmline = ${$rpmlist}[$i]; my $infoline = "Preparing link/patch RPM: $rpmline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $rpmline =~ /^\s*(\S.*?\S)\s+(\S.*?\S)\s*$/ ) { @@ -1033,12 +1036,12 @@ sub remove_scpgid_from_xmlfile if ($successfully_removed) { $infoline = "Module $scpgid successfully removed from xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Module $scpgid not found in xml file (no problem).\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1052,7 +1055,7 @@ sub remove_module_if_not_defined my ($xmlfile, $modulesarrayref, $scpgid) = @_; my $infoline = "Checking existence of $scpgid in scp definition\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $found = 0; @@ -1066,7 +1069,7 @@ sub remove_module_if_not_defined if ( ! $found ) { $infoline = "Module $scpgid not found -> Removing from xml file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); remove_scpgid_from_xmlfile($xmlfile, $scpgid); } } @@ -1224,7 +1227,7 @@ sub replace_component_name_in_java_file installer::files::save_file($javafilename, $javafile); $infoline = "Changes in Java file: $javafilename : $oldname \-\> $newname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1304,7 +1307,7 @@ sub replace_component_names if ( $modulename eq "" ) { $infoline = "Info: Modulename for $gid not defined in modules collector. Looking in Java ulf file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $modulename eq "" ) # the modulename can also be set in the Java ulf file @@ -1317,7 +1320,7 @@ sub replace_component_names ${$xmlfile}[$i] =~ s/$componentname/$modulename/; $infoline = "Replacement in xml file (Solaris): $componentname \-\> $modulename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Replacement has to be done in all Java language files replace_component_name_in_java_file($alljavafiles, $componentname, $modulename); @@ -1326,7 +1329,7 @@ sub replace_component_names if ( $modulename eq "" ) # the modulename can also be set in the Java ulf file { $infoline = "WARNING: No replacement in xml file for component: $componentname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -1359,7 +1362,7 @@ sub get_all_packages_in_installdir { ${$allrpms}[$i] = $directory . $installer::globals::separator . ${$allrpms}[$i]; $infoline = "Found RPM: ${$allrpms}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1416,7 +1419,7 @@ sub set_filesize_in_xmlfile ${$xmlfile}[$number] =~ s/FILESIZEPLACEHOLDER/$filesize/; $filesizeset = 1; $infoline = "Setting filesize for $rpmname : $filesize\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } @@ -1430,13 +1433,13 @@ sub set_filesize_in_xmlfile if ( ! $foundrpm ) { $infoline = "ERROR: Did not find $rpmname in xml file !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( ! $filesizeset ) { $infoline = "ERROR: Did not set filesize for $rpmname in xml file !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1497,24 +1500,24 @@ sub find_rpmname_to_uniquename { my $number = $#all_correct_rpms + 1; $infoline = "There are $number RPMs for the unique name \"$uniquename\" :\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $allrpmstring = ""; for ( my $i = 0; $i <= $#all_correct_rpms; $i++ ) { $allrpmstring = $allrpmstring . $all_correct_rpms[$i] . "\n"; } - push( @installer::globals::logfileinfo, $allrpmstring); + $installer::logger::Lang->print($allrpmstring); installer::exiter::exit_program("ERROR: Found $number RPMs that start with unique name \"$uniquename\". Only one allowed!", "find_rpmname_to_uniquename"); } if ( $#all_correct_rpms < 0 ) { $infoline = "There is no rpm for the unique name \"$uniquename\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: There is no RPM that start with unique name \"$uniquename\"!", "find_rpmname_to_uniquename"); } if ( $#all_correct_rpms == 0 ) { $infoline = "Found one rpm for the unique name \"$uniquename\" : $all_correct_rpms[0]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $all_correct_rpms[0]; @@ -1549,7 +1552,7 @@ sub set_rpmname_into_xmlfile ${$xmlfile}[$number] =~ s/RPMFILENAMEPLACEHOLDER/$rpmname/; $rpmnameset = 1; $infoline = "Setting RPM name for $uniquename : $rpmname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } @@ -1563,13 +1566,13 @@ sub set_rpmname_into_xmlfile if ( ! $foundrpm ) { $infoline = "ERROR: Did not find $rpmname in xml file !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( ! $rpmnameset ) { $infoline = "ERROR: Did not set rpm name for $uniquename in xml file !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1590,25 +1593,23 @@ sub put_rpmpath_into_xmlfile my $number = $#{$listofpackages} + 1; $infoline = "Number of packages in installation set: $number\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $number = $#{$alluniquenames} + 1; $infoline = "Number of unique RPM names in xml file: $number\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); - $infoline = "\nPackages in installation set:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("Packages in installation set:\n"); for ( my $i = 0; $i <= $#{$listofpackages}; $i++ ) { - $infoline = "${$listofpackages}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print(${$listofpackages}[$i] . "\n"); } - $infoline = "\nUnique RPM names in xml file:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Unique RPM names in xml file:\n"); for ( my $i = 0; $i <= $#{$alluniquenames}; $i++ ) { $infoline = "${$alluniquenames}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $#{$alluniquenames} != $#{$listofpackages} ) { installer::exiter::exit_program("ERROR: xml file contains $#{$alluniquenames} unique names, but there are $#{$listofpackages} packages in installation set!", "put_rpmpath_into_xmlfile"); } @@ -1644,7 +1645,7 @@ sub put_filesize_into_xmlfile my $filesize = do_sum($rpmout); $infoline = "Filesize $rpmname : $filesize\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); set_filesize_in_xmlfile($filesize, $rpmname, $xmlfile); } @@ -1695,11 +1696,11 @@ sub create_java_installer $ulffilename = $installer::globals::javalanguagepath . $installer::globals::separator . $ulffilename; my $ulffile = installer::files::read_file($ulffilename); - $infoline = "\nReading ulf file: $ulffilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Reading ulf file: $ulffilename\n"); $infoline = "Translating the Java template file\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) { @@ -1738,7 +1739,7 @@ sub create_java_installer installer::files::save_file($newfilename, $templatefile); $infoline = "Saving Java file: $newfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # renaming one language java file to "MyResources.java" @@ -1767,14 +1768,14 @@ sub create_java_installer installer::files::save_file($basedestfilename, $basetemplatefile); $infoline = "Created base Java file: $basedestfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # deleting the template file unlink($templatefilename); $infoline = "Deleted template Java resource file: $templatefilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # changing into Java directory @@ -1783,7 +1784,7 @@ sub create_java_installer chdir($javadir); $infoline = "Changing into directory: $javadir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # preparing the xml file @@ -1823,7 +1824,7 @@ sub create_java_installer if ( $installer::globals::islinuxrpmbuild ) { put_filesize_into_xmlfile($xmlfile, $listofpackages); } installer::files::save_file($xmlfilename, $xmlfile); $infoline = "Saving xml file: $xmlfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Setting the classpath and starting compiler @@ -1875,7 +1876,7 @@ sub create_java_installer chdir($from); $infoline = "Changing into directory: $from\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } 1; diff --git a/solenv/bin/modules/installer/languagepack.pm b/solenv/bin/modules/installer/languagepack.pm index 461bbc9a33dd..7dbd76ce581d 100644 --- a/solenv/bin/modules/installer/languagepack.pm +++ b/solenv/bin/modules/installer/languagepack.pm @@ -136,7 +136,7 @@ sub put_license_file_into_script my ($scriptfile, $licensefile) = @_; my $infoline = "Adding licensefile into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $includestring = ""; @@ -162,22 +162,22 @@ sub create_tar_gz_file $packagename =~ s/\.rpm\s*$//; my $targzname = $packagename . ".tar.gz"; $systemcall = "cd $installdir; tar -cf - $packagestring | gzip > $targzname"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $targzname; @@ -268,7 +268,7 @@ sub determine_packagename } my $infoline = "Found package in installation directory $installdir : $packagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return ( $packagename, $allnames); } @@ -285,7 +285,7 @@ sub put_packagename_into_script my $localpackagename = $packagename; $localpackagename =~ s/\.tar\.gz//; # making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea" my $infoline = "Adding packagename $localpackagename into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $installline = ""; @@ -319,7 +319,7 @@ sub put_productname_into_script $productname =~ s/\.//g; # openoffice.org -> openofficeorg my $infoline = "Adding productname $productname into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -342,7 +342,7 @@ sub put_fullproductname_into_script my $fullproductname = $productname . " " . $productversion; my $infoline = "Adding full productname \"$fullproductname\" into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -365,10 +365,10 @@ sub put_searchpackage_into_script if ( $installer::globals::issolarisbuild ) { $basispackageversion =~ s/\.//g; } # "3.0" -> "30" my $infoline = "Adding basis package prefix $basispackageprefix into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Adding basis package version $basispackageversion into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -389,7 +389,7 @@ sub put_linenumber_into_script my $linenumber = $#{$scriptfile} + $#{$licensefile} + 3; # also adding the content of the license file! my $infoline = "Adding linenumber $linenumber into language pack script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -413,7 +413,7 @@ sub determine_scriptfile_name $scriptfilename =~ s/\.tar\.gz\s*$/\.sh/; my $infoline = "Setting language pack script file name to $scriptfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $scriptfilename; } @@ -430,7 +430,7 @@ sub save_script_file installer::files::save_file($newscriptfilename, $scriptfile); my $infoline = "Saving script file $newscriptfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $newscriptfilename; } @@ -449,17 +449,17 @@ sub include_package_into_script my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1"; @@ -485,7 +485,7 @@ sub remove_package unlink $longpackagename; my $infoline = "Removing package: $longpackagename \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -499,7 +499,7 @@ sub build_installer_for_languagepack { my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_; - installer::logger::print_message( "... creating shell script installer ...\n" ); + $installer::logger::Info->print("... creating shell script installer ...\n"); installer::logger::include_header_into_logfile("Creating shell script installer:"); @@ -511,7 +511,7 @@ sub build_installer_for_languagepack my $scriptfile = installer::files::read_file($$scriptref); my $infoline = "Found script file $scriptfilename: $$scriptref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # find and read english license file my $licenselanguage = "en-US"; # always english ! @@ -523,7 +523,7 @@ sub build_installer_for_languagepack my $licensefile = installer::files::read_file($$licenseref); $infoline = "Found licensefile $licensefilename: $$licenseref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # including variables into license file installer::scpzipfiles::replace_all_ziplistvariables_in_file($licensefile, $allvariableshashref); diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm index 9cf3299d4eee..6145ce08dfd9 100644 --- a/solenv/bin/modules/installer/logger.pm +++ b/solenv/bin/modules/installer/logger.pm @@ -25,53 +25,368 @@ package installer::logger; use installer::files; use installer::globals; +use Time::HiRes qw(gettimeofday tv_interval); +use English; +use IO::Handle; +use strict; -#################################################### -# Including header files into the logfile -#################################################### +my $StartTime = undef; -sub include_header_into_logfile +sub PrintStackTrace (); +sub Die ($); + +=head1 NAME + + installer::logger + + Logging for the installer modules. + +=cut + +=head1 DESCRIPTION + + This module is in a transition state from a set of loosly connected functions to a single class. + + There are three globaly available logger objects: + +=over + +=item $Lang + + is language specific and writes messages to a log file. + +=cut + +=item $Glob + + is independent of the current language. Its messages are prepended to each $Lang logger. + +=cut + +=item $Info + + is for output to the console. + +=cut + +=back + +=cut + + +our $Global = installer::logger->new("glob", + 'is_save_lines' => 1, + 'is_print_to_console' => 0, + 'is_show_relative_time' => 1); +our $Lang = installer::logger->new("lang", + 'is_print_to_console' => 0, + 'is_show_relative_time' => 1, + 'is_show_log_id' => 1 + ); +our $Info = installer::logger->new("info", + 'is_show_relative_time' => 0, + 'is_show_process_id' => 0, + 'is_show_log_id' => 0 + ); + +=head2 new($class, $id, @arguments) + + Create a new instance of the logger class. + @arguments lets you override default values. + +=cut + +sub new ($$@) { - my ($message) = @_; + my ($class, $id, @arguments) = @_; + + my $self = { + 'id' => $id, + 'filename' => "", + # When set then lines are printed to this file. + 'file' => undef, + # When true then lines are printed to the console. + 'is_print_to_console' => 1, + 'is_save_lines' => 0, + # A container of printed lines. Lines are added only when 'is_save_lines' is true. + 'lines' => [], + # Another logger to which all prints are forwarded. + 'forward' => [], + # A filter function that for example can recoginze build errors. + 'filter' => undef, + # Show relative time + 'is_show_relative_time' => 0, + # Show log id (mostly for debugging the logger) + 'is_show_log_id' => 0, + # Show the process id, useful on the console when doing a multiprocessor build. + 'is_show_process_id' => 0 + }; + while (scalar @arguments >= 2) + { + my $key = shift @arguments; + my $value = shift @arguments; + $self->{$key} = $value; + } - my $infoline; + bless($self, $class); + + return $self; +} + + + +=head2 printf($self, $message, @arguments) + + Identical in syntax and semantics to the usual perl (s)printf. + +=cut +sub printf ($$@) +{ + my ($self, $format, @arguments) = @_; + + if ($format =~ /\%\{/) + { + printf(">%s<\n", $format); + PrintStackTrace(); + } + my $message = sprintf($format, @arguments); + $self->print($message, 0); +} + + + + +=head2 print ($self, $message, [optional] $force) + + Print the given message. + If the optional $force parameter is given and it evaluates to true then the message + is printed even when the golbal $installer::globals::quiet is true. + +=cut +sub print ($$;$) +{ + my ($self, $message, $force) = @_; + + Die "newline at start of line" if ($message =~ /^\n.+/); + + $force = 0 unless defined $force; + + my $relative_time = tv_interval($StartTime, [gettimeofday()]); + foreach my $target ($self, @{$self->{'forward'}}) + { + $target->process_line( + $relative_time, + $self->{'id'}, + $PID, + $message, + $force); + } +} + + + + +=head2 process_line ($self, $relative_time, $log_id, $pid, $message, $force) + + Internal function that decides whether to + a) write to a log file + b) print to the console + c) store in an array for later use + the preformatted message. + +=cut +sub process_line ($$$$$$) +{ + my ($self, $relative_time, $log_id, $pid, $message, $force) = @_; + + # Apply the line filter. + if (defined $self->{'filter'}) + { + $message = &{$self->{'filter'}}($relative_time, $log_id, $pid, $message); + } + + # Format the line. + my $line = ""; + if ($self->{'is_show_relative_time'}) + { + $line .= sprintf("%12.6f : ", $relative_time); + } + if ($self->{'is_show_log_id'}) + { + $line .= $log_id . " : "; + } + if ($self->{'is_show_process_id'}) + { + $line .= $pid . " : "; + } + $line .= $message; + + # Print the line to a file or to the console or store it for later use. + my $fid = $self->{'file'}; + if (defined $fid) + { + print $fid ($line); + } + if (($force || ! $installer::globals::quiet) + && $self->{'is_print_to_console'}) + { + print($line); + } + if ($self->{'is_save_lines'}) + { + push @{$self->{'lines'}}, [$relative_time, $log_id, $pid, $message, $force]; + } +} + + + + +=head2 set_filename (Self, $filename) + + When the name of a writable file is given then all future messages will go to that file. + Output to the console is turned off. + This method is typically used to tie the language dependent $Lang logger to different log files. + +=cut +sub set_filename ($$) +{ + my ($self, $filename) = @_; + + $filename = "" unless defined $filename; + if ($self->{'filename'} ne $filename) + { + if (defined $self->{'file'}) + { + $self->{'is_print_to_console'} = 1; + close $self->{'file'}; + $self->{'file'} = undef; + } + + $self->{'filename'} = $filename; + + if ($filename ne "") + { + open $self->{'file'}, ">", $self->{'filename'} + || Die "can not open log file ".$self->{'filename'}." for writing"; + $self->{'is_print_to_console'} = 0; + + # Make all writes synchronous so that we don't loose any messages on an + # 'abrupt' end. + my $handle = select $self->{'file'}; + $| = 1; + select $handle; + } + } +} + + + + +=head2 set_filter ($self, $filter) + + Sets $filter (a function reference) as line filter. It is applied to each line. + The filter can extract information from the given message and modify it before it is printed. + +=cut +sub set_filter ($$) +{ + my ($self, $filter) = @_; + $self->{'filter'} = $filter; +} + + + + +=head2 add_timestamp ($self, $message) + + Print the given message together with the current (absolute) time. + +=cut +sub add_timestamp ($$) +{ + my ($self, $message) = @_; + + my $timestring = get_time_string(); + $self->printf("%s\t%s", $message, $timestring); +} + + + +=head2 copy_lines_from ($self, $other) + + Copy saved lines from another logger object. + +=cut +sub copy_lines_from ($$) +{ + my ($self, $other) = @_; + + my $is_print_to_console = $self->{'is_print_to_console'}; + my $is_save_lines = $self->{'is_save_lines'}; + my $fid = $self->{'file'}; + + foreach my $line (@{$other->{'lines'}}) + { + $self->process_line(@$line); + } +} - $infoline = "\n" . get_time_string(); - push( @installer::globals::logfileinfo, $infoline); - $infoline = "######################################################\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "$message\n"; - push( @installer::globals::logfileinfo, $infoline); +=head2 set_forward ($self, $other) - $infoline = "######################################################\n"; - push( @installer::globals::logfileinfo, $infoline); + Set a forwarding target. All future messages are forwarded (copied) to $other. + A typical use is to tie $Info to $Lang so that all messages sent to $Info are + printed to the console AND written to the log file. + +=cut +sub set_forward ($$) +{ + my ($self, $other) = @_; + + # At the moment at most one forward target is allowed. + if (defined $other) + { + $self->{'forward'} = [$other]; + } + else + { + $self->{'forward'} = []; + } } + + + #################################################### # Including header files into the logfile #################################################### -sub include_header_into_globallogfile +sub include_header_into_logfile { my ($message) = @_; - my $infoline; - - $infoline = "\n" . get_time_string(); - push( @installer::globals::globallogfileinfo, $infoline); - - $infoline = "######################################################\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $Lang->print("\n"); + $Lang->print(get_time_string()); + $Lang->print("######################################################\n"); + $Lang->print($message."\n"); + $Lang->print("######################################################\n"); +} - $infoline = "$message\n"; - push( @installer::globals::globallogfileinfo, $infoline); +#################################################### +# Including header files into the logfile +#################################################### +sub include_header_into_globallogfile +{ + my ($message) = @_; - $infoline = "######################################################\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $Global->print("\n"); + $Global->print(get_time_string()); + $Global->print("######################################################\n"); + $Global->print($message."\n"); + $Global->print("######################################################\n"); } #################################################### @@ -80,12 +395,12 @@ sub include_header_into_globallogfile sub include_timestamp_into_logfile { + Die "deprected"; my ($message) = @_; my $infoline; my $timestring = get_time_string(); - $infoline = "$message\t$timestring"; - push( @installer::globals::logfileinfo, $infoline); + $Lang->printf("%s\t%s", $message, $timestring); } #################################################### @@ -96,8 +411,8 @@ sub log_hashref { my ($hashref) = @_; - my $infoline = "\nLogging variable settings:\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $Global->print("\n"); + $Global->print("Logging variable settings:\n"); my $itemkey; @@ -106,12 +421,10 @@ sub log_hashref my $line = ""; my $itemvalue = ""; if ( $hashref->{$itemkey} ) { $itemvalue = $hashref->{$itemkey}; } - $line = $itemkey . "=" . $itemvalue . "\n"; - push(@installer::globals::globallogfileinfo, $line); + $Global->printf("%s=%s\n", $itemkey, $itemvalue); } - $infoline = "\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $Global->print("\n"); } ######################################################### @@ -124,18 +437,11 @@ sub globallog my $infoline; - $infoline = "\n" . get_time_string(); - push( @installer::globals::globallogfileinfo, $infoline); - - $infoline = "################################################################\n"; - push( @installer::globals::globallogfileinfo, $infoline); - - $infoline = "$message\n"; - push( @installer::globals::globallogfileinfo, $infoline); - - $infoline = "################################################################\n"; - push( @installer::globals::globallogfileinfo, $infoline); - + $Global->print("\n"); + $Global->print(get_time_string()); + $Global->print("################################################################\n"); + $Global->print($message."\n"); + $Global->print("################################################################\n"); } ############################################################### @@ -183,6 +489,9 @@ sub savedebug sub starttime { $installer::globals::starttime = time(); + $StartTime = [gettimeofday()]; + + my $localtime = localtime(); } ############################################################### @@ -258,8 +567,8 @@ sub get_file_age sub stoptime { - my $infoline = get_time_string(); - print_message( "$infoline" ); + my $localtime = localtime(); + $Info->printf("stopping log at %s\n", $localtime); } ############################################################### @@ -291,6 +600,8 @@ sub set_installation_date sub print_message { + Die "print_message is deprecated"; + my $message = shift; chomp $message; my $force = shift || 0; @@ -326,10 +637,37 @@ sub print_error { my $message = shift; chomp $message; - print STDERR "\n**************************************************\n"; + print STDERR "\n"; + print STDERR "**************************************************\n"; print STDERR "ERROR: $message"; - print STDERR "\n**************************************************\n"; + print STDERR "\n"; + print STDERR "**************************************************\n"; return; } + +=head2 PrintStackTrace() + This is for debugging the print and printf methods of the logger class and their use. + Therefore we use the Perl print/printf directly and not the logger methods to avoid loops in case of errors. +=cut +sub PrintStackTrace () +{ + print "Stack Trace:\n"; + my $i = 1; + while ((my @call_details = (caller($i++)))) + { + printf("%s:%s in function %s\n", $call_details[1], $call_details[2], $call_details[3]); + } +} + + +sub Die ($) +{ + my ($message) = @_; + PrintStackTrace(); + die $message; +} + + + 1; diff --git a/solenv/bin/modules/installer/packagelist.pm b/solenv/bin/modules/installer/packagelist.pm index a330ae3d0589..51706274beff 100644 --- a/solenv/bin/modules/installer/packagelist.pm +++ b/solenv/bin/modules/installer/packagelist.pm @@ -527,8 +527,7 @@ sub check_packagelist if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find script file $scriptfile for module $gid!", "check_packagelist"); } - my $infoline = "$gid: Using script file: \"$$fileref\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s: Using script file: \"%s\"!\n", $gid, $$fileref); $onepackage->{'script'} = $$fileref; } @@ -679,8 +678,7 @@ sub collectpackages if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $packinfofile for module $modulegid!", "collectpackages"); } - my $infoline = "$modulegid: Using packinfo: \"$$fileref\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s: Using packinfo: \"%s\"!\n", $modulegid, $$fileref); get_packinfo($modulegid, $$fileref, \@packages, $onelanguage, $islanguagemodule); } @@ -709,8 +707,7 @@ sub log_packages_content # checking all items that must be defined - $infoline = "Package $onepackage->{'module'}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Package %s\n", $onepackage->{'module'}); my $key; foreach $key (sort keys %{$onepackage}) @@ -719,24 +716,20 @@ sub log_packages_content if ( $key eq "allmodules" ) { - $infoline = "\t$key:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\t%s:\n", $key); my $onemodule; foreach $onemodule ( @{$onepackage->{$key}} ) { - $infoline = "\t\t$onemodule\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\t\t%s\n", $onemodule); } } else { - $infoline = "\t$key: $onepackage->{$key}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\t%s: %s\n", $key, $onepackage->{$key}); } } - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } } @@ -824,8 +817,7 @@ sub prepare_cabinet_files # checking all items that must be defined - $infoline = "Package $onepackage->{'module'}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Package %s\n", $onepackage->{'module'}); # Assigning the cab file to the module and also to all corresponding sub modules @@ -838,10 +830,12 @@ sub prepare_cabinet_files } else { - my $infoline = "Warning: Already existing assignment: $onemodule : $installer::globals::allcabinetassigns{$onemodule}\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Ignoring further assignment: $onemodule : $cabinetfile\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: Already existing assignment: %s : %s\n", + $onemodule, + $installer::globals::allcabinetassigns{$onemodule}); + $installer::logger::Lang->printf("Ignoring further assignment: %s : %s\n", + $onemodule, + $cabinetfile); } } } @@ -855,16 +849,23 @@ sub log_cabinet_assignments { installer::logger::include_header_into_logfile("Logging cabinet files:"); - my $infoline = "List of cabinet files:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("List of cabinet files:\n"); my $key; - foreach $key ( sort keys %installer::globals::allcabinets ) { push(@installer::globals::logfileinfo, "\t$key\n"); } + foreach $key ( sort keys %installer::globals::allcabinets ) + { + $installer::logger::Lang->printf("\t%s\n", $key); + } - $infoline = "\nList of assignments from modules to cabinet files:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("List of assignments from modules to cabinet files:\n"); - foreach $key ( sort keys %installer::globals::allcabinetassigns ) { push(@installer::globals::logfileinfo, "\t$key : $installer::globals::allcabinetassigns{$key}\n"); } + foreach $key ( sort keys %installer::globals::allcabinetassigns ) + { + $installer::logger::Lang->printf("\t%s : %s\n", + $key, + $installer::globals::allcabinetassigns{$key}); + } } 1; diff --git a/solenv/bin/modules/installer/packagepool.pm b/solenv/bin/modules/installer/packagepool.pm index 2473ea9bec00..b6c25d4306f2 100644 --- a/solenv/bin/modules/installer/packagepool.pm +++ b/solenv/bin/modules/installer/packagepool.pm @@ -57,8 +57,8 @@ sub set_sessionid my $timer = time(); # time $installer::globals::sessionid = $pid . $timer; $installer::globals::sessionidset = 1; - my $infoline = "\nPool: Setting session id: $installer::globals::sessionid.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Setting session id: $installer::globals::sessionid.\n"); } #################################################### @@ -104,7 +104,8 @@ sub compare_epm_content if ( $oldmember != $newmember ) { $identical = 0; - installer::logger::print_message("\n...... changed length of EPM file\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("...... changed length of EPM file\n"); $diffinfo = "Pool: EPM, different line count: old epm file: $oldmember, new epm file: $newmember\n"; push(@installer::globals::epmdifflist, $diffinfo); } @@ -119,7 +120,8 @@ sub compare_epm_content { $identical = 0; my $line = $i + 1; - installer::logger::print_message("\n...... different content in EPM file\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("...... different content in EPM file\n"); $diffinfo = "Pool: EPM, line $line changed from \"${$oldcontent}[$i]\" to \"$newlocalcontent[$i]\".\n"; push(@installer::globals::epmdifflist, $diffinfo); last; @@ -150,7 +152,8 @@ sub compare_package_content { # Logging the difference $identical = 0; - installer::logger::print_message("\n...... different number of files in packages. New number: $newmember, old number: $oldmember\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("...... different number of files in packages. New number: %s, old number: %s\n", $newmember, $oldmember); $infoline = "Different number of files in packages. New number: $newmember, old number: $oldmember\n"; push(@installer::globals::pcfdiffcomment, $infoline); } @@ -166,7 +169,7 @@ sub compare_package_content if ( ! exists($oldcontent->{$dest}) ) { $identical = 0; - installer::logger::print_message("$start...... file only in one package (A): $dest\n"); + $installer::logger::Info->printf("%s...... file only in one package (A): %s\n", $start, $dest); $infoline = "File only in existing pool package: $dest\n"; push(@installer::globals::pcfdiffcomment, $infoline); if ( $first ) { $start = ""; } @@ -182,7 +185,7 @@ sub compare_package_content if ( ! exists($newcontent->{$dest}) ) { $identical = 0; - installer::logger::print_message("$start...... file only in one package (B): $dest\n"); + $installer::logger::Info->printf("%s...... file only in one package (B): %s\n", $start, $dest); $infoline = "File only in new package: $dest\n"; push(@installer::globals::pcfdiffcomment, $infoline); if ( $first ) { $start = ""; } @@ -205,11 +208,11 @@ sub compare_package_content $identical = 0; if ( $first == 1 ) { - installer::logger::print_message("\n"); + $installer::logger::Info->print("\n"); $first = 0; } $installer::globals::pcfdifflist{$dest} = 1; - installer::logger::print_message("...... different file: $dest\n"); + $installer::logger::Info->printf("...... different file: %s\n", $dest); # last; } @@ -219,7 +222,8 @@ sub compare_package_content { $identical = 0; $installer::globals::pcfdifflist{$dest} = 1; - installer::logger::print_message("\n...... different file: $dest"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("...... different file: %s", $dest); # last; } } @@ -237,7 +241,8 @@ sub calculate_current_content { my ($filesarray, $packagename) = @_; - installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Calculating content for package content file ($packagename), start"); my %globalcontent = (); @@ -265,7 +270,8 @@ sub calculate_current_content $globalcontent{$destination} = \%onefilehash; } - installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Calculating content for package content file ($packagename), start"); return \%globalcontent; } @@ -424,8 +430,10 @@ sub check_pool_exit { my $timestring = installer::logger::convert_timestring($timeage); my $infoline = "\nPool: Attention: \"$lockfilename\" is too old ($timestring). Removing file!\n"; - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print($infoline); unlink $lockfilename; # installer::exiter::exit_program("ERROR: Waiting too long for removal of lock file \"$lockfilename\"", "check_pool_exit (packagepool)"); } @@ -434,9 +442,11 @@ sub check_pool_exit my $filecontent = installer::files::read_file($lockfilename); my $waittime = $timecounter * 10; $waittime = installer::logger::convert_timestring($waittime); - my $infoline = "\nPool: Warning: \"$lockfilename\" blocks this process for $waittime. Lock content: \"${$filecontent}[0]\"\n"; - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); + my $infoline = "Pool: Warning: \"$lockfilename\" blocks this process for $waittime. Lock content: \"${$filecontent}[0]\"\n"; + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print($infoline); } } @@ -457,16 +467,24 @@ sub log_pool_info if ( $file_exists ) { - $infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" belongs to another process. This process has session id: $installer::globals::sessionid .\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Content of Lock file:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $line ( @{$installer::globals::savelockfilecontent} ) { push( @installer::globals::logfileinfo, $line); } + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Pool Problem: Lock file \"%s\" belongs to another process. This process has session id: %s.\n", + $installer::globals::savelockfilename, + $installer::globals::sessionid); + $installer::logger::Lang->print("Content of Lock file:\n"); + foreach my $line ( @{$installer::globals::savelockfilecontent} ) + { + $installer::logger::Lang->print($line); + } } else { - $infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" does not exist anymore (this process has session id: $installer::globals::sessionid) .\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Pool Problem: Lock file \"%s\" does not exist anymore (this process has session id: %s).\n", + $installer::globals::savelockfilename, + $installer::globals::sessionid); } } @@ -499,8 +517,8 @@ sub remove_package_from_installset { my ($newpackagepath) = @_; - my $infoline = "Pool problem: Removing package \"$newpackagepath\" from installation set!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Pool problem: Removing package \"%s\" from installation set!\n", + $newpackagepath); if ( -f $newpackagepath ) { unlink $newpackagepath; } if ( -d $newpackagepath ) { installer::systemactions::remove_complete_directory($newpackagepath, 1); } @@ -518,7 +536,7 @@ sub package_is_up_to_date { my ($allvariables, $onepackage, $packagename, $newepmcontent, $filesinpackage, $installdir, $subdir, $languagestringref) = @_; - installer::logger::print_message_without_newline( "... checking pool package $packagename ..." ); + $installer::logger::Info->printf("... checking pool package ...\n", $packagename); installer::logger::include_header_into_logfile("Checking package in pool: $packagename"); @@ -563,10 +581,12 @@ sub package_is_up_to_date } $infoline = "Pool: $checkfilename exists. WAITING 10 seconds ($timecounter).\n"; - if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); } - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); - # if ( $timecounter % 50 == 0 ) { check_pool_exit($checkfilename, $timecounter); } + if ( $timecounter == 1 ) + { + $installer::logger::Info->print("\n"); + } + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print($infoline); if ( $timecounter % 100 == 0 ) { check_pool_exit($checkfilename, $timecounter); } sleep 10; # process sleeps 10 seconds $waited_for_check = 1; @@ -580,7 +600,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" could not be created successfully or was removed by another process (A)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -589,15 +609,18 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (A)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; } $infoline = "Pool: Created file: $checkfilename\n"; - push( @installer::globals::logfileinfo, $infoline); - if ( $waited_for_check ) { installer::logger::print_message( "... $infoline" ); } + $installer::logger::Lang->print($infoline); + if ( $waited_for_check ) + { + $installer::logger::Info->printf("... %s", $infoline); + } # Waiting, step 2 # Checking, if another process creates this package at the moment @@ -606,17 +629,22 @@ sub package_is_up_to_date { $timecounter++; $infoline = "Pool: $lockfilename exists. WAITING 10 seconds ($timecounter).\n"; - if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); } - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); - # if ( $timecounter % 50 == 0 ) { check_pool_exit($lockfilename, $timecounter); } + if ( $timecounter == 1 ) + { + $installer::logger::Info->print("\n"); + } + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print($infoline); if ( $timecounter % 100 == 0 ) { check_pool_exit($lockfilename, $timecounter); } sleep 10; # process sleeps 10 seconds $waited_for_lock = 1; } # No lock file exists, therefore no process creates this package at the moment. Check can be done now. - if ( $waited_for_lock ) { installer::logger::print_message( "... Pool: Proceeding, $lockfilename was removed.\n" ); } + if ( $waited_for_lock ) + { + $installer::logger::Info->printf("... Pool: Proceeding, %s was removed.\n", $lockfilename); + } my $package_already_exists = 0; @@ -651,26 +679,35 @@ sub package_is_up_to_date if ( $package_is_up_to_date ) { $infoline = "Pool: $packagename: No new content, using existing package\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... using package from pool\n" ); + $installer::logger::Lang->print($infoline); + $installer::logger::Info->printf("... using package from pool\n"); } else { if ( $package_already_exists ) { $infoline = "Pool: $packagename: Contains new content, creating new package. Differences:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $dest ( sort keys %installer::globals::pcfdifflist ) { push( @installer::globals::logfileinfo, "$dest\n"); } - foreach my $dest ( @installer::globals::pcfdiffcomment ) { push( @installer::globals::logfileinfo, "$dest"); } - foreach my $dest ( @installer::globals::epmdifflist ) { push( @installer::globals::logfileinfo, "$dest"); } + $installer::logger::Lang->print($infoline); + foreach my $dest ( sort keys %installer::globals::pcfdifflist ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } + foreach my $dest ( @installer::globals::pcfdiffcomment ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } + foreach my $dest ( @installer::globals::epmdifflist ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } } else { $infoline = "Pool: $packagename: Does not exist in pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::print_message( "... packaging required\n" ); + $installer::logger::Info->printf("... packaging required\n"); %installer::globals::xpdpackageinfo = (); # reset the filled hash, because the package cannot be used. # Creating lock mechanism, so that other processes do not create this package, too. @@ -682,7 +719,7 @@ sub package_is_up_to_date if ( ! -f $lockfilename ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" could not be created successfully or was removed by another process (D)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -691,14 +728,14 @@ sub package_is_up_to_date if ( ! process_is_owner($lockfilename) ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (D)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; } $infoline = "Pool: Created file: $lockfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $newpackagepath = ""; @@ -711,7 +748,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (B)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -720,7 +757,7 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (B)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -735,7 +772,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (C)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); # removing new package from installation set @@ -748,7 +785,7 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (C)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); # removing new package from installation set @@ -763,7 +800,7 @@ sub package_is_up_to_date unlink $checkfilename; $installer::globals::processhaspoolcheckfile = 0; $infoline = "Pool: Removing file: $checkfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Last chance before packaging starts, to check, if this process is really still owner # of the packaging lock file. If not, this packaging process can be repeated. @@ -772,7 +809,7 @@ sub package_is_up_to_date if ( ! -f $lockfilename ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" was removed by another process (E)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -781,7 +818,7 @@ sub package_is_up_to_date if ( ! process_is_owner($lockfilename) ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (E)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -884,7 +921,7 @@ sub put_content_into_pool # Put package into pool $infoline = "Pool: Adding package \"$packagename\" into pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Copying with unique name, containing PID. Only renaming if everything was fine. my $realdestination = ""; @@ -929,7 +966,7 @@ sub put_content_into_pool rename($uniquedestination, $realdestination); $infoline = "Pool: Renamed file: \"$uniquedestination\" to \"$realdestination\".\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Before the lock file in the pool can be removed, it has to be checked, if this process is still the owner of this lock file. # Check, if lock file still exists and if this process is the owner. Otherwise a pool error occured. @@ -949,7 +986,7 @@ sub put_content_into_pool unlink $installer::globals::poollockfilename; $installer::globals::processhaspoollockfile = 0; $infoline = "Pool: Removing file: $installer::globals::poollockfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################### @@ -961,7 +998,7 @@ sub copy_package_from_pool my ($installdir, $subdir, $packagename) = @_; my $infoline = "Pool: Using package \"$packagename\" from pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $sourcefile = $installer::globals::poolpath . $installer::globals::separator . $packagename; if ( $installer::globals::issolarisbuild ) { $sourcefile = $sourcefile . ".tar"; } if ( ! -f $sourcefile ) { installer::exiter::exit_program("ERROR: Missing package in package pool: \"$sourcefile\"", "copy_package_from_pool"); } @@ -1016,27 +1053,26 @@ sub log_pool_statistics my $created_packages = get_count(\%installer::globals::createpackages); $infoline = "Number of packages from pool: $pool_packages\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $packagename ( sort keys(%installer::globals::poolpackages) ) { $infoline = "\t$packagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - $infoline = "\nNumber of packages that were created: $created_packages\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Number of packages that were created: %s\n", $created_packages); foreach my $packagename ( sort keys(%installer::globals::createpackages) ) { $infoline = "\t$packagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $reason = $installer::globals::createpackages{$packagename}; - for ( my $i = 0; $i <= $#{$reason}; $i++ ) + foreach my $line (@reason) { - $infoline = "${$reason}[$i]"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($line); } } } diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm index c44ba17e0ad2..faa3cc1fde2a 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -30,6 +30,7 @@ use installer::globals; use installer::logger; use installer::remover; use installer::systemactions; +use strict; ############################################ # Parameter Operations @@ -95,21 +96,16 @@ sub saveparameter { if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::saveparameter"); } - my $include = ""; + $installer::logger::Global->printf("Command line arguments:\n"); - installer::logger::globallog("Command line arguments:"); - - for ( my $i = 0; $i <= $#ARGV; $i++ ) + my $index = 0; + foreach my $argument (@ARGV) { - $include = $ARGV[$i] . "\n"; - push(@installer::globals::globallogfileinfo, $include); + $installer::logger::Global->printf(" %2d: %s\n", $index++, $argument); } # also saving global settings: - - $include = "Separator: $installer::globals::separator\n"; - push(@installer::globals::globallogfileinfo, $include); - + $installer::logger::Global->printf("Separator: %s\n", $installer::globals::separator); } ##################################### @@ -340,8 +336,8 @@ sub setglobalvariables $installer::globals::debian = 1; $installer::globals::packageformat = "deb"; my $message = "Creating Debian packages"; - installer::logger::print_message( $message ); - push(@installer::globals::globallogfileinfo, $message); + $installer::logger::Info->print($message); + $installer::logger::Global->print($message); $installer::globals::islinuxrpmbuild = 0; $installer::globals::islinuxdebbuild = 1; $installer::globals::epmoutpath = "DEBS"; @@ -573,15 +569,14 @@ sub control_required_parameter # Writing parameter to shell and into logfile ################################################ -sub outputparameter +sub outputparameter () { if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::outputparameter"); } - my $element; - my @output = (); - push(@output, "\n########################################################\n"); + push(@output, "\n"); + push(@output, "########################################################\n"); push(@output, "$installer::globals::prog, version 1.0\n"); push(@output, "Product list file: $installer::globals::ziplistname\n"); if (!($installer::globals::setupscript_defined_in_productlist)) @@ -624,7 +619,7 @@ sub outputparameter if (!($installer::globals::languages_defined_in_productlist)) { push(@output, "Languages:\n"); - foreach $element (@installer::globals::languageproducts) { push(@output, "\t$element\n"); } + foreach my $element (@installer::globals::languageproducts) { push(@output, "\t$element\n"); } } else { @@ -637,10 +632,10 @@ sub outputparameter # output into shell and into logfile - for ( my $i = 0; $i <= $#output; $i++ ) + foreach my $line (@output) { - installer::logger::print_message( $output[$i] ); - push(@installer::globals::globallogfileinfo, $output[$i]); + $installer::logger::Info->print($line); + $installer::logger::Global->print($line); } } diff --git a/solenv/bin/modules/installer/profiles.pm b/solenv/bin/modules/installer/profiles.pm index 6c5869c4e642..c31a54eb7601 100644 --- a/solenv/bin/modules/installer/profiles.pm +++ b/solenv/bin/modules/installer/profiles.pm @@ -215,12 +215,10 @@ sub create_profiles # Some data are set now, others are taken from the file "soffice.exe" ("soffice.bin") add_profile_into_filelist($filesarrayref, $oneprofile, $completeprofilename, $allvariables); - $infoline = "Created Profile: $completeprofilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created Profile: %s\n", $completeprofilename); } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } diff --git a/solenv/bin/modules/installer/scppatchsoname.pm b/solenv/bin/modules/installer/scppatchsoname.pm index a9bf09ae06eb..3adec119d608 100644 --- a/solenv/bin/modules/installer/scppatchsoname.pm +++ b/solenv/bin/modules/installer/scppatchsoname.pm @@ -183,13 +183,12 @@ sub resolving_patchsoname_flag if ($found == 0) { - my $infoline = "Did not patch the file $destinationpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Did not patch the file %s\n", $destinationpath); } else { - my $infoline = "Successfully patched $destinationpath, Count: $found\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully patched %s, Count: %s\n", + $destinationpath, $found); } } @@ -207,8 +206,7 @@ sub resolving_patchsoname_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); } 1; diff --git a/solenv/bin/modules/installer/scpzipfiles.pm b/solenv/bin/modules/installer/scpzipfiles.pm index b950baaea107..ecc1d3e76dd1 100644 --- a/solenv/bin/modules/installer/scpzipfiles.pm +++ b/solenv/bin/modules/installer/scpzipfiles.pm @@ -176,8 +176,7 @@ sub resolving_scpzip_replace_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } 1; diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index 50c96a75a3fb..d07498bdbafc 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -103,8 +103,8 @@ sub resolve_all_directory_names if ($parentvalue eq "") { $directoryhashref->{$key} = "FAILURE"; - my $infoline = "WARNING: No hostname for $parentid with \"$key\". Needed by child directory $gid !\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("WARNING: No hostname for %s with \"%s\". Needed by child directory %s !\n", + $parentid, $key, $gid); } else { @@ -206,8 +206,8 @@ sub remove_notinsuite_files_from_productlists } else { - my $infoline = "INFO: Flag NOT_IN_SUITE \-\> Removing $oneitem->{'gid'} from file list.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("INFO: Flag NOT_IN_SUITE \-\> Removing %s from file list.\n", + $oneitem->{'gid'}); } } @@ -240,8 +240,9 @@ sub remove_office_start_language_files } else { - my $infoline = "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing $oneitem->{'gid'} from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing %s from file list.\n", + $oneitem->{'gid'}); } } @@ -436,8 +437,7 @@ sub remove_not_required_spellcheckerlanguage_modules } else { - $infoline = "Spellchecker selection: Removing module $module->{'gid'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Spellchecker selection: Removing module %s\n", $module->{'gid'}); # Collecting all files at modules that are removed @@ -481,8 +481,8 @@ sub remove_not_required_spellcheckerlanguage_files my $onefile = ${$filesarrayref}[$i]; if ( exists($installer::globals::spellcheckerfilehash{$onefile->{'gid'}}) ) { - $infoline = "Spellchecker selection: Removing file $onefile->{'gid'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Spellchecker selection: Removing file %s\n", + $onefile->{'gid'}); next; } push(@filesarray, $onefile); @@ -541,13 +541,12 @@ sub add_bundled_extension_blobs # file:// extensions are added as pre-registered in add_bundled_prereg_extension(). } - installer::logger::print_message( - sprintf("preparing %d extension blob%s for language%s %s:\n", - $#bundle_files + 1, - $#bundle_files!=0 ? "s" : "", - $#installer::globals::languageproducts!=0 ? "s" : "", - join(" ", @installer::globals::languageproducts), - join("\n ", @bundle_files))); + $installer::logger::Info->printf( + "preparing %d extension blob%s for language%s %s:\n", + $#bundle_files + 1, + $#bundle_files!=0 ? "s" : "", + $#installer::globals::languageproducts!=0 ? "s" : "", + join(" ", @installer::globals::languageproducts)); foreach my $filename ( @bundle_files) { @@ -562,9 +561,9 @@ sub add_bundled_extension_blobs 'gid' => "gid_File_Extension_".$basename }; push( @filelist, $onefile); - push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n"); + $installer::logger::Lang->printf("\tbundling \"%s\" extension\n", $filename); - installer::logger::print_message(" " . $basename . "\n"); + $installer::logger::Info->printf(" %s\n", $basename); } return \@filelist; @@ -609,13 +608,16 @@ sub add_bundled_prereg_extensions } } - installer::logger::print_message( - sprintf("preparing %d bundled extension%s for language%s %s:\n %s\n", - $#bundle_files + 1, - $#bundle_files!=0 ? "s" : "", - $#installer::globals::languageproducts!=0 ? "s" : "", - join(" ", @installer::globals::languageproducts), - join("\n ", @bundle_files))); + $installer::logger::Info->printf( + "preparing %d bundled extension%s for language%s %s:\n", + $#bundle_files + 1, + $#bundle_files!=0 ? "s" : "", + $#installer::globals::languageproducts!=0 ? "s" : "", + join(" ", @installer::globals::languageproducts)); + foreach my $filename (@bundle_files) + { + $installer::logger::Info->printf(" %s\n", $filename); + } # Find the prereg directory entry so that we can create a new sub-directory. my $parentdir_gid = "gid_Brand_Dir_Share_Prereg_Bundled"; @@ -659,7 +661,7 @@ sub add_bundled_prereg_extensions 'gid' => "gid_File_Extension_".$basename }; push( @filelist, $onefile); - push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n"); + $installer::logger::Lang->printf("\tbundling \"%s\" extension\n", $filename); } return (\@filelist, $dirsref); @@ -1088,8 +1090,9 @@ sub remove_non_existent_languages_in_productlists if ($itemtoberemoved) { - $infoline = "WARNING: Language $$languagestringref: No $itemtype packed for $oneitem->{'gid'}!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("WARNING: Language %s: No $itemtype packed for %s!\n", + $$languagestringref, + $oneitem->{'gid'}); } else { @@ -1097,8 +1100,7 @@ sub remove_non_existent_languages_in_productlists } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); return \@allexistentitems; } @@ -1261,15 +1263,16 @@ sub get_sourcepath_from_filename_and_includepath_classic $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } else { if ( $write_logfile) { - $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("SUCCESS: Source for %s: %s\n", + $$searchfilenameref, + $onefile); } } @@ -1339,7 +1342,7 @@ sub get_sourcepath_from_filename_and_includepath $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } else @@ -1354,7 +1357,7 @@ sub get_sourcepath_from_filename_and_includepath { $infoline = "SUCCESS/WARNING: Special handling for $$searchfilenameref: $onefile\n"; } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } @@ -1445,9 +1448,8 @@ sub get_Source_Directory_For_Files_From_Includepathlist if ($onefile->{'sourcepath'}) # defaulting to english was successful { - $infoline = "WARNING: Using $onefilename instead of $oldname\n"; - push( @installer::globals::logfileinfo, $infoline); - print " $infoline"; + $installer::logger::Lang->printf("WARNING: Using %s instead of %s\n", $onefilename, $oldname); + $installer::logger::Info->printf("WARNING: Using %s instead of %s\n", $onefilename, $oldname); # if ( $onefile->{'destination'} ) { $onefile->{'destination'} =~ s/\Q$oldname\E/$onefile->{'Name'}/; } # If the directory, in which the new file is installed, is not language dependent, @@ -1463,23 +1465,25 @@ sub get_Source_Directory_For_Files_From_Includepathlist if ( ! $islanguagedependent ) { $onefile->{'Styles'} =~ s/\bARCHIVE\b/ARCHIVE, RENAME_TO_LANGUAGE/; # Setting new flag RENAME_TO_LANGUAGE - $infoline = "Setting flag RENAME_TO_LANGUAGE: File $onefile->{'Name'} in directory: $directorygid\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Setting flag RENAME_TO_LANGUAGE: File %s in directory: %s\n", + $onefile->{'Name'}, + $directorygid); } } } else { - $infoline = "WARNING: Using $onefile->{'Name'} instead of $oldname was not successful\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("WARNING: Using %s instead of %s was not successful\n", + $onefile->{'Name'}, $oldname); $onefile->{'Name'} = $oldname; # Switching back to old file name } } } } - $infoline = "\n"; # empty line after listing of all files - push( @installer::globals::logfileinfo, $infoline); + # empty line after listing of all files + $installer::logger::Lang->printf("\n"); } ################################################################################# @@ -1507,8 +1511,8 @@ sub remove_Files_For_Languagepacks if (( $gid eq "gid_File_Extra_Fontunxpsprint" ) || ( $gid eq "gid_File_Extra_Migration_Lang" )) { - $infoline = "ATTENTION: Removing item $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Removing item %s from the installation set.\n", + $oneitem->{'gid'},); next; } @@ -1549,8 +1553,8 @@ sub remove_Files_Without_Sourcedirectory if ( ! $installer::globals::languagepack ) { - $infoline = "ERROR: No sourcepath -> Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: No sourcepath -> Removing file %s from file list.\n", + $filename); push(@missingfiles, "ERROR: File not found: $filename\n"); $error_occured = 1; @@ -1561,8 +1565,7 @@ sub remove_Files_Without_Sourcedirectory { if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Removing file %s from file list.\n", $filename); push(@missingfiles, "ERROR: File not found: $filename\n"); $error_occured = 1; @@ -1571,10 +1574,11 @@ sub remove_Files_Without_Sourcedirectory } else { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "INFO: Removing file %s from file list. It is not language dependent.\n", + $filename); + $installer::logger::Lang->printf( + "INFO: It is not language dependent and can be ignored in language packs.\n"); next; # removing this file from list, if sourcepath is empty } @@ -1584,8 +1588,7 @@ sub remove_Files_Without_Sourcedirectory push(@newfilesarray, $onefile); } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); if ( $error_occured ) { @@ -1717,20 +1720,24 @@ sub add_License_Files_into_Installdir push(@newfilesarray, $newfile); - $infoline = "New files: Adding file $newfilename for the installation root to the file list. Language: $defaultlanguage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Adding file %s for the installation root to the file list. Language: %s\n", + $newfilename, + $defaultlanguage); if ( defined $newfile->{'InstallName'} ) { - $infoline = "New files: Using installation name: $newfile->{'InstallName'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Using installation name: %s\n", $newfile->{'InstallName'}); } # Collecting license and readme file for the installation set push(@installer::globals::installsetfiles, $newfile); - $infoline = "New files: Adding file $newfilename to the file collector for the installation set. Language: $defaultlanguage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Adding file %s to the file collector for the installation set. Language: %s\n", + $newfilename, + $defaultlanguage); } push(@newfilesarray, $onefile); @@ -1760,13 +1767,12 @@ sub remove_onlyasialanguage_files_from_productlists my $containsasianlanguage = installer::languages::detect_asian_language($installer::globals::alllanguagesinproductarrayref); my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); - $infoline = "\nLanguages in complete product: $alllangstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Languages in complete product: %s\n", $alllangstring); if ( ! $containsasianlanguage ) { - $infoline = "Product does not contain asian language -> removing files\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Product does not contain asian language -> removing files\n"); for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) { @@ -1775,8 +1781,9 @@ sub remove_onlyasialanguage_files_from_productlists if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } if ( $styles =~ /\bONLY_ASIA_LANGUAGE\b/ ) { - $infoline = "Flag ONLY_ASIA_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Flag ONLY_ASIA_LANGUAGE: Removing file %s from files collector!\n", + $onefile->{'Name'}); next; } @@ -1789,9 +1796,7 @@ sub remove_onlyasialanguage_files_from_productlists { $returnfilesarrayref = $filesarrayref; - $infoline = "Product contains asian language -> Nothing to do\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Product contains asian language -> Nothing to do\n"); } return $returnfilesarrayref; @@ -1818,13 +1823,12 @@ sub remove_onlywesternlanguage_files_from_productlists my $containswesternlanguage = installer::languages::detect_western_language($installer::globals::alllanguagesinproductarrayref); my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); - $infoline = "\nLanguages in complete product: $alllangstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Languages in complete product: %s\n", $alllangstring); if ( ! $containswesternlanguage ) { - $infoline = "Product does not contain western language -> removing files\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Product does not contain western language -> removing files\n"); for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) { @@ -1833,8 +1837,9 @@ sub remove_onlywesternlanguage_files_from_productlists if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } if ( $styles =~ /\bONLY_WESTERN_LANGUAGE\b/ ) { - $infoline = "Flag ONLY_WESTERN_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Flag ONLY_WESTERN_LANGUAGE: Removing file %s from files collector!\n", + $onefile->{'Name'}); next; } @@ -1847,9 +1852,7 @@ sub remove_onlywesternlanguage_files_from_productlists { $returnfilesarrayref = $filesarrayref; - $infoline = "Product contains western language -> Nothing to do\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Product contains western language -> Nothing to do\n"); } return $returnfilesarrayref; @@ -1895,12 +1898,10 @@ sub make_filename_language_specific $onefile->{'destination'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/; } - $infoline = "Flag MAKE_LANG_SPECIFIC:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Changing name from $oldname to $onefile->{'Name'} !\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Changing destination from $olddestination to $onefile->{'destination'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Flag MAKE_LANG_SPECIFIC:\n"); + $installer::logger::Lang->printf("Changing name from %s to %s !\n", $oldname, $onefile->{'Name'}); + $installer::logger::Lang->printf("Changing destination from %s to %s !\n", + $olddestination, $onefile->{'destination'}); } } } @@ -1930,8 +1931,9 @@ sub remove_scpactions_without_name if ( $name eq "" ) { - $infoline = "ATTENTION: Removing scpaction $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "ATTENTION: Removing scpaction %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2009,8 +2011,9 @@ sub remove_Xpdonly_Items if ( $styles =~ /\bXPD_ONLY\b/ ) { - $infoline = "Removing \"xpd only\" item $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing \"xpd only\" item %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2018,8 +2021,7 @@ sub remove_Xpdonly_Items push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2047,8 +2049,9 @@ sub remove_Languagepacklibraries_from_Installset if ( $styles =~ /\bLANGUAGEPACK\b/ ) { - $infoline = "Removing language pack file $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing language pack file %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2056,8 +2059,7 @@ sub remove_Languagepacklibraries_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2085,8 +2087,9 @@ sub remove_patchonlyfiles_from_Installset if ( $styles =~ /\bPATCH_ONLY\b/ ) { - $infoline = "Removing file with flag PATCH_ONLY $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing file with flag PATCH_ONLY %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2094,8 +2097,7 @@ sub remove_patchonlyfiles_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2123,8 +2125,9 @@ sub remove_tabonlyfiles_from_Installset if ( $styles =~ /\bTAB_ONLY\b/ ) { - $infoline = "Removing tab only file $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing tab only file %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2132,8 +2135,7 @@ sub remove_tabonlyfiles_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2161,16 +2163,16 @@ sub remove_installedproductonlyfiles_from_Installset if ( $styles =~ /\bONLY_INSTALLED_PRODUCT\b/ ) { - $infoline = "Removing file $oneitem->{'gid'} from the installation set. This file is only required for PKGFORMAT archive or installed).\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing file from the installation set. This file is only required for PKGFORMAT archive or installed).\n", + $oneitem->{'gid'}); next; } push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2202,16 +2204,15 @@ sub quoting_illegal_filenames # sourcepath and destination have to be quoted for epm list file - # $filename =~ s/\$/\$\$/g; $destpath =~ s/\$/\$\$/g; $sourcepath =~ s/\$/\$\$/g; - # my $infoline = "ATTENTION: Files: Renaming $onefile->{'Name'} to $filename\n"; - # push( @installer::globals::logfileinfo, $infoline); - my $infoline = "ATTENTION: Files: Quoting sourcepath $onefile->{'sourcepath'} to $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "ATTENTION: Files: Quoting destination path $onefile->{'destination'} to $destpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Files: Quoting sourcepath %s to %s\n", + $onefile->{'sourcepath'}, + $sourcepath); + $installer::logger::Lang->printf("ATTENTION: Files: Quoting destination path %s to %s\n", + $onefile->{'destination'}, + $destpath); # $onefile->{'Name'} = $filename; $onefile->{'sourcepath'} = $sourcepath; @@ -2514,14 +2515,14 @@ sub get_destination_file_path_for_links if (!($foundfile)) { - $infoline = "Warning: FileID $fileid for Link $onelink->{'gid'} not found!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: FileID %s for Link %s not found!\n", + $fileid, + $onelink->{'gid'}); } } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } ################################################# @@ -2561,14 +2562,14 @@ sub get_destination_link_path_for_links if (!($foundlink)) { - $infoline = "Warning: ShortcutID $shortcutid for Link $onelink->{'gid'} not found!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: ShortcutID %s for Link %s not found!\n", + $shortcutid, + $onelink->{'gid'}); } } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } ################################################################################### @@ -2786,14 +2787,14 @@ sub assigning_modules_to_items if (( $oneitem->{'ismultilingual'} ) && ( ! $oneitem->{'haslanguagemodule'} )) { $infoline = "Error: \"$oneitem->{'gid'}\" is multi lingual, but not in language pack (Assigned module: $modulegids)!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); push( @languageassignmenterrors, $infoline ); $languageassignmenterror = 1; } if (( $oneitem->{'haslanguagemodule'} ) && ( ! $oneitem->{'ismultilingual'} )) { $infoline = "Error: \"$oneitem->{'gid'}\" is in language pack, but not multi lingual (Assigned module: $modulegids)!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); push( @languageassignmenterrors, $infoline ); $languageassignmenterror = 1; } @@ -2918,8 +2919,7 @@ sub collect_all_parent_feature if ( $found_root_module ) { installer::exiter::exit_program("ERROR: Only one module without ParentID or with empty ParentID allowed ($installer::globals::rootmodulegid, $onefeature->{'gid'}).", "collect_all_parent_feature"); } $installer::globals::rootmodulegid = $onefeature->{'gid'}; $found_root_module = 1; - $infoline = "Setting Root Module: $installer::globals::rootmodulegid\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Setting Root Module: %s\n", $installer::globals::rootmodulegid); } if ( ! $found_root_module ) { installer::exiter::exit_program("ERROR: Could not define root module. No module without ParentID or with empty ParentID exists.", "collect_all_parent_feature"); } diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index 4416a02754bd..2d4f6de6c9d4 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -285,10 +285,14 @@ sub replace_all_setupscriptvariables_in_script $num++; if ( $check =~ /^.*\%\w+.*$/ ) { - if (( $check =~ /%1/ ) || ( $check =~ /%2/ ) || ( $check =~ /%verify/ )) { next; } - my $infoline = "WARNING: mis-named or un-known '%' variable in setup script at line $num:\n$check\n"; - push( @installer::globals::globallogfileinfo, $infoline); - # print STDERR "Warning: mis-named or un-known '%' variable at line $num:\n$check\n"; + if (( $check =~ /%1/ ) || ( $check =~ /%2/ ) || ( $check =~ /%verify/ )) + { + next; + } + $installer::logger::Global->printf( + "WARNING: mis-named or un-known '%s' variable in setup script at line %s:\n", + "%", $num); + $installer::logger::Global->printf("%s\n", $check); } } diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index 4525a524bb64..28b1414de1ab 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -86,7 +86,7 @@ sub register_extensions if ( $preregdir eq "" ) { $infoline = "ERROR: Failed to determine directory \"prereg\" for extension registration! Please check your installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "register_extensions"); } @@ -104,31 +104,31 @@ sub register_extensions { $unopkgexists = 0; $infoline = "Language packs do not contain unopkg!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( ! -f $unopkgfile ) { $unopkgexists = 0; $infoline = "Info: File $unopkgfile does not exist! Extensions cannot be registered.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $unopkgexists ) { my $currentdir = cwd(); - print "... current dir: $currentdir ...\n"; + $installer::logger::Info->printf("... current dir: %s ...\n", $currentdir); $infoline = "Current dir: $currentdir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); } my $systemcall = $unopkgfile . " sync --verbose" . " -env:UNO_JAVA_JFW_ENV_JREHOME=true 2\>\&1 |"; - print "... $systemcall ...\n"; + $installer::logger::Info->printf("... %s ...\n", $systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my @unopkgoutput = (); @@ -147,16 +147,19 @@ sub register_extensions # Writing content of @unopkgoutput only in the error case into the log file. Sometimes it # contains strings like "Error" even in the case of success. This causes a packaging error # when the log file is analyzed at the end, even if there is no real error. - for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); } + foreach my $line (@unopkgoutput) + { + $installer::logger::Lang->printf($line); + } $infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions"); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -177,7 +180,7 @@ sub get_mac_translation_file my $translationfile = installer::files::read_file($translationfilename); my $infoline = "Reading translation file: $translationfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $translationfile; } @@ -352,7 +355,7 @@ sub create_package { my ( $installdir, $archivedir, $packagename, $allvariables, $includepatharrayref, $languagestringref, $format ) = @_; - installer::logger::print_message( "... creating $installer::globals::packageformat file ...\n" ); + $installer::logger::Info->printf("... creating %s file ...\n", $installer::globals::packageformat); installer::logger::include_header_into_logfile("Creating $installer::globals::packageformat file:"); # moving dir into temporary directory @@ -448,20 +451,20 @@ sub create_package $systemcall = "tar -cjf $tarballname Contents/"; - print "... $systemcall ...\n"; + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $localreturnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($localreturnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $sourcefile = $appfolder . "/" . $tarballname; @@ -563,26 +566,26 @@ sub create_package if ( $makesystemcall ) { - print "... $systemcall ...\n"; + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } if ( $return_to_start ) { chdir($from); } - print "... removing $tempdir ...\n"; + $installer::logger::Info->printf("... removing %s ...\n", $tempdir); installer::systemactions::remove_complete_directory($tempdir); } @@ -600,7 +603,7 @@ sub create_simple_package my $current_install_number = ""; my $infoline = ""; - installer::logger::print_message( "... creating installation directory ...\n" ); + $installer::logger::Info->print( "... creating installation directory ...\n" ); installer::logger::include_header_into_logfile("Creating installation directory"); $installer::globals::csp_installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); @@ -653,7 +656,7 @@ sub create_simple_package # Create directories, copy files and ScpActions - installer::logger::print_message( "... creating directories ...\n" ); + $installer::logger::Info->print("... creating directories ...\n"); installer::logger::include_header_into_logfile("Creating directories:"); for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) @@ -668,8 +671,7 @@ sub create_simple_package { if ( $^O =~ /cygwin/i || $^O =~ /os2/i ) # Cygwin performance check { - $infoline = "Try to create directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Try to create directory %s\n", $destdir); # Directories in $dirsref are sorted and all parents were added -> "mkdir" works without parent creation! if ( ! ( -d $destdir )) { mkdir($destdir, 0775); } } @@ -685,7 +687,7 @@ sub create_simple_package if (( $installer::globals::strip ) && ( ! $installer::globals::iswindowsbuild ) && ( ! $installer::globals::isos2 )) { installer::strip::strip_libraries($filesref, $languagestringref); } # copy Files - installer::logger::print_message( "... copying files ...\n" ); + $installer::logger::Info->print("... copying files ...\n"); installer::logger::include_header_into_logfile("Copying files:"); for ( my $i = 0; $i <= $#{$filesref}; $i++ ) @@ -711,16 +713,14 @@ sub create_simple_package if ($copyreturn) { - $infoline = "Copy: $source to $destination\n"; + $installer::logger::Lang->printf("Copy: $source to %s\n", $destination); $returnvalue = 1; } else { - $infoline = "ERROR: Could not copy $source to $destination\n"; + $installer::logger::Lang->printf("ERROR: Could not copy %s to %s\n", $source, $destination); $returnvalue = 0; } - - push(@installer::globals::logfileinfo, $infoline); } else { @@ -743,7 +743,7 @@ sub create_simple_package # creating Links - installer::logger::print_message( "... creating links ...\n" ); + $installer::logger::Info->print("... creating links ...\n"); installer::logger::include_header_into_logfile("Creating links:"); for ( my $i = 0; $i <= $#{$linksref}; $i++ ) @@ -759,8 +759,9 @@ sub create_simple_package my $localcall = "ln -sf \'$destinationfile\' \'$destination\' \>\/dev\/null 2\>\&1"; system($localcall); - $infoline = "Creating link: \"ln -sf $destinationfile $destination\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating link: \"ln -sf %s %s\"\n", + $destinationfile, + $destination); } for ( my $i = 0; $i <= $#{$unixlinksref}; $i++ ) @@ -775,22 +776,23 @@ sub create_simple_package my $localcall = "ln -sf \'$target\' \'$destination\' \>\/dev\/null 2\>\&1"; system($localcall); - $infoline = "Creating Unix link: \"ln -sf $target $destination\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating Unix link: \"ln -sf %s %s\"\n", + $target, + $destination); } # Setting privileges for cygwin globally if ( $^O =~ /cygwin/i ) { - installer::logger::print_message( "... changing privileges in $subfolderdir ...\n" ); + $installer::logger::Lang->print( "... changing privileges in $subfolderdir ...\n" ); installer::logger::include_header_into_logfile("Changing privileges in $subfolderdir:"); my $localcall = "chmod -R 755 " . "\"" . $subfolderdir . "\""; system($localcall); } - installer::logger::print_message( "... removing superfluous directories ...\n" ); + $installer::logger::Lang->print( "... removing superfluous directories ...\n" ); installer::logger::include_header_into_logfile("Removing superfluous directories:"); my ( $extensionfolder, $preregdir ) = get_extensions_dir($subfolderdir); @@ -798,7 +800,7 @@ sub create_simple_package # Registering the extensions - installer::logger::print_message( "... registering extensions ...\n" ); + $installer::logger::Lang->print( "... registering extensions ...\n" ); installer::logger::include_header_into_logfile("Registering extensions:"); register_extensions($subfolderdir, $languagestringref, $preregdir); diff --git a/solenv/bin/modules/installer/strip.pm b/solenv/bin/modules/installer/strip.pm index 65e9badfe2b3..d821caa5e415 100644 --- a/solenv/bin/modules/installer/strip.pm +++ b/solenv/bin/modules/installer/strip.pm @@ -64,17 +64,17 @@ sub do_strip my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not strip $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "SUCCESS: Stripped library $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -105,7 +105,7 @@ sub strip_libraries installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); $infoline = "Strip: $shortfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # copy file into directory for stripped libraries diff --git a/solenv/bin/modules/installer/substfilenamefiles.pm b/solenv/bin/modules/installer/substfilenamefiles.pm index 4226303cef4e..0cb575020899 100644 --- a/solenv/bin/modules/installer/substfilenamefiles.pm +++ b/solenv/bin/modules/installer/substfilenamefiles.pm @@ -155,8 +155,7 @@ sub resolving_subst_filename_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } 1; diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index cd25ed17f5a4..76e4ace1f521 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -48,8 +48,8 @@ sub create_directory if ($returnvalue) { - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -64,8 +64,10 @@ sub create_directory # was not created in this process. There is only an important error, if the directory does not # exist now. - $infoline = "\nDid not succeed in creating directory: \"$directory\". Further attempts will follow.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Did not succeed in creating directory: \"%s\". Further attempts will follow.\n", + $directory); if (!(-d $directory)) { @@ -79,8 +81,10 @@ sub create_directory if ($returnvalue) { - $infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Successfully created parent directory (should already be created before): %s\n", + $parentdir); my $localcall = "chmod 775 $parentdir \>\/dev\/null 2\>\&1"; system($localcall); @@ -88,11 +92,13 @@ sub create_directory else { $infoline = "\Error: \"$directory\" could not be created. Even the parent directory \"$parentdir\" does not exist and could not be created.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -d $parentdir ) { - $infoline = "\nAttention: Finally the parent directory \"$parentdir\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the parent directory \"%s\" exists, but I could not create it.\n", + $parentdir); } else { @@ -109,8 +115,10 @@ sub create_directory if ($returnvalue) { - $infoline = "\nAttention: Created directory \"$directory\" in the second try.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Created directory \"\" in the second try.\n", + $directory);; my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -119,8 +127,10 @@ sub create_directory { if ( -d $directory ) { - $infoline = "\nAttention: Finally the directory \"$directory\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the directory \"%s\" exists, but I could not create it.\n", + $directory); } else { @@ -131,15 +141,16 @@ sub create_directory } else { - $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Another process created this directory in exactly this moment :-) : %s\n", + $directory);; } } } else { - $infoline = "\nAlready existing directory, did not create: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Already existing directory, did not create: %s\n", $directory); } } @@ -161,8 +172,8 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -173,8 +184,10 @@ sub create_directory_with_privileges # was not created in this process. There is only an important error, if the directory does not # exist now. - $infoline = "\nDid not succeed in creating directory: \"$directory\". Further attempts will follow.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Did not succeed in creating directory: \"%s\". Further attempts will follow.\n", + $directory); if (!(-d $directory)) { @@ -188,8 +201,10 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Successfully created parent directory (should already be created before): %s\n", + $parentdir); my $localcall = "chmod $privileges $parentdir \>\/dev\/null 2\>\&1"; system($localcall); @@ -197,11 +212,13 @@ sub create_directory_with_privileges else { $infoline = "\Error: \"$directory\" could not be created. Even the parent directory \"$parentdir\" does not exist and could not be created.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -d $parentdir ) { - $infoline = "\nAttention: Finally the parent directory \"$parentdir\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the parent directory \"%s\" exists, but I could not create it.\n", + $parentdir); } else { @@ -218,8 +235,9 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nAttention: Created directory \"$directory\" in the second try.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Attention: Created directory \"%s\" in the second try.\n", + $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -228,8 +246,10 @@ sub create_directory_with_privileges { if ( -d $directory ) { - $infoline = "\nAttention: Finally the directory \"$directory\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the directory \"\" exists, but I could not create it.\n", + $directory); } else { @@ -240,21 +260,54 @@ sub create_directory_with_privileges } else { - $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Another process created this directory in exactly this moment :-) : %s\n", + $directory); } } } else { - $infoline = "\nAlready existing directory, did not create: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Already existing directory, did not create: %s\n", $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); } } + + + +=item is_directory_empty ($path) + Return + 1 if there are no files in the directory pointed to by $path + 0 if there are files + -1 if there is an error accessing the directory. +=cut +sub is_directory_empty ($) +{ + my ($path) = @_; + + opendir my $dir, $path or return -1; + + my $result = 1; + while (my $entry = readdir($dir)) + { + if ($entry !~ /^\.+$/) + { + $result = 0; + last; + } + } + + return $result; +} + + + + ###################################################### # Removing a new direcotory ###################################################### @@ -267,22 +320,27 @@ sub remove_empty_directory if (-d $directory) { - my $systemcall = "rmdir $directory"; - - $returnvalue = system($systemcall); - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - if ($returnvalue) + if ( ! is_directory_empty($directory)) { - $infoline = "ERROR: Could not remove \"$directory\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("directory '%s' is not empty and can not be removed\n", $directory); + return; } else { - $infoline = "Success: Removed \"$directory\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + my $systemcall = "rmdir $directory"; + + $returnvalue = system($systemcall); + + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); + + if ($returnvalue) + { + $installer::logger::Lang->printf("ERROR: Could not remove \"%s\"!\n", $directory); + } + else + { + $installer::logger::Lang->printf("Success: Removed \"%s\"!\n", $directory); + } } } } @@ -348,7 +406,7 @@ sub create_directories } $infoline = "create_directories: Using $path for $newdirectory !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($newdirectory eq "unzip" ) # special handling for common directory { @@ -445,7 +503,7 @@ sub copy_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( !$returnvalue ) { return $returnvalue; @@ -467,7 +525,7 @@ sub copy_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $returnvalue; @@ -496,7 +554,7 @@ sub hardlink_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -524,7 +582,7 @@ sub softlink_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -552,7 +610,7 @@ sub rename_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -572,9 +630,9 @@ sub copy_directory $destdir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -644,9 +702,9 @@ sub hardlink_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Creating hard links for all files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -688,9 +746,9 @@ sub softlink_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Creating soft links for all files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -735,9 +793,9 @@ sub copy_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -782,9 +840,9 @@ sub copy_complete_directory_without_cvs if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir (without CVS)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -825,9 +883,9 @@ sub copy_directory_with_fileextension $destdir =~ s/\Q$installer::globals::separator\E\s*$//; $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files with extension $extension from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -867,9 +925,9 @@ sub copy_directory_except_fileextension $destdir =~ s/\Q$installer::globals::separator\E\s*$//; $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files without extension $extension from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -909,9 +967,9 @@ sub rename_files_with_fileextension $dir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Renaming files with extension \"$extension\" in the directory $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $dir); @sourcefiles = readdir(DIR); @@ -951,9 +1009,9 @@ sub find_file_with_file_extension $dir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Searching files with extension \"$extension\" in the directory $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $dir); @sourcefiles = sort readdir(DIR); @@ -1010,14 +1068,16 @@ sub make_numbered_dir if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from %s to %s\n", $olddir, $newdir); $returndir = $newdir; } else { - $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"make_numbered_dir\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("ATTENTION: Could not move directory from %s to %s, \"make_numbered_dir\"\n", + $olddir, + $newdir); $returndir = $olddir; } @@ -1131,13 +1191,15 @@ sub rename_string_in_directory if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from $olddir to %s\n", $newdir); } else { - $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"rename_string_in_directory\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "ATTENTION: Could not move directory from %s to %s, \"rename_string_in_directory\"\n", + $olddir, $newdir); } return $newdir; @@ -1194,14 +1256,12 @@ sub rename_directory sleep(2); if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from $olddir to %s\n", $newdir); } else { installer::exiter::exit_program("ERROR: Could not move directory from $olddir to $newdir", "rename_directory"); - # $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"rename_directory\"\n"; - # push(@installer::globals::logfileinfo, $infoline); } return $newdir; @@ -1435,8 +1495,8 @@ sub try_to_create_directory if ($returnvalue) { $created_directory = 1; - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -1471,10 +1531,8 @@ sub create_directory_structure my $parentdir = $directory; installer::pathanalyzer::get_path_from_fullqualifiedname(\$parentdir); - my $infoline = "INFO: Did not create directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Now trying to create parent directory $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("INFO: Did not create directory %s\n", $directory); + $installer::logger::Lang->printf("Now trying to create parent directory %s\n", $parentdir); create_directory_structure($parentdir); # recursive } @@ -1499,10 +1557,8 @@ sub remove_complete_directory { if ( $start ) { - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Removing directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Removing directory %s\n", $directory); } opendir(DIR, $directory); @@ -1531,12 +1587,15 @@ sub remove_complete_directory # try to remove empty directory + if ( ! -d $directory) + { + $installer::logger::Info->printf("trying to remove directory that doesn't exist: %s\n", $directory); + } my $returnvalue = rmdir $directory; if ( ! $returnvalue ) { - $infoline = "Warning: Problem with removing empty dir $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: Problem with removing empty dir %s\n", $directory); } # try a little bit harder (sometimes there is a performance problem) @@ -1546,20 +1605,19 @@ sub remove_complete_directory { if ( -d $directory ) { - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Warning (Try $j): Problems with removing directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Warning (Try %d): Problems with removing directory %s\n", + $j, $directory); $returnvalue = rmdir $directory; if ( $returnvalue ) { - $infoline = "Successfully removed empty dir $directory\n"; - push(@installer::globals::logfileinfo, $infoline); - } else { - $infoline = "Warning: rmdir $directory failed.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully removed empty dir %s\n", $directory); + } + else + { + $installer::logger::Lang->printf("Warning: rmdir %s failed.\n", $directory); } } } @@ -1728,12 +1786,12 @@ sub remove_empty_dirs_in_folder } # try to remove empty directory + $installer::logger::Info->printf("remove_empty_dirs_in_folder %s\n", $dir); my $returnvalue = rmdir $dir; if ( $returnvalue ) { - $infoline = "Successfully removed empty dir $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully removed empty dir %s\n", $dir); } } diff --git a/solenv/bin/modules/installer/upx.pm b/solenv/bin/modules/installer/upx.pm index b6bdc189b281..8eaa3ceb0422 100644 --- a/solenv/bin/modules/installer/upx.pm +++ b/solenv/bin/modules/installer/upx.pm @@ -68,17 +68,17 @@ sub do_upx my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "WARNING: Could not successfully upx $filename! Using original file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "SUCCESS: upx $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $returnvalue; @@ -97,13 +97,15 @@ sub upx_on_libraries if ( ! $installer::globals::upx_in_path ) { - $infoline = "\n\nWarning: This is an UPX product, but upx was not found in PATH!\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Warning: This is an UPX product, but upx was not found in PATH!\n"); + $installer::logger::Lang->print("\n"); } else { $infoline = "Using upx: $installer::globals::upxfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $upxdirbase = installer::systemactions::create_directories("upx", $languagestringref); @@ -121,8 +123,8 @@ sub upx_on_libraries my $shortfilename = $sourcefilename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); - $infoline = "\nUpx: $shortfilename"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Upx: %s", $shortfilename); # copy file into directory for stripped libraries my $onelanguage = ${$filelist}[$i]->{'specificlanguage'}; diff --git a/solenv/bin/modules/installer/windows/admin.pm b/solenv/bin/modules/installer/windows/admin.pm index 13dbd4ebdd39..0bb4e2819033 100644 --- a/solenv/bin/modules/installer/windows/admin.pm +++ b/solenv/bin/modules/installer/windows/admin.pm @@ -41,7 +41,7 @@ sub unpack_cabinet_file my ($cabfilename, $unpackdir) = @_; my $infoline = "Unpacking cabinet file: $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $expandfile = "expand.exe"; # Has to be in the path @@ -84,18 +84,18 @@ sub unpack_cabinet_file my $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not extract cabinet file: $mergemodulehash->{'cabinetfile'} !", "change_file_table"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -139,18 +139,18 @@ sub include_tables_into_pcpfile $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not include tables into msi database: $fullmsidatabasepath !", "include_tables_into_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -197,18 +197,18 @@ sub extract_tables_from_pcpfile $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not exclude tables from pcp file: $localfullmsidatabasepath !", "extract_tables_from_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -480,7 +480,7 @@ sub copy_files_into_directory_structure { my $infoline = "ERROR: Could not copy $sourcefile to $destfile (insufficient disc space for $destfile ?)\n"; $returnvalue = 0; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "copy_files_into_directory_structure"); } @@ -540,7 +540,8 @@ sub remove_properties_from_registry_table { my ($registryhash, $componentkeypathhash, $registryfilecontent) = @_; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Start remove_properties_from_registry_table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Start remove_properties_from_registry_table"); my @registrytable = (); @@ -623,7 +624,7 @@ sub remove_properties_from_registry_table delete($registryhash->{$regitem}); $removecounter++; $infoline = "Removing registry item: $regitem : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { @@ -651,16 +652,16 @@ sub remove_properties_from_registry_table $infoline = "Changing registry item: $regitem\n"; $infoline = "Old: $oldkey : $oldname : $oldvalue\n"; $infoline = "New: $registryhash->{$regitem}->{'Key'} : $registryhash->{$regitem}->{'Name'} : $registryhash->{$regitem}->{'Value'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } } $infoline = "Number of removed registry items: $removecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Number of changed registry items: $renamecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Creating the new content of Registry table # First three lines from $registryfilecontent @@ -689,9 +690,10 @@ sub remove_properties_from_registry_table } $infoline = "Number of registry items: $newitemcounter. Old value: $olditemcounter.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: End remove_properties_from_registry_table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: End remove_properties_from_registry_table"); return (\@registrytable); } @@ -733,13 +735,13 @@ sub write_sis_info } $systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; - push(@installer::globals::logfileinfo, $systemcall); + $installer::logger::Lang->printf($systemcall); $returnvalue = system($systemcall); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "write_sis_info"); } } @@ -816,7 +818,9 @@ sub make_admin_install # Create helper directory - installer::logger::print_message( "... installing $databasepath in directory $targetdir ...\n" ); + $installer::logger::Info->printf("... installing %s in directory %s ...\n", + $databasepath, + $targetdir); my $helperdir = $targetdir . $installer::globals::separator . "installhelper"; installer::systemactions::create_directory($helperdir); diff --git a/solenv/bin/modules/installer/windows/assembly.pm b/solenv/bin/modules/installer/windows/assembly.pm index e7e63db55702..a053519168e2 100644 --- a/solenv/bin/modules/installer/windows/assembly.pm +++ b/solenv/bin/modules/installer/windows/assembly.pm @@ -217,7 +217,7 @@ sub create_msiassembly_table my $msiassemblytablename = $basedir . $installer::globals::separator . "MsiAssem.idt"; installer::files::save_file($msiassemblytablename ,\@msiassemblytable); my $infoline = "Created idt file: $msiassemblytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } #################################################################################### @@ -299,7 +299,7 @@ sub create_msiassemblyname_table my $msiassemblynametablename = $basedir . $installer::globals::separator . "MsiAsseN.idt"; installer::files::save_file($msiassemblynametablename ,\@msiassemblynametable); my $infoline = "Created idt file: $msiassemblynametablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -346,9 +346,9 @@ sub add_assembly_condition_into_component_table ${$componenttable}[$j] = $oneline; $changed = 1; $infoline = "Changing $componenttablename :\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = $oneline; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } } @@ -360,8 +360,8 @@ sub add_assembly_condition_into_component_table # Saving the file installer::files::save_file($componenttablename ,$componenttable); $infoline = "Saved idt file: $componenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/binary.pm b/solenv/bin/modules/installer/windows/binary.pm index ca979f65ae81..0f4d55852adf 100644 --- a/solenv/bin/modules/installer/windows/binary.pm +++ b/solenv/bin/modules/installer/windows/binary.pm @@ -66,8 +66,7 @@ sub update_binary_table # Saving the file installer::files::save_file($binaryidttablename ,$binaryidttable); - my $infoline = "Updated idt file: $binaryidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $binaryidttablename); } 1; diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index 436306c117e0..2804cb5a31a1 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -361,7 +361,7 @@ sub get_component_keypath { # Warning: This keypath was changed because of info from old database $infoline = "WARNING: The KeyPath for component \"$componentname\" was changed from \"$oneitem->{'uniquename'}\" to \"$keypath\" because of information from update database"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -438,7 +438,7 @@ sub create_component_table my $componenttablename = $basedir . $installer::globals::separator . "Componen.idt"; installer::files::save_file($componenttablename ,\@componenttable); $infoline = "Created idt file: $componenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } #################################################################################### @@ -501,14 +501,14 @@ sub set_component_in_environment_table if ( $componentname ) # only do something if a component could be found { $infoline = "Updated Environment table:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old line: ${$environmentfile}[$i]\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); ${$environmentfile}[$i] =~ s/$modulegid/$componentname/; $infoline = "New line: ${$environmentfile}[$i]\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -518,9 +518,9 @@ sub set_component_in_environment_table installer::files::save_file($environmentfilename ,$environmentfile); $infoline = "Updated idt file: $environmentfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/createfolder.pm b/solenv/bin/modules/installer/windows/createfolder.pm index 4f2de143892f..070d488a9044 100644 --- a/solenv/bin/modules/installer/windows/createfolder.pm +++ b/solenv/bin/modules/installer/windows/createfolder.pm @@ -141,9 +141,7 @@ sub create_createfolder_table my $createfoldertablename = $basedir . $installer::globals::separator . "CreateFo.idt"; installer::files::save_file($createfoldertablename ,\@createfoldertable); - $infoline = "Created idt file: $createfoldertablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $createfoldertablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 156aba0fc963..86be8a214d70 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -563,7 +563,7 @@ sub create_directory_table # Before ":" : [sourcedir]:[destdir] (not programmed yet) # After ":" : 8+3 and not 8+3 the destination directory name - installer::logger::include_timestamp_into_logfile("Performance Info: Directory Table start"); + $installer::logger::Lang->add_timestamp("Performance Info: Directory Table start"); my @directorytable = (); my $infoline; @@ -584,11 +584,9 @@ sub create_directory_table my $directorytablename = $basedir . $installer::globals::separator . "Director.idt"; installer::files::save_file($directorytablename ,\@directorytable); - $infoline = "Created idt file: $directorytablename\n"; - push(@installer::globals::logfileinfo, $infoline); - - installer::logger::include_timestamp_into_logfile("Performance Info: Directory Table end"); + $installer::logger::Lang->printf("Created idt file: %s\n", $directorytablename); + $installer::logger::Lang->add_timestamp("Performance Info: Directory Table end"); } 1; diff --git a/solenv/bin/modules/installer/windows/feature.pm b/solenv/bin/modules/installer/windows/feature.pm index 0e0ffa333748..20cba1422be4 100644 --- a/solenv/bin/modules/installer/windows/feature.pm +++ b/solenv/bin/modules/installer/windows/feature.pm @@ -329,8 +329,9 @@ sub sort_feature { if ( $sorted{$modulekey} == 0 ) { - my $infoline = "Warning: Module \"$modulekey\" could not be sorted. Added to the end of the module array.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Warning: Module \"%s\" could not be sorted. Added to the end of the module array.\n", + $modulekey); push(@feature, ${$modulesref}[$directaccess{$modulekey}]); } } @@ -432,10 +433,8 @@ sub create_feature_table my $featuretablename = $basedir . $installer::globals::separator . "Feature.idt" . "." . $onelanguage; installer::files::save_file($featuretablename ,\@featuretable); - $infoline = "Created idt file: $featuretablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $featuretablename); } - } 1; diff --git a/solenv/bin/modules/installer/windows/featurecomponent.pm b/solenv/bin/modules/installer/windows/featurecomponent.pm index 13eb7a24b080..4253746557cd 100644 --- a/solenv/bin/modules/installer/windows/featurecomponent.pm +++ b/solenv/bin/modules/installer/windows/featurecomponent.pm @@ -162,8 +162,8 @@ sub check_number_of_components_at_feature { my ($featurecomponenttable) = @_; - my $infoline = "\nChecking number of components at features. Maximum is 817 (for Win 98 and Win Me)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Checking number of components at features. Maximum is 817 (for Win 98 and Win Me)\n"); my $allfeature = collect_all_feature($featurecomponenttable); @@ -184,12 +184,10 @@ sub check_number_of_components_at_feature # Logging the result - $infoline = "Number of components at feature $onefeature : $featurecomponents\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Number of components at feature $onefeature : %s\n", $featurecomponents); } - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); } ################################################################################# @@ -232,9 +230,7 @@ sub create_featurecomponent_table my $featurecomponenttablename = $basedir . $installer::globals::separator . "FeatureC.idt"; installer::files::save_file($featurecomponenttablename ,\@featurecomponenttable); - $infoline = "Created idt file: $featurecomponenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $featurecomponenttablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index 74d094c5b04a..00a23d12a2cd 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -70,13 +70,13 @@ sub assign_cab_to_files # logging the number of files in each cabinet file - $infoline = "\nCabinet file content:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file content:\n"); my $cabfile; foreach $cabfile ( sort keys %installer::globals::cabfilecounter ) { $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile} files\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # assigning startsequencenumbers for each cab file @@ -93,22 +93,22 @@ sub assign_cab_to_files # logging the start sequence numbers - $infoline = "\nCabinet file start sequences:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file start sequences:\n"); foreach $cabfile ( sort keys %installer::globals::cabfilecounter ) { $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # logging the last sequence numbers - $infoline = "\nCabinet file last sequences:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file last sequences:\n"); foreach $cabfile ( sort keys %installer::globals::lastsequence ) { $infoline = "$cabfile : $installer::globals::lastsequence{$cabfile}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -594,7 +594,7 @@ sub get_sequence_for_file if ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) { $infoline = "Warning: Special handling for component \"$pffcomponentname\". This file was added after the final, but before this ServicePack.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $onefile->{'componentname'} = $pffcomponentname; # pff for "post final file" $fileentry->{'Component_'} = $onefile->{'componentname'}; if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; } @@ -746,7 +746,7 @@ sub check_file_sequences } $infoline = "ERROR: Files are removed compared with update database.\nThe following files are missing:\n$errorstring"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "check_file_sequences"); } @@ -760,18 +760,20 @@ sub check_file_sequences $counter++; if ( $counter == 1 ) { - $infoline = "\nNew files compared to the update database:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("New files compared to the update database:\n"); } - $infoline = "$onefile->{'Name'} ($onefile->{'gid'}) Sequence: $onefile->{'assignedsequencenumber'}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s (%s) Sequence: %s\n", + $onefile->{'Name'}, + $onefile->{'gid'}, + $onefile->{'assignedsequencenumber'}); } if ( $counter == 0 ) { $infoline = "Info: No new file compared with update database!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -844,7 +846,7 @@ sub create_files_table { my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_; - installer::logger::include_timestamp_into_logfile("Performance Info: File Table start"); + $installer::logger::Lang->add_timestamp("Performance Info: File Table start"); # Structure of the files table: # File Component_ FileName FileSize Version Language Attributes Sequence @@ -1040,15 +1042,15 @@ sub create_files_table my $filetablename = $basedir . $installer::globals::separator . "File.idt"; installer::files::save_file($filetablename ,\@filetable); - $infoline = "\nCreated idt file: $filetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created idt file: %s\n", $filetablename); - installer::logger::include_timestamp_into_logfile("Performance Info: File Table end"); + $installer::logger::Lang->add_timestamp("Performance Info: File Table end"); my $filehashtablename = $basedir . $installer::globals::separator . "MsiFileHash.idt"; installer::files::save_file($filehashtablename ,\@filehashtable); - $infoline = "\nCreated idt file: $filehashtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created idt file: %s\n", $filehashtablename); # Now the new files can be added to the files collector (only in update packaging processes) if ( $installer::globals::newfilesexist ) diff --git a/solenv/bin/modules/installer/windows/font.pm b/solenv/bin/modules/installer/windows/font.pm index 1996f51c2298..c82d5a082795 100644 --- a/solenv/bin/modules/installer/windows/font.pm +++ b/solenv/bin/modules/installer/windows/font.pm @@ -68,7 +68,7 @@ sub create_font_table my $fonttablename = $basedir . $installer::globals::separator . "Font.idt"; installer::files::save_file($fonttablename ,\@fonttable); my $infoline = "Created idt file: $fonttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -92,12 +92,12 @@ sub get_font_version { $fontversion = $1; $infoline = "FONT: Font \"$fontfile\" version: $fontversion\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "FONT: Could not determine font version: \"$fontfile\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $fontversion; diff --git a/solenv/bin/modules/installer/windows/icon.pm b/solenv/bin/modules/installer/windows/icon.pm index 32569e2ac487..c7ccf04bbc09 100644 --- a/solenv/bin/modules/installer/windows/icon.pm +++ b/solenv/bin/modules/installer/windows/icon.pm @@ -65,9 +65,7 @@ sub create_icon_table my $icontablename = $basedir . $installer::globals::separator . "Icon.idt"; installer::files::save_file($icontablename ,\@icontable); - my $infoline = "Created idt file: $icontablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $icontablename); } 1; diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm b/solenv/bin/modules/installer/windows/idtglobal.pm index 598ee64103e6..4edfe4ce6d4f 100644 --- a/solenv/bin/modules/installer/windows/idtglobal.pm +++ b/solenv/bin/modules/installer/windows/idtglobal.pm @@ -790,8 +790,12 @@ sub prepare_language_idt_directory if ( $allvariables->{'WINDOWSBITMAPDIRECTORY'} ) { $bitmapdir = $allvariables->{'WINDOWSBITMAPDIRECTORY'}; } my $newsourcedir = $installer::globals::unpackpath . $installer::globals::separator . $bitmapdir; # path setting in list file dependent from unpackpath !? - $infoline = "\nOverwriting files in directory \"" . $destinationdir . $installer::globals::separator . "Binary" . "\" with files from directory \"" . $newsourcedir . "\".\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf( + "Overwriting files in directory \"%s%sBinary\" with files from directory \"%s\".\n", + $destinationdir, + $installer::globals::separator, + $newsourcedir); if ( ! -d $newsourcedir ) { my $currentdir = cwd(); @@ -856,8 +860,7 @@ sub get_rtflicensefilesource if ($$sourcefileref eq "") { installer::exiter::exit_program("ERROR: Could not find $licensefilename!", "get_rtflicensefilesource"); } - my $infoline = "Using licensefile: $$sourcefileref\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Using licensefile: %s\n", $$sourcefileref); return $$sourcefileref; } @@ -1041,7 +1044,7 @@ sub add_officedir_to_database installer::files::save_file($customactionfilename ,$customacfile); my $infoline = "Updated idt file: $customactionfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -1282,7 +1285,7 @@ sub set_custom_action push(@{$customactionidttable}, $line); $infoline = "Added $actionname CustomAction into table $customactionidttablename (NO_FILE has been set)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $included_customaction = 1; return $included_customaction; @@ -1335,7 +1338,7 @@ sub set_custom_action if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $customactionidttablename\n"; } else { $infoline = "Did not add $actionname CustomAction into table $customactionidttablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $included_customaction; } @@ -1368,7 +1371,7 @@ sub add_custom_action_to_install_table push(@{$installtable}, $line); $infoline = "Added $actionname CustomAction into table $installtablename (NO_FILE has been set)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return; } @@ -1423,7 +1426,7 @@ sub add_custom_action_to_install_table if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $installtablename\n"; } else { $infoline = "Did not add $actionname CustomAction into table $installtablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -1443,7 +1446,7 @@ sub connect_custom_action_to_control $line =~ s/\s*$//g; $infoline = "Added line \"$line\" into table $tablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################## @@ -1462,7 +1465,7 @@ sub connect_condition_to_control $line =~ s/\s*$//g; $infoline = "Added line \"$line\" into table $tablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################## @@ -1618,7 +1621,7 @@ sub include_subdirname_into_directory_table push(@{$directorytable}, $line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into directory table $directorytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $includedline = 1; last; @@ -1659,7 +1662,7 @@ sub include_subdir_into_componenttable installer::remover::remove_leading_and_ending_whitespaces(\$oldvalue); installer::remover::remove_leading_and_ending_whitespaces(\$newvalue); $infoline = "Change in Component table: From \"$oldvalue\" to \"$newvalue\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $changeddirectory = 1; last; @@ -1727,7 +1730,7 @@ sub add_childprojects $infoline = "SystemFolder already exists in table $directorytablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Additional content for the directory table # subjava INSTALLLOCATION program:java @@ -1763,7 +1766,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1772,7 +1775,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1781,7 +1784,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1790,7 +1793,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Content for InstallUISequence table @@ -1808,7 +1811,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1820,7 +1823,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'ADAPRODUCT'} ) @@ -1831,7 +1834,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1843,7 +1846,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1855,7 +1858,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1867,7 +1870,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Content for Feature table, better from scp (translation) @@ -2101,8 +2104,8 @@ sub set_positions_in_table { my ( $sequencetable, $tablename ) = @_; - my $infoline = "\nSetting positions in table \"$tablename\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Setting positions in table \"%s\".\n", $tablename); # Step 1: Resolving all occurences of "POSITIONTEMPLATE_end" @@ -2116,7 +2119,7 @@ sub set_positions_in_table $lastposition = $lastposition + 25; ${$sequencetable}[$i] =~ s/POSITIONTEMPLATE_end/$lastposition/; $infoline = "Setting position \"$lastposition\" for custom action \"$customaction\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -2166,12 +2169,12 @@ sub set_positions_in_table ${$sequencetable}[$i] =~ s/$templatename/$newposition/; $template_replaced = 1; $infoline = "Setting position \"$newposition\" for custom action \"$onename\" (scp: \"$positionname\" at position $position).\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Could not assign position for custom action \"$onename\" yet (scp: \"$positionname\").\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2207,13 +2210,13 @@ sub set_positions_in_table $lastposition = $lastposition + 25; ${$sequencetable}[$i] =~ s/$fulltemplate/$lastposition/; $infoline = "WARNING: Setting position \"$lastposition\" for custom action \"$customactionname\". Could not find CustomAction \"$template\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } # $templatestring =~ s/,\s*$//; # $infoline = "Error: Saving table \"$tablename\"\n"; - # push(@installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # print $infoline; # installer::files::save_file($tablename, $sequencetable); # installer::exiter::exit_program("ERROR: Unresolved positions in CustomActions in scp2: $templatestring", "set_positions_in_table"); @@ -2229,7 +2232,8 @@ sub addcustomactions { my ($languageidtdir, $customactions, $filesarray) = @_; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions start\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: addcustomactions start\n"); my $customactionidttablename = $languageidtdir . $installer::globals::separator . "CustomAc.idt"; my $customactionidttable = installer::files::read_file($customactionidttablename); @@ -2344,19 +2348,20 @@ sub addcustomactions installer::files::save_file($controlconditiontablename, $controlconditiontable); my $infoline = "Updated idt file: $customactionidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $installexecutetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $adminexecutetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $controleventtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $controlconditiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions end\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: addcustomactions end\n"); } ########################################################################## @@ -2427,11 +2432,11 @@ sub setbidiattributes installer::files::save_file($dialogfilename, $dialogfile); $infoline = "Set bidi support in idt file \"$dialogfilename\" for language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($controlfilename, $controlfile); $infoline = "Set bidi support in idt file \"$controlfilename\" for language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } 1; diff --git a/solenv/bin/modules/installer/windows/inifile.pm b/solenv/bin/modules/installer/windows/inifile.pm index 1e4c467ac796..b91f79deac53 100644 --- a/solenv/bin/modules/installer/windows/inifile.pm +++ b/solenv/bin/modules/installer/windows/inifile.pm @@ -134,9 +134,7 @@ sub create_inifile_table my $inifiletablename = $basedir . $installer::globals::separator . "IniFile.idt"; installer::files::save_file($inifiletablename ,\@inifiletable); - my $infoline = "Created idt file: $inifiletablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $inifiletablename); } 1; diff --git a/solenv/bin/modules/installer/windows/java.pm b/solenv/bin/modules/installer/windows/java.pm index 613c70ec875d..03ba1d3732d5 100644 --- a/solenv/bin/modules/installer/windows/java.pm +++ b/solenv/bin/modules/installer/windows/java.pm @@ -101,15 +101,15 @@ sub update_java_tables installer::files::save_file($reglocatfilename ,$reglocatfile); my $infoline = "Updated idt file for Java: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($appsearchfilename ,$appsearchfile); $infoline = "Updated idt file for Java: $appsearchfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($signaturefilename ,$signaturefile); $infoline = "Updated idt file: $signaturefilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } diff --git a/solenv/bin/modules/installer/windows/media.pm b/solenv/bin/modules/installer/windows/media.pm index effe3962c92a..0dc57b39485e 100644 --- a/solenv/bin/modules/installer/windows/media.pm +++ b/solenv/bin/modules/installer/windows/media.pm @@ -277,8 +277,9 @@ sub create_media_table } else { - my $localinfoline = "Warning: Could not find cabinet file \"$media{'Cabinet'}}\" in update database. This seems to be an new cabinet file!?\n"; - push(@installer::globals::logfileinfo, $localinfoline); + $installer::logger::Lang->printf( + "Warning: Could not find cabinet file \"%s}\" in update database. This seems to be an new cabinet file!?\n", + $media{'Cabinet'}); } } } @@ -447,8 +448,7 @@ sub create_media_table my $mediatablename = $basedir . $installer::globals::separator . "Media.idt"; installer::files::save_file($mediatablename ,\@mediatable); - my $infoline = "Created idt file: $mediatablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $mediatablename); } 1; diff --git a/solenv/bin/modules/installer/windows/mergemodule.pm b/solenv/bin/modules/installer/windows/mergemodule.pm index ce2cb8636240..2ed2781d9747 100644 --- a/solenv/bin/modules/installer/windows/mergemodule.pm +++ b/solenv/bin/modules/installer/windows/mergemodule.pm @@ -52,8 +52,9 @@ sub merge_mergemodules_into_msi_database if ( $domerge ) { installer::logger::include_header_into_logfile("Merging merge modules into msi database"); - installer::logger::print_message( "... merging msm files into msi database ... \n" ); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: MergeModule into msi database, start"); + $installer::logger::Info->printf("... merging msm files into msi database ... \n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: MergeModule into msi database, start"); my $msidb = "msidb.exe"; # Has to be in the path my $cabinetfile = "MergeModule.CABinet"; # the name of each cabinet file in a merge file @@ -68,9 +69,10 @@ sub merge_mergemodules_into_msi_database if ( ! $installer::globals::mergemodules_analyzed ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Analyzing MergeModules, start"); - $infoline = "Analyzing all Merge Modules\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Analyzing MergeModules, start"); + $installer::logger::Lang->print("Analyzing all Merge Modules\n"); + $installer::logger::Lang->print("\n"); %installer::globals::mergemodules = (); @@ -91,7 +93,7 @@ sub merge_mergemodules_into_msi_database if ( ! -d $workdir ) { installer::systemactions::create_directory($workdir); } $infoline = "Analyzing Merge Module: $filename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # copy msm file into working directory my $completedest = $workdir . $installer::globals::separator . $filename; @@ -111,18 +113,18 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not extract cabinet file from merge file: $completedest !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # exclude tables from mergefile @@ -147,18 +149,18 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not exclude tables from merge file: $completedest !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Determining files @@ -320,13 +322,14 @@ sub merge_mergemodules_into_msi_database } $infoline = "All Merge Modules successfully analyzed\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $installer::globals::mergemodules_analyzed = 1; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Analyzing MergeModules, stop"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Analyzing MergeModules, stop"); $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # 2. Change msi database (has to be done for every msi database -> for every language) @@ -344,7 +347,7 @@ sub merge_mergemodules_into_msi_database $counter++; installer::logger::include_header_into_logfile("Merging Module: $mergemodulehash->{'name'}"); - installer::logger::print_message( "\t... $mergemodulehash->{'name'} ... \n" ); + $installer::logger::Info->printf("\t... %s ... \n", $mergemodulehash->{'name'}); $msifilename = installer::converter::make_path_conform($msifilename); my $workdir = $msifilename; @@ -360,7 +363,8 @@ sub merge_mergemodules_into_msi_database # Merging msm file, this is the "real" merge command - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before merging database"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before merging database"); if ( $^O =~ /cygwin/i ) { # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) @@ -377,21 +381,22 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall . Returnvalue: $returnvalue!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not merge msm file into database: $mergemodulehash->{'mergefilepath'} !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After merging database"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After merging database"); # Saving original idt files if ( -f "File.idt" ) { installer::systemactions::rename_one_file("File.idt", "File.idt.$counter"); } @@ -405,7 +410,8 @@ sub merge_mergemodules_into_msi_database # Extracting tables - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before extracting tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before extracting tables"); my $workingtables = "File Media Directory FeatureComponents"; # required tables # Optional tables can be added now @@ -427,21 +433,22 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not exclude tables from msi database: $msifilename !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After extracting tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After extracting tables"); # Using 8+3 table names, that are used, when tables are integrated into database. The export of tables # creates idt-files, that have long names. @@ -451,17 +458,22 @@ sub merge_mergemodules_into_msi_database if ( -f "MsiAssembly.idt" ) { installer::systemactions::rename_one_file("MsiAssembly.idt", "MsiAssem.idt"); } # Changing content of tables: File, Media, Directory, FeatureComponent, MsiAssembly - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing Media table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing Media table"); change_media_table($mergemodulehash, $workdir, $mergemodulegid, $allupdatelastsequences, $allupdatediskids); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing File table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing File table"); $filesref = change_file_table($mergemodulehash, $workdir, $allupdatesequences, $includepatharrayref, $filesref, $mergemodulegid); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing FeatureComponent table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing FeatureComponent table"); change_featurecomponent_table($mergemodulehash, $workdir); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing Directory table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing Directory table"); change_directory_table($mergemodulehash, $workdir); if ( $mergemodulehash->{'hasmsiassemblies'} ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing MsiAssembly table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing MsiAssembly table"); change_msiassembly_table($mergemodulehash, $workdir); } @@ -523,29 +535,35 @@ sub merge_mergemodules_into_msi_database # into tables InstallExecuteSequence, AdminExecuteSequence and AdvtExecuteSequence if ( -f "ModuleInstallExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing InstallExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing InstallExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "InstallE.idt", "ModuleInstallExecuteSequence.idt"); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing InstallUISequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing InstallUISequence table"); change_executesequence_table($mergemodulehash, $workdir, "InstallU.idt", "ModuleInstallExecuteSequence.idt"); } if ( -f "ModuleAdminExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing AdminExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing AdminExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "AdminExe.idt", "ModuleAdminExecuteSequence.idt"); } if ( -f "ModuleAdvtExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing AdvtExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing AdvtExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "AdvtExec.idt", "ModuleAdvtExecuteSequence.idt"); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: All tables edited"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: All tables edited"); # Including tables into msi database - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before including tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before including tables"); if ( $^O =~ /cygwin/i ) { # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) @@ -562,28 +580,30 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not include tables into msi database: $msifilename !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After including tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After including tables"); chdir($from); } if ( ! $installer::globals::mergefiles_added_into_collector ) { $installer::globals::mergefiles_added_into_collector = 1; } # Now all mergemodules are merged for one language. - installer::logger::include_timestamp_into_logfile("\nPerformance Info: MergeModule into msi database, stop"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: MergeModule into msi database, stop"); } return $filesref; @@ -819,7 +839,7 @@ sub set_last_cabfile_name if ( $mediafile->{$line}->{'DiskId'} == $lastdiskid ) { $installer::globals::lastcabfilename = $mediafile->{$line}->{'Cabinet'}; } } my $infoline = "Setting last cabinet file: $installer::globals::lastcabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ######################################################################### @@ -832,7 +852,7 @@ sub change_media_table my ( $mergemodulehash, $workdir, $mergemodulegid, $allupdatelastsequences, $allupdatediskids ) = @_; my $infoline = "Changing content of table \"Media\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = "Media.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" in \"$workdir\" !", "change_media_table"); } @@ -857,11 +877,11 @@ sub change_media_table my $start = $1; my $final = $2; $infoline = "Merge: Old line in media table: ${$filecontent}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $newline = $start . $newmaxsequencenumber . $final . "\n"; ${$filecontent}[$i] = $newline; $infoline = "Merge: Changed line in media table: ${$filecontent}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -874,7 +894,7 @@ sub change_media_table } $infoline = "Adding line: $installer::globals::merge_media_line{$mergemodulegid}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # adding new line push(@{$filecontent}, $installer::globals::merge_media_line{$mergemodulegid}); @@ -1072,7 +1092,7 @@ sub change_file_table my ($mergemodulehash, $workdir, $allupdatesequenceshashref, $includepatharrayref, $filesref, $mergemodulegid) = @_; my $infoline = "Changing content of table \"File\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "File.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_file_table"); } @@ -1133,7 +1153,7 @@ sub change_file_table # should be available on every Windows system. $infoline = "Unpacking cabinet file: $mergemodulehash->{'cabinetfile'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Avoid the Cygwin expand command my $expandfile = "expand.exe"; # Has to be in the path @@ -1161,18 +1181,18 @@ sub change_file_table my $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not extract cabinet file: $mergemodulehash->{'cabinetfile'} !", "change_file_table"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } chdir($from); @@ -1216,11 +1236,11 @@ sub change_file_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Adding files to the files collector (but only once) if (( $installer::globals::fix_number_of_cab_files ) && ( ! $installer::globals::mergefiles_added_into_collector )) @@ -1343,7 +1363,7 @@ sub change_featurecomponent_table my ($mergemodulehash, $workdir) = @_; my $infoline = "Changing content of table \"FeatureComponents\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "FeatureC.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_featurecomponent_table"); } @@ -1370,7 +1390,7 @@ sub change_featurecomponent_table my $line = "$feature\t$component\n"; push(@{$filecontent}, $line); $infoline = "Adding line: $line\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # saving file @@ -1392,7 +1412,7 @@ sub change_directory_table if ( $scpdirectory ne "TARGETDIR" ) # TARGETDIR works fine, when using msidb.exe { my $infoline = "Changing content of table \"Directory\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "Director.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_directory_table"); } @@ -1432,11 +1452,11 @@ sub change_directory_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1454,7 +1474,7 @@ sub change_msiassembly_table my ($mergemodulehash, $workdir) = @_; my $infoline = "Changing content of table \"MsiAssembly\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "MsiAssem.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_msiassembly_table"); } @@ -1492,11 +1512,11 @@ sub change_msiassembly_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # saving file @@ -1581,7 +1601,7 @@ sub change_executesequence_table my ($mergemodulehash, $workdir, $idtfilename, $moduleidtfilename) = @_; my $infoline = "Changing content of table \"$idtfilename\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_executesequence_table"); } if ( ! -f $moduleidtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$moduleidtfilename\" in \"$workdir\" !", "change_executesequence_table"); } diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 2c8c017a5ec1..24342935643f 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -101,7 +101,7 @@ sub check_ddf_file } my $infoline = "Check of ddf file \"$ddffilename\": Maximum length \"$maxlength\" in line \"$maxline\" (allowed line length: 256 characters)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ########################################################################## @@ -162,7 +162,7 @@ sub generate_cab_file_list installer::logger::include_header_into_logfile("Generating ddf files"); - installer::logger::include_timestamp_into_logfile("Performance Info: ddf file generation start"); + $installer::logger::Lang->add_timestamp("Performance Info: ddf file generation start"); if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_pathes($filesref); } @@ -244,7 +244,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -337,7 +337,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -413,7 +413,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -476,7 +476,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -528,7 +528,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -547,7 +547,7 @@ sub generate_cab_file_list installer::exiter::exit_program("ERROR: No cab file specification in globals.pm !", "create_media_table"); } - installer::logger::include_timestamp_into_logfile("Performance Info: ddf file generation end"); + $installer::logger::Lang->add_timestamp("Performance Info: ddf file generation end"); return \@cabfilelist; # contains all system calls for packaging process } @@ -593,7 +593,7 @@ sub save_packorder { installer::logger::include_header_into_logfile("Saving pack order"); - installer::logger::include_timestamp_into_logfile("Performance Info: saving pack order start"); + $installer::logger::Lang->add_timestamp("Performance Info: saving pack order start"); my $packorderfilename = "packorder.txt"; $packorderfilename = $installer::globals::infodirectory . $installer::globals::separator . $packorderfilename; @@ -638,7 +638,7 @@ sub save_packorder installer::files::save_file($packorderfilename ,\@packorder); - installer::logger::include_timestamp_into_logfile("Performance Info: saving pack order end"); + $installer::logger::Lang->add_timestamp("Performance Info: saving pack order end"); } ################################################################# @@ -708,17 +708,17 @@ sub create_msi_database my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $msidb!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msidb successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -812,7 +812,7 @@ sub get_packagecode_for_sis my $guid = "\{" . ${$guidref}[0] . "\}"; my $infoline = "PackageCode: $guid\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $guid; } @@ -949,17 +949,17 @@ sub write_summary_into_msi_database my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $msiinfo!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msiinfo successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1004,7 +1004,7 @@ sub create_transforms my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Problem: msitran.exe in version 4.0 always returns "1", even if no failure occured. # Therefore it has to be checked, if this is version 4.0. If yes, if the mst file @@ -1015,7 +1015,7 @@ sub create_transforms if ($returnvalue) { $infoline = "WARNING: Returnvalue of $msitran is not 0. Checking version of $msitran!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); open(FILE, "<$installer::globals::msitranpath") or die "ERROR: Can't open $installer::globals::msitranpath for creating file hash"; binmode(FILE); @@ -1028,9 +1028,9 @@ sub create_transforms foreach my $problemchecksum ( @problemchecksums ) { $infoline = "Checksum of problematic MsiTran.exe: $problemchecksum\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Checksum of used MsiTran.exe: $digest\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $digest eq $problemchecksum ) { $isproblemchecksum = 1; } } @@ -1040,45 +1040,45 @@ sub create_transforms if ( -f $transformfile ) { $infoline = "File $transformfile exists.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filesize = ( -s $transformfile ); $infoline = "Size of $transformfile: $filesize\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $filesize > 0 ) { $infoline = "Info: Returnvalue $returnvalue of $msitran is no problem :-) .\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $returnvalue = 0; # reset the error } else { $infoline = "Filesize indicates that an error occured.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "File $transformfile does not exist -> An error occured.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "This is not a problematic version of msitran.exe. Therefore the error is not caused by problematic msitran.exe.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } if ($returnvalue) { $infoline = "ERROR: Could not execute $msitran!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msitran successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # The reference database can be deleted @@ -1089,7 +1089,7 @@ sub create_transforms if ( $result == 0 ) { $infoline = "ERROR: Could not remove file $$referencedbname !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "create_transforms"); } } @@ -1337,7 +1337,7 @@ sub create_setup_ini installer::files::save_file($setupinifilename, $setupinifile); $infoline = "Generated file $setupinifilename !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################# @@ -1479,19 +1479,19 @@ sub get_guid_list close (UUIDGEN); my $infoline = "Systemcall: $systemcall\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } my $comparenumber = $#uuidlist + 1; if ( $comparenumber == $number ) { $infoline = "Success: Executed $uuidgen successfully!\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } } else { $infoline = "ERROR: Could not execute $uuidgen successfully!\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } } # uppercase, no longer "-c", because this is only supported in uuidgen.exe v.1.01 @@ -1678,12 +1678,12 @@ sub set_uuid_into_component_table # # installer::files::save_file($installer::globals::componentfilename, $componentfile); # version using new file in solver # # $infoline = "COMPONENTCODES: Created $counter new GUIDs for components ! \n"; -# push( @installer::globals::logfileinfo, $infoline); +# $installer::logger::Lang->print($infoline); # } # else # { # $infoline = "SUCCESS COMPONENTCODES: All component codes exist! \n"; -# push( @installer::globals::logfileinfo, $infoline); +# $installer::logger::Lang->print($infoline); # } } @@ -1745,7 +1745,7 @@ sub prepare_64bit_database # Saving the files installer::files::save_file($reglocatfilename ,$reglocatfile); $infoline = "Making idt file 64 bit conform: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1778,7 +1778,7 @@ sub prepare_64bit_database # Saving the files installer::files::save_file($fullfilename ,$filecontent); $infoline = "Making idt file 64 bit conform: $fullfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -1803,7 +1803,7 @@ sub include_cabs_into_msi chdir($to); my $infoline = "Changing into directory: $to"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $msidb = "msidb.exe"; # Has to be in the path my $extraslash = ""; # Has to be set for non-ActiveState perl @@ -1825,17 +1825,17 @@ sub include_cabs_into_msi my $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # deleting the cab file @@ -1843,11 +1843,11 @@ sub include_cabs_into_msi unlink(${$allcabfiles}[$i]); $infoline = "Deleted cab file: ${$allcabfiles}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } $infoline = "Changing back into directory: $from"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); chdir($from); } @@ -1863,7 +1863,7 @@ sub execute_packaging installer::logger::include_header_into_logfile("Packaging process"); - installer::logger::include_timestamp_into_logfile("Performance Info: Execute packaging start"); + $installer::logger::Lang->add_timestamp("Performance Info: Execute packaging start"); my $infoline = ""; my $from = cwd(); @@ -1871,7 +1871,7 @@ sub execute_packaging chdir($to); $infoline = "chdir: $to \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # if the ddf file contains relative pathes, it is necessary to change into the temp directory if ( $allvariables->{'RELATIVE_PATHES_IN_DDF'} ) @@ -1879,7 +1879,7 @@ sub execute_packaging $to = $installer::globals::temppath; chdir($to); $infoline = "chdir: $to \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # changing the tmp directory, because makecab.exe generates temporary cab files @@ -1896,7 +1896,7 @@ sub execute_packaging my $callscounter = $i + 1; - installer::logger::print_message( "... makecab.exe ($callscounter/$allmakecabcalls) ... \n" ); + $installer::logger::Info->printf("... makecab.exe (%s/%s) ... \n", $callscounter, $allmakecabcalls); # my $returnvalue = system($systemcall); @@ -1905,7 +1905,7 @@ sub execute_packaging my @ddfoutput = (); $infoline = "Systemcall: $systemcall"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); open (DDF, "$systemcall"); while (<DDF>) {push(@ddfoutput, $_); } @@ -1917,26 +1917,26 @@ sub execute_packaging { if ( $n < $maxmakecabcalls ) { - installer::logger::print_message( "makecab_error (Try $n): Trying again \n" ); - $infoline = "makecab_error (Try $n): $systemcall !"; + $installer::logger::Info->printf("makecab_error (Try %s): Trying again\n", $n); + $installer::logger::Lang->printf("makecab_error (Try %s): Trying again\n", $n); } else { - installer::logger::print_message( "ERROR (Try $n): Abort packing \n" ); - $infoline = "ERROR (Try $n): $systemcall !"; + $installer::logger::Info->printf("ERROR (Try %s): Abort packing \n", $n); + $installer::logger::Lang->printf("ERROR (Try %s): Abort packing \n", $n); } - push( @installer::globals::logfileinfo, $infoline); - # for ( my $j = 0; $j <= $#ddfoutput; $j++ ) { push( @installer::globals::logfileinfo, "$ddfoutput[$j]"); } - for ( my $m = 0; $m <= $#ddfoutput; $m++ ) { if ( $ddfoutput[$m] =~ /(ERROR\:.*?)\s*$/ ) { $infoline = $1 . "\n"; - if ( $n < $maxmakecabcalls ) { $infoline =~ s/ERROR\:/makecab_error\:/i; } - installer::logger::print_message( $infoline ); - push( @installer::globals::logfileinfo, $infoline); + if ( $n < $maxmakecabcalls ) + { + $infoline =~ s/ERROR\:/makecab_error\:/i; + } + $installer::logger::Info->print($infoline); + $installer::logger::Lang->print($infoline); } } @@ -1944,22 +1944,21 @@ sub execute_packaging } else { - # installer::logger::print_message( "Success (Try $n): \"$systemcall\"\n" ); $infoline = "Success (Try $n): $systemcall"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } } } - installer::logger::include_timestamp_into_logfile("Performance Info: Execute packaging end"); + $installer::logger::Lang->add_timestamp("Performance Info: Execute packaging end"); # setting back to the original tmp directory $ENV{'TMP'} = $origtemppath; chdir($from); $infoline = "chdir: $from \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ############################################################### @@ -1982,7 +1981,7 @@ sub set_global_code_variables } my $infoline = "Using Codes file: $installer::globals::codefilename \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $codefile = installer::files::read_file($installer::globals::codefilename); @@ -2051,9 +2050,9 @@ sub set_global_code_variables if ( $installer::globals::upgradecode eq "" ) { installer::exiter::exit_program("ERROR: UpgradeCode not defined in $installer::globals::codefilename !", "set_global_code_variables"); } $infoline = "Setting ProductCode to: $installer::globals::productcode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Setting UpgradeCode to: $installer::globals::upgradecode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Adding both variables into the variables array @@ -2061,10 +2060,10 @@ sub set_global_code_variables $allvariableshashref->{'UPGRADECODE'} = $installer::globals::upgradecode; $infoline = "Defined variable PRODUCTCODE: $installer::globals::productcode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Defined variable UPGRADECODE: $installer::globals::upgradecode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -2185,7 +2184,7 @@ sub update_reglocat_table # Saving the file installer::files::save_file($reglocatfilename ,$reglocatfile); my $infoline = "Updated idt file: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2220,7 +2219,7 @@ sub update_removere_table # Saving the file installer::files::save_file($removeregistryfilename ,$removeregistryfile); my $infoline = "Updated idt file: $removeregistryfilename \n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -2234,7 +2233,7 @@ sub read_saved_mappings { installer::logger::include_header_into_logfile("Reading saved mappings from older installation sets:"); - installer::logger::include_timestamp_into_logfile("Performance Info: Reading saved mappings start"); + $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings start"); if ( $installer::globals::previous_idt_dir ) { @@ -2250,8 +2249,12 @@ sub read_saved_mappings # Reading File.idt my $idtfile = $idtdir . $installer::globals::separator . "File.idt"; - push( @installer::globals::globallogfileinfo, "\nAnalyzing file: $idtfile\n" ); - if ( ! -f $idtfile ) { push( @installer::globals::globallogfileinfo, "Warning: File $idtfile does not exist!\n" ); } + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Analyzing file: %s\n", $idtfile); + if ( ! -f $idtfile ) + { + $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile); + } my $n = 0; open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings"); @@ -2319,13 +2322,18 @@ sub read_saved_mappings close (F); - push( @installer::globals::globallogfileinfo, "Read $n old file table key or 8.3 name mappings from $idtfile\n" ); + $installer::logger::Global->printf("Read %s old file table key or 8.3 name mappings from %s\n", + $n, $idtfile); # Reading Director.idt $idtfile = $idtdir . $installer::globals::separator . "Director.idt"; - push( @installer::globals::globallogfileinfo, "\nAnalyzing file $idtfile\n" ); - if ( ! -f $idtfile ) { push( @installer::globals::globallogfileinfo, "Warning: File $idtfile does not exist!\n" ); } + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Analyzing file %s\n", $idtfile); + if ( ! -f $idtfile ) + { + $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile); + } $n = 0; open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings"); @@ -2356,25 +2364,25 @@ sub read_saved_mappings } close (F); - push( @installer::globals::globallogfileinfo, "Read $n old directory 8.3 name mappings from $idtfile\n" ); + $installer::logger::Global->printf("Read %s old directory 8.3 name mappings from %s\n", + $n, $idtfile); # Analyzing errors if ( $error_occured ) { - for ( my $i = 0; $i <= $#errorlines; $i++ ) + for my $line (@errorlines) { - print "$errorlines[$i]"; - push( @installer::globals::globallogfileinfo, "$errorlines[$i]"); + $installer::logger::Info->print($line); + $installer::logger::Global->print($line); } installer::exiter::exit_program("ERROR: Duplicate entries in saved mappings!", "read_saved_mappings"); } } else { - # push( @installer::globals::globallogfileinfo, "WARNING: Windows patch shall be prepared, but PREVIOUS_IDT_DIR is not set!\n" ); installer::exiter::exit_program("ERROR: Windows patch shall be prepared, but environment variable PREVIOUS_IDT_DIR is not set!", "read_saved_mappings"); } - installer::logger::include_timestamp_into_logfile("Performance Info: Reading saved mappings end"); + $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings end"); } 1; diff --git a/solenv/bin/modules/installer/windows/msp.pm b/solenv/bin/modules/installer/windows/msp.pm index 10dc7287f809..735377439fc5 100644 --- a/solenv/bin/modules/installer/windows/msp.pm +++ b/solenv/bin/modules/installer/windows/msp.pm @@ -186,7 +186,7 @@ sub prepare_path_in_nopatchfilehash if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not determine flexible destination path for msp patch creation!", "prepare_path_in_nopatchfilehash"); } $infoline = "Setting flexible path for msp creation: $flexiblepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $onedestination ( keys %{$nopatchfiledestinations} ) { @@ -206,25 +206,25 @@ sub synchronize_installation_sets { my ($olddatabase, $newdatabase, $filesarray) = @_; - my $infoline = "\nSynchronizing installed products because of PATCH flag\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Synchronizing installed products because of PATCH flag\n"); $infoline = "Old product: $olddatabase\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New product: $newdatabase\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my ( $patchfiledestinations, $nopatchfiledestinations, $patchfilecounter, $nopatchfilecounter ) = collect_patch_file_destinations($filesarray); $infoline = "Number of files with PATCH flag: $patchfilecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Number of files without PATCH flag: $nopatchfilecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $localfile ( sort keys %{$patchfiledestinations} ) { $infoline = "\tPATCH file: $localfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $oldpath = $olddatabase; @@ -255,18 +255,18 @@ sub synchronize_installation_sets my $copyreturn = copy($source, $dest); # installer::systemactions::copy_one_file($source, $dest); # $infoline = "Synchronizing file: $source to $dest\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); } else { $infoline = "Not synchronizing. Destination file \"$dest\" does not exist.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Not synchronizing. Source file \"$source\" does not exist.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -301,18 +301,18 @@ sub extract_all_tables_from_pcpfile $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not exclude tables from pcp file: $fullpcpfilepath !", "extract_all_tables_from_msidatabase"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -363,18 +363,18 @@ sub include_tables_into_pcpfile $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not include tables into pcp file: $fullpcpfilepath !", "include_tables_into_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -424,23 +424,23 @@ sub execute_msimsp } $systemcall = $msimsp . " -s " . $localfullpcpfilename . " -p " . $localmspfilename . " -l " . $locallogfilename . " -f " . $localmsimsptemppath; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not execute $systemcall !", "execute_msimsp"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $logfilename; @@ -544,7 +544,7 @@ sub change_properties_table my ($localmspdir, $mspfilename) = @_; my $infoline = "Changing content of table \"Properties\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "Properties.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_properties_table"); } @@ -602,7 +602,7 @@ sub change_targetimages_table my ($localmspdir, $olddatabase) = @_; my $infoline = "Changing content of table \"TargetImages\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "TargetImages.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_targetimages_table"); } @@ -630,7 +630,7 @@ sub change_upgradedimages_table my ($localmspdir, $newdatabase) = @_; my $infoline = "Changing content of table \"UpgradedImages\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "UpgradedImages.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_upgradedimages_table"); } @@ -679,7 +679,7 @@ sub change_imagefamilies_table my ($localmspdir) = @_; my $infoline = "Changing content of table \"ImageFamilies\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "ImageFamilies.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_imagefamilies_table"); } @@ -846,7 +846,7 @@ sub change_patchmetadata_table my ($localmspdir, $allvariables, $languagestringref) = @_; my $infoline = "Changing content of table \"PatchMetadata\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "PatchMetadata.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_patchmetadata_table"); } @@ -1054,7 +1054,7 @@ sub change_patchsequence_table my ($localmspdir, $allvariables) = @_; my $infoline = "Changing content of table \"PatchSequence\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "PatchSequence.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_patchsequence_table"); } @@ -1342,10 +1342,11 @@ sub create_msp_patch { my ($installationdir, $includepatharrayref, $allvariables, $languagestringref, $languagesarrayref, $filesarray) = @_; - my $force = 1; # print this message even in 'quiet' mode - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating msp installation set ...\n", $force ); - installer::logger::print_message( "******************************************\n" ); + # print this message even in 'quiet' mode + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating msp installation set ...\n", 1); + $installer::logger::Info->print("******************************************\n"); $installer::globals::creating_windows_installer_patch = 1; @@ -1381,22 +1382,25 @@ sub create_msp_patch $installer::globals::saveinstalldir = $mspdir; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting product installation"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting product installation"); # Installing both installation sets - installer::logger::print_message( "... installing products ...\n" ); + $installer::logger::Info->printf("... installing products ...\n"); my ($olddatabase, $newdatabase) = install_installation_sets($installationdir); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting synchronization of installation sets"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting synchronization of installation sets"); # Synchronizing installed products, allowing only different files with PATCH flag - installer::logger::print_message( "... synchronizing installation sets ...\n" ); + $installer::logger::Info->printf("... synchronizing installation sets ...\n"); synchronize_installation_sets($olddatabase, $newdatabase, $filesarray); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting pcp file creation"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting pcp file creation"); # Create pcp file - installer::logger::print_message( "... creating pcp file ...\n" ); + $installer::logger::Info->printf("... creating pcp file ...\n"); my $localmspdir = installer::systemactions::create_directories("msp", $languagestringref); @@ -1437,12 +1441,14 @@ sub create_msp_patch include_tables_into_pcpfile($fullpcpfilename, $localmspdir, $tablelist); # Start msimsp.exe - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting msimsp.exe"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting msimsp.exe"); my $msimsplogfile = execute_msimsp($fullpcpfilename, $mspfilename, $localmspdir); # Copy final installation set next to msp file - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Copying installation set"); - installer::logger::print_message( "... copying installation set ...\n" ); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Copying installation set"); + $installer::logger::Info->printf("... copying installation set ...\n"); my $oldinstallationsetpath = $installer::globals::updatedatabasepath; @@ -1470,7 +1476,7 @@ sub create_msp_patch # Copying patch file installer::systemactions::copy_one_file($requiredpatchfile, $mspdir); # my $infoline = "Copy $requiredpatchfile to $mspdir\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); } # Find all files included into the patch @@ -1478,7 +1484,8 @@ sub create_msp_patch analyze_msimsp_logfile($msimsplogfile, $filesarray); # Done - installer::logger::include_timestamp_into_logfile("\nPerformance Info: msp creation done"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: msp creation done"); return $mspdir; } diff --git a/solenv/bin/modules/installer/windows/patch.pm b/solenv/bin/modules/installer/windows/patch.pm index 5035339aaa6a..7d75481370df 100644 --- a/solenv/bin/modules/installer/windows/patch.pm +++ b/solenv/bin/modules/installer/windows/patch.pm @@ -135,17 +135,13 @@ sub update_patch_tables # Saving the files installer::files::save_file($reglocatfilename ,$reglocatfile); - my $infoline = "Updated idt file: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $reglocatfilename); installer::files::save_file($appsearchfilename ,$appsearchfile); - $infoline = "Updated idt file: $appsearchfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $appsearchfilename); installer::files::save_file($signaturefilename ,$signaturefile); - $infoline = "Updated idt file: $signaturefilename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Updated idt file: %s\n", $signaturefilename); } 1; diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 70e3d86bb849..eddce824633b 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -177,7 +177,7 @@ sub get_productname_for_property_table # Saving this name in hash $allvariables for further usage $allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname; my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $productname; } @@ -193,7 +193,7 @@ sub get_quickstarterlinkname_for_property_table my $quickstartername = $name . " " . $version; my $infoline = "Defined Quickstarter Link name: $quickstartername\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $quickstartername; } @@ -512,7 +512,7 @@ sub update_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Updated idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -559,7 +559,7 @@ sub set_languages_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -590,7 +590,7 @@ sub set_codes_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -619,7 +619,7 @@ sub set_regkeyprodpath_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -650,7 +650,7 @@ sub update_checkbox_table # Saving the property file installer::files::save_file($checkboxfilename ,$checkboxfile); my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm index 5cdc6a34cd0e..3e26b03810d6 100644 --- a/solenv/bin/modules/installer/windows/registry.pm +++ b/solenv/bin/modules/installer/windows/registry.pm @@ -445,13 +445,11 @@ sub create_registry_table my $registrytablename = $basedir . $installer::globals::separator . "Registry.idt" . "." . $onelanguage; installer::files::save_file($registrytablename ,\@registrytable); - my $infoline = "Created idt file: $registrytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $registrytablename); $registrytablename = $basedir . $installer::globals::separator . "Reg64.idt" . "." . $onelanguage; installer::files::save_file($registrytablename ,\@reg64table ); - $infoline = "Created idt file: $registrytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $registrytablename); } } diff --git a/solenv/bin/modules/installer/windows/removefile.pm b/solenv/bin/modules/installer/windows/removefile.pm index ec6b17dbbfff..cdf0f5366ef0 100644 --- a/solenv/bin/modules/installer/windows/removefile.pm +++ b/solenv/bin/modules/installer/windows/removefile.pm @@ -140,9 +140,7 @@ sub create_removefile_table my $removefiletablename = $basedir . $installer::globals::separator . "RemoveFi.idt"; installer::files::save_file($removefiletablename ,\@removefiletable); - my $infoline = "Created idt file: $removefiletablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $removefiletablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/selfreg.pm b/solenv/bin/modules/installer/windows/selfreg.pm index fa69439e4977..96029edd9326 100644 --- a/solenv/bin/modules/installer/windows/selfreg.pm +++ b/solenv/bin/modules/installer/windows/selfreg.pm @@ -77,8 +77,7 @@ sub create_selfreg_table my $selfregtablename = $basedir . $installer::globals::separator . "SelfReg.idt"; installer::files::save_file($selfregtablename ,\@selfregtable); - my $infoline = "Created idt file: $selfregtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $selfregtablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm index 134429888f98..3ba36a053dc6 100644 --- a/solenv/bin/modules/installer/windows/shortcut.pm +++ b/solenv/bin/modules/installer/windows/shortcut.pm @@ -677,17 +677,16 @@ sub create_shortcut_table $installer::globals::sofficeiconadded = 1; } - my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; - push(@installer::globals::logfileinfo, $localinfoline); + $installer::logger::Lang->printf( + "Added icon file %s for language pack into icon file collector.\n", $$sourcepathref); # Saving the file my $shortcuttablename = $basedir . $installer::globals::separator . "Shortcut.idt" . "." . $onelanguage; installer::files::save_file($shortcuttablename ,\@shortcuttable); - my $infoline = "Created idt file: $shortcuttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $shortcuttablename); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/sign.pm b/solenv/bin/modules/installer/windows/sign.pm index e12c74607bb8..8ce4cc6e054c 100644 --- a/solenv/bin/modules/installer/windows/sign.pm +++ b/solenv/bin/modules/installer/windows/sign.pm @@ -63,7 +63,7 @@ sub copy_install_set if ( -d $removepath ) { installer::systemactions::remove_complete_directory($removepath, 1); } $infoline = "Copy installation set from $installsetpath to $newpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $installsetpath = installer::systemactions::copy_complete_directory($installsetpath, $newpath); @@ -141,7 +141,8 @@ sub check_system_path foreach my $onefile ( @needed_files_in_path ) { - installer::logger::print_message( "...... searching $onefile ..." ); + + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $patharrayref , 0); @@ -152,7 +153,7 @@ sub check_system_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->printf("\tFound: %s\n", $$fileref); } } @@ -169,24 +170,24 @@ sub make_systemcall { my ($systemcall, $displaysystemcall) = @_; - installer::logger::print_message( "... $displaysystemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $displaysystemcall); my $success = 1; my $returnvalue = system($systemcall); my $infoline = "Systemcall: $displaysystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$displaysystemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$displaysystemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $success; @@ -200,24 +201,24 @@ sub make_systemcall_with_warning { my ($systemcall, $displaysystemcall) = @_; - installer::logger::print_message( "... $displaysystemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $displaysystemcall); my $success = 1; my $returnvalue = system($systemcall); my $infoline = "Systemcall: $displaysystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "WARNING: Could not execute \"$displaysystemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$displaysystemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $success; @@ -256,13 +257,13 @@ sub execute_open_system_call if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return ($success, \@openoutput); @@ -504,7 +505,7 @@ sub cabinet_cosistency_check my ( $onefile, $followmeinfohash, $filenamehash, $lastsequencehash, $temppath ) = @_; my $infoline = "Making consistency check of $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $expandfile = "expand.exe"; # Has to be in the path if ( $^O =~ /cygwin/i ) @@ -516,12 +517,12 @@ sub cabinet_cosistency_check if ( $filenamehash == 0 ) { $infoline = "Warning: Stopping consistency check: Important hash of filenames is empty!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( $lastsequencehash == 0 ) { $infoline = "Warning: Stopping consistency check; Important hash of last sequences is empty!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else # both hashes are available { @@ -529,7 +530,7 @@ sub cabinet_cosistency_check my $sequence = $lastsequencehash->{$onefile}; my $lastfile = $filenamehash->{$sequence}; $infoline = "Check of $onefile: Sequence: $sequence is file: $lastfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Therefore the file $lastfile need to be binary compared. # It has to be expanded from the cabinet file @@ -555,12 +556,12 @@ sub cabinet_cosistency_check if ( ! -f $sourcecabfile ) { $infoline = "WARNING: Check of cab file cannot happen, because source cabinet file was not found: $sourcecabfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( ! -f $destcabfile ) { $infoline = "WARNING: Check of cab file cannot happen, because destination cabinet file was not found: $sourcecabfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else # everything is okay for the check { @@ -574,14 +575,14 @@ sub cabinet_cosistency_check my $systemcall = "$expandfile $sourcecabfile $origdiffpath -f:$lastfile "; $infoline = $systemcall . "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $success = make_systemcall($systemcall, $systemcall); if ( ! $success ) { installer::exiter::exit_program("ERROR: Could not successfully execute: $systemcall !", "cabinet_cosistency_check"); } $systemcall = "$expandfile $destcabfile $newdiffpath -f:$lastfile "; $infoline = $systemcall . "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = make_systemcall($systemcall, $systemcall); if ( ! $success ) { installer::exiter::exit_program("ERROR: Could not successfully execute: $systemcall !", "cabinet_cosistency_check"); } @@ -599,13 +600,13 @@ sub cabinet_cosistency_check if ( $origsize != $newsize ) # This shows an error! { $infoline = "ERROR: Different filesize after signtool.exe was used. Original: $origsize Bytes, new: $newsize. File: $lastfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: The cabinet file $destcabfile is broken after signtool.exe signed this file !", "cabinet_cosistency_check"); } else { $infoline = "Same size of last file in cabinet file after usage of signtool.exe: $newsize (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Also making a binary diff? @@ -620,18 +621,18 @@ sub cabinet_cosistency_check if ( $success == 0 ) { $infoline = "Last files are identical after signing cabinet file (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( $success == 1 ) { $infoline = "ERROR: Last files are different after signing cabinet file (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Last files are different after signing cabinet file (File: $lastfile)!", "cabinet_cosistency_check"); } else { $infoline = "ERROR: Problem occured calling diff.exe (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Problem occured calling diff.exe (File: $lastfile) !", "cabinet_cosistency_check"); } } @@ -654,9 +655,7 @@ sub sign_files my $productname = ""; if ( $followmeinfohash->{'allvariableshash'}->{'PRODUCTNAME'} ) { $productname = "/d " . "\"$followmeinfohash->{'allvariableshash'}->{'PRODUCTNAME'}\""; } - my $url = ""; - if (( ! exists($followmeinfohash->{'allvariableshash'}->{'OPENSOURCE'}) ) || ( $followmeinfohash->{'allvariableshash'}->{'OPENSOURCE'} == 0 )) { $url = "/du " . "\"http://www.sun.com\""; } - else { $url = "/du " . "\"http://www.openoffice.org\""; } + my $url = "/du " . "\"http://www.openoffice.org\""; my $timestampurl = "http://timestamp.verisign.com/scripts/timestamp.dll"; my $pfxfilepath = $installer::globals::pfxfile; @@ -673,7 +672,7 @@ sub sign_files if ( already_certified($onefile) ) { $infoline = "Already certified: Skipping file $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); next; } @@ -682,8 +681,16 @@ sub sign_files while (( $counter <= $maxcounter ) && ( ! $success )) { - if ( $counter > 1 ) { installer::logger::print_message( "\n\n... repeating file $onefile ...\n" ); } - if ( $cabinternal ) { installer::logger::print_message(" Signing: $onefile\n"); } + if ( $counter > 1 ) + { + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... repeating file %s ...\n", $onefile); + } + if ( $cabinternal ) + { + $installer::logger::Info->printf(" Signing: %s\n", $onefile); + } my $systemcall = "signtool.exe sign /f \"$pfxfilepath\" /p $pw $productname $url /t \"$timestampurl\" \"$onefile\""; my $displaysystemcall = "signtool.exe sign /f \"$pfxfilepath\" /p ***** $productname $url /t \"$timestampurl\" \"$onefile\""; $success = make_systemcall_with_warning($systemcall, $displaysystemcall); @@ -739,7 +746,7 @@ sub check_ddf_file } my $infoline = "Check of ddf file \"$ddffilename\": Maximum length \"$maxlength\" in line \"$maxline\" (allowed line length: 256 characters)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################# @@ -840,9 +847,10 @@ sub read_cab_file { my ($cabfilename) = @_; - installer::logger::print_message( "\n... reading cabinet file $cabfilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... reading cabinet file %s ...\n", $cabfilename); my $infoline = "Reading cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $systemcall = "cabarc.exe" . " L " . $cabfilename; push(@logfile, "$systemcall\n"); @@ -872,9 +880,10 @@ sub unpack_cab_file { my ($cabfilename, $temppath) = @_; - installer::logger::print_message( "\n... unpacking cabinet file $cabfilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... unpacking cabinet file %s ...\n", $cabfilename); my $infoline = "Unpacking cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $dirname = $cabfilename; $dirname =~ s/\.cab\s*$//; @@ -967,9 +976,10 @@ sub do_pack_cab_file { my ($cabfilename, $allfiles, $workingpath, $temppath) = @_; - installer::logger::print_message( "\n... packing cabinet file $cabfilename ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... packing cabinet file %s ...\n", $cabfilename); my $infoline = "Packing cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -f $cabfilename ) { unlink($cabfilename); } # removing cab file if ( -f $cabfilename ) { installer::exiter::exit_program("ERROR: Failed to remove file: $cabfilename!", "do_pack_cab_file"); } @@ -1051,7 +1061,7 @@ sub already_certified if ( $success ) { $is_certified = 1; - installer::logger::print_message( "... already certified -> skipping $filename ...\n" ); + $installer::logger::Info->printf("... already certified -> skipping %s ...\n", $filename); } return $is_certified; @@ -1118,7 +1128,7 @@ sub compare_directories $dir2 =~ s/\/\s*//; my $infoline = "Comparing directories: $dir1 and $dir2\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $onefile ( @{$files} ) { @@ -1132,7 +1142,7 @@ sub compare_directories my $size2 = -s $file2; $infoline = "Comparing files: $file1 ($size1) and $file2 ($size2)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $size1 != $size2 ) { @@ -1157,7 +1167,7 @@ sub sign_install_set my $success = 1; my $infoline = "Signing installation set in $installsetpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # check required files. if ( ! $installer::globals::signfiles_checked ) { check_system_path(); } diff --git a/solenv/bin/modules/installer/windows/strip.pm b/solenv/bin/modules/installer/windows/strip.pm index 375a792fc5d8..924cfb6b3fcc 100644 --- a/solenv/bin/modules/installer/windows/strip.pm +++ b/solenv/bin/modules/installer/windows/strip.pm @@ -66,18 +66,15 @@ sub do_strip my $returnvalue = system($systemcall); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not strip $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not strip %s!\n", $filename); } else { - $infoline = "SUCCESS: Stripped library $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("SUCCESS: Stripped library %s!\n", $filename); } } @@ -124,8 +121,7 @@ sub strip_binaries my $shortfilename = $sourcefilename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); - $infoline = "Strip: $shortfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Strip: %s\n", $shortfilename); # copy file into directory for stripped libraries diff --git a/solenv/bin/modules/installer/windows/update.pm b/solenv/bin/modules/installer/windows/update.pm index fe668322c70b..974ac6b760f8 100644 --- a/solenv/bin/modules/installer/windows/update.pm +++ b/solenv/bin/modules/installer/windows/update.pm @@ -56,19 +56,16 @@ sub extract_all_tables_from_msidatabase $systemcall = $msidb . " -d " . $fulldatabasepath . " -f " . $workdir . " -e " . $extraslash . "*"; $returnvalue = system($systemcall); - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not execute %s !\n", $systemcall); installer::exiter::exit_program("ERROR: Could not exclude tables from msi database: $fulldatabasepath !", "extract_all_tables_from_msidatabase"); } else { - $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed %s successfully!\n", $systemcall); } } @@ -323,17 +320,19 @@ sub readdatabase if (( $databasename ) && ( $databasename ne "" )) # This is an update packaging process! { $installer::globals::updatedatabase = 1; - installer::logger::print_message( "... update process, using database $databasename ...\n" ); - $infoline = "\nDatabase found in $completelistname: \"$databasename\"\n\n"; + $installer::logger::Info->printf("... update process, using database %s ...\n", $databasename); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Database found in %s: \"%s\"\n", $completelistname, $databasename); + $installer::logger::Lang->printf("\n"); # Saving in global variable $installer::globals::updatedatabasepath = $databasename; } else { - # installer::logger::print_message( "... no update process, no database found ...\n" ); - $infoline = "\nNo database found in $completelistname. This is no update process!\n\n"; + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("No database found in %s. This is no update process!\n", $completelistname); + $installer::logger::Lang->printf("\n"); } - push( @installer::globals::logfileinfo, $infoline); if ( $installer::globals::updatedatabase ) { @@ -342,7 +341,7 @@ sub readdatabase my $msifilename = $databasename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$msifilename); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase start"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase start"); # create directory for unpacking my $databasedir = installer::systemactions::create_directories("database", $languagestringref); @@ -351,12 +350,12 @@ sub readdatabase my $fulldatabasepath = $databasedir . $installer::globals::separator . $msifilename; installer::systemactions::copy_one_file($databasename, $fulldatabasepath); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase: before extracting tables"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase: before extracting tables"); # extract all tables from database extract_all_tables_from_msidatabase($fulldatabasepath, $databasedir); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase: before reading tables"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase: before reading tables"); # read all tables $database = read_all_tables_from_msidatabase($databasedir); @@ -402,7 +401,7 @@ sub readdatabase # } # } - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase end"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase end"); } return $database; @@ -416,7 +415,7 @@ sub readmergedatabase { my ( $mergemodules, $languagestringref, $includepatharrayref ) = @_; - installer::logger::include_timestamp_into_logfile("Performance Info: readmergedatabase start"); + $installer::logger::Lang->add_timestamp("Performance Info: readmergedatabase start"); my $mergemoduledir = installer::systemactions::create_directories("mergedatabase", $languagestringref); @@ -461,7 +460,7 @@ sub readmergedatabase } } - installer::logger::include_timestamp_into_logfile("Performance Info: readmergedatabase end"); + $installer::logger::Lang->add_timestamp("Performance Info: readmergedatabase end"); } ################################################################################# @@ -593,4 +592,4 @@ sub create_database_hashes } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/upgrade.pm b/solenv/bin/modules/installer/windows/upgrade.pm index 3f837dff8f31..9559c8e6c8ab 100644 --- a/solenv/bin/modules/installer/windows/upgrade.pm +++ b/solenv/bin/modules/installer/windows/upgrade.pm @@ -124,16 +124,14 @@ sub create_upgrade_table { @upgradetable = (); installer::windows::idtglobal::write_idt_header(\@upgradetable, "upgrade"); - my $infoline = "Beta product -> empty Upgrade table\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Beta product -> empty Upgrade table\n"); } # Saving the file my $upgradetablename = $basedir . $installer::globals::separator . "Upgrade.idt"; installer::files::save_file($upgradetablename ,\@upgradetable); - my $infoline = "Created idt file: $upgradetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $upgradetablename); } ############################################################## diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 91da2ab0b39a..8ea19acda9da 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -52,7 +52,7 @@ sub unpack_all_targzfiles_in_directory installer::logger::include_header_into_logfile("Unpacking tar.gz files:"); - installer::logger::print_message( "... unpacking tar.gz files ... \n" ); + $installer::logger::Info->print( "... unpacking tar.gz files ... \n" ); my $localdirectory = $directory . $installer::globals::separator . "packages"; my $alltargzfiles = installer::systemactions::find_file_with_file_extension("tar.gz", $localdirectory); @@ -65,17 +65,17 @@ sub unpack_all_targzfiles_in_directory $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -97,7 +97,7 @@ sub copy_install_sets_to_ship if ( ! -d $localshipinstalldir ) { installer::systemactions::create_directory_structure($localshipinstalldir); } # copy installation set to /ship ($localshipinstalldir) - installer::logger::print_message( "... copy installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); + $installer::logger::Info->print( "... copy installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); installer::systemactions::copy_complete_directory($destdir, $localshipinstalldir); if (( ! $installer::globals::iswindowsbuild ) && ( $installer::globals::addjavainstaller )) @@ -126,16 +126,16 @@ sub link_install_sets_to_ship installer::logger::include_header_into_logfile("Linking installation set to ship:"); my $infoline = "... destination directory: $shipinstalldir ...\n"; - installer::logger::print_message( $infoline ); - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->print( $infoline ); + $installer::logger::Lang->print($infoline); if ( ! -d $shipinstalldir) { $infoline = "Creating directory: $shipinstalldir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::systemactions::create_directory_structure($shipinstalldir); $infoline = "Created directory: $shipinstalldir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $dirname = $destdir; @@ -144,24 +144,24 @@ sub link_install_sets_to_ship my $localshipinstalldir = $shipinstalldir . $installer::globals::separator . $dirname; # link installation set to /ship ($localshipinstalldir) - installer::logger::print_message( "... linking installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); + $installer::logger::Lang->print( "... linking installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); my $systemcall = "ln -s $destdir $localshipinstalldir"; $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not create link \"$localshipinstalldir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Created link \"$localshipinstalldir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $localshipinstalldir; @@ -292,14 +292,14 @@ sub save_patchlist_file $patchlistfilename =~ s/log\_/patchfiles\_/; $patchlistfilename =~ s/\.log/\.txt/; installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, \@installer::globals::patchfilecollector); - installer::logger::print_message( "... creating patchlist file $patchlistfilename \n" ); + $installer::logger::Info->print( "... creating patchlist file $patchlistfilename \n" ); if (( $installer::globals::patch ) && ( ! $installer::globals::creating_windows_installer_patch )) # only for non-Windows patches { $patchlistfilename =~ s/patchfiles\_/nopatchfiles\_/; my $nopatchlist = create_nopatchlist(); installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, $nopatchlist); - installer::logger::print_message( "... creating patch exclusion file $patchlistfilename \n" ); + $installer::logger::Info->print( "... creating patch exclusion file $patchlistfilename \n" ); } } @@ -313,7 +313,7 @@ sub remove_old_installation_sets { my ($basedir) = @_; - installer::logger::print_message( "... removing old installation directories ...\n" ); + $installer::logger::Info->print( "... removing old installation directories ...\n" ); my $removedir = $basedir; @@ -342,7 +342,7 @@ sub remove_old_ship_installation_sets { my ($fulldir, $counter) = @_; - installer::logger::print_message( "... removing old installation directories ...\n" ); + $installer::logger::Info->print( "... removing old installation directories ...\n" ); my $basedir = $fulldir; installer::pathanalyzer::get_path_from_fullqualifiedname(\$basedir); @@ -398,7 +398,7 @@ sub create_installation_directory else { $installdir = installer::systemactions::create_directories("install", $languageref); - installer::logger::print_message( "... creating installation set in $installdir ...\n" ); + $installer::logger::Info->print( "... creating installation set in $installdir ...\n" ); remove_old_installation_sets($installdir); my $inprogressinstalldir = $installdir . "_inprogress"; installer::systemactions::rename_directory($installdir, $inprogressinstalldir); @@ -421,16 +421,19 @@ sub analyze_and_save_logfile my $is_success = 1; my $finalinstalldir = ""; - installer::logger::print_message( "... checking log file " . $loggingdir . $installer::globals::logfilename . "\n" ); + $installer::logger::Info->print( "... checking log file " . $loggingdir . $installer::globals::logfilename . "\n" ); - my $contains_error = installer::control::check_logfile(\@installer::globals::logfileinfo); + my $contains_error = installer::control::check_logfile(); # Dependent from the success, the installation directory can be renamed and mails can be send. - if ( $contains_error ) + if ($contains_error) { my $errordir = installer::systemactions::rename_string_in_directory($installdir, "_inprogress", "_witherror"); - if ( $installer::globals::updatepack ) { installer::mail::send_fail_mail($allsettingsarrayref, $languagestringref, $errordir); } + if ($installer::globals::updatepack) + { + installer::mail::send_fail_mail($allsettingsarrayref, $languagestringref, $errordir); + } # Error output to STDERR for ( my $j = 0; $j <= $#installer::globals::errorlogfileinfo; $j++ ) { @@ -469,13 +472,20 @@ sub analyze_and_save_logfile # Saving the logfile in the log file directory and additionally in a log directory in the install directory my $numberedlogfilename = $installer::globals::logfilename; - if ( $installer::globals::updatepack ) { $numberedlogfilename =~ s /log_/log_$current_install_number\_/; } - installer::logger::print_message( "... creating log file $numberedlogfilename \n" ); - installer::files::save_file($loggingdir . $numberedlogfilename, \@installer::globals::logfileinfo); - installer::files::save_file($installlogdir . $installer::globals::separator . $numberedlogfilename, \@installer::globals::logfileinfo); - - # Saving the checksumfile in a checksum directory in the install directory - # installer::worker::save_checksum_file($current_install_number, $installchecksumdir, $checksumfile); + if ( $installer::globals::updatepack ) + { + $numberedlogfilename =~ s /log_/log_$current_install_number\_/; + } + foreach my $log_file_name ( + $loggingdir . $numberedlogfilename, + $installlogdir . $installer::globals::separator . $numberedlogfilename) + { + if ($log_file_name ne $installer::logger::Lang->{'filename'}) + { + $installer::logger::Info->printf(" copying log file to %s\n", $log_file_name); + installer::systemactions::copy_one_file($installer::logger::Lang->{'filename'}, $log_file_name); + } + } # Saving the list of patchfiles in a patchlist directory in the install directory if (( $installer::globals::patch ) || ( $installer::globals::creating_windows_installer_patch )) { installer::worker::save_patchlist_file($installlogdir, $numberedlogfilename); } @@ -502,7 +512,7 @@ sub save_logfile_after_linking # Saving the logfile in the log file directory and additionally in a log directory in the install directory my $numberedlogfilename = $installer::globals::logfilename; if ( $installer::globals::updatepack ) { $numberedlogfilename =~ s /log_/log_$current_install_number\_/; } - installer::logger::print_message( "... creating log file $numberedlogfilename \n" ); + $installer::logger::Info->print( "... creating log file $numberedlogfilename \n" ); installer::files::save_file($loggingdir . $numberedlogfilename, \@installer::globals::logfileinfo); installer::files::save_file($installlogdir . $installer::globals::separator . $numberedlogfilename, \@installer::globals::logfileinfo); } @@ -514,13 +524,13 @@ sub save_logfile_after_linking sub clean_output_tree { - installer::logger::print_message( "... cleaning the output tree ...\n" ); + $installer::logger::Info->print( "... cleaning the output tree ...\n" ); for ( my $i = 0; $i <= $#installer::globals::removedirs; $i++ ) { if ( -d $installer::globals::removedirs[$i] ) { - installer::logger::print_message( "... removing directory $installer::globals::removedirs[$i] ...\n" ); + $installer::logger::Info->print( "... removing directory $installer::globals::removedirs[$i] ...\n" ); installer::systemactions::remove_complete_directory($installer::globals::removedirs[$i], 1); } } @@ -532,7 +542,7 @@ sub clean_output_tree if ( -d $installer::globals::shiptestdirectory ) { my $infoline = "Last try to remove $installer::globals::shiptestdirectory . \n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $systemcall = "rmdir $installer::globals::shiptestdirectory"; my $returnvalue = system($systemcall); } @@ -546,13 +556,13 @@ sub clean_output_tree sub clean_jds_temp_dirs { - installer::logger::print_message( "... cleaning jds directories ...\n" ); + $installer::logger::Info->print( "... cleaning jds directories ...\n" ); for ( my $i = 0; $i <= $#installer::globals::jdsremovedirs; $i++ ) { if ( -d $installer::globals::jdsremovedirs[$i] ) { - installer::logger::print_message( "... removing directory $installer::globals::jdsremovedirs[$i] ...\n" ); + $installer::logger::Info->print( "... removing directory $installer::globals::jdsremovedirs[$i] ...\n" ); installer::systemactions::remove_complete_directory($installer::globals::jdsremovedirs[$i], 1); } } @@ -724,7 +734,7 @@ sub remove_all_items_with_special_flag if ( $styles =~ /\b$flag\b/ ) { my $infoline = "Attention: Removing from collector: $oneitem->{'Name'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $flag eq "BINARYTABLE_ONLY" ) { push(@installer::globals::binarytableonlyfiles, $oneitem); } next; } @@ -748,13 +758,13 @@ sub install_simple ($$$$$$) my $copyopts = '-af'; $copyopts = '-PpRf' unless ( $ENV{'GNUCOPY'} ); # if not gnucopy, assume POSIX copy - installer::logger::print_message( "... installing module $packagename ...\n" ); + $installer::logger::Info->print( "... installing module $packagename ...\n" ); my $destdir = $installer::globals::destdir; my @lines = (); - installer::logger::print_message( "DestDir: $destdir \n" ); - installer::logger::print_message( "Rootpath: $installer::globals::rootpath \n" ); + $installer::logger::Info->print( "DestDir: $destdir \n" ); + $installer::logger::Info->print( "Rootpath: $installer::globals::rootpath \n" ); `mkdir -p $destdir` if $destdir ne ""; `mkdir -p $destdir$installer::globals::rootpath`; @@ -1092,7 +1102,7 @@ sub create_inf_file my $infdir = installer::systemactions::create_directories($infdirname, $languagestringref); my $infoline = "Number of inf files: $#{$inf_files} + 1 \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # there are inffiles for all modules @@ -1115,7 +1125,7 @@ sub create_inf_file my $onelanguage = ${$languagesarrayref}[$j]; $infoline = "Templatefile: $inf_file_name, Language: $onelanguage \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $templatefile = installer::files::read_file($templatefilename); @@ -1124,7 +1134,7 @@ sub create_inf_file write_content_into_inf_file($templatefile, $filesref, $registryitemsref, $folderref, $folderitemsref, $modulesref, $onelanguage, $inffile, $firstlanguage, $allvariableshashref); $infoline = "Lines change: From $linesbefore to $#{$templatefile}.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # rename language specific inffile my $language_inf_file_name = $inf_file_name; @@ -1135,7 +1145,7 @@ sub create_inf_file installer::files::save_file($sourcepath, $templatefile); $infoline = "Saving file: $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # creating new file object @@ -1342,7 +1352,7 @@ sub prepare_linuxlinkfiles else { $onefile->{'destination'} = $onefile->{'destination'} . "\.$installer::globals::linuxlibrarybaselevel"; } my $infoline = "LINUXLINK: Changing file destination from $original_destination to $onefile->{'destination'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # all files without PATCH flag are included into the RPM if ( ! $ispatchfile ) { push( @filesarray, $onefile); } @@ -1357,7 +1367,7 @@ sub prepare_linuxlinkfiles push( @installer::globals::linuxlinks, $linkfile ); $infoline = "LINUXLINK: Created link: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return \@filesarray; @@ -1412,7 +1422,7 @@ sub prepare_forced_linuxlinkfiles $linkfile->{'destination'} = $localdestination . $installer::globals::separator . $onelink->{'Name'}; $infoline = "Forced link into update file: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # The file, defined by the link, has to be included into the # link array @installer::globals::linuxlinks @@ -1443,7 +1453,7 @@ sub prepare_forced_linuxlinkfiles $linkfile->{'destination'} = $localdestination . $installer::globals::separator . $onelink->{'Name'}; $infoline = "Forced link into update file: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # The file, defined by the link, has to be included into the # link array @installer::globals::linuxlinks @@ -1684,8 +1694,8 @@ sub prepare_windows_patchfiles $patchfilename = $winpatchdir . $installer::globals::separator . $patchfilename; installer::files::save_file($patchfilename, $patchfilelist); - my $infoline = "\nCreated list of patch files: $patchfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created list of patch files: %s\n", $patchfilename); # and assigning the new source $patchlistfile->{'sourcepath'} = $patchfilename; @@ -1695,8 +1705,8 @@ sub prepare_windows_patchfiles { my $filesize = ( -s $patchfilename ); $infoline = "Size of patch file list: $filesize\n\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... size of patch list file: $filesize Byte ... \n" ); + $installer::logger::Lang->print($infoline); + $installer::logger::Info->print( "... size of patch list file: $filesize Byte ... \n" ); # Win 98: Maximum size of ini file is 65 kB # if ( $filesize > 64000 ) { installer::exiter::exit_program("ERROR: Maximum size of patch file list is 65 kB (Win98), now reached: $filesize Byte !", "prepare_windows_patchfiles"); } @@ -1948,13 +1958,13 @@ sub copy_all_packages else { $infoline = "Excluding package (matching): $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Excluding package (precise name): $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -1970,17 +1980,17 @@ sub make_systemcall my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1993,7 +2003,7 @@ sub copy_additional_packages my ($allcopypackages, $destdir, $includepatharrayref) = @_; my $infoline = "Copy additional packages into installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $destdir =~ s/\/\s*$//; @@ -2001,7 +2011,7 @@ sub copy_additional_packages { my $onepackage = ${$allcopypackages}[$i]; $infoline = "Copy package: $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # this package must be delivered into the solver @@ -2029,9 +2039,10 @@ sub create_jds_sets { my ($installationdir, $allvariableshashref, $languagestringref, $languagesarrayref, $includepatharrayref) = @_; - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating jds installation set ...\n" ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating jds installation set ...\n"); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating jds installation sets:"); @@ -2072,7 +2083,7 @@ sub create_jds_sets my $listfile = installer::files::read_file($$filelistnameref); my $infoline = "Found jds list file: $$filelistnameref\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # substituting the variables substitute_dollar_variables($listfile, $allvariableshashref); @@ -2301,8 +2312,7 @@ sub add_variables_from_inc_to_hashref $includefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$includefilename, $includepatharrayref, 1); if ( $$includefilenameref eq "" ) { installer::exiter::exit_program("Include file $includefilename not found!\nADD_INCLUDE_FILES = $allvariables->{'ADD_INCLUDE_FILES'}", "add_variables_from_inc_to_hashref"); } - $infoline = "Including inc file: $$includefilenameref \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Including inc file: %s\n", $$includefilenameref); my $includefile = installer::files::read_file($$includefilenameref); @@ -2316,8 +2326,8 @@ sub add_variables_from_inc_to_hashref my $key = $1; my $value = $2; $allvariables->{$key} = $value; - $infoline = "Setting of variable: $key = $value\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Setting of variable: %s = %s\n", + $key, $value); } } } @@ -2330,8 +2340,9 @@ sub add_variables_from_inc_to_hashref if (( exists($allvariables->{'WINDOWSJAVAVERSION'})) && ( $allvariables->{'WINDOWSJAVAVERSION'} ne "" )) { $allvariables->{'JAVAVERSION'} = $allvariables->{'WINDOWSJAVAVERSION'}; - $infoline = "Changing value of property \"JAVAVERSION\" to $allvariables->{'JAVAVERSION'} (property \"WINDOWSJAVAVERSION\").\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Changing value of property \"JAVAVERSION\" to %s (property \"WINDOWSJAVAVERSION\").\n", + $allvariables->{'JAVAVERSION'}); } } } @@ -2345,7 +2356,7 @@ sub collect_all_files_from_includepathes my ($patharrayref) = @_; installer::logger::globallog("Reading all directories: Start"); - installer::logger::print_message( "... reading include pathes ...\n" ); + $installer::logger::Info->print( "... reading include pathes ...\n" ); # empty the global @installer::globals::allincludepathes =(); @@ -2358,8 +2369,9 @@ sub collect_all_files_from_includepathes if ( ! -d $includepath ) { - $infoline = "$includepath does not exist. (Can be removed from include path list?)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "%s does not exist. (Can be removed from include path list?)\n", + $includepath); next; } @@ -2370,14 +2382,16 @@ sub collect_all_files_from_includepathes if ( ! ( $#sourcefiles > -1 )) { - $infoline = "$includepath is empty. (Can be removed from include path list?)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "%s is empty. (Can be removed from include path list?)\n", + $includepath); } else { my $number = $#sourcefiles + 1; - $infoline = "Directory $includepath contains $number files (including subdirs)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Directory %s contains $number files (including subdirs)\n", + $includepath); my %allfileshash = (); $allfileshash{'includepath'} = $includepath; @@ -2394,7 +2408,7 @@ sub collect_all_files_from_includepathes $installer::globals::include_pathes_read = 1; installer::logger::globallog("Reading all directories: End"); - push( @installer::globals::globallogfileinfo, "\n"); + $installer::logger::Global->print("\n"); } ############################################## @@ -2478,17 +2492,17 @@ sub call_sum my $returnvalue = $?; # $? contains the return value of the systemcall my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $sumoutput; @@ -2518,17 +2532,17 @@ sub call_wc my $returnvalue = $?; # $? contains the return value of the systemcall my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $wcoutput; @@ -2633,17 +2647,17 @@ sub set_time_stamp my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: \"$systemcall\" failed!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: \"$systemcall\" !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2684,10 +2698,10 @@ sub generate_cygwin_pathes { my ($filesref) = @_; - installer::logger::include_timestamp_into_logfile("Starting generating cygwin pathes"); + $installer::logger::Lang->add_timestamp("Starting generating cygwin pathes"); my $infoline = "Generating cygwin pathes (generate_cygwin_pathes)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $max = 5000; # number of pathes in one file @@ -2708,7 +2722,7 @@ sub generate_cygwin_pathes $temppath =~ s/\Q$installer::globals::separator\E\s*$//; $tmpfilename = $temppath . $installer::globals::separator . $tmpfilename; $infoline = "Creating temporary file for cygwin conversion: $tmpfilename (contains $counter pathes)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -f $tmpfilename ) { unlink $tmpfilename; } installer::files::save_file($tmpfilename, \@pathcollector); @@ -2724,12 +2738,12 @@ sub generate_cygwin_pathes if ($success) { $infoline = "Success: Successfully converted to cygwin pathes!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "ERROR: Failed to convert to cygwin pathes!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Failed to convert to cygwin pathes!", "generate_cygwin_pathes"); } @@ -2753,12 +2767,12 @@ sub generate_cygwin_pathes if (( ! exists(${$filesref}[$i]->{'cyg_sourcepath'}) ) || ( ${$filesref}[$i]->{'cyg_sourcepath'} eq "" )) { $infoline = "ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}!", "generate_cygwin_pathes"); } } - installer::logger::include_timestamp_into_logfile("Ending generating cygwin pathes"); + $installer::logger::Lang->add_timestamp("Ending generating cygwin pathes"); } ############################################## @@ -2978,18 +2992,18 @@ sub resolving_hidden_flag else { $onefile->{'destination'} = $destination . $installer::globals::separator . $newfilename; } $infoline = "Success: Using file with flag HIDDEN from \"$onefile->{'sourcepath'}\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Error: Failed to copy HIDDEN file from \"$sourcefile\" to \"$destfile\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################ @@ -3053,8 +3067,7 @@ sub set_spellcheckerlanguages if ($$spellcheckfileref eq "") { installer::exiter::exit_program("ERROR: Could not find $spellcheckfilename!", "set_spellcheckerlanguages"); } - my $infoline = "Using spellchecker file: $$spellcheckfileref \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Using spellchecker file: %s\n", $$spellcheckfileref); my $spellcheckfile = installer::files::read_file($$spellcheckfileref); my %spellcheckhash = (); @@ -3114,8 +3127,7 @@ sub set_spellcheckerlanguages foreach my $lang (sort keys %installer::globals::spellcheckerlanguagehash) { $langstring = $langstring . "," . $lang } $langstring =~ s/^\s*,//; - $infoline = "Collected spellchecker languages for spellchecker: $langstring \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Collected spellchecker languages for spellchecker: %s\n", $langstring); } ################################################ @@ -3142,7 +3154,7 @@ sub put_license_into_setup # Replacement my $infoline = "Adding licensefile into setup script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $includestring = ""; for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) { $includestring = $includestring . ${$licensefile}[$i]; } @@ -3185,17 +3197,17 @@ sub tar_package my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1"; @@ -3223,17 +3235,17 @@ sub untar_package my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1"; @@ -3250,12 +3262,12 @@ sub shuffle_array # my $counter = 0; # my $infoline = "Old package order: \n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # foreach my $onepackage ( @{$arrayref} ) # { # $counter++; # $infoline = "$counter: $onepackage->{'module'}\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # } my $i = @$arrayref; @@ -3267,12 +3279,12 @@ sub shuffle_array # $counter = 0; # $infoline = "New package order: \n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # foreach my $onepackage ( @{$arrayref} ) # { # $counter++; # $infoline = "$counter: $onepackage->{'module'}\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # } } @@ -3305,17 +3317,17 @@ sub set_time_stamp_for_file my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: \"$systemcall\" failed!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: \"$systemcall\" !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } diff --git a/solenv/bin/modules/installer/xpdinstaller.pm b/solenv/bin/modules/installer/xpdinstaller.pm index 0f8a4037e144..301878b8ab88 100644 --- a/solenv/bin/modules/installer/xpdinstaller.pm +++ b/solenv/bin/modules/installer/xpdinstaller.pm @@ -596,7 +596,7 @@ sub get_size_value # Evaluating an error, because of rpm problems with removed LD_LIBRARY_PATH if ( $error ) { - installer::logger::print_message( "... trying /usr/bin/rpm ...\n" ); + $installer::logger::Info->print("... trying /usr/bin/rpm ...\n"); my $systemcall = "/usr/bin/rpm -qp --queryformat \"\[\%\{FILESIZES\}\\n\]\" $packagename 2\>\&1 |"; ($rpmout, $error) = make_systemcall_allowing_error($systemcall, 0, 0); if ( $error ) { installer::exiter::exit_program("ERROR: rpm failed to query package!", "get_size_value"); } @@ -611,7 +611,7 @@ sub get_size_value my $rpmname = $packagename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "Filesize $rpmname : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $installer::globals::issolarispkgbuild ) @@ -671,7 +671,7 @@ sub get_md5_value my $rpmname = $packagename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "md5sum of $rpmname : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -734,7 +734,7 @@ sub get_fullpkgname_value # Evaluating an error, because of rpm problems with removed LD_LIBRARY_PATH if ( $error ) { - installer::logger::print_message( "... trying /usr/bin/rpm ...\n" ); + $installer::logger::Info->print("... trying /usr/bin/rpm ...\n"); my $systemcall = "/usr/bin/rpm -qp $packagename |"; ($returnarray, $error) = make_systemcall_allowing_error($systemcall, 0, 0); if ( $error ) { installer::exiter::exit_program("ERROR: rpm failed to query package!", "get_fullpkgname_value"); } @@ -746,7 +746,7 @@ sub get_fullpkgname_value installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "Full package name from $rpmname: $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $value; @@ -864,7 +864,7 @@ sub make_systemcall my @returns = (); - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); open (REG, "$systemcall"); while (<REG>) {push(@returns, $_); } @@ -873,23 +873,26 @@ sub make_systemcall my $returnvalue = $?; # $? contains the return value of the systemcall my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $logreturn ) { - for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); } + foreach my $line (@returns) + { + $installer::logger::Lang->print($line); + } } if ($returnvalue) { $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $error_occured = 1; } else { $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return \@returns; @@ -905,7 +908,7 @@ sub make_systemcall_allowing_error my @returns = (); - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); open (REG, "$systemcall"); while (<REG>) {push(@returns, $_); } @@ -914,11 +917,14 @@ sub make_systemcall_allowing_error my $returnvalue = $?; # $? contains the return value of the systemcall my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $logreturn ) { - for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); } + foreach my $line (@returns) + { + $installer::logger::Lang->print($line); + } } if ($returnvalue) @@ -926,20 +932,20 @@ sub make_systemcall_allowing_error if ( $can_fail ) { $infoline = "WARNING: Failed system call: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $error_occured = 1; } else { $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $error_occured = 1; } } else { $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return (\@returns, $returnvalue); @@ -1480,7 +1486,7 @@ sub create_emptyparents_xpd_file installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # push(@installer::globals::emptyxpdparents, $parentgid); @@ -1595,7 +1601,7 @@ sub create_xpd_file installer::files::save_file($xpdfilename, $emptyfilecontent); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $xpdfilename = $newxpdfilename; change_parent_in_xpdfile($xpdfile, $module->{'XpdPackageName'}); @@ -1605,7 +1611,7 @@ sub create_xpd_file push( @installer::globals::createdxpdfiles, $modulegid); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $grandpagid = "root"; if ( $parentgid ne "root" ) @@ -1663,7 +1669,7 @@ sub create_xpd_file_for_childproject push( @installer::globals::createdxpdfiles, $modulegid); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $parentgid ne "root" ) { @@ -1697,7 +1703,7 @@ sub create_xpd_file_for_systemintegration # installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newpackagename); my $infoline = "Creating xpd file for package: $newpackagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $childmodule = installer::worker::copy_hash_from_references($module); $childmodule->{'ParentID'} = $module->{'gid'}; # the module gid is the new parent @@ -1748,7 +1754,7 @@ sub create_xpd_file_for_systemintegration installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Creating the top level visible xpd file @@ -1804,7 +1810,7 @@ sub create_setup_xpd installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################### diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index af70557eac22..6673c3236feb 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -584,18 +584,18 @@ sub replace_languages_in_pathes { $installer::globals::refresh_includepathes = 1; $infoline = "Directory $newdir exists and is not empty. Refreshing global file array is required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Directory $newdir is empty. No refresh of global file array required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Directory $newdir does not exist. No refresh of global file array required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -623,10 +623,10 @@ sub list_all_files_from_include_path my $path = ${$patharrayref}[$i]; installer::remover::remove_leading_and_ending_whitespaces(\$path); my $infoline = "$path\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - push( @installer::globals::logfileinfo, "\n"); + $installer::logger::Lang->print("\n"); return \@filesarray; } diff --git a/solenv/gbuild/platform/os2.mk b/solenv/gbuild/platform/os2.mk index 565f51186cf9..692f98a4463f 100644 --- a/solenv/gbuild/platform/os2.mk +++ b/solenv/gbuild/platform/os2.mk @@ -87,10 +87,6 @@ gb_CFLAGS := \ -I$(JAVA_HOME)/include \ -I$(JAVA_HOME)/include/os2 - -# -fvisibility=hidden \ -# - gb_CXXFLAGS := \ -Zomf \ -Wall \ @@ -108,7 +104,7 @@ gb_CXXFLAGS := \ gb_STDLIBS = \ z \ - stdc++ \ + stdc++ ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) gb_CFLAGS_WERROR := -Werror diff --git a/solenv/inc/extension_post.mk b/solenv/inc/extension_post.mk index 0c7c963eee36..ba10b2d5e8cb 100644 --- a/solenv/inc/extension_post.mk +++ b/solenv/inc/extension_post.mk @@ -92,39 +92,19 @@ $(PACK_RUNTIME_FLAG) : $(EXTENSIONDIR) .ENDIF .ELSE .IF "$(PACKMS)"!="" -.IF "$(CCNUMVER)" <= "001399999999" - $(GNUCOPY) $(PACKMS)/msvcr71.dll $(EXTENSIONDIR) - $(GNUCOPY) $(PACKMS)/msvcp71.dll $(EXTENSIONDIR) -.ELSE # "$(CCNUMVER)" <= "001399999999" -.IF "$(CCNUMVER)" <= "001499999999" - $(GNUCOPY) $(PACKMS)/msvcr80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(PACKMS)/msvcp80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(PACKMS)/msvcm80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(PACKMS)/Microsoft.VC80.CRT.manifest $(EXTENSIONDIR) -.ELSE # "$(CCNUMVER)" <= "001499999999" +.IF "$(CCNUMVER)" > "001499999999" $(GNUCOPY) $(PACKMS)/msvcr90.dll $(EXTENSIONDIR) $(GNUCOPY) $(PACKMS)/msvcp90.dll $(EXTENSIONDIR) $(GNUCOPY) $(PACKMS)/msvcm90.dll $(EXTENSIONDIR) $(GNUCOPY) $(PACKMS)/Microsoft.VC90.CRT.manifest $(EXTENSIONDIR) -.ENDIF # "$(CCNUMVER)" <= "001499999999" -.ENDIF # "$(CCNUMVER)" <= "001399999999" +.ENDIF # "$(CCNUMVER)" > "001499999999" .ELSE # "$(PACKMS)"!="" -.IF "$(CCNUMVER)" <= "001399999999" - $(GNUCOPY) $(SOLARBINDIR)/msvcr71.dll $(EXTENSIONDIR) - $(GNUCOPY) $(SOLARBINDIR)/msvcp71.dll $(EXTENSIONDIR) -.ELSE # "$(CCNUMVER)" <= "001399999999" -.IF "$(CCNUMVER)" <= "001499999999" - $(GNUCOPY) $(SOLARBINDIR)/msvcr80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(SOLARBINDIR)/msvcp80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(SOLARBINDIR)/msvcm80.dll $(EXTENSIONDIR) - $(GNUCOPY) $(SOLARBINDIR)/Microsoft.VC80.CRT.manifest $(EXTENSIONDIR) -.ELSE # "$(CCNUMVER)" <= "001499999999" +.IF "$(CCNUMVER)" > "001499999999" $(GNUCOPY) $(SOLARBINDIR)/msvcr90.dll $(EXTENSIONDIR) $(GNUCOPY) $(SOLARBINDIR)/msvcp90.dll $(EXTENSIONDIR) $(GNUCOPY) $(SOLARBINDIR)/msvcm90.dll $(EXTENSIONDIR) $(GNUCOPY) $(SOLARBINDIR)/Microsoft.VC90.CRT.manifest $(EXTENSIONDIR) -.ENDIF # "$(CCNUMVER)" <= "001499999999" -.ENDIF # "$(CCNUMVER)" <= "001399999999" +.ENDIF # "$(CCNUMVER)" > "001499999999" .ENDIF # "$(PACKMS)"!="" .ENDIF #"$(COM)"=="GCC" .ENDIF # "$(OS)$(CPU)"=="WNTI" diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 8fbfec435846..2278b56aece0 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -18,8 +18,8 @@ # under the License. # # ************************************************************* -RSCVERSION=400 -RSCREVISION=400m3(Build:9702) -BUILD=9702 -LAST_MINOR=m3 -SOURCEVERSION=AOO400 +RSCVERSION=410 +RSCREVISION=410m1(Build:9750) +BUILD=9750 +LAST_MINOR=m1 +SOURCEVERSION=AOO410 diff --git a/solenv/inc/os2gcci.mk b/solenv/inc/os2gcci.mk index 28d74539541f..1c400c616fd9 100644 --- a/solenv/inc/os2gcci.mk +++ b/solenv/inc/os2gcci.mk @@ -259,8 +259,8 @@ STDLIBGUIST=$(STDLIBCPP) STDSHLGUIMT=$(STDLIBCPP) STDSHLCUIMT=$(STDLIBCPP) -LIBSTLPORT=stlp45.lib $(DYNAMIC) -LIBSTLPORTST=stlp45.lib $(STATIC) $(DYNAMIC) +LIBSTLPORT=$(DYNAMIC) +LIBSTLPORTST=$(STATIC) $(DYNAMIC) # name of library manager diff --git a/solenv/inc/tg_ext.mk b/solenv/inc/tg_ext.mk index 332c0ca45690..290b50347273 100644 --- a/solenv/inc/tg_ext.mk +++ b/solenv/inc/tg_ext.mk @@ -182,18 +182,12 @@ $(PACKAGE_DIR)/$(PATCH_FLAG_FILE) : $(PACKAGE_DIR)/$(ADD_FILES_FLAG_FILE) $(COMMAND_ECHO)$(TOUCH) $@ .ELSE # "$(PATCH_FILES)"=="none" || "$(PATCH_FILES)"=="" .IF "$(GUI)"=="WNT" -# hack to make 4nt version 4,01 work and still get propper -# errorcodes for versions < 3,00 -#.IF "$(my4ver:s/.//:s/,//)" >= "300" -# $(COMMAND_ECHO)cd $(PACKAGE_DIR) && ( $(TYPE:s/+//) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | tr -d "\015" | patch $(PATCHFLAGS) -p2 ) && $(TOUCH) $(PATCH_FLAG_FILE) -#.ELSE # "$(my4ver:s/.//:s/,//)" >= "300" - $(COMMAND_ECHO)cd $(PACKAGE_DIR) && $(TYPE:s/+//) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | tr -d "\015" | patch $(PATCHFLAGS) -p2 && $(TOUCH) $(PATCH_FLAG_FILE) -#.ENDIF # "$(my4ver:s/.//:s/,//)" >= "300" + $(COMMAND_ECHO)cd $(PACKAGE_DIR) && $(TYPE:s/+//) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | patch --binary $(PATCHFLAGS) -p2 && $(TOUCH) $(PATCH_FLAG_FILE) .ELSE # "$(GUI)"=="WNT" .IF "$(BSCLIENT)"=="TRUE" $(COMMAND_ECHO)cd $(PACKAGE_DIR) && $(TYPE) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) -f $(PATCHFLAGS) -p2 && $(TOUCH) $(PATCH_FLAG_FILE) .ELSE # "$(BSCLIENT)"!="" - $(COMMAND_ECHO)cd $(PACKAGE_DIR) && $(TYPE) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) $(PATCHFLAGS) -p2 && $(TOUCH) $(PATCH_FLAG_FILE) + $(COMMAND_ECHO)cd $(PACKAGE_DIR) && $(TYPE) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) --binary $(PATCHFLAGS) -p2 && $(TOUCH) $(PATCH_FLAG_FILE) .ENDIF # "$(BSCLIENT)"!="" .ENDIF # "$(GUI)"=="WNT" .ENDIF # "$(PATCH_FILES)"=="none" || "$(PATCH_FILES)"=="" @@ -309,18 +303,12 @@ $(MISC)/$(TARFILE_ROOTDIR).done : $(MISC)/$(TARFILE_MD5)-$(TARFILE_NAME).unpack $(CONVERT) unix $(foreach,i,$(CONVERTFILES) $(MISC)/$(TARFILE_ROOTDIR)/$i) .ENDIF # "$(CONVERTFILES)"!="" .IF "$(GUI)"=="WNT" -# hack to make 4nt version 4,01 work and still get propper -# errorcodes for versions < 3,00 -#.IF "$(my4ver:s/.//:s/,//)" >= "300" -# $(COMMAND_ECHO)cd $(MISC) && ( $(TYPE:s/+//) $(BACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | tr -d "\015" | patch $(PATCHFLAGS) -p2 ) -#.ELSE # "$(my4ver:s/.//:s/,//)" >= "300" - $(COMMAND_ECHO)cd $(MISC) && $(TYPE:s/+//) $(MBACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | tr -d "\015" | patch $(PATCHFLAGS) -p2 -#.ENDIF # "$(my4ver:s/.//:s/,//)" >= "300" + $(COMMAND_ECHO)cd $(MISC) && $(TYPE:s/+//) $(MBACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | patch --binary $(PATCHFLAGS) -p2 .ELSE # "$(GUI)"=="WNT" .IF "$(BSCLIENT)"=="TRUE" $(COMMAND_ECHO)cd $(MISC) && $(TYPE) $(MBACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) -f $(PATCHFLAGS) -p2 .ELSE # "$(BSCLIENT)"!="" - $(COMMAND_ECHO)cd $(MISC) && $(TYPE) $(MBACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) $(PATCHFLAGS) -p2 + $(COMMAND_ECHO)cd $(MISC) && $(TYPE) $(MBACK_PATH)$(PATH_IN_MODULE)/{$(PATCH_FILES)} | $(GNUPATCH) --binary $(PATCHFLAGS) -p2 .ENDIF # "$(BSCLIENT)"!="" .ENDIF # "$(GUI)"=="WNT" .IF "$(CONVERTFILES)"!="" diff --git a/solenv/inc/tg_moz.mk b/solenv/inc/tg_moz.mk deleted file mode 100644 index 312534bc1f13..000000000000 --- a/solenv/inc/tg_moz.mk +++ /dev/null @@ -1,85 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - - -.IF "$(EXPORTS)"!="" -EXPORT_HEADER=export_mozilla_header -.ENDIF - -.IF "$(XPIDLSRCS)"!="" -XPIDL_TYPELIB_MODULE=$(MISC)/$(XPIDL_MODULE).xpt -XPIDLHDR:=$(XPIDLSRCS:s/.idl/.h/) -XPIDLXPT:=$(XPIDLSRCS:s/.idl/.xpt/) -EXTRA_MOZ_TARGET+= $(foreach,i,$(XPIDLHDR) $(INCCOM)/$i) -EXTRA_MOZ_TARGET+= $(foreach,i,$(XPIDLXPT) $(MISC)/$i) - -EXTRA_MOZ_TARGET+= $(XPIDL_TYPELIB_MODULE) -.ENDIF - -ALLMOZ:=$(EXTRA_MOZ_TARGET) $(DO_XPIDL) $(GEN_PRCPUCFG) $(EXPORT_HEADER) - -$(INCCOM)/%.h : %.idl - $(COMMAND_ECHO)$(COPY) $< $(INCCOM) - $(COMMAND_ECHO)$(XPIDL) -m header -w -I $(SOLARIDLDIR)/mozilla -I$(INCCOM) -I . -o $(INCCOM)/$* $< - -$(MISC)/%.xpt : %.idl - $(COMMAND_ECHO)$(XPIDL) -m typelib -w -I $(SOLARIDLDIR)/mozilla -I$(INCCOM) -I . -o $(MISC)/$* $< - -.INCLUDE : target.mk - -.IF "$(GUI)"=="WNT" -CPUCFG=_winnt.cfg -.ENDIF - -.IF "$(OS)"=="SOLARIS" -CPUCFG=_solaris32.cfg -.ENDIF - -.IF "$(OS)"=="LINUX" -CPUCFG=_linux.cfg -.ENDIF - -.IF "$(OS)"=="FREEBSD" -CPUCFG=_freebsd.cfg -.ENDIF - -.IF "$(OS)"=="NETBSD" -CPUCFG=_netbsd.cfg -.ENDIF - -.IF "$(GEN_PRCPUCFG)"!="" -$(GEN_PRCPUCFG): $(PRJ)/pr/include/md/$(CPUCFG) - @$(COPY) $(PRJ)/pr/include/md/$(CPUCFG) $@ -.ENDIF - -.IF "$(EXPORTS)"!="" -$(EXPORT_HEADER): - @$(COPY) $(EXPORTS) $(INCCOM) -.ENDIF - -.IF "$(XPIDLSRCS)"!="" -$(XPIDL_TYPELIB_MODULE): $(foreach,i,$(XPIDLXPT) $(MISC)/$i) - $(COMMAND_ECHO)$(XPIDL_LINK) $(MISC)/$(XPIDL_MODULE).xpt $^ - @-mkdir $(BIN)/components - @$(COPY) $@ $(BIN)/components -.ENDIF diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 872d6e9e1997..2e4bf396d4d9 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -198,7 +198,7 @@ sal_Bool StgHeader::Check() && nTOCstrm >= 0 && nThreshold > 0 && ( nDataFAT == STG_EOF || ( nDataFAT >= 0 && nDataFATSize > 0 ) ) - && ( nMasterChain == STG_EOF || ( nMasterChain >=0 && nMaster > 0 ) ) + && ( nMasterChain == STG_FREE || nMasterChain == STG_EOF || ( nMasterChain >=0 && nMaster > 0 ) ) && nMaster >= 0; } @@ -438,7 +438,7 @@ sal_Bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize ) n = ( n >> 1 ) - 1; if ( n > 31 || (nSize < 0 && cType != STG_STORAGE) || - ( nPage1 < 0 && nPage1 != STG_EOF ) ) + ( nPage1 < 0 && nPage1 != STG_FREE && nPage1 != STG_EOF ) ) { // the size makes no sence for the substorage // TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 38420a29dd3b..326ed7ba95f1 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -29,6 +29,7 @@ #include <osl/file.hxx> #include <tools/tempfile.hxx> #include <tools/debug.hxx> +#include <set> #include "sot/stg.hxx" #include "stgelem.hxx" @@ -768,14 +769,26 @@ void StgDataStrm::Init( sal_Int32 nBgn, sal_Int32 nLen ) // determine the actual size of the stream by scanning // the FAT chain and counting the # of pages allocated nSize = 0; - sal_Int32 nOldBgn = -1; - while( nBgn >= 0 && nBgn != nOldBgn ) + + // there may be files with double page numbers or loops of page + // references. This is not allowed. To be able to track this and + // to exit with an error, track already scanned PageNumbers here + // and use them to see if an already counted page is re-visited + std::set< sal_Int32 > nUsedPageNumbers; + + while(nBgn >= 0) { - nOldBgn = nBgn; - nBgn = pFat->GetNextPage( nBgn ); - if( nBgn == nOldBgn ) - rIo.SetError( ERRCODE_IO_WRONGFORMAT ); - nSize += nPageSize; + if(nUsedPageNumbers.find(nBgn) == nUsedPageNumbers.end()) + { + nUsedPageNumbers.insert(nBgn); + nSize += nPageSize; + nBgn = pFat->GetNextPage(nBgn); + } + else + { + rIo.SetError(ERRCODE_IO_WRONGFORMAT); + nBgn = -1; + } } } } diff --git a/stlport/systemstl/slist b/stlport/systemstl/slist index 260983d7af4a..10e55ef000ae 100644 --- a/stlport/systemstl/slist +++ b/stlport/systemstl/slist @@ -62,9 +62,11 @@ public: typedef typename STLP4_SLIST_EMUBASE<T,A> _super; typedef typename _super::iterator slist_mit; typedef typename _super::const_iterator slist_cit; -#ifndef STLP4_SLIST_WITH_LIST - slist_mit insert( slist_cit aI, const T& rT) { return _super::insert_after( aI, rT); } -#endif + +private: // prevent the use of methods not available in forward_list + // signatures are intentionally mismatched to catch invocations + size_t size() const; + void insert( void) const; }; } diff --git a/svgio/inc/svgio/svgreader/svgmarkernode.hxx b/svgio/inc/svgio/svgreader/svgmarkernode.hxx index b5562f70df44..ca8868156f05 100644 --- a/svgio/inc/svgio/svgreader/svgmarkernode.hxx +++ b/svgio/inc/svgio/svgreader/svgmarkernode.hxx @@ -74,7 +74,7 @@ namespace svgio const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const; /// InfoProvider support for % values - virtual const basegfx::B2DRange* getCurrentViewPort() const; + virtual const basegfx::B2DRange getCurrentViewPort() const; /// viewBox content const basegfx::B2DRange* getViewBox() const { return mpViewBox; } diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx index 2711405f60f1..7142febe9ec6 100644 --- a/svgio/inc/svgio/svgreader/svgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgnode.hxx @@ -137,7 +137,7 @@ namespace svgio const SvgNodeVector& getChildren() const { return maChildren; } /// InfoProvider support for %, em and ex values - virtual const basegfx::B2DRange* getCurrentViewPort() const; + virtual const basegfx::B2DRange getCurrentViewPort() const; virtual double getCurrentFontSize() const; virtual double getCurrentXHeight() const; diff --git a/svgio/inc/svgio/svgreader/svgpathnode.hxx b/svgio/inc/svgio/svgreader/svgpathnode.hxx index 73811b13f880..dac4fea9ae24 100644 --- a/svgio/inc/svgio/svgreader/svgpathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpathnode.hxx @@ -25,6 +25,7 @@ #include <svgio/svgiodllapi.h> #include <svgio/svgreader/svgnode.hxx> #include <svgio/svgreader/svgstyleattributes.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -36,12 +37,13 @@ namespace svgio { private: /// use styles - SvgStyleAttributes maSvgStyleAttributes; + SvgStyleAttributes maSvgStyleAttributes; /// variable scan values, dependent of given XAttributeList - basegfx::B2DPolyPolygon* mpPolyPolygon; - basegfx::B2DHomMatrix* mpaTransform; - SvgNumber maPathLength; + basegfx::B2DPolyPolygon* mpPolyPolygon; + basegfx::B2DHomMatrix* mpaTransform; + SvgNumber maPathLength; + basegfx::tools::PointIndexSet maHelpPointIndices; public: SvgPathNode( diff --git a/svgio/inc/svgio/svgreader/svgpatternnode.hxx b/svgio/inc/svgio/svgreader/svgpatternnode.hxx index faf0994a81dd..384116695f74 100644 --- a/svgio/inc/svgio/svgreader/svgpatternnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpatternnode.hxx @@ -77,7 +77,7 @@ namespace svgio const drawinglayer::primitive2d::Primitive2DSequence& getPatternPrimitives() const; /// InfoProvider support for % values - virtual const basegfx::B2DRange* getCurrentViewPort() const; + virtual const basegfx::B2DRange getCurrentViewPort() const; /// viewBox content const basegfx::B2DRange* getViewBox() const; diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx index 7b3cbef9b4a8..5c46c599167b 100644 --- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx +++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx @@ -26,6 +26,7 @@ #include <svgio/svgreader/svgpaint.hxx> #include <svgio/svgreader/svgnode.hxx> #include <vcl/vclenum.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -251,17 +252,10 @@ namespace svgio basegfx::B2DHomMatrix& rMarkerTransform, basegfx::B2DRange& rClipRange, const SvgMarkerNode& rMarker) const; - void add_singleMarker( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - const drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, - const basegfx::B2DHomMatrix& rMarkerTransform, - const basegfx::B2DRange& rClipRange, - const SvgMarkerNode& rMarker, - const basegfx::B2DPolygon& rCandidate, - const sal_uInt32 nIndex) const; void add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const; + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const; public: /// local attribute scanner @@ -273,7 +267,8 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence& rSource) const; void add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const; + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const; void add_postProcess( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::Primitive2DSequence& rSource, diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx b/svgio/inc/svgio/svgreader/svgsvgnode.hxx index a72fcf7ad243..38b7c2d8c2ac 100644 --- a/svgio/inc/svgio/svgreader/svgsvgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx @@ -56,8 +56,16 @@ namespace svgio virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent); virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const; - /// InfoProvider support for % values - virtual const basegfx::B2DRange* getCurrentViewPort() const; + /// Seeks width and height of viewport, which is current before the new viewport is set. + // needed for percentage unit in x, y, width or height + virtual void seekReferenceWidth(double& fWidth, bool& bHasFound) const; + virtual void seekReferenceHeight(double& fHeight, bool& bHasFound) const; + + /// InfoProvider support for % values in childs + // The returned 'CurrentViewPort' is the viewport as it is set by this svg element + // and as it is needed to resolve relative values in childs + // The method does not check for invalid width and height + virtual const basegfx::B2DRange getCurrentViewPort() const; /// viewBox content const basegfx::B2DRange* getViewBox() const { return mpViewBox; } diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx b/svgio/inc/svgio/svgreader/svgtools.hxx index 3933d3b41335..c7b0dca976f5 100644 --- a/svgio/inc/svgio/svgreader/svgtools.hxx +++ b/svgio/inc/svgio/svgreader/svgtools.hxx @@ -40,6 +40,9 @@ namespace svgio void myAssert(const rtl::OUString& rMessage); #endif +// recommended value for this devise dependend unit, see CSS2 section 4.3.2 Lenghts +#define F_SVG_PIXEL_PER_INCH 90.0 + // common non-token strings struct commonStrings { @@ -65,7 +68,7 @@ namespace svgio class InfoProvider { public: - virtual const basegfx::B2DRange* getCurrentViewPort() const = 0; + virtual const basegfx::B2DRange getCurrentViewPort() const = 0; virtual double getCurrentFontSize() const = 0; virtual double getCurrentXHeight() const = 0; }; @@ -126,7 +129,12 @@ namespace svgio bool isPositive() const; + // Only usable in cases, when the unit is not Unit_percent, otherwise use method solve + double solveNonPercentage(const InfoProvider& rInfoProvider) const; + double solve(const InfoProvider& rInfoProvider, NumberType aNumberType = length) const; + + }; typedef ::std::vector< SvgNumber > SvgNumberVector; diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx index e13c15040ff6..77d13eb18c99 100644 --- a/svgio/source/svgreader/svgcirclenode.cxx +++ b/svgio/source/svgreader/svgcirclenode.cxx @@ -128,7 +128,7 @@ namespace svgio if(pStyle && getR().isSet()) { - const double fR(getR().solve(*this, xcoordinate)); + const double fR(getR().solve(*this, length)); if(fR > 0.0) { @@ -141,7 +141,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx index b5a3b6c787ab..187045ac03e3 100644 --- a/svgio/source/svgreader/svgellipsenode.cxx +++ b/svgio/source/svgreader/svgellipsenode.cxx @@ -156,7 +156,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx index 4a8c77ecf1c7..77f2eb835356 100644 --- a/svgio/source/svgreader/svglinenode.cxx +++ b/svgio/source/svgreader/svglinenode.cxx @@ -152,7 +152,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx index d10f8e004338..8cc7e6cee008 100644 --- a/svgio/source/svgreader/svgmarkernode.cxx +++ b/svgio/source/svgreader/svgmarkernode.cxx @@ -196,11 +196,11 @@ namespace svgio return aPrimitives; } - const basegfx::B2DRange* SvgMarkerNode::getCurrentViewPort() const + const basegfx::B2DRange SvgMarkerNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } else { diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx index 9cc726e364d0..26e28f5e42a1 100644 --- a/svgio/source/svgreader/svgmasknode.cxx +++ b/svgio/source/svgreader/svgmasknode.cxx @@ -266,10 +266,8 @@ namespace svgio const drawinglayer::primitive2d::Primitive2DReference xInverseMask( new drawinglayer::primitive2d::ModifiedColorPrimitive2D( aMaskTarget, - basegfx::BColorModifier( - basegfx::BColor(0.0, 0.0, 0.0), - 0.5, - basegfx::BCOLORMODIFYMODE_LUMINANCE_TO_ALPHA))); + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_luminance_to_alpha()))); aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xInverseMask, 1); } diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index db5cb570a58f..f73b008765e9 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -112,14 +112,12 @@ namespace svgio } } - if(maCssStyleVector.empty()) + if(!maCssStyleVector.empty()) { - return &rOriginal; - } - else - { - // set CssStyleParent at maCssStyleVector members to hang them in front of - // the existing style. Build a style chain, reset parent of original for security. + // #123510# if CSS styles were found, create a linked list with rOriginal as parent + // and all CSS styles as linked children, so that the style attribute has + // priority over the CSS style. If there is no style attribute this means that + // no values are set at rOriginal, thus it is still correct to have that order. // Repeated style requests should only be issued from sub-Text nodes and I'm not // sure if in-between text nodes may build other chains (should not happen). But // it's only a re-chaining with pointers (cheap), so allow to do it every time. @@ -128,14 +126,15 @@ namespace svgio for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++) { - SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]); + SvgStyleAttributes* pNext = const_cast< SvgStyleAttributes* >(maCssStyleVector[a]); - pCandidate->setCssStyleParent(pCurrent); - pCurrent = pCandidate; + pCurrent->setCssStyleParent(pNext); + pCurrent = pNext; + pCurrent->setCssStyleParent(0); } - - return pCurrent; } + + return &rOriginal; } SvgNode::SvgNode( @@ -485,7 +484,7 @@ namespace svgio } } - const basegfx::B2DRange* SvgNode::getCurrentViewPort() const + const basegfx::B2DRange SvgNode::getCurrentViewPort() const { if(getParent()) { @@ -493,7 +492,7 @@ namespace svgio } else { - return 0; + return basegfx::B2DRange(); // return empty B2DRange } } diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx index b54d41ced1c2..08b10d735a94 100644 --- a/svgio/source/svgreader/svgpathnode.cxx +++ b/svgio/source/svgreader/svgpathnode.cxx @@ -75,7 +75,7 @@ namespace svgio { basegfx::B2DPolyPolygon aPath; - if(basegfx::tools::importFromSvgD(aPath, aContent)) + if(basegfx::tools::importFromSvgD(aPath, aContent, false, &maHelpPointIndices)) { if(aPath.count()) { @@ -120,7 +120,7 @@ namespace svgio { drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(*getPath(), aNewTarget); + pStyle->add_path(*getPath(), aNewTarget, &maHelpPointIndices); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx index feac0e2c5d60..c3db7613c5da 100644 --- a/svgio/source/svgreader/svgpatternnode.cxx +++ b/svgio/source/svgreader/svgpatternnode.cxx @@ -293,11 +293,11 @@ namespace svgio return aPrimitives; } - const basegfx::B2DRange* SvgPatternNode::getCurrentViewPort() const + const basegfx::B2DRange SvgPatternNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } else { diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index deb2ae07a944..540d2bae0093 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -25,6 +25,7 @@ #include <svgio/svgreader/svgpolynode.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -117,7 +118,7 @@ namespace svgio { drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(*getPolygon()), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(*getPolygon()), aNewTarget, 0); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx index c1a5dcbb0dc8..656e22aa6280 100644 --- a/svgio/source/svgreader/svgrectnode.cxx +++ b/svgio/source/svgreader/svgrectnode.cxx @@ -213,7 +213,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 795b8bcb9767..2dc7f4c43637 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -746,59 +746,6 @@ namespace svgio } } - double get_markerRotation( - const SvgMarkerNode& rMarker, - const basegfx::B2DPolygon& rPolygon, - const sal_uInt32 nIndex) - { - double fAngle(0.0); - const sal_uInt32 nPointCount(rPolygon.count()); - - if(nPointCount) - { - if(rMarker.getOrientAuto()) - { - const bool bPrev(rPolygon.isClosed() || nIndex > 0); - basegfx::B2DCubicBezier aSegment; - basegfx::B2DVector aPrev; - basegfx::B2DVector aNext; - - if(bPrev) - { - rPolygon.getBezierSegment((nIndex - 1) % nPointCount, aSegment); - aPrev = aSegment.getTangent(1.0); - } - - const bool bNext(rPolygon.isClosed() || nIndex + 1 < nPointCount); - - if(bNext) - { - rPolygon.getBezierSegment(nIndex % nPointCount, aSegment); - aNext = aSegment.getTangent(0.0); - } - - if(bPrev && bNext) - { - fAngle = atan2(aPrev.getY() + aNext.getY(), aPrev.getX() + aNext.getX()); - } - else if(bPrev) - { - fAngle = atan2(aPrev.getY(), aPrev.getX()); - } - else if(bNext) - { - fAngle = atan2(aNext.getY(), aNext.getX()); - } - } - else - { - fAngle = rMarker.getAngle(); - } - } - - return fAngle; - } - bool SvgStyleAttributes::prepare_singleMarker( drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, basegfx::B2DHomMatrix& rMarkerTransform, @@ -889,52 +836,10 @@ namespace svgio return false; } - void SvgStyleAttributes::add_singleMarker( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - const drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, - const basegfx::B2DHomMatrix& rMarkerTransform, - const basegfx::B2DRange& rClipRange, - const SvgMarkerNode& rMarker, - const basegfx::B2DPolygon& rCandidate, - const sal_uInt32 nIndex) const - { - const sal_uInt32 nPointCount(rCandidate.count()); - - if(nPointCount) - { - // get and apply rotation - basegfx::B2DHomMatrix aCombinedTransform(rMarkerTransform); - aCombinedTransform.rotate(get_markerRotation(rMarker, rCandidate, nIndex)); - - // get and apply target position - const basegfx::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex % nPointCount)); - aCombinedTransform.translate(aPoint.getX(), aPoint.getY()); - - // prepare marker - drawinglayer::primitive2d::Primitive2DReference xMarker( - new drawinglayer::primitive2d::TransformPrimitive2D( - aCombinedTransform, - rMarkerPrimitives)); - - if(!rClipRange.isEmpty()) - { - // marker needs to be clipped, it's bigger as the mapping - basegfx::B2DPolyPolygon aClipPolygon(basegfx::tools::createPolygonFromRect(rClipRange)); - - aClipPolygon.transform(aCombinedTransform); - xMarker = new drawinglayer::primitive2d::MaskPrimitive2D( - aClipPolygon, - drawinglayer::primitive2d::Primitive2DSequence(&xMarker, 1)); - } - - // add marker - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMarker); - } - } - void SvgStyleAttributes::add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const { // try to access linked markers const SvgMarkerNode* pStart = accessMarkerStartXLink(); @@ -943,49 +848,170 @@ namespace svgio if(pStart || pMid || pEnd) { - const sal_uInt32 nCount(rPath.count()); + const sal_uInt32 nSubPathCount(rPath.count()); - for (sal_uInt32 a(0); a < nCount; a++) + if(nSubPathCount) { - const basegfx::B2DPolygon aCandidate(rPath.getB2DPolygon(a)); - const sal_uInt32 nPointCount(aCandidate.count()); + // remember prepared marker; pStart, pMid and pEnd may all be equal when + // only 'marker' was used instead of 'marker-start', 'marker-mid' or 'marker-end', + // see 'case SVGTokenMarker' in this file; thus in this case only one common + // marker in primitive form will be prepared + const SvgMarkerNode* pPrepared = 0; + + // values for the prepared marker, results of prepare_singleMarker + drawinglayer::primitive2d::Primitive2DSequence aPreparedMarkerPrimitives; + basegfx::B2DHomMatrix aPreparedMarkerTransform; + basegfx::B2DRange aPreparedMarkerClipRange; - if(nPointCount) + for (sal_uInt32 a(0); a < nSubPathCount; a++) { - const sal_uInt32 nMarkerCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount); - drawinglayer::primitive2d::Primitive2DSequence aMarkerPrimitives; - basegfx::B2DHomMatrix aMarkerTransform; - basegfx::B2DRange aClipRange; - const SvgMarkerNode* pPrepared = 0; + // iterate over sub-paths + const basegfx::B2DPolygon aSubPolygonPath(rPath.getB2DPolygon(a)); + const sal_uInt32 nSubPolygonPointCount(aSubPolygonPath.count()); + const bool bSubPolygonPathIsClosed(aSubPolygonPath.isClosed()); - if(pStart) + if(nSubPolygonPointCount) { - if(prepare_singleMarker(aMarkerPrimitives, aMarkerTransform, aClipRange, *pStart)) - { - pPrepared = pStart; - add_singleMarker(rTarget, aMarkerPrimitives, aMarkerTransform, aClipRange, *pPrepared, aCandidate, 0); - } - } + // for each sub-path, create one marker per point (when closed, two markers + // need to pe created for the 1st point) + const sal_uInt32 nTargetMarkerCount(bSubPolygonPathIsClosed ? nSubPolygonPointCount + 1 : nSubPolygonPointCount); - if(pMid && nMarkerCount > 2) - { - if(pMid == pPrepared || prepare_singleMarker(aMarkerPrimitives, aMarkerTransform, aClipRange, *pMid)) + for (sal_uInt32 b(0); b < nTargetMarkerCount; b++) { - pPrepared = pMid; + const bool bIsFirstMarker(!a && !b); + const bool bIsLastMarker(nSubPathCount - 1 == a && nTargetMarkerCount - 1 == b); + const SvgMarkerNode* pNeeded = 0; - for(sal_uInt32 b(1); b < nMarkerCount - 1; b++) + if(bIsFirstMarker) { - add_singleMarker(rTarget, aMarkerPrimitives, aMarkerTransform, aClipRange, *pPrepared, aCandidate, b); + // 1st point in 1st sub-polygon, use pStart + pNeeded = pStart; + } + else if(bIsLastMarker) + { + // last point in last sub-polygon, use pEnd + pNeeded = pEnd; + } + else + { + // anything in-between, use pMid + pNeeded = pMid; } - } - } - if(pEnd) - { - if(pEnd == pPrepared || prepare_singleMarker(aMarkerPrimitives, aMarkerTransform, aClipRange, *pEnd)) - { - pPrepared = pEnd; - add_singleMarker(rTarget, aMarkerPrimitives, aMarkerTransform, aClipRange, *pPrepared, aCandidate, nMarkerCount - 1); + if(pHelpPointIndices && !pHelpPointIndices->empty()) + { + const basegfx::tools::PointIndexSet::const_iterator aFound( + pHelpPointIndices->find(basegfx::tools::PointIndex(a, b))); + + if(aFound != pHelpPointIndices->end()) + { + // this point is a pure helper point; do not create a marker for it + continue; + } + } + + if(!pNeeded) + { + // no marker needs to be created for this point + continue; + } + + if(pPrepared != pNeeded) + { + // if needed marker is not yet prepared, do it now + if(prepare_singleMarker(aPreparedMarkerPrimitives, aPreparedMarkerTransform, aPreparedMarkerClipRange, *pNeeded)) + { + pPrepared = pNeeded; + } + else + { + // error: could not prepare given marker + OSL_ENSURE(false, "OOps, could not prepare given marker as primitives (!)"); + pPrepared = 0; + continue; + } + } + + // prepare complete transform + basegfx::B2DHomMatrix aCombinedTransform(aPreparedMarkerTransform); + + // get rotation + if(pPrepared->getOrientAuto()) + { + const sal_uInt32 nPointIndex(b % nSubPolygonPointCount); + + // get entering and leaving tangents; this will search backward/froward + // in the polygon to find tangents unequal to zero, skipping empty edges + // see basegfx descriptions) + // Hint: Mozilla, Inkscape and others use only leaving tangent for start marker + // and entering tangent for end marker. To achieve this (if wanted) it is possibe + // to make the fetch of aEntering/aLeaving dependent on bIsFirstMarker/bIsLastMarker. + // This is not done here, see comment 14 in task #1232379# + // or http://www.w3.org/TR/SVG/painting.html#OrientAttribute + basegfx::B2DVector aEntering( + basegfx::tools::getTangentEnteringPoint( + aSubPolygonPath, + nPointIndex)); + basegfx::B2DVector aLeaving( + basegfx::tools::getTangentLeavingPoint( + aSubPolygonPath, + nPointIndex)); + const bool bEntering(!aEntering.equalZero()); + const bool bLeaving(!aLeaving.equalZero()); + + if(bEntering || bLeaving) + { + basegfx::B2DVector aSum(0.0, 0.0); + + if(bEntering) + { + aSum += aEntering.normalize(); + } + + if(bLeaving) + { + aSum += aLeaving.normalize(); + } + + if(!aSum.equalZero()) + { + const double fAngle(atan2(aSum.getY(), aSum.getX())); + + // apply rotation + aCombinedTransform.rotate(fAngle); + } + } + } + else + { + // apply rotation + aCombinedTransform.rotate(pPrepared->getAngle()); + } + + // get and apply target position + const basegfx::B2DPoint aPoint(aSubPolygonPath.getB2DPoint(b % nSubPolygonPointCount)); + + aCombinedTransform.translate(aPoint.getX(), aPoint.getY()); + + // prepare marker + drawinglayer::primitive2d::Primitive2DReference xMarker( + new drawinglayer::primitive2d::TransformPrimitive2D( + aCombinedTransform, + aPreparedMarkerPrimitives)); + + if(!aPreparedMarkerClipRange.isEmpty()) + { + // marker needs to be clipped, it's bigger as the mapping + basegfx::B2DPolyPolygon aClipPolygon(basegfx::tools::createPolygonFromRect(aPreparedMarkerClipRange)); + + aClipPolygon.transform(aCombinedTransform); + xMarker = new drawinglayer::primitive2d::MaskPrimitive2D( + aClipPolygon, + drawinglayer::primitive2d::Primitive2DSequence(&xMarker, 1)); + } + + // add marker + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMarker); } } } @@ -995,7 +1021,8 @@ namespace svgio void SvgStyleAttributes::add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const { if(!rPath.count()) { @@ -1053,7 +1080,7 @@ namespace svgio SVGTokenLine == mrOwner.getType()) // line { // try to add markers - add_markers(rPath, rTarget); + add_markers(rPath, rTarget, pHelpPointIndices); } } diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 95b15fb169c0..fc613db500e6 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -162,6 +162,91 @@ namespace svgio } } + void SvgSvgNode::seekReferenceWidth(double& fWidth, bool& bHasFound) const + { + if (!getParent() || bHasFound) + { + return; + } + const SvgSvgNode* pParentSvgSvgNode = 0; + // enclosing svg might have relative width, need to cumulate them till they are + // resolved somewhere up in the node tree + double fPercentage(1.0); + for(const SvgNode* pParent = getParent(); pParent && !bHasFound; pParent = pParent->getParent()) + { + // dynamic_cast results Null-pointer for not SvgSvgNode and so skips them in if condition + pParentSvgSvgNode = dynamic_cast< const SvgSvgNode* >(pParent); + if (pParentSvgSvgNode) + { + if (pParentSvgSvgNode->getViewBox()) + { + // viewbox values are already in 'user unit'. + fWidth = pParentSvgSvgNode->getViewBox()->getWidth() * fPercentage; + bHasFound = true; + } + else + { + // take absolute value or cummulate percentage + if (pParentSvgSvgNode->getWidth().isSet()) + { + if (Unit_percent == pParentSvgSvgNode->getWidth().getUnit()) + { + fPercentage *= pParentSvgSvgNode->getWidth().getNumber() * 0.01; + } + else + { + fWidth = pParentSvgSvgNode->getWidth().solveNonPercentage(*pParentSvgSvgNode) * fPercentage; + bHasFound = true; + } + } // not set => width=100% => factor 1, no need for else + } + } + } + } + + void SvgSvgNode::seekReferenceHeight(double& fHeight, bool& bHasFound) const + { + if (!getParent() || bHasFound) + { + return; + } + const SvgSvgNode* pParentSvgSvgNode = 0; + // enclosing svg might have relative width and height, need to cumulate them till they are + // resolved somewhere up in the node tree + double fPercentage(1.0); + for(const SvgNode* pParent = getParent(); pParent && !bHasFound; pParent = pParent->getParent()) + { + // dynamic_cast results Null-pointer for not SvgSvgNode and so skips them in if condition + pParentSvgSvgNode = dynamic_cast< const SvgSvgNode* >(pParent); + if (pParentSvgSvgNode) + { + if (pParentSvgSvgNode->getViewBox()) + { + // viewbox values are already in 'user unit'. + fHeight = pParentSvgSvgNode->getViewBox()->getHeight() * fPercentage; + bHasFound = true; + } + else + { + // take absolute value or cummulate percentage + if (pParentSvgSvgNode->getHeight().isSet()) + { + if (Unit_percent == pParentSvgSvgNode->getHeight().getUnit()) + { + fPercentage *= pParentSvgSvgNode->getHeight().getNumber() * 0.01; + } + else + { + fHeight = pParentSvgSvgNode->getHeight().solveNonPercentage(*pParentSvgSvgNode) * fPercentage; + bHasFound = true; + } + } // not set => height=100% => factor 1, no need for else + } + } + } + } + +// ToDo: Consider attribute overflow in method decomposeSvgNode void SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const { drawinglayer::primitive2d::Primitive2DSequence aSequence; @@ -173,13 +258,7 @@ namespace svgio { if(getParent()) { - const bool bWidthIsRelative(!getWidth().isSet() || Unit_percent == getWidth().getUnit()); - const bool bHeightIsRelative(!getWidth().isSet() || Unit_percent == getWidth().getUnit()); - const SvgSvgNode* pParentSvgSvgNode = 0; - double fW(0.0); - double fH(0.0); - - // #122594# if width/height is not given, it's 100% (see 5.1.2 The svg element in SVG1.1 spec). + // #122594# if width/height is not given, it's 100% (see 5.1.2 The 'svg' element in SVG1.1 spec). // If it is relative, the question is to what. The previous implementatin assumed relative to the // local ViewBox which is implied by (4.2 Basic data types): // @@ -190,56 +269,92 @@ namespace svgio // units in general), and (b) when a percentage length value represents a percentage of the // bounding box width or height on a given object (refer to the section that describes object // bounding box units)." - // - // This is not closer specified for the SVG element itself as non-outmost element, but comparisons - // with common browsers shows that it's mostly interpreted relative to the viewBox of the parent. - // Adding code to search the parent SVG element and calculating width/height relative to it's - // viewBox width/height (and no longer to the local viewBox). - if(bWidthIsRelative || bHeightIsRelative) + + // Comparisons with commom browsers show, that it's mostly interpreted relative to the viewport + // of the parent, and so does the new implementation. + + // Extract known viewport data + // bXXXIsAbsolute tracks whether relative values could be resolved to absolute values + + // If width or height is not provided, the default 100% is used, see SVG 1.1 section 5.1.2 + // value 0.0 here is only to initialize variable + bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); + double fW( bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : 0.0); + + bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); + double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : 0.0); + + // If x or y not provided, then default 0.0 is used, see SVG 1.1 Section 5.1.2 + bool bXIsAbsolute((getX().isSet() && Unit_percent != getX().getUnit()) || !getX().isSet()); + double fX( bXIsAbsolute && getX().isSet() ? getX().solveNonPercentage(*this) : 0.0); + + bool bYIsAbsolute((getY().isSet() && Unit_percent != getY().getUnit()) || !getY().isSet()); + double fY( bYIsAbsolute && getY().isSet() ? getY().solveNonPercentage(*this) : 0.0); + + if ( !bXIsAbsolute || !bWidthIsAbsolute) { - for(const SvgNode* pParent = getParent(); pParent && !pParentSvgSvgNode; pParent = pParent->getParent()) + // get width of enclosing svg and resolve percentage in x and width; + double fWReference(0.0); + bool bHasFoundWidth(false); + seekReferenceWidth(fWReference, bHasFoundWidth); + if (!bHasFoundWidth) { - pParentSvgSvgNode = dynamic_cast< const SvgSvgNode* >(pParent); + // Even outermost svg has not all information to resolve relative values, + // I use content itself as fallback to set missing values for viewport + // Any better idea for such ill structures svg documents? + const basegfx::B2DRange aChildRange( + drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( + aSequence, + drawinglayer::geometry::ViewInformation2D())); + fWReference = aChildRange.getWidth(); } - } - - if(bWidthIsRelative) - { - fW = getWidth().isSet() ? getWidth().getNumber() * 0.01 : 1.0; - - if(pParentSvgSvgNode) + // referenced values are already in 'user unit' + if (!bXIsAbsolute) { - fW *= pParentSvgSvgNode->getViewBox()->getWidth(); + fX = getX().getNumber() * 0.01 * fWReference; + } + if (!bWidthIsAbsolute) + { + fW = (getWidth().isSet() ? getWidth().getNumber() *0.01 : 1.0) * fWReference; } - } - else - { - fW = getWidth().solve(*this, xcoordinate); } - if(bHeightIsRelative) + if ( !bYIsAbsolute || !bHeightIsAbsolute) { - fH = getHeight().isSet() ? getHeight().getNumber() * 0.01 : 1.0; + // get height of enclosing svg and resolve percentage in y and height + double fHReference(0.0); + bool bHasFoundHeight(false); + seekReferenceHeight(fHReference, bHasFoundHeight); + if (!bHasFoundHeight) + { + // Even outermost svg has not all information to resolve relative values, + // I use content itself as fallback to set missing values for viewport + // Any better idea for such ill structures svg documents? + const basegfx::B2DRange aChildRange( + drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( + aSequence, + drawinglayer::geometry::ViewInformation2D())); + fHReference = aChildRange.getHeight(); + } - if(pParentSvgSvgNode) + // referenced values are already in 'user unit' + if (!bYIsAbsolute) { - fH *= pParentSvgSvgNode->getViewBox()->getHeight(); + fY = getY().getNumber() * 0.01 * fHReference; + } + if (!bHeightIsAbsolute) + { + fH = (getHeight().isSet() ? getHeight().getNumber() *0.01 : 1.0) * fHReference; } - } - else - { - fH = getHeight().solve(*this, ycoordinate); } if(getViewBox()) { - // Svg defines that with no width or no height the viewBox content is empty, - // so both need to exist - if(!basegfx::fTools::equalZero(getViewBox()->getWidth()) && !basegfx::fTools::equalZero(getViewBox()->getHeight())) + // SVG 1.1 defines in section 7.7 that a negative value for width or height + // in viewBox is an error and that 0.0 disables rendering + if(basegfx::fTools::more(getViewBox()->getWidth(),0.0) && basegfx::fTools::more(getViewBox()->getHeight(),0.0)) { - // create target range homing x,y, width and height as given - const double fX(getX().isSet() ? getX().solve(*this, xcoordinate) : 0.0); - const double fY(getY().isSet() ? getY().solve(*this, ycoordinate) : 0.0); + // create target range homing x,y, width and height as calculated above const basegfx::B2DRange aTarget(fX, fY, fX + fW, fY + fH); if(aTarget.equal(*getViewBox())) @@ -250,63 +365,44 @@ namespace svgio else { // create mapping - const SvgAspectRatio& rRatio = getSvgAspectRatio(); + // #i122610 SVG 1.1 defines in section 5.1.2 that if the attribute perserveAspectRatio is not specified, + // then the effect is as if a value of 'xMidYMid meet' were specified. + SvgAspectRatio aRatioDefault(Align_xMidYMid,false,true); + const SvgAspectRatio& rRatio = getSvgAspectRatio().isSet()? getSvgAspectRatio() : aRatioDefault; - if(rRatio.isSet()) + // let mapping be created from SvgAspectRatio + const basegfx::B2DHomMatrix aEmbeddingTransform( + rRatio.createMapping(aTarget, *getViewBox())); + + // prepare embedding in transformation + const drawinglayer::primitive2d::Primitive2DReference xRef( + new drawinglayer::primitive2d::TransformPrimitive2D( + aEmbeddingTransform, + aSequence)); + + if(rRatio.isMeetOrSlice()) { - // let mapping be created from SvgAspectRatio - const basegfx::B2DHomMatrix aEmbeddingTransform( - rRatio.createMapping(aTarget, *getViewBox())); - - // prepare embedding in transformation - const drawinglayer::primitive2d::Primitive2DReference xRef( - new drawinglayer::primitive2d::TransformPrimitive2D( - aEmbeddingTransform, - aSequence)); - - if(rRatio.isMeetOrSlice()) - { - // embed in transformation - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); - } - else - { - // need to embed in MaskPrimitive2D, too - const drawinglayer::primitive2d::Primitive2DReference xMask( - new drawinglayer::primitive2d::MaskPrimitive2D( - basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aTarget)), - drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1))); - - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMask); - } + // embed in transformation + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); } else { - // choose default mapping - const basegfx::B2DHomMatrix aEmbeddingTransform( - rRatio.createLinearMapping( - aTarget, *getViewBox())); - - // embed in transformation - const drawinglayer::primitive2d::Primitive2DReference xTransform( - new drawinglayer::primitive2d::TransformPrimitive2D( - aEmbeddingTransform, - aSequence)); + // need to embed in MaskPrimitive2D, too + const drawinglayer::primitive2d::Primitive2DReference xMask( + new drawinglayer::primitive2d::MaskPrimitive2D( + basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aTarget)), + drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1))); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xTransform); + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMask); } } } } - else + else // no viewBox attribute { // Svg defines that a negative value is an error and that 0.0 disables rendering if(basegfx::fTools::more(fW, 0.0) && basegfx::fTools::more(fH, 0.0)) { - // check if we have a x,y position - const double fX(getX().isSet() ? getX().solve(*this, xcoordinate) : 0.0); - const double fY(getY().isSet() ? getY().solve(*this, ycoordinate) : 0.0); - if(!basegfx::fTools::equalZero(fX) || !basegfx::fTools::equalZero(fY)) { // embed in transform @@ -331,40 +427,64 @@ namespace svgio } } } - else + else // Outermost SVG element { - // Outermost SVG element; create target range homing width and height as given. - // SVG defines that x,y has no meanig for the outermost SVG element. Use a fallback - // width and height of din A 4 (21 x 29,7 cm) - double fW(getWidth().isSet() ? getWidth().solve(*this, xcoordinate) : (210.0 * 3.543307)); - double fH(getHeight().isSet() ? getHeight().solve(*this, ycoordinate) : (297.0 * 3.543307)); + double fW = 0.0; // effective value depends on viewBox + double fH = 0.0; // Svg defines that a negative value is an error and that 0.0 disables rendering - if(basegfx::fTools::more(fW, 0.0) && basegfx::fTools::more(fH, 0.0)) + // isPositive() not usable because it allows 0.0 in contrast to mathematical definition of 'positive' + const bool bWidthInvalid(getWidth().isSet() && basegfx::fTools::lessOrEqual(getWidth().getNumber(), 0.0)); + const bool bHeightInvalid(getHeight().isSet() && basegfx::fTools::lessOrEqual(getHeight().getNumber(), 0.0)); + if(!bWidthInvalid && !bHeightInvalid) { - const basegfx::B2DRange aSvgCanvasRange(0.0, 0.0, fW, fH); - + basegfx::B2DRange aSvgCanvasRange; // effective value depends on viewBox if(getViewBox()) { - if(!basegfx::fTools::equalZero(getViewBox()->getWidth()) && !basegfx::fTools::equalZero(getViewBox()->getHeight())) + // SVG 1.1 defines in section 7.7 that a negative value for width or height + // in viewBox is an error and that 0.0 disables rendering + const double fViewBoxWidth = getViewBox()->getWidth(); + const double fViewBoxHeight = getViewBox()->getHeight(); + if(basegfx::fTools::more(fViewBoxWidth,0.0) && basegfx::fTools::more(fViewBoxHeight,0.0)) { - // create mapping - const SvgAspectRatio& rRatio = getSvgAspectRatio(); - basegfx::B2DHomMatrix aViewBoxMapping; - - if(rRatio.isSet()) + // The intrinsic aspect ratio of the svg element is given by absolute values of both width and height + // or if one or both of them is relative by the width and height of the viewBox + // see SVG 1.1 section 7.12 + const bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); + const bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); + if(bWidthIsAbsolute && bHeightIsAbsolute) { - // let mapping be created from SvgAspectRatio - aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *getViewBox()); - - // no need to check ratio here for slice, the outermost Svg will - // be clipped anyways (see below) + fW =getWidth().solveNonPercentage(*this); + fH =getHeight().solveNonPercentage(*this); + } + else if (bWidthIsAbsolute) + { + fW = getWidth().solveNonPercentage(*this); + fH = fW * fViewBoxWidth / fViewBoxHeight ; + } + else if (bHeightIsAbsolute) + { + fH = getHeight().solveNonPercentage(*this); + fW = fH * fViewBoxWidth / fViewBoxHeight ; } else { - // choose default mapping - aViewBoxMapping = rRatio.createLinearMapping(aSvgCanvasRange, *getViewBox()); + fW = fViewBoxWidth; + fH = fViewBoxHeight; } + // SVG 1.1 defines in section 5.1.2 that x,y has no meanig for the outermost SVG element. + aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); + + // create mapping + // SVG 1.1 defines in section 5.1.2 that if the attribute perserveAspectRatio is not specified, + // then the effect is as if a value of 'xMidYMid meet' were specified. + SvgAspectRatio aRatioDefault(Align_xMidYMid,false,true); + const SvgAspectRatio& rRatio = getSvgAspectRatio().isSet()? getSvgAspectRatio() : aRatioDefault; + + basegfx::B2DHomMatrix aViewBoxMapping; + aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *getViewBox()); + // no need to check ratio here for slice, the outermost Svg will + // be clipped anyways (see below) // scale content to viewBox definitions const drawinglayer::primitive2d::Primitive2DReference xTransform( @@ -375,6 +495,32 @@ namespace svgio aSequence = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1); } } + else // no viewbox + { + // There exists no parent to resolve relative width or height. + // Use child size as fallback. + const bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); + const bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); + if (bWidthIsAbsolute && bHeightIsAbsolute) + { + fW =getWidth().solveNonPercentage(*this); + fH =getHeight().solveNonPercentage(*this); + + } + else + { + const basegfx::B2DRange aChildRange( + drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( + aSequence, + drawinglayer::geometry::ViewInformation2D())); + const double fChildWidth(aChildRange.getWidth()); + const double fChildHeight(aChildRange.getHeight()); + fW = bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : fChildWidth; + fH = bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : fChildHeight; + } + // SVG 1.1 defines in section 5.1.2 that x,y has no meanig for the outermost SVG element. + aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); + } // to be completely correct in Svg sense it is necessary to clip // the whole content to the given canvas. I choose here to do this @@ -436,9 +582,9 @@ namespace svgio if(aSequence.hasElements()) { // embed in transform primitive to scale to 1/100th mm - // where 1 mm == 3.543307 px to get from Svg coordinates to - // drawinglayer ones - const double fScaleTo100thmm(100.0 / 3.543307); + // where 1 inch == 25.4 mm to get from Svg coordinates (px) to + // drawinglayer coordinates + const double fScaleTo100thmm(25.4 * 100.0 / F_SVG_PIXEL_PER_INCH); const basegfx::B2DHomMatrix aTransform( basegfx::tools::createScaleB2DHomMatrix( fScaleTo100thmm, @@ -459,15 +605,106 @@ namespace svgio } } - const basegfx::B2DRange* SvgSvgNode::getCurrentViewPort() const + const basegfx::B2DRange SvgSvgNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } - else + else // viewport should be given by x, y, width, and height { - return SvgNode::getCurrentViewPort(); + // Extract known viewport data + // bXXXIsAbsolute tracks whether relative values could be resolved to absolute values + if (getParent()) + { + // If width or height is not provided, the default 100% is used, see SVG 1.1 section 5.1.2 + // value 0.0 here is only to initialize variable + bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); + double fW( bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : 0.0); + bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); + double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : 0.0); + + // If x or y not provided, then default 0.0 is used, see SVG 1.1 Section 5.1.2 + bool bXIsAbsolute((getX().isSet() && Unit_percent != getX().getUnit()) || !getX().isSet()); + double fX( bXIsAbsolute && getX().isSet() ? getX().solveNonPercentage(*this) : 0.0); + + bool bYIsAbsolute((getY().isSet() && Unit_percent != getY().getUnit()) || !getY().isSet()); + double fY( bYIsAbsolute && getY().isSet() ? getY().solveNonPercentage(*this) : 0.0); + + if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute && bHeightIsAbsolute) + { + return basegfx::B2DRange(fX, fY, fX+fW, fY+fH); + } + else // try to resolve relative values + { + if (!bXIsAbsolute || !bWidthIsAbsolute) + { + // get width of enclosing svg and resolve percentage in x and width + double fWReference(0.0); + bool bHasFoundWidth(false); + seekReferenceWidth(fWReference, bHasFoundWidth); + // referenced values are already in 'user unit' + if (!bXIsAbsolute && bHasFoundWidth) + { + fX = getX().getNumber() * 0.01 * fWReference; + bXIsAbsolute = true; + } + if (!bWidthIsAbsolute && bHasFoundWidth) + { + fW = (getWidth().isSet() ? getWidth().getNumber() *0.01 : 1.0) * fWReference; + bWidthIsAbsolute = true; + } + } + if (!bYIsAbsolute || !bHeightIsAbsolute) + { + // get height of enclosing svg and resolve percentage in y and height + double fHReference(0.0); + bool bHasFoundHeight(false); + seekReferenceHeight(fHReference, bHasFoundHeight); + // referenced values are already in 'user unit' + if (!bYIsAbsolute && bHasFoundHeight) + { + fY = getY().getNumber() * 0.01 * fHReference; + bYIsAbsolute = true; + } + if (!bHeightIsAbsolute && bHasFoundHeight) + { + fH = (getHeight().isSet() ? getHeight().getNumber() *0.01 : 1.0) * fHReference; + bHeightIsAbsolute = true; + } + } + + if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute && bHeightIsAbsolute) + { + return basegfx::B2DRange(fX, fY, fX+fW, fY+fH); + } + else // relative values could not be resolved, there exists no fallback + { + return SvgNode::getCurrentViewPort(); + } + } + } + else //outermost svg + { + // If width or height is not provided, the default would be 100%, see SVG 1.1 section 5.1.2 + // But here it cannot be resolved and no fallback exists. + // SVG 1.1 defines in section 5.1.2 that x,y has no meanig for the outermost SVG element. + bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); + double fW( bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : 0.0); + bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); + double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : 0.0); + if (bWidthIsAbsolute && bHeightIsAbsolute) + { + return basegfx::B2DRange(0.0, 0.0, fW, fH); + } + else // no fallback exists + { + return SvgNode::getCurrentViewPort(); + } + } +// ToDo: Is it possible to decompose and use the bounding box of the childs, if even the +// outermost svg has no information to resolve percentage? Is it worth, how expensive is it? + } } diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 7eb18025135d..ed35eed9db02 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -156,7 +156,7 @@ namespace svgio return aRetval; } - double SvgNumber::solve(const InfoProvider& rInfoProvider, NumberType aNumberType) const + double SvgNumber::solveNonPercentage(const InfoProvider& rInfoProvider) const { if(isSet()) { @@ -187,51 +187,89 @@ namespace svgio switch(meUnit) { - case Unit_pt: fRetval *= 1.25; break; - case Unit_pc: fRetval *= 15.0; break; - case Unit_cm: fRetval *= 35.43307; break; - case Unit_mm: fRetval *= 3.543307; break; - case Unit_in: fRetval *= 90.0; break; + case Unit_pt: fRetval *= F_SVG_PIXEL_PER_INCH / 72.0; break; + case Unit_pc: fRetval *= F_SVG_PIXEL_PER_INCH / 6.0; break; + case Unit_cm: fRetval *= F_SVG_PIXEL_PER_INCH / 2.54; break; + case Unit_mm: fRetval *= 0.1 * F_SVG_PIXEL_PER_INCH / 2.54; break; + case Unit_in: fRetval *= F_SVG_PIXEL_PER_INCH; break; default: break; } return fRetval; break; } + default: + { + OSL_ENSURE(false, "Do not use with percentage! "); + return 0.0; + break; + } + } + } + + /// not set + OSL_ENSURE(false, "SvgNumber not set (!)"); + return 0.0; + } + + double SvgNumber::solve(const InfoProvider& rInfoProvider, NumberType aNumberType) const + { + if(isSet()) + { + switch(meUnit) + { + case Unit_px: + { + return mfNumber; + break; + } + case Unit_pt: + case Unit_pc: + case Unit_cm: + case Unit_mm: + case Unit_in: + case Unit_em: + case Unit_ex: + { + return solveNonPercentage( rInfoProvider); + break; + } case Unit_percent: { double fRetval(mfNumber * 0.01); - const basegfx::B2DRange* pViewPort = rInfoProvider.getCurrentViewPort(); + basegfx::B2DRange aViewPort = rInfoProvider.getCurrentViewPort(); - if(!pViewPort) + if ( aViewPort.isEmpty() ) { +#ifdef DBG_UTIL + myAssert(rtl::OUString::createFromAscii("Design error, this case should have been handled in the caller")); +#endif // no viewPort, assume a normal page size (A4) - static basegfx::B2DRange aDinA4Range( + aViewPort = basegfx::B2DRange( 0.0, 0.0, - 210.0 * 3.543307, - 297.0 * 3.543307); + 210.0 * F_SVG_PIXEL_PER_INCH / 2.54, + 297.0 * F_SVG_PIXEL_PER_INCH / 2.54); - pViewPort = &aDinA4Range; } - if(pViewPort) + if ( !aViewPort.isEmpty() ) { if(xcoordinate == aNumberType) { // it's a x-coordinate, relative to current width (w) - fRetval *= pViewPort->getWidth(); + fRetval *= aViewPort.getWidth(); } else if(ycoordinate == aNumberType) { // it's a y-coordinate, relative to current height (h) - fRetval *= pViewPort->getHeight(); + fRetval *= aViewPort.getHeight(); } else // length { // it's a length, relative to sqrt(w*w + h*h)/sqrt(2) - const double fCurrentWidth(pViewPort->getWidth()); - const double fCurrentHeight(pViewPort->getHeight()); + const double fCurrentWidth(aViewPort.getWidth()); + const double fCurrentHeight(aViewPort.getHeight()); const double fCurrentLength( sqrt(fCurrentWidth * fCurrentWidth + fCurrentHeight * fCurrentHeight)/sqrt(2.0)); @@ -924,11 +962,11 @@ namespace svgio if(readNumberAndUnit(rCandidate, nPos, aHeight, nLen)) { - return basegfx::B2DRange( - aMinX.solve(rInfoProvider, xcoordinate), - aMinY.solve(rInfoProvider, ycoordinate), - aWidth.solve(rInfoProvider, xcoordinate), - aHeight.solve(rInfoProvider, ycoordinate)); + double fX(aMinX.solve(rInfoProvider, xcoordinate)); + double fY(aMinY.solve(rInfoProvider, ycoordinate)); + double fW(aWidth.solve(rInfoProvider,xcoordinate)); + double fH(aHeight.solve(rInfoProvider,ycoordinate)); + return basegfx::B2DRange(fX,fY,fX+fW,fY+fH); } } } diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index cf9f40b26336..1f0becdda7af 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -159,6 +159,9 @@ public: void SetNatNumDate( sal_Bool bDate ) { aNatNum.SetDate( bDate ); } const SvNumberNatNum& GetNatNum() const { return aNatNum; } + // check, if the format code contains a subformat for text + const bool HasTextFormatCode() const; + private: ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos String sColorName; // color name @@ -332,6 +335,9 @@ public: // Whether a new SYMBOLTYPE_CURRENCY is contained in the format sal_Bool HasNewCurrency() const; + // check, if the format code contains a subformat for text + const bool HasTextFormatCode() const; + // Build string from NewCurrency for saving it SO50 compatible void Build50Formatstring( String& rStr ) const; diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index c11a7595138c..e8df25ed6b72 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() const return sal_False; } +const bool ImpSvNumFor::HasTextFormatCode() const +{ + return aI.eScannedType == NUMBERFORMAT_TEXT; +} sal_Bool ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const @@ -1718,6 +1722,15 @@ sal_Bool SvNumberformat::HasNewCurrency() const return sal_False; } +const bool SvNumberformat::HasTextFormatCode() const +{ + for ( sal_uInt16 j=0; j<4; j++ ) + { + if ( NumFor[j].HasTextFormatCode() ) + return true; + } + return false; +} sal_Bool SvNumberformat::GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const diff --git a/svtools/source/filter/jpeg/jpeg.cxx b/svtools/source/filter/jpeg/jpeg.cxx index d544e064537b..62b9f7a5a1e8 100644 --- a/svtools/source/filter/jpeg/jpeg.cxx +++ b/svtools/source/filter/jpeg/jpeg.cxx @@ -474,14 +474,38 @@ void JPEGReader::FillBitmap() for( long nY = 0L; nY < nHeight; nY++ ) { - pTmp = (sal_uInt8*) pBuffer + nY * nAlignedWidth; + // #122985# Added fast-lane implementations using CopyScanline with direct supported mem formats + static bool bCheckOwnReader(true); - for( long nX = 0L; nX < nWidth; nX++ ) + if(bCheckOwnReader) + { + // #122985# Trying to copy the RGB data from jpeg import to make things faster. Unfortunately + // it has no GBR format, so RGB three-byte groups need to be 'flipped' to GBR first, + // then CopyScanline can use a memcpy to do the data transport. CopyScanline can also + // do the needed conversion from BMP_FORMAT_24BIT_TC_RGB (and it works well), but this + // is not faster that the old loop below using SetPixel. + sal_uInt8* aSource((sal_uInt8*)pBuffer + nY * nAlignedWidth); + sal_uInt8* aEnd(aSource + (nWidth * 3)); + + for(sal_uInt8* aTmp(aSource); aTmp < aEnd; aTmp += 3) + { + ::std::swap(*aTmp, *(aTmp + 2)); + } + + pAcc->CopyScanline(nY, aSource, BMP_FORMAT_24BIT_TC_BGR, nWidth * 3); + } + else { - aColor.SetRed( *pTmp++ ); - aColor.SetGreen( *pTmp++ ); - aColor.SetBlue( *pTmp++ ); - pAcc->SetPixel( nY, nX, aColor ); + // old version: WritePixel + pTmp = (sal_uInt8*) pBuffer + nY * nAlignedWidth; + + for( long nX = 0L; nX < nWidth; nX++ ) + { + aColor.SetRed( *pTmp++ ); + aColor.SetGreen( *pTmp++ ); + aColor.SetBlue( *pTmp++ ); + pAcc->SetPixel( nY, nX, aColor ); + } } } } diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index dc6472f8e5d9..e03137adb230 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -1023,14 +1023,18 @@ sal_Bool EnhWMFReader::ReadEnhWMF() } aLogFont.alfFaceName = UniString( lfFaceName ); - // #121382# Need to apply WorldTransform to FontHeight/Width; this should be completely - // chnaged to basegfx::B2DHomMatrix instead of 'struct XForm', but not now due to time - // constraints and dangers - const XForm& rXF = pOut->GetWorldTransform(); - const basegfx::B2DHomMatrix aWT(rXF.eM11, rXF.eM21, rXF.eDx, rXF.eM12, rXF.eM22, rXF.eDy); - const basegfx::B2DVector aTransVec(aWT * basegfx::B2DVector(aLogFont.lfWidth, aLogFont.lfHeight)); - aLogFont.lfWidth = aTransVec.getX(); - aLogFont.lfHeight = aTransVec.getY(); + // #123216# Not used in the test case of #121382# (always identity in XForm), also + // no hints in ms docu if FontSize should be scaled with WT. Using with the example + // from #123216# creates errors, so removing. + // + // // #121382# Need to apply WorldTransform to FontHeight/Width; this should be completely + // // chnaged to basegfx::B2DHomMatrix instead of 'struct XForm', but not now due to time + // // constraints and dangers + // const XForm& rXF = pOut->GetWorldTransform(); + // const basegfx::B2DHomMatrix aWT(rXF.eM11, rXF.eM21, rXF.eDx, rXF.eM12, rXF.eM22, rXF.eDy); + // const basegfx::B2DVector aTransVec(aWT * basegfx::B2DVector(aLogFont.lfWidth, aLogFont.lfHeight)); + // aLogFont.lfWidth = aTransVec.getX(); + // aLogFont.lfHeight = aTransVec.getY(); pOut->CreateObject( nIndex, GDI_FONT, new WinMtfFontStyle( aLogFont ) ); } diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx index 5be172ee9164..bdfaf85dc5c4 100644 --- a/svtools/source/filter/wmf/winmtf.cxx +++ b/svtools/source/filter/wmf/winmtf.cxx @@ -2055,10 +2055,10 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ) { case MWT_IDENTITY : { - maXForm.eM11 = maXForm.eM12 = maXForm.eM21 = maXForm.eM22 = 1.0f; - maXForm.eDx = maXForm.eDy = 0.0f; + maXForm.eM11 = maXForm.eM22 = 1.0f; + maXForm.eM12 = maXForm.eM21 = maXForm.eDx = maXForm.eDy = 0.0f; + break; } - break; case MWT_RIGHTMULTIPLY : case MWT_LEFTMULTIPLY : @@ -2117,8 +2117,13 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ) maXForm.eM22 = cF[1][1]; maXForm.eDx = cF[2][0]; maXForm.eDy = cF[2][1]; + break; + } + case MWT_SET: + { + SetWorldTransform(rXForm); + break; } - break; } } diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index d850aefba6e5..499244a69c2e 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -68,6 +68,7 @@ #define MWT_IDENTITY 1 #define MWT_LEFTMULTIPLY 2 #define MWT_RIGHTMULTIPLY 3 +#define MWT_SET 4 #define ENHMETA_STOCK_OBJECT 0x80000000 diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx index a5906dc5fe1f..1a16173469dd 100644 --- a/svtools/source/filter/wmf/wmf.cxx +++ b/svtools/source/filter/wmf/wmf.cxx @@ -50,6 +50,13 @@ sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaF { WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF(); } + +#ifdef DBG_UTIL + // #123216# allow a look at CheckSum and ByteSize for debugging + const sal_uLong aC(rGDIMetaFile.GetChecksum()); + const sal_uLong aB(rGDIMetaFile.GetSizeBytes()); +#endif + rStreamWMF.SetNumberFormatInt( nOrigNumberFormat ); return !rStreamWMF.GetError(); } diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index aa88628591a4..417a5676d47e 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -942,23 +942,25 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo if( aMapGraph == MAP_PIXEL ) { - aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetLeftCrop(), - rAttr.GetTopCrop() ), - aMap100 ); - aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( Size( rAttr.GetRightCrop(), - rAttr.GetBottomCrop() ), - aMap100 ); + // crops are in 1/100th mm -> to aMapGraph -> to MAP_PIXEL + aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), + aMap100); + aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), + aMap100); } else { - aCropLeftTop = OutputDevice::LogicToLogic( Size( rAttr.GetLeftCrop(), - rAttr.GetTopCrop() ), - aMap100, - aMapGraph ); - aCropRightBottom = OutputDevice::LogicToLogic( Size( rAttr.GetRightCrop(), - rAttr.GetBottomCrop() ), - aMap100, - aMapGraph ); + // crops are in GraphicObject units -> to aMapGraph + aCropLeftTop = OutputDevice::LogicToLogic( + Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), + aMap100, + aMapGraph); + aCropRightBottom = OutputDevice::LogicToLogic( + Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), + aMap100, + aMapGraph); } // #104115# If the metafile is cropped, give it a special @@ -1008,15 +1010,29 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo BitmapEx aBitmapEx( aTransGraphic.GetBitmapEx() ); Rectangle aCropRect; - // convert crops to pixel (crops are always in GraphicObject units) + // convert crops to pixel if(rAttr.IsCropped()) { - aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( - Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), - aMapGraph); - aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( - Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), - aMapGraph); + if( aMapGraph == MAP_PIXEL ) + { + // crops are in 1/100th mm -> to MAP_PIXEL + aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), + aMap100); + aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), + aMap100); + } + else + { + // crops are in GraphicObject units -> to MAP_PIXEL + aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), + aMapGraph); + aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( + Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), + aMapGraph); + } // convert from prefmapmode to pixel Size aSrcSizePixel( @@ -1036,8 +1052,9 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo // another possibility is to adapt the values created so far with a factor; this // will keep the original Bitmap untouched and thus quality will not change - const double fFactorX(aBitmapEx.GetSizePixel().Width() / aSrcSizePixel.Width()); - const double fFactorY(aBitmapEx.GetSizePixel().Height() / aSrcSizePixel.Height()); + // caution: convert to double first, else pretty big errors may occurr + const double fFactorX((double)aBitmapEx.GetSizePixel().Width() / aSrcSizePixel.Width()); + const double fFactorY((double)aBitmapEx.GetSizePixel().Height() / aSrcSizePixel.Height()); aCropLeftTop.Width() = basegfx::fround(aCropLeftTop.Width() * fFactorX); aCropLeftTop.Height() = basegfx::fround(aCropLeftTop.Height() * fFactorY); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index d9d07601fbcd..bc9bf06e8fca 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1808,6 +1808,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE SotStorageStreamRef xStm; DataFlavor aSubstFlavor; bool bRet(GetSotStorageStream(rFlavor, xStm)); + bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor)) { @@ -1819,18 +1820,20 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE { // when no direct success, try if BMP is available bRet = GetSotStorageStream(aSubstFlavor, xStm); + bSuppressPNG = bRet; } if(bRet) { - if(rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png"))) + if(!bSuppressPNG && rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png"))) { // it's a PNG, import to BitmapEx ::vcl::PNGReader aPNGReader(*xStm); rBmpEx = aPNGReader.Read(); } - else + + if(rBmpEx.IsEmpty()) { Bitmap aBitmap; Bitmap aMask; @@ -1848,7 +1851,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE } } - bRet = (ERRCODE_NONE == xStm->GetError()); + bRet = (ERRCODE_NONE == xStm->GetError() && !rBmpEx.IsEmpty()); /* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The problem is, that some graphics are inserted much too big because the nXPelsPerMeter diff --git a/svx/inc/svx/fillctrl.hxx b/svx/inc/svx/fillctrl.hxx index caf0ee9c77c2..daa2b20604db 100644 --- a/svx/inc/svx/fillctrl.hxx +++ b/svx/inc/svx/fillctrl.hxx @@ -58,7 +58,6 @@ private: SvxFillAttrBox* pFillAttrLB; sal_Bool bUpdate; - sal_Bool bIgnoreStatusUpdate; sal_uInt16 eLastXFS; public: @@ -71,7 +70,6 @@ public: const SfxPoolItem* pState ); void Update( const SfxPoolItem* pState ); virtual Window* CreateItemWindow( Window *pParent ); - void IgnoreStatusUpdate( sal_Bool bSet ); }; //======================================================================== diff --git a/svx/inc/svx/sdr/properties/customshapeproperties.hxx b/svx/inc/svx/sdr/properties/customshapeproperties.hxx index 7dd520d9db37..726443aa9fdb 100644 --- a/svx/inc/svx/sdr/properties/customshapeproperties.hxx +++ b/svx/inc/svx/sdr/properties/customshapeproperties.hxx @@ -34,7 +34,8 @@ namespace sdr { class CustomShapeProperties : public TextProperties { - void UpdateTextFrameStatus(); + private: + void UpdateTextFrameStatus(bool bInvalidateRenderGeometry); protected: // create a new itemset diff --git a/svx/inc/svx/sdrundomanager.hxx b/svx/inc/svx/sdrundomanager.hxx index 70f46d7d52b4..5b4b9f61f4bc 100755 --- a/svx/inc/svx/sdrundomanager.hxx +++ b/svx/inc/svx/sdrundomanager.hxx @@ -51,6 +51,9 @@ public: virtual sal_Bool Undo(); virtual sal_Bool Redo(); + // ## + virtual void Clear(); + // Call for the view which starts the interactive text edit. Use link to // activate (start text edit) and empty link to reset (end text edit). On // reset all text edit actions will be removed from this undo manager to diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index 8029fa539f9d..b95a28d606fd 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -124,6 +124,11 @@ public: static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const bool bBezierAllowed ); protected: + // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set + // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities + // and object sizes + virtual void AdaptTextMinSize(); + String aName; virtual ~SdrObjCustomShape(); @@ -131,11 +136,6 @@ protected: /// method to copy all data from given source virtual void copyDataFromSdrObject(const SdrObject& rSource); - // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set - // SDRATTR_TEXT_MINFRAMEWIDTH and SDRATTR_TEXT_MINFRAMEHEIGHT based on all settings, necessities - // and object sizes - virtual void AdaptTextMinSize(); - virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const; public: diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index cb48152544e3..1d6fd3fc3e97 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -169,6 +169,27 @@ protected: // inside test (HitTest) and object center test (see FindConnector()) bool mbSuppressDefaultConnect : 1; + // #110649# + // Flag value for avoiding death loops when calculating BoundRects + // from circularly connected connectors. A coloring algorythm is used + // here. When the GetCurrentBoundRect() calculation of a SdrEdgeObj + // is running, the flag is set, else it is always sal_False. + unsigned mbBoundRectCalculationRunning : 1; + + // #123048# need to remember if layouting was suppressed before to get + // to a correct state for first real layouting + unsigned mbSuppressed : 1; + +public: + // #109007# + // Interface to default connect suppression + void SetSuppressDefaultConnect(sal_Bool bNew) { mbSuppressDefaultConnect = bNew; } + sal_Bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; } + + // #110649# + sal_Bool IsBoundRectCalculationRunning() const { return mbBoundRectCalculationRunning; } + +protected: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); void ImpRecalcEdgeTrack(); // Neuberechnung des Verbindungsverlaufs @@ -198,11 +219,6 @@ public: /// create a copy, evtl. with a different target model (if given) virtual SdrObject* CloneSdrObject(SdrModel* pTargetModel = 0) const; - // #109007# - // Interface to default connect suppression - void SetSuppressDefaultConnect(bool bNew) { mbSuppressDefaultConnect = bNew; } - bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; } - virtual bool IsSdrEdgeObj() const; virtual bool IsClosedObj() const; diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx index 8edab506a44b..cfa248df1185 100644 --- a/svx/inc/svx/svdundo.hxx +++ b/svx/inc/svx/svdundo.hxx @@ -244,13 +244,12 @@ public: class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj { +private: + void TryToFlushGraphicContent(); + public: - SdrUndoDelObj(SdrObject& rNewObj) - : SdrUndoRemoveObj(rNewObj) - { - SetOwner(true); - } - virtual ~SdrUndoDelObj() {} + SdrUndoDelObj(SdrObject& rNewObj); + virtual ~SdrUndoDelObj(); virtual void Undo(); virtual void Redo(); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 5376ebee1afe..516c768af18d 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -390,7 +390,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(const SdrObject& rShape2d, cons // #116336# // If shapes are mirrored once (mirroring two times correct geometry again) // double-sided at the object and two-sided-lighting at the scene need to be set. - if((bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY)) + // + // #122777# Also use double sided for two fill styles since there several 3d objects get + // created with a depth of 0; one of them is the backside which needs double-sided to + // get visible + if(bUseTwoFillStyles || (bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY)) { aSet.Put(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, true)); @@ -538,22 +542,26 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(const SdrObject& rShape2d, cons aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); - Size aLogicalSize(aFillBmp.GetPrefSize()); - - if(MapMode(MAP_PIXEL) == aFillBmp.GetPrefMapMode()) - { - aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, MAP_100TH_MM); - } - else - { - aLogicalSize = OutputDevice::LogicToLogic(aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM); - } - - aLogicalSize.Width() *= 5; // :-( nice scaling, look at engine3d/obj3d.cxx - aLogicalSize.Height() *= 5; - aFillBmp.SetPrefSize(aLogicalSize); - aFillBmp.SetPrefMapMode(MAP_100TH_MM); - p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); + // #122777# old adaption of FillStyle bitmap size to 5-times the original size; this is not needed + // anymore and was used in old times to male the fill look better when converting to 3D. Removed + // from regular 3D objects for some time, also needs to be removed from CustomShapes + // + //Size aLogicalSize(aFillBmp.GetPrefSize()); + // + //if(MapMode(MAP_PIXEL) == aFillBmp.GetPrefMapMode()) + //{ + // aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, MAP_100TH_MM); + //} + //else + //{ + // aLogicalSize = OutputDevice::LogicToLogic(aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM); + //} + // + //aLogicalSize.Width() *= 5; // :-( nice scaling, look at engine3d/obj3d.cxx + //aLogicalSize.Height() *= 5; + //aFillBmp.SetPrefSize(aLogicalSize); + //aFillBmp.SetPrefMapMode(MAP_100TH_MM); + //p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); } else { @@ -599,11 +607,12 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(const SdrObject& rShape2d, cons p3DObj->SetMergedItem(Svx3DCloseBackItem(false)); pScene->Insert3DObj(*p3DObj); + // #122777# depth 0 is okay for planes when using double-sided p3DObj = new E3dExtrudeObj( rCustomShape.getSdrModelFromSdrObject(), a3DDefaultAttr, aPolyPoly, - 10); + 0); p3DObj->SetLayer(rShape2d.GetLayer()); p3DObj->SetMergedItemSet(aLocalSet); diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 583519604cb3..0b1b6cbdc8e4 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -387,8 +387,14 @@ namespace sdr if(isPrimitiveGhosted(rDisplayInfo)) { const basegfx::BColor aRGBWhite(1.0, 1.0, 1.0); - const basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, basegfx::BCOLORMODIFYMODE_INTERPOLATE); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ModifiedColorPrimitive2D( + xRetval, + basegfx::BColorModifierSharedPtr( + new basegfx::BColorModifier_interpolate( + aRGBWhite, + 0.5)))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index f6a597d75193..cd62c5f12462 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -60,8 +60,15 @@ namespace sdr if(isPrimitiveGhosted(rDisplayInfo)) { const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0); - const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE); - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::ModifiedColorPrimitive3D(xRetval, aBColorModifier)); + const ::basegfx::BColorModifierSharedPtr aBColorModifier( + new basegfx::BColorModifier_interpolate( + aRGBWhite, + 0.5)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::ModifiedColorPrimitive3D( + xRetval, + aBColorModifier)); + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index 2a8cb7df9f70..ad821d85a51a 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -114,8 +114,14 @@ namespace sdr if(isPrimitiveGhosted(rDisplayInfo)) { const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0); - const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier)); + const ::basegfx::BColorModifierSharedPtr aBColorModifier( + new basegfx::BColorModifier_interpolate( + aRGBWhite, + 0.5)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ModifiedColorPrimitive2D( + xRetval, + aBColorModifier)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index 73263559b845..d7c0b0292b46 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -38,21 +38,32 @@ namespace sdr { namespace properties { - void CustomShapeProperties::UpdateTextFrameStatus() + void CustomShapeProperties::UpdateTextFrameStatus(bool bInvalidateRenderGeometry) { SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject()); const bool bOld(rObj.bTextFrame); + // change TextFrame flag when bResizeShapeToFitText changes (which is mapped + // on the item SDRATTR_TEXT_AUTOGROWHEIGHT for custom shapes, argh) rObj.bTextFrame = 0 != static_cast< const SdrOnOffItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue(); + // check if it did change if(rObj.bTextFrame != bOld) { - rObj.InvalidateRenderGeometry(); + // on change also invalidate render geometry + bInvalidateRenderGeometry = true; - // #115391# Potential recursuin, since it calls SetObjectItemSet again, but rObj.bTextFrame - // will not change again, thus it will be only one level and terminate + // #115391# Potential recursion, since it calls SetObjectItemSet again, but rObj.bTextFrame + // will not change again. Thus it will be only one level and terminate safely rObj.AdaptTextMinSize(); } + + if(bInvalidateRenderGeometry) + { + // if asked for or bResizeShapeToFitText changed, make sure that + // the render geometry is reconstructed using changed parameters + rObj.InvalidateRenderGeometry(); + } } SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) @@ -69,7 +80,6 @@ namespace sdr // 3d Properties SDRATTR_3D_FIRST, SDRATTR_3D_LAST, - // CustomShape properties SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST, @@ -104,8 +114,8 @@ namespace sdr TextProperties::ClearObjectItemDirect( nWhich2 ); nWhich2 = aIter.NextWhich(); } - SfxItemSet aSet(GetSdrObject().GetObjectItemPool()); - ItemSetChanged(aSet); + const SfxItemSet& rSet(GetSdrObject().GetObjectItemPool()); + ItemSetChanged(rSet); } else TextProperties::ClearObjectItem( nWhich ); @@ -133,7 +143,7 @@ namespace sdr TextProperties::ItemSetChanged(rSet); // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); } void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich) @@ -143,7 +153,7 @@ namespace sdr case SDRATTR_TEXT_AUTOGROWHEIGHT: { // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize() - UpdateTextFrameStatus(); + UpdateTextFrameStatus(false); break; } default: @@ -162,7 +172,7 @@ namespace sdr TextProperties::ItemChange( nWhich, pNewItem ); // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); } void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) @@ -171,13 +181,13 @@ namespace sdr TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); } void CustomShapeProperties::ForceDefaultAttributes() { // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); // SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml // This means: Do *not* call parent here is by purpose... @@ -225,11 +235,8 @@ namespace sdr bRemoveRenderGeometry = true; } - if ( bRemoveRenderGeometry ) - { - // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); - } + // update bTextFrame and RenderGeometry + UpdateTextFrameStatus(bRemoveRenderGeometry); } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 9e4c1e4d4dea..107f85d0c787 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -132,7 +132,7 @@ namespace sdr if(nWhich) { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0); + const SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0); ItemSetChanged(aSet); } } diff --git a/svx/source/svdraw/sdrundomanager.cxx b/svx/source/svdraw/sdrundomanager.cxx index 3211ee28732e..49df4f2e0476 100755 --- a/svx/source/svdraw/sdrundomanager.cxx +++ b/svx/source/svdraw/sdrundomanager.cxx @@ -85,6 +85,25 @@ sal_Bool SdrUndoManager::Redo() return bRetval; } +void SdrUndoManager::Clear() +{ + if(isTextEditActive()) + { + while(GetUndoActionCount() && mpLastUndoActionBeforeTextEdit != GetUndoAction(0)) + { + RemoveLastUndoAction(); + } + + // urgently needed: RemoveLastUndoAction does NOT correct the Redo stack by itself (!) + ClearRedo(); + } + else + { + // call parent + EditUndoManager::Clear(); + } +} + void SdrUndoManager::SetEndTextEditHdl(const Link& rLink) { maEndTextEditHdl = rLink; diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 6d4114c93df0..8e07afef0a54 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -856,7 +856,8 @@ bool SdrDragView::BegInsGluePoint(const basegfx::B2DPoint& rPnt) if(rProvider.allowsUserGluePoints()) { - sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(sdr::glue::GluePoint()); + sdr::glue::GluePoint aNewGluePoint; + sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(aNewGluePoint); const sal_uInt32 nGlueId(rNew.getID()); SdrHdl* pHdl = 0; diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index eb3e5c7b87bb..47774fb5635c 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -849,15 +849,37 @@ void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget) rTarget.SetDistortShear(SDRDRAG_SHEAR == GetDragMode()); const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView()); const bool bStdDrag(SDRDRAG_MOVE == GetDragMode()); - bool bFrmHdl(ImpIsFrameHandles()); + const bool bFrmHdl(ImpIsFrameHandles()); const SdrObject* pSingleSelected = getSelectedIfSingle(); const SdrTextObj* pSingleTextObj = dynamic_cast< const SdrTextObj* >(pSingleSelected); const bool bSingleTextObjMark(pSingleTextObj && pSingleTextObj->IsTextFrame()); - // #122142# for captions in TextEdit, force to FrameHdls to get the special text selection - if(!bFrmHdl && bSingleTextObjMark && dynamic_cast< const SdrCaptionObj* >(pSingleSelected)) + // check if text edit or ole is active and handles need to be suppressed. This may be the case + // when a single object is selected + // Using a strict return statement is okay here; no handles means *no* handles. + if(pSingleSelected) { - bFrmHdl = true; + // formally #i33755#: If TextEdit is active the EditEngine will directly paint + // to the window, so suppress Overlay and handles completely; a text frame for + // the active text edit will be painted by the repaitnt mechanism in + // SdrObjEditView::ImpPaintOutlinerView in this case. This needs to be reworked + // in the future + // Also formally #122142#: Pretty much the same for SdrCaptionObj's in calc. + if(((SdrView*)this)->IsTextEdit()) + { + if(pSingleTextObj && pSingleTextObj->IsInEditMode()) + { + return; + } + } + + // formally #i118524#: if inplace activated OLE is selected, suppress handles + const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pSingleSelected); + + if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive())) + { + return; + } } if(bFrmHdl) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 973951482148..6d134605b2b7 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1714,14 +1714,6 @@ sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const // state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height void SdrObjCustomShape::AdaptTextMinSize() { - if(mbAdaptingTextMinSize) - { - // already adapting - return; - } - - mbAdaptingTextMinSize = true; - if(!IsPasteResize()) { const bool bResizeShapeToFitText(0 != static_cast< const SdrOnOffItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue()); @@ -1755,8 +1747,6 @@ void SdrObjCustomShape::AdaptTextMinSize() AdjustTextFrameWidthAndHeight(); } } - - mbAdaptingTextMinSize = false; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index a659525968d8..b375d9dfeeb6 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -732,33 +732,40 @@ void SdrEdgeObj::ImpUndirtyEdgeTrack() void SdrEdgeObj::ImpRecalcEdgeTrack() { - // #120437# if bEdgeTrackUserDefined, do not recalculate. Also not when model locked - if(mbEdgeTrackUserDefined || getSdrModelFromSdrObject().isLocked()) + // #120437# if bEdgeTrackUserDefined, do not recalculate + if(mbEdgeTrackUserDefined) { return; } - static bool mbBoundRectCalculationRunning = false; + // #120437# also not when model locked during import, but remember + if(getSdrModelFromSdrObject().isLocked()) + { + mbSuppressed = true; + return; + } - if(mbBoundRectCalculationRunning) + // #110649# + if(IsBoundRectCalculationRunning()) { // this object is involved into another ImpRecalcEdgeTrack() call // from another SdrEdgeObj. Do not calculate again to avoid loop. // Also, do not change mbEdgeTrackDirty so that it gets recalculated // later at the first non-looping call. } - else if(getSdrModelFromSdrObject().isLocked()) - { - // avoid re-layout during imports/API call sequences - // #i45294# but calc EdgeTrack and secure properties there - mbBoundRectCalculationRunning = true; - maEdgeTrack = ImpCalcEdgeTrack(maCon1, maCon2, &maEdgeInfo); - ImpSetAttrToEdgeInfo(); - mbEdgeTrackDirty = false; - mbBoundRectCalculationRunning = false; - } else { + if(mbSuppressed) + { + // #123048# If layouting was ever suppressed, it needs to be done once + // and the attr need to be set at EdgeInfo, else these attr *will be lost* + // in the following call to ImpSetEdgeInfoToAttr() sice they were never + // set before (!) + maEdgeTrack = ImpCalcEdgeTrack(maCon1, maCon2, &maEdgeInfo); + ImpSetAttrToEdgeInfo(); + mbSuppressed = false; + } + // To not run in a depth loop, use a coloring algorythm on // SdrEdgeObj BoundRect calculations mbBoundRectCalculationRunning = true; diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 9a0ec69c9e4e..d5ff10a4850e 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -69,6 +69,7 @@ #include <vos/mutex.hxx> #include <drawinglayer/processor2d/objectinfoextractor2d.hxx> #include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx> +#include <unotools/cacheoptions.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; @@ -80,6 +81,37 @@ using namespace ::com::sun::star::io; #define GRAFSTREAMPOS_INVALID 0xffffffff #define SWAPGRAPHIC_TIMEOUT 5000 +// #122985# it is not correct to se the swap-timeout to a hard-coded 5000ms as it was before. +// Added code and experimented what to do as a good compromize, see description +sal_uInt32 getCacheTimeInMs() +{ + static bool bSetAtAll(true); + + if(bSetAtAll) + { + static bool bSetToPreferenceTime(true); + + if(bSetToPreferenceTime) + { + const SvtCacheOptions aCacheOptions; + const sal_Int32 nSeconds(aCacheOptions.GetGraphicManagerObjectReleaseTime()); + + // the default is 10 minutes. The minimum is one minute, thus 60 seconds. When the minimum + // should match to the former hard-coded 5 seconds, we have a divisor of 12 to use. For the + // default of 10 minutes this would mean 50 seconds. Compared to before this is ten times + // more (would allow better navigation by switching through pages) and is controllable + // by the user by setting the tools/options/memory/Remove_from_memory_after setting. Seems + // to be a good compromize to me. + return nSeconds * 1000 / 12; + } + else + { + return SWAPGRAPHIC_TIMEOUT; + } + } + + return 0; +} // ------------------ // - SdrGraphicLink - @@ -377,7 +409,7 @@ SdrGrafObj::SdrGrafObj( { pGraphic = new GraphicObject( rGrf ); mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), getCacheTimeInMs() ); onGraphicChanged(); // #i118485# Shear allowed and possible now @@ -461,7 +493,7 @@ void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj ) *pGraphic = rGrfObj; delete mpReplacementGraphic; mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), getCacheTimeInMs() ); pGraphic->SetUserData(); mbIsPreview = false; SetChanged(); diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 357451159731..c311c9795a42 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -44,6 +44,8 @@ #include <svl/whiter.hxx> #include <svx/e3dsceneupdater.hxx> #include <svx/svdlegacy.hxx> +#include <svx/svdograf.hxx> +#include <svx/sdr/contact/viewcontactofgraphic.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -883,6 +885,38 @@ void SdrUndoInsertObj::Redo() //////////////////////////////////////////////////////////////////////////////////////////////////// +void SdrUndoDelObj::TryToFlushGraphicContent() +{ + SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(&mrSdrObject); + + if(pSdrGrafObj) + { + sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&pSdrGrafObj->GetViewContact()); + + if(pVC) + { + pVC->flushViewObjectContacts(); + pVC->flushGraphicObjects(); + } + + pSdrGrafObj->ForceSwapOut(); + } +} + +SdrUndoDelObj::SdrUndoDelObj(SdrObject& rNewObj) +: SdrUndoRemoveObj(rNewObj) +{ + SetOwner(true); + + // #122985# if graphic object is deleted (but goes to undo) flush it's graphic content + // since it is potentially no longer needed + TryToFlushGraphicContent(); +} + +SdrUndoDelObj::~SdrUndoDelObj() +{ +} + void SdrUndoDelObj::Undo() { SdrUndoRemoveObj::Undo(); @@ -895,6 +929,10 @@ void SdrUndoDelObj::Redo() SdrUndoRemoveObj::Redo(); DBG_ASSERT(!IsOwner(),"RedoDeleteObj: mrSdrObject gehoert bereits der UndoAction"); SetOwner(true); + + // #122985# if graphic object is deleted (but goes to undo) flush it's graphic content + // since it is potentially no longer needed + TryToFlushGraphicContent(); } XubString SdrUndoDelObj::GetComment() const diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index afa49afe2744..354797036a79 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -74,7 +74,6 @@ SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId pFillTypeLB ( NULL ), pFillAttrLB ( NULL ), bUpdate ( sal_False ), - bIgnoreStatusUpdate( sal_False ), eLastXFS ( XFILL_NONE ) { addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" ))); @@ -107,9 +106,6 @@ void SvxFillToolBoxControl::StateChanged( { bool bEnableControls = sal_False; - if ( bIgnoreStatusUpdate ) - return; - if( eState == SFX_ITEM_DISABLED ) { if( nSID == SID_ATTR_FILL_STYLE ) @@ -229,13 +225,6 @@ void SvxFillToolBoxControl::StateChanged( //======================================================================== -void SvxFillToolBoxControl::IgnoreStatusUpdate( sal_Bool bSet ) -{ - bIgnoreStatusUpdate = bSet; -} - -//======================================================================== - void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) { if ( pStyleItem && pState && bUpdate ) @@ -682,10 +671,8 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )); aXFillStyleItem.QueryValue( a ); aArgs[0].Value = a; - ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True ); ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs ); - ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False ); switch( eXFS ) { diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 48445701f146..ad147d0e8e79 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -222,21 +222,52 @@ namespace svx { BitmapEx aBmpEx; - if(bTransparent) + if(bTransparent) // TTTT: Is this needed? Simply use 1st case for all? { // use new primitive conversion tooling basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0)); + sal_uInt32 nMaximumQuadraticPixels(500000); // use 100th mm for primitive bitmap converter tool, input is pixel // use a real OutDev to get the correct DPI, the static LogicToLogic assumes 72dpi which is wrong (!) const Size aSize100th(Application::GetDefaultDevice()->PixelToLogic(rSize, MapMode(MAP_100TH_MM))); aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height())); - aBmpEx = convertMetafileToBitmapEx(rMtf, aRange); + + // when explicitely pixels are requested from the GraphicExporter, use a *very* high limit + // of 16gb (4096x4096 pixels), else use the default for the converters + nMaximumQuadraticPixels = std::min(sal_uInt32(4096 * 4096), sal_uInt32(rSize.Width() * rSize.Height())); + + aBmpEx = convertMetafileToBitmapEx(rMtf, aRange, nMaximumQuadraticPixels); } else { const SvtOptionsDrawinglayer aDrawinglayerOpt; + + // #122820# If a concrete target size in pixels is given, use it + Size aTargetSize(rSize); + + // get hairline and full bound rect to evtl. reduce given target pixel size when + // it is known that it will be expanded to get the right and bottom hairlines right + Rectangle aHairlineRect; + const Rectangle aRect(rMtf.GetBoundRect(*Application::GetDefaultDevice(), &aHairlineRect)); + + if(!aRect.IsEmpty() && !aHairlineRect.IsEmpty()) + { + if(aRect.Right() == aHairlineRect.Right() || aRect.Bottom() == aHairlineRect.Bottom()) + { + if(aTargetSize.Width()) + { + aTargetSize.Width() -= 1; + } + + if(aTargetSize.Height()) + { + aTargetSize.Height() -= 1; + } + } + } + const GraphicConversionParameters aParameters( rSize, true, // allow unlimited size @@ -417,26 +448,39 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWid } pVDev->SetMapMode( aMM ); -#ifdef DBG_UTIL - sal_Bool bAbort = ! -#endif - pVDev->SetOutputSize(aPageSize); - DBG_ASSERT(!bAbort, "virt. Device nicht korrekt erzeugt"); - - SdrView* pView = new SdrView(*mpDoc, pVDev); - pView->SetPageVisible(false); - pView->SetBordVisible(false); - pView->SetGridVisible(false); - pView->SetHlplVisible(false); - pView->SetGlueVisible(false); - pView->ShowSdrPage(*pPage); - Region aRegion (Rectangle( aPoint, aPageSize ) ); - - ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage ); - - pView->CompleteRedraw(pVDev, aRegion, &aRedirector); - - delete pView; + bool bSuccess(false); + + // #122820# If available, use pixel size directly + if(nWidthPixel && nHeightPixel) + { + bSuccess = pVDev->SetOutputSizePixel(Size(nWidthPixel, nHeightPixel)); + } + else + { + bSuccess = pVDev->SetOutputSize(aPageSize); + } + + if(bSuccess) + { + SdrView* pView = new SdrView(*mpDoc, pVDev); + pView->SetPageVisible(false); + pView->SetBordVisible(false); + pView->SetGridVisible(false); + pView->SetHlplVisible(false); + pView->SetGlueVisible(false); + pView->ShowSdrPage(*pPage); + Region aRegion (Rectangle( aPoint, aPageSize ) ); + + ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage ); + + pView->CompleteRedraw(pVDev, aRegion, &aRedirector); + delete pView; + } + else + { + OSL_ENSURE(false, "Could not get a VirtualDevice of requested size (!)"); + } + return pVDev; } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index bc56dfd86684..e74bc1aa7824 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -130,8 +130,10 @@ bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBa { const BitmapPalette& rPalette = pRead->GetPalette(); - o_rBack = rPalette[1]; - o_rFront = rPalette[0]; + // #123564# bachground and foregrund were exchanged; of course + // rPalette[0] is the background color + o_rFront = rPalette[1]; + o_rBack = rPalette[0]; return true; } diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index ea02a35101a4..c5a6fb8fa7d2 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -70,8 +70,14 @@ public: virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const; - const SwField *GetFld() const { return pField; } - SwField *GetFld() { return pField; } + const SwField* GetField() const + { + return pField; + } + SwField* GetField() + { + return pField; + } // #111840# /** diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 7a7958b283bf..f9ee8acab24e 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -154,7 +154,6 @@ public: /// wrappers for non-const calls at GraphicObject void ReleaseGraphicFromCache() { maGrfObj.ReleaseFromCache(); } - void DrawGraphicWithPDFHandling(OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr = NULL, const sal_uLong nFlags = GRFMGR_DRAW_STANDARD) { maGrfObj.DrawWithPDFHandling(rOutDev, rPt, rSz, pGrfAttr, nFlags); } void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0, const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, OutputDevice* pFirstFrameOutDev = NULL) { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); } void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { maGrfObj.StopAnimation(pOut, nExtraData); } diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index faf53c95ddc0..789b41639a48 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -285,8 +285,12 @@ public: refmarks, toxmarks, and metas will be ignored unless this is true ATTENTION: setting bInclRefToxMark is only allowed from UNDO! */ - void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0, - const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False ); + void RstAttr( + const SwIndex &rIdx, + const xub_StrLen nLen, + const sal_uInt16 nWhich = 0, + const SfxItemSet* pSet = 0, + const sal_Bool bInclRefToxMark = sal_False ); void GCAttr(); // loesche das Text-Attribut (muss beim Pool abgemeldet werden!) diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index 685face9b7b7..1213fdff6360 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -108,7 +108,7 @@ public: inline const SwFmtCharFmt &GetCharFmt() const; inline const SwFmtAutoFmt &GetAutoFmt() const; - inline const SwFmtFld &GetFld() const; + inline const SwFmtFld &GetFmtFld() const; inline const SwFmtFtn &GetFtn() const; inline const SwFmtFlyCnt &GetFlyCnt() const; inline const SwTOXMark &GetTOXMark() const; @@ -181,7 +181,7 @@ inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const return (const SwFmtAutoFmt&)(*m_pAttr); } -inline const SwFmtFld& SwTxtAttr::GetFld() const +inline const SwFmtFld& SwTxtAttr::GetFmtFld() const { ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD, "Wrong attribute" ); diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 4e1bfdaeebcd..ef34edfc7bc5 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -443,8 +443,8 @@ public: SwXDrawPage* GetDrawPage(); SwDocShell* GetDocShell() {return pDocShell;} - // #121125# react on ViewShell change - void ReactOnViewShellChange(); + // #121125#, #122868# - clean up rendering data + void CleanUpRenderingData(); void * SAL_CALL operator new( size_t ) throw(); void SAL_CALL operator delete( void * ) throw(); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 61e9f82432cc..6a5d2e46e4c2 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -334,10 +334,7 @@ SfxItemInfo __FAR_DATA aSlotTab[] = { SID_ATTR_PARA_HYPHENZONE, SFX_ITEM_POOLABLE }, // RES_PARATR_HYPHENZONE { FN_FORMAT_DROPCAPS, 0 }, // RES_PARATR_DROP { SID_ATTR_PARA_REGISTER, SFX_ITEM_POOLABLE }, // RES_PARATR_REGISTER - // --> OD 2008-03-04 #refactorlists# - // RES_PARATR_NUMRULE is now poolable { SID_ATTR_PARA_NUMRULE, SFX_ITEM_POOLABLE }, // RES_PARATR_NUMRULE - // <-- { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_SCRIPTSPACE { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },// RES_PARATR_HANGINGPUNCTUATION @@ -348,13 +345,11 @@ SfxItemInfo __FAR_DATA aSlotTab[] = { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level,zhaojianwei - // --> OD 2008-02-19 #refactorlists# { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ID { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_LEVEL { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISRESTART { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_RESTARTVALUE { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISCOUNTED - // <-- { 0, SFX_ITEM_POOLABLE }, // RES_FILL_ORDER { 0, SFX_ITEM_POOLABLE }, // RES_FRM_SIZE @@ -524,15 +519,15 @@ void _InitCore() aAttrTab[ RES_CHRATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY2 ); // CharakterAttr - Dummies - aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFmtAutoFmt; - aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFmtINetFmt( aEmptyStr, aEmptyStr ); aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr ); aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark; + aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META); + aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_METAFIELD); + aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFmtAutoFmt; + aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFmtINetFmt( aEmptyStr, aEmptyStr ); aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 ); aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr ); aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER ); - aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META); - aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_METAFIELD); aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld; aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 ); @@ -545,6 +540,7 @@ void _InitCore() aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 ); aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 ); // TextAttr - Dummies + aAttrTab[ RES_CHRATR_BIDIRTL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ); aAttrTab[ RES_CHRATR_IDCTHINT - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ); diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 36f7736b4bbd..e6d5dced4f7a 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -187,6 +187,7 @@ namespace sw { namespace mark DdeBookmark::DdeBookmark(const SwPaM& aPaM) : MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix)) , m_aRefObj(NULL) + , mbInDestruction( false ) { } void DdeBookmark::SetRefObject(SwServerObject* pObj) @@ -204,6 +205,7 @@ namespace sw { namespace mark DdeBookmark::~DdeBookmark() { + mbInDestruction = true; if( m_aRefObj.Is() ) { if(m_aRefObj->HasDataLinks()) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index ecc5307b417c..c27ec28cd874 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -630,9 +630,9 @@ void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType, bool bSubType = nSubType != USHRT_MAX; for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) if( 0 != ( pTxtFld = pFmtFld->GetTxtFld() ) && - ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFld().GetFld()) + ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField()) ->GetInputFlag() ) && - (!bSubType || (pFmtFld->GetFld()->GetSubType() + (!bSubType || (pFmtFld->GetField()->GetSubType() & 0xff ) == nSubType )) { SwCntntFrm* pCFrm; @@ -1119,7 +1119,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, pTxtAttr = pTxtNd->GetTxtAttrForCharAt( aPos.nContent.GetIndex(), RES_TXTATR_FIELD ); const SwField* pFld = pTxtAttr - ? pTxtAttr->GetFld().GetFld() + ? pTxtAttr->GetFmtFld().GetField() : 0; if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos && pFld && !pFld->HasClickHdl() ) @@ -1545,7 +1545,7 @@ const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const { SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt( pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD ); - const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0; + const SwField* pFld = pTxtAttr ? pTxtAttr->GetFmtFld().GetField() : 0; if ( pFld && pFld->Which()== RES_POSTITFLD ) { pPostItFld = static_cast<const SwPostItField*>(pFld); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 4a2d671d0536..74cca2655f14 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -57,9 +57,13 @@ using namespace util; String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ); -String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, - xub_StrLen& rEnde, SvULongs& rArr, String& rRet, - bool bRemoveSoftHyphen ) +String& lcl_CleanStr( + const SwTxtNode& rNd, + xub_StrLen nStart, + xub_StrLen& rEnde, + SvULongs& rArr, + String& rRet, + const bool bRemoveSoftHyphen ) { rRet = rNd.GetTxt(); if( rArr.Count() ) @@ -122,13 +126,13 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, if ( pHt->HasDummyChar() && (nStt >= nStart) ) { //JP 17.05.00: Task 75806 ask for ">=" and not for ">" - switch( pHt->Which() ) + switch( pHt->Which() ) { case RES_TXTATR_FLYCNT: case RES_TXTATR_FTN: - case RES_TXTATR_FIELD: + case RES_TXTATR_FIELD: case RES_TXTATR_REFMARK: - case RES_TXTATR_TOXMARK: + case RES_TXTATR_TOXMARK: case RES_TXTATR_META: case RES_TXTATR_METAFIELD: { @@ -140,24 +144,24 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, // wir sie einfach. // Fuer das Ende merken wir uns die Ersetzungen und entferenen // hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen - sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() || + sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() || !(static_cast<SwTxtFld const*>(pHt) - ->GetFld().GetFld()->ExpandField(true).Len()); + ->GetFmtFld().GetField()->ExpandField(true).Len()); if ( bEmpty && nStart == nAkt ) - { + { rArr.Insert( nAkt, rArr.Count() ); --rEnde; rRet.Erase( nAkt, 1 ); - } + } else - { + { if ( bEmpty ) aReplaced.Insert( nAkt, aReplaced.Count() ); rRet.SetChar( nAkt, '\x7f' ); - } - } - break; - default: + } + } + break; + default: ASSERT( false, "unknown case in lcl_CleanStr" ) break; } @@ -200,7 +204,7 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts) aIndex++; const SwTxtAttr* pTxtAttr = (*pHts)[i]; if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) && - (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD)) + (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD)) { aCount--; if (!aCount) @@ -213,7 +217,7 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts) { const SwTxtAttr* pTxtAttr = (*pHts)[i]; if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) && - (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD)) + (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD)) break; else aIndex++; @@ -308,7 +312,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes xub_StrLen aPos = *(*pHts)[i]->GetStart(); const SwTxtAttr* pTxtAttr = (*pHts)[i]; if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) && - (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD)) + (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD)) { if ( (aPos >= nStart) && (aPos <= nEnde) ) aNumberPostits++; @@ -391,7 +395,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes if ( (bSrchForward && (GetPostIt(aLoop + aIgnore,pHts) < pHts->Count()) ) || ( !bSrchForward && (aLoop!=0) )) { const SwTxtAttr* pTxtAttr = bSrchForward ? (*pHts)[GetPostIt(aLoop+aIgnore,pHts)] : (*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)]; - if ( pPostItMgr && pPostItMgr->SearchReplace(((SwTxtFld*)pTxtAttr)->GetFld(),rSearchOpt,bSrchForward) ) + if ( pPostItMgr && pPostItMgr->SearchReplace(((SwTxtFld*)pTxtAttr)->GetFmtFld(),rSearchOpt,bSrchForward) ) { bFound = true ; break; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 019f74688fe5..04ad4e595720 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1083,7 +1083,7 @@ struct _PostItFld : public _SetGetExpFld SwPostItField* GetPostIt() const { - return (SwPostItField*) GetFld()->GetFld().GetFld(); + return (SwPostItField*) GetTxtFld()->GetFmtFld().GetField(); } }; @@ -1101,7 +1101,7 @@ sal_uInt16 _PostItFld::GetPageNo( //Bereichs ermittelt werden. rVirtPgNo = 0; sal_uInt16 nPos = GetCntnt(); - SwIterator<SwTxtFrm,SwTxtNode> aIter( GetFld()->GetTxtNode() ); + SwIterator<SwTxtFrm,SwTxtNode> aIter( GetTxtFld()->GetTxtNode() ); for( SwTxtFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { if( pFrm->GetOfst() > nPos || @@ -1233,7 +1233,7 @@ void SwDoc::CalculatePagesForPrinting( bool bIsPDFExport, sal_Int32 nDocPageCount ) { - const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + const sal_Int64 nContent = rOptions.getIntValue( "PrintContent", 0 ); const bool bPrintSelection = nContent == 2; // properties to take into account when calcualting the set of pages @@ -1594,7 +1594,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange // 2 -> print selection - const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + const sal_Int64 nContent = rOptions.getIntValue( "PrintContent", 0 ); if (0 == nContent) { // set page range to print to 'all pages' @@ -1667,7 +1667,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // dann sorge mal dafuer, das alle Seiten in der richtigen // Reihenfolge stehen: - sal_uInt16 nSPg = 0, nEPg = aVec.size(), nStep = 1; + sal_uInt16 nSPg = 0; + sal_uInt32 nEPg = aVec.size(); + sal_uInt16 nStep = 1; if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht! --nEPg; @@ -1755,7 +1757,7 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) if (pFmtFld->IsFldInDoc()) { SwPostItField const * const pField( - static_cast<SwPostItField const*>(pFmtFld->GetFld())); + static_cast<SwPostItField const*>(pFmtFld->GetField())); rStat.nAllPara += pField->GetNumberOfParagraphs(); } } @@ -1871,8 +1873,8 @@ sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const const SfxPoolItem* pItem; const SwTxtRefMark* pTxtRef; - sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK ); - sal_uInt32 nCount = 0; + const sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK ); + sal_uInt16 nCount = 0; for( sal_uInt32 n = 0; n < nMaxItems; ++n ) if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) && 0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) && @@ -1883,7 +1885,7 @@ sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const String* pTmp = new String( ((SwFmtRefMark*)pItem)->GetRefName() ); pNames->Insert( pTmp, nCount ); } - nCount ++; + ++nCount; } return nCount; @@ -2475,8 +2477,8 @@ sal_Bool SwDoc::ConvertFieldsToText() if (!bSkip) { sal_Bool bInHeaderFooter = IsInHeaderFooter(SwNodeIndex(*pTxtFld->GetpTxtNode())); - const SwFmtFld& rFmtFld = pTxtFld->GetFld(); - const SwField* pField = rFmtFld.GetFld(); + const SwFmtFld& rFmtFld = pTxtFld->GetFmtFld(); + const SwField* pField = rFmtFld.GetField(); //#i55595# some fields have to be excluded in headers/footers sal_uInt16 nWhich = pField->GetTyp()->Which(); @@ -2710,7 +2712,7 @@ SwField * SwDoc::GetField(const SwPosition & rPos) { SwTxtFld * const pAttr = GetTxtFld(rPos); - return (pAttr) ? const_cast<SwField *>( pAttr->GetFld().GetFld() ) : 0; + return (pAttr) ? const_cast<SwField *>( pAttr->GetFmtFld().GetField() ) : 0; } SwTxtFld * SwDoc::GetTxtFld(const SwPosition & rPos) diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 65ce1c958816..fcbb17b3819d 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -734,9 +734,18 @@ namespace sw { namespace mark break; } DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get()); - if(pDdeBookmark) + if ( pDdeBookmark ) + { pDdeBookmark->DeregisterFromDoc(m_pDoc); - m_vMarks.erase(m_vMarks.begin() + (ppMark - m_vMarks.begin())); // clumsy const-cast + } + // keep a temporary instance of the to-be-deleted mark in order to avoid + // recursive deletion of the mark triggered via its destructor. + // the temporary hold instance assures that the mark is deleted after the + // mark container has been updated. Thus, the mark could not be found anymore + // in the mark container by other calls trying to recursively delete the mark. + iterator_t aToBeDeletedMarkIter = m_vMarks.begin() + (ppMark - m_vMarks.begin()); + pMark_t pToBeDeletedMark = *aToBeDeletedMarkIter; + m_vMarks.erase( aToBeDeletedMarkIter ); } void MarkManager::deleteMark(const IMark* const pMark) diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 4cecdb72a36d..be10fcefe9a7 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -446,7 +446,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { if( pFmtFld->GetTxtFld() ) { - SwTblField* pFld = (SwTblField*)pFmtFld->GetFld(); + SwTblField* pFld = (SwTblField*)pFmtFld->GetField(); if( pUpdtFld ) { @@ -528,7 +528,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { SwTblField* pFld; if( !pFmtFld->GetTxtFld() || (nsSwExtendedSubType::SUB_CMD & - (pFld = (SwTblField*)pFmtFld->GetFld())->GetSubType() )) + (pFld = (SwTblField*)pFmtFld->GetField())->GetSubType() )) continue; // muss neu berechnet werden (und ist keine textuelle Anzeige) @@ -1066,11 +1066,11 @@ String lcl_GetDBVarName( SwDoc& rDoc, SwDBNameInfField& rDBFld ) void lcl_CalcFld( SwDoc& rDoc, SwCalc& rCalc, const _SetGetExpFld& rSGEFld, SwNewDBMgr* pMgr ) { - const SwTxtFld* pTxtFld = rSGEFld.GetFld(); + const SwTxtFld* pTxtFld = rSGEFld.GetTxtFld(); if( !pTxtFld ) return ; - const SwField* pFld = pTxtFld->GetFld().GetFld(); + const SwField* pFld = pTxtFld->GetFmtFld().GetField(); const sal_uInt16 nFldWhich = pFld->GetTyp()->Which(); if( RES_SETEXPFLD == nFldWhich ) @@ -1192,11 +1192,11 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblSize, const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData(); for( ; nLast; --nLast, ++ppSortLst ) { - const SwTxtFld* pTxtFld = (*ppSortLst)->GetFld(); + const SwTxtFld* pTxtFld = (*ppSortLst)->GetTxtFld(); if( !pTxtFld ) continue; - const SwField* pFld = pTxtFld->GetFld().GetFld(); + const SwField* pFld = pTxtFld->GetFmtFld().GetField(); switch( pFld->GetTyp()->Which() ) { case RES_SETEXPFLD: @@ -1337,7 +1337,6 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) { //!SECTION -// if( pGFld->IsInBodyTxt() ) SwSbxValue aValue = aCalc.Calculate( pSect->GetCondition() ); if(!aValue.IsVoidValue()) @@ -1345,15 +1344,15 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) continue; } - SwTxtFld* pTxtFld = (SwTxtFld*)(*ppSortLst)->GetFld(); + SwTxtFld* pTxtFld = (SwTxtFld*)(*ppSortLst)->GetTxtFld(); if( !pTxtFld ) { ASSERT( !this, "was ist es denn nun" ); continue; } - SwFmtFld* pFmtFld = (SwFmtFld*)&pTxtFld->GetFld(); - SwField* pFld = pFmtFld->GetFld(); + SwFmtFld* pFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld(); + const SwField* pFld = pFmtFld->GetField(); switch( nWhich = pFld->GetTyp()->Which() ) { @@ -1684,11 +1683,9 @@ const SwDBData& SwDoc::GetDBDesc() if(pFld->IsFldInDoc()) { if(RES_DBFLD == nWhich) - aDBData = - (static_cast < SwDBFieldType * > (pFld->GetFld()->GetTyp())) - ->GetDBData(); + aDBData = (static_cast < SwDBFieldType * > (pFld->GetField()->GetTyp()))->GetDBData(); else - aDBData = (static_cast < SwDBNameInfField* > (pFld->GetFld()))->GetRealDBData(); + aDBData = (static_cast < SwDBNameInfField* > (pFld->GetField()))->GetRealDBData(); break; } } @@ -1758,7 +1755,7 @@ void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList, if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; - const SwField* pFld = pFmtFld->GetFld(); + const SwField* pFld = pFmtFld->GetField(); switch( pFld->GetTyp()->Which() ) { case RES_DBFLD: @@ -1933,7 +1930,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; - SwField* pFld = pFmtFld->GetFld(); + SwField* pFld = pFmtFld->GetField(); sal_Bool bExpand = sal_False; switch( pFld->GetTyp()->Which() ) @@ -2092,18 +2089,18 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) { SwFieldType* pFldType = GetSysFldType( aTypes[ nStt ] ); SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { - if( pFld && pFld->GetTxtFld() ) + if( pFmtFld && pFmtFld->GetTxtFld() ) { sal_Bool bChgd = sal_False; switch( aTypes[ nStt ] ) { case RES_DOCINFOFLD: - if( ((SwDocInfoField*)pFld->GetFld())->IsFixed() ) + if( ((SwDocInfoField*)pFmtFld->GetField())->IsFixed() ) { bChgd = sal_True; - SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld->GetFld(); + SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFmtFld->GetField(); pDocInfFld->SetExpansion( ((SwDocInfoFieldType*) pDocInfFld->GetTyp())->Expand( pDocInfFld->GetSubType(), @@ -2114,10 +2111,10 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) break; case RES_AUTHORFLD: - if( ((SwAuthorField*)pFld->GetFld())->IsFixed() ) + if( ((SwAuthorField*)pFmtFld->GetField())->IsFixed() ) { bChgd = sal_True; - SwAuthorField* pAuthorFld = (SwAuthorField*)pFld->GetFld(); + SwAuthorField* pAuthorFld = (SwAuthorField*)pFmtFld->GetField(); pAuthorFld->SetExpansion( ((SwAuthorFieldType*) pAuthorFld->GetTyp())->Expand( pAuthorFld->GetFormat() ) ); @@ -2125,10 +2122,10 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) break; case RES_EXTUSERFLD: - if( ((SwExtUserField*)pFld->GetFld())->IsFixed() ) + if( ((SwExtUserField*)pFmtFld->GetField())->IsFixed() ) { bChgd = sal_True; - SwExtUserField* pExtUserFld = (SwExtUserField*)pFld->GetFld(); + SwExtUserField* pExtUserFld = (SwExtUserField*)pFmtFld->GetField(); pExtUserFld->SetExpansion( ((SwExtUserFieldType*) pExtUserFld->GetTyp())->Expand( pExtUserFld->GetSubType(), @@ -2137,20 +2134,20 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) break; case RES_DATETIMEFLD: - if( ((SwDateTimeField*)pFld->GetFld())->IsFixed() ) + if( ((SwDateTimeField*)pFmtFld->GetField())->IsFixed() ) { bChgd = sal_True; - ((SwDateTimeField*)pFld->GetFld())->SetDateTime( + ((SwDateTimeField*)pFmtFld->GetField())->SetDateTime( DateTime(Date(nDate), Time(nTime)) ); } break; case RES_FILENAMEFLD: - if( ((SwFileNameField*)pFld->GetFld())->IsFixed() ) + if( ((SwFileNameField*)pFmtFld->GetField())->IsFixed() ) { bChgd = sal_True; SwFileNameField* pFileNameFld = - (SwFileNameField*)pFld->GetFld(); + (SwFileNameField*)pFmtFld->GetField(); pFileNameFld->SetExpansion( ((SwFileNameFieldType*) pFileNameFld->GetTyp())->Expand( pFileNameFld->GetFormat() ) ); @@ -2160,7 +2157,7 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) // Formatierung anstossen if( bChgd ) - pFld->ModifyNotification( 0, 0 ); + pFmtFld->ModifyNotification( 0, 0 ); } } } @@ -2239,7 +2236,7 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) void SwDocUpdtFld::InsDelFldInFldLst( sal_Bool bIns, const SwTxtFld& rFld ) { - sal_uInt16 nWhich = rFld.GetFld().GetFld()->GetTyp()->Which(); + const sal_uInt16 nWhich = rFld.GetFmtFld().GetField()->GetTyp()->Which(); switch( nWhich ) { case RES_DBFLD: @@ -2377,7 +2374,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; - const SwField* pFld = pFmtFld->GetFld(); + const SwField* pFld = pFmtFld->GetField(); switch( nWhich = pFld->GetTyp()->Which() ) { case RES_DBSETNUMBERFLD: @@ -2392,7 +2389,6 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) break; case RES_SETEXPFLD: - /// OD 04.10.2002 #102894# /// fields of subtype <string> have also been add /// for calculation (eGetMode == GETFLD_CALC). /// Thus, add fields of subtype <string> in all modes @@ -2554,12 +2550,12 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich ) // bei GetExp.-/DB.-Felder immer das BodyTxtFlag setzen if( RES_GETEXPFLD == nFldWhich ) { - SwGetExpField* pGetFld = (SwGetExpField*)rTFld.GetFld().GetFld(); + SwGetExpField* pGetFld = (SwGetExpField*)rTFld.GetFmtFld().GetField(); pGetFld->ChgBodyTxtFlag( bIsInBody ); } else if( RES_DBFLD == nFldWhich ) { - SwDBField* pDBFld = (SwDBField*)rTFld.GetFld().GetFld(); + SwDBField* pDBFld = (SwDBField*)rTFld.GetFmtFld().GetField(); pDBFld->ChgBodyTxtFlag( bIsInBody ); } @@ -2703,8 +2699,8 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, sal_Bool bTblSelBreak = sal_False; - SwFmtFld * pDstFmtFld = (SwFmtFld*)&pDstTxtFld->GetFld(); - SwField * pDstFld = pDstFmtFld->GetFld(); + SwFmtFld * pDstFmtFld = (SwFmtFld*)&pDstTxtFld->GetFmtFld(); + SwField * pDstFld = pDstFmtFld->GetField(); sal_uInt16 nFldWhich = rSrcFld.GetTyp()->Which(); SwNodeIndex aTblNdIdx(pDstTxtFld->GetTxtNode()); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index e649764f4fd2..bf4114469948 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -76,7 +76,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <drawinglayer/processor2d/processor2dtools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/graphicprimitive2d.hxx> using namespace com::sun::star; @@ -816,57 +816,19 @@ bool paintUsingPrimitivesHelper( OutputDevice& rOutputDevice, const drawinglayer::primitive2d::Primitive2DSequence& rSequence, const basegfx::B2DRange& rSourceRange, - const basegfx::B2DRange& rTargetRange, - const sal_Int32 nLeftCrop = 0, - const sal_Int32 nTopCrop = 0, - const sal_Int32 nRightCrop = 0, - const sal_Int32 nBottomCrop = 0, - const bool bMirrorX = false, - const bool bMirrorY = false) + const basegfx::B2DRange& rTargetRange) { - const double fSourceWidth(rSourceRange.getWidth()); - const double fSourceHeight(rSourceRange.getHeight()); - - if(rSequence.hasElements() && !basegfx::fTools::equalZero(fSourceWidth) && !basegfx::fTools::equalZero(fSourceHeight)) + if(rSequence.hasElements() && !basegfx::fTools::equalZero(rSourceRange.getWidth()) && !basegfx::fTools::equalZero(rSourceRange.getHeight())) { - // copy target range and apply evtl. cropping - basegfx::B2DRange aTargetRange(rTargetRange); - - if(nLeftCrop || nTopCrop || nRightCrop || nBottomCrop) + if(!basegfx::fTools::equalZero(rTargetRange.getWidth()) && !basegfx::fTools::equalZero(rTargetRange.getHeight())) { - // calculate original TargetRange - const double fFactor100thmmToTwips(72.0 / 127.0); - - aTargetRange = basegfx::B2DRange( - aTargetRange.getMinX() - (nLeftCrop * fFactor100thmmToTwips), - aTargetRange.getMinY() - (nTopCrop * fFactor100thmmToTwips), - aTargetRange.getMaxX() + (nRightCrop * fFactor100thmmToTwips), - aTargetRange.getMaxY() + (nBottomCrop * fFactor100thmmToTwips)); - } - - const double fTargetWidth(aTargetRange.getWidth()); - const double fTargetHeight(aTargetRange.getHeight()); - - if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight)) - { - // map graphic range to target range. This will automatically include - // tme mapping from Svg 1/100th mm content to twips since the target - // range is twips already - basegfx::B2DHomMatrix aMappingTransform( - basegfx::tools::createTranslateB2DHomMatrix( - -rSourceRange.getMinX(), - -rSourceRange.getMinY())); - - aMappingTransform.scale(fTargetWidth / fSourceWidth, fTargetHeight / fSourceHeight); - aMappingTransform.translate(aTargetRange.getMinX(), aTargetRange.getMinY()); - - // apply mirrorings - if(bMirrorX || bMirrorY) - { - aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY()); - aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // #119176# small typo with X/Y - aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY()); - } + // map graphic range to target range. This will e.g. automatically include + // tme mapping from 1/100th mm content to twips if needed when the target + // range is defined in twips + const basegfx::B2DHomMatrix aMappingTransform( + basegfx::tools::createSourceRangeTargetRangeTransform( + rSourceRange, + rTargetRange)); // Fill ViewInformation. Use MappingTransform here, so there is no need to // embed the primitives to it. Use original TargetRange here so there is also @@ -875,7 +837,7 @@ bool paintUsingPrimitivesHelper( const drawinglayer::geometry::ViewInformation2D aViewInformation2D( aMappingTransform, rOutputDevice.GetViewTransformation(), - aTargetRange, + rTargetRange, 0, 0.0, uno::Sequence< beans::PropertyValue >()); @@ -983,14 +945,6 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False ); bContinue = sal_False; } - else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(), - aAlignedGrfArea.SSize(), &aGrfAttr )) - { - pGrfNd->DrawGraphicWithPDFHandling(*pOut, - aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), - &aGrfAttr ); - bContinue = sal_False; - } } if( bContinue ) @@ -1027,68 +981,30 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons } else { - const SvgDataPtr& rSvgDataPtr = rGrfObj.GetGraphic().getSvgData(); - bool bDone(false); - - if(rSvgDataPtr.get()) - { - // Graphic is Svg and can be painted as primitives (vector graphic) - const basegfx::B2DRange aTargetRange( - aAlignedGrfArea.Left(), aAlignedGrfArea.Top(), - aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom()); - const bool bCropped(aGrfAttr.IsCropped()); - drawinglayer::primitive2d::Primitive2DSequence aContent; - GraphicAttr aSuppressGraphicAttr(aGrfAttr); - - aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); - aSuppressGraphicAttr.SetRotation(0); - aSuppressGraphicAttr.SetMirrorFlags(0); - - const bool bNeedTransformedGraphic( - aSuppressGraphicAttr.IsSpecialDrawMode() || - aSuppressGraphicAttr.IsAdjusted() || - aSuppressGraphicAttr.IsMirrored() || - aSuppressGraphicAttr.IsRotated() || - aSuppressGraphicAttr.IsTransparent()); - - if(bNeedTransformedGraphic) - { - // #122039# need to apply graphic transformation if GraphicAttr are used qwhich need this - const Graphic aTransformedGraphic(rGrfObj.GetTransformedGraphic(&aSuppressGraphicAttr)); - const basegfx::B2DRange aRange(rSvgDataPtr->getRange()); - const basegfx::B2DHomMatrix aTransform( - basegfx::tools::createScaleTranslateB2DHomMatrix( - aRange.getRange(), - aRange.getMinimum())); - - aContent.realloc(1); - aContent[0] = new drawinglayer::primitive2d::BitmapPrimitive2D( - aTransformedGraphic.GetBitmapEx(), - aTransform); - } - else - { - aContent = rSvgDataPtr->getPrimitive2DSequence(); - } - - bDone = paintUsingPrimitivesHelper( - *pOut, - aContent, - rSvgDataPtr->getRange(), - aTargetRange, - bCropped ? aGrfAttr.GetLeftCrop() : 0, - bCropped ? aGrfAttr.GetTopCrop() : 0, - bCropped ? aGrfAttr.GetRightCrop() : 0, - bCropped ? aGrfAttr.GetBottomCrop() : 0, - aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ, - aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT); - } - - if(!bDone) - { - // fallback paint, uses replacement image - pGrfNd->DrawGraphicWithPDFHandling(*pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr); - } + // unify using GraphicPrimitive2D + // -> the primitive handles all crop and mirror stuff + // -> the primitive renderer will create the needed pdf export data + // -> if bitmap conent, it will be cached system-dependent + const basegfx::B2DRange aTargetRange( + aAlignedGrfArea.Left(), aAlignedGrfArea.Top(), + aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom()); + const basegfx::B2DHomMatrix aTargetTransform( + basegfx::tools::createScaleTranslateB2DHomMatrix( + aTargetRange.getRange(), + aTargetRange.getMinimum())); + drawinglayer::primitive2d::Primitive2DSequence aContent; + + aContent.realloc(1); + aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D( + aTargetTransform, + rGrfObj.GetGraphic(), + aGrfAttr); + + paintUsingPrimitivesHelper( + *pOut, + aContent, + aTargetRange, + aTargetRange); } } else diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index db26c7f60cd7..70019e459b48 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -321,10 +321,15 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, static_cast<SwTxtFld*>(pAttr); rNds.GetDoc()->InsDelFldInFldLst( !bToUndo, *pTxtFld ); - const SwFieldType* pTyp = pTxtFld->GetFld().GetFld()->GetTyp(); + const SwFieldType* pTyp = pTxtFld->GetFmtFld().GetField()->GetTyp(); if ( RES_POSTITFLD == pTyp->Which() ) { - rNds.GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( &pTxtFld->GetFld(), pTxtFld->GetFld().IsFldInDoc() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) ); + rNds.GetDoc()->GetDocShell()->Broadcast( + SwFmtFldHint( + &pTxtFld->GetFmtFld(), + ( pTxtFld->GetFmtFld().IsFldInDoc() + ? SWFMTFLD_INSERTED + : SWFMTFLD_REMOVED ) ) ); } else if( RES_DDEFLD == pTyp->Which() ) diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 1b9fe4591985..55c093d22a04 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -463,7 +463,7 @@ sal_Bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, // defined as weak-script ? if ( RES_TXTATR_FIELD == pAttr->Which() ) { - const SwField* const pFld = pAttr->GetFld().GetFld(); + const SwField* const pFld = pAttr->GetFmtFld().GetField(); if (pFld) { sExp += pFld->ExpandField(true); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 840730ae5259..c29454bf3d7a 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -273,7 +273,7 @@ SwField* SwEditShell::GetCurFld() const (pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex()) <= 1) { - pCurFld = (SwField*)pTxtFld->GetFld().GetFld(); + pCurFld = (SwField*)pTxtFld->GetFmtFld().GetField(); // TabellenFormel ? wandel internen in externen Namen um if( RES_TABLEFLD == pCurFld->GetTyp()->Which() ) { @@ -311,7 +311,7 @@ SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld ) for( n = 0; n < nMaxItems; ++n ) if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) ) - && ((SwFmtFld*)pItem)->GetFld() == &rFld ) + && ((SwFmtFld*)pItem)->GetField() == &rFld ) { pTFld = ((SwFmtFld*)pItem)->GetTxtFld(); break; @@ -390,8 +390,8 @@ void SwEditShell::UpdateFlds( SwField &rFld ) if( 0 != (pTxtFld = GetDocTxtFld( pCurStt )) ) { - pFmtFld = (SwFmtFld*)&pTxtFld->GetFld(); - pCurFld = pFmtFld->GetFld(); + pFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld(); + pCurFld = pFmtFld->GetField(); // bei gemischten Feldtypen if( pCurFld->GetTyp()->Which() != diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx index bce3300ac335..6e6dd1cc91ed 100644 --- a/sw/source/core/edit/edfldexp.cxx +++ b/sw/source/core/edit/edfldexp.cxx @@ -63,13 +63,13 @@ sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const case RES_DBFLD: { SwIterator<SwFmtFld,SwFieldType> aIter( rFldType ); - SwFmtFld* pFld = aIter.First(); - while(pFld) + SwFmtFld* pFmtFld = aIter.First(); + while(pFmtFld) { - if(pFld->IsFldInDoc()) + if(pFmtFld->IsFldInDoc()) { const SwDBData& rData = - ((SwDBFieldType*)pFld->GetFld()->GetTyp())->GetDBData(); + ((SwDBFieldType*)pFmtFld->GetField()->GetTyp())->GetDBData(); try { return xDBContext->getByName(rData.sDataSource).hasValue(); @@ -80,7 +80,7 @@ sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const return sal_False; } } - pFld = aIter.Next(); + pFmtFld = aIter.Next(); } } break; diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index bacf595e3403..bc63d52afb2e 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -325,7 +325,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle) if(!pTxtFld || !pTxtFld->GetpTxtNode()) { #ifdef DBG_UTIL - if(nHandle == ((SwAuthorityField*)pFmtFld->GetFld())->GetHandle()) + if(nHandle == ((SwAuthorityField*)pFmtFld->GetField())->GetHandle()) bCurrentFieldWithoutTextNode = sal_True; #endif continue; @@ -381,7 +381,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle) { const SwTOXSortTabBase& rBase = *aSortArr[i]; SwFmtFld& rFmtFld = ((SwTOXAuthority&)rBase).GetFldFmt(); - SwAuthorityField* pAFld = (SwAuthorityField*)rFmtFld.GetFld(); + SwAuthorityField* pAFld = (SwAuthorityField*)rFmtFld.GetField(); m_pSequArr->Insert(pAFld->GetHandle(), i); } aSortArr.DeleteAndDestroy(0, aSortArr.Count()); diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index c524b73bffd9..4e77fdfcd141 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -164,7 +164,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen - const SwField* pFld = pTxtFld->GetFld().GetFld(); + const SwField* pFld = pTxtFld->GetFmtFld().GetField(); switch( pFld->GetTyp()->Which() ) { case RES_SETEXPFLD: diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 1212450b740e..11e3fa491f8b 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -159,18 +159,18 @@ sal_Bool SwDBFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { sColumn = sTmp; SwIterator<SwFmtFld,SwFieldType> aIter( *this ); - SwFmtFld* pFld = aIter.First(); - while(pFld) + SwFmtFld* pFmtFld = aIter.First(); + while(pFmtFld) { // Feld im Undo? - SwTxtFld *pTxtFld = pFld->GetTxtFld(); + SwTxtFld *pTxtFld = pFmtFld->GetTxtFld(); if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) { - SwDBField* pDBField = (SwDBField*)pFld->GetFld(); + SwDBField* pDBField = (SwDBField*)pFmtFld->GetField(); pDBField->ClearInitialized(); pDBField->InitContent(); } - pFld = aIter.Next(); + pFmtFld = aIter.Next(); } } } @@ -460,17 +460,17 @@ sal_Bool SwDBField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) if(GetTyp()) { SwIterator<SwFmtFld,SwFieldType> aIter( *GetTyp() ); - SwFmtFld* pFld = aIter.First(); - while(pFld) + SwFmtFld* pFmtFld = aIter.First(); + while(pFmtFld) { - SwTxtFld *pTxtFld = pFld->GetTxtFld(); - if(pTxtFld && (SwDBField*)pFld->GetFld() == this ) + SwTxtFld *pTxtFld = pFmtFld->GetTxtFld(); + if(pTxtFld && (SwDBField*)pFmtFld->GetField() == this ) { //notify the change - pTxtFld->NotifyContentChange(*pFld); + pTxtFld->NotifyContentChange(*pFmtFld); break; } - pFld = aIter.Next(); + pFmtFld = aIter.Next(); } } } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index dce1358f632e..19d1e036d204 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2316,7 +2316,7 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst ) void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, _SetGetExpFlds& rSetList ) { - SwRefPageGetField* pGetFld = (SwRefPageGetField*)pTxtFld->GetFld().GetFld(); + SwRefPageGetField* pGetFld = (SwRefPageGetField*)pTxtFld->GetFmtFld().GetField(); pGetFld->SetText( aEmptyStr ); // dann suche mal das richtige RefPageSet-Field @@ -2332,9 +2332,9 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, if( nLast-- ) { - const SwTxtFld* pRefTxtFld = rSetList[ nLast ]->GetFld(); + const SwTxtFld* pRefTxtFld = rSetList[ nLast ]->GetTxtFld(); const SwRefPageSetField* pSetFld = - (SwRefPageSetField*)pRefTxtFld->GetFld().GetFld(); + (SwRefPageSetField*)pRefTxtFld->GetFmtFld().GetField(); if( pSetFld->IsOn() ) { // dann bestimme mal den entsp. Offset @@ -2358,7 +2358,7 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, } } // dann die Formatierung anstossen - ((SwFmtFld&)pTxtFld->GetFld()).ModifyNotification( 0, 0 ); + ((SwFmtFld&)pTxtFld->GetFmtFld()).ModifyNotification( 0, 0 ); } /*-------------------------------------------------------------------- @@ -2429,9 +2429,9 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, if( !nLast-- ) return ; // es gibt kein entsprechendes Set - Feld vor mir - const SwTxtFld* pRefTxtFld = aTmpLst[ nLast ]->GetFld(); + const SwTxtFld* pRefTxtFld = aTmpLst[ nLast ]->GetTxtFld(); const SwRefPageSetField* pSetFld = - (SwRefPageSetField*)pRefTxtFld->GetFld().GetFld(); + (SwRefPageSetField*)pRefTxtFld->GetFmtFld().GetField(); Point aPt; const SwCntntFrm* pRefFrm = pRefTxtFld ? pRefTxtFld->GetTxtNode().getLayoutFrm( pFrm->getRootFrm(), &aPt, 0, sal_False ) : 0; if( pSetFld->IsOn() && pRefFrm ) @@ -2441,7 +2441,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, sal_uInt16 nDiff = pPgFrm->GetPhyPageNum() - pRefFrm->FindPageFrm()->GetPhyPageNum() + 1; - SwRefPageGetField* pGetFld = (SwRefPageGetField*)pFld->GetFld().GetFld(); + SwRefPageGetField* pGetFld = (SwRefPageGetField*)pFld->GetFmtFld().GetField(); sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat() ? pPgFrm->GetPageDesc()->GetNumType().GetNumberingType() : pGetFld->GetFormat(); diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 71a20cd7fa51..67c533925e80 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -534,8 +534,8 @@ void SwSetExpFieldType::Modify( const SfxPoolItem*, const SfxPoolItem* ) void SwSetExpFieldType::SetSeqFormat(sal_uLong nFmt) { SwIterator<SwFmtFld,SwFieldType> aIter(*this); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) - pFld->GetFld()->ChangeFormat( nFmt ); + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) + pFmtFld->GetField()->ChangeFormat( nFmt ); } sal_uLong SwSetExpFieldType::GetSeqFormat() @@ -543,7 +543,7 @@ sal_uLong SwSetExpFieldType::GetSeqFormat() if( !GetDepends() ) return SVX_NUM_ARABIC; - SwField *pFld = ((SwFmtFld*)GetDepends())->GetFld(); + SwField *pFld = ((SwFmtFld*)GetDepends())->GetField(); return pFld->GetFormat(); } @@ -562,10 +562,10 @@ extern void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = SwIterator<SwFmtFld,SwFieldType> aIter( *this ); const SwTxtNode* pNd; for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() ) - if( pF->GetFld() != &rFld && pF->GetTxtFld() && + if( pF->GetField() != &rFld && pF->GetTxtFld() && 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) && pNd->GetNodes().IsDocNodes() ) - InsertSort( aArr, ((SwSetExpField*)pF->GetFld())->GetSeqNumber() ); + InsertSort( aArr, ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); // teste erstmal ob die Nummer schon vorhanden ist: @@ -605,7 +605,7 @@ sal_uInt16 SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList ) { _SeqFldLstElem* pNew = new _SeqFldLstElem( pNd->GetExpandTxt( 0, (*pF->GetTxtFld()->GetStart()) + 1 ), - ((SwSetExpField*)pF->GetFld())->GetSeqNumber() ); + ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); rList.InsertSort( pNew ); } diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index 82a32521509a..684595e40389 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -60,14 +60,14 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst ) if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType ) { SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { - const SwTxtFld* pTxtFld = pFld->GetTxtFld(); + const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); // nur InputFields und interaktive SetExpFlds bearbeiten // and DropDown fields if( !pTxtFld || ( RES_SETEXPFLD == nType && - !((SwSetExpField*)pFld->GetFld())->GetInputFlag())) + !((SwSetExpField*)pFmtFld->GetField())->GetInputFlag())) continue; const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); @@ -107,9 +107,9 @@ sal_uInt16 SwInputFieldList::Count() const SwField* SwInputFieldList::GetField(sal_uInt16 nId) { - const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetFld(); + const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetTxtFld(); ASSERT( pTxtFld, "kein TextFld" ); - return (SwField*)pTxtFld->GetFld().GetFld(); + return (SwField*)pTxtFld->GetFmtFld().GetField(); } /*-------------------------------------------------------------------- @@ -156,13 +156,13 @@ sal_uInt16 SwInputFieldList::BuildSortLst() if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType ) { SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { - const SwTxtFld* pTxtFld = pFld->GetTxtFld(); + const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); // nur InputFields und interaktive SetExpFlds bearbeiten if( !pTxtFld || ( RES_SETEXPFLD == nType && - !((SwSetExpField*)pFld->GetFld())->GetInputFlag())) + !((SwSetExpField*)pFmtFld->GetField())->GetInputFlag())) continue; const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index a46458aa5a15..2996950307ab 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -318,7 +318,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) pTxtNd->GetTxtAttrForCharAt(nStt, RES_TXTATR_FIELD); if( pTxtAttr ) nStt = SwGetExpField::GetReferenceTextPos( - pTxtAttr->GetFld(), *pDoc ); + pTxtAttr->GetFmtFld(), *pDoc ); else if( nStt + 1 < nEnd ) ++nStt; } @@ -768,23 +768,21 @@ void SwGetRefFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew if( !pNew && !pOld ) { SwIterator<SwFmtFld,SwFieldType> aIter( *this ); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { // nur die GetRef-Felder Updaten //JP 3.4.2001: Task 71231 - we need the correct language - SwGetRefField* pGRef = (SwGetRefField*)pFld->GetFld(); + SwGetRefField* pGRef = (SwGetRefField*)pFmtFld->GetField(); const SwTxtFld* pTFld; if( !pGRef->GetLanguage() && - 0 != ( pTFld = pFld->GetTxtFld()) && + 0 != ( pTFld = pFmtFld->GetTxtFld()) && pTFld->GetpTxtNode() ) { pGRef->SetLanguage( pTFld->GetpTxtNode()->GetLang( *pTFld->GetStart() ) ); } - // --> OD 2007-09-06 #i81002# - pGRef->UpdateField( pFld->GetTxtFld() ); - // <-- + pGRef->UpdateField( pFmtFld->GetTxtFld() ); } } // weiter an die Text-Felder, diese "Expandieren" den Text @@ -820,12 +818,12 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType*)pFldType)->GetType() ) { SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); - for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) + for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { - if( pFld->GetTxtFld() && nSeqNo == - ((SwSetExpField*)pFld->GetFld())->GetSeqNumber() ) + if( pFmtFld->GetTxtFld() && nSeqNo == + ((SwSetExpField*)pFmtFld->GetField())->GetSeqNumber() ) { - SwTxtFld* pTxtFld = pFld->GetTxtFld(); + SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); pTxtNd = (SwTxtNode*)pTxtFld->GetpTxtNode(); *pStt = *pTxtFld->GetStart(); if( pEnd ) @@ -939,7 +937,7 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, if( pF->GetTxtFld() && 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) && pNd->GetNodes().IsDocNodes() ) - aIds.Insert( ((SwSetExpField*)pF->GetFld())->GetSeqNumber() ); + aIds.Insert( ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); } if( 0 != ( pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false ) )) { @@ -948,7 +946,7 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, if( pF->GetTxtFld() && 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) && pNd->GetNodes().IsDocNodes() ) - aDstIds.Insert( ((SwSetExpField*)pF->GetFld())->GetSeqNumber() ); + aDstIds.Insert( ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); } } else @@ -996,8 +994,8 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, SwIterator<SwFmtFld,SwFieldType> aIter( *pType ); for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() ) if( pF->GetTxtFld() && nSeqNo == - ((SwSetExpField*)pF->GetFld())->GetSeqNumber() ) - ((SwSetExpField*)pF->GetFld())->SetSeqNumber( n ); + ((SwSetExpField*)pF->GetField())->GetSeqNumber() ) + ((SwSetExpField*)pF->GetField())->SetSeqNumber( n ); } } else @@ -1035,7 +1033,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) SwIterator<SwFmtFld,SwFieldType> aIter( *this ); for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) { - SwGetRefField& rRefFld = *(SwGetRefField*)pFld->GetFld(); + SwGetRefField& rRefFld = *(SwGetRefField*)pFld->GetField(); switch( rRefFld.GetSubType() ) { case REF_SEQUENCEFLD: diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 40dac7500685..f7c33e93c16e 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -101,7 +101,7 @@ const SwNode* SwTblField::GetNodeOfFormula() const SwIterator<SwFmtFld,SwFieldType> aIter( *GetTyp() ); for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) - if( this == pFmtFld->GetFld() ) + if( this == pFmtFld->GetField() ) return (SwTxtNode*)&pFmtFld->GetTxtFld()->GetTxtNode(); return 0; } diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 720539c5a4a9..5a899698ad2a 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1503,7 +1503,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < for( sal_uInt16 n = 0, nEnd = pHts->Count(); n < nEnd; ++n ) if( RES_TXTATR_FIELD == ( pItem = &(*pHts)[ n ]->GetAttr())->Which() && - TYP_SEQFLD == ((SwFmtFld*)pItem)->GetFld()->GetTypeId() ) + TYP_SEQFLD == ((SwFmtFld*)pItem)->GetField()->GetTypeId() ) { // sequence field found SwFlyFrm* pChgFly = (SwFlyFrm*)pAnchor->GetUpper(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index a12fcb3a2050..9691a676e7ee 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -640,7 +640,8 @@ sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, // alle Zellen der (Teil-)Tabelle zusammen. Dann teste mal ob // all huebsch nebeneinander liegen. - size_t n, nCellCnt = 0; + size_t n; + sal_uInt16 nCellCnt = 0; long nYPos = LONG_MAX; long nXPos = 0; long nHeight = 0; diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx index 92df083f6d51..aabf6dd45bbb 100644 --- a/sw/source/core/inc/bookmrk.hxx +++ b/sw/source/core/inc/bookmrk.hxx @@ -159,8 +159,13 @@ namespace sw { namespace mark void DeregisterFromDoc(SwDoc* const pDoc); virtual ~DdeBookmark(); + inline bool IsInDestruction() const + { + return mbInDestruction; + } private: SwServerObjectRef m_aRefObj; + bool mbInDestruction; static const ::rtl::OUString our_sNamePrefix; }; diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx index 4563421f0b70..691dc53f4234 100644 --- a/sw/source/core/inc/docfld.hxx +++ b/sw/source/core/inc/docfld.hxx @@ -86,7 +86,7 @@ public: CNTNT.pTxtFld == rFld.CNTNT.pTxtFld ); } sal_Bool operator<( const _SetGetExpFld& rFld ) const; - const SwTxtFld* GetFld() const + const SwTxtFld* GetTxtFld() const { return TEXTFIELD == eSetGetExpFldType ? CNTNT.pTxtFld : 0; } const SwTxtTOXMark* GetTOX() const { return TEXTTOXMARK == eSetGetExpFldType ? CNTNT.pTxtTOX : 0; } diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx index e5517b4c7124..c2748163c10c 100644 --- a/sw/source/core/inc/wrong.hxx +++ b/sw/source/core/inc/wrong.hxx @@ -103,10 +103,10 @@ private: } } } - catch(::com::sun::star::container::NoSuchElementException& ex) + catch(::com::sun::star::container::NoSuchElementException& ) { } - catch(::com::sun::star::uno::RuntimeException& ex) + catch(::com::sun::star::uno::RuntimeException& ) { } @@ -137,10 +137,10 @@ private: } } } - catch(::com::sun::star::container::NoSuchElementException& ex) + catch(::com::sun::star::container::NoSuchElementException& ) { } - catch(::com::sun::star::uno::RuntimeException& ex) + catch(::com::sun::star::uno::RuntimeException& ) { } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 05d4039c7366..b0dc8343504c 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2797,32 +2797,28 @@ void SwFlyFrmFmt::MakeFrms() { sal_uInt16 nPgNum = aAnchorAttr.GetPageNum(); SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetCurrentLayout()->Lower(); //swmod 080218 - if( !nPgNum && aAnchorAttr.GetCntntAnchor() ) + if( nPgNum == 0 && aAnchorAttr.GetCntntAnchor() ) { - SwCntntNode *pCNd = - aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); + SwCntntNode *pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); SwIterator<SwFrm,SwCntntNode> aIter( *pCNd ); - for (SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) + for ( SwFrm* pFrm = aIter.First(); pFrm != NULL; pFrm = aIter.Next() ) { - pPage = pFrm->FindPageFrm(); - if( pPage ) - { - nPgNum = pPage->GetPhyPageNum(); - // OD 24.07.2003 #111032# - update anchor attribute - aAnchorAttr.SetPageNum( nPgNum ); - aAnchorAttr.SetAnchor( 0 ); - SetFmtAttr( aAnchorAttr ); - } + pPage = pFrm->FindPageFrm(); + if( pPage ) + { + nPgNum = pPage->GetPhyPageNum(); + aAnchorAttr.SetPageNum( nPgNum ); + aAnchorAttr.SetAnchor( 0 ); + SetFmtAttr( aAnchorAttr ); break; } + } } while ( pPage ) { if ( pPage->GetPhyPageNum() == nPgNum ) { - // --> OD 2005-06-09 #i50432# - adjust synopsis of <PlaceFly(..)> pPage->PlaceFly( 0, this ); - // <-- break; } pPage = (SwPageFrm*)pPage->GetNext(); @@ -2931,18 +2927,21 @@ SwAnchoredObject* SwFlyFrmFmt::GetAnchoredObj( const Point* pPoint, const sal_Bo sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const { + sal_Bool bRet = sal_True; switch( rInfo.Which() ) { case RES_CONTENT_VISIBLE: { ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this ); } - return sal_False; + bRet = sal_False; + break; default: - return SwFrmFmt::GetInfo( rInfo ); + bRet = SwFrmFmt::GetInfo( rInfo ); + break; } - return sal_True; + return bRet; } // --> OD 2009-07-14 #i73249# diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 575e2f9e6ecc..c132017ee708 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2220,12 +2220,17 @@ sal_Bool SwLayIdle::_DoIdleJob( const SwCntntFrm *pCnt, IdleJobType eJob ) } case SMART_TAGS : // SMARTTAGS { - const SwRect aRepaint( ((SwTxtFrm*)pCnt)->SmartTagScan( pCntntNode, nTxtPos ) ); - bPageValid = bPageValid && !pTxtNode->IsSmartTagDirty(); - if( !bPageValid ) - bAllValid = sal_False; - if ( aRepaint.HasArea() ) - pImp->GetShell()->InvalidateWindows( aRepaint ); + try { + const SwRect aRepaint( ((SwTxtFrm*)pCnt)->SmartTagScan( pCntntNode, nTxtPos ) ); + bPageValid = bPageValid && !pTxtNode->IsSmartTagDirty(); + if( !bPageValid ) + bAllValid = sal_False; + if ( aRepaint.HasArea() ) + pImp->GetShell()->InvalidateWindows( aRepaint ); + } catch( const ::com::sun::star::uno::RuntimeException& e) { + // #i122885# handle smarttag problems gracefully and provide diagnostics + DBG_WARNING( rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } if ( Application::AnyInput( INPUT_MOUSEANDKEYBOARD|INPUT_OTHER|INPUT_PAINT ) ) return sal_True; break; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 0ba42e0996ba..024e88236bd4 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6393,10 +6393,27 @@ const Color& SwPageFrm::GetDrawBackgrdColor() const const SvxBrushItem* pBrushItem; const Color* pDummyColor; SwRect aDummyRect; + if ( GetBackgroundBrush( pBrushItem, pDummyColor, aDummyRect, true) ) - return pBrushItem->GetColor(); - else - return aGlobalRetoucheColor; + { + const Graphic* pGraphic = pBrushItem->GetGraphic(); + + if(pGraphic) + { + // #29105# when a graphic is set, it may be possible to calculate a single + // color which looks good in all places of the graphic. Since it is + // planned to have text edit on the overlay one day and the fallback + // to aGlobalRetoucheColor returns something useful, just use that + // for now. + } + else + { + // not a graphic, use (hopefully) initialized color + return pBrushItem->GetColor(); + } + } + + return aGlobalRetoucheColor; } /************************************************************************* diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index b6e1feb2caa1..e126aab1f2db 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2586,7 +2586,7 @@ sal_uLong SwTableBox::IsValidNumTxtNd( sal_Bool bCheckAttr ) const // it inserts hidden variable-set fields at // the beginning of para in cell, but they // should not turn cell into text cell - const SwField* pField = pAttr->GetFld().GetFld(); + const SwField* pField = pAttr->GetFmtFld().GetField(); if (pField && (pField->GetTypeId() == TYP_SETFLD) && (0 != (static_cast<SwSetExpField const*> diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 8dc03a482042..c00a44fcbe95 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -374,8 +374,9 @@ bool SwTaggedPDFHelper::CheckReopenTag() if ( pKey ) { FrmTagIdMap& rFrmTagIdMap = SwEnhancedPDFExportHelper::GetFrmTagIdMap(); - const FrmTagIdMap::const_iterator aIter = rFrmTagIdMap.find( pKey ); - nReopenTag = (*aIter).second; + const FrmTagIdMap::const_iterator aIter = rFrmTagIdMap.find( pKey ); + if( aIter != rFrmTagIdMap.end()) + nReopenTag = (*aIter).second; } } } @@ -1459,7 +1460,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() const SwField* pFld = 0; if ( pHint && RES_TXTATR_FIELD == pHint->Which() ) { - pFld = (SwField*)pHint->GetFld().GetFld(); + pFld = (SwField*)pHint->GetFmtFld().GetField(); if ( RES_GETREFFLD == pFld->Which() ) { nPDFType = vcl::PDFWriter::Link; @@ -1609,7 +1610,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() vcl::PDFNote aNote; // Use the NumberFormatter to get the date string: - const SwPostItField* pField = (SwPostItField*)pFirst->GetFld(); + const SwPostItField* pField = (SwPostItField*)pFirst->GetField(); SvNumberFormatter* pNumFormatter = pDoc->GetNumberFormatter(); const Date aDateDiff( pField->GetDate() - *pNumFormatter->GetNullDate() ); @@ -1849,8 +1850,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() mrSh.SwCrsrShell::ClearMark(); // Destination Rectangle - const SwGetRefField* pField = - (SwGetRefField*)pFirst->GetFld(); + const SwGetRefField* pField = (SwGetRefField*)pFirst->GetField(); const String& rRefName = pField->GetSetRefName(); mrSh.GotoRefMark( rRefName, pField->GetSubType(), pField->GetSeqNo() ); const SwRect& rDestRect = mrSh.GetCharRect(); diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 9661e97bda6a..ad06d9fdc0b7 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -121,18 +121,18 @@ const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - 35, // RES_CHRATR_OVERLINE, // 38 0, // RES_CHRATR_DUMMY1, // 39 0, // RES_CHRATR_DUMMY2, // 40 - 0, // RES_CHRATR_BIDIRTL - 0, // RES_CHRATR_IDCTHINT - 36, // RES_TXTATR_REFMARK, // 41 - 37, // RES_TXTATR_TOXMARK, // 42 - 38, // RES_TXTATR_META, // 43 - 38, // RES_TXTATR_METAFIELD, // 44 - 0, // RES_TXTATR_AUTOFMT, // 45 - 0, // RES_TXTATR_INETFMT // 46 - 0, // RES_TXTATR_CHARFMT, // 47 - 39, // RES_TXTATR_CJK_RUBY, // 48 - 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 49 - 0, // RES_TXTATR_DUMMY5 // 50 + 0, // RES_CHRATR_BIDIRTL // 41 + 0, // RES_CHRATR_IDCTHINT // 42 + 36, // RES_TXTATR_REFMARK, // 43 + 37, // RES_TXTATR_TOXMARK, // 44 + 38, // RES_TXTATR_META, // 45 + 38, // RES_TXTATR_METAFIELD, // 46 + 0, // RES_TXTATR_AUTOFMT, // 47 + 0, // RES_TXTATR_INETFMT // 48 + 0, // RES_TXTATR_CHARFMT, // 49 + 39, // RES_TXTATR_CJK_RUBY, // 50 + 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 51 + 0, // RES_TXTATR_DUMMY5 // 52 }; /************************************************************************* diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 0de6585c476e..6b9469e30ec9 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -773,7 +773,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa } case RES_TXTATR_FIELD : { - SwField *pFld = (SwField*)pHint->GetFld().GetFld(); + SwField *pFld = (SwField*)pHint->GetFmtFld().GetField(); const String aTxt = pFld->ExpandField(true); if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0, aTxt.Len() ) ) @@ -976,7 +976,7 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd } case RES_TXTATR_FIELD : { - SwField *pFld = (SwField*)pHint->GetFld().GetFld(); + SwField *pFld = (SwField*)pHint->GetFmtFld().GetField(); String const aTxt = pFld->ExpandField(true); SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() ); diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 8e855da32311..9c95883b7943 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -84,7 +84,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, { SwExpandPortion *pRet = 0; SwFrm *pFrame = (SwFrm*)pFrm; - SwField *pFld = (SwField*)pHint->GetFld().GetFld(); + SwField *pFld = (SwField*)pHint->GetFmtFld().GetField(); const sal_Bool bName = rInf.GetOpt().IsFldName(); SwCharFmt* pChFmt = 0; @@ -98,7 +98,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pFld->SetLanguage( GetFnt()->GetLanguage() ); // let the visual note know about its new language if (pFld->GetTyp()->Which()==RES_POSTITFLD) - const_cast<SwFmtFld*> (&pHint->GetFld())->Broadcast( SwFmtFldHint( &pHint->GetFld(), SWFMTFLD_LANGUAGE ) ); + const_cast<SwFmtFld*> (&pHint->GetFmtFld())->Broadcast( SwFmtFldHint( &pHint->GetFmtFld(), SWFMTFLD_LANGUAGE ) ); } ViewShell *pSh = rInf.GetVsh(); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 0462da67e712..e531761e042c 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -845,8 +845,7 @@ SwTOXAuthority::SwTOXAuthority( const SwCntntNode& rNd, sal_uInt16 SwTOXAuthority::GetLevel() const { - String sText(((SwAuthorityField*)m_rField.GetFld())-> - GetFieldText(AUTH_FIELD_AUTHORITY_TYPE)); + String sText(((SwAuthorityField*)m_rField.GetField())->GetFieldText(AUTH_FIELD_AUTHORITY_TYPE)); //#i18655# the level '0' is the heading level therefor the values are incremented here sal_uInt16 nRet = 1; if( pTOXIntl->IsNumeric( sText ) ) @@ -864,7 +863,7 @@ sal_uInt16 SwTOXAuthority::GetLevel() const -----------------------------------------------------------------------*/ static String lcl_GetText(SwFmtFld const& rField) { - return rField.GetFld()->ExpandField(true); + return rField.GetField()->ExpandField(true); } void SwTOXAuthority::GetText_Impl( String& rTxt, String& ) const @@ -878,7 +877,7 @@ void SwTOXAuthority::GetText_Impl( String& rTxt, String& ) const void SwTOXAuthority::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField ) const { - SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld(); + SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetField(); String sText; if(AUTH_FIELD_IDENTIFIER == nAuthField) { @@ -907,8 +906,8 @@ void SwTOXAuthority::FillText( SwTxtNode& rNd, sal_Bool SwTOXAuthority::operator==( const SwTOXSortTabBase& rCmp) { return nType == rCmp.nType && - ((SwAuthorityField*)m_rField.GetFld())->GetHandle() == - ((SwAuthorityField*)((SwTOXAuthority&)rCmp).m_rField.GetFld())->GetHandle(); + ((SwAuthorityField*)m_rField.GetField())->GetHandle() == + ((SwAuthorityField*)((SwTOXAuthority&)rCmp).m_rField.GetField())->GetHandle(); } /* -----------------21.10.99 09:52------------------- @@ -916,15 +915,15 @@ sal_Bool SwTOXAuthority::operator==( const SwTOXSortTabBase& rCmp) sal_Bool SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase) { sal_Bool bRet = sal_False; - SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld(); + SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetField(); SwAuthorityFieldType* pType = (SwAuthorityFieldType*) pField->GetTyp(); if(pType->IsSortByDocument()) bRet = SwTOXSortTabBase::operator<(rBase); else { - SwAuthorityField* pCmpField = (SwAuthorityField*) - ((SwTOXAuthority&)rBase).m_rField.GetFld(); + SwAuthorityField* pCmpField = + (SwAuthorityField*)((SwTOXAuthority&)rBase).m_rField.GetField(); for(sal_uInt16 i = 0; i < pType->GetSortKeyCount(); i++) diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 75823ee0ad27..feee13492942 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -50,17 +50,20 @@ // Konstruktor fuers Default vom Attribut-Pool SwFmtFld::SwFmtFld() - : SfxPoolItem( RES_TXTATR_FIELD ), - SwClient( 0 ), - pField( 0 ), - pTxtAttr( 0 ) + : SfxPoolItem( RES_TXTATR_FIELD ) + , SwClient( 0 ) + , SfxBroadcaster() + , pField( 0 ) + , pTxtAttr( 0 ) { } SwFmtFld::SwFmtFld( const SwField &rFld ) - : SfxPoolItem( RES_TXTATR_FIELD ), - SwClient( rFld.GetTyp() ), - pTxtAttr( 0 ) + : SfxPoolItem( RES_TXTATR_FIELD ) + , SwClient( rFld.GetTyp() ) + , SfxBroadcaster() + , pField( 0 ) + , pTxtAttr( 0 ) { pField = rFld.CopyField(); } @@ -70,14 +73,16 @@ SwFmtFld::SwFmtFld( const SwField &rFld ) // full pool range, all items need to be clonable. Thus, this one needed to be // corrected SwFmtFld::SwFmtFld( const SwFmtFld& rAttr ) - : SfxPoolItem( RES_TXTATR_FIELD ), SwClient(), SfxBroadcaster(), - pField( 0 ), - pTxtAttr( 0 ) + : SfxPoolItem( RES_TXTATR_FIELD ) + , SwClient() + , SfxBroadcaster() + , pField( 0 ) + , pTxtAttr( 0 ) { - if(rAttr.GetFld()) + if(rAttr.GetField()) { - rAttr.GetFld()->GetTyp()->Add(this); - pField = rAttr.GetFld()->CopyField(); + rAttr.GetField()->GetTyp()->Add(this); + pField = rAttr.GetField()->CopyField(); } } @@ -138,13 +143,10 @@ void SwFmtFld::SetFld(SwField * _pField) int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const { ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); - // OD 2004-05-14 #i29146# - correction: check, if <pField> and - // <((SwFmtFld&)rAttr).GetFld()> are set. - // OD 2004-05-14 #i29146# - items are equal, if both fields aren't set. - return ( pField && ((SwFmtFld&)rAttr).GetFld() && - pField->GetTyp() == ((SwFmtFld&)rAttr).GetFld()->GetTyp() && - pField->GetFormat() == ((SwFmtFld&)rAttr).GetFld()->GetFormat() ) || - ( !pField && !((SwFmtFld&)rAttr).GetFld() ); + return ( ( pField && ((SwFmtFld&)rAttr).GetField() + && pField->GetTyp() == ((SwFmtFld&)rAttr).GetField()->GetTyp() + && pField->GetFormat() == ((SwFmtFld&)rAttr).GetField()->GetFormat() ) ) + || ( !pField && !((SwFmtFld&)rAttr).GetField() ); } SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const @@ -167,7 +169,7 @@ void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint ) pPaM->GetPoint()->nNode = rTxtNode; pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *pTxtAttr->GetStart() ); - String const aEntry( GetFld()->ExpandField( pDoc->IsClipBoard() ) ); + String const aEntry( GetField()->ExpandField( pDoc->IsClipBoard() ) ); pPaM->SetMark(); pPaM->Move( fnMoveForward ); pDoc->DeleteRange( *pPaM ); @@ -197,11 +199,11 @@ void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) return; case RES_REFMARKFLD_UPDATE: // GetReferenz-Felder aktualisieren - if( RES_GETREFFLD == GetFld()->GetTyp()->Which() ) + if( RES_GETREFFLD == GetField()->GetTyp()->Which() ) { // --> OD 2007-09-06 #i81002# // ((SwGetRefField*)GetFld())->UpdateField(); - dynamic_cast<SwGetRefField*>(GetFld())->UpdateField( pTxtAttr ); + dynamic_cast<SwGetRefField*>(GetField())->UpdateField( pTxtAttr ); // <-- } break; @@ -219,7 +221,7 @@ void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } } - switch (GetFld()->GetTyp()->Which()) + switch (GetField()->GetTyp()->Which()) { case RES_HIDDENPARAFLD: if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() ) @@ -232,9 +234,9 @@ void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) return; } - if( RES_USERFLD == GetFld()->GetTyp()->Which() ) + if( RES_USERFLD == GetField()->GetTyp()->Which() ) { - SwUserFieldType* pType = (SwUserFieldType*)GetFld()->GetTyp(); + SwUserFieldType* pType = (SwUserFieldType*)GetField()->GetTyp(); if(!pType->IsValid()) { SwCalc aCalc( *pTxtNd->GetDoc() ); @@ -283,7 +285,7 @@ sal_Bool SwFmtFld::IsProtect() const SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos) : SwTxtAttr( rAttr, nStartPos ) - , m_aExpand( rAttr.GetFld()->ExpandField(true) ) + , m_aExpand( rAttr.GetField()->ExpandField(true) ) , m_pTxtNode( 0 ) { rAttr.pTxtAttr = this; @@ -314,9 +316,8 @@ void SwTxtFld::Expand() const // Wenn das expandierte Feld sich nicht veraendert hat, wird returnt ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); - const SwField* pFld = GetFld().GetFld(); - XubString aNewExpand( - pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) ); + const SwField* pFld = GetFmtFld().GetField(); + XubString aNewExpand( pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) ); if( aNewExpand == m_aExpand ) { @@ -345,7 +346,7 @@ void SwTxtFld::Expand() const m_aExpand = aNewExpand; // 0, this for formatting - m_pTxtNode->ModifyNotification( 0, const_cast<SwFmtFld*>( &GetFld() ) ); + m_pTxtNode->ModifyNotification( 0, const_cast<SwFmtFld*>( &GetFmtFld() ) ); } /************************************************************************* @@ -360,8 +361,8 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const IDocumentFieldsAccess* pIDFA = m_pTxtNode->getIDocumentFieldsAccess(); IDocumentFieldsAccess* pDestIDFA = pDest->m_pTxtNode->getIDocumentFieldsAccess(); - SwFmtFld& rFmtFld = (SwFmtFld&)pDest->GetFld(); - const sal_uInt16 nFldWhich = rFmtFld.GetFld()->GetTyp()->Which(); + SwFmtFld& rFmtFld = (SwFmtFld&)pDest->GetFmtFld(); + const sal_uInt16 nFldWhich = rFmtFld.GetField()->GetTyp()->Which(); if( pIDFA != pDestIDFA ) { @@ -374,19 +375,19 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const RES_AUTHORITY != nFldWhich ) pFldType = pDestIDFA->GetSysFldType( nFldWhich ); else - pFldType = pDestIDFA->InsertFldType( *rFmtFld.GetFld()->GetTyp() ); + pFldType = pDestIDFA->InsertFldType( *rFmtFld.GetField()->GetTyp() ); // Sonderbehandlung fuer DDE-Felder if( RES_DDEFLD == nFldWhich ) { if( rFmtFld.GetTxtFld() ) - ((SwDDEFieldType*)rFmtFld.GetFld()->GetTyp())->DecRefCnt(); + ((SwDDEFieldType*)rFmtFld.GetField()->GetTyp())->DecRefCnt(); ((SwDDEFieldType*)pFldType)->IncRefCnt(); } ASSERT( pFldType, "unbekannter FieldType" ); pFldType->Add( &rFmtFld ); // ummelden - rFmtFld.GetFld()->ChgTyp( pFldType ); + rFmtFld.GetField()->ChgTyp( pFldType ); } // Expressionfelder Updaten @@ -398,12 +399,12 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const } // Tabellenfelder auf externe Darstellung else if( RES_TABLEFLD == nFldWhich && - ((SwTblField*)rFmtFld.GetFld())->IsIntrnlName() ) + ((SwTblField*)rFmtFld.GetField())->IsIntrnlName() ) { // erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel const SwTableNode* pTblNd = m_pTxtNode->FindTableNode(); if( pTblNd ) // steht in einer Tabelle - ((SwTblField*)rFmtFld.GetFld())->PtrToBoxNm( &pTblNd->GetTable() ); + ((SwTblField*)rFmtFld.GetField())->PtrToBoxNm( &pTblNd->GetTable() ); } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a7b02ac6f8ff..14c459587f5d 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1310,7 +1310,7 @@ void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt, // TabellenFormel muessen relativ kopiert werden. case RES_TXTATR_FIELD : { - const SwFmtFld& rFld = pHt->GetFld(); + const SwFmtFld& rFld = pHt->GetFmtFld(); if( pOtherDoc ) { static_cast<const SwTxtFld*>(pHt)->CopyFld( @@ -1318,18 +1318,16 @@ void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt, } // Tabellenformel ?? - if( RES_TABLEFLD == rFld.GetFld()->GetTyp()->Which() - && static_cast<const SwTblField*>(rFld.GetFld())->IsIntrnlName()) + if( RES_TABLEFLD == rFld.GetField()->GetTyp()->Which() + && static_cast<const SwTblField*>(rFld.GetField())->IsIntrnlName()) { // wandel die interne in eine externe Formel um const SwTableNode* const pDstTblNd = - static_cast<const SwTxtFld*>(pHt)-> - GetTxtNode().FindTableNode(); + static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode(); if( pDstTblNd ) { SwTblField* const pTblFld = const_cast<SwTblField*>( - static_cast<const SwTblField*>( - pNewHt->GetFld().GetFld())); + static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField())); pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() ); } } @@ -3038,8 +3036,7 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt, if( bExpandFlds ) { const XubString aExpand( - static_cast<SwTxtFld const*>(pAttr)->GetFld() - .GetFld()->ExpandField(true)); + static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()->ExpandField(true)); rTxt.Insert( aExpand, nPos ); nPos = nPos + aExpand.Len(); nEndPos = nEndPos + aExpand.Len(); @@ -3187,8 +3184,7 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, case RES_TXTATR_FIELD: { XubString const aExpand( - static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld() - ->ExpandField(true)); + static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true) ); if( aExpand.Len() ) { aDestIdx++; // dahinter einfuegen; @@ -3285,8 +3281,7 @@ const ModelToViewHelper::ConversionMap* if ( RES_TXTATR_FIELD == pAttr->Which() ) { const XubString aExpand( - static_cast<SwTxtFld const*>(pAttr)->GetFld().GetFld() - ->ExpandField(true)); + static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()->ExpandField(true)); if ( aExpand.Len() > 0 ) { const xub_StrLen nFieldPos = *pAttr->GetStart(); @@ -5079,9 +5074,9 @@ bool SwTxtNode::HasPageNumberField() xub_StrLen nEnd = Len(); for(xub_StrLen nStart=0;nStart<nEnd;nStart++) { - SwTxtFld* pFld = GetTxtFld(nStart); + const SwTxtFld* pFld = GetTxtFld(nStart); const SwField* pSwField = pFld - ? pFld->GetFld().GetFld() + ? pFld->GetFmtFld().GetField() : NULL; const SwFieldType* pType = pSwField ? pSwField->GetTyp() diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index f8885cd22475..451f57ff4348 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1130,7 +1130,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) { // Wenn wir ein HiddenParaField sind, dann muessen wir // ggf. fuer eine Neuberechnung des Visible-Flags sorgen. - const SwField* pFld = pAttr->GetFld().GetFld(); + const SwField* pFld = pAttr->GetFmtFld().GetField(); //JP 06-08-95: DDE-Felder bilden eine Ausnahme ASSERT( RES_DDEFLD == pFld->GetTyp()->Which() || @@ -1160,7 +1160,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) break; case RES_POSTITFLD: { - const_cast<SwFmtFld&>(pAttr->GetFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pAttr)->GetFld(), SWFMTFLD_REMOVED ) ); + const_cast<SwFmtFld&>(pAttr->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pAttr)->GetFmtFld(), SWFMTFLD_REMOVED ) ); break; } } @@ -1435,7 +1435,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // fuer HiddenParaFields Benachrichtigungsmechanismus // anwerfen if( RES_HIDDENPARAFLD == - pAttr->GetFld().GetFld()->GetTyp()->Which() ) + pAttr->GetFmtFld().GetField()->GetTyp()->Which() ) bHiddenPara = sal_True; } break; @@ -2438,7 +2438,7 @@ void SwpHints::CalcFlags() break; case RES_TXTATR_FIELD: { - const SwField* pFld = pAttr->GetFld().GetFld(); + const SwField* pFld = pAttr->GetFmtFld().GetField(); if( RES_DDEFLD == pFld->GetTyp()->Which() ) { m_bDDEFields = true; @@ -2470,10 +2470,10 @@ bool SwpHints::CalcHiddenParaField() if( RES_TXTATR_FIELD == nWhich ) { - const SwFmtFld& rFld = pTxtHt->GetFld(); - if( RES_HIDDENPARAFLD == rFld.GetFld()->GetTyp()->Which() ) + const SwFmtFld& rFld = pTxtHt->GetFmtFld(); + if( RES_HIDDENPARAFLD == rFld.GetField()->GetTyp()->Which() ) { - if( !((SwHiddenParaField*)rFld.GetFld())->IsHidden() ) + if( !((SwHiddenParaField*)rFld.GetField())->IsHidden() ) { SetHiddenParaField(false); return bOldHasHiddenParaField != bNewHasHiddenParaField; @@ -2706,7 +2706,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, sal_Bool bDelFirst = 0 != ((SwTxtFld*)pHint)->GetpTxtNode(); ((SwTxtFld*)pHint)->ChgTxtNode( &rNode ); SwDoc* pDoc = rNode.GetDoc(); - const SwField* pFld = ((SwTxtFld*)pHint)->GetFld().GetFld(); + const SwField* pFld = ((SwTxtFld*)pHint)->GetFmtFld().GetField(); if( !pDoc->IsNewFldLst() ) { @@ -2750,10 +2750,9 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, pDoc->InsertFldType( *pFld->GetTyp() ); if( pFldType != pFld->GetTyp() ) { - SwFmtFld* pFmtFld = (SwFmtFld*)&((SwTxtFld*)pHint) - ->GetFld(); + SwFmtFld* pFmtFld = (SwFmtFld*)&((SwTxtFld*)pHint)->GetFmtFld(); pFmtFld->RegisterToFieldType( *pFldType ); - pFmtFld->GetFld()->ChgTyp( pFldType ); + pFmtFld->GetField()->ChgTyp( pFldType ); } pFldType->SetSeqRefNo( *(SwSetExpField*)pFld ); } @@ -2770,7 +2769,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, case RES_POSTITFLD: if ( pDoc->GetDocShell() ) - pDoc->GetDocShell()->Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFld(), SWFMTFLD_INSERTED ) ); + pDoc->GetDocShell()->Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_INSERTED ) ); break; } if( bInsFldType ) @@ -2972,7 +2971,7 @@ void SwpHints::DeleteAtPos( const sal_uInt16 nPos ) if( RES_TXTATR_FIELD == pHint->Which() ) { - SwFieldType* pFldTyp = ((SwTxtFld*)pHint)->GetFld().GetFld()->GetTyp(); + const SwFieldType* pFldTyp = ((SwTxtFld*)pHint)->GetFmtFld().GetField()->GetTyp(); if( RES_DDEFLD == pFldTyp->Which() ) { const SwTxtNode* pNd = ((SwTxtFld*)pHint)->GetpTxtNode(); @@ -2982,7 +2981,7 @@ void SwpHints::DeleteAtPos( const sal_uInt16 nPos ) } else if( RES_POSTITFLD == pFldTyp->Which() ) { - const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFld(), SWFMTFLD_REMOVED ) ); + const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_REMOVED ) ); } else if ( m_bHasHiddenParaField && RES_HIDDENPARAFLD == pFldTyp->Which() ) @@ -3125,7 +3124,7 @@ sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr ) // #i78149: PostIt fields should not break words for spell and grammar checking if (rAttr.Which() == RES_TXTATR_FIELD && - RES_POSTITFLD == rAttr.GetFld().GetFld()->GetTyp()->Which()) + RES_POSTITFLD == rAttr.GetFmtFld().GetField()->GetTyp()->Which()) cRet = CH_TXTATR_INWORD; } break; diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 3f0cfca81170..77469bd83a80 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -394,26 +394,25 @@ inline sal_Bool InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) { * -> nothing to do */ -void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, - const SfxItemSet* pSet, sal_Bool bInclRefToxMark ) +void SwTxtNode::RstAttr( + const SwIndex &rIdx, + const xub_StrLen nLen, + const sal_uInt16 nWhich, + const SfxItemSet* pSet, + const sal_Bool bInclRefToxMark ) { - // Attribute? if ( !GetpSwpHints() ) return; - sal_uInt16 i = 0; - xub_StrLen nStt = rIdx.GetIndex(); - xub_StrLen nEnd = nStt + nLen; - xub_StrLen nAttrStart; - SwTxtAttr *pHt; + const xub_StrLen nStt = rIdx.GetIndex(); + const xub_StrLen nEnd = nStt + nLen; - sal_Bool bChanged = sal_False; + bool bChanged = false; // nMin and nMax initialized to maximum / minimum (inverse) xub_StrLen nMin = m_Text.Len(); xub_StrLen nMax = nStt; - - const sal_Bool bNoLen = !nMin; + const bool bNoLen = nMin == 0; // We have to remember the "new" attributes, which have // been introduced by splitting surrounding attributes (case 4). @@ -422,15 +421,27 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, // iterate over attribute array until start of attribute is behind // deletion range + sal_uInt16 i = 0; + xub_StrLen nAttrStart; + SwTxtAttr *pHt = NULL; while ((i < m_pSwpHints->Count()) && ((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) ) { pHt = m_pSwpHints->GetTextHint(i); // attributes without end stay in! - xub_StrLen * const pAttrEnd = pHt->GetEnd(); - if ( !pAttrEnd /*|| pHt->HasDummyChar()*/ ) // see bInclRefToxMark + // but consider <bInclRefToxMark> used by Undo + xub_StrLen* const pAttrEnd = pHt->GetEnd(); + const bool bKeepAttrWithoutEnd = + pAttrEnd == NULL + && ( !bInclRefToxMark + || ( RES_TXTATR_REFMARK != pHt->Which() + && RES_TXTATR_TOXMARK != pHt->Which() + && RES_TXTATR_META != pHt->Which() + && RES_TXTATR_METAFIELD != pHt->Which() ) ); + if ( bKeepAttrWithoutEnd ) { + i++; continue; } @@ -480,21 +491,22 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if( nStt <= nAttrStart ) // Faelle: 1,3,5 { + const xub_StrLen nAttrEnd = pAttrEnd != NULL + ? *pAttrEnd + : nAttrStart; if( nEnd > nAttrStart - || ( nEnd == *pAttrEnd && nEnd==nAttrStart ) ) + || ( nEnd == nAttrEnd && nEnd == nAttrStart ) ) { // Faelle: 1,3 if ( nMin > nAttrStart ) nMin = nAttrStart; - if ( nMax < *pAttrEnd ) - nMax = *pAttrEnd; + if ( nMax < nAttrEnd ) + nMax = nAttrEnd; // Falls wir nur ein nichtaufgespanntes Attribut entfernen, // tun wir mal so, als ob sich nichts geaendert hat. bChanged = bChanged || nEnd > nAttrStart || bNoLen; - if( *pAttrEnd <= nEnd ) // Fall: 1 + if( nAttrEnd <= nEnd ) // Fall: 1 { - const xub_StrLen nAttrEnd = *pAttrEnd; - m_pSwpHints->DeleteAtPos(i); DestroyAttr( pHt ); @@ -505,8 +517,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } - // if the last attribute is a Field, the HintsArray is - // deleted! + // if the last attribute is a Field, the HintsArray is deleted! if ( !m_pSwpHints ) break; @@ -520,7 +531,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, continue; } - else // Fall: 3 + else // Fall: 3 { m_pSwpHints->NoteInHistory( pHt ); *pHt->GetStart() = nEnd; @@ -533,20 +544,21 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } - bChanged = sal_True; + bChanged = true; } } } - else // Faelle: 2,4,5 + else if ( pAttrEnd != NULL ) // Faelle: 2,4,5 + { if( *pAttrEnd > nStt ) // Faelle: 2,4 { - if( *pAttrEnd < nEnd ) // Fall: 2 + if( *pAttrEnd < nEnd ) // Fall: 2 { if ( nMin > nAttrStart ) nMin = nAttrStart; if ( nMax < *pAttrEnd ) nMax = *pAttrEnd; - bChanged = sal_True; + bChanged = true; const xub_StrLen nAttrEnd = *pAttrEnd; @@ -557,18 +569,19 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if ( pStyleHandle.get() ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - *pStyleHandle, nStt, nAttrEnd ); + *pStyleHandle, nStt, nAttrEnd ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } } - else if( nLen ) // Fall: 4 - { // bei Lange 0 werden beide Hints vom Insert(Ht) - // wieder zu einem zusammengezogen !!!! + else if( nLen ) // Fall: 4 + { + // bei Lange 0 werden beide Hints vom Insert(Ht) + // wieder zu einem zusammengezogen !!!! if ( nMin > nAttrStart ) nMin = nAttrStart; if ( nMax < *pAttrEnd ) nMax = *pAttrEnd; - bChanged = sal_True; + bChanged = true; xub_StrLen nTmpEnd = *pAttrEnd; m_pSwpHints->NoteInHistory( pHt ); *pAttrEnd = nStt; @@ -577,14 +590,14 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if ( pStyleHandle.get() && nStt < nEnd ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - *pStyleHandle, nStt, nEnd ); + *pStyleHandle, nStt, nEnd ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } if( nEnd < nTmpEnd ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - pHt->GetAttr(), nEnd, nTmpEnd ); + pHt->GetAttr(), nEnd, nTmpEnd ); if ( pNew ) { SwTxtCharFmt* pCharFmt = dynamic_cast<SwTxtCharFmt*>(pHt); @@ -602,7 +615,8 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, } } } - ++i; + ++i; + } } TryDeleteSwpHints(); diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index c67b44c1bdd8..2f04cad7266b 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -82,7 +82,7 @@ SwUndoFieldFromDoc::~SwUndoFieldFromDoc() void SwUndoFieldFromDoc::UndoImpl(::sw::UndoRedoContext &) { SwTxtFld * pTxtFld = SwDoc::GetTxtFld(GetPosition()); - const SwField * pField = pTxtFld->GetFld().GetFld(); + const SwField * pField = pTxtFld->GetFmtFld().GetField(); if (pField) { @@ -93,14 +93,14 @@ void SwUndoFieldFromDoc::UndoImpl(::sw::UndoRedoContext &) void SwUndoFieldFromDoc::DoImpl() { SwTxtFld * pTxtFld = SwDoc::GetTxtFld(GetPosition()); - const SwField * pField = pTxtFld->GetFld().GetFld(); + const SwField * pField = pTxtFld->GetFmtFld().GetField(); if (pField) { pDoc->UpdateFld(pTxtFld, *pNewField, pHnt, bUpdate); - SwFmtFld* pDstFmtFld = (SwFmtFld*)&pTxtFld->GetFld(); + SwFmtFld* pDstFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld(); - if ( pDoc->GetFldType(RES_POSTITFLD, aEmptyStr,false) == pDstFmtFld->GetFld()->GetTyp() ) + if ( pDoc->GetFldType(RES_POSTITFLD, aEmptyStr,false) == pDstFmtFld->GetField()->GetTyp() ) pDoc->GetDocShell()->Broadcast( SwFmtFldHint( pDstFmtFld, SWFMTFLD_INSERTED ) ); } } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index c277432fb06b..ae10840fba5d 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -266,20 +266,20 @@ void SwHistorySetTxt::SetInDoc( SwDoc* pDoc, bool ) SwHistorySetTxtFld::SwHistorySetTxtFld( SwTxtFld* pTxtFld, sal_uLong nNodePos ) : SwHistoryHint( HSTRY_SETTXTFLDHNT ) , m_pFldType( 0 ) - , m_pFld( new SwFmtFld( *pTxtFld->GetFld().GetFld() ) ) + , m_pFld( new SwFmtFld( *pTxtFld->GetFmtFld().GetField() ) ) { // only copy if not Sys-FieldType SwDoc* pDoc = pTxtFld->GetTxtNode().GetDoc(); - m_nFldWhich = m_pFld->GetFld()->GetTyp()->Which(); + m_nFldWhich = m_pFld->GetField()->GetTyp()->Which(); if (m_nFldWhich == RES_DBFLD || m_nFldWhich == RES_USERFLD || m_nFldWhich == RES_SETEXPFLD || m_nFldWhich == RES_DDEFLD || !pDoc->GetSysFldType( m_nFldWhich )) { - m_pFldType.reset( m_pFld->GetFld()->GetTyp()->Copy() ); - m_pFld->GetFld()->ChgTyp( m_pFldType.get() ); // change field type + m_pFldType.reset( m_pFld->GetField()->GetTyp()->Copy() ); + m_pFld->GetField()->ChgTyp( m_pFldType.get() ); // change field type } m_nNodeIndex = nNodePos; m_nPos = *pTxtFld->GetStart(); @@ -287,7 +287,7 @@ SwHistorySetTxtFld::SwHistorySetTxtFld( SwTxtFld* pTxtFld, sal_uLong nNodePos ) String SwHistorySetTxtFld::GetDescription() const { - return m_pFld->GetFld()->GetDescription();; + return m_pFld->GetField()->GetDescription();; } SwHistorySetTxtFld::~SwHistorySetTxtFld() @@ -311,7 +311,7 @@ void SwHistorySetTxtFld::SetInDoc( SwDoc* pDoc, bool ) pNewFldType = pDoc->InsertFldType( *m_pFldType ); } - m_pFld->GetFld()->ChgTyp( pNewFldType ); // change field type + m_pFld->GetField()->ChgTyp( pNewFldType ); // change field type SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); ASSERT( pTxtNd, "SwHistorySetTxtFld: no TextNode" ); diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 8dfd472f1322..57a7d7313c13 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -243,14 +243,12 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) { { RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx, - SwIndex( pTxtNode, pTxtNode->GetTxt().Len() ))); + SwIndex( pTxtNode, pTxtNode->GetTxt().Len() ))); } pTxtNode->JoinNext(); } // reset all text attributes in the paragraph! - //i121897, change the hints clearing method from 'RstAttr' to 'ClarSwpHints' as the certain tox mark index hint reason - if( pTxtNode && pTxtNode->GetpSwpHints() ) - pTxtNode->ClearSwpHintsArr( true ); + pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true ); // setze alle Attribute im Node zurueck pTxtNode->ResetAllAttr(); diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 6dc3e0ff2ada..bc55a0a9ea6c 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -64,7 +64,7 @@ #include <unochart.hxx> #include <comphelper/makesequence.hxx> #include <comphelper/sequence.hxx> -#include <slist> +#include <list> #include <iterator> #include <unosection.hxx> #include <unoparagraph.hxx> @@ -826,7 +826,7 @@ namespace : public SwSimpleEnumeration_Base { private: - typedef ::std::slist< Any > frmcontainer_t; + typedef ::std::list< Any > frmcontainer_t; frmcontainer_t m_aFrames; protected: virtual ~SwXFrameEnumeration() {}; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 3185d44a028e..c53a8e6264e9 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -382,8 +382,8 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry { if( pAny ) { - SwXTextField* pField = SwXTextField::CreateSwXTextField(*rPam.GetDoc(), - pTxtAttr->GetFld()); + SwXTextField* pField = + SwXTextField::CreateSwXTextField( *rPam.GetDoc(),pTxtAttr->GetFmtFld() ); *pAny <<= uno::Reference< XTextField >( pField ); } } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 3695b061c20a..b394acefbba4 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -80,7 +80,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <com/sun/star/drawing/PointSequence.hpp> #include <vcl/svapp.hxx> -#include <slist> +#include <list> #include <iterator> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> @@ -410,7 +410,7 @@ namespace : public SwSimpleEnumeration_Base { private: - typedef ::std::slist< ::com::sun::star::uno::Any > shapescontainer_t; + typedef ::std::list< ::com::sun::star::uno::Any > shapescontainer_t; shapescontainer_t m_aShapes; protected: virtual ~SwXShapesEnumeration() {}; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index fe787ea6c6df..db1b868bf283 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1001,7 +1001,7 @@ OUString SwXFieldMaster::LocalizeFormula( SwXTextField* SwXTextField::CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt) { - SwIterator<SwXTextField,SwFieldType> aIter(*rFmt.GetFld()->GetTyp()); + SwIterator<SwXTextField,SwFieldType> aIter(*rFmt.GetField()->GetTyp()); SwXTextField * pField = 0; SwXTextField * pTemp = aIter.First(); while (pTemp) @@ -1113,7 +1113,7 @@ SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc) : m_pTextObject(0), m_bIsDescriptor(sal_False), m_bCallUpdate(sal_False), - m_nServiceId( lcl_GetServiceForField( *pFmtFld->GetFld() ) ), + m_nServiceId( lcl_GetServiceForField( *pFmtFld->GetField() ) ), m_pProps(0) { pDc->GetUnoCallBack()->Add(this); @@ -1165,7 +1165,7 @@ uno::Reference< beans::XPropertySet > SwXTextField::getTextFieldMaster(void) th { if(!GetRegisteredIn()) throw uno::RuntimeException(); - pType = pFmtFld->GetFld()->GetTyp(); + pType = pFmtFld->GetField()->GetTyp(); } SwXFieldMaster* pMaster = SwIterator<SwXFieldMaster,SwFieldType>::FirstElement( *pType ); @@ -1745,7 +1745,7 @@ void SwXTextField::attachToRange( // was passiert mit dem Update der Felder ? (siehe fldmgr.cxx) if(pTxtAttr) { - const SwFmtFld& rFld = pTxtAttr->GetFld(); + const SwFmtFld& rFld = pTxtAttr->GetFmtFld(); pFmtFld = &rFld; } } @@ -2363,8 +2363,10 @@ void SwXTextField::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) const SwField* SwXTextField::GetField() const { - if(GetRegisteredIn() && pFmtFld) - return pFmtFld->GetFld(); + if ( GetRegisteredIn() && pFmtFld ) + { + return pFmtFld->GetField(); + } return 0; } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 78e3f76d30af..edd295269c2b 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -757,7 +757,7 @@ lcl_ExportHints( xRef = pPortion = new SwXTextPortion( pUnoCrsr, xParent, PORTION_FIELD); Reference<XTextField> xField = - SwXTextField::CreateSwXTextField(*pDoc, pAttr->GetFld()); + SwXTextField::CreateSwXTextField(*pDoc, pAttr->GetFmtFld()); pPortion->SetTextField(xField); } break; diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 9d4b88e27c40..13d8e2b9a7c7 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2167,7 +2167,7 @@ lcl_ApplyCellProperties( { xCellPS->setPropertyValue(rName, rValue); } - catch (uno::Exception const& e) + catch (uno::Exception const& ) { // Apply the paragraph and char properties to the cell's content const uno::Reference< text::XText > xCellText(xCell, diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 475c1d8ae18a..14ee0f4a9133 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -666,10 +666,13 @@ sal_Bool ViewShell::IsAnyFieldInDoc() const { const SwFmtFld* pFmtFld = (SwFmtFld*)pItem; const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); - //#i101026# mod: do not include postits in field check - const SwField* pFld = pFmtFld->GetFld(); - if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() && (pFld->Which() != RES_POSTITFLD)) + // do not include postits in field check + const SwField* pFld = pFmtFld->GetField(); + if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() + && (pFld->Which() != RES_POSTITFLD)) + { return sal_True; + } } return sal_False; } diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 40fbe86357b2..bbba284dbf11 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -120,8 +120,8 @@ sal_Bool SwASC_AttrIter::OutAttr( xub_StrLen nSwPos ) switch( pHt->Which() ) { case RES_TXTATR_FIELD: - sOut = static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld() - ->ExpandField(true); + sOut = + static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true); break; case RES_TXTATR_FTN: diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 5b4a6aae6e6b..ab005119c1e6 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3746,6 +3746,8 @@ SwAttrFnTab aCSS1AttrFnTab = { /* RES_CHRATR_OVERLINE */ OutCSS1_SvxOverline, /* RES_CHRATR_DUMMY1 */ 0, /* RES_CHRATR_DUMMY2 */ 0, +/* RES_CHRATR_BIDIRTL */ 0, +/* RES_CHRATR_IDCTHINT */ 0, /* RES_TXTATR_REFMARK */ 0, /* RES_TXTATR_TOXMARK */ 0, @@ -3775,9 +3777,9 @@ SwAttrFnTab aCSS1AttrFnTab = { /* RES_PARATR_HYPHENZONE*/ 0, /* RES_PARATR_DROP */ OutCSS1_SwFmtDrop, /* RES_PARATR_REGISTER */ 0, // neu: Registerhaltigkeit -/* RES_PARATR_NUMRULE */ 0, // Dummy: -/* RES_PARATR_SCRIPTSPACE */ 0, // Dummy: -/* RES_PARATR_HANGINGPUNCTUATION */ 0, // Dummy: +/* RES_PARATR_NUMRULE */ 0, +/* RES_PARATR_SCRIPTSPACE */ 0, +/* RES_PARATR_HANGINGPUNCTUATION */ 0, /* RES_PARATR_FORBIDDEN_RULES */ 0, // new /* RES_PARATR_VERTALIGN */ 0, // new /* RES_PARATR_SNAPTOGRID*/ 0, // new @@ -3824,13 +3826,13 @@ SwAttrFnTab aCSS1AttrFnTab = { /* RES_COLUMNBALANCE */ 0, /* RES_FRAMEDIR */ OutCSS1_SvxFrameDirection, /* RES_HEADER_FOOTER_EAT_SPACING */ 0, -/* RES_FRMATR_DUMMY9 */ 0, // Dummy: +/* RES_ROW_SPLIT */ 0, /* RES_FOLLOW_TEXT_FLOW */ 0, +/* RES_COLLAPSING_BORDERS */ 0, /* RES_WRAP_INFLUENCE_ON_OBJPOS */ 0, -/* RES_FRMATR_DUMMY2 */ 0, // Dummy: -/* RES_AUTO_STYLE */ 0, // Dummy: -/* RES_FRMATR_DUMMY4 */ 0, // Dummy: -/* RES_FRMATR_DUMMY5 */ 0, // Dummy: +/* RES_AUTO_STYLE */ 0, +/* RES_FRMATR_STYLE_NAME */ 0, +/* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0, /* RES_GRFATR_MIRRORGRF */ 0, /* RES_GRFATR_CROPGRF */ 0, diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index f73c10c11b68..910b661aad55 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2588,7 +2588,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) pTxtHt = pHt; sal_uInt16 nFldWhich; if( RES_TXTATR_FIELD != pHt->Which() || - ( RES_POSTITFLD != (nFldWhich = ((const SwFmtFld&)pHt->GetAttr()).GetFld()->Which()) && + ( RES_POSTITFLD != (nFldWhich = ((const SwFmtFld&)pHt->GetAttr()).GetField()->Which()) && RES_SCRIPTFLD != nFldWhich ) ) bWriteBreak = sal_False; } diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 423ca26369d4..5e9edb25cdbf 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -643,8 +643,7 @@ void SwHTMLParser::InsertComment( const String& rComment, const sal_Char *pTag ) break; if( RES_TXTATR_FIELD == pAttr->pItem->Which() && - RES_SCRIPTFLD == ((const SwFmtFld *)pAttr->pItem)->GetFld() - ->GetTyp()->Which() ) + RES_SCRIPTFLD == ((const SwFmtFld *)pAttr->pItem)->GetField()->GetTyp()->Which() ) { bMoveFwd = sal_False; break; diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 5d7908a73324..8d82456fb17d 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -422,7 +422,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) { SwFmtFld & rFld = (SwFmtFld&)rHt; - const SwField* pFld = rFld.GetFld(); + const SwField* pFld = rFld.GetField(); const SwFieldType* pFldTyp = pFld->GetTyp(); if( RES_SETEXPFLD == pFldTyp->Which() && diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 2f9c6c8d5f35..51a6442d6708 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2779,8 +2779,9 @@ void SwHTMLParser::_SetAttr( sal_Bool bChkEnd, sal_Bool bBeforeTable, case RES_TXTATR_FIELD: { sal_uInt16 nFldWhich = - pPostIts ? ((const SwFmtFld *)pAttr->pItem) - ->GetFld()->GetTyp()->Which() : 0; + pPostIts + ? ((const SwFmtFld *)pAttr->pItem)->GetField()->GetTyp()->Which() + : 0; if( pPostIts && (RES_POSTITFLD == nFldWhich || RES_SCRIPTFLD == nFldWhich) ) { diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index bad5aac6bc11..14bd9bd9b0c3 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -897,8 +897,8 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs() if( nPos-nOldPos > 1 || RES_TXTATR_FIELD != pHt->Which() ) break; - sal_uInt16 nFldWhich = ((const SwFmtFld&)pHt->GetAttr()).GetFld() - ->GetTyp()->Which(); + const sal_uInt16 nFldWhich = + ((const SwFmtFld&)pHt->GetAttr()).GetField()->GetTyp()->Which(); if( RES_POSTITFLD!=nFldWhich && RES_SCRIPTFLD!=nFldWhich ) break; diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index cb5d4716d8d2..408f2614ec26 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -1056,7 +1056,7 @@ void SwRTFParser::ReadField() if (pFldAttr) { - const SwField *pFld = pFldAttr->GetFld().GetFld(); + const SwField *pFld = pFldAttr->GetFmtFld().GetField(); SwFieldType *pTyp = pFld ? pFld->GetTyp() : 0; ASSERT(pTyp->Which() == RES_USERFLD, "expected a user field"); if (pTyp->Which() == RES_USERFLD) diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index a6a1cb57a4ba..baa3eb80a87e 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -2289,8 +2289,13 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) SwTxtNode* pTxtNd = pDoc->GetNodes()[ n ]->GetTxtNode(); if( pTxtNd ) { - pTxtNd->SetAttr( - *GetDfltAttr(RES_PARATR_NUMRULE)); + pTxtNd->SetAttr( *GetDfltAttr(RES_PARATR_NUMRULE) ); + // reset all list attributes + pTxtNd->ResetAttr( RES_PARATR_LIST_LEVEL ); + pTxtNd->ResetAttr( RES_PARATR_LIST_ISRESTART ); + pTxtNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE ); + pTxtNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); + pTxtNd->ResetAttr( RES_PARATR_LIST_ID ); } } } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 806787055d93..7616c90c4ca8 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -878,13 +878,13 @@ bool MSWordExportBase::HasRefToObject( sal_uInt16 nTyp, const String* pName, sal SwFieldType* pType = pDoc->GetSysFldType( RES_GETREFFLD ); SwIterator<SwFmtFld, SwFieldType> aFmtFlds( *pType ); - for ( SwFmtFld* pFld = aFmtFlds.First(); pFld; pFld = aFmtFlds.Next() ) + for ( SwFmtFld* pFmtFld = aFmtFlds.First(); pFmtFld; pFmtFld = aFmtFlds.Next() ) { - if ( pFld->GetTxtFld() && nTyp == pFld->GetFld()->GetSubType() && - 0 != ( pNd = pFld->GetTxtFld()->GetpTxtNode() ) && + if ( pFmtFld->GetTxtFld() && nTyp == pFmtFld->GetField()->GetSubType() && + 0 != ( pNd = pFmtFld->GetTxtFld()->GetpTxtNode() ) && pNd->GetNodes().IsDocNodes() ) { - const SwGetRefField& rRFld = *static_cast< SwGetRefField* >( pFld->GetFld() ); + const SwGetRefField& rRFld = *static_cast< SwGetRefField* >( pFmtFld->GetField() ); switch ( nTyp ) { case REF_BOOKMARK: @@ -2616,7 +2616,7 @@ void WW8AttributeOutput::WriteExpand( const SwField* pFld ) void AttributeOutputBase::TextField( const SwFmtFld& rField ) { - const SwField* pFld = rField.GetFld(); + const SwField* pFld = rField.GetField(); String sStr; // fuer optionale Parameter bool bWriteExpand = false; sal_uInt16 nSubType = pFld->GetSubType(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 4c6c089a7da9..2e75bd06defc 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1421,7 +1421,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetStackAttr(const SwPosition& rPos, bool SwWW8FltRefStack::IsFtnEdnBkmField(const SwFmtFld& rFmtFld, sal_uInt16& rBkmNo) { - const SwField* pFld = rFmtFld.GetFld(); + const SwField* pFld = rFmtFld.GetField(); sal_uInt16 nSubType; if(pFld && (RES_GETREFFLD == pFld->Which()) && ((REF_FOOTNOTE == (nSubType = pFld->GetSubType())) || (REF_ENDNOTE == nSubType)) @@ -1456,7 +1456,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, SwPaM aPaM(aIdx, pEntry->nMkCntnt); SwFmtFld& rFmtFld = *(SwFmtFld*)pEntry->pAttr; - SwField* pFld = rFmtFld.GetFld(); + SwField* pFld = rFmtFld.GetField(); if (!RefToVar(pFld,pEntry)) { @@ -4696,42 +4696,43 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) delete mpRedlineStack; DeleteAnchorStk(); DeleteRefStks(); + //For i120928,achieve the graphics from the special bookmark with is for graphic bullet { std::vector<const SwGrfNode*> vecBulletGrf; std::vector<SwFrmFmt*> vecFrmFmt; IDocumentMarkAccess* const pMarkAccess = - rDoc.getIDocumentMarkAccess(); + rDoc.getIDocumentMarkAccess(); if ( pMarkAccess ) { - IDocumentMarkAccess::const_iterator_t ppBkmk = - pMarkAccess->findBookmark( C2U("_PictureBullets") ); - //for(IDocumentMarkAccess::const_iterator_t ppBookmark = ppBkmk->begin(); - // ppBookmark != ppBkmk->end(); ppBookmark++) - if ( ppBkmk != pMarkAccess->getBookmarksEnd() && - IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) - == IDocumentMarkAccess::BOOKMARK ) - { + IDocumentMarkAccess::const_iterator_t ppBkmk = + pMarkAccess->findBookmark( C2U("_PictureBullets") ); + if ( ppBkmk != pMarkAccess->getBookmarksEnd() + && IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) == IDocumentMarkAccess::BOOKMARK ) + { SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode(); - if ( pTxtNode ) + if ( pTxtNode ) { - const SwpHints *pHints = pTxtNode->GetpSwpHints(); - for(int nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos) + const SwpHints* pHints = pTxtNode->GetpSwpHints(); + for( sal_uInt16 nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos) { const SwTxtAttr *pHt = (*pHints)[nHintPos]; - xub_StrLen st = *(pHt->GetStart()); - if(pHt && pHt->Which() == RES_TXTATR_FLYCNT && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex())) + const xub_StrLen st = *(pHt->GetStart()); + if( pHt + && pHt->Which() == RES_TXTATR_FLYCNT + && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex()) ) { - SwFrmFmt *pFrmFmt = pHt->GetFlyCnt().GetFrmFmt(); - const SwNodeIndex *pNdIdx = pFrmFmt->GetCntnt().GetCntntIdx(); - const SwNodes &nos = pNdIdx->GetNodes(); - const SwGrfNode *pGrf = dynamic_cast<const SwGrfNode*>(nos[pNdIdx->GetIndex() + 1]); - if (pGrf) - { - vecBulletGrf.push_back(pGrf); - vecFrmFmt.push_back(pFrmFmt); - } + SwFrmFmt* pFrmFmt = pHt->GetFlyCnt().GetFrmFmt(); + vecFrmFmt.push_back(pFrmFmt); + const SwNodeIndex* pNdIdx = pFrmFmt->GetCntnt().GetCntntIdx(); + const SwNodes* pNodesArray = (pNdIdx != NULL) + ? &(pNdIdx->GetNodes()) + : NULL; + const SwGrfNode *pGrf = (pNodesArray != NULL) + ? dynamic_cast<const SwGrfNode*>((*pNodesArray)[pNdIdx->GetIndex() + 1]) + : NULL; + vecBulletGrf.push_back(pGrf); } } // update graphic bullet information @@ -4742,14 +4743,16 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) for (sal_uInt16 j = 0; j < MAXLEVEL; ++j) { SwNumFmt aNumFmt(pRule->Get(j)); - sal_Int16 nType = aNumFmt.GetNumberingType(); - sal_uInt16 nGrfBulletCP = aNumFmt.GetGrfBulletCP(); - if (nType == SVX_NUM_BITMAP && vecBulletGrf.size() > nGrfBulletCP) + const sal_Int16 nType = aNumFmt.GetNumberingType(); + const sal_uInt16 nGrfBulletCP = aNumFmt.GetGrfBulletCP(); + if ( nType == SVX_NUM_BITMAP + && vecBulletGrf.size() > nGrfBulletCP + && vecBulletGrf[nGrfBulletCP] != NULL ) { Graphic aGraphic = vecBulletGrf[nGrfBulletCP]->GetGrf(); SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH); Font aFont = numfunc::GetDefBulletFont(); - int nHeight = aFont.GetHeight() * 12;//20; + int nHeight = aFont.GetHeight() * 12; Size aPrefSize( aGraphic.GetPrefSize()); if (aPrefSize.Height() * aPrefSize.Width() != 0 ) { diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index c71b27ee34c2..12052d8bf316 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -944,8 +944,9 @@ namespace { for ( sal_Int32 i = 0; i <= nMaxIndex; ++i ) { if ( pPLCFPosArray[i] < 0 - && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -63488 ) // pPLCFPosArray[nMaxIndex-1]==-63488 seems to be allowed - && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -65536 ) ) // pPLCFPosArray[nMaxIndex-1]==-65536 seems to be allowed + && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -63488 ) // pPLCFPosArray[nMaxIndex-1]==-63488 (0xffff0800) seems to be allowed + && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -65536 ) // pPLCFPosArray[nMaxIndex-1]==-65536 (0xffff0000) seems to be allowed + && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -61440 ) ) // pPLCFPosArray[nMaxIndex-1]==-61440 (0xffff112c) seems to be allowed { bIsValid = false; break; diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index e323c558cc46..037d69384cd3 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -64,10 +64,7 @@ #include <vcl/svapp.hxx> #include <vos/mutex.hxx> -// --> OD 2007-03-30 #i73788# #include <pausethreadstarting.hxx> -// <-- - using ::rtl::OUString; using namespace ::com::sun::star; @@ -534,7 +531,48 @@ void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps) { Reference< XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY ); if( xProps.is() ) - SvXMLUnitConverter::convertPropertySet( rProps, xProps ); + { + // property CurrentDatabaseDataSource needs to be exported before CurrentDatabaseCommand and CurrentDatabaseCommandType + // in order to assure that AOO/OOo versions (before AOO 4.0.1) are able to apply the current database settings correct + // Thus, put CurrentDatabaseDataSource as the first one into the Sequence +// SvXMLUnitConverter::convertPropertySet( rProps, xProps ); + uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo(); + if (xPropertySetInfo.is()) + { + uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties(); + const sal_Int32 nCount(aProps.getLength()); + if (nCount) + { + rProps.realloc(nCount); + beans::PropertyValue* pProps = rProps.getArray(); + + static ::rtl::OUString csCurrentDatabaseSource = ::rtl::OUString::createFromAscii("CurrentDatabaseDataSource"); + const sal_Bool bHasCurrentDatabaseSource = xPropertySetInfo->hasPropertyByName( csCurrentDatabaseSource ); + if ( bHasCurrentDatabaseSource ) + { + beans::Property aProp = xPropertySetInfo->getPropertyByName( csCurrentDatabaseSource ); + pProps->Name = aProp.Name; + pProps->Value = xProps->getPropertyValue(aProp.Name); + ++pProps; + } + + for (sal_Int32 i = 0; i < nCount; i++ ) + { + if ( bHasCurrentDatabaseSource + && aProps[i].Name.compareTo( csCurrentDatabaseSource ) == 0 ) + { + // nothing to do - already added as first item - see above + } + else + { + pProps->Name = aProps[i].Name; + pProps->Value = xProps->getPropertyValue(aProps[i].Name); + ++pProps; + } + } + } + } + } } } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index b356122573f3..b104923237e4 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1163,7 +1163,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( !xInfo.is() ) return; - // #111955# hash_set< String, StringHashRef, StringEqRef > aSet; aSet.insert(String("ForbiddenCharacters", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("IsKernAsianPunctuation", RTL_TEXTENCODING_ASCII_US)); @@ -1189,16 +1188,14 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC aSet.insert(String("PrintSingleJobs", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("UpdateFromTemplate", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US)); - // --> FME 2005-12-13 #b6354161# aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US)); - // <-- sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); SvtSaveOptions aSaveOpt; - sal_Bool bIsUserSetting = aSaveOpt.IsLoadUserSettings(), - bSet = bIsUserSetting; + sal_Bool bIsUserSetting = aSaveOpt.IsLoadUserSettings(); + sal_Bool bSet = bIsUserSetting; // for some properties we don't want to use the application // default if they're missing. So we watch for them in the loop @@ -1221,7 +1218,16 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bUnixForceZeroExtLeading = false; bool bUseOldPrinterMetrics = false; - OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); + static const OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); + + // Set current database properties in certain order + // Thus, keep these properties during loop and set them afterwards in valid order + static const OUString sCurrentDatabaseDataSource( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseDataSource" ) ); + uno::Any aCurrentDatabaseDataSource; + static const OUString sCurrentDatabaseCommand( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommand" ) ); + uno::Any aCurrentDatabaseCommand; + static const OUString sCurrentDatabaseCommandType( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommandType" ) ); + uno::Any aCurrentDatabaseCommandType; while( nCount-- ) { @@ -1245,10 +1251,24 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC pValues->Value >>= aKey; GetTextImport()->SetChangesProtectionKey( aKey ); } + else if ( !aCurrentDatabaseDataSource.hasValue() + && pValues->Name.equals( sCurrentDatabaseDataSource ) ) + { + aCurrentDatabaseDataSource = pValues->Value; + } + else if ( !aCurrentDatabaseCommand.hasValue() + && pValues->Name.equals( sCurrentDatabaseCommand ) ) + { + aCurrentDatabaseCommand = pValues->Value; + } + else if ( !aCurrentDatabaseCommandType.hasValue() + && pValues->Name.equals( sCurrentDatabaseCommandType ) ) + { + aCurrentDatabaseCommandType = pValues->Value; + } else { - xProps->setPropertyValue( pValues->Name, - pValues->Value ); + xProps->setPropertyValue( pValues->Name, pValues->Value ); } } @@ -1296,11 +1316,26 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC pValues++; } + // apply current database properties + { + if ( aCurrentDatabaseDataSource.hasValue() ) + { + xProps->setPropertyValue( sCurrentDatabaseDataSource, aCurrentDatabaseDataSource ); + } + if ( aCurrentDatabaseCommand.hasValue() ) + { + xProps->setPropertyValue( sCurrentDatabaseCommand, aCurrentDatabaseCommand ); + } + if ( aCurrentDatabaseCommandType.hasValue() ) + { + xProps->setPropertyValue( sCurrentDatabaseCommandType, aCurrentDatabaseCommandType ); + } + } + // finally, treat the non-default cases - // --> OD 2006-04-18 #b6402800# + // introduce boolean, that indicates a document, written by version prior SO8. const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos; - // <-- if( ! bPrinterIndependentLayout ) { @@ -1330,14 +1365,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC OUString( RTL_CONSTASCII_USTRINGPARAM("UseFormerObjectPositioning")), makeAny( true ) ); } - if( !bUseOldNumbering ) // #111955# + if( !bUseOldNumbering ) { Any aAny; sal_Bool bOldNum = true; aAny.setValue(&bOldNum, ::getBooleanCppuType()); - xProps->setPropertyValue - (OUString( RTL_CONSTASCII_USTRINGPARAM("UseOldNumbering")), - aAny ); + xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("UseOldNumbering")), aAny ); } if( !bOutlineLevelYieldsOutlineRule ) @@ -1403,8 +1436,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if ( !bLoadReadonly ) { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("LoadReadonly") ), makeAny( false ) ); + xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("LoadReadonly") ), makeAny( false ) ); } // This flag has to be set for all documents < SO8 @@ -1441,7 +1473,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( xTextTunnel.is() ) { SwXText *pText = reinterpret_cast< SwXText *>( - sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); + sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); ASSERT( pText, "SwXText missing" ); if( pText ) { diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index d6e722e092b1..dbb2327a3172 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -77,6 +77,7 @@ #include <shellio.hxx> // I/O #include <docstyle.hxx> #include <doc.hxx> +#include <unotxdoc.hxx> #include <IDocumentUndoRedo.hxx> #include <docstat.hxx> #include <pagedesc.hxx> @@ -818,6 +819,18 @@ sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xS if( bResetModified ) EnableSetModified( sal_True ); } + + // #121125#, #122868# + // Clean up rendering data created by the usage of <XRenderable> interface + // of <SwXDocument> (e.g. export to PDF) and which is not cleaned up by + // "rendering the last page". + // This is needed to restore former <ViewOptions>. This is performed via + // a <ViewShell> reference hold by the rendering data. The rendering data + // also needs to loose the hold <ViewShell> reference. Otherwise, the application + // will crash on closing the document. + uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); + ((SwXTextDocument*)xDoc.get())->CleanUpRenderingData(); + return bRet; } @@ -1123,31 +1136,15 @@ SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool() } -#include <unotxdoc.hxx> - void SwDocShell::SetView(SwView* pVw) { - bool bChanged(false); - if(0 != (pView = pVw)) { pWrtShell = &pView->GetWrtShell(); - bChanged = true; } else { pWrtShell = 0; - bChanged = true; - } - - if(bChanged) - { - // #121125# SwXTextDocument may hold references to the ViewShell, so inform - // it about changes to allow to react on it. This happens e.g. when printing - // and/or PDF export (SwViewOptionAdjust_Impl holds a reference to the view - // and needs to be destroyed) - uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); - ((SwXTextDocument*)xDoc.get())->ReactOnViewShellChange(); } } @@ -1157,37 +1154,18 @@ void SwDocShell::PrepareReload() ::DelAllGrfCacheEntries( pDoc ); } -// --> OD 2006-11-07 #i59688# // linked graphics are now loaded on demand. // Thus, loading of linked graphics no longer needed and necessary for // the load of document being finished. void SwDocShell::LoadingFinished() { - // --> OD 2007-10-08 #i38810# - // Original fix fails after integration of cws xmlsec11: // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and // enables the document modification again. // Thus, manuell modify the document, if its modified and its links are updated // before <FinishedLoading(..)> is called. const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() ); -// // --> OD 2005-02-11 #i38810# - disable method <SetModified(..)>, if document -// // has stay in modified state, due to the update of its links during load. -// bool bResetEnableSetModified(false); -// if ( IsEnableSetModified() && -// pDoc->IsModified() && pDoc->LinksUpdated() ) -// { -// EnableSetModified( sal_False ); -// bResetEnableSetModified = true; -// } - // <-- FinishedLoading( SFX_LOADED_ALL ); -// // --> OD 2005-02-11 #i38810# -// if ( bResetEnableSetModified ) -// { -// EnableSetModified( sal_True ); -// } -// // <-- SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this); if(pVFrame) { @@ -1196,12 +1174,10 @@ void SwDocShell::LoadingFinished() ((SwSrcView*)pShell)->Load(this); } - // --> OD 2007-10-08 #i38810# if ( bHasDocToStayModified && !pDoc->IsModified() ) { pDoc->SetModified(); } - // <-- } // eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 380e90b617f0..1cf0d84df821 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -235,26 +235,6 @@ TabPage TP_OPTPRINT_PAGE TabStop = TRUE ; Group = TRUE ; }; -/* - removed, tables now always get printed - CheckBox CB_PTAB - { - HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PTAB"; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "~Tables" ; - }; -*/ -/* - functionally merged with CB_PGRF (pictures and graphics) - CheckBox CB_PDRAW - { - HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PDRAW"; - Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Dra~wings" ; - }; -*/ CheckBox CB_CTRLFLD { HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_CTRLFLD"; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 93665893e008..fc3f9657d92c 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1608,9 +1608,13 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) bRet = sal_True; } - m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, + if ( m_pWrtShell ) + { + m_pWrtShell->GetDoc()->set( + IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, m_aMathBaselineAlignmentCB.IsChecked() ); - bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue(); + bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue(); + } if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue()) { @@ -1618,8 +1622,8 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) bRet |= sal_True; } - const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*) - GetOldItem(GetItemSet(), FN_PARAM_DOCDISP); + const SwDocDisplayItem* pOldAttr = + (const SwDocDisplayItem*)GetOldItem(GetItemSet(), FN_PARAM_DOCDISP); SwDocDisplayItem aDisp; if(pOldAttr) @@ -1648,7 +1652,9 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) SwShadowCursorItem aOpt; if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem )) + { aOpt = *(SwShadowCursorItem*)pItem; + } aOnOffCB.Check( aOpt.IsOn() ); sal_uInt8 eMode = aOpt.GetMode(); @@ -1657,17 +1663,25 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) aFillTabRB.Check( FILL_TAB == eMode ); aFillSpaceRB.Check( FILL_SPACE == eMode ); - m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ); - m_aMathBaselineAlignmentCB.SaveValue(); + if ( m_pWrtShell ) + { + m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ); + m_aMathBaselineAlignmentCB.SaveValue(); + } + else + { + m_aMathBaselineAlignmentCB.Disable(); + } if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem )) + { aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue()); + } aCrsrInProtCB.SaveValue(); const SwDocDisplayItem* pDocDisplayAttr = 0; - rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, - (const SfxPoolItem**)&pDocDisplayAttr ); + rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, (const SfxPoolItem**)&pDocDisplayAttr ); if(pDocDisplayAttr) { aParaCB .Check (pDocDisplayAttr->bParagraphEnd ); diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index ce0ac95954f6..7e0274bdd63a 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -87,6 +87,7 @@ #include <IDocumentUndoRedo.hxx> #include <pagedesc.hxx> #include <IMark.hxx> +#include <bookmrk.hxx> #include <docary.hxx> #include <section.hxx> #include <ndtxt.hxx> @@ -3771,12 +3772,6 @@ sal_Bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) rStrm.Write( pMem, nLen ); delete[] pMem; - //if( bDelBookmrk ) - //{ - // // er wird das erstemal abgeholt, also ins Undo mitaufnehmen - // // aber wie?? - //} - IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess(); IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName); if(ppMark != pMarkAccess->getMarksEnd() @@ -3822,7 +3817,7 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) // kein DataChanged mehr entgegen nehmen, wenn man // sich schon im Disconnet befindet! // (DTOR vom Bookmark verschickt einen DataChanged!) - sal_Bool bOldDisconnect = bInDisconnect; + const sal_Bool bOldDisconnect = bInDisconnect; bInDisconnect = sal_True; // den nicht verwendeten Bookmark wieder zerstoeren (ohne Undo!)? @@ -3838,13 +3833,20 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) sal_Bool bIsModified = pDoc->IsModified(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - pMarkAccess->deleteMark(pMarkAccess->findMark(sName)); + // check, if DdeBookmark is already in its desctruction + IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName); + if ( ppMark != pMarkAccess->getMarksEnd() ) + { + ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(ppMark->get()); + if ( pDdeBookmark && !pDdeBookmark->IsInDestruction() ) + { + pMarkAccess->deleteMark(ppMark); + } + } if( !bIsModified ) pDoc->ResetModified(); - // --> OD, CD, OS 2005-11-25 #i58448# pDoc->SetOle2Link( aSavedOle2Link ); - // <-- bDelBookmrk = sal_False; } diff --git a/sw/source/ui/docvw/AnchorOverlayObject.cxx b/sw/source/ui/docvw/AnchorOverlayObject.cxx index b45af72d0d66..582b81936f3f 100644 --- a/sw/source/ui/docvw/AnchorOverlayObject.cxx +++ b/sw/source/ui/docvw/AnchorOverlayObject.cxx @@ -54,7 +54,7 @@ private: basegfx::BColor maColor; // discrete line width - double mfLogicLineWidth; + double mfDiscreteLineWidth; // bitfield bool mbShadow : 1; @@ -70,7 +70,7 @@ public: const basegfx::B2DPolygon& rLineTop, AnchorState aAnchorState, const basegfx::BColor& rColor, - double fLogicLineWidth, + double fDiscreteLineWidth, bool bShadow, bool bLineSolid ) : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(), @@ -79,7 +79,7 @@ public: maLineTop(rLineTop), maAnchorState(aAnchorState), maColor(rColor), - mfLogicLineWidth(fLogicLineWidth), + mfDiscreteLineWidth(fDiscreteLineWidth), mbShadow(bShadow), mbLineSolid(bLineSolid) {} @@ -90,7 +90,7 @@ public: const basegfx::B2DPolygon& getLineTop() const { return maLineTop; } AnchorState getAnchorState() const { return maAnchorState; } const basegfx::BColor& getColor() const { return maColor; } - double getLogicLineWidth() const { return mfLogicLineWidth; } + double getDiscreteLineWidth() const { return mfDiscreteLineWidth; } bool getShadow() const { return mbShadow; } bool getLineSolid() const { return mbLineSolid; } @@ -115,14 +115,15 @@ drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecompos drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle); } + // prepare view-independent LineWidth and color + const drawinglayer::attribute::LineAttribute aLineAttribute( + getColor(), + getDiscreteLineWidth() * getDiscreteUnit()); + if ( AS_ALL == maAnchorState || AS_START == maAnchorState ) { // create line start - const drawinglayer::attribute::LineAttribute aLineAttribute( - getColor(), - getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit())); - if(getLineSolid()) { const drawinglayer::primitive2d::Primitive2DReference aSolidLine( @@ -201,10 +202,6 @@ drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecompos { // LineTop has to be created, too, but uses no shadow, so add after // the other parts are created - const drawinglayer::attribute::LineAttribute aLineAttribute( - getColor(), - getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit())); - const drawinglayer::primitive2d::Primitive2DReference aLineTop( new drawinglayer::primitive2d::PolygonStrokePrimitive2D( getLineTop(), @@ -335,13 +332,14 @@ drawinglayer::primitive2d::Primitive2DSequence AnchorOverlayObject::createOverla { implEnsureGeometry(); + static double aDiscreteLineWidth(1.6); const drawinglayer::primitive2d::Primitive2DReference aReference( new AnchorPrimitive( maTriangle, maLine, maLineTop, GetAnchorState(), getBaseColor().getBColor(), - ANCHORLINE_WIDTH * 15.0, + ANCHORLINE_WIDTH * aDiscreteLineWidth, getShadowedEffect(), getLineSolid()) ); diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index d024bdf143d8..6fcc2c49d482 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -68,7 +68,7 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, SwFmtFld* aField ) : SwSidebarWin( rEditWin, nBits, aMgr, aBits, rSidebarItem ) , mpFmtFld(aField) - , mpFld( static_cast<SwPostItField*>(aField->GetFld())) + , mpFld( static_cast<SwPostItField*>(aField->GetField())) , mpButtonPopup(0) { } @@ -83,7 +83,7 @@ void SwAnnotationWin::SetPostItText() // get text from SwPostItField and insert into our textview Engine()->SetModifyHdl( Link() ); Engine()->EnableUndo( sal_False ); - mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld()); + mpFld = static_cast<SwPostItField*>(mpFmtFld->GetField()); if( mpFld->GetTextObject() ) Engine()->SetText( *mpFld->GetTextObject() ); else @@ -162,7 +162,7 @@ bool SwAnnotationWin::CalcFollow() aPosition.nContent = *pTxtFld->GetStart(); SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt( aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD ); - const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0; + const SwField* pFld = pTxtAttr ? pTxtAttr->GetFmtFld().GetField() : 0; return pFld && (pFld->Which()== RES_POSTITFLD); } @@ -178,7 +178,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() aPosition.nContent.GetIndex() + 1, RES_TXTATR_FIELD ); SwField* pFld = pTxtAttr - ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) + ? const_cast<SwField*>(pTxtAttr->GetFmtFld().GetField()) : 0; while ( pFld && ( pFld->Which()== RES_POSTITFLD ) ) { @@ -187,7 +187,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() aPosition.nContent.GetIndex() + aCount, RES_TXTATR_FIELD ); pFld = pTxtAttr - ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) + ? const_cast<SwField*>(pTxtAttr->GetFmtFld().GetField()) : 0; } return aCount - 1; diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 77f6c60cdb44..042e14368724 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -425,7 +425,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if ((*i)->pPostIt) { - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld()->GetFld()->GetLanguage() ); + sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld()->GetField()->GetLanguage() ); sal_uInt16 nLangWhichId = 0; switch (nScriptType) { @@ -433,7 +433,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; } - (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(), + (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetField()->GetLanguage(), nLangWhichId) ); } break; @@ -1395,7 +1395,7 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie { for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++) { - if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld)) + if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetField() == pFld)) return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt); } return NULL; diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index e61b2ea2b08b..bc62f772b709 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -111,17 +111,14 @@ #include <checkit.hxx> #include <helpid.h> #include <cmdid.h> -#ifndef _DOCVW_HRC #include <docvw.hrc> -#endif #include <uitool.hxx> -// OD 18.09.2003 #i18732# #include <fmtfollowtextflow.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <charfmt.hxx> #include <numrule.hxx> #include <pagedesc.hxx> -#include <svtools/ruler.hxx> // #i23726# +#include <svtools/ruler.hxx> #include "formatclipboard.hxx" #include <vos/mutex.hxx> #include <vcl/svapp.hxx> @@ -179,9 +176,7 @@ private: SdrHdl* mpHdl; basegfx::B2DPoint maHdlPos; basegfx::B2DPoint maLastPos; - // --> OD 2010-09-16 #i114522# bool bTopRightHandle; - // <-- public: SwAnchorMarker( SdrHdl& rH ) : mpHdl( &rH ), @@ -196,8 +191,15 @@ public: void SetPos( const basegfx::B2DPoint& rNew ) { mpHdl->setPosition( rNew ); } const basegfx::B2DPoint& GetPos() { return mpHdl->getPosition(); } const basegfx::B2DPoint& GetHdlPos() { return maHdlPos; } - void ChgHdl( SdrHdl& rNew ) { mpHdl = &rNew; } - void SetSelected(bool bSelected) { mpHdl->SetSelected(bSelected); } + void ChgHdl( SdrHdl& rNew ) + { + mpHdl = &rNew; + bTopRightHandle = (rNew.GetKind() == HDL_ANCHOR_TR); + } + void SetSelected(bool bSelected) + { + mpHdl->SetSelected(bSelected); + } // --> OD 2010-09-16 #i114522# const basegfx::B2DPoint GetPosForHitTest( const OutputDevice& rOut ) @@ -217,7 +219,6 @@ public: return aHitTestPos; } - // <-- }; struct QuickHelpData @@ -307,7 +308,6 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) delete pUserMarker; pUserMarker = 0L; } -// rSh.SwCrsrShell::UnSetVisCrsr( rLPt ); eStyle = POINTER_NOTALLOWED; } else @@ -625,11 +625,7 @@ void SwEditWin::JustifyAreaTimer() nDiff = Max( Max( aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - aMovePos.Y() ), Max( aMovePos.X() - rVisArea.Right(), rVisArea.Left() - aMovePos.X())); -#ifdef TEST_FOR_BUG91313 aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff) ); -#else - aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff*2L) ); -#endif } void SwEditWin::LeaveArea(const Point &rPos) @@ -665,9 +661,6 @@ void SwEditWin::StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect ) { setSdrObjectCreationInfo(SdrObjectCreationInfo(eSdrObjectKind)); -/* if (GetDrawFuncPtr()) - GetDrawFuncPtr()->Deactivate();*/ - if (bObjSelect) rView.SetDrawFuncPtr(new DrawSelection( &rView.GetWrtShell(), this, &rView )); else @@ -1005,13 +998,10 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb ) SwRect aBoundRect; Point aRefPoint; - // OD 18.09.2003 #i18732# - adjustment for allowing vertical position - // aligned to page for fly frame anchored to paragraph or to character. { SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) ); const bool bFollowTextFlow = static_cast<const SwFmtFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue(); - // OD 12.11.2003 #i22341# - additional provide content position const SwPosition* pToCharCntntPos = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetCntntAnchor(); rSh.CalcBoundRect( aBoundRect, eAnchorId, text::RelOrientation::FRAME, aVert.GetRelationOrient(), @@ -1150,11 +1140,8 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb ) ---------------------------------------------------------------------------*/ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) { - // --> OD 2005-01-31 #i40845# - start undo action in order to get only one - // undo action for this change. SwWrtShell &rSh = rView.GetWrtShell(); rSh.StartUndo(); - // <-- long nX = 0; long nY = 0; @@ -1230,8 +1217,6 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) // if the object's position is not protected if(0 == (nProtect&FLYPROTECT_POS)) { - // --> FME 2005-04-26 #i47138# - // Check if object is anchored as character and move direction sal_Bool bDummy1, bDummy2; const bool bVertAnchor = rSh.IsFrmVertical( sal_True, bDummy1, bDummy2 ); const bool bHoriMove = !bVertAnchor == !( nDir % 2 ); @@ -1239,7 +1224,6 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) !bHoriMove || (rSh.GetAnchorId() != FLY_AS_CHAR); if ( bMoveAllowed ) { - // <-- pSdrView->MoveMarkedObj(basegfx::B2DVector(nX, nY)); rSh.SetModified(); } @@ -1269,9 +1253,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) rSh.EndAllAction(); } - // --> OD 2005-01-31 #i40845# - end undo action rSh.EndUndo(); - // <-- } /*-------------------------------------------------------------------- @@ -1514,13 +1496,11 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) eNextKeyState = KS_Ende; sal_uInt8 nDir = 0; - // -> #i23725# if (nKS_NUMDOWN_Count > 0) nKS_NUMDOWN_Count--; if (nKS_NUMINDENTINC_Count > 0) nKS_NUMINDENTINC_Count--; - // <- #i23725# while( KS_Ende != eKeyState ) { @@ -1627,13 +1607,6 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) nDir = MOVE_DOWN_SMALL; goto KEYINPUT_CHECKTABLE; -// case KEY_UP | KEY_MOD2 | KEY_SHIFT: -// eKeyState = KS_ColTopBig; -// goto KEYINPUT_CHECKTABLE; -// case KEY_DOWN | KEY_MOD2 | KEY_SHIFT: -// eKeyState = KS_ColTopSmall; -// goto KEYINPUT_CHECKTABLE; - case KEY_UP | KEY_MOD2 | KEY_MOD1: eKeyState = KS_CellBottomSmall; goto KEYINPUT_CHECKTABLE; @@ -1674,8 +1647,10 @@ KEYINPUT_CHECKTABLE: case KEY_UP | KEY_SHIFT: case KEY_DOWN | KEY_SHIFT: { - if ( pFlyFmt - || ( (rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) + const int nSelectionType = rSh.GetSelectionType(); + if ( ( pFlyFmt + && ( nSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) ) ) + || ( ( nSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM) ) && rSh.GetDrawView()->areSdrObjectsSelected() ) ) { eKeyState = pFlyFmt ? KS_Fly_Change : KS_Draw_Change; @@ -1708,7 +1683,6 @@ KEYINPUT_CHECKTABLE: nTblChgSize = pModOpt->GetTblVInsert(); } goto KEYINPUT_CHECKTABLE_INSDEL; -// case KEY_RIGHT: case KEY_RIGHT | KEY_MOD1: { eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_CELL_RIGHT; @@ -1850,13 +1824,10 @@ KEYINPUT_CHECKTABLE_INSDEL: case KEY_BACKSPACE | KEY_SHIFT: if( !rSh.HasReadonlySel() ) { - // #i23725# sal_Bool bDone = sal_False; - // --> OD 2006-01-31 - try to add comment for code snip: // Remove the paragraph indent, if the cursor is at the // beginning of a paragraph, there is no selection // and no numbering rule found at the current paragraph - // --> OD 2006-01-31 #b6341339#, #i58776# // Also try to remove indent, if current paragraph // has numbering rule, but isn't counted and only // key <backspace> is hit. @@ -1869,9 +1840,7 @@ KEYINPUT_CHECKTABLE_INSDEL: { bDone = rSh.TryRemoveIndent(); } - // <-- - // -> #i23725# if (bDone) eKeyState = KS_Ende; else @@ -1893,10 +1862,6 @@ KEYINPUT_CHECKTABLE_INSDEL: bDone = sal_True; } } - // <- #i23725# - // --> OD 2006-01-31 #b6341339#, #i58776# - // --> OD 2006-04-21 #i63540# - // revise fix for issues b6341339 and i58776: // If the cursor is in an empty paragraph, which has // a numbering, but not the oultine numbering, and // there is no selection, the numbering has to be @@ -1965,11 +1930,8 @@ KEYINPUT_CHECKTABLE_INSDEL: if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) { - // --> OD 2007-10-02 #b660435# -// if (rSh.IsFirstOfNumRule()) // #i23725# if ( rSh.IsFirstOfNumRule() && numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() ) - // <-- eKeyState = KS_NumIndentInc; else eKeyState = KS_NumDown; @@ -2020,11 +1982,8 @@ KEYINPUT_CHECKTABLE_INSDEL: else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) { - // --> OD 2007-10-02 #b660435# -// if (rSh.IsFirstOfNumRule()) // #i23725# if ( rSh.IsFirstOfNumRule() && numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() ) - // <-- eKeyState = KS_NumIndentDec; else eKeyState = KS_NumUp; @@ -2275,7 +2234,6 @@ KEYINPUT_CHECKTABLE_INSDEL: case KS_InsTab: if( dynamic_cast< const SwWebView* >(&rView)) //Kein Tabulator fuer Web! { - // Bug 56196 - dann sollte der weiter gereicht werden. Window::KeyInput( aKeyEvent ); eKeyState = KS_Ende; break; @@ -2293,23 +2251,11 @@ KEYINPUT_CHECKTABLE_INSDEL: if(pFieldmark) { pFieldmark->SetChecked(!pFieldmark->IsChecked()); - SwDocShell* pDocSh = rView.GetDocShell(); - SwDoc *pDoc=pDocSh->GetDoc(); OSL_ENSURE(pFieldmark->IsExpanded(), "where is the otherpos?"); if (pFieldmark->IsExpanded()) { - SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos()); - if(0) - { - rSh.StartAllAction(); //$flr TODO: understand why this not works - pDoc->SetModified(aPaM); - rSh.EndAllAction(); - } - else - { - rSh.CalcLayout(); // workaround - } + rSh.CalcLayout(); } } eKeyState = KS_Ende; @@ -2367,7 +2313,6 @@ KEYINPUT_CHECKTABLE_INSDEL: else { InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); - // ??? Window::KeyInput( aKeyEvent ); eKeyState = KS_Ende; } break; @@ -2380,12 +2325,6 @@ KEYINPUT_CHECKTABLE_INSDEL: ChgToEnEmDash | SetINetAttr | Autocorrect ) && !rSh.HasReadonlySel() ) - /* { - pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | - ChgFractionSymbol | ChgOrdinalNumber | - ChgToEnEmDash | SetINetAttr | - Autocorrect ) && - !rSh.HasReadonlySel() ) */ { FlushInBuffer(); rSh.AutoCorrect( *pACorr, static_cast< sal_Unicode >('\0') ); @@ -2398,8 +2337,6 @@ KEYINPUT_CHECKTABLE_INSDEL: { sal_uInt16 nSlotId = 0; FlushInBuffer(); -//??? if( bFlushCharBuffer ) -//??? FlushInBuffer( &rSh ); switch( eKeyState ) { case KS_SpecialInsert: @@ -2426,11 +2363,8 @@ KEYINPUT_CHECKTABLE_INSDEL: rSh.NumUpDown( sal_False ); break; - // -> #i23726# case KS_NumIndentInc: - // --> OD 2008-06-16 #i90078# rSh.ChangeIndentOfAllListLevels(360); - // <-- nKS_NUMINDENTINC_Count = 2; break; @@ -2449,11 +2383,9 @@ KEYINPUT_CHECKTABLE_INSDEL: break; case KS_NumIndentDec: - // --> OD 2008-06-16 #i90078# rSh.ChangeIndentOfAllListLevels(-360); // <-- break; - // <- #i23726# case KS_OutlineDown: rSh.OutlineUpDown( 1 ); @@ -2475,8 +2407,6 @@ KEYINPUT_CHECKTABLE_INSDEL: rSh.SplitNode( sal_True ); break; -// case KS_NumOrNoNum: -// break; case KS_NextObject: case KS_PrevObject: if(rSh.GotoObj( KS_NextObject == eKeyState, GOTOOBJ_GOTO_ANY)) @@ -2546,9 +2476,7 @@ KEYINPUT_CHECKTABLE_INSDEL: case KS_ColRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; case KS_ColLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHMove() ); break; case KS_ColRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHMove() ); break; -// case KS_ColTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; case KS_ColBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; -// case KS_ColTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVMove() ); break; case KS_ColBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVMove() ); break; case KS_CellLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; case KS_CellRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; @@ -2741,7 +2669,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) 0 != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) && !rSh.IsObjSelectable(aB2DDocPos) ) { - // --> FME 2004-07-30 #i32329# Enhanced table selection + // Enhanced table selection if ( SW_TABSEL_HORI <= nMouseTabCol && SW_TABCOLSEL_VERT >= nMouseTabCol ) { rSh.EnterStdMode(); @@ -2757,7 +2685,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } return; } - // <-- if ( !rSh.IsTableMode() ) { @@ -2786,7 +2713,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } } } - // #i23726# else if (bTmp && rSh.IsNumLabel(aDocPos)) { @@ -2796,10 +2722,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); rBind.Update(); - // --> OD 2005-02-21 #i42921# if ( RulerMarginDrag( rMEvt, rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) ) - // <-- { rView.SetNumRuleNodeFromDoc( NULL ); rView.InvalidateRulerPos(); @@ -2808,11 +2732,9 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } else { - // --> FME 2005-11-03 #125036# Make sure the pointer is set to 0, - // otherwise it may point to nowhere after deleting the corresponding - // text node. + // Make sure the pointer is set to 0, otherwise it may point to + // nowhere after deleting the corresponding text node. rView.SetNumRuleNodeFromDoc( NULL ); - // <-- return; } } @@ -2853,7 +2775,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) ( pHdl->GetKind() == HDL_ANCHOR || pHdl->GetKind() == HDL_ANCHOR_TR ) ) { - // #121463# Set selected during drag + // Set selected during drag pHdl->SetSelected(true); pAnchorMarker = new SwAnchorMarker( *pHdl ); UpdatePointer( aDocPos, rMEvt.GetModifier() ); @@ -2912,11 +2834,10 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bExecHyperlinks = sal_True; } - // --> FME 2004-07-30 #i32329# Enhanced selection + // Enhanced selection sal_uInt8 nNumberOfClicks = static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4); if ( 0 == nNumberOfClicks && 0 < rMEvt.GetClicks() ) nNumberOfClicks = 4; - // <-- sal_Bool bExecDrawTextLink = sal_False; @@ -2949,7 +2870,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) !GetView().GetViewFrame()->GetDispatcher()->IsLocked() && !bExecDrawTextLink) { - // #107513# // Test if there is a draw object at that position and if it should be selected. sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos); @@ -3187,12 +3107,11 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if ( bMod ) rSh.EnterAddMode(); - // --> FME 2004-07-30 #i32329# Enhanced selection + // Enhanced selection if ( 3 == nNumberOfClicks ) rSh.SelSentence( &aDocPos ); else rSh.SelPara( &aDocPos ); - // <-- if ( bMod ) rSh.LeaveAddMode(); @@ -3436,13 +3355,11 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if ( !bOverURLGrf && !bOnlyText ) { const int nSelType = rSh.GetSelectionType(); - // --> OD 2009-12-30 #i89920# // Check in general, if an object is selectable at given position. // Thus, also text fly frames in background become selectable via Ctrl-Click. if ( nSelType & nsSelectionType::SEL_OLE || nSelType & nsSelectionType::SEL_GRF || rSh.IsObjSelectable(aB2DDocPos) ) - // <-- { MV_KONTEXT( &rSh ); if( !rSh.IsFrmSelected() ) @@ -3451,11 +3368,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bCallBase = sal_False; } } - // nicht mehr hier zuruecksetzen, damit -- falls durch MouseMove - // bei gedrueckter Ctrl-Taste eine Mehrfachselektion erfolgen soll, - // im Drag nicht die vorherige Selektion aufgehoben wird. -// if(bModePushed) -// rSh.PopMode(sal_False); break; } } @@ -3521,20 +3433,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) } const Point aOldPt( rSh.VisArea().Pos() ); -#ifdef TEST_FOR_BUG91313 - // n Pixel as FUZZY border - SwRect aVis( rSh.VisArea() ); - Size aFuzzySz( 2, 2 ); - aFuzzySz = PixelToLogic( aFuzzySz ); - - aVis.Top( aVis.Top() + aFuzzySz.Height() ); - aVis.Bottom( aVis.Bottom() - aFuzzySz.Height() ); - aVis.Left( aVis.Left() + aFuzzySz.Width() ); - aVis.Right( aVis.Right() - aFuzzySz.Width() ); - const sal_Bool bInsWin = aVis.IsInside( aDocPt ); -#else const sal_Bool bInsWin = rSh.VisArea().IsInside( aDocPt ); -#endif if( pShadCrsr && !bInsWin ) delete pShadCrsr, pShadCrsr = 0; @@ -3615,7 +3514,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) nPointer = POINTER_HSIZEBAR; bChkTblSel = true; break; - // --> FME 2004-07-30 #i20126# Enhanced table selection + // Enhanced table selection case SW_TABSEL_HORI : nPointer = POINTER_TAB_SELECT_SE; break; @@ -3634,31 +3533,25 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) case SW_TABCOLSEL_VERT : nPointer = POINTER_TAB_SELECT_W; break; - // <-- } if ( USHRT_MAX != nPointer && - // --> FME 2004-10-20 #i35543# // Enhanced table selection is explicitely allowed in table mode ( !bChkTblSel || !rSh.IsTableMode() ) ) - // <-- { SetPointer( nPointer ); } return; } - // #i23726# else if (rSh.IsNumLabel(aDocPt, RULER_MOUSE_MARGINWIDTH)) { - // --> OD 2005-02-21 #i42921# - consider vertical mode SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPt ); const sal_uInt16 nPointer = rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPt ) ? POINTER_VSIZEBAR : POINTER_HSIZEBAR; SetPointer( nPointer ); - // <-- return; } @@ -3682,7 +3575,6 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) // is destroyed, it will find a new one at position GetHdlPos(). // --> OD 2010-09-16 #i114522# const basegfx::B2DPoint aOld(pAnchorMarker->GetPosForHitTest(*(rSh.GetOut()))); - // <-- Point aNew = rSh.FindAnchorPos( aDocPt ); SdrHdl* pHdl; if( (0!=( pHdl = pSdrView->PickHandle( aOld ) )|| @@ -3756,9 +3648,6 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) && 0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable(). Get( nEvent )) && -// oder nur z.B. alle 20 Twip bescheid sagen? -// ( 20 > Abs( aRszMvHdlPt.X() - aDocPt.X() ) || -// 20 > Abs( aRszMvHdlPt.Y() - aDocPt.Y() ) ) aRszMvHdlPt != aDocPt ) { aRszMvHdlPt = aDocPt; @@ -4016,10 +3905,6 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) //MouseButtonUp nur bearbeiten, wenn auch das Down an dieses Fenster ging. if ( !bMBPressed ) { -// OS 25.02.97 Undo fuer die Giesskann ist bereits im CommandHdl -//JP 29.09.95: so sollte es sein!!! if(pApplyTempl->bUndo) -// if( pApplyTempl && MOUSE_RIGHT == rMEvt.GetModifier() + rMEvt.GetButtons() ) -// rSh.Do( SwWrtShell::UNDO ); return; } @@ -4294,8 +4179,6 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if ( aCntntAtPos.aFnd.pFldmark != NULL) { IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark ); - //SwDocShell* pDocSh = rView.GetDocShell(); - //SwDoc *pDoc=pDocSh->GetDoc(); if (fieldBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) { ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(fieldBM); @@ -4509,11 +4392,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) case SFX_STYLE_FAMILY_PSEUDO: if( !rSh.HasReadonlySel() ) { - // --> OD 2008-03-17 #refactorlists# rSh.SetCurNumRule( *pApplyTempl->aColl.pNumRule, false, pApplyTempl->aColl.pNumRule->GetDefaultListId() ); - // <-- bCallBase = sal_False; pApplyTempl->bUndo = sal_True; if( pApplyTempl->aColl.pNumRule ) @@ -4638,8 +4519,8 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView): bLockInput(sal_False), bObjectSelect( sal_False ), - nKS_NUMDOWN_Count(0), // #i23725# - nKS_NUMINDENTINC_Count(0) // #i23725# + nKS_NUMDOWN_Count(0), + nKS_NUMINDENTINC_Count(0) { SetHelpId(HID_EDIT_WIN); EnableChildTransparentMode(); @@ -4731,7 +4612,6 @@ sal_Bool SwEditWin::EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos) SwWrtShell &rSh = rView.GetWrtShell(); SdrView *pSdrView = rSh.GetDrawView(); -// if ( GetDrawFuncPtr() && (aActHitType == SDRHIT_NONE || rSh.IsDrawCreate()) ) if ( rView.GetDrawFuncPtr() ) { if (rSh.IsDrawCreate()) @@ -5271,18 +5151,15 @@ sal_Bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) sal_Bool bRet = sal_False; const Point aDocPos( PixelToLogic( rMousePos ) ); const basegfx::B2DPoint aB2DDocPos(aDocPos.X(), aDocPos.Y()); - // --> OD 2005-02-17 #i42258# const bool bIsInsideSelectedObj( rSh.IsInsideSelectedObj( aB2DDocPos ) ); - // <-- //create a synthetic mouse event out of the coordinates MouseEvent aMEvt(rMousePos); SdrView *pSdrView = rSh.GetDrawView(); if ( pSdrView ) { - // --> OD 2005-02-17 #i42258# - no close of insert_draw and reset of - // draw mode, if context menu position is inside a selected object. + // no close of insert_draw and reset of draw mode, + // if context menu position is inside a selected object. if ( !bIsInsideSelectedObj && rView.GetDrawFuncPtr() ) - // <-- { rView.GetDrawFuncPtr()->Deactivate(); diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index edaf6171ca26..801cc114539e 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -250,7 +250,7 @@ sal_Bool SwFldPage::InsertFld(sal_uInt16 nTypeId, sal_uInt16 nSubType, const Str for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { - if( pFmtFld->GetFld() == m_pCurFld) + if( pFmtFld->GetField() == m_pCurFld) { pFmtFld->RegisterToFieldType(*pTyp); pTmpFld->ChgTyp(pTyp); diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index be0c9e4691e2..980add9723d4 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -375,7 +375,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) SwFmtFld* pSwFmtFld = aIter.First(); while( pSwFmtFld ) { - if ( pSwFmtFld->GetFld() == pPostIt ) + if ( pSwFmtFld->GetField() == pPostIt ) { pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) ); break; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 201bfc9c6706..408d6b1a44f3 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -623,8 +623,16 @@ void SwXTextDocument::dispose(void) throw( RuntimeException ) -----------------------------------------------------------------------*/ void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException ) { - if(IsValid() && m_pHiddenViewFrame) + if ( IsValid() && m_pHiddenViewFrame ) + { + ASSERT( false, "<SwXTextDocument::close(..)> - rendering data not cleaned up???" ); lcl_DisposeView( m_pHiddenViewFrame, pDocShell); + m_pHiddenViewFrame = 0; + // prevent crash described in #i108805 + SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet(); + pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); + } + SfxBaseModel::close(bDeliverOwnership); } /*-- 18.12.98 13:12:25--------------------------------------------------- @@ -2664,27 +2672,32 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); + CleanUpRenderingData(); + const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); bool bIsSwSrcView = false; SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); - if (!bIsSwSrcView && !m_pRenderData) - m_pRenderData = new SwRenderData; - if (!m_pPrintUIOptions) - m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); - bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - // const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); - if (!pDoc || !pView) + if ( pDoc == 0 || pView == 0 ) + { return 0; + } + + if ( !bIsSwSrcView ) + { + m_pRenderData = new SwRenderData; + } + // new <PrintUIOptions> + m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); + const bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); // save current UI options from the print dialog for the next call to that dialog lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport ); sal_Int32 nRet = 0; - if (bIsSwSrcView) + if ( bIsSwSrcView ) { SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); @@ -2718,7 +2731,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (!pViewShell || !pViewShell->GetLayout()) return 0; - if (bFormat) + if ( bFormat ) { // #i38289 if( pViewShell->GetViewOptions()->getBrowseMode() ) @@ -2734,7 +2747,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // We don't want that! Thus we disable updating of the view. pViewShell->StartAction(); - if (pSwView) + if ( pSwView ) { if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pViewShell ) ) m_pRenderData->ViewOptionAdjustStop(); @@ -2746,11 +2759,12 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, m_pPrintUIOptions, m_pRenderData, bIsPDFExport ); - if (pSwView) + if ( pSwView ) { // PDF export should not make use of the SwPrtOptions const SwPrintData *pPrtOptions = (bIsPDFExport) - ? NULL : m_pRenderData->GetSwPrtOptions(); + ? NULL + : m_pRenderData->GetSwPrtOptions(); m_pRenderData->ViewOptionAdjust( pPrtOptions ); } @@ -2861,10 +2875,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (!pDoc || !pView) return uno::Sequence< beans::PropertyValue >(); - // due to #110067# (document page count changes sometimes during - // PDF export/printing) we can not check for the upper bound properly. - // Thus instead of throwing the exception we silently return. - if (0 > nRenderer) + if ( nRenderer < 0 || nRenderer >= SAL_MAX_UINT16 ) throw IllegalArgumentException(); // TODO/mba: we really need a generic way to get the ViewShell! @@ -2891,14 +2902,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( uno::Sequence< beans::PropertyValue > aRenderer; if (m_pRenderData) { - // --> TL, OD 2010-09-07 #i114210# - // determine the correct page number from the renderer index - // --> OD 2010-10-01 #i114875 - // consider brochure print - const sal_uInt16 nPage = bPrintProspect - ? nRenderer + 1 - : m_pRenderData->GetPagesToPrint()[ nRenderer ]; - // <-- + const sal_Int32 nPage = bPrintProspect + ? nRenderer + 1 + : m_pRenderData->GetPagesToPrint()[ nRenderer ]; // get paper tray to use ... sal_Int32 nPrinterPaperTray = -1; @@ -2935,19 +2941,6 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( aTmpSize = pPrinter->LogicToLogic( aTmpSize, pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); - #if 0 - // #i115048# it seems users didn't like getting double the formatted page size - // revert to "old" behavior scaling to the current paper size of the printer - if (bPrintProspect) - { - // we just state what output size we would need - // which may cause vcl to set that page size on the printer - // (if available and not overriden by the user) - aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages ); - aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), - TWIP_TO_MM100( aTmpSize.Height() )); - } - #else if( bPrintProspect ) { // just switch to an appropriate portrait/landscape format @@ -2960,12 +2953,13 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( aPreferredPageSize.Height = aPageSize.Width; } } - #endif } } else { - aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages ); + ASSERT( nPage > 0 && nPage <= SAL_MAX_UINT16, + "<SwXTextDocument::getRenderer(..)> - unexpected value for the page number, it does not fit into sal_uInt16." ); + aTmpSize = pVwSh->GetPageSize( static_cast< sal_uInt16 >(nPage), bIsSkipEmptyPages ); aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), TWIP_TO_MM100( aTmpSize.Height() )); } @@ -2992,7 +2986,6 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( } } - // --> OD #i117783# if ( bApplyPagePrintSettingsFromXPagePrintable ) { const SwPagePreViewPrtData* pPagePrintSettings = @@ -3047,7 +3040,6 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( bApplyPagePrintSettingsFromXPagePrintable = sal_False; } - // <-- m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); @@ -3070,8 +3062,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False ); // look for the view shell with the same controller in use, - // otherwise look for a suitable view, preferably a SwView, - // if that one is not found use a SwPagePreView if found. + // otherwise look for a suitable view while (pFrame) { pView = pFrame->GetViewShell(); @@ -3084,7 +3075,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( if (pView && pView->GetController() == xController) break; } - else if (pSwView || pSwSrcView) + else if ( pSwView || pSwSrcView || pSwPagePreView ) break; pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False ); } @@ -3093,9 +3084,6 @@ SfxViewShell * SwXTextDocument::GuessViewShell( if (pView) rbIsSwSrcView = pSwSrcView != 0; return pView; -// return pSwView ? dynamic_cast< SfxViewShell * >(pSwView) : -// (pSwSrcView ? dynamic_cast< SfxViewShell * >(pSwSrcView) : -// dynamic_cast< SfxViewShell * >(pSwPagePreView) ); } @@ -3119,12 +3107,18 @@ void SAL_CALL SwXTextDocument::render( bool bIsSwSrcView = false; SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); - DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); - DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); - if (!bIsSwSrcView && !m_pRenderData) + // error handling - avoid crash + if ( !bIsSwSrcView && m_pRenderData == NULL ) + { + DBG_ASSERT( false, "data should have been created already in getRendererCount..." ); m_pRenderData = new SwRenderData; - if (!m_pPrintUIOptions) + } + if ( m_pPrintUIOptions == 0 ) + { + DBG_ASSERT( false, "data should have been created already in getRendererCount..." ); m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); + } + m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); @@ -3208,8 +3202,6 @@ void SAL_CALL SwXTextDocument::render( else // normal printing and PDF export pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer ); - // --> FME 2004-10-08 #i35176# - // // After printing the last page, we take care for the links coming // from the EditEngine. The links are generated during the painting // process, but the destinations are still missing. @@ -3218,41 +3210,17 @@ void SAL_CALL SwXTextDocument::render( { SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); } - // <-- pVwSh->SetPDFExportOption( sal_False ); - - // last page to be rendered? (not necessarily the last page of the document) - // -> do clean-up of data - if (bLastPage) - { - // #i96167# haggai: delete ViewOptionsAdjust here because it makes use - // of the shell, which might get destroyed in lcl_DisposeView! - if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) - m_pRenderData->ViewOptionAdjustStop(); - - if (m_pRenderData && m_pRenderData->HasPostItData()) - m_pRenderData->DeletePostItData(); - if (m_pHiddenViewFrame) - { - lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); - m_pHiddenViewFrame = 0; - - // prevent crash described in #i108805 - SwDocShell *pRenderDocShell = pDoc->GetDocShell(); - SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet(); - pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); - - } - } } } } } - if( bLastPage ) + // last page to be rendered? (not necessarily the last page of the document) + // -> do clean-up of data + if ( bLastPage ) { - delete m_pRenderData; m_pRenderData = NULL; - delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; + CleanUpRenderingData(); } } /* -----------------------------03.10.04 ------------------------------------- @@ -3510,21 +3478,35 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( return aLanguages; } -// #121125# react on ViewShell change; a reference to the ViewShell is -// held in SwViewOptionAdjust_Impl, thus needs to be cleaned up -void SwXTextDocument::ReactOnViewShellChange() +// #121125#, #122868# +// method to assure clean up of the rendering data to restore view options +// and to loose hold reference to the ViewShell in SwViewOptionAdjust_Impl. +// also perform clean up for the still existing hidden frame for PDF export from Page Preview +void SwXTextDocument::CleanUpRenderingData() { - if(m_pRenderData) + if( m_pRenderData != NULL ) { + if ( m_pRenderData->HasPostItData() ) + { + m_pRenderData->DeletePostItData(); + } delete m_pRenderData; m_pRenderData = NULL; } - if(m_pPrintUIOptions) + if( m_pPrintUIOptions != NULL ) { delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; } + + if ( IsValid() && m_pHiddenViewFrame ) + { + lcl_DisposeView( m_pHiddenViewFrame, pDocShell); + m_pHiddenViewFrame = 0; + SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet(); + pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); + } } /* -----------------25.10.99 11:06------------------- diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index c825951eea56..06bb93d8ab29 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -417,7 +417,7 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow) if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() && (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE ) { - String sEntry = aFmtFld->GetFld()->GetPar2(); + String sEntry = aFmtFld->GetField()->GetPar2(); RemoveNewline(sEntry); SwPostItContent* pCnt = new SwPostItContent( this, @@ -428,25 +428,6 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow) nMemberCount++; } } - /* - // this code can be used once we want redline comments in the margin - else // redcomment - { - SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster()); - if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) ) - { - String sEntry = pRedline->GetComment(); - RemoveNewline(sEntry); - SwPostItContent* pCnt = new SwPostItContent( - this, - sEntry, // hier steht der Text - pRedline, - nMemberCount); - pMember->Insert(pCnt); - nMemberCount++; - } - } - */ } } // @@ -784,7 +765,7 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged) if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() && (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE ) { - String sEntry = aFmtFld->GetFld()->GetPar2(); + String sEntry = aFmtFld->GetField()->GetPar2(); RemoveNewline(sEntry); SwPostItContent* pCnt = new SwPostItContent( this, diff --git a/sysui/desktop/icons/main.icns b/sysui/desktop/icons/main.icns Binary files differindex df341eb9c7cc..e42a021298ce 100755 --- a/sysui/desktop/icons/main.icns +++ b/sysui/desktop/icons/main.icns diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx index 0f8ba2d9b977..632db629c015 100644 --- a/tools/source/generic/toolsin.cxx +++ b/tools/source/generic/toolsin.cxx @@ -31,7 +31,7 @@ #include <tools/debug.hxx> #include <toolsin.hxx> -#if defined WNT || defined OS2 +#if defined WNT #include <dll.hxx> #endif diff --git a/unoil/climaker/version.txt b/unoil/climaker/version.txt index e4018699c7bf..b4f6c18bd825 100644 --- a/unoil/climaker/version.txt +++ b/unoil/climaker/version.txt @@ -19,8 +19,8 @@ # #************************************************************** -CLI_OOOTYPES_NEW_VERSION=1.0.8.0 -CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.7.0 -CLI_OOOTYPES_POLICY_VERSION=8.0.0.0 +CLI_OOOTYPES_NEW_VERSION=1.0.9.0 +CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.8.0 +CLI_OOOTYPES_POLICY_VERSION=9.0.0.0 CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index a7663bd6f966..cfc7a8f8bf20 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -393,25 +393,42 @@ public: @param rTransformation The back transformation for each pixel in (0 .. fWidth),(0 .. fHeight) to local pixel coordiantes + + @param bSmooth + Defines if pixel interpolation is to be used to create the result */ BitmapEx TransformBitmapEx( double fWidth, double fHeight, - const basegfx::B2DHomMatrix& rTransformation) const; + const basegfx::B2DHomMatrix& rTransformation, + bool bSmooth = true) const; /** Create transformed Bitmap @param rTransformation - The transformation from unit coordinates to target + The transformation from unit coordinates to the unit range + + @param rVisibleRange + The relative visible range in unit coordinates, relative to (0,0,1,1) which + defines the whole target area @param fMaximumArea A limitation for the maximum size of pixels to use for the result + @param bSmooth + Defines if pixel interpolation is to be used to create the result + + The traget size of the result bitmap is defined by transforming the given + rTargetRange with the given rTransformation; the area of the result is + linearly scaled to not exceed the given fMaximumArea + @return The transformed bitmap */ BitmapEx getTransformed( const basegfx::B2DHomMatrix& rTransformation, - double fMaximumArea = 500000.0) const; + const basegfx::B2DRange& rVisibleRange, + double fMaximumArea = 500000.0, + bool bSmooth = true) const; /** Create ColorStack-modified version of this BitmapEx diff --git a/vcl/inc/vcl/bmpacc.hxx b/vcl/inc/vcl/bmpacc.hxx index c22e865f0d8e..2a51304de177 100644 --- a/vcl/inc/vcl/bmpacc.hxx +++ b/vcl/inc/vcl/bmpacc.hxx @@ -171,6 +171,16 @@ public: inline BitmapColor GetColor( long nY, long nX ) const; inline sal_uInt8 GetPixelIndex( long nY, long nX ) const; inline sal_uInt8 GetLuminance( long nY, long nX ) const; + + /** Get the interpolated color at coordinates fY, fX; if outside, return rFallback */ + BitmapColor GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const; + + /** Get the color at coordinates fY, fX; if outside, return rFallback. Automatically does the correct + inside/outside checks, e.g. static_cast< sal_uInt32 >(-0.25) *is* 0, not -1 and has to be outside */ + BitmapColor GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const; + + /** Get the color at coordinates nY, nX; if outside, return rFallback */ + BitmapColor GetColorWithFallback( long nY, long nX, const BitmapColor& rFallback ) const; }; // --------------------- diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index e9152bd6c433..8e06945bf951 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -837,7 +837,7 @@ USHORT Os2SalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) return 0; } -#if OSL_DEBUG_LEVEL>1 +#if OSL_DEBUG_LEVEL>10 debug_printf( "Os2SalGraphics::SetFont\n"); #endif diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx index 6294579d8696..b98694eee318 100644 --- a/vcl/os2/source/gdi/salprn.cxx +++ b/vcl/os2/source/gdi/salprn.cxx @@ -57,32 +57,8 @@ #include <print.h> #include <jobset.h> -/* -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/XFilePicker.hpp> -#include <com/sun/star/ui/dialogs/XFilterManager.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <comphelper/processfactory.hxx> -*/ - #include <malloc.h> -/* -#define _SV_SALPRN_CXX -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salframe.h> -#include <vcl/salptype.hxx> -#include <salprn.h> -#include <vcl/print.h> -#include <vcl/jobset.h> - -*/ - #ifndef __H_FT2LIB #include <os2/wingdi.h> #include <ft2lib.h> @@ -583,11 +559,15 @@ static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter ) static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData ) { + // if not defined, suppose default orientation is portrait + Orientation orientation = ORIENTATION_PORTRAIT; + ImplFreeFormAndTrayList( pOs2SalInfoPrinter ); LONG alQuery[] = { 0, 0, // First two members of QUERYSIZE + DJP_SJ_ORIENTATION, DJP_CURRENT, DJP_CJ_FORM, DJP_ALL, DJP_CJ_TRAYNAME, DJP_ALL, DJP_NONE, DJP_NONE // EOL marker @@ -638,7 +618,18 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const PQUERYTUPLE pTuple = pQuerySize->aTuples; while ( DJP_NONE != pTuple->ulProperty ) { - if ( pDJP->ulProperty == DJP_CJ_FORM ) + if ( pDJP->ulProperty == DJP_SJ_ORIENTATION ) + { + if ( pDJP->ulNumReturned ) + { + PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION ); + if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) ) + orientation = ORIENTATION_PORTRAIT; + else + orientation = ORIENTATION_LANDSCAPE; + } + } + else if ( pDJP->ulProperty == DJP_CJ_FORM ) { if ( pDJP->ulNumReturned ) { @@ -649,11 +640,20 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) { ImplFormInfo* pInfo = new ImplFormInfo; - pInfo->mnPaperWidth = pElm->hcInfo.cx; - pInfo->mnPaperHeight = pElm->hcInfo.cy; + // AOO expects form size always in portrait mode + if (orientation == ORIENTATION_PORTRAIT) + { + pInfo->mnPaperWidth = pElm->hcInfo.cx; + pInfo->mnPaperHeight = pElm->hcInfo.cy; + } + else + { + pInfo->mnPaperWidth = pElm->hcInfo.cy; + pInfo->mnPaperHeight = pElm->hcInfo.cx; + } #if OSL_DEBUG_LEVEL>0 - printf("ImplGetFormAndTrayList mnPaperWidth %d\n", pInfo->mnPaperWidth); - printf("ImplGetFormAndTrayList mnPaperHeight %d\n", pInfo->mnPaperHeight); + debug_printf("ImplGetFormAndTrayList #%d: %d x %d", + i, pInfo->mnPaperWidth, pInfo->mnPaperHeight); #endif pInfo->mnId = pElm->djppsFormID; pOs2SalInfoPrinter->mpFormArray[i] = pInfo; @@ -865,6 +865,9 @@ static sal_Bool ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData, DJP_SJ_ORIENTATION, DJP_CURRENT, DJP_NONE, DJP_NONE // EOL marker }; +#if OSL_DEBUG_LEVEL>0 + debug_printf( "ImplSetOrientation mhDC %x, %d", hPrinterDC, eOrientation); +#endif APIRET rc; PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; @@ -1164,6 +1167,7 @@ Os2SalInfoPrinter::Os2SalInfoPrinter() mpFormArray = NULL; mnTrayCount = 0; mpTrayArray = NULL; + m_bPapersInit = FALSE; } // ----------------------------------------------------------------------- @@ -1181,6 +1185,42 @@ Os2SalInfoPrinter::~Os2SalInfoPrinter() // ----------------------------------------------------------------------- +void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) +{ +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalInfoPrinter::InitPaperFormats pSetupData %x", + pSetupData); +#endif + + m_aPaperFormats.clear(); + m_bPapersInit = true; + + // init paperbinlist if empty + if ( !mnTrayCount ) + ImplGetFormAndTrayList( this, pSetupData ); + + for( int i = 0; i < mnFormCount; i++) + { + PaperInfo aInfo( mpFormArray[i]->mnPaperWidth * 100, + mpFormArray[i]->mnPaperHeight * 100); +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalInfoPrinter::InitPaperFormats #%d: %d x %d", + i, mpFormArray[i]->mnPaperWidth * 100, + mpFormArray[i]->mnPaperHeight * 100); +#endif + m_aPaperFormats.push_back( aInfo ); + } +} + +// ----------------------------------------------------------------------- + +int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) +{ + return 900; +} + +// ----------------------------------------------------------------------- + SalGraphics* Os2SalInfoPrinter::GetGraphics() { if ( mbGraphics ) @@ -1292,6 +1332,11 @@ sal_Bool Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) { +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalInfoPrinter::SetData nFlags %x, pSetupData %x", + nFlags, pSetupData); +#endif + // needs DJP support if ( !mbDJPSupported ) return FALSE; @@ -1306,6 +1351,9 @@ sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) // set orientation if ( nFlags & SAL_JOBSET_ORIENTATION ) { +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalInfoPrinter::SetData meOrientation %d", pSetupData->meOrientation); +#endif if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) ) bOK = TRUE; } @@ -1687,6 +1735,9 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName, // Can we print with DJP mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC ); +#if OSL_DEBUG_LEVEL>0 + debug_printf( "mbPrintDJPSupported %d", mbPrintDJPSupported); +#endif // JobName ermitteln und Job starten PSZ pszJobName = NULL; @@ -1697,9 +1748,10 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName, nJobNameLen = jobName.Len(); } rc = DevEscape( mhDC, - DEVESC_STARTDOC, + mbPrintDJPSupported ? DEVESC_STARTDOC_WPROP : DEVESC_STARTDOC, nJobNameLen, (PBYTE)pszJobName, - 0, (PBYTE)NULL ); + &((PDRIVDATA)(pSetupData->mpDriverData))->cb, + (PBYTE)(pSetupData->mpDriverData)); if ( rc != DEV_OK ) { @@ -1770,6 +1822,13 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo { APIRET rc; +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalPrinter::StartPage mhDC %x, mbFirstPage %d, bNewJobSetup %d", + mhDC, mbFirstPage, bNewJobSetup); + debug_printf( "Os2SalPrinter::StartPage pSetupData %x", + pSetupData); +#endif + if ( mbFirstPage ) mbFirstPage = FALSE; else @@ -1840,6 +1899,10 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo sal_Bool Os2SalPrinter::EndPage() { +#if OSL_DEBUG_LEVEL>0 + debug_printf( "Os2SalPrinter::EndPage mhDC %x", mhDC); +#endif + if ( mpGraphics ) { // destroy SalGraphics @@ -1857,14 +1920,3 @@ ULONG Os2SalPrinter::GetErrorCode() { return mnError; } - -void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::InitPaperFormats\n"); -} -int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::GetLandscapeAngle\n"); - return 0; -} - diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index d40cbdad0985..cc695852bf24 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -799,7 +799,10 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo } while (flags & MORE_COMPONENTS); - + // #i123417# some fonts like IFAOGrec have no outline points in some compound glyphs + // so this unlikely but possible scenario should be handled gracefully + if( myPoints.empty() ) + return 0; np = myPoints.size(); @@ -2787,7 +2790,7 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID) /* now calculate npoints and ncontours */ ControlPoint *cp; n = GetTTGlyphPoints(ttf, glyphID, &cp); - if (n != -1) { + if( n > 0) { m = 0; for (i = 0; i < n; i++) { if (cp[i].flags & 0x8000) m++; diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index b44ea2e41d8f..7345cb032ad6 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -845,87 +845,6 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const namespace { - void impSmoothPoint(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) - { - double fDeltaX(rSource.getX() - nIntX); - double fDeltaY(rSource.getY() - nIntY); - sal_Int32 nIndX(0L); - sal_Int32 nIndY(0L); - - if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) - { - nIndX++; - } - else if(fDeltaX < 0.0 && nIntX >= 1L) - { - fDeltaX = -fDeltaX; - nIndX--; - } - - if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) - { - nIndY++; - } - else if(fDeltaY < 0.0 && nIntY >= 1L) - { - fDeltaY = -fDeltaY; - nIndY--; - } - - if(nIndX || nIndY) - { - const double fColorToReal(1.0 / 255.0); - double fR(rValue.GetRed() * fColorToReal); - double fG(rValue.GetGreen() * fColorToReal); - double fB(rValue.GetBlue() * fColorToReal); - double fRBottom(0.0), fGBottom(0.0), fBBottom(0.0); - - if(nIndX) - { - const double fMulA(fDeltaX * fColorToReal); - double fMulB(1.0 - fDeltaX); - const BitmapColor aTopPartner(rRead.GetColor(nIntY, nIntX + nIndX)); - - fR = (fR * fMulB) + (aTopPartner.GetRed() * fMulA); - fG = (fG * fMulB) + (aTopPartner.GetGreen() * fMulA); - fB = (fB * fMulB) + (aTopPartner.GetBlue() * fMulA); - - if(nIndY) - { - fMulB *= fColorToReal; - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - const BitmapColor aBottomPartner(rRead.GetColor(nIntY + nIndY, nIntX + nIndX)); - - fRBottom = (aBottom.GetRed() * fMulB) + (aBottomPartner.GetRed() * fMulA); - fGBottom = (aBottom.GetGreen() * fMulB) + (aBottomPartner.GetGreen() * fMulA); - fBBottom = (aBottom.GetBlue() * fMulB) + (aBottomPartner.GetBlue() * fMulA); - } - } - - if(nIndY) - { - if(!nIndX) - { - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - - fRBottom = aBottom.GetRed() * fColorToReal; - fGBottom = aBottom.GetGreen() * fColorToReal; - fBBottom = aBottom.GetBlue() * fColorToReal; - } - - const double fMulB(1.0 - fDeltaY); - - fR = (fR * fMulB) + (fRBottom * fDeltaY); - fG = (fG * fMulB) + (fGBottom * fDeltaY); - fB = (fB * fMulB) + (fBBottom * fDeltaY); - } - - rValue.SetRed((sal_uInt8)(fR * 255.0)); - rValue.SetGreen((sal_uInt8)(fG * 255.0)); - rValue.SetBlue((sal_uInt8)(fB * 255.0)); - } - } - Bitmap impTransformBitmap( const Bitmap& rSource, const Size aDestinationSize, @@ -937,54 +856,41 @@ namespace if(pWrite) { - const Size aContentSizePixel(rSource.GetSizePixel()); + //const Size aContentSizePixel(rSource.GetSizePixel()); BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); if(pRead) { const Size aDestinationSizePixel(aDestination.GetSizePixel()); - bool bWorkWithIndex(rSource.GetBitCount() <= 8); - BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff)); + const BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff)); for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) { for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) { const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); - const sal_Int32 nIntX(basegfx::fround(aSourceCoor.getX())); - if(nIntX >= 0L && nIntX < aContentSizePixel.getWidth()) + if(bSmooth) { - const sal_Int32 nIntY(basegfx::fround(aSourceCoor.getY())); - - if(nIntY >= 0L && nIntY < aContentSizePixel.getHeight()) - { - // inside pixel - BitmapColor aValue; - - if(bWorkWithIndex) - { - aValue = pRead->GetPaletteColor(pRead->GetPixelIndex(nIntY, nIntX)); - } - else - { - aValue = pRead->GetPixel(nIntY, nIntX); - } - - if(bSmooth) - { - impSmoothPoint(aValue, aSourceCoor, nIntX, nIntY, *pRead); - } - - pWrite->SetPixel(y, x, aValue); - continue; - } + pWrite->SetPixel( + y, + x, + pRead->GetInterpolatedColorWithFallback( + aSourceCoor.getY(), + aSourceCoor.getX(), + aOutside)); } - - // here are outside pixels. Complete mask - if(bWorkWithIndex) + else { - pWrite->SetPixel(y, x, aOutside); + // this version does the correct <= 0.0 checks, so no need + // to do the static_cast< sal_Int32 > self and make an error + pWrite->SetPixel( + y, + x, + pRead->GetColorWithFallback( + aSourceCoor.getY(), + aSourceCoor.getX(), + aOutside)); } } } @@ -1000,25 +906,26 @@ namespace return aDestination; } } // end of anonymous namespace + BitmapEx BitmapEx::TransformBitmapEx( double fWidth, double fHeight, - const basegfx::B2DHomMatrix& rTransformation) const + const basegfx::B2DHomMatrix& rTransformation, + bool bSmooth) const { if(fWidth <= 1 || fHeight <= 1) return BitmapEx(); // force destination to 24 bit, we want to smooth output const Size aDestinationSize(basegfx::fround(fWidth), basegfx::fround(fHeight)); - static bool bDoSmoothAtAll(true); - const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bDoSmoothAtAll)); + const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bSmooth)); // create mask if(IsTransparent()) { if(IsAlpha()) { - const Bitmap aAlpha(impTransformBitmap(GetAlpha().GetBitmap(), aDestinationSize, rTransformation, bDoSmoothAtAll)); + const Bitmap aAlpha(impTransformBitmap(GetAlpha().GetBitmap(), aDestinationSize, rTransformation, bSmooth)); return BitmapEx(aDestination, AlphaMask(aAlpha)); } else @@ -1035,7 +942,9 @@ BitmapEx BitmapEx::TransformBitmapEx( BitmapEx BitmapEx::getTransformed( const basegfx::B2DHomMatrix& rTransformation, - double fMaximumArea) const + const basegfx::B2DRange& rVisibleRange, + double fMaximumArea, + bool bSmooth) const { BitmapEx aRetval; @@ -1048,20 +957,31 @@ BitmapEx BitmapEx::getTransformed( if(!nSourceWidth || !nSourceHeight) return aRetval; - // Get dest range + // Get aOutlineRange basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); + aOutlineRange.transform(rTransformation); - // get target size - double fWidth(aOutlineRange.getWidth()); - double fHeight(aOutlineRange.getHeight()); + // create visible range from it by moving from relative to absolute + basegfx::B2DRange aVisibleRange(rVisibleRange); + + aVisibleRange.transform( + basegfx::tools::createScaleTranslateB2DHomMatrix( + aOutlineRange.getRange(), + aOutlineRange.getMinimum())); + + // get target size (which is visible range's size) + double fWidth(aVisibleRange.getWidth()); + double fHeight(aVisibleRange.getHeight()); if(fWidth < 1.0 || fHeight < 1.0) + { return aRetval; + } // test if discrete size (pixel) maybe too big and limit it const double fArea(fWidth * fHeight); - const bool bNeedToReduce(fArea > fMaximumArea); + const bool bNeedToReduce(basegfx::fTools::more(fArea, fMaximumArea)); double fReduceFactor(1.0); if(bNeedToReduce) @@ -1082,8 +1002,10 @@ BitmapEx BitmapEx::getTransformed( // aOutlineRange aTransform = rTransformation * aTransform; - // substract top-left of aOutlineRange - aTransform.translate(-aOutlineRange.getMinX(), -aOutlineRange.getMinY()); + // substract top-left of absolute VisibleRange + aTransform.translate( + -aVisibleRange.getMinX(), + -aVisibleRange.getMinY()); // scale to target pixels (if needed) if(bNeedToReduce) @@ -1095,7 +1017,7 @@ BitmapEx BitmapEx::getTransformed( aTransform.invert(); // create bitmap using source, destination and linear back-transformation - aRetval = TransformBitmapEx(fWidth, fHeight, aTransform); + aRetval = TransformBitmapEx(fWidth, fHeight, aTransform, bSmooth); return aRetval; } @@ -1109,58 +1031,110 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; ) { - const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a); + const basegfx::BColorModifierSharedPtr& rModifier = rBColorModifierStack.getBColorModifier(--a); + const basegfx::BColorModifier_replace* pReplace = dynamic_cast< const basegfx::BColorModifier_replace* >(rModifier.get()); - switch(rModifier.getMode()) + if(pReplace) { - case basegfx::BCOLORMODIFYMODE_REPLACE : + // complete replace + if(IsTransparent()) { - // complete replace - if(IsTransparent()) + // clear bitmap with dest color + if(aChangedBitmap.GetBitCount() <= 8) { - // clear bitmap with dest color - if(aChangedBitmap.GetBitCount() <= 8) - { - // do NOT use erase; for e.g. 8bit Bitmaps, the nearest color to the given - // erase color is determined and used -> this may be different from what is - // wanted here. Better create a new bitmap with the needed color explicitely - BitmapReadAccess* pReadAccess = aChangedBitmap.AcquireReadAccess(); - OSL_ENSURE(pReadAccess, "Got no Bitmap ReadAccess ?!?"); + // do NOT use erase; for e.g. 8bit Bitmaps, the nearest color to the given + // erase color is determined and used -> this may be different from what is + // wanted here. Better create a new bitmap with the needed color explicitely + BitmapReadAccess* pReadAccess = aChangedBitmap.AcquireReadAccess(); + OSL_ENSURE(pReadAccess, "Got no Bitmap ReadAccess ?!?"); - if(pReadAccess) - { - BitmapPalette aNewPalette(pReadAccess->GetPalette()); - aNewPalette[0] = BitmapColor(Color(rModifier.getBColor())); - aChangedBitmap = Bitmap( - aChangedBitmap.GetSizePixel(), - aChangedBitmap.GetBitCount(), - &aNewPalette); - delete pReadAccess; - } - } - else + if(pReadAccess) { - aChangedBitmap.Erase(Color(rModifier.getBColor())); + BitmapPalette aNewPalette(pReadAccess->GetPalette()); + aNewPalette[0] = BitmapColor(Color(pReplace->getBColor())); + aChangedBitmap = Bitmap( + aChangedBitmap.GetSizePixel(), + aChangedBitmap.GetBitCount(), + &aNewPalette); + delete pReadAccess; } } else { - // erase bitmap, caller will know to paint direct - aChangedBitmap.SetEmpty(); + aChangedBitmap.Erase(Color(pReplace->getBColor())); } - - bDone = true; - break; + } + else + { + // erase bitmap, caller will know to paint direct + aChangedBitmap.SetEmpty(); } - default : // BCOLORMODIFYMODE_INTERPOLATE, BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE + bDone = true; + } + else + { + BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess(); + + if(pContent) { - BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess(); + const double fConvertColor(1.0 / 255.0); + + if(pContent->HasPalette()) + { + const sal_uInt16 nCount(pContent->GetPaletteEntryCount()); + + for(sal_uInt16 a(0); a < nCount; a++) + { + const BitmapColor& rCol = pContent->GetPaletteColor(a); + const basegfx::BColor aBSource( + rCol.GetRed() * fConvertColor, + rCol.GetGreen() * fConvertColor, + rCol.GetBlue() * fConvertColor); + const basegfx::BColor aBDest(rModifier->getModifiedColor(aBSource)); + pContent->SetPaletteColor(a, BitmapColor(Color(aBDest))); + } + } + else if(BMP_FORMAT_24BIT_TC_BGR == pContent->GetScanlineFormat()) + { + for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) + { + Scanline pScan = pContent->GetScanline(y); - if(pContent) + for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) + { + const basegfx::BColor aBSource( + *(pScan + 2)* fConvertColor, + *(pScan + 1) * fConvertColor, + *pScan * fConvertColor); + const basegfx::BColor aBDest(rModifier->getModifiedColor(aBSource)); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getBlue() * 255.0); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getGreen() * 255.0); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getRed() * 255.0); + } + } + } + else if(BMP_FORMAT_24BIT_TC_RGB == pContent->GetScanlineFormat()) { - const double fConvertColor(1.0 / 255.0); + for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) + { + Scanline pScan = pContent->GetScanline(y); + for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) + { + const basegfx::BColor aBSource( + *pScan * fConvertColor, + *(pScan + 1) * fConvertColor, + *(pScan + 2) * fConvertColor); + const basegfx::BColor aBDest(rModifier->getModifiedColor(aBSource)); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getRed() * 255.0); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getGreen() * 255.0); + *pScan++ = static_cast< sal_uInt8 >(aBDest.getBlue() * 255.0); + } + } + } + else + { for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) { for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) @@ -1170,16 +1144,14 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod (double)aBMCol.GetRed() * fConvertColor, (double)aBMCol.GetGreen() * fConvertColor, (double)aBMCol.GetBlue() * fConvertColor); - const basegfx::BColor aBDest(rModifier.getModifiedColor(aBSource)); + const basegfx::BColor aBDest(rModifier->getModifiedColor(aBSource)); pContent->SetPixel(y, x, BitmapColor(Color(aBDest))); } } - - delete pContent; } - break; + delete pContent; } } } diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index ae41737b1667..9e2ab2df9f91 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -324,6 +324,126 @@ sal_uInt16 BitmapReadAccess::GetBestPaletteIndex( const BitmapColor& rBitmapColo return( HasPalette() ? mpBuffer->maPalette.GetBestIndex( rBitmapColor ) : 0 ); } +BitmapColor BitmapReadAccess::GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const +{ + // ask directly doubles >= 0.0 here to avoid rounded values of 0 at small negative + // double values, e.g. static_cast< sal_Int32 >(-0.25) is 0, not -1, but *has* to be outside (!) + if(mpBuffer && fX >= 0.0 && fY >= 0.0) + { + const sal_Int32 nX(static_cast< sal_Int32 >(fX)); + const sal_Int32 nY(static_cast< sal_Int32 >(fY)); + + if(nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight) + { + // get base-return value from inside pixel + BitmapColor aRetval(GetColor(nY, nX)); + + // calculate deltas and indices for neighbour accesses + sal_Int16 nDeltaX((fX - (nX + 0.5)) * 255.0); // [-255 .. 255] + sal_Int16 nDeltaY((fY - (nY + 0.5)) * 255.0); // [-255 .. 255] + sal_Int16 nIndX(0); + sal_Int16 nIndY(0); + + if(nDeltaX > 0) + { + nIndX = nX + 1; + } + else + { + nIndX = nX - 1; + nDeltaX = -nDeltaX; + } + + if(nDeltaY > 0) + { + nIndY = nY + 1; + } + else + { + nIndY = nY - 1; + nDeltaY = -nDeltaY; + } + + // get right/left neighbour + BitmapColor aXCol(rFallback); + + if(nDeltaX && nIndX >= 0 && nIndX < mpBuffer->mnWidth) + { + aXCol = GetColor(nY, nIndX); + } + + // get top/bottom neighbour + BitmapColor aYCol(rFallback); + + if(nDeltaY && nIndY >= 0 && nIndY < mpBuffer->mnHeight) + { + aYCol = GetColor(nIndY, nX); + } + + // get one of four edge neighbours + BitmapColor aXYCol(rFallback); + + if(nDeltaX && nDeltaY && nIndX >=0 && nIndY >= 0 && nIndX < mpBuffer->mnWidth && nIndY < mpBuffer->mnHeight) + { + aXYCol = GetColor(nIndY, nIndX); + } + + // merge return value with right/left neighbour + if(aXCol != aRetval) + { + aRetval.Merge(aXCol, 255 - nDeltaX); + } + + // merge top/bottom neighbour with edge + if(aYCol != aXYCol) + { + aYCol.Merge(aXYCol, 255 - nDeltaX); + } + + // merge return value with already merged top/bottom neighbour + if(aRetval != aYCol) + { + aRetval.Merge(aYCol, 255 - nDeltaY); + } + + return aRetval; + } + } + + return rFallback; +} + +BitmapColor BitmapReadAccess::GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const +{ + // ask directly doubles >= 0.0 here to avoid rounded values of 0 at small negative + // double values, e.g. static_cast< sal_Int32 >(-0.25) is 0, not -1, but *has* to be outside (!) + if(mpBuffer && fX >= 0.0 && fY >= 0.0) + { + const sal_Int32 nX(static_cast< sal_Int32 >(fX)); + const sal_Int32 nY(static_cast< sal_Int32 >(fY)); + + if(nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight) + { + return GetColor(nY, nX); + } + } + + return rFallback; +} + +BitmapColor BitmapReadAccess::GetColorWithFallback( long nY, long nX, const BitmapColor& rFallback ) const +{ + if(mpBuffer) + { + if(nX >= 0 && nY >= 0 && nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight) + { + return GetColor(nY, nX); + } + } + + return rFallback; +} + // --------------------- // - BitmapWriteAccess - // --------------------- diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 8e2c0e5970b2..bdfce54454aa 100755 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -388,12 +388,12 @@ void ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess& while ( !bEndDecoding && ( nY >= 0L ) ); } -bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown) +bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown, bool& rAlphaUsed) { const sal_uLong nAlignedWidth = AlignedWidth4Bytes(rHeader.nWidth * rHeader.nBitCount); - sal_uInt32 nRMask(0); - sal_uInt32 nGMask(0); - sal_uInt32 nBMask(0); + sal_uInt32 nRMask(( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL); + sal_uInt32 nGMask(( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL); + sal_uInt32 nBMask(( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL); bool bNative(false); bool bTCMask(!pAccAlpha && ((16 == rHeader.nBitCount) || (32 == rHeader.nBitCount))); bool bRLE((RLE_8 == rHeader.nCompression && 8 == rHeader.nBitCount) || (RLE_4 == rHeader.nCompression && 4 == rHeader.nBitCount)); @@ -430,21 +430,12 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r else { // Read color mask - if(bTCMask) + if(bTCMask && BITFIELDS == rHeader.nCompression) { - if(BITFIELDS == rHeader.nCompression) - { - rIStm.SeekRel( -12L ); - rIStm >> nRMask; - rIStm >> nGMask; - rIStm >> nBMask; - } - else - { - nRMask = ( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL; - nGMask = ( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL; - nBMask = ( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL; - } + rIStm.SeekRel( -12L ); + rIStm >> nRMask; + rIStm >> nGMask; + rIStm >> nBMask; } if(bRLE) @@ -601,6 +592,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, (sal_uInt8*) pTmp32++ ); rAcc.SetPixel( nY, nX, aColor ); pAccAlpha->SetPixelIndex(nY, nX, sal_uInt8(0xff) - aAlpha); + rAlphaUsed |= bool(0xff != aAlpha); } } } @@ -725,6 +717,8 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon } // read bits + bool bAlphaUsed(false); + if(!pIStm->GetError()) { if(nOffset) @@ -732,7 +726,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon pIStm->SeekRel(nOffset - (pIStm->Tell() - nStmPos)); } - bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown); + bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown, bAlphaUsed); if(bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter) { @@ -758,6 +752,11 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon if(bAlphaPossible) { aNewBmpAlpha.ReleaseAccess(pAccAlpha); + + if(!bAlphaUsed) + { + bAlphaPossible = false; + } } if(bRet) @@ -1240,7 +1239,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& if(pAccAlpha) // only write DIBV5 when asked to do so { aHeader.nV5CSType = 0x57696E20; // LCS_WINDOWS_COLOR_SPACE - aHeader.nV5Intent = 0x00000008; // LCS_GM_ABS_COLORIMETRIC + aHeader.nV5Intent = 0x00000004; // LCS_GM_IMAGES rOStm << aHeader.nV5RedMask; rOStm << aHeader.nV5GreenMask; diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 46f10a8a3534..f13620ad49df 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -43,6 +43,7 @@ #include <window.h> #include <outdata.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #define BAND_MAX_SIZE 512000 @@ -818,8 +819,9 @@ void OutputDevice::DrawTransformedBitmapEx( const bool bSheared(!basegfx::fTools::equalZero(fShearX)); const bool bMirroredX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirroredY(basegfx::fTools::less(aScale.getY(), 0.0)); + static bool bForceToOwnTransformer(false); - if(!bRotated && !bSheared && !bMirroredX && !bMirroredY) + if(!bForceToOwnTransformer && !bRotated && !bSheared && !bMirroredX && !bMirroredY) { // with no rotation, shear or mirroring it can be mapped to DrawBitmapEx // do *not* execute the mirroring here, it's done in the fallback @@ -840,7 +842,7 @@ void OutputDevice::DrawTransformedBitmapEx( const basegfx::B2DHomMatrix aFullTransform(GetViewTransformation() * rTransformation); const bool bTryDirectPaint(!bInvert && !bBitmapChangedColor && !bMetafile && !bPrinter); - if(bTryDirectPaint) + if(!bForceToOwnTransformer && bTryDirectPaint) { // try to paint directly const basegfx::B2DPoint aNull(aFullTransform * basegfx::B2DPoint(0.0, 0.0)); @@ -873,7 +875,7 @@ void OutputDevice::DrawTransformedBitmapEx( if(!bDone) { // take the fallback when no rotate and shear, but mirror (else we would have done this above) - if(!bRotated && !bSheared) + if(!bForceToOwnTransformer && !bRotated && !bSheared) { // with no rotation or shear it can be mapped to DrawBitmapEx // do *not* execute the mirroring here, it's done in the fallback @@ -886,14 +888,139 @@ void OutputDevice::DrawTransformedBitmapEx( // fallback; create transformed bitmap the hard way (back-transform // the pixels) and paint - basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0); - const double fMaximumArea(bMetafile ? 800000.0 : 200000.0); - const BitmapEx aTransformed(rBitmapEx.getTransformed(aFullTransform, fMaximumArea)); - aTargetRange.transform(rTransformation); - const Point aDestPt(basegfx::fround(aTargetRange.getMinX()), basegfx::fround(aTargetRange.getMinY())); - const Size aDestSize(basegfx::fround(aTargetRange.getWidth()), basegfx::fround(aTargetRange.getHeight())); - - DrawBitmapEx(aDestPt, aDestSize, aTransformed); + basegfx::B2DRange aVisibleRange(0.0, 0.0, 1.0, 1.0); + + // limit maximum area to something looking good for non-pixel-based targets (metafile, printer) + // by using a fixed minimum (allow at least, but no need to utilize) for good smooting and an area + // dependent of original size for good quality when e.g. rotated/sheared. Still, limit to a maximum + // to avoid crashes/ressource problems (ca. 1500x3000 here) + const Size& rOriginalSizePixel(rBitmapEx.GetSizePixel()); + const double fOrigArea(rOriginalSizePixel.Width() * rOriginalSizePixel.Height() * 0.5); + const double fOrigAreaScaled(bSheared || bRotated ? fOrigArea * 1.44 : fOrigArea); + double fMaximumArea(std::min(4500000.0, std::max(1000000.0, fOrigAreaScaled))); + + if(!bMetafile && !bPrinter) + { + // limit TargetRange to existing pixels (if pixel device) + // first get discrete range of object + basegfx::B2DRange aFullPixelRange(aVisibleRange); + + aFullPixelRange.transform(aFullTransform); + + if(basegfx::fTools::equalZero(aFullPixelRange.getWidth()) || basegfx::fTools::equalZero(aFullPixelRange.getHeight())) + { + // object is outside of visible area + return; + } + + // now get discrete target pixels; start with OutDev pixel size and evtl. + // intersect with active clipping area + basegfx::B2DRange aOutPixel( + 0.0, + 0.0, + GetOutputSizePixel().Width(), + GetOutputSizePixel().Height()); + + if(IsClipRegion()) + { + const Rectangle aRegionRectangle(GetActiveClipRegion().GetBoundRect()); + + aOutPixel.intersect( // caution! Range from rectangle, one too much (!) + basegfx::B2DRange( + aRegionRectangle.Left(), + aRegionRectangle.Top(), + aRegionRectangle.Right() + 1, + aRegionRectangle.Bottom() + 1)); + } + + if(aOutPixel.isEmpty()) + { + // no active output area + return; + } + + // if aFullPixelRange is not completely inside of aOutPixel, + // reduction of target pixels is possible + basegfx::B2DRange aVisiblePixelRange(aFullPixelRange); + + if(!aOutPixel.isInside(aFullPixelRange)) + { + aVisiblePixelRange.intersect(aOutPixel); + + if(aVisiblePixelRange.isEmpty()) + { + // nothing in visible part, reduces to nothing + return; + } + + // aVisiblePixelRange contains the reduced output area in + // discrete coordinates. To make it useful everywhere, make it relative to + // the object range + basegfx::B2DHomMatrix aMakeVisibleRangeRelative; + + aVisibleRange = aVisiblePixelRange; + aMakeVisibleRangeRelative.translate( + -aFullPixelRange.getMinX(), + -aFullPixelRange.getMinY()); + aMakeVisibleRangeRelative.scale( + 1.0 / aFullPixelRange.getWidth(), + 1.0 / aFullPixelRange.getHeight()); + aVisibleRange.transform(aMakeVisibleRangeRelative); + } + + // for pixel devices, do *not* limit size, else OutputDevice::ImplDrawAlpha + // will create another, badly scaled bitmap to do the job. Nonetheless, do a + // maximum clipping of something big (1600x1280x2). Add 1.0 to avoid rounding + // errors in rough estimations + const double fNewMaxArea(aVisiblePixelRange.getWidth() * aVisiblePixelRange.getHeight()); + + fMaximumArea = std::min(4096000.0, fNewMaxArea + 1.0); + } + + if(!aVisibleRange.isEmpty()) + { + static bool bDoSmoothAtAll(true); + BitmapEx aTransformed(rBitmapEx); + + // #122923# when the result needs an alpha channel due to being rotated or sheared + // and thus uncovering areas, add these channels so that the own transformer (used + // in getTransformed) also creates a transformed alpha channel + if(!aTransformed.IsTransparent() && (bSheared || bRotated)) + { + // parts will be uncovered, extend aTransformed with a mask bitmap + const Bitmap aContent(aTransformed.GetBitmap()); +#if defined(MACOSX) + AlphaMask aMaskBmp(aContent.GetSizePixel()); + aMaskBmp.Erase(0); +#else + Bitmap aMaskBmp(aContent.GetSizePixel(), 1); + aMaskBmp.Erase(Color(COL_BLACK)); // #122758# Initialize to non-transparent +#endif + aTransformed = BitmapEx(aContent, aMaskBmp); + } + + aTransformed = aTransformed.getTransformed( + aFullTransform, + aVisibleRange, + fMaximumArea, + bDoSmoothAtAll); + basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0); + + // get logic object target range + aTargetRange.transform(rTransformation); + + // get from unified/relative VisibleRange to logoc one + aVisibleRange.transform( + basegfx::tools::createScaleTranslateB2DHomMatrix( + aTargetRange.getRange(), + aTargetRange.getMinimum())); + + // extract point and size; do not remove size, the bitmap may have been prepared reduced by purpose + const Point aDestPt(basegfx::fround(aVisibleRange.getMinX()), basegfx::fround(aVisibleRange.getMinY())); + const Size aDestSize(basegfx::fround(aVisibleRange.getWidth()), basegfx::fround(aVisibleRange.getHeight())); + + DrawBitmapEx(aDestPt, aDestSize, aTransformed); + } } } diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 3e798b5ea601..97531772c80b 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -151,6 +151,15 @@ private: sal_Bool mbpHYs; // sal_True if pysical size of pixel available sal_Bool mbIgnoreGammaChunk; +#ifdef DBG_UTIL + // do some checks in debug mode + sal_uInt32 mnAllocSizeScanline; + sal_uInt32 mnAllocSizeScanlineAlpha; +#endif + // the temporary Scanline (and alpha) for direct scanline copy to Bitmap + sal_uInt8* mpScanline; + sal_uInt8* mpScanlineAlpha; + bool ReadNextChunk(); void ReadRemainingChunks(); void SkipRemainingChunks(); @@ -204,7 +213,13 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream ) mbIDAT( sal_False ), mbGamma ( sal_False ), mbpHYs ( sal_False ), - mbIgnoreGammaChunk ( sal_False ) + mbIgnoreGammaChunk ( sal_False ), +#ifdef DBG_UTIL + mnAllocSizeScanline(0), + mnAllocSizeScanlineAlpha(0), +#endif + mpScanline(0), + mpScanlineAlpha(0) { // prepare the PNG data stream mnOrigStreamMode = mrPNGStream.GetNumberFormatInt(); @@ -250,6 +265,9 @@ PNGReaderImpl::~PNGReaderImpl() delete[] mpInflateInBuf; delete[] mpScanPrior; delete mpZCodec; + + delete[] mpScanline; + delete[] mpScanlineAlpha; } // ------------------------------------------------------------------------ @@ -1358,42 +1376,125 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else // no palette => truecolor { - if( mbAlphaChannel ) // has RGB + alpha - { // BMP_FORMAT_32BIT_TC_RGBA + // #122985# Added fast-lane implementations using CopyScanline with direct supported mem formats + static bool bCkeckDirectScanline(true); + + if( mbAlphaChannel ) + { + // has RGB + alpha if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample { - if ( mpColorTable != mpDefaultColorTable ) + // BMP_FORMAT_32BIT_TC_RGBA + // only use DirectScanline when we have no preview shifting stuff and accesses to content and alpha + const bool bDoDirectScanline( + bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift && mpAcc && mpMaskAcc); + const bool bCustomColorTable(mpColorTable != mpDefaultColorTable); + + if(bDoDirectScanline) { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) - ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ], - mpColorTable[ pTmp[ 1 ] ], - mpColorTable[ pTmp[ 2 ] ] ), pTmp[ 3 ] ); + // allocate scanlines on demand, reused for next line + if(!mpScanline) + { +#ifdef DBG_UTIL + mnAllocSizeScanline = maOrigSize.Width() * 3; +#endif + mpScanline = new sal_uInt8[maOrigSize.Width() * 3]; + } + + if(!mpScanlineAlpha) + { +#ifdef DBG_UTIL + mnAllocSizeScanlineAlpha = maOrigSize.Width(); +#endif + mpScanlineAlpha = new sal_uInt8[maOrigSize.Width()]; + } + } + + if(bDoDirectScanline) + { + OSL_ENSURE(mpScanline, "No Scanline allocated (!)"); + OSL_ENSURE(mpScanlineAlpha, "No ScanlineAlpha allocated (!)"); +#ifdef DBG_UTIL + OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)"); + OSL_ENSURE(mnAllocSizeScanlineAlpha >= maOrigSize.Width(), "Allocated ScanlineAlpha too small (!)"); +#endif + sal_uInt8* pScanline(mpScanline); + sal_uInt8* pScanlineAlpha(mpScanlineAlpha); + + for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4) + { + // prepare content line as BGR by reordering when copying + // do not forget to invert alpha (source is alpha, target is opacity) + if(bCustomColorTable) + { + *pScanline++ = mpColorTable[pTmp[2]]; + *pScanline++ = mpColorTable[pTmp[1]]; + *pScanline++ = mpColorTable[pTmp[0]]; + *pScanlineAlpha++ = ~pTmp[3]; + } + else + { + *pScanline++ = pTmp[2]; + *pScanline++ = pTmp[1]; + *pScanline++ = pTmp[0]; + *pScanlineAlpha++ = ~pTmp[3]; + } + } + + // copy scanlines directly to bitmaps for content and alpha; use the formats which + // are able to copy directly to BitmapBuffer + mpAcc->CopyScanline(nY, mpScanline, BMP_FORMAT_24BIT_TC_BGR, maOrigSize.Width() * 3); + mpMaskAcc->CopyScanline(nY, mpScanlineAlpha, BMP_FORMAT_8BIT_PAL, maOrigSize.Width()); } else { -// if ( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible -// { -// int nLineBytes = 4 * maOrigSize.Width(); -// mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_32BIT_TC_RGBA, nLineBytes ); -// pTmp += nLineBytes; -// } -// else + for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) - ImplSetAlphaPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ), pTmp[3] ); + if(bCustomColorTable) + { + ImplSetAlphaPixel( + nY, + nX, + BitmapColor( + mpColorTable[ pTmp[ 0 ] ], + mpColorTable[ pTmp[ 1 ] ], + mpColorTable[ pTmp[ 2 ] ]), + pTmp[ 3 ]); + } + else + { + ImplSetAlphaPixel( + nY, + nX, + BitmapColor( + pTmp[0], + pTmp[1], + pTmp[2]), + pTmp[3]); + } } } } else - { // BMP_FORMAT_64BIT_TC_RGBA + { + // BMP_FORMAT_64BIT_TC_RGBA for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 ) - ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ], - mpColorTable[ pTmp[ 2 ] ], - mpColorTable[ pTmp[ 4 ] ] ), pTmp[6] ); + { + ImplSetAlphaPixel( + nY, + nX, + BitmapColor( + mpColorTable[ pTmp[ 0 ] ], + mpColorTable[ pTmp[ 2 ] ], + mpColorTable[ pTmp[ 4 ] ]), + pTmp[6]); + } } } else if( mbTransparent ) // has RGB + transparency - { // BMP_FORMAT_24BIT_TC_RGB + { + // BMP_FORMAT_24BIT_TC_RGB + // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample { for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) @@ -1402,7 +1503,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) sal_uInt8 nGreen = pTmp[ 1 ]; sal_uInt8 nBlue = pTmp[ 2 ]; sal_Bool bTransparent = ( ( nRed == mnTransRed ) - && ( nGreen == mnTransGreen ) + && ( nGreen == mnTransGreen ) && ( nBlue == mnTransBlue ) ); ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ], @@ -1411,7 +1512,8 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } } else - { // BMP_FORMAT_48BIT_TC_RGB + { + // BMP_FORMAT_48BIT_TC_RGB for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) { sal_uInt8 nRed = pTmp[ 0 ]; @@ -1428,37 +1530,94 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } } else // has RGB but neither alpha nor transparency - { // BMP_FORMAT_24BIT_TC_RGB + { + // BMP_FORMAT_24BIT_TC_RGB + // only use DirectScanline when we have no preview shifting stuff and access to content + const bool bDoDirectScanline( + bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift && mpAcc); + const bool bCustomColorTable(mpColorTable != mpDefaultColorTable); + + if(bDoDirectScanline && !mpScanline) + { + // allocate scanlines on demand, reused for next line +#ifdef DBG_UTIL + mnAllocSizeScanline = maOrigSize.Width() * 3; +#endif + mpScanline = new sal_uInt8[maOrigSize.Width() * 3]; + } + if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample { - if ( mpColorTable != mpDefaultColorTable ) + if(bDoDirectScanline) { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) - ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ], - mpColorTable[ pTmp[ 1 ] ], - mpColorTable[ pTmp[ 2 ] ] ) ); + OSL_ENSURE(mpScanline, "No Scanline allocated (!)"); +#ifdef DBG_UTIL + OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)"); +#endif + sal_uInt8* pScanline(mpScanline); + + for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3) + { + // prepare content line as BGR by reordering when copying + if(bCustomColorTable) + { + *pScanline++ = mpColorTable[pTmp[2]]; + *pScanline++ = mpColorTable[pTmp[1]]; + *pScanline++ = mpColorTable[pTmp[0]]; + } + else + { + *pScanline++ = pTmp[2]; + *pScanline++ = pTmp[1]; + *pScanline++ = pTmp[0]; + } + } + + // copy scanline directly to bitmap for content; use the format which is able to + // copy directly to BitmapBuffer + mpAcc->CopyScanline(nY, mpScanline, BMP_FORMAT_24BIT_TC_BGR, maOrigSize.Width() * 3); } else { - if( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible - { - int nLineBytes = maOrigSize.Width() * 3; - mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_24BIT_TC_RGB, nLineBytes ); - pTmp += nLineBytes; - } - else + for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) - ImplSetPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ) ); + if(bCustomColorTable) + { + ImplSetPixel( + nY, + nX, + BitmapColor( + mpColorTable[ pTmp[ 0 ] ], + mpColorTable[ pTmp[ 1 ] ], + mpColorTable[ pTmp[ 2 ] ])); + } + else + { + ImplSetPixel( + nY, + nX, + BitmapColor( + pTmp[0], + pTmp[1], + pTmp[2])); + } } } } else - { // BMP_FORMAT_48BIT_TC_RGB + { + // BMP_FORMAT_48BIT_TC_RGB + // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) - ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ], - mpColorTable[ pTmp[ 2 ] ], - mpColorTable[ pTmp[ 4 ] ] ) ); + { + ImplSetPixel( + nY, + nX, + BitmapColor( + mpColorTable[ pTmp[ 0 ] ], + mpColorTable[ pTmp[ 2 ] ], + mpColorTable[ pTmp[ 4 ] ])); + } } } } diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 55bb30a332c7..05e191f9a3b5 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1274,9 +1274,10 @@ Rectangle Region::GetBoundRect() const } else { + // #122149# corrected rounding, no need for ceil() and floor() here return Rectangle( - static_cast<sal_Int32>(floor(aRange.getMinX())), static_cast<sal_Int32>(floor(aRange.getMinY())), - static_cast<sal_Int32>(ceil(aRange.getMaxX())), static_cast<sal_Int32>(ceil(aRange.getMaxY()))); + basegfx::fround(aRange.getMinX()), basegfx::fround(aRange.getMinY()), + basegfx::fround(aRange.getMaxX()), basegfx::fround(aRange.getMaxY())); } } diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index b858517a708b..18fef6e76fe9 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1869,12 +1869,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) for( n = 0; n < nLevel; ++n ) maFallbackRuns[n].ResetPos(); // get the next codepoint index that needs fallback - // and limit it to the minindex..endindex bounds int nActiveCharPos = nCharPos[0]; - if( nActiveCharPos < mnMinCharPos) - nActiveCharPos = mnMinCharPos; - else if( nActiveCharPos >= rArgs.mnEndCharPos ) - nActiveCharPos = rArgs.mnEndCharPos - 1; // get the end index of the active run int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])? rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1; @@ -2083,8 +2078,6 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) } } } -// if( !maFallbackRuns[i].PosIsInRun( nActiveCharPos ) ) -// maFallbackRuns[i].NextRun(); } mpLayouts[0]->Simplify( true ); diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index 817aa90e13da..7b93189c5d45 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -429,12 +429,12 @@ BitmapBuffer* StretchAndConvert( } // horizontal mapping table - if( nDstDX != nSrcDX ) + if( (nDstDX != nSrcDX) && (nDstDX != 0) ) { - const double fFactorX = ( nDstDX > 1 ) ? (double) ( nSrcDX - 1 ) / ( nDstDX - 1 ) : 0.0; + const double fFactorX = (double)nSrcDX / nDstDX; for( i = 0L; i < nDstDX; i++ ) - pMapX[ i ] = nSrcX + FRound( i * fFactorX ); + pMapX[ i ] = nSrcX + static_cast<int>( i * fFactorX ); } else { @@ -443,12 +443,12 @@ BitmapBuffer* StretchAndConvert( } // vertical mapping table - if( nDstDY != nSrcDY ) + if( (nDstDY != nSrcDY) && (nDstDY != 0) ) { - const double fFactorY = ( nDstDY > 1 ) ? (double) ( nSrcDY - 1 ) / ( nDstDY - 1 ) : 0.0; + const double fFactorY = (double)nSrcDY / nDstDY; for( i = 0L; i < nDstDY; i++ ) - pMapY[ i ] = nSrcY + FRound( i * fFactorY ); + pMapY[ i ] = nSrcY + static_cast<int>( i * fFactorY ); } else { diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 4d87af444707..005f822e4599 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -313,27 +313,29 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap() sal_uInt8* pSrcRGB(pRGB->mpBits); const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData); + // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible for(sal_uInt32 y(0); y < nH; y++) { const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - for(sal_uInt32 x(0); x < nW; x++) - { - const sal_uInt8 nB(*pSrcRGB++); - const sal_uInt8 nG(*pSrcRGB++); - const sal_uInt8 nR(*pSrcRGB++); - - pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nR, nG, nB)); - } - - pSrcRGB += nExtraRGB; + memcpy(targetPixels, pSrcRGB, nW * 3); + pSrcRGB += nW * 3 + nExtraRGB; } + + pRetval->UnlockBits(&aGdiPlusBitmapData); } } if(pExtraRGB) { + // #123478# shockingly, BitmapBuffer does not free the memory it is controlling + // in it's destructor, this *has to be done handish*. Doing it here now + delete[] pExtraRGB->mpBits; delete pExtraRGB; } else @@ -443,29 +445,38 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); const sal_uInt32 nExtraA(pA->mnScanlineSize - nW); const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData); + // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and + // A from alpha, so inner loop is needed (who invented BitmapEx..?) for(sal_uInt32 y(0); y < nH; y++) { const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); for(sal_uInt32 x(0); x < nW; x++) { - const sal_uInt8 nB(*pSrcRGB++); - const sal_uInt8 nG(*pSrcRGB++); - const sal_uInt8 nR(*pSrcRGB++); - const sal_uInt8 nA(0xff - *pSrcA++); - - pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nA, nR, nG, nB)); + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = 0xff - *pSrcA++; } pSrcRGB += nExtraRGB; pSrcA += nExtraA; } + + pRetval->UnlockBits(&aGdiPlusBitmapData); } } if(pExtraA) { + // #123478# shockingly, BitmapBuffer does not free the memory it is controlling + // in it's destructor, this *has to be done handish*. Doing it here now + delete[] pExtraA->mpBits; delete pExtraA; } else @@ -480,6 +491,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph if(pExtraRGB) { + // #123478# shockingly, BitmapBuffer does not free the memory it is controlling + // in it's destructor, this *has to be done handish*. Doing it here now + delete[] pExtraRGB->mpBits; delete pExtraRGB; } else diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 9a05ce7ad91c..d5e981cb78a6 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -26,20 +26,18 @@ #include <stdio.h> #include <string.h> - #include <rtl/strbuf.hxx> - #include <tools/svwin.h> #include <tools/debug.hxx> #include <tools/poly.hxx> - #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> - +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salgdi.h> #include <win/salframe.h> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace rtl; @@ -859,8 +857,40 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) mhRegion = 0; } - if( i_rClip.HasPolyPolygonOrB2DPolyPolygon() ) + bool bUsePolygon(i_rClip.HasPolyPolygonOrB2DPolyPolygon()); + static bool bTryToAvoidPolygon(true); + + // #122149# try to avoid usage of PolyPolygon ClipRegions when PolyPolygon is no curve + // and only contains horizontal/vertical edges. In that case, use the fallback + // in GetRegionRectangles which will use Region::GetAsRegionBand() which will do + // the correct polygon-to-RegionBand transformation. + // Background is that when using the same Rectangle as rectangle or as Polygon + // clip region will lead to different results; the polygon-based one will be + // one pixel less to the right and down (see GDI docu for CreatePolygonRgn). This + // again is because of the polygon-nature and it's classic handling when filling. + // This also means that all cases which use a 'true' polygon-based incarnation of + // a Region should know what they do - it may lead to repaint errors. + if(bUsePolygon && bTryToAvoidPolygon) + { + const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); + + if(!aPolyPolygon.areControlPointsUsed()) + { + if(basegfx::tools::containsOnlyHorizontalAndVerticalEdges(aPolyPolygon)) + { + bUsePolygon = false; + } + } + } + + if(bUsePolygon) { + // #122149# check the comment above to know that this may lead to potentioal repaint + // problems. It may be solved (if needed) by scaling the polygon by one in X + // and Y. Currently the workaround to only use it if really unavoidable will + // solve most cases. When someone is really using polygon-based Regions he + // should know what he is doing. + // Added code to do that scaling to check if it works, testing it. const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -869,21 +899,38 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) std::vector< POINT > aPolyPoints; aPolyPoints.reserve( 1024 ); std::vector< INT > aPolyCounts( nCount, 0 ); + basegfx::B2DHomMatrix aExpand; + static bool bExpandByOneInXandY(true); - for(sal_uInt32 a(0); a < nCount; a++) + if(bExpandByOneInXandY) { - basegfx::B2DPolygon aPoly(aPolyPolygon.getB2DPolygon(a)); + const basegfx::B2DRange aRangeS(aPolyPolygon.getB2DRange()); + const basegfx::B2DRange aRangeT(aRangeS.getMinimum(), aRangeS.getMaximum() + basegfx::B2DTuple(1.0, 1.0)); + aExpand = basegfx::B2DHomMatrix(basegfx::tools::createSourceRangeTargetRangeTransform(aRangeS, aRangeT)); + } - aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); - const sal_uInt32 nPoints = aPoly.count(); + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aPoly( + basegfx::tools::adaptiveSubdivideByDistance( + aPolyPolygon.getB2DPolygon(a), + 1)); + const sal_uInt32 nPoints(aPoly.count()); aPolyCounts[a] = nPoints; for( sal_uInt32 b = 0; b < nPoints; b++ ) { - basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + basegfx::B2DPoint aPt(aPoly.getB2DPoint(b)); + + if(bExpandByOneInXandY) + { + aPt = aExpand * aPt; + } + POINT aPOINT; - aPOINT.x = (LONG)aPt.getX(); - aPOINT.y = (LONG)aPt.getY(); + // #122149# do correct rounding + aPOINT.x = basegfx::fround(aPt.getX()); + aPOINT.y = basegfx::fround(aPt.getY()); aPolyPoints.push_back( aPOINT ); } } @@ -969,53 +1016,6 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } } - //ImplRegionInfo aInfo; - //long nX, nY, nW, nH; - //bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); - //while( bRegionRect ) - //{ - // if ( nW && nH ) - // { - // long nRight = nX + nW; - // long nBottom = nY + nH; - // - // if ( bFirstClipRect ) - // { - // pBoundRect->left = nX; - // pBoundRect->top = nY; - // pBoundRect->right = nRight; - // pBoundRect->bottom = nBottom; - // bFirstClipRect = false; - // } - // else - // { - // if ( nX < pBoundRect->left ) - // pBoundRect->left = (int)nX; - // - // if ( nY < pBoundRect->top ) - // pBoundRect->top = (int)nY; - // - // if ( nRight > pBoundRect->right ) - // pBoundRect->right = (int)nRight; - // - // if ( nBottom > pBoundRect->bottom ) - // pBoundRect->bottom = (int)nBottom; - // } - // - // pNextClipRect->left = (int)nX; - // pNextClipRect->top = (int)nY; - // pNextClipRect->right = (int)nRight; - // pNextClipRect->bottom = (int)nBottom; - // pNextClipRect++; - // } - // else - // { - // mpClipRgnData->rdh.nCount--; - // mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); - // } - // bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); - //} - // create clip region from ClipRgnData if ( mpClipRgnData->rdh.nCount == 1 ) { @@ -1054,7 +1054,16 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } if( mhRegion ) + { SelectClipRgn( getHDC(), mhRegion ); + + // debug code if you weant to check range of the newly applied ClipRegion + //RECT aBound; + //const int aRegionType = GetRgnBox(mhRegion, &aBound); + // + //bool bBla = true; + } + return mhRegion != 0; } diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 244767240dcb..495fc3f196f9 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -1850,8 +1850,9 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, { // create and reset the new array mpGlyphs2Chars = new int[ mnGlyphCapacity ]; + static const int CHARPOS_NONE = -1; for( int i = 0; i < mnGlyphCount; ++i ) - mpGlyphs2Chars[i] = -1; + mpGlyphs2Chars[i] = CHARPOS_NONE; // calculate the char->glyph mapping for( nItem = 0; nItem < mnItemCount; ++nItem ) { @@ -1867,6 +1868,14 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int i = mpLogClusters[c] + rVI.mnMinGlyphPos; mpGlyphs2Chars[i] = c; } + // use a heuristic to fill the gaps in the glyphs2chars array + c = !rVI.IsRTL() ? rVI.mnMinCharPos : rVI.mnEndCharPos - 1; + for( int i = rVI.mnMinGlyphPos; i < rVI.mnEndGlyphPos; ++i ) { + if( mpGlyphs2Chars[i] == CHARPOS_NONE ) + mpGlyphs2Chars[i] = c; + else + c = mpGlyphs2Chars[i]; + } } } diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index ec6a06712893..593bddf3cc31 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -1037,7 +1037,8 @@ void XMLShapeExport::ImpExportPolygonShape( basegfx::tools::exportToSvgD( aPolyPolygon, true, // bUseRelativeCoordinates - false)); // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible // write point array mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); @@ -1411,7 +1412,8 @@ void XMLShapeExport::ImpExportConnectorShape( basegfx::tools::exportToSvgD( aPolyPolygon, true, // bUseRelativeCoordinates - false)); // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible // write svg:d mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx index b905bb326c21..9e1c99efe0e3 100644 --- a/xmloff/source/draw/shapeexport3.cxx +++ b/xmloff/source/draw/shapeexport3.cxx @@ -124,9 +124,6 @@ void XMLShapeExport::ImpExport3DShape( { case XmlShapeTypeDraw3DCubeObject: { - // write 3DCube shape - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True); - // minEdge aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition"))); drawing::Position3D aPosition3D; @@ -158,13 +155,15 @@ void XMLShapeExport::ImpExport3DShape( mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr); } + // write 3DCube shape + // #123542# Do this *after* the attributes are added, else these will be lost since opening + // the scope will clear the global attribute list at the exporter + SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True); + break; } case XmlShapeTypeDraw3DSphereObject: { - // write 3DSphere shape - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True); - // Center aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition"))); drawing::Position3D aPosition3D; @@ -193,6 +192,11 @@ void XMLShapeExport::ImpExport3DShape( mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr); } + // write 3DSphere shape + // #123542# Do this *after* the attributes are added, else these will be lost since opening + // the scope will clear the global attribute list at the exporter + SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True); + break; } case XmlShapeTypeDraw3DLatheObject: @@ -232,7 +236,8 @@ void XMLShapeExport::ImpExport3DShape( basegfx::tools::exportToSvgD( aPolyPolygon, true, // bUseRelativeCoordinates - false)); // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now + false, // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible // write point array mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx index cbba3ce7814a..65077c57f9d3 100644 --- a/xmloff/source/draw/ximp3dobject.cxx +++ b/xmloff/source/draw/ximp3dobject.cxx @@ -453,7 +453,9 @@ void SdXML3DPolygonBasedShapeContext::StartElement(const uno::Reference< xml::sa if(basegfx::tools::importFromSvgD( aPolyPolygon, - maPoints)) + maPoints, + true, + 0)) { // convert to 3D PolyPolygon const basegfx::B3DPolyPolygon aB3DPolyPolygon( diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index c9591f777a61..540501c34632 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -87,6 +87,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -1342,7 +1343,7 @@ void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAtt const SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); basegfx::B2DVector aSize(aViewBox.GetWidth(), aViewBox.GetHeight()); - // TTTT: Is this correct? It overrides ViewBox stuff; OTOH it makes no + // Is this correct? It overrides ViewBox stuff; OTOH it makes no // sense to have the geometry content size different from object size if(!basegfx::fTools::equalZero(maObjectSize.getX()) && !basegfx::fTools::equalZero(maObjectSize.getY())) { @@ -1441,7 +1442,7 @@ void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib const SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); basegfx::B2DVector aSize(aViewBox.GetWidth(), aViewBox.GetHeight()); - // TTTT: Is this correct? It overrides ViewBox stuff; OTOH it makes no + // Is this correct? It overrides ViewBox stuff; OTOH it makes no // sense to have the geometry content size different from object size if(!basegfx::fTools::equalZero(maObjectSize.getX()) && !basegfx::fTools::equalZero(maObjectSize.getY())) { @@ -1450,7 +1451,7 @@ void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib basegfx::B2DPolyPolygon aPolyPolygon; - if(basegfx::tools::importFromSvgD(aPolyPolygon, maD)) + if(basegfx::tools::importFromSvgD(aPolyPolygon, maD, true, 0)) { if(aPolyPolygon.count()) { @@ -1902,7 +1903,7 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r { basegfx::B2DPolyPolygon aPolyPolygon; - if(basegfx::tools::importFromSvgD(aPolyPolygon, rValue)) + if(basegfx::tools::importFromSvgD(aPolyPolygon, rValue, true, 0)) { if(aPolyPolygon.count()) { diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx index 89f9ce0fd22a..e7932e3642a9 100644 --- a/xmloff/source/style/MarkerStyle.cxx +++ b/xmloff/source/style/MarkerStyle.cxx @@ -107,7 +107,7 @@ sal_Bool XMLMarkerStyleImport::importXML( { basegfx::B2DPolyPolygon aPolyPolygon; - if(basegfx::tools::importFromSvgD(aPolyPolygon, strPathData)) + if(basegfx::tools::importFromSvgD(aPolyPolygon, strPathData, true, 0)) { if(aPolyPolygon.count()) { @@ -213,7 +213,8 @@ sal_Bool XMLMarkerStyleExport::exportXML( basegfx::tools::exportToSvgD( aPolyPolygon, true, // bUseRelativeCoordinates - false)); // bDetectQuadraticBeziers: not used in old, but maybe activated now + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible // write point array rExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 9afbe4e06840..8584d02a9778 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -297,7 +297,9 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( { basegfx::tools::importFromSvgD( aPolyPolygon, - sD); + sD, + true, + 0); } else { @@ -432,6 +434,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext sal_Bool bSyncHeight : 1; sal_Bool bCreateFailed : 1; sal_Bool bOwnBase64Stream : 1; + bool mbSetNameForFrame : 1; // #123261# remember if to set the NameForFrame void Create( sal_Bool bHRefOrBase64 ); @@ -441,14 +444,14 @@ public: const OUString& GetHRef() const { return sHRef; } XMLTextFrameContext_Impl( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const ::rtl::OUString& rLName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & rAttrList, - ::com::sun::star::text::TextContentAnchorType eAnchorType, - sal_uInt16 nType, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList ); + sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & rAttrList, + ::com::sun::star::text::TextContentAnchorType eAnchorType, + sal_uInt16 nType, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList, + bool bSetNameForFrame); // #123261# control if to set the NameForFrame virtual ~XMLTextFrameContext_Impl(); virtual void EndElement(); @@ -473,8 +476,38 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& GetPropSet() const { return xPropSet; } + + // #123261# helper to set the NameForFrame + void SetNameForFrameFromPropSet(); }; +void XMLTextFrameContext_Impl::SetNameForFrameFromPropSet() +{ + // set name + UniReference < XMLTextImportHelper > xTextImportHelper = GetImport().GetTextImport(); + Reference < XNamed > xNamed( xPropSet, UNO_QUERY ); + + if( xNamed.is() && xTextImportHelper.is() ) + { + OUString sOrigName( xNamed->getName() ); + if( !sOrigName.getLength() || + (sName.getLength() && sOrigName != sName) ) + { + OUString sOldName( sName ); + sal_Int32 i = 0; + while( xTextImportHelper->HasFrameByName( sName ) ) + { + sName = sOldName; + sName += OUString::valueOf( ++i ); + } + xNamed->setName( sName ); + if( sName != sOldName ) + xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME, + sOldName, sName ); + } + } +} + void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ ) { UniReference < XMLTextImportHelper > xTextImportHelper = @@ -584,26 +617,12 @@ void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ ) Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - // set name - Reference < XNamed > xNamed( xPropSet, UNO_QUERY ); - if( xNamed.is() ) + // #123261# set name, but only if wanted, e.g. for MultiImageSupport, it will be set after + // it is decided which image will be used. This is done e.g. to avoid double stuff and effects + // for the target to avoid double names + if(mbSetNameForFrame) { - OUString sOrigName( xNamed->getName() ); - if( !sOrigName.getLength() || - (sName.getLength() && sOrigName != sName) ) - { - OUString sOldName( sName ); - sal_Int32 i = 0; - while( xTextImportHelper->HasFrameByName( sName ) ) - { - sName = sOldName; - sName += OUString::valueOf( ++i ); - } - xNamed->setName( sName ); - if( sName != sOldName ) - xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME, - sOldName, sName ); - } + SetNameForFrameFromPropSet(); } // frame style @@ -808,12 +827,13 @@ sal_Bool XMLTextFrameContext_Impl::CreateIfNotThere() } XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( - SvXMLImport& rImport, - sal_uInt16 nPrfx, const OUString& rLName, - const Reference< XAttributeList > & rAttrList, - TextContentAnchorType eATyp, - sal_uInt16 nNewType, - const Reference< XAttributeList > & rFrameAttrList ) + SvXMLImport& rImport, + sal_uInt16 nPrfx, const OUString& rLName, + const Reference< XAttributeList > & rAttrList, + TextContentAnchorType eATyp, + sal_uInt16 nNewType, + const Reference< XAttributeList > & rFrameAttrList, + bool bSetNameForFrame) : SvXMLImportContext( rImport, nPrfx, rLName ) , mbListContextPushed( false ) , sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")) @@ -844,6 +864,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( , sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject")) , nType( nNewType ) , eAnchorType( eATyp ) +, mbSetNameForFrame(bSetNameForFrame) { nX = 0; nY = 0; @@ -1442,10 +1463,22 @@ void XMLTextFrameContext::EndElement() { /// solve if multiple image child contexts were imported /// the winner is returned, if something has yet to be done with it - /*const SvXMLImportContext* pWinner =*/ solveMultipleImages(); + const SvXMLImportContext* pWinner = solveMultipleImages(); + + // #123261# see if the winner is a XMLTextFrameContext_Impl + const XMLTextFrameContext_Impl* pImplWinner = dynamic_cast< const XMLTextFrameContext_Impl* >(pWinner); + + if(pImplWinner) + { + // #123261# if yes, set name now, after the winner is identified (setting at each + // candidate may run into problems due to colliding with efforts in the target to + // avoid double names, so only set one name at one image and not at each) + const_cast< XMLTextFrameContext_Impl* >(pImplWinner)->SetNameForFrameFromPropSet(); + } SvXMLImportContext *pContext = &m_xImplContext; - XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl* >( pContext ); + XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl* >(pContext); + if( pImpl ) { pImpl->CreateIfNotThere(); @@ -1555,12 +1588,15 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( if( !pContext ) { - - pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix, - rLocalName, xAttrList, - m_eDefaultAnchorType, - nFrameType, - m_xAttrList ); + pContext = new XMLTextFrameContext_Impl( + GetImport(), + p_nPrefix, + rLocalName, + xAttrList, + m_eDefaultAnchorType, + nFrameType, + m_xAttrList, + !getSupportsMultipleContents()); } m_xImplContext = pContext; @@ -1576,8 +1612,14 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( { // read another image pContext = new XMLTextFrameContext_Impl( - GetImport(), p_nPrefix, rLocalName, xAttrList, - m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList); + GetImport(), + p_nPrefix, + rLocalName, + xAttrList, + m_eDefaultAnchorType, + XML_TEXT_FRAME_GRAPHIC, + m_xAttrList, + false); m_xImplContext = pContext; addContent(*m_xImplContext); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index e2f807c2049b..c1eea8a7e53e 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2899,11 +2899,11 @@ void XMLTextParagraphExport::exportContour( if(bPixel) { - GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aPolyPolygonRange.getWidth()); + GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth())); } else { - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aPolyPolygonRange.getWidth()); + GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth())); } GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear()); @@ -2911,11 +2911,11 @@ void XMLTextParagraphExport::exportContour( // svg: height if(bPixel) { - GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aPolyPolygonRange.getHeight()); + GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight())); } else { - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aPolyPolygonRange.getHeight()); + GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight())); } GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear()); @@ -2943,7 +2943,8 @@ void XMLTextParagraphExport::exportContour( basegfx::tools::exportToSvgD( aPolyPolygon, true, // bUseRelativeCoordinates - false)); // bDetectQuadraticBeziers: not used in old, but maybe activated now + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible // write point array GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, aPolygonString); diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst index 45b6126c6cb4..cb7197e4085e 100644 --- a/xmlsecurity/prj/build.lst +++ b/xmlsecurity/prj/build.lst @@ -1,4 +1,4 @@ -xs xmlsecurity : L10N:l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL +xs xmlsecurity : L10N:l10n xmloff unotools offapi unoil svx LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL xs xmlsecurity usr1 - all xs_mkout NULL xs xmlsecurity\inc nmake - all xs_inc NULL xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL diff --git a/xmlsecurity/source/xmlsec/makefile.mk b/xmlsecurity/source/xmlsec/makefile.mk index 2b243e42904a..34088dc26979 100644 --- a/xmlsecurity/source/xmlsec/makefile.mk +++ b/xmlsecurity/source/xmlsec/makefile.mk @@ -37,11 +37,9 @@ ENABLE_EXCEPTIONS = TRUE CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) .ENDIF -.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES" -.IF "$(SYSTEM_MOZILLA)" != "YES" +.IF "$(ENABLE_NSS_MODULE)"!="YES" @all: - @echo "No mozilla -> no nss -> no libxmlsec -> no xmlsecurity.." -.ENDIF + @echo "No nss -> no libxmlsec -> no xmlsecurity.." .ENDIF .IF "$(CRYPTO_ENGINE)" == "mscrypto" diff --git a/xmlsecurity/source/xmlsec/nss/makefile.mk b/xmlsecurity/source/xmlsec/nss/makefile.mk index 18b07ce4707f..6ebf7375ace0 100644 --- a/xmlsecurity/source/xmlsec/nss/makefile.mk +++ b/xmlsecurity/source/xmlsec/nss/makefile.mk @@ -37,11 +37,9 @@ ENABLE_EXCEPTIONS = TRUE CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) .ENDIF -.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES" -.IF "$(SYSTEM_MOZILLA)" != "YES" +.IF "$(ENABLE_NSS_MODULE)"!="YES" @all: - @echo "No mozilla -> no nss -> no libxmlsec -> no xmlsecurity/nss" -.ENDIF + @echo "No nss -> no libxmlsec -> no xmlsecurity/nss" .ENDIF .IF "$(SYSTEM_MOZILLA)" != "YES" @@ -54,13 +52,6 @@ NSS_INC = $(MOZ_NSS_CFLAGS) NSPR_INC = $(MOZ_INC)$/nspr .ENDIF -.IF "$(GUI)"=="UNX" -.IF "$(COMNAME)"=="sunpro5" -CFLAGS += -features=tmplife -#This flag is needed to build mozilla 1.7 code -.ENDIF # "$(COMNAME)"=="sunpro5" -.ENDIF - .IF "$(GUI)" == "WNT" .IF "$(DBG_LEVEL)" == "0" INCPRE += \ @@ -118,11 +109,7 @@ SOLARINC += \ -I$(NSPR_INC) \ -I$(PRJ)$/source$/xmlsec -.IF "$(SYSTEM_MOZILLA)" == "YES" -SOLARINC += -DSYSTEM_MOZILLA $(NSS_INC) -.ELSE SOLARINC += -I$(NSS_INC) -.ENDIF SLOFILES = \ $(SLO)$/nssinitializer.obj \ diff --git a/xmlsecurity/tools/demo/makefile.mk b/xmlsecurity/tools/demo/makefile.mk index b3f3e70fb62c..df634072ea68 100644 --- a/xmlsecurity/tools/demo/makefile.mk +++ b/xmlsecurity/tools/demo/makefile.mk @@ -98,14 +98,6 @@ APP3STDLIBS+=$(SHARE_LIBS) APP3OBJS= $(SHARE_OBJS) $(OBJ)$/multisigdemo.obj # -# ---------- mozprofile ---------- -# -APP4TARGET=mozprofile -APP4DEPN=makefile.mk -APP4STDLIBS+=$(SHARE_LIBS) -APP4OBJS= $(SHARE_OBJS) $(OBJ)$/mozprofile.obj - -# # ---------- performance ---------- # APP5TARGET=performance @@ -137,8 +129,7 @@ REGISTERLIBS= \ dynamicloader.uno$(DLLPOST) \ namingservice.uno$(DLLPOST) \ bootstrap.uno$(DLLPOST) \ - sax.uno$(DLLPOST) \ - $(DLLPRE)mozab2$(DLLPOST) + sax.uno$(DLLPOST) $(BIN)$/demo.rdb: \ makefile.mk \ diff --git a/xmlsecurity/tools/demo/mozprofile.cxx b/xmlsecurity/tools/demo/mozprofile.cxx index 4ac31e991dbc..a5268905689e 100644 --- a/xmlsecurity/tools/demo/mozprofile.cxx +++ b/xmlsecurity/tools/demo/mozprofile.cxx @@ -33,7 +33,6 @@ #include <xmlsecurity/biginteger.hxx> #include <xmlsecurity/xmlsignaturehelper.hxx> -#include <com/sun/star/mozilla/XMozillaBootstrap.hpp> using namespace ::com::sun::star; diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk index e065fc0d894a..6c503269a07a 100644 --- a/xmlsecurity/util/makefile.mk +++ b/xmlsecurity/util/makefile.mk @@ -35,9 +35,9 @@ USE_DEFFILE=TRUE .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/target.pmk -.IF "$(WITH_MOZILLA)" == "NO" +.IF "$(ENABLE_NSS_MODULE)" != "YES" @all: - @echo "No mozilla -> no nss -> no libxmlsec -> no xmlsecurity..." + @echo "No nss -> no libxmlsec -> no xmlsecurity..." .ENDIF # --- Files -------------------------------------------------------- @@ -71,8 +71,6 @@ SHL2NAME=xsec_xmlsec SHL2TARGET= $(SHL2NAME) -.IF "$(ENABLE_NSS_MODULE)"=="YES" || "$(SYSTEM_MOZILLA)" == "YES" - SHL2LIBS= \ $(SLB)$/xs_comm.lib @@ -84,8 +82,6 @@ SHL2LIBS += \ SHL2LIBS += \ $(SLB)$/xs_nss.lib -.ENDIF - SHL2STDLIBS += \ $(SALLIB) \ @@ -102,7 +98,7 @@ SHL2STDLIBS += \ SHL2STDLIBS +=-ldl .ENDIF -.IF "$(SYSTEM_MOZILLA)" == "YES" +.IF "$(ENABLE_NSS_MODULE)"=="YES" && "$(SYSTEM_NSS)"!="YES" .IF "$(NSPR_LIB)" != "" SHL2STDLIBS += $(NSPR_LIB) .ENDIF |